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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
578f6215f1a94bc8fb180f10fb4713f9a9dba7bc | d562ca8e526722f2f864b2196b6cc8a016b7161c | /Swift_Animations/Swift_Animations/SceneDelegate.swift | 5674a65fa7204559b1775a9200b2d1de6f2d2f18 | [] | no_license | deepcodingios/Swift_Animations | 48d3ee436d74a0b15ee456b1e6d11d6f11373472 | a7364e93ee5e0d122cde3c0417c52cd16d0c0646 | refs/heads/main | 2023-07-04T23:50:12.359868 | 2021-07-25T09:20:02 | 2021-07-25T09:20:02 | 389,281,871 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,305 | swift | //
// SceneDelegate.swift
// Swift_Animations
//
// Created by Pradeep Reddy Kypa on 25/07/21.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
| [
393221,
163849,
393228,
393231,
393251,
352294,
344103,
393260,
393269,
213049,
376890,
385082,
393277,
376906,
327757,
254032,
368728,
180314,
254045,
180322,
376932,
286833,
286845,
286851,
417925,
262284,
360598,
286880,
377003,
377013,
164029,
327872,
180418,
377030,
377037,
377047,
418008,
418012,
377063,
327915,
205037,
393457,
393461,
393466,
418044,
385281,
336129,
262405,
180491,
336140,
164107,
262417,
368913,
262423,
377118,
377121,
262437,
254253,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
270687,
262497,
418145,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
393613,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
164362,
328207,
410129,
393748,
262679,
377372,
188959,
385571,
377384,
197160,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
385610,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
385671,
148106,
213642,
377485,
352919,
98969,
344745,
361130,
336556,
385714,
434868,
164535,
336568,
164539,
328379,
328387,
352969,
344777,
418508,
385743,
385749,
139998,
189154,
369382,
361196,
418555,
344832,
336644,
344837,
344843,
328462,
361231,
394002,
336660,
418581,
418586,
434971,
369436,
262943,
369439,
418591,
418594,
336676,
418600,
418606,
369464,
361274,
328516,
336709,
328520,
336712,
361289,
328523,
336715,
361300,
213848,
426842,
361307,
197469,
361310,
254813,
361318,
344936,
361323,
361335,
328574,
369544,
361361,
222129,
345036,
386004,
345046,
386012,
386019,
386023,
328690,
435188,
328703,
328710,
418822,
377867,
328715,
361490,
386070,
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,
337601,
403139,
337607,
419528,
419531,
272083,
394967,
419543,
419545,
345819,
419548,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
362274,
378664,
354107,
345916,
354112,
370504,
329545,
345932,
370510,
354132,
247639,
337751,
370520,
313181,
182110,
354143,
354157,
345965,
345968,
345971,
345975,
403321,
1914,
354173,
395148,
247692,
337809,
247701,
329625,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
346059,
247760,
346064,
346069,
419810,
329699,
354275,
190440,
354314,
346140,
436290,
395340,
378956,
436307,
338005,
100454,
329833,
329853,
329857,
329868,
411806,
329886,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
346317,
411862,
256214,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
387314,
436474,
321787,
379135,
411905,
411917,
379154,
395539,
387350,
387353,
338201,
182559,
338212,
395567,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
321911,
420237,
379279,
272787,
354728,
338353,
338382,
272849,
248279,
256474,
182755,
338404,
338411,
330225,
248309,
248332,
330254,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
191085,
338544,
346736,
191093,
346743,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
355029,
264919,
338661,
264942,
363252,
338680,
264965,
338701,
256787,
363294,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
355151,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
355185,
412600,
207809,
379849,
347082,
396246,
330711,
248794,
248799,
347106,
437219,
257009,
265208,
265215,
199681,
338951,
330761,
330769,
330775,
248863,
158759,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
248915,
183384,
339037,
412765,
257121,
322660,
265321,
248952,
420985,
330886,
330890,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
126148,
322763,
330959,
330966,
265433,
265438,
388320,
363757,
388348,
339199,
396552,
175376,
175397,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
126279,
437576,
437584,
331089,
437588,
331094,
396634,
175451,
437596,
429408,
175458,
175461,
175464,
265581,
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,
175637,
405017,
134689,
339504,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
224885,
224888,
224891,
224895,
372354,
126597,
421509,
224905,
11919,
224911,
224914,
126611,
224917,
224920,
126618,
208539,
224923,
224927,
224930,
224933,
257705,
224939,
224943,
257713,
224949,
257717,
257721,
224954,
257725,
224960,
257733,
224966,
224970,
257740,
224976,
257745,
339664,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
225013,
257788,
225021,
339711,
257791,
225027,
257796,
339722,
257802,
257805,
225039,
257808,
249617,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
397089,
257825,
225059,
339748,
225068,
257837,
413485,
225071,
225074,
257843,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
257869,
257872,
225105,
397140,
225109,
225113,
257881,
257884,
257887,
225120,
257891,
413539,
225128,
257897,
339818,
225138,
339827,
257909,
225142,
372598,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
372698,
372704,
372707,
356336,
380919,
393215,
372739,
405534,
266295,
266298,
217158,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
192640,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
250012,
225439,
135328,
192674,
225442,
438434,
225445,
438438,
225448,
438441,
356521,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
430275,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
356580,
225511,
217319,
225515,
225519,
381177,
397572,
389381,
381212,
356638,
356641,
356644,
356647,
266537,
389417,
356650,
356656,
332081,
307507,
340276,
356662,
397623,
332091,
225599,
201030,
348489,
332107,
151884,
430422,
348503,
332118,
250201,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
332162,
389507,
348548,
356741,
250239,
332175,
160152,
373146,
340380,
373149,
70048,
356783,
373169,
266688,
324032,
201158,
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,
348926,
389927,
348979,
152371,
348983,
340792,
398141,
357202,
389971,
357208,
389979,
430940,
357212,
357215,
439138,
201580,
201583,
349041,
340850,
381815,
430967,
324473,
398202,
119675,
340859,
324476,
430973,
324479,
340863,
324482,
373635,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
398246,
373672,
324525,
5040,
111539,
324534,
5047,
324539,
324542,
398280,
349129,
340940,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
349173,
381947,
201724,
349181,
431100,
431107,
349203,
209944,
209948,
357411,
250915,
250917,
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,
211161,
350426,
350449,
375027,
358645,
350459,
350462,
350465,
350469,
268553,
350477,
268560,
350481,
432406,
350487,
325915,
350491,
325918,
350494,
325920,
350500,
194854,
350505,
358701,
391469,
350510,
358705,
358714,
358717,
383307,
358738,
334162,
383331,
383334,
391531,
383342,
334204,
268669,
194942,
391564,
366991,
334224,
268702,
342431,
375209,
375220,
334263,
326087,
358857,
195041,
334312,
104940,
375279,
416255,
350724,
186898,
342546,
350740,
342551,
334359,
342555,
334364,
416294,
350762,
252463,
358962,
334386,
334397,
358973,
252483,
219719,
399957,
334425,
326240,
375401,
334466,
334469,
162446,
326291,
342680,
342685,
260767,
342711,
244410,
260798,
334530,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
64231,
113389,
342769,
203508,
375541,
342777,
391938,
391949,
375569,
326417,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
326452,
326455,
375613,
244542,
326463,
375616,
326468,
342857,
326474,
326479,
326486,
416599,
342875,
244572,
326494,
433001,
400238,
326511,
211826,
211832,
392061,
351102,
359296,
252801,
260993,
351105,
400260,
211846,
342921,
342931,
252823,
400279,
392092,
400286,
252838,
359335,
211885,
252846,
400307,
351169,
359362,
351172,
170950,
187335,
326599,
359367,
359383,
359389,
383968,
343018,
359411,
261109,
261112,
244728,
383999,
261130,
261148,
359452,
211999,
261155,
261160,
261166,
359471,
375868,
343132,
384099,
384102,
384108,
367724,
187503,
343155,
384115,
212095,
351366,
384136,
384140,
384144,
351382,
384152,
384158,
384161,
351399,
384169,
367795,
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,
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
] |
305f012217c84659802d9071a00879bcb9cafe09 | 800f93048f88427d8c7823b1b555f3b1c9e916a3 | /GarlandCollectionDemo/SecondViewController.swift | 970048cf79ec4682c048d7534e2d4f21e9904900 | [
"MIT"
] | permissive | devendranrajesh/garland-view | b41db6c9eb4b133a88a5ff3ad3713344f15f7a89 | 097f27b45777a777d6668a0b7a49770ef1332d5a | refs/heads/master | 2021-08-16T09:44:18.584112 | 2017-11-19T14:15:35 | 2017-11-19T14:15:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,892 | swift | //
// SecondViewController.swift
// GarlandView
//
// Created by Slava Yusupov.
// Copyright © 2017 Ramotion. All rights reserved.
//
import Foundation
import UIKit
import GarlandView
class SecondViewController: GarlandViewController {
var collectionView: UICollectionView!
override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override func viewDidLoad() {
super.viewDidLoad()
self.transitioningDelegate = self
self.modalPresentationStyle = .custom
let nib = UINib(nibName: "CollectionCell", bundle: nil)
collectionView = garlandView.collectionView
collectionView.register(nib, forCellWithReuseIdentifier: "Cell")
collectionView.backgroundColor = .clear
self.collectionView.delegate = self
self.collectionView.dataSource = self
self.view.addSubview(collectionView)
let panGesture = UIPanGestureRecognizer(target: self, action: #selector(handleGesture))
self.view.addGestureRecognizer(panGesture)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func handleGesture(gesture: UIPanGestureRecognizer) {
let velocity = gesture.velocity(in: self.view)
let translation = gesture.translation(in: self.view)
let firstViewController = ViewController.init(nibName: "ViewController", bundle: nil)
if velocity.x > 0, translation.x > 20, !isPresenting {
isPresenting = true
print("panning right")
firstViewController.animationXDest = UIScreen.main.bounds.width
present(firstViewController, animated: true, completion: nil)
} else if translation.x < -20, !isPresenting {
print("panning left")
isPresenting = true
present(firstViewController, animated: true, completion: nil)
}
}
}
extension SecondViewController: UICollectionViewDataSource, UICollectionViewDelegate {
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 30
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as? CollectionCell else { return UICollectionViewCell() }
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
self.selectedCardIndex = indexPath
let cardController = UserCardViewController.init(nibName: "UserCardViewController", bundle: nil)
present(cardController, animated: true, completion: nil)
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let startOffset = (collectionView.contentOffset.y + GarlandConfig.shared.cardsSpacing + GarlandConfig.shared.cardsSize.height) / GarlandConfig.shared.cardsSize.height
let maxHeight: CGFloat = 1.0
let minHeight: CGFloat = 0.5
let divided = startOffset / 3
let height = max(minHeight, min(maxHeight, 1.0 - divided))
headerView.frame.size.height = GarlandConfig.shared.cardsSize.height*height
}
}
| [
-1
] |
8035ca2ab7645b60e628ea32a2f33ad95bee8dab | 031aa70fb25b8f810a7855bafc05a63198651e05 | /iOS8bookExamples/bk1ch01p015yourFirstInstance/bk1ch01p015yourFirstInstance/ViewController.swift | 7eb320bb50331b2a22d09dc3b112db0c82b9e688 | [] | no_license | CaiJianWeiAndLiuHua/Programming-iOS-Book-Examples-master | c73e9130e43c7335f418965f82cb2adac1d871e7 | 4a6483414e35c5163e94341514d9c3e40c640fc5 | refs/heads/master | 2021-01-17T10:52:28.126237 | 2016-06-22T06:43:52 | 2016-06-22T06:43:52 | 61,695,392 | 3 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 397 | swift |
import UIKit
class Dog {
func bark() {
println("woof")
}
}
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let fido = Dog()
fido.bark()
// Dog.bark() // error: no, it's an _instance_ method
// think the error message is weird? see the explanation on p. 127
}
}
| [
-1
] |
d5353c7f5d2e2e7fc0c4b62af0b159b261f57a8a | 23d7f1ba712d5bf8482a07506c38b6cab48ee281 | /Landmarks/Views/ContentView.swift | d2682ea9fe79de679b76b4e2d8ee800e545afd2a | [] | no_license | lkusam/Landmarks | 5c8a83b8c0e0c69415451428597d118f084ee701 | 40e416c741f6ca5c8f014c7bdaaba2f0e9389a78 | refs/heads/main | 2023-02-15T11:32:31.542932 | 2021-01-10T04:06:33 | 2021-01-10T04:06:33 | 328,295,625 | 0 | 0 | null | 2021-01-10T04:06:34 | 2021-01-10T03:31:21 | Swift | UTF-8 | Swift | false | false | 1,054 | swift | /*
See LICENSE folder for this sample’s licensing information.
Abstract:
A view showing the list of landmarks.
*/
import SwiftUI
struct ContentView: View {
@State private var selection: Tab = .featured
enum Tab {
case featured
case list
}
var body: some View {
TabView(selection: $selection){
CategoryHome()
.tabItem { Label("Featured", systemImage: "star") }
.tag(Tab.featured)
LandmarkList()
.tabItem {
Label("List", systemImage: "list.bullet")
}
.tag(Tab.list)
Text("Hello man")
.foregroundColor(.green)
.tabItem { Label("Man this is text", systemImage: "phone.circle.fill" )
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
.environmentObject(ModelData())
}
}
| [
372896,
372805,
377509,
363388,
421183
] |
0c638a3faefcb3a5c0c7c115fc49b3de40671cce | ce09cf59ed8ed7a5bd91fb973f87905533120049 | /SampleAppUITests/SampleAppUITests.swift | 63366dbf6a2845d14d152aa68632fe50b512e14f | [] | no_license | abhinaycb/CustomTextField | dc9ddd57e692cacaae9e82a76c1e7371edafc2ad | cf2fc809b9aff015f6af7101b76878f6f0d10d42 | refs/heads/master | 2020-03-22T15:54:16.744795 | 2018-07-09T13:18:59 | 2018-07-09T13:18:59 | 140,288,199 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,251 | swift | //
// SampleAppUITests.swift
// SampleAppUITests
//
// Created by Coffeebeans on 06/07/18.
// Copyright © 2018 Coffeebeans. All rights reserved.
//
import XCTest
class SampleAppUITests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
| [
333827,
243720,
282634,
313356,
155665,
305173,
241695,
237599,
292901,
223269,
315431,
354342,
102441,
354346,
325675,
278571,
229414,
124974,
102446,
282671,
229425,
315433,
243763,
321589,
241717,
180279,
215095,
229431,
319543,
213051,
288829,
325695,
286787,
288835,
307269,
237638,
239689,
233548,
315468,
311373,
196687,
278607,
354386,
315477,
223317,
323678,
315488,
321632,
45154,
280676,
313446,
215144,
217194,
194667,
233578,
278637,
307306,
319599,
288878,
278642,
284789,
131190,
249976,
288890,
215165,
194692,
235661,
278669,
241809,
323730,
278676,
311447,
153752,
327834,
284827,
329884,
278684,
299166,
278690,
233635,
311459,
215204,
284840,
299176,
184489,
284843,
278698,
278703,
184498,
278707,
125108,
180409,
280761,
278713,
223418,
227517,
258233,
295099,
299197,
280767,
299202,
139459,
309443,
176325,
131270,
227525,
299208,
301255,
280779,
233678,
282832,
321744,
227536,
301270,
301271,
229591,
280792,
356575,
311520,
325857,
280803,
182503,
338151,
307431,
295147,
317676,
286957,
125166,
125170,
313595,
125180,
184574,
125184,
309504,
125192,
217352,
125200,
194832,
227601,
325904,
125204,
319764,
278805,
334104,
315674,
282908,
311582,
125215,
282912,
233761,
278817,
299294,
211239,
282920,
125225,
317738,
325930,
311596,
321839,
315698,
98611,
125236,
307514,
278843,
282938,
168251,
287040,
319812,
311622,
227655,
280903,
323914,
201037,
282959,
229716,
289109,
168280,
379224,
323934,
239973,
381286,
285031,
416103,
280938,
242027,
242028,
321901,
278895,
354672,
287089,
227702,
199030,
315768,
315769,
139641,
223611,
291193,
248188,
313726,
211327,
291200,
311679,
240003,
158087,
313736,
227721,
242059,
285074,
227730,
240020,
190870,
315798,
190872,
291225,
285083,
293275,
317851,
242079,
227743,
285089,
289185,
283039,
293281,
156069,
305572,
301482,
289195,
311723,
377265,
338359,
299449,
311739,
319931,
293309,
278974,
311744,
317889,
291266,
278979,
278988,
289229,
281038,
326093,
278992,
283089,
373196,
281039,
283088,
279000,
242138,
176602,
285152,
369121,
279009,
160224,
195044,
291297,
279014,
242150,
319976,
279017,
311787,
281071,
319986,
236020,
279030,
311800,
279033,
317949,
279042,
283138,
233987,
287237,
377352,
342537,
309770,
279053,
283154,
303635,
303634,
279061,
182802,
279060,
188954,
279066,
322077,
291359,
227881,
293420,
289328,
283185,
236080,
279092,
23093,
234037,
244279,
338491,
301635,
309831,
55880,
322119,
377419,
303693,
281165,
301647,
281170,
326229,
309847,
189016,
287319,
115287,
111197,
295518,
287327,
242274,
244326,
279143,
279150,
281200,
287345,
313970,
287348,
301688,
189054,
287359,
291455,
297600,
303743,
301702,
164487,
279176,
311944,
334473,
316044,
311948,
311950,
184974,
316048,
311953,
336531,
287379,
295575,
227991,
289435,
303772,
221853,
205469,
285348,
314020,
279207,
295591,
248494,
318127,
293552,
285360,
285362,
299698,
287412,
166581,
295598,
154295,
342705,
287418,
314043,
303802,
66243,
291529,
287434,
225996,
363212,
287438,
242385,
303826,
279249,
279253,
158424,
230105,
299737,
342757,
295653,
289511,
230120,
330473,
234216,
285419,
330476,
289517,
279278,
170735,
215790,
312046,
125683,
230133,
199415,
234233,
279293,
205566,
289534,
291584,
299777,
322302,
285443,
228099,
291591,
295688,
346889,
285450,
322312,
312076,
285457,
295698,
166677,
283418,
285467,
221980,
281378,
234276,
283431,
262952,
262953,
279337,
318247,
318251,
262957,
293673,
164655,
328495,
289580,
301872,
242481,
234290,
303921,
230198,
285493,
285496,
301883,
201534,
281407,
222017,
295745,
293702,
283466,
281426,
279379,
295769,
201562,
281434,
234330,
322396,
230238,
275294,
301919,
230239,
279393,
293729,
349025,
303973,
279398,
281444,
177002,
242540,
242542,
310132,
295797,
201590,
207735,
228214,
295799,
177018,
269179,
279418,
308093,
314240,
291713,
158594,
330627,
240517,
287623,
228232,
416649,
279434,
236427,
320394,
316299,
299912,
189327,
308111,
308113,
234382,
293780,
310166,
289691,
209820,
240543,
283551,
310177,
289699,
189349,
289704,
279465,
293801,
304050,
177074,
289723,
189373,
213956,
281541,
345030,
19398,
213961,
326602,
279499,
56270,
191445,
183254,
304086,
234469,
340967,
314343,
304104,
324587,
183276,
289773,
203758,
320492,
234476,
320495,
287730,
240631,
320504,
214009,
312313,
312317,
234499,
293894,
320520,
230411,
320526,
330766,
234513,
238611,
140311,
293911,
238617,
316441,
197658,
330789,
248871,
113710,
189487,
281647,
322609,
312372,
203829,
238646,
300087,
238650,
320571,
21567,
308288,
336962,
160834,
314437,
349254,
238663,
300109,
207954,
234578,
205911,
296023,
314458,
281698,
281699,
230500,
285795,
322664,
228457,
279659,
318571,
300145,
238706,
279666,
230514,
187508,
312435,
302202,
285819,
314493,
285823,
150656,
234626,
279686,
222344,
285833,
318602,
285834,
234635,
228492,
337037,
177297,
162962,
187539,
308375,
296091,
119965,
302239,
330912,
300192,
234655,
306339,
339106,
234662,
300200,
249003,
208044,
238764,
3243,
294069,
300215,
294075,
339131,
228541,
64699,
283841,
148674,
283846,
312519,
279752,
283849,
148687,
290001,
189651,
316628,
279766,
189656,
279775,
304352,
298209,
304353,
310496,
279780,
228587,
279789,
290030,
302319,
251124,
234741,
316661,
283894,
279803,
292092,
208123,
228608,
320769,
234756,
322826,
242955,
177420,
312588,
318732,
126229,
245018,
320795,
318746,
320802,
304422,
130342,
130344,
298290,
312628,
345398,
300342,
159033,
222523,
286012,
181568,
279872,
279874,
300355,
216387,
294210,
300354,
193858,
372039,
304457,
345418,
230730,
294220,
296269,
234830,
224591,
222542,
238928,
296274,
314708,
318804,
283990,
314711,
357720,
300378,
300379,
316764,
294236,
314721,
292194,
230757,
281958,
314727,
134504,
306541,
314734,
284015,
234864,
296304,
316786,
327023,
314740,
312688,
314742,
327030,
230772,
314745,
290170,
310650,
224637,
306558,
290176,
243073,
179586,
294278,
314759,
296328,
296330,
298378,
368012,
314765,
318860,
304523,
292242,
279955,
306580,
224662,
234902,
282008,
314776,
318876,
282013,
290206,
148899,
314788,
314790,
282023,
333224,
298406,
241067,
279980,
314797,
279979,
286128,
173492,
279988,
286133,
310714,
284090,
228796,
302523,
54719,
415170,
292291,
228804,
280003,
306630,
302530,
300488,
370122,
339403,
310731,
300490,
306634,
310735,
234957,
312785,
327122,
280011,
280020,
222674,
280025,
310747,
144862,
286176,
320997,
310758,
187877,
280042,
280043,
191980,
300526,
282097,
308722,
296434,
306678,
40439,
191991,
288248,
286201,
300539,
288252,
312830,
290304,
228868,
323079,
218632,
292359,
230922,
302602,
323083,
294413,
329231,
304655,
323088,
282132,
230933,
302613,
282135,
316951,
374297,
302620,
313338,
222754,
282147,
306730,
312879,
230960,
288305,
239159,
290359,
323132,
157246,
288319,
288322,
280131,
349764,
310853,
124486,
282182,
288328,
286281,
292426,
194118,
224848,
224852,
290391,
196184,
239192,
306777,
128600,
235096,
212574,
99937,
204386,
323171,
345697,
300643,
282214,
300645,
204394,
224874,
243306,
206447,
310896,
294517,
314997,
288377,
290425,
325246,
333438,
235136,
280193,
282244,
288391,
323208,
282248,
286344,
179853,
286351,
188049,
239251,
229011,
280217,
323226,
179868,
229021,
302751,
282272,
198304,
245413,
282279,
298664,
212649,
298666,
317102,
286387,
337590,
286392,
302778,
306875,
280252,
280253,
282302,
296636,
286400,
323265,
321217,
280259,
333508,
282309,
323262,
296649,
239305,
306891,
280266,
212684,
302798,
9935,
241360,
282321,
333522,
286419,
241366,
280279,
282330,
18139,
280285,
294621,
282336,
325345,
321250,
294629,
153318,
333543,
12009,
282347,
288492,
282349,
323315,
67316,
34547,
284410,
288508,
200444,
282366,
286463,
319232,
288515,
280326,
282375,
323335,
284425,
300810,
116491,
282379,
280333,
216844,
284430,
161553,
124691,
284436,
278292,
278294,
282390,
116502,
118549,
325403,
321308,
321309,
282399,
241440,
282401,
325411,
186148,
186149,
315172,
241447,
294699,
286507,
284460,
280367,
300849,
282418,
280373,
282424,
280377,
321338,
282428,
280381,
345918,
241471,
413500,
280386,
325444,
280391,
153416,
325449,
315209,
159563,
280396,
307024,
337746,
317268,
325460,
307030,
237397,
18263,
188250,
284508,
237411,
284515,
276326,
282471,
296807,
292713,
282476,
292719,
313200,
296815,
313204,
317305,
124795,
317308,
339840,
182145,
315265,
280451,
325508,
333700,
243590,
282503,
67464,
188293,
305032,
315272,
325514,
315275,
243592,
184207,
311183,
124816,
282517,
294806,
214936,
337816,
294808,
329627,
239515,
124826,
214943,
298912,
319393,
294820,
219046,
333734,
294824,
298921,
284584,
313257,
292783,
126896,
200628,
300983,
343993,
288698,
98240,
294849,
214978,
280517,
280518,
214983,
282572,
282573,
153553,
24531,
231382,
329696,
323554,
292835,
190437,
292838,
294887,
317416,
313322,
278507,
329707,
311277,
296942,
298987,
124912,
327666,
278515,
325620,
239610
] |
a60b7d3bbfb105e09d04496d86c720c22ff9d67c | 4a2e35a15a2d772694543f2111527230caf50864 | /Sources/Services/Keychain/KeychainServiceError.swift | 1688465025efd88bfced91eb92c48790467e36ca | [
"MIT"
] | permissive | noxt/Groshy-SwiftUI | 79e9d81defa98b1f49d0c3ea4b450a4f10f80175 | 190f75f04ff6a6d6a2f75b97742d33b50f96ecbe | refs/heads/master | 2020-08-09T07:39:54.047944 | 2020-01-22T15:13:35 | 2020-01-22T15:13:35 | 214,038,307 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 285 | swift | //
// Created by Dmitry Ivanenko on 16.11.2019.
// Copyright © 2019 Dmitry Ivanenko. All rights reserved.
//
import Foundation
enum KeychainServiceError: Error {
case encodingError
case decodingError
case savingError
case gettingError
case deletingError
}
| [
-1
] |
e225734a66a4e63f92781f537606dc91610be943 | 700f78a3ad6d4700ca8cd3ac4e80e1bfb5896ee0 | /Castle guide/Controller/WebViewController.swift | 5ce7528a51e78f5f2be0769d99e25e9cb4d61623 | [] | no_license | doupi0331/Castle-guide | 02a6733df3d79afcd69c098209093f106abc9f31 | a8dd47a913928e14484c551247343d4d9bed4293 | refs/heads/master | 2021-08-07T22:52:03.086741 | 2017-11-09T05:03:14 | 2017-11-09T05:03:14 | 110,069,634 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 773 | swift | //
// WebViewController.swift
// Castle guide
//
// Created by Yi-Yun Chen on 2017/11/9.
// Copyright © 2017年 Yi-Yun Chen. All rights reserved.
//
import UIKit
class WebViewController: UIViewController {
@IBOutlet weak var webView: UIWebView!
var webside = ""
override func viewDidLoad() {
super.viewDidLoad()
webside = HOTELS[self.view.tag].webside
if let url = URL(string: webside) {
let request = URLRequest(url: url)
webView.loadRequest(request)
}
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
-1
] |
0bcb51c2c3fe8d6cc25bc012348816def5b883e7 | 5f36d6140bf1c432c5ec6dca9759827489bd09da | /viewusingmodelclass/viewusingmodelclassTests/viewusingmodelclassTests.swift | db82940545f01c4e6e3df7660f580a4a0760bdc7 | [] | no_license | hetalAcharya/Dummy | 9c2599f1ac5cbfbf90e95180a870016c02b5a3ea | 182edce1bd39d251472bf1b0a3347f6c61f1bcaa | refs/heads/master | 2020-04-07T02:07:35.236738 | 2018-11-17T08:26:47 | 2018-11-17T08:26:47 | 157,964,714 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,005 | swift | //
// viewusingmodelclassTests.swift
// viewusingmodelclassTests
//
// Created by Kush on 13/07/17.
// Copyright © 2017 bansi. All rights reserved.
//
import XCTest
@testable import viewusingmodelclass
class viewusingmodelclassTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
360462,
98333,
278558,
16419,
229413,
204840,
278570,
344107,
155694,
253999,
229424,
229430,
319542,
163896,
180280,
213052,
376894,
286788,
352326,
311372,
311374,
196691,
278615,
385116,
237663,
254048,
319591,
278634,
221290,
319598,
352368,
204916,
131191,
237689,
131198,
278655,
311438,
278677,
196760,
426138,
278685,
311458,
278691,
49316,
278699,
32941,
278704,
377009,
278708,
131256,
278714,
295098,
139479,
254170,
229597,
311519,
205035,
286958,
327929,
344313,
147717,
368905,
278797,
180493,
254226,
368916,
262421,
377114,
278816,
237856,
237857,
311597,
98610,
180535,
336183,
278842,
287041,
139589,
319813,
319821,
254286,
344401,
377169,
368981,
155990,
368984,
106847,
98657,
270701,
246127,
270706,
139640,
246136,
246137,
311681,
311685,
106888,
385417,
385422,
213403,
385454,
377264,
278970,
311738,
33211,
319930,
336317,
336320,
311745,
278978,
254406,
188871,
278989,
278993,
278999,
328152,
369116,
188894,
287198,
279008,
279013,
279018,
311786,
319981,
279029,
254456,
279032,
377338,
377343,
279039,
254465,
287241,
279050,
139792,
303636,
393751,
279065,
377376,
180771,
377386,
197167,
385588,
279094,
352829,
115270,
385615,
426576,
369235,
295519,
139872,
66150,
344680,
279146,
295536,
287346,
139892,
287352,
344696,
279164,
189057,
311941,
336518,
311945,
369289,
344715,
279177,
311949,
287374,
377489,
311954,
352917,
230040,
271000,
377497,
303771,
377500,
205471,
344738,
139939,
279206,
295590,
287404,
205487,
295599,
303793,
336564,
164533,
287417,
287422,
66242,
377539,
287439,
164560,
385747,
279252,
361176,
418520,
287452,
295652,
279269,
369385,
279280,
312052,
230134,
172792,
344827,
221948,
205568,
295682,
197386,
434957,
295697,
426774,
197399,
426775,
336671,
344865,
197411,
279336,
262954,
295724,
312108,
197422,
353070,
164656,
295729,
303920,
262962,
353069,
328499,
353078,
230199,
197431,
353079,
336702,
295746,
353094,
353095,
353109,
377686,
230234,
189275,
435039,
295776,
279392,
303972,
385893,
230248,
246641,
246643,
295798,
246648,
279417,
361337,
254850,
369538,
287622,
295824,
189348,
279464,
353195,
140204,
377772,
353197,
304051,
230332,
189374,
377790,
353215,
353216,
213957,
213960,
345033,
279498,
386006,
418776,
50143,
123881,
304110,
320494,
287731,
271350,
295927,
304122,
320507,
328700,
328706,
410627,
320516,
295942,
386056,
353290,
230410,
377869,
320527,
238610,
418837,
140310,
197657,
336929,
189474,
369701,
345132,
238639,
312373,
238651,
377926,
238664,
296019,
353367,
156764,
156765,
304222,
279660,
173166,
377972,
353397,
279672,
377983,
279685,
402565,
222343,
386189,
296086,
238743,
296092,
238765,
279728,
238769,
402613,
230588,
279747,
353479,
353481,
402634,
353482,
279760,
189652,
279765,
189653,
419029,
148696,
296153,
279774,
304351,
304356,
222440,
279785,
328940,
279792,
353523,
386294,
386301,
320770,
386306,
279814,
328971,
312587,
353551,
173334,
320796,
222494,
304421,
279854,
353584,
345396,
386359,
116026,
378172,
222524,
279875,
304456,
230729,
312648,
337225,
296270,
238927,
353616,
296273,
222559,
378209,
230756,
386412,
230765,
296303,
279920,
312689,
296307,
116084,
337281,
148867,
378244,
296329,
296335,
9619,
370071,
279974,
279984,
173491,
304564,
279989,
353719,
361927,
296392,
280010,
370123,
148940,
280013,
312782,
222675,
353750,
280032,
271843,
280041,
361963,
296433,
321009,
280055,
288249,
230913,
329225,
230921,
296461,
304656,
329232,
370197,
230943,
402985,
394794,
230959,
288309,
312889,
288318,
280130,
124485,
288326,
288327,
239198,
99938,
312940,
222832,
247416,
337534,
337535,
263809,
239237,
288392,
239250,
419478,
345752,
255649,
337591,
321207,
296632,
280251,
280257,
321219,
280267,
403148,
9936,
9937,
370388,
272085,
345814,
280278,
280280,
18138,
67292,
345821,
321247,
321249,
345833,
345834,
280300,
239341,
67315,
173814,
313081,
124669,
288512,
288516,
280327,
280329,
321302,
345879,
116505,
321310,
255776,
247590,
362283,
378668,
280366,
296755,
280372,
321337,
280380,
345919,
436031,
403267,
280390,
345929,
304977,
18262,
362327,
280410,
370522,
345951,
362337,
345955,
296806,
288619,
288620,
214895,
313199,
362352,
313203,
124798,
182144,
305026,
67463,
329622,
337815,
124824,
214937,
214938,
436131,
354212,
436137,
362417,
124852,
288697,
362431,
214977,
280514,
280519,
214984,
362443,
247757,
231375,
280541,
329695,
436191,
313319,
337895,
247785,
296941,
436205,
362480,
313339,
43014,
354316,
313357,
182296,
354345,
223274,
124975,
215089,
346162,
124984,
288828,
436285,
288833,
288834,
436292,
403525,
436301,
338001,
354385,
338003,
223316,
280661,
329814,
338007,
354393,
280675,
280677,
43110,
313447,
321637,
436329,
288879,
223350,
280694,
215164,
313469,
215166,
280712,
215178,
346271,
436383,
362659,
239793,
125109,
182456,
280762,
223419,
379071,
149703,
338119,
280778,
346314,
321745,
280795,
387296,
280802,
379106,
338150,
346346,
321772,
125169,
338164,
436470,
125183,
149760,
411906,
125188,
313608,
125193,
125198,
272658,
125203,
125208,
305440,
125217,
338218,
321840,
379186,
125235,
280887,
125240,
321860,
280902,
182598,
289110,
215385,
272729,
379225,
321894,
280939,
313713,
354676,
436608,
362881,
240002,
436611,
248194,
395659,
395661,
108944,
240016,
190871,
149916,
420253,
141728,
289189,
289194,
108972,
272813,
338356,
436661,
281040,
289232,
256477,
281072,
109042,
174593,
420369,
289304,
207393,
182817,
289332,
174648,
338489,
338490,
322120,
281166,
281171,
297560,
354911,
436832,
436834,
191082,
313966,
281199,
420463,
346737,
313971,
346740,
420471,
330379,
330387,
117396,
346772,
330388,
264856,
289434,
346779,
338613,
166582,
314040,
158394,
363211,
363230,
289502,
264928,
338662,
330474,
346858,
289518,
199414,
35583,
363263,
322313,
117517,
322319,
166676,
207640,
289576,
191283,
273207,
355130,
289598,
281408,
420677,
281427,
281433,
330609,
207732,
158593,
240518,
224145,
355217,
256922,
289690,
289698,
420773,
289703,
363438,
347055,
289727,
273344,
330689,
363458,
379844,
19399,
338899,
248796,
248797,
207838,
347103,
314342,
289774,
183279,
347123,
314355,
240630,
314362,
257024,
330754,
134150,
322570,
330763,
281626,
248872,
322612,
314448,
339030,
281697,
314467,
281700,
257125,
322663,
273515,
207979,
404593,
363641,
363644,
150657,
248961,
330888,
363669,
339100,
380061,
429214,
199839,
339102,
306338,
265379,
249002,
306346,
3246,
421048,
339130,
265412,
290000,
298208,
298212,
298213,
330984,
298221,
298228,
216315,
208124,
363771,
388349,
437505,
322824,
257305,
126237,
339234,
372009,
412971,
306494,
216386,
224586,
372043,
331090,
314710,
372054,
159066,
314720,
281957,
380271,
314739,
208244,
249204,
290173,
306559,
314751,
298374,
314758,
314760,
142729,
388487,
314766,
306579,
282007,
290207,
314783,
314789,
282022,
314791,
282024,
396711,
396712,
241066,
380337,
380338,
150965,
380357,
339398,
306631,
306639,
413137,
429542,
191981,
306673,
306677,
290300,
290301,
282114,
372227,
306692,
306693,
323080,
323087,
282129,
175639,
282136,
388632,
396827,
282141,
134686,
282146,
306723,
347694,
290358,
265798,
282183,
265804,
396882,
290390,
44635,
396895,
323172,
282213,
323178,
224883,
314998,
323196,
175741,
339584,
224901,
282245,
282246,
290443,
323217,
282259,
298654,
282271,
282273,
282276,
298661,
323236,
290471,
282280,
298667,
224946,
110268,
224958,
282303,
274115,
306890,
241361,
298712,
298720,
12010,
282348,
282358,
175873,
339715,
323331,
323332,
339720,
372496,
323346,
249626,
282400,
339745,
241441,
257830,
421672,
282417,
282427,
282434,
307011,
315202,
282438,
307025,
413521,
216918,
307031,
241495,
282480,
241528,
339841,
241540,
282504,
315273,
315274,
110480,
184208,
372626,
380821,
282518,
282519,
118685,
298909,
298920,
323507,
290745,
274371,
151497,
372701,
298980,
380908,
290811,
282633,
241692,
102437,
315432,
233517,
102445,
176175,
241716,
225351,
315465,
315476,
307289,
200794,
315487,
356447,
307299,
438377,
315498,
299121,
233589,
233590,
266357,
422019,
241808,
381073,
323729,
233636,
299174,
233642,
405687,
184505,
299198,
258239,
389313,
299203,
299209,
372941,
282831,
266449,
356576,
176362,
307435,
438511,
381172,
184570,
356602,
184575,
184584,
381208,
299293,
151839,
233762,
217380,
151847,
282919,
332083,
332085,
332089,
315706,
282939,
307517,
241986,
438596,
332101,
323913,
348492,
323916,
323920,
250192,
348500,
168281,
332123,
323935,
332127,
242023,
242029,
160110,
242033,
291192,
340357,
225670,
242058,
373134,
291224,
242078,
283038,
61857,
315810,
381347,
61859,
315811,
340398,
299441,
61873,
283064,
61880,
299456,
127427,
127428,
283075,
324039,
373197,
176601,
242139,
160225,
242148,
291311,
233978,
291333,
348682,
340490,
283153,
258581,
291358,
283182,
283184,
234036,
315960,
348732,
242237,
70209,
348742,
70215,
348749,
381517,
332378,
201308,
111208,
184940,
373358,
389745,
209530,
373375,
152195,
348806,
152203,
184973,
316049,
111253,
316053,
111258,
111259,
176808,
299699,
299700,
422596,
422599,
291530,
225995,
242386,
422617,
422626,
234217,
299759,
299770,
234234,
299776,
291585,
242433,
430849,
291592,
62220,
422673,
430865,
291604,
422680,
234277,
283430,
152365,
422703,
422709,
152374,
234294,
242485,
160571,
430910,
160575,
160580,
299849,
283467,
381773,
201551,
242529,
349026,
357218,
275303,
177001,
308076,
242541,
209783,
209785,
177019,
185211,
308092,
398206,
291712,
381829,
316298,
308107,
308112,
349072,
234386,
209817,
324506,
324507,
390045,
185250,
324517,
283558,
185254,
373687,
349121,
373706,
316364,
340955,
340961,
324586,
340974,
316405,
349175,
201720,
127992,
357379,
234500,
324625,
234514,
308243,
316437,
201755,
300068,
357414,
300084,
324666,
308287,
21569,
218186,
300111,
234577,
341073,
439384,
234587,
250981,
300135,
300136,
316520,
357486,
316526,
144496,
300146,
300150,
300151,
291959,
160891,
341115,
300158,
349316,
349318,
234638,
373903,
169104,
177296,
308372,
185493,
119962,
300187,
300188,
234663,
300201,
300202,
373945,
283840,
259268,
283847,
62665,
283852,
283853,
259280,
316627,
333011,
357595,
234733,
234742,
292091,
128251,
316669,
234755,
439562,
292107,
242954,
414990,
251153,
177428,
349462,
382258,
300343,
382269,
193859,
300359,
234827,
177484,
406861,
259406,
234831,
251213,
120148,
283991,
374109,
234850,
292195,
333160,
284014,
243056,
316787,
111993,
357762,
112017,
234898,
259475,
275859,
112018,
357786,
251298,
333220,
316842,
374191,
210358,
284089,
292283,
415171,
300487,
300489,
284107,
366037,
210390,
210391,
210393,
144867,
54765,
251378,
308723,
300535,
300536,
300542,
210433,
366083,
292356,
259599,
316946,
308756,
398869,
374296,
374299,
308764,
349726,
431649,
349741,
169518,
431663,
194110,
235070,
349763,
218696,
292425,
243274,
128587,
333388,
333393,
300630,
128599,
235095,
333408,
300644,
374372,
317032,
415338,
243307,
54893,
325231,
366203,
325245,
194180,
415375,
153251,
300714,
210603,
415420,
333503,
218819,
259781,
333517,
333520,
333521,
333523,
325346,
153319,
325352,
284401,
300794,
325371,
194303,
194304,
300811,
284429,
243472,
366360,
284442,
325404,
325410,
341796,
399147,
431916,
300848,
317232,
259899,
325439,
153415,
341836,
415567,
325457,
317269,
341847,
284507,
350044,
128862,
300894,
284512,
284514,
276327,
292712,
325484,
423789,
292720,
325492,
276341,
300918,
341879,
317304,
333688,
194429,
112509,
55167,
325503,
333701,
243591,
243597,
325518,
333722,
350109,
300963,
292771,
415655,
333735,
284587,
292782,
243637,
301008,
153554,
194515,
219101,
292836,
292837,
317415,
325619,
432116,
333817,
292858,
415741,
333828,
358410,
399373,
317467,
145435,
292902,
227370,
325674,
129076,
243767,
358456,
309345,
227428,
194666,
260207,
432240,
284788,
333940,
292992,
194691,
227460,
333955,
415881,
104587,
235662,
325776,
317587,
284826,
333991,
333992,
284842,
301251,
309444,
227548,
194782,
301279,
317664,
243962,
375039,
309503,
375051,
325905,
325912,
309529,
211235,
432421,
211238,
358703,
358709,
260418,
6481,
366930,
366929,
6489,
391520,
383332,
383336,
416104,
285040,
211326,
317831,
227725,
227726,
252308,
317852,
121245,
285090,
375207,
342450,
293303,
293310,
416197,
129483,
342476,
317901,
326100,
285150,
227809,
342498,
358882,
334309,
195045,
391655,
432618,
375276,
293367,
342536,
342553,
416286,
375333,
293419,
244269,
375343,
236081,
23092,
375351,
244281,
301638,
309830,
293448,
55881,
416341,
244310,
416351,
268899,
39530,
301689,
244347,
326287,
375440,
334481,
227990,
318106,
318107,
342682,
285361,
342706,
318130,
293556,
383667,
342713,
285373,
39614,
154316,
96984,
318173,
375526,
285415,
342762,
342763,
293612,
154359,
432893,
162561,
285444,
383754,
285458,
310036,
326429,
293664,
326433,
400166,
293672,
318250,
318252,
301871,
375609,
293693,
252741,
318278,
293711,
244568,
244570,
301918,
293730,
351077,
342887,
400239,
269178,
400252,
359298,
359299,
260996,
113542,
228233,
228234,
392074,
56208,
293781,
318364,
310176,
310178,
293800,
236461,
293806,
326581,
326587,
326601,
359381,
359387,
433115,
343005,
130016,
64485,
326635,
187374,
383983,
318461,
293886,
293893,
433165,
384016,
146448,
433174,
252958,
252980,
203830,
359478,
302139,
359495,
392290,
253029,
228458,
15471,
351344,
187506,
285814,
392318,
187521,
384131,
285828,
302213,
302216,
228491,
228493,
285838,
162961,
326804,
351390,
302240,
343203,
253099,
253100,
318639,
367799,
294074,
113850,
64700,
302274,
367810,
343234,
244940,
228563,
195808,
310497,
228588,
253167,
302325,
261377,
228609,
245019,
253216,
130338,
130343,
261425,
351537,
286013,
286018,
113987,
294218,
146762,
294219,
318805,
425304,
294243,
163175,
327024,
327025,
327031,
318848,
179587,
253317,
384393,
368011,
318864,
318868,
318875,
310692,
245161,
310701,
286129,
286132,
228795,
425405,
302529,
302531,
163268,
425418,
310732,
302540,
64975,
327121,
228827,
286172,
310757,
187878,
343542,
343543,
286202,
359930,
286205,
302590,
228861,
294400,
228867,
253451,
253452,
359950,
146964,
253463,
286244,
245287,
245292,
286254,
196164,
56902,
228943,
286288,
179801,
196187,
343647,
286306,
310889,
204397,
138863,
188016,
294529,
286343,
229001,
310923,
188048,
425626,
229020,
302754,
245412,
40613,
40614,
40615,
229029,
286388,
286391,
384695,
319162,
327358,
286399,
212685,
212688,
384720,
302802,
245457,
286423,
278233,
278234,
294622,
278240,
229088,
212716,
212717,
360177,
286459,
278272,
319233,
360195,
278291,
294678,
286494,
294700,
409394,
319292,
360252,
360264,
188251,
376669,
245599,
237408,
425825,
302946,
425833,
417654,
188292,
253829,
294807,
294809,
376732,
294814,
311199,
319392,
294823,
327596,
294843,
188348,
98239,
237504,
294850,
384964,
163781,
344013,
212942,
212946,
24532,
294886,
253929,
327661,
311281,
311282
] |
fe540bfd08f13382a1fd7a7c72b122755a886800 | a97acab1b823149c2a7f4c7ac1c3b5b9328910df | /CV/CV/Modules/1.0.Main/Scenes/Landing/TableView/TableHeader/LandingHeader.swift | 5db7226fedd4f549abcd44f689c542b1dbb99ecd | [] | no_license | AntonBreza/CV | 7ea12601eb367c19e40f76d5abaa5416fecffb3b | b35619a517d70d97a917cfa3d3c3b44be7a91804 | refs/heads/master | 2020-07-31T06:52:58.469084 | 2019-09-25T15:47:13 | 2019-09-25T15:47:13 | 210,521,607 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,116 | swift | //
// LandingHeader.swift
// CV
//
// Created by Anton Breza Dev on 9/24/19.
// Copyright © 2019 Anton Breza Dev. All rights reserved.
//
import UIKit
extension Constants.Landing {
static let headerHeight: CGFloat = 284.0
}
class LandingHeader: UIView, NibLoadable {
// MARK: - IBOutlet
@IBOutlet weak var avatarImageView: UIImageView!
@IBOutlet weak var avatarContainer: UIView!
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var positionLabel: UILabel!
@IBOutlet weak var positionLabelContainer: UIView!
@IBOutlet weak var dateOfBirthLabel: UILabel!
// MARK: - Properites
private var presenter: LandingHeaderPresenter?
// MARK: - Lifecycle
convenience init(presenter: LandingHeaderPresenter) {
let size = CGSize(width: UIScreen.main.bounds.width, height: Constants.Landing.headerHeight)
let frame = CGRect(origin: CGPoint.zero, size: size)
self.init(frame: frame)
self.presenter = presenter
presenter.view = self
}
override init(frame: CGRect) {
super.init(frame: frame)
loadFromNib()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
loadFromNib()
}
override func layoutSubviews() {
super.layoutSubviews()
avatarImageView.halfCornerRadius()
avatarContainer.halfCornerRadius()
positionLabelContainer.halfCornerRadius()
}
// MARK: - Public methods
public func updateImage(_ image: UIImage?) {
avatarImageView
.setupImage(image ?? #imageLiteral(resourceName: "portrait_placeholder"))
.contentMode(.scaleAspectFill)
.halfCornerRadius()
}
public func setup(with presenter: LandingHeaderPresenter) {
self.presenter = presenter
presenter.view = self
setup(with: presenter.personEntity)
presenter.loadImage()
}
public func setup(with personEntity: PersonEntity?) {
cleanUp()
guard let personEntity = personEntity else {
return
}
avatarImageView
.background(.clear)
.setupImage(#imageLiteral(resourceName: "portrait_placeholder"))
.halfCornerRadius()
avatarContainer
.halfCornerRadius()
.background(UIColor.cvTurquoise.withAlphaComponent(0.3))
titleLabel
.text(personEntity.name)
.style(UILabel.Common.bold14)
positionLabel
.text(personEntity.position)
.style(UILabel.Common.normal14)
positionLabelContainer
.borderColor(.cvTurquoise)
.borderWidth(1.0)
.halfCornerRadius()
dateOfBirthLabel
.text(personEntity.dateOfBirth)
.style(UILabel.Common.light14)
self
.background(.clear)
}
// MARK: - Private method
private func cleanUp() {
titleLabel.text(String.empty)
positionLabel.text(String.empty)
dateOfBirthLabel.text(String.empty)
avatarImageView.background(.clear)
}
}
| [
-1
] |
da446623e729ef3ba43e07ee583256352e74a8cd | 229af45e9e8aa96d5add9578ca0007267d844a5c | /Baluchon/Baluchon/Extension/UIViewController.swift | ebf5fbec7a4d845d4a7e6f29a02858f3ac29dbb9 | [] | no_license | ArnoDlbn/openclassrooms_projet_9 | aa9851bf5488cec803501034dc6454b0f40598e8 | 62d1f6306646a2b110214bcf8fa9cd29b063fe4d | refs/heads/master | 2020-09-28T05:20:11.275403 | 2020-04-12T10:44:54 | 2020-04-12T10:44:54 | 226,698,452 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 844 | swift | //
// UIViewController.swift
// Baluchon
//
// Created by Arnaud Dalbin on 12/04/2020.
// Copyright © 2020 Arnaud Dalbin. All rights reserved.
//
import UIKit
extension UIViewController {
// method to display an alert
func alert(title: String, message: String) {
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
let ok = UIAlertAction(title: "OK", style:.default, handler: nil)
alert.addAction(ok)
present(alert, animated: true, completion: nil)
}
// method to manage button and activity controller together
func activityIndicator(activityIndicator: UIActivityIndicatorView, button: UIButton, showActivityIndicator: Bool){
activityIndicator.isHidden = !showActivityIndicator
button.isHidden = showActivityIndicator
}
}
| [
-1
] |
ccbfad5b683dce238e6fb95e7df8386bc78c0274 | 3cdfcaaac28f9009b87dd9cbf2236ce5c83e9d59 | /climaApp/Controller/CitySelectionViewController.swift | a3da06074cac1d32b7ea9753061393a90efbe820 | [] | no_license | GarofaloD/climaApp | c3a63441c78ef09fa9808c654d9be772fe0bd9c2 | 8c72f4c0974673b8b6dc3d50de779c678ad16f4f | refs/heads/master | 2020-04-05T14:27:05.561593 | 2018-11-09T23:37:41 | 2018-11-09T23:37:41 | 156,929,710 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,118 | swift | //
// CitySelectionViewController.swift
// climaApp
//
// Created by Daniel Garofalo on 11/9/18.
// Copyright © 2018 Daniel Garofalo. All rights reserved.
//
import UIKit
class CitySelectionViewController: UIViewController {
//MARK:- Outlets
@IBOutlet weak var cityInput: UITextField!
//MARK:- Properties
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
@IBAction func getWeatherWhenPressed(_ sender: UIButton) {
}
@IBAction func returnToWeatherWhenPressed(_ sender: UIButton) {
dismiss(animated: true, completion: nil)
}
}
| [
-1
] |
0d1a0c0bad2cd80f0524f7bb86cfd8fd8b620aa6 | 102270a3714b50fc205e6443bc588b451cf296d8 | /Projeto Lojas/AppDelegate.swift | 54055d79ece4d3ac42d3744b2b56ac6d883cc444 | [] | no_license | igorvilar/Trabalho-Final-iOS-2-IESB | 5c5b498f5e98a3d76b58a4c6a83d865ec54efdae | a4f2ca01fe495860b3c1b89f7b63407975a9606c | refs/heads/master | 2020-04-01T16:07:03.883884 | 2018-11-18T22:49:29 | 2018-11-18T22:49:29 | 153,366,184 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,147 | swift | //
// AppDelegate.swift
// Projeto Lojas
//
// Created by Renê Xavier on 06/09/18.
// Copyright © 2018 com.iesb. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
Database.preencheDadosIniciais()
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
294924,
229388,
327695,
229391,
229394,
229397,
229399,
229402,
229405,
229408,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
237618,
229426,
229428,
286774,
286776,
319544,
286778,
229432,
204856,
286791,
237640,
286797,
311375,
196692,
319573,
311383,
319590,
303212,
131192,
237693,
303230,
327814,
303241,
131209,
303244,
311436,
319633,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
286922,
286924,
286926,
319694,
131278,
131281,
295133,
155872,
131299,
319716,
303345,
286962,
303347,
229622,
327930,
237826,
319751,
286987,
319757,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
319809,
319810,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
311693,
65943,
319898,
311719,
139689,
311728,
311741,
319938,
319945,
188895,
172512,
287202,
172520,
319978,
172526,
311791,
172529,
319989,
172534,
180727,
311804,
287230,
303617,
287234,
172550,
303623,
172552,
320007,
172558,
303632,
303637,
172572,
172577,
295459,
172581,
172591,
172598,
172607,
172609,
172612,
172614,
213575,
172618,
303690,
33357,
303696,
172634,
262752,
172644,
311911,
172656,
352880,
295538,
172660,
287349,
287355,
295553,
172675,
295557,
311942,
303751,
352905,
311946,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
303773,
172705,
287394,
172707,
303780,
287398,
287400,
172714,
295595,
189102,
172721,
287409,
66227,
287419,
303804,
328381,
287423,
328384,
172737,
287427,
312005,
312006,
172748,
287436,
172751,
287440,
295633,
172755,
303827,
287450,
303835,
189149,
303838,
312035,
295654,
230128,
312048,
312050,
205564,
303871,
230146,
328453,
295685,
230154,
312077,
295695,
230169,
295707,
328476,
295710,
230175,
295720,
303914,
230202,
312124,
328508,
222018,
377676,
287569,
230237,
230241,
303976,
336744,
303981,
303985,
303987,
328563,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
304009,
304011,
304013,
295822,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
304065,
295873,
156612,
197580,
312272,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
295945,
230413,
320528,
140312,
295961,
238620,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
238658,
336964,
296004,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
312432,
337018,
205968,
296084,
238745,
304285,
238756,
222377,
337067,
165035,
238766,
165038,
230576,
238770,
304311,
230592,
410820,
312518,
230600,
230607,
148690,
320727,
304348,
304354,
296163,
320740,
304360,
320748,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
214294,
296215,
320792,
230681,
230689,
173350,
312622,
296243,
312630,
296253,
296255,
312639,
296259,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
148843,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
181631,
312711,
312712,
296331,
288140,
288144,
304533,
337306,
288164,
304555,
173488,
288176,
312755,
312759,
288185,
222652,
312766,
173507,
230860,
312783,
148946,
370130,
222676,
329177,
239070,
370146,
288229,
288232,
296435,
288244,
288250,
296446,
321022,
402942,
296450,
230916,
230919,
230923,
304651,
304653,
370187,
222752,
108066,
296486,
296488,
157229,
230961,
157236,
288320,
288325,
124489,
288338,
288344,
239194,
239202,
312938,
116354,
321195,
296622,
321200,
337585,
296637,
313027,
206536,
206539,
206541,
206543,
313044,
321239,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
321266,
288499,
419570,
288502,
288510,
124671,
67330,
198405,
198416,
296723,
321304,
329498,
296731,
313121,
313123,
304932,
321316,
321336,
296767,
288576,
345921,
304968,
173907,
313171,
313176,
321381,
296812,
313201,
305028,
247688,
124817,
239510,
124827,
214940,
247709,
214944,
321458,
124853,
214966,
296890,
288700,
296894,
190403,
296900,
337862,
165831,
296921,
239586,
313320,
124913,
165876,
239612,
313340,
288764,
239617,
313347,
313358,
305176,
321560,
313371,
305191,
223273,
124978,
215090,
124980,
288824,
288826,
321595,
313406,
288831,
288836,
215123,
288859,
280669,
149599,
280671,
149601,
321634,
149603,
280681,
280687,
149618,
215154,
313458,
313464,
329850,
321659,
288895,
321670,
215175,
141459,
280725,
313498,
100520,
280747,
288947,
321717,
313548,
321740,
313557,
338147,
280804,
125171,
182517,
280825,
280831,
125187,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
305464,
280891,
289087,
305480,
305485,
305489,
354653,
354656,
313700,
313705,
280940,
190832,
313720,
313731,
199051,
240011,
289166,
240017,
240021,
297365,
297368,
297372,
297377,
289186,
297391,
240052,
289207,
289210,
305594,
281024,
281045,
166378,
305647,
174580,
240124,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
223752,
150025,
338440,
223757,
322074,
150066,
158266,
289342,
322115,
338528,
338532,
199273,
19053,
158317,
313973,
297594,
158347,
314003,
240275,
117398,
314007,
289436,
174754,
330404,
289448,
174764,
314029,
314033,
240309,
314045,
314047,
314051,
297671,
158409,
289493,
363234,
289513,
289522,
289532,
322303,
322310,
264969,
322314,
322318,
322341,
215850,
289601,
240458,
240468,
322393,
297818,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
183184,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
183260,
289762,
322534,
297961,
183277,
322550,
134142,
322563,
314372,
322599,
322610,
314421,
281654,
314427,
314433,
314441,
322642,
314456,
314461,
248995,
306341,
306344,
306347,
322734,
306354,
199877,
289991,
289997,
363742,
363745,
298216,
330988,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
298292,
298294,
216376,
380226,
298306,
224587,
224594,
216404,
306517,
150870,
314714,
314718,
265568,
314723,
150890,
306539,
314732,
314736,
290161,
306549,
314743,
306552,
290171,
314747,
298365,
290174,
306555,
224641,
298372,
314756,
224647,
314763,
142733,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
241068,
241070,
241072,
150966,
298424,
306618,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
191985,
290291,
241142,
191992,
290298,
151036,
290302,
290305,
306694,
192008,
323084,
290325,
241175,
290328,
290332,
241181,
290344,
306731,
290349,
290356,
224849,
282199,
306778,
314979,
323176,
224875,
241260,
323181,
315016,
290445,
298651,
282269,
323229,
298655,
323231,
61092,
306856,
323260,
323266,
306904,
298714,
52959,
241380,
323318,
306945,
323330,
241412,
323333,
323345,
323349,
315167,
315169,
315174,
323367,
241448,
315176,
241450,
306991,
315184,
323376,
315190,
241464,
159545,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
315211,
307027,
315221,
315223,
241496,
241498,
307035,
307040,
110433,
241509,
110438,
298860,
110445,
315249,
315253,
315255,
339838,
315267,
315269,
241544,
241546,
241548,
298896,
298898,
241556,
298901,
241560,
241563,
241565,
241567,
241569,
241574,
241581,
241583,
323504,
241586,
241588,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
315396,
241669,
315397,
290835,
241693,
102438,
217127,
323630,
290877,
315463,
315466,
192596,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
299126,
233591,
299136,
315524,
307338,
233613,
241813,
307352,
299164,
299167,
315552,
315557,
184486,
307370,
168107,
307372,
307374,
307376,
323763,
184503,
299191,
307385,
307386,
258235,
307388,
307390,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
299225,
233701,
307432,
184586,
323854,
291104,
233766,
307508,
315701,
332086,
307510,
307512,
307515,
307518,
282942,
323917,
110926,
233808,
323921,
315733,
323926,
315739,
299357,
242018,
242024,
299373,
250231,
242043,
315771,
299391,
291202,
242057,
291212,
299405,
291222,
315801,
242075,
61855,
291231,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
127413,
127417,
291260,
127421,
127424,
299457,
127434,
315856,
127440,
315860,
283095,
127447,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
127463,
242152,
291305,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127494,
135689,
233994,
127500,
233998,
127506,
234006,
127511,
152087,
135707,
135710,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
135805,
135808,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
135839,
225954,
299684,
135844,
242343,
242345,
373421,
299706,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
299740,
201444,
299750,
234219,
316151,
242431,
299778,
234242,
242436,
234246,
291593,
234252,
234258,
242452,
201496,
234264,
234266,
234269,
234272,
152355,
299814,
234281,
234287,
185138,
242483,
234296,
160572,
234302,
234307,
316233,
316235,
234319,
185173,
201557,
308063,
234336,
242530,
349027,
234341,
234344,
234347,
234350,
324464,
152435,
177011,
234356,
234358,
234364,
291714,
201603,
291716,
234373,
234370,
308105,
324504,
234393,
209818,
308123,
324508,
291742,
291747,
291748,
234405,
291750,
324518,
324520,
324522,
291754,
291756,
324527,
299952,
201650,
324531,
234422,
324536,
275384,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
234443,
291788,
193486,
234446,
193488,
234449,
234452,
234455,
234464,
168935,
324585,
234478,
316400,
234481,
316403,
234485,
234487,
316416,
234496,
308231,
234504,
300054,
316439,
234520,
234519,
234526,
234528,
300066,
300069,
234535,
234540,
144430,
234546,
300085,
234549,
234553,
316479,
316483,
160835,
234563,
308291,
316491,
234572,
300108,
234574,
300115,
234593,
234597,
300133,
300139,
160879,
234610,
234620,
234634,
275594,
177293,
234640,
234643,
308373,
324757,
234647,
234650,
308379,
300189,
324766,
119967,
324768,
234653,
242852,
300197,
234667,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
300263,
300265,
300267,
300270,
300272,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
300292,
275719,
234760,
177419,
300299,
242957,
300301,
275725,
177424,
349464,
292143,
300344,
243003,
300357,
283973,
283983,
316758,
357722,
316766,
316768,
292197,
316774,
218473,
136562,
333178,
275836,
316803,
316806,
316811,
316814,
300433,
234899,
300436,
357783,
316824,
316826,
300448,
144807,
144810,
144812,
144814,
144820,
374196,
292279,
144826,
144828,
144830,
144832,
144835,
144837,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
300527,
308720,
292338,
316917,
292343,
300537,
316933,
316947,
308757,
308762,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
284223,
284226,
284228,
243268,
292421,
284231,
284234,
366155,
317004,
284238,
284241,
194130,
284243,
300628,
284245,
284247,
235097,
243290,
284249,
292452,
292454,
292458,
292461,
284272,
284274,
284278,
292470,
292473,
284283,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
284308,
284312,
284314,
284316,
284320,
284322,
284327,
284329,
317098,
284331,
284333,
284335,
300726,
284343,
284346,
284350,
358080,
284354,
358083,
284358,
358089,
284362,
284365,
284368,
284370,
358098,
284372,
317138,
284377,
358114,
358116,
317158,
358119,
325353,
358122,
358126,
358128,
358133,
358135,
358138,
300795,
358140,
358142,
358146,
317187,
317189,
317191,
300816,
300819,
317207,
300830,
300832,
325408,
300834,
317221,
300845,
243504,
300850,
325436,
358206,
366406,
300872,
292681,
153417,
358224,
178006,
317271,
292700,
317279,
292715,
300912,
292721,
300915,
292729,
317306,
292734,
325512,
317332,
358292,
350106,
284572,
284579,
358312,
317353,
292784,
358326,
358330,
301009,
301011,
301013,
358360,
301017,
292828,
153568,
292839,
292843,
178161,
325624,
317435,
317446,
317456,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
325700,
292934,
350293,
350295,
309337,
350299,
350302,
350304,
178273,
309346,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
301167,
350321,
350325,
252022,
350328,
292985,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
350375,
350379,
350381,
350383,
350385,
350387,
350389,
350395,
350397,
350399,
350402,
301252,
350406,
301258,
309455,
309462,
301272,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
309491,
309494,
243960,
325910,
309530,
342298,
211232,
317729,
211241,
325937,
325943,
211260,
235853,
235858,
391523,
293227,
293232,
186744,
211324,
317833,
317853,
317858,
342434,
317864,
235955,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
293346,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
293387,
342541,
113167,
309779,
317971,
309781,
293417,
227882,
309804,
236082,
23094,
219714,
301636,
318020,
301639,
301643,
309844,
309849,
318055,
309871,
121458,
309885,
309888,
301706,
318092,
326285,
334476,
318094,
318108,
318110,
137889,
383658,
318128,
293555,
318132,
137946,
113378,
342760,
56043,
56059,
310015,
310020,
310029,
293659,
326430,
285474,
318248,
318253,
293677,
301876,
293685,
301880,
301884,
293696,
310080,
293706,
310100,
301911,
301921,
236397,
162671,
326514,
310134,
236408,
15224,
416639,
416640,
113538,
310147,
416648,
187274,
424853,
277411,
310179,
293798,
293802,
293811,
293817,
293820,
203715,
326603,
293849,
318442,
228332,
326638,
318450,
293876,
293877,
302073,
121850,
293882,
302075,
244731,
293899,
293908,
293917,
293939,
318516,
310336,
293956,
293960,
310344,
203857,
293971,
310355,
310359,
236632,
138332,
203872,
310374,
203879,
310376,
228460,
318573,
367737,
302205,
392326,
294026,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
302248,
294063,
294065,
302258,
294072,
318651,
294076,
318657,
244930,
302275,
130244,
302277,
302282,
310476,
302285,
302288,
310481,
302290,
302292,
302294,
310486,
302296,
310498,
318698,
302315,
294132,
138485,
204026,
64768,
310531,
138505,
318742,
285999,
318773,
318776,
286010,
417086,
302403,
384328,
294221,
294223,
326991,
294246,
327015,
310632,
327017,
351594,
310648,
310651,
310657,
351619,
294276,
310659,
327046,
253320,
310665,
318858,
310672,
310689,
130468,
310703,
310710,
130486,
310712,
310715,
302526,
228799,
302534,
310727,
245191,
163272,
302541,
302543,
310737,
310749,
310755,
310764,
310772,
40440,
212472,
40443,
310780,
286203,
40448,
228864,
286214,
302603,
302614,
302617,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
286248,
310831,
40499,
40502,
212538,
40507,
40511,
40513,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
40537,
40539,
40541,
40544,
40548,
40550,
40552,
40554,
40557,
40560,
294521,
343679,
294537,
310925,
302740,
179870,
327333,
229030,
212648,
302764,
319153,
302781,
319171,
294599,
294601,
302793,
343757,
212690,
319187,
286420,
286425,
319194,
294625,
294634,
302838,
319226,
286460,
171774,
302852,
278277,
302854,
294664,
311048,
319243,
311053,
302862,
319251,
294682,
188199,
294701,
319280,
319290,
229192,
302925,
188247,
188252,
237409,
360317,
294785,
327554,
40851,
237470,
319390,
40865,
319394,
294821,
311209,
180142,
343983,
188340,
40886,
294844,
294847,
393177,
294876,
294879,
294890,
311279,
237555,
311283,
237562
] |
bb2e409b707140399ba8852527166e65577b132e | 390ee013c3adbe05171e8d8443dd789b33c28871 | /Projeto-mini-ITI/models/UserForm.swift | df17286809c500d409209bcbbd942197adcd5dde | [] | no_license | WilliamMoraesZup/silvanos-project-miniITI | a376b89e56607f4a67b3fcd0e3ab125664986ae8 | 1a09598ea4bc09311f9d303227fe27e8c1147bb4 | refs/heads/main | 2023-08-23T00:24:16.068321 | 2021-10-13T20:25:46 | 2021-10-13T20:25:46 | 412,492,312 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,292 | swift | //
// UserForm.swift
// Projeto-mini-ITI
//
// Created by William Moraes da Silva on 02/10/21.
//
import Foundation
struct UserForm {
let name : String?
let documentNumber : Int?
let tel : Int?
let address : String?
let ocupation : String?
let income : Double?
let password : Int?
func toModel() -> UserModel? {
let newACC = Account()
// TO-DO remover os force unwrap
guard
let unwrapedName = name,
let unwrapedDocumentoNumber = documentNumber,
let unwrapedTel = tel,
let unwrapedAddress = address,
let unwrapedOcupation = ocupation,
let unwrapedIncome = income,
let unwrapedPassword = password
else {
print("Erro ao criar MOdel")
return nil
}
return UserModel(name: unwrapedName, documentNumber : unwrapedDocumentoNumber,
tel: unwrapedTel,
address: unwrapedAddress,
ocupation: unwrapedOcupation,
income: unwrapedIncome,
password : unwrapedPassword,
account: newACC )
}
}
| [
-1
] |
d61a122ca203bb35a3f3c85f78af8a82c4f9a756 | 6f49bef4ae60de17a7ff6c7f0db954e726443890 | /TapUIKit-iOS/Pods/TapAdditionsKitV2/TapAdditionsKitV2/TapAdditionsKitV2/SwiftStandartLibrary/Bool+Additions.swift | c6fa05cba951450080f15737f03d457a6f9590da | [
"MIT"
] | permissive | Tap-Payments/TapUIKit-iOS | 6c9b584e77d0827a87d672d71da8751b77606b68 | 20650b6868d192c9a3a04ef4f07650e00231f4b4 | refs/heads/master | 2023-09-01T18:33:07.344596 | 2023-08-22T21:12:48 | 2023-08-22T21:12:48 | 245,787,251 | 3 | 0 | MIT | 2023-06-21T09:34:18 | 2020-03-08T09:37:30 | Swift | UTF-8 | Swift | false | false | 294 | swift | //
// Bool+Additions.swift
// TapAdditionsKit
//
// Copyright © 2019 Tap Payments. All rights reserved.
//
// MARK: - ExpressibleByIntegerLiteral
extension Bool: ExpressibleByIntegerLiteral {
public init(integerLiteral value: Int) {
self.init(value != 0)
}
}
| [
-1
] |
5c1b234b6aeb4c1b4de1d249fd20587ef672cf89 | 310241b87341bf99a5ea8eebdd4cdfcc6e103b3f | /Example_Swift2/RMPScrollingMenuBarController/AppDelegate.swift | 26679278ecb2097c0a26b25c2e976a22a94ee8f8 | [
"MIT"
] | permissive | ramtiga/RMPScrollingMenuBarController | bab7bdc9ffc2ab2191232274df7b2f5e56c78fde | 69e2f101bea737323e148bb2669300bb0c4335a3 | refs/heads/master | 2021-08-20T02:43:41.328295 | 2017-11-28T01:57:48 | 2017-11-28T01:57:48 | 112,268,419 | 0 | 0 | null | 2017-11-28T01:15:26 | 2017-11-28T01:15:26 | null | UTF-8 | Swift | false | false | 5,638 | swift | // Copyright (c) 2015 Recruit Marketing Partners Co.,Ltd. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
import UIKit
import RMPScrollingMenuBarController
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
self.setup()
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:.
}
// MARK: - private methods
func setup() {
self.window = UIWindow(frame: UIScreen.main.bounds)
// Setup menu bar controller
let menuController = RMPScrollingMenuBarController()
menuController.delegate = self
// Customize appearance of menu bar.
menuController.view.backgroundColor = UIColor.white
menuController.menuBar.indicatorColor = UIColor.blue
//menuController.menuBar.style = .InfinitePaging
//menuController.menuBar.showsIndicator = false
//menuController.menuBar.showsSeparatorLine = false
// Set ViewControllers for menu bar controller
var viewControllers: [PageViewController] = []
// for i in 0 ..< 10 += 1 {
for i in 0 ..< 10 {
let vc = PageViewController()
vc.view.backgroundColor = UIColor(white: CGFloat(0.3) + CGFloat(0.05) * CGFloat(i), alpha: 1)
vc.message = "Message for No.\(i)"
viewControllers.append(vc)
}
menuController.setViewControllers(viewControllers, animated: false)
let naviController = UINavigationController(rootViewController: menuController)
self.window?.rootViewController = naviController
self.window?.makeKeyAndVisible()
}
}
extension AppDelegate: RMPScrollingMenuBarControllerDelegate {
func menuBarController(_ menuBarController: RMPScrollingMenuBarController!, willSelect viewController: UIViewController!) {
print("will select \(viewController)")
}
func menuBarController(_ menuBarController: RMPScrollingMenuBarController!, didSelect viewController: UIViewController!) {
print("did select \(viewController)")
}
func menuBarController(_ menuBarController: RMPScrollingMenuBarController!, didCancel viewController: UIViewController!) {
print("did cancel \(viewController)")
}
func menuBarController(_ menuBarController: RMPScrollingMenuBarController!, menuBarItemAt index: Int) -> RMPScrollingMenuBarItem! {
let item = RMPScrollingMenuBarItem()
item.title = "Title \(index)"
// Customize appearance of menu bar item.
let button = item.button()
button?.setTitleColor(UIColor.lightGray, for: UIControlState.normal)
button?.setTitleColor(UIColor.blue, for: UIControlState.disabled)
button?.setTitleColor(UIColor.gray, for: UIControlState.selected)
return item
}
}
| [
-1
] |
fdb474dd142b45b88dfc1ca212d1a95bfa1e0b20 | 2a63b29c4778757a052c0c4bfb72d0a87419eab6 | /BTCTicket/Custom Types/NetworkingType.swift | 76c0bbf5435a16d6da9c5ff233badeb8e613d0f7 | [] | no_license | javidsheikh/BTCTicket | 8057bcd0fd17351142248757867f5d750db9fd6b | 66fa259608543c20e5f065826f75f6b4d113da29 | refs/heads/master | 2020-09-08T02:24:31.945565 | 2019-11-12T08:06:50 | 2019-11-12T08:06:50 | 220,984,800 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 273 | swift | //
// NetworkingType.swift
// BTCTicket
//
// Created by Javid Sheikh on 11/11/2019.
// Copyright © 2019 Quaxo Digital. All rights reserved.
//
import Foundation
import RxSwift
protocol NetworkingType {
func decode<D: Decodable>(type: D.Type) -> Observable<D>
}
| [
-1
] |
b3acc7243a826c25711f4194a72751f6de0e9b34 | 0570ff626dcbd64f3b9015f26ddd63de7975c639 | /uikit-sample/SendBirdUIKit-Sample/Extension/UIView+Ext.swift | 2b582698431994e3df16c7006bd41d15cd3c50c6 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Codefied/sendbird-uikit-ios-sources | 9331c4906853ef25a682f422977c0244c313e280 | 4dc22ed4ac0e6737600d37d60b009e7787274e43 | refs/heads/main | 2023-07-13T17:17:42.857531 | 2021-08-19T09:06:18 | 2021-08-19T09:06:18 | 399,496,757 | 1 | 0 | MIT | 2021-08-24T14:31:33 | 2021-08-24T14:31:32 | null | UTF-8 | Swift | false | false | 1,232 | swift | //
// UIView+Ext.swift
// SendBirdUIKit-Sample
//
// Created by Tez Park on 2020/07/01.
// Copyright © 2020 SendBird, Inc. All rights reserved.
//
import UIKit
extension UIView {
func animateBorderColor(toColor: UIColor, duration: Double) {
let animation:CABasicAnimation = CABasicAnimation(keyPath: "borderColor")
animation.fromValue = layer.borderColor
animation.toValue = toColor.cgColor
animation.duration = duration
layer.add(animation, forKey: "borderColor")
layer.borderColor = toColor.cgColor
}
func shake() {
let animation = CAKeyframeAnimation(keyPath: "transform.translation.x")
animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear)
animation.duration = 0.3
animation.values = [-10.0, 10.0, -5.0, 5.0, -2.5, 2.5, 0.0 ].map { $0 * 0.7 }
layer.add(animation, forKey: "shake")
}
func highlight() {
UIView.highlight(self)
}
static func highlight(_ view: UIView) {
view.layer.cornerRadius = 5
view.layer.borderColor = UIColor.red.cgColor
view.layer.borderWidth = 2
for v in view.subviews { highlight(v) }
}
}
| [
-1
] |
0e613a15f0aaf7a264cdc7e9369ce3ea98e86db5 | d98c8c88e9283a9ceab2b96dd5c4b74a9d83fe80 | /ControlVehicle/View/HomeView/CircleImageButton.swift | ea69a2014565d782ba2ad49f01af220976c862ef | [] | no_license | anikh1993/ControlVehicle | 555c8f343efffe6a5d3ddcf98f225974bdd804ae | f9764c6ee94081a2ab48997e0e66927e1c331ade | refs/heads/master | 2023-08-19T01:00:53.432490 | 2021-09-29T06:37:59 | 2021-09-29T06:37:59 | 411,555,170 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 1,639 | swift | //
// CircleButton.swift
// ControlVehicle
//
// Created by Ani Khechoyan on 9/28/21.
//
import SwiftUI
struct CircleImageButton: View {
enum ButtonState {
case none, selected, disabled, loading
}
var action: () -> ()
var imageName: String
var state: ButtonState = .none
var body: some View {
VStack {
switch state {
case .none:
Button(action: action) {
Image(imageName)
}
.frame(width: 40, height: 40)
.padding()
.background(Color(.black))
.disabled(false)
case .disabled:
Button(action: action) {
Image(imageName)
}
.frame(width: 40, height: 40)
.padding()
.background(Color(.gray))
.disabled(true)
case .selected:
Button(action: action) {
Image(imageName)
}
.frame(width: 40, height: 40)
.padding()
.background(Color("highlight"))
.disabled(true)
case .loading:
LoadingView()
.frame(width: 72, height: 72)
}
}
.foregroundColor(.white)
.clipShape(Circle())
}
}
struct CircleButton_Previews: PreviewProvider {
static var previews: some View {
CircleImageButton(action: {}, imageName: "", state: .loading)
CircleImageButton(action: {}, imageName: "", state: .selected)
}
}
| [
-1
] |
f385fd53e5f180b6bf92965319bb6f82589edc30 | 5379fba056503c8187d3b386bd007ddd31c0702e | /Snapchat/Story/StoriesInsideFeaturesCell.swift | 1076105114d0e2c9f9278e47b9857da60776e9ca | [] | no_license | lmick002/snapchat-ui | 9fe0bed43c3ae833313c3e833f9df90a1d089bd5 | 53463796776d6a6a14a643119246198cb6193c19 | refs/heads/master | 2020-11-24T01:11:35.220073 | 2019-02-17T18:29:08 | 2019-02-17T18:29:08 | 227,897,406 | 1 | 0 | null | 2019-12-13T18:15:11 | 2019-12-13T18:15:10 | null | UTF-8 | Swift | false | false | 2,605 | swift | //
// StoriesInsideFeaturesCell.swift
// Snapchat
//
// Created by Danny Dramond on 28/01/2018.
// Copyright © 2018 Danny Dramond. All rights reserved.
//
import UIKit
class StoriesInsideFeaturedCell: UICollectionViewCell {
let gradientLayer: CAGradientLayer = CAGradientLayer()
var featured: Featured? {
didSet {
guard let image_url = self.featured?.urlToImage,
let title = self.featured?.title else { return }
self.imageView.loadImageUsingCacheWithUrlString(image_url)
self.titleLabel.text = title
}
}
override init(frame: CGRect) {
super.init(frame: frame)
self.backgroundColor = .white
setupViews()
}
lazy var imageView: CustomImageView = {
let iv = CustomImageView()
iv.contentMode = .scaleAspectFill
iv.backgroundColor = .white
iv.layer.masksToBounds = true
iv.layer.cornerRadius = 6
iv.isUserInteractionEnabled = true
iv.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(handleTapped)))
return iv
}()
@objc func handleTapped() {
guard let urlToArticle = self.featured?.url else { return }
guard let url = URL(string: urlToArticle) else { return }
if #available(iOS 10.0, *) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
} else {
UIApplication.shared.openURL(url)
}
}
let titleLabel: UILabel = {
let label = UILabel()
label.font = UIFont(name: "AvenirNext-Bold", size: 12)
label.textColor = .white
label.numberOfLines = 0
label.lineBreakMode = .byWordWrapping
return label
}()
func setupViews() {
self.addSubview(imageView)
_ = imageView.anchor(self.topAnchor, self.rightAnchor, self.bottomAnchor, self.leftAnchor, 0, 0, 0, 0, width: 0, height: 0)
let blackColor: UIColor = UIColor(white: 0, alpha: 0.75)
gradientLayer.colors = [UIColor.clear.cgColor, blackColor.cgColor]
imageView.layer.addSublayer(gradientLayer)
gradientLayer.frame = CGRect(x: 0, y: self.frame.height / 2, width: self.frame.width, height: self.frame.height / 2)
self.addSubview(titleLabel)
_ = titleLabel.anchor(nil, self.rightAnchor, self.bottomAnchor, self.leftAnchor, 0, 6, 6, 6, width: 0, height: 0)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
| [
-1
] |
f156b16e4fe053d18ea6adeb8eafcf316fd67e62 | bfb7e450c1d05feb02d594137dfbbdc759938337 | /configen/CommandLineKit/CommandLineKit.swift | 1ed43983e8567d06816fe20a3e17309d99b9c50a | [
"MIT"
] | permissive | phatblat/ConfigGenerator | 1cbe65199295ce61e43f7b4e5e4692406d6a9448 | c3922ff2fa93424fc974755506ce2f3869b6a59f | refs/heads/master | 2020-03-15T22:20:19.263551 | 2018-01-11T11:03:39 | 2018-01-11T11:03:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 14,020 | swift | /*
* CommandLine.swift
* Copyright (c) 2014 Ben Gollmer.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Foundation
/* Required for setlocale(3) */
#if os(OSX)
import Darwin
#elseif os(Linux)
import Glibc
#endif
let shortOptionPrefix = "-"
let longOptionPrefix = "--"
/* Stop parsing arguments when an ArgumentStopper (--) is detected. This is a GNU getopt
* convention; cf. https://www.gnu.org/prep/standards/html_node/Command_002dLine-Interfaces.html
*/
let argumentStopper = "--"
/* Allow arguments to be attached to flags when separated by this character.
* --flag=argument is equivalent to --flag argument
*/
let argumentAttacher: Character = "="
/* An output stream to stderr; used by CommandLine.printUsage(). */
private struct StderrOutputStream: TextOutputStream {
static let stream = StderrOutputStream()
func write(_ s: String) {
fputs(s, stderr)
}
}
/**
* The CommandLine class implements a command-line interface for your app.
*
* To use it, define one or more Options (see Option.swift) and add them to your
* CommandLine object, then invoke `parse()`. Each Option object will be populated with
* the value given by the user.
*
* If any required options are missing or if an invalid value is found, `parse()` will throw
* a `ParseError`. You can then call `printUsage()` to output an automatically-generated usage
* message.
*/
public class CommandLineKit {
private var _arguments: [String]
private var _options: [Option] = [Option]()
private var _maxFlagDescriptionWidth: Int = 0
private var _usedFlags: Set<String> {
var usedFlags = Set<String>(minimumCapacity: _options.count * 2)
for option in _options {
for case let flag? in [option.shortFlag, option.longFlag] {
usedFlags.insert(flag)
}
}
return usedFlags
}
/**
* After calling `parse()`, this property will contain any values that weren't captured
* by an Option. For example:
*
* ```
* let cli = CommandLine()
* let fileType = StringOption(shortFlag: "t", longFlag: "type", required: true, helpMessage: "Type of file")
*
* do {
* try cli.parse()
* print("File type is \(type), files are \(cli.unparsedArguments)")
* catch {
* cli.printUsage(error)
* exit(EX_USAGE)
* }
*
* ---
*
* $ ./readfiles --type=pdf ~/file1.pdf ~/file2.pdf
* File type is pdf, files are ["~/file1.pdf", "~/file2.pdf"]
* ```
*/
public private(set) var unparsedArguments: [String] = [String]()
/**
* If supplied, this function will be called when printing usage messages.
*
* You can use the `defaultFormat` function to get the normally-formatted
* output, either before or after modifying the provided string. For example:
*
* ```
* let cli = CommandLine()
* cli.formatOutput = { str, type in
* switch(type) {
* case .Error:
* // Make errors shouty
* return defaultFormat(str.uppercaseString, type: type)
* case .OptionHelp:
* // Don't use the default indenting
* return ">> \(s)\n"
* default:
* return defaultFormat(str, type: type)
* }
* }
* ```
*
* - note: Newlines are not appended to the result of this function. If you don't use
* `defaultFormat()`, be sure to add them before returning.
*/
public var formatOutput: ((String, OutputType) -> String)?
/**
* The maximum width of all options' `flagDescription` properties; provided for use by
* output formatters.
*
* - seealso: `defaultFormat`, `formatOutput`
*/
public var maxFlagDescriptionWidth: Int {
if _maxFlagDescriptionWidth == 0 {
_maxFlagDescriptionWidth = _options.map { $0.flagDescription.characters.count }.sorted().first ?? 0
}
return _maxFlagDescriptionWidth
}
/**
* The type of output being supplied to an output formatter.
*
* - seealso: `formatOutput`
*/
public enum OutputType {
/** About text: `Usage: command-example [options]` and the like */
case about
/** An error message: `Missing required option --extract` */
case error
/** An Option's `flagDescription`: `-h, --help:` */
case optionFlag
/** An Option's help message */
case optionHelp
}
/** A ParseError is thrown if the `parse()` method fails. */
public enum ParseError: Error, CustomStringConvertible {
/** Thrown if an unrecognized argument is passed to `parse()` in strict mode */
case invalidArgument(String)
/** Thrown if the value for an Option is invalid (e.g. a string is passed to an IntOption) */
case invalidValueForOption(Option, [String])
/** Thrown if an Option with required: true is missing */
case missingRequiredOptions([Option])
public var description: String {
switch self {
case let .invalidArgument(arg):
return "Invalid argument: \(arg)"
case let .invalidValueForOption(opt, vals):
let vs = vals.joined(separator: ", ")
return "Invalid value(s) for option \(opt.flagDescription): \(vs)"
case let .missingRequiredOptions(opts):
return "Missing required options: \(opts.map { return $0.flagDescription })"
}
}
}
/**
* Initializes a CommandLine object.
*
* - parameter arguments: Arguments to parse. If omitted, the arguments passed to the app
* on the command line will automatically be used.
*
* - returns: An initalized CommandLine object.
*/
public init(arguments: [String] = Swift.CommandLine.arguments) {
self._arguments = arguments
/* Initialize locale settings from the environment */
setlocale(LC_ALL, "")
}
/* Returns all argument values from flagIndex to the next flag or the end of the argument array. */
private func _getFlagValues(_ flagIndex: Int, _ attachedArg: String? = nil) -> [String] {
var args: [String] = [String]()
var skipFlagChecks = false
if let a = attachedArg {
args.append(a)
}
for i in flagIndex + 1 ..< _arguments.count {
if !skipFlagChecks {
if _arguments[i] == argumentStopper {
skipFlagChecks = true
continue
}
if _arguments[i].hasPrefix(shortOptionPrefix) && Int(_arguments[i]) == nil &&
_arguments[i].toDouble() == nil {
break
}
}
args.append(_arguments[i])
}
return args
}
/**
* Adds an Option to the command line.
*
* - parameter option: The option to add.
*/
public func addOption(_ option: Option) {
let uf = _usedFlags
for case let flag? in [option.shortFlag, option.longFlag] {
assert(!uf.contains(flag), "Flag '\(flag)' already in use")
}
_options.append(option)
_maxFlagDescriptionWidth = 0
}
/**
* Adds one or more Options to the command line.
*
* - parameter options: An array containing the options to add.
*/
public func addOptions(_ options: [Option]) {
for o in options {
addOption(o)
}
}
/**
* Adds one or more Options to the command line.
*
* - parameter options: The options to add.
*/
public func addOptions(_ options: Option...) {
for o in options {
addOption(o)
}
}
/**
* Sets the command line Options. Any existing options will be overwritten.
*
* - parameter options: An array containing the options to set.
*/
public func setOptions(_ options: [Option]) {
_options = [Option]()
addOptions(options)
}
/**
* Sets the command line Options. Any existing options will be overwritten.
*
* - parameter options: The options to set.
*/
public func setOptions(_ options: Option...) {
_options = [Option]()
addOptions(options)
}
/**
* Parses command-line arguments into their matching Option values.
*
* - parameter strict: Fail if any unrecognized flags are present (default: false).
*
* - throws: A `ParseError` if argument parsing fails:
* - `.InvalidArgument` if an unrecognized flag is present and `strict` is true
* - `.InvalidValueForOption` if the value supplied to an option is not valid (for
* example, a string is supplied for an IntOption)
* - `.MissingRequiredOptions` if a required option isn't present
*/
public func parse(strict: Bool = false) throws {
var strays = _arguments
/* Nuke executable name */
strays[0] = ""
let argumentsEnumerator = _arguments.enumerated()
for (idx, arg) in argumentsEnumerator {
if arg == argumentStopper {
break
}
if !arg.hasPrefix(shortOptionPrefix) {
continue
}
let skipChars = arg.hasPrefix(longOptionPrefix) ?
longOptionPrefix.characters.count : shortOptionPrefix.characters.count
let flagWithArg = arg[arg.index(arg.startIndex, offsetBy: skipChars)..<arg.endIndex]
/* The argument contained nothing but ShortOptionPrefix or LongOptionPrefix */
if flagWithArg.isEmpty {
continue
}
/* Remove attached argument from flag */
let splitFlag = flagWithArg.split(separator: argumentAttacher, maxSplits: 1)
let flag = splitFlag[0]
let attachedArg: String? = splitFlag.count == 2 ? String(splitFlag[1]) : nil
var flagMatched = false
for option in _options where option.flagMatch(String(flag)) {
let vals = self._getFlagValues(idx, attachedArg)
guard option.setValue(vals) else {
throw ParseError.invalidValueForOption(option, vals)
}
var claimedIdx = idx + option.claimedValues
if attachedArg != nil { claimedIdx -= 1 }
for i in idx...claimedIdx {
strays[i] = ""
}
flagMatched = true
break
}
/* Flags that do not take any arguments can be concatenated */
let flagLength = flag.characters.count
if !flagMatched && !arg.hasPrefix(longOptionPrefix) {
let flagCharactersEnumerator = flag.characters.enumerated()
for (i, c) in flagCharactersEnumerator {
for option in _options where option.flagMatch(String(c)) {
/* Values are allowed at the end of the concatenated flags, e.g.
* -xvf <file1> <file2>
*/
let vals = (i == flagLength - 1) ? self._getFlagValues(idx, attachedArg) : [String]()
guard option.setValue(vals) else {
throw ParseError.invalidValueForOption(option, vals)
}
var claimedIdx = idx + option.claimedValues
if attachedArg != nil { claimedIdx -= 1 }
for i in idx...claimedIdx {
strays[i] = ""
}
flagMatched = true
break
}
}
}
/* Invalid flag */
guard !strict || flagMatched else {
throw ParseError.invalidArgument(arg)
}
}
/* Check to see if any required options were not matched */
let missingOptions = _options.filter { $0.required && !$0.wasSet }
guard missingOptions.count == 0 else {
throw ParseError.missingRequiredOptions(missingOptions)
}
unparsedArguments = strays.filter { $0 != "" }
}
/**
* Provides the default formatting of `printUsage()` output.
*
* - parameter s: The string to format.
* - parameter type: Type of output.
*
* - returns: The formatted string.
* - seealso: `formatOutput`
*/
public func defaultFormat(s: String, type: OutputType) -> String {
switch type {
case .about:
return "\(s)\n"
case .error:
return "\(s)\n\n"
case .optionFlag:
return " \(s.padded(toWidth: maxFlagDescriptionWidth)):\n"
case .optionHelp:
return " \(s)\n"
}
}
/* printUsage() is generic for OutputStreamType because the Swift compiler crashes
* on inout protocol function parameters in Xcode 7 beta 1 (rdar://21372694).
*/
/**
* Prints a usage message.
*
* - parameter to: An OutputStreamType to write the error message to.
*/
public func printUsage<TargetStream: TextOutputStream>(_ to: inout TargetStream) {
/* Nil coalescing operator (??) doesn't work on closures :( */
let format = formatOutput != nil ? formatOutput! : defaultFormat
let name = _arguments[0]
print(format("Usage: \(name) [options]", .about), terminator: "", to: &to)
for opt in _options {
print(format(opt.flagDescription, .optionFlag), terminator: "", to: &to)
print(format(opt.helpMessage, .optionHelp), terminator: "", to: &to)
}
}
/**
* Prints a usage message.
*
* - parameter error: An error thrown from `parse()`. A description of the error
* (e.g. "Missing required option --extract") will be printed before the usage message.
* - parameter to: An OutputStreamType to write the error message to.
*/
public func printUsage<TargetStream: TextOutputStream>(_ error: Error, to: inout TargetStream) {
let format = formatOutput != nil ? formatOutput! : defaultFormat
print(format("\(error)", .error), terminator: "", to: &to)
printUsage(&to)
}
/**
* Prints a usage message.
*
* - parameter error: An error thrown from `parse()`. A description of the error
* (e.g. "Missing required option --extract") will be printed before the usage message.
*/
public func printUsage(_ error: Error) {
var out = StderrOutputStream.stream
printUsage(error, to: &out)
}
/**
* Prints a usage message.
*/
public func printUsage() {
var out = StderrOutputStream.stream
printUsage(&out)
}
}
| [
-1
] |
4c0e0629968b3310b73cea05a19347f97d96ff71 | 12cfed2ff1914fedfdc3ee400d113da36e03597c | /PPDemo/Summary「总览」/Swift/Function(函数).swift | 4d4972755bfa02507d2b2b7d463ab2ad0e76abbb | [
"MIT"
] | permissive | AbnerPei/PPDemo | 16a7c9a6643e2f12b9cd5ce3ba8bbcf226d817b8 | a2dc2fe1328de76a776ebdd657664efb1e2c59b2 | refs/heads/master | 2023-06-03T20:32:07.082164 | 2021-06-14T11:00:19 | 2021-06-14T11:00:19 | 64,399,255 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 330 | swift | //
// Function(函数).swift
// PPDemo
//
// Created by AbnerPei on 2021/4/30.
//
import UIKit
class FunctionViewController: UIViewController {
override func viewDidLoad() {
let a:() -> Void = test1;
a()
}
func test1() -> Void {
print("今天天气真好")
}
}
| [
-1
] |
a79c9c43a2c5d85533a3f50eeeed89d08ed37e49 | cf06f06fb41584b70113463b87e2e90e4c89ce69 | /RxSwiftMVVMNewsApp/Controllers/NewsTableViewController.swift | a935bb5bb9aca43bc0e78309ee58a5f4d039e93e | [] | no_license | EvgeniyUskov/RxSwiftMVVMNews | 88ec124259cdf5354ebb6b195a50d5432729c13e | 32066b5f91293fccda4acf9460a972ffe4100a96 | refs/heads/main | 2023-02-23T03:24:49.687762 | 2021-01-28T07:07:18 | 2021-01-28T07:07:18 | 322,648,088 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,020 | swift | //
// NewsTableViewController.swift
// RxSwiftMVVMNewsApp
//
// Created by Evgeniy Uskov on 18.12.2020.
//
import UIKit
import RxSwift
import RxCocoa
class NewsTableViewController : UITableViewController {
let disposeBag = DisposeBag()
var viewModel: ArticleListViewModel?
override func viewDidLoad() {
super.viewDidLoad()
UIHelper.setupNavBar(vc: self)
populateNews()
}
}
extension NewsTableViewController {
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.viewModel?.articleViewModels.count ?? 0
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: Constants.newsCellId, for: indexPath) as? NewsCell else {fatalError("Unable to dequeue newsCell")}
if let articleViewModel = viewModel?.article(at: indexPath.row) {
articleViewModel.title.asDriver(onErrorJustReturn: "")
.drive(cell.titleLabel.rx.text)
.disposed(by: disposeBag)
articleViewModel.description.asDriver(onErrorJustReturn: "")
.drive(cell.descriptionLabel.rx.text)
.disposed(by: disposeBag)
cell.setup()
}
return cell
}
}
extension NewsTableViewController {
private func populateNews() {
guard let url = URL.urlForNewsAPI() else {return}
let resource = Resource<ArticleResponse>(url: url)
URLRequest.load(resource: resource)
.subscribe(onNext: {
articleResponse in
let articles = articleResponse.articles
self.viewModel = ArticleListViewModel(articles: articles)
DispatchQueue.main.async {
self.tableView.reloadData()
}
} )
.disposed(by: disposeBag)
}
}
| [
-1
] |
003427df0db1bd88e5bd2845349b649fd0710363 | c8ef09b6b01006ad66f511b4f81108357c910628 | /cybexMobile/UI/SectionCornerViewView.swift | cd09b1e390e36eea39b59a4f2d974a8796d0a44e | [] | no_license | DaiKeMeng/cybex-ios | b430709104eda4ca6c3c8856568c4ef72f18e53c | de9dfaed039c4f5d8d07d531c28c55d313917921 | refs/heads/master | 2020-04-03T15:32:10.635112 | 2018-10-25T03:09:02 | 2018-10-25T03:09:02 | 141,396,776 | 0 | 0 | null | 2018-07-18T07:19:08 | 2018-07-18T07:19:07 | null | UTF-8 | Swift | false | false | 1,745 | swift | //
// SectionCornerViewView.swift
// cybexMobile
//
// Created koofrank on 2018/8/13.
// Copyright © 2018年 Cybex. All rights reserved.
//
import Foundation
import TinyConstraints
@IBDesignable
class SectionCornerViewView: UIView {
@IBOutlet weak var stackView: UIStackView!
@IBOutlet weak var shadowView: CornerAndShadowView!
var data: Any? {
didSet {
}
}
fileprivate func setup() {
updateHeight()
}
override var intrinsicContentSize: CGSize {
return CGSize.init(width: UIView.noIntrinsicMetric,height: dynamicHeight())
}
fileprivate func updateHeight() {
layoutIfNeeded()
self.height = dynamicHeight()
invalidateIntrinsicContentSize()
}
fileprivate func dynamicHeight() -> CGFloat {
let lastView = self.subviews.last?.subviews.last
return lastView?.bottom ?? 0
}
override func layoutSubviews() {
super.layoutSubviews()
layoutIfNeeded()
}
override init(frame: CGRect) {
super.init(frame: frame)
loadViewFromNib()
setup()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
loadViewFromNib()
setup()
}
fileprivate func loadViewFromNib() {
let bundle = Bundle(for: type(of: self))
let nibName = String(describing: type(of: self))
let nib = UINib.init(nibName: nibName, bundle: bundle)
let view = nib.instantiate(withOwner: self, options: nil).first as! UIView
insertSubview(view, at: 0)
view.frame = self.bounds
view.autoresizingMask = [.flexibleHeight, .flexibleWidth]
}
}
| [
-1
] |
675c7854c0c12b648c3d953df52beda6d40267cb | f36db81b96698bbb093f49da9c4a208fb0c3a739 | /Leader/Home VCs/ChapterVC.swift | 1c600fad249b37338d3ed019066e443614073f1c | [] | no_license | tarynneal10/Leader | a0628c58a1263f515df5425e2a43d9a634fbc84b | 8d8cfc58774ec9fe33c990eff22d583bfd4ce190 | refs/heads/master | 2020-06-23T07:31:12.489445 | 2020-04-24T19:24:32 | 2020-04-24T19:24:32 | 198,556,865 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,509 | swift | //
// ChapterVC.swift
// Leader
//
// Created by Taryn Neal on 9/6/19.
// Copyright © 2019 Taryn Neal. All rights reserved.
//
import Foundation
import UIKit
import Firebase
import FirebaseFirestore
import SDWebImage
import FirebaseUI
import SVProgressHUD
class ChapterVC : UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout{
@IBOutlet weak var chapterDescriptionLabel: UILabel!
@IBOutlet weak var officerView: UICollectionView!
@IBOutlet weak var view1: UIView!
@IBOutlet weak var officerViewHeight: NSLayoutConstraint!
var db: Firestore!
var storage : Storage!
var DocRef : Query?
var userRef : Query?
var chapterRef : Query?
var storageRef : [StorageReference] = []
var chapterName = ""
var officerArray : [String] = []
var urlArray : [String] = []
override func viewDidLoad() {
super.viewDidLoad()
db = Firestore.firestore()
storage = Storage.storage()
officerView.delegate = self
officerView.dataSource = self
getUser()
SVProgressHUD.show()
}
//MARK: Retrieving from cloud
//Gets user for other queries
func getUser() {
guard let userID = Auth.auth().currentUser?.uid else { return }
userRef = db.collection("members").whereField("user UID", isEqualTo: userID)
userRef?.getDocuments() { (querySnapshot, err) in
if let err = err {
print("Error getting documents: \(err)")
//Put more error handling here
} else {
for document in querySnapshot!.documents {
//print("\(document.documentID) => \(document.data())")
let chapter = document.get("chapter") as? String
self.chapterName = chapter!
self.navigationItem.title = self.chapterName
self.DocRef = self.db.collection("members").whereField("chapter", isEqualTo: self.chapterName)
self.chapterRef = self.db.collection("chapter").whereField("name", isEqualTo: self.chapterName)
}
self.setDescription()
self.populateOfficers()
}
}
}
//Gets officers
func populateOfficers() {
DocRef?.getDocuments() { (querySnapshot, err) in
if let err = err {
print("Error getting documents: \(err)")
//Put more error handling here
} else {
for document in querySnapshot!.documents {
//print("\(document.documentID) => \(document.data())")
let position = document.get("position") as? String
let name = document.get("name") as? String
let url = document.get("imageURL") as? String
if position != "Member", position != "Advisor" {
self.officerArray.append("\(position!): \(name!)")
self.storageRef.append(self.storage.reference(forURL: url!))
}
}
SVProgressHUD.dismiss()
self.officerView.reloadData()
let viewHeight = self.officerView.collectionViewLayout.collectionViewContentSize.height
self.officerViewHeight.constant = viewHeight
self.view.setNeedsLayout()
//self.view.layoutIfNeeded()
//self.view.layoutSubviews()
}
}
}
//Sets description for chapter text box
func setDescription() {
chapterRef?.getDocuments() { (querySnapshot, err) in
if let err = err {
print("Error getting documents: \(err)")
//Put more error handling here
} else {
for document in querySnapshot!.documents {
print("\(document.documentID) => \(document.data())")
self.chapterDescriptionLabel.text = document.get("description") as? String
}
}
}
}
//MARK: Collection View Functions
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return officerArray.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "officerCell", for: indexPath) as! OfficerCell
let placeholderImage = UIImage(named: "Anon")
let photoUrl = storageRef[indexPath.row]
cell.label.text = officerArray[indexPath.row]
cell.image.sd_setImage(with: photoUrl, placeholderImage: placeholderImage)
return cell
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
//let height = view.frame.size.height
let width = view.frame.size.width
return CGSize(width: width * 0.3, height: 155)
}
@IBAction func unwindToChapterVC(segue: UIStoryboardSegue) {
print("Unwind to ChapterVC")
}
}
//MARK: OfficerCell Class
class OfficerCell : UICollectionViewCell {
@IBOutlet weak var image: UIImageView!
@IBOutlet weak var label: UILabel!
}
| [
-1
] |
341c1afffe31e6e42ba03e027e186d830e86f7c0 | 3eab4e3c879d29aa9521aa12aed8829aa5511ff1 | /LHChatMessage/LHChatMessage/RosterTableViewController.swift | 448293563b0b2b2a359d8d715759ce6f668a454b | [
"MIT"
] | permissive | LawrenceHan/iOS-project-playground | e0d79d2a49d6938edfbea99720cfa93cd7dd4a83 | dc9fef2e0b4f3e084fdf140df9a2f487c0654d7c | refs/heads/master | 2021-01-17T08:12:27.977800 | 2016-12-11T11:41:23 | 2016-12-11T11:41:23 | 32,574,721 | 2 | 0 | null | 2016-12-11T11:41:24 | 2015-03-20T09:26:31 | Objective-C | UTF-8 | Swift | false | false | 6,178 | swift | //
// RosterTableViewController.swift
// LHChatMessage
//
// Created by Hanguang on 3/15/16.
// Copyright © 2016 Hanguang. All rights reserved.
//
import UIKit
class RosterTableViewController: UITableViewController, ChatDelegate {
var onlineBuddies = NSMutableArray()
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
override func viewDidLoad() {
super.viewDidLoad()
appDelegate.delegate = self
let rightBarItem = UIBarButtonItem(barButtonSystemItem: .Action, target: self, action: Selector("sendYo:"))
navigationItem.rightBarButtonItem = rightBarItem
let leftBarItem = UIBarButtonItem(barButtonSystemItem: .Cancel, target: self, action: Selector("logOut:"))
navigationItem.leftBarButtonItem = leftBarItem
}
override func viewDidAppear(animated: Bool) {
if (NSUserDefaults.standardUserDefaults().objectForKey("userID") != nil) {
appDelegate.connect({ (connected) -> () in
if connected {
self.title = self.appDelegate.xmppStream.myJID.bare()
self.appDelegate.xmppRoster.fetchRoster()
} else {
self.performSegueWithIdentifier("Home.To.Login", sender: self)
}
})
} else {
self.performSegueWithIdentifier("Home.To.Login", sender: self)
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Button methods
func sendYo() {
let message = "Yo!"
let senderJID = XMPPJID.jidWithString("100670")
let msg = XMPPMessage(type: "chat", to: senderJID)
msg.addBody(message)
self.appDelegate.xmppStream.sendElement(msg)
}
func logOut() {
NSUserDefaults.standardUserDefaults().setValue(nil, forKey: "userID")
NSUserDefaults.standardUserDefaults().setValue(nil, forKey: "userPassword")
self.performSegueWithIdentifier("Home.To.Login", sender: self)
}
// MARK: - Chat Delegates
func buddyWentOnline(name: String) {
if !onlineBuddies.containsObject(name) {
onlineBuddies.addObject(name)
tableView.reloadData()
}
}
func buddyWentOffline(name: String) {
onlineBuddies.removeObject(name)
tableView.reloadData()
}
func didDisconnect() {
onlineBuddies.removeAllObjects()
tableView.reloadData()
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return onlineBuddies.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
// Configure the cell...
cell.textLabel?.text = onlineBuddies[indexPath.row] as? String
return cell
}
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let alertController = UIAlertController(title: "Warning!",
message: "It will send Yo! to the recipient, continue ?", preferredStyle: UIAlertControllerStyle.Alert)
alertController.addAction(UIAlertAction(title: "Cancel", style: .Cancel,
handler: { (action) -> Void in
alertController.dismissViewControllerAnimated(true, completion: nil)
}))
alertController.addAction(UIAlertAction(title: "OK", style: .Default,
handler: { (action) -> Void in
let message = "Yo!"
let senderJID = XMPPJID.jidWithString(self.onlineBuddies[indexPath.row] as? String)
let msg = XMPPMessage(type: "chat", to: senderJID)
msg.addBody(message)
self.appDelegate.xmppStream.sendElement(msg)
}))
presentViewController(alertController, animated: true, completion: nil)
}
/*
// Override to support conditional editing of the table view.
override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
*/
/*
// Override to support editing the table view.
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == .Delete {
// Delete the row from the data source
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
} else if editingStyle == .Insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
override func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) {
}
*/
/*
// Override to support conditional rearranging of the table view.
override func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// Return false if you do not want the item to be re-orderable.
return true
}
*/
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
71cd76c4d4d21499c6aab0b73db5006e61cf383b | dc51f0f0aea96027428f6bc91f35c00368c21731 | /TwitterApp/AppDelegate.swift | e8356921f10fd313cf51e119405afdc9fcd88066 | [] | no_license | Iraniya/TwitterClone | 376575f3e96e854b18138bea862a37e1a00dee54 | 17e245f950e5084bf0fcfbee9583924b26e5db32 | refs/heads/master | 2021-05-02T08:18:19.730985 | 2018-02-21T19:53:02 | 2018-02-21T19:53:02 | 120,800,693 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,418 | swift | //
// AppDelegate.swift
// TwitterApp
//
// Created by Iraniya Naynesh on 05/02/18.
// Copyright © 2018 Iraniya Naynesh. 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.
window = UIWindow(frame: UIScreen.main.bounds)
window?.makeKeyAndVisible()
window?.rootViewController = UINavigationController(rootViewController: HomeDatasourceController())
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
294924,
229388,
229391,
327695,
229394,
229397,
229399,
229402,
229405,
229408,
294950,
229415,
229417,
327722,
237613,
229422,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
229432,
352318,
286791,
237640,
286797,
237646,
311375,
163920,
196692,
319573,
311383,
319590,
311400,
303212,
131192,
237693,
303230,
327814,
303241,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
286922,
286924,
286926,
319694,
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,
270640,
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,
65938,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
311746,
98756,
278980,
319945,
278986,
319947,
278990,
278994,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
311804,
287230,
279040,
303617,
287234,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
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,
295533,
172655,
172656,
352880,
295538,
172660,
287349,
287355,
287360,
295553,
172675,
295557,
311942,
287365,
303751,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
303773,
164509,
172705,
287394,
172707,
303780,
287390,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312006,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
418523,
189149,
303838,
279258,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
189169,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
230241,
279394,
303976,
336744,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
304009,
213895,
304011,
230284,
304013,
295822,
279438,
189329,
295825,
304019,
189331,
279445,
58262,
304027,
279452,
410526,
279461,
140202,
213931,
304042,
230327,
304055,
287675,
230334,
304063,
304065,
295873,
213954,
156612,
189378,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
312321,
295945,
230413,
197645,
295949,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
296004,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
164973,
312432,
279669,
304249,
337018,
304258,
66690,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
337067,
165035,
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,
230689,
173350,
312622,
279857,
296243,
312630,
222522,
296253,
230718,
296255,
312639,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
312676,
230760,
173418,
148843,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181631,
148865,
312711,
296331,
288140,
288144,
230800,
304533,
288154,
337306,
173472,
288160,
288162,
279975,
304555,
370092,
279983,
173488,
288176,
312755,
296373,
312759,
279991,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
148946,
370130,
222676,
288210,
280021,
288212,
288214,
329177,
239064,
288217,
288218,
288220,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
320998,
288234,
370146,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
181854,
280158,
370272,
403039,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
321195,
296622,
321200,
337585,
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,
288510,
124671,
67330,
280324,
198405,
313093,
288519,
198416,
280337,
296723,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
321336,
296767,
288576,
345921,
304968,
280393,
280402,
173907,
313171,
313176,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
247688,
280464,
124817,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
411601,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305168,
305176,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
215123,
354390,
288859,
280669,
149599,
223327,
149601,
321634,
149603,
280671,
329830,
280681,
313451,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
321717,
280764,
280769,
280771,
280774,
313548,
321740,
280783,
280786,
313557,
280793,
280796,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
182517,
280825,
280827,
280830,
280831,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
289087,
280897,
305480,
239944,
239947,
305485,
305489,
379218,
280919,
248153,
354653,
313700,
313705,
280937,
280940,
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,
281045,
281047,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
150025,
338440,
223757,
281102,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
150066,
158262,
158266,
289342,
281154,
322115,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
256716,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281372,
322341,
215850,
281388,
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,
289694,
289696,
289700,
289712,
289724,
52163,
281567,
289762,
322534,
297961,
183277,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
322630,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
290008,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
306427,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
290174,
298365,
224641,
281987,
298372,
314756,
265604,
224647,
281990,
298377,
314763,
298381,
142733,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
306608,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
290321,
323090,
282130,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282144,
290344,
306731,
290349,
290351,
290356,
224849,
282195,
282199,
282201,
306778,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
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,
241509,
110438,
298860,
110445,
282478,
315249,
282481,
110450,
315251,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
241560,
241563,
241565,
241567,
241569,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
290739,
241588,
282547,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
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,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
176311,
307385,
307386,
258235,
307388,
176316,
307390,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
184579,
282893,
291089,
282906,
291104,
233766,
176435,
315701,
332086,
307510,
151864,
168245,
307515,
307518,
282942,
151874,
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,
283033,
242075,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
127413,
291254,
127417,
291260,
127421,
127424,
299457,
127429,
291269,
127434,
315856,
315860,
176597,
127447,
299481,
176605,
242143,
127457,
291299,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127494,
283142,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
234006,
127511,
152087,
234010,
135707,
242202,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
299655,
373383,
316051,
225941,
316054,
299672,
135834,
373404,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
242431,
209665,
299778,
234242,
242436,
234246,
226056,
234248,
291593,
242443,
242445,
234254,
291601,
234258,
242450,
242452,
201496,
234264,
234266,
234269,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
185180,
234333,
308063,
234336,
242530,
349027,
234338,
234344,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
291711,
234368,
291714,
201603,
291716,
234373,
234370,
226182,
234375,
308105,
324490,
226185,
234384,
234388,
234390,
324504,
226200,
209818,
308123,
234396,
324508,
291742,
234393,
234401,
291747,
291748,
234405,
291750,
324518,
324520,
234407,
324522,
291754,
291756,
226220,
234414,
324527,
291760,
201650,
324531,
226230,
234422,
324536,
275384,
234428,
291773,
242623,
324544,
226239,
234434,
324546,
324548,
234431,
226245,
234437,
234439,
234443,
291788,
193486,
234446,
193488,
234449,
275406,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
234493,
316416,
234496,
308226,
234501,
308231,
234504,
234507,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234593,
234595,
234597,
300133,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
275594,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
324757,
234647,
234648,
226453,
234650,
308379,
275606,
300189,
324766,
119967,
324768,
275608,
234653,
283805,
242852,
300197,
177318,
234657,
275626,
234667,
316596,
308414,
234687,
300226,
308418,
234692,
300229,
308420,
308422,
316610,
234695,
300234,
283844,
283850,
300238,
283854,
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,
275725,
349451,
177424,
283917,
349464,
415009,
283939,
259367,
283951,
300344,
226617,
243003,
226628,
300357,
177482,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
243046,
218473,
136562,
333178,
275834,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
300433,
234899,
300436,
357783,
316824,
316826,
300448,
144810,
144812,
144814,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
316959,
284194,
284196,
235045,
284199,
235047,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
243268,
284231,
226886,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
276053,
284249,
317015,
243290,
284253,
243293,
284255,
300638,
284258,
292452,
292454,
177766,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
276098,
284297,
317066,
284299,
317068,
284301,
284303,
284306,
276114,
284308,
284312,
276122,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
358114,
358116,
276197,
358119,
325353,
358122,
358126,
276206,
358128,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
300828,
300830,
276255,
300832,
325408,
317221,
227109,
358183,
186151,
276268,
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,
317332,
358292,
399252,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
292776,
284585,
276395,
292784,
276402,
358326,
161718,
358330,
276411,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
153568,
292839,
292843,
178161,
227314,
325624,
317435,
317446,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
243779,
325700,
292934,
243785,
350293,
350295,
309337,
227418,
350302,
227423,
350304,
178273,
309346,
227426,
194660,
350308,
309350,
309348,
292968,
309352,
350313,
309354,
301163,
350316,
227430,
301167,
276586,
350321,
227440,
284786,
276595,
350325,
252022,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
333957,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
153765,
284837,
350375,
350379,
350381,
350383,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309494,
243960,
227583,
276735,
276739,
211204,
276742,
227596,
325910,
309530,
342298,
276766,
211232,
317729,
211241,
325937,
325943,
211260,
260421,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
366983,
317833,
178572,
285070,
293263,
178575,
178583,
227738,
317853,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
236056,
55837,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
301636,
318020,
301639,
301643,
285265,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
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,
154292,
277173,
342707,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342744,
342745,
137946,
342747,
342749,
113378,
203491,
228069,
277223,
342760,
56041,
285417,
56043,
277232,
228081,
56059,
310015,
310020,
310029,
228113,
285459,
277273,
293659,
326430,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
375606,
285494,
301880,
285499,
301884,
293696,
310080,
277317,
277329,
162643,
310100,
301911,
277337,
301921,
400236,
236397,
162671,
326514,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
310179,
293798,
293802,
236460,
276579,
293811,
293817,
293820,
203715,
326603,
342994,
293849,
293861,
228327,
228328,
318442,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
56313,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
277577,
310344,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
277608,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
392326,
294026,
285835,
302218,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
294072,
318651,
277695,
318657,
244930,
302275,
130244,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
228592,
294132,
138485,
204026,
228606,
204031,
64768,
310531,
138505,
228617,
318742,
204067,
277801,
277804,
285997,
285999,
277807,
113969,
277811,
318773,
261430,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
302403,
294211,
277832,
277836,
294221,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
277857,
277860,
302436,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
277892,
277894,
253320,
310665,
318858,
327046,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
277947,
310715,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
277995,
310764,
286188,
278000,
228851,
310772,
327156,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
40448,
228864,
286214,
302603,
302614,
286233,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
286248,
310831,
245288,
40499,
40502,
212538,
40507,
40511,
40513,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
40529,
228944,
40533,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286313,
40554,
310892,
40557,
40560,
343666,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
229076,
286425,
319194,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
302852,
302854,
294664,
311048,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
188252,
237409,
360317,
294785,
327554,
360322,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
163755,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
237562
] |
e0c365e4824de2e11f5cd7fbe486fc5fb0d66464 | 76f23c9632dda6dc2b45bd3c4dafc4d961a4c832 | /flipviewsTests/flipviewsTests.swift | 7bd4d45c4e03e3a54aa1cad4b7f1b2fad4b3c875 | [] | no_license | agerchan/flipviews | b48cd6f2e84f6a812c6358ec5917edffca8c8d00 | 48aa0f80c0becf9f99675146fe43d9517f1c59d7 | refs/heads/master | 2022-11-12T07:50:01.182275 | 2020-06-26T18:27:11 | 2020-06-26T18:27:11 | 275,088,317 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 968 | swift | //
// flipviewsTests.swift
// flipviewsTests
//
// Created by Anna Gerchanovsky on 6/24/20.
// Copyright © 2020 Anna Gerchanovsky. All rights reserved.
//
import XCTest
@testable import flipviews
class flipviewsTests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() throws {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
358410,
354316,
360462,
317467,
241692,
16419,
223268,
329765,
315432,
315434,
325674,
344107,
176175,
243759,
321583,
253999,
346162,
241716,
319542,
243767,
124984,
241720,
352315,
325694,
376894,
352326,
338007,
200794,
356447,
254048,
329829,
321637,
319591,
319598,
352368,
333940,
333955,
325776,
323729,
317587,
362659,
333991,
333992,
333996,
32941,
379071,
338119,
346314,
334042,
254170,
194782,
356576,
338150,
321772,
385262,
338164,
336120,
344313,
356602,
12542,
194820,
313608,
375051,
125199,
254226,
272660,
338197,
368916,
334103,
325912,
315673,
151839,
237856,
125217,
151847,
338218,
325931,
254251,
321840,
127284,
336183,
323916,
319821,
348492,
254286,
250192,
344401,
366930,
383311,
155990,
215385,
272729,
354655,
106847,
242023,
160110,
246127,
250226,
354677,
246136,
139640,
246137,
106874,
211326,
313727,
362881,
248194,
340357,
332167,
242058,
108944,
317852,
121245,
39324,
246178,
340398,
311727,
342450,
334260,
319930,
336317,
342466,
254406,
324039,
188871,
129483,
342476,
317901,
6606,
334290,
242139,
256477,
342498,
195045,
334309,
127465,
330218,
319981,
109042,
319987,
254456,
324097,
342536,
348682,
340490,
254488,
322078,
207393,
375333,
377386,
358954,
197167,
348732,
242237,
352829,
348742,
322120,
340558,
244310,
332378,
354911,
436832,
139872,
242277,
344680,
191082,
346737,
313971,
139892,
344696,
356989,
152195,
311941,
348806,
369289,
344715,
334481,
346772,
111253,
316053,
352917,
111258,
318107,
363163,
346779,
344738,
139939,
336558,
109241,
248517,
363211,
164560,
242386,
334547,
361176,
363230,
338662,
375526,
330474,
342763,
418546,
322291,
312052,
312053,
348920,
344827,
344828,
35583,
363263,
162561,
191235,
336648,
264968,
322316,
326414,
312079,
322319,
207640,
336671,
344865,
342820,
189228,
353069,
355121,
353078,
355130,
336702,
342847,
355137,
355139,
252741,
353094,
353095,
348998,
355146,
355152,
355154,
377686,
244568,
322395,
189275,
355165,
109409,
357218,
127841,
351077,
342887,
326505,
355178,
242541,
246641,
246648,
361337,
269178,
211836,
254850,
359299,
260996,
240518,
109447,
316298,
349067,
426895,
355217,
326553,
318364,
127902,
185250,
256935,
359338,
353195,
140204,
363438,
347055,
252847,
326581,
373687,
330689,
349121,
363458,
359364,
381897,
211914,
330708,
359381,
340955,
248796,
248797,
207838,
343005,
359387,
340961,
64485,
52200,
123881,
340974,
383982,
359406,
347123,
349171,
349175,
201720,
320507,
330754,
357379,
330763,
320527,
146448,
324625,
330772,
418837,
322582,
320536,
201755,
326685,
252958,
336929,
357414,
345132,
357423,
252980,
359478,
324666,
324667,
132158,
361535,
336960,
248901,
257094,
361543,
250954,
250956,
341073,
156764,
314467,
250981,
253029,
257125,
318572,
351344,
187506,
337017,
363641,
341115,
363644,
150657,
248961,
349316,
349318,
337039,
347283,
324760,
339100,
351390,
343203,
253099,
44203,
253100,
3246,
367799,
113850,
343234,
367810,
259268,
353481,
353482,
283853,
333011,
351446,
148696,
357595,
134366,
359647,
330984,
222440,
328940,
351478,
128251,
363771,
261377,
320770,
322824,
242954,
328971,
353551,
251153,
349462,
245019,
320796,
126237,
208164,
109861,
369956,
130348,
66862,
353584,
351537,
345396,
318775,
312634,
116026,
216386,
337225,
337227,
251213,
353616,
331090,
316765,
243056,
312689,
327025,
314739,
116084,
314741,
382330,
314751,
318848,
337281,
357762,
378244,
253317,
388487,
112018,
9619,
314783,
251298,
208293,
245161,
241066,
316842,
314798,
343476,
210358,
163268,
361927,
366037,
210390,
210391,
210392,
210393,
310748,
103909,
245223,
361963,
54765,
321009,
251378,
359930,
210433,
329225,
253451,
253452,
359950,
323089,
316946,
146964,
398869,
253463,
374296,
423453,
349726,
134686,
187938,
245287,
347694,
312880,
312889,
425535,
349763,
243274,
128587,
333393,
349781,
196187,
44635,
345700,
323172,
374372,
120427,
204397,
54893,
138863,
333430,
247416,
370296,
366203,
325245,
175741,
337535,
339584,
337534,
339585,
224901,
345752,
255649,
245412,
323236,
321199,
364207,
224946,
337591,
224958,
323263,
323264,
333509,
319177,
245457,
241361,
241365,
181975,
345821,
325346,
333542,
345833,
345834,
212716,
212717,
294638,
360177,
319233,
323331,
339715,
360195,
339720,
323346,
321302,
366360,
169754,
255776,
339745,
241442,
341796,
247590,
257830,
333610,
362283,
366381,
259899,
315202,
325445,
153415,
339783,
360264,
159562,
345929,
341836,
325457,
337745,
255829,
241495,
362327,
341847,
345951,
345955,
325484,
362352,
325492,
341879,
317304,
124798,
325503,
55167,
327557,
247686,
253829,
325515,
350093,
325518,
337815,
118685,
350109,
319392,
253856,
354212,
188348,
362431,
174019,
321480,
212942,
212946,
212951,
219101,
354269,
354272,
360417,
354274,
313319,
337895,
174057,
354280,
327661,
247791,
362480,
333817
] |
21d4269892efcfab8d2951b9e404ce7bf267e2f5 | 6a086560998de8fc148f84e17c32b51bab44a1c3 | /Memorize/SceneDelegate.swift | 097f8ed2150e4ad2519a9a1e4590a2389f44c3b4 | [] | no_license | Lapinee/CS193P_2020 | 4fe6b090a37dcbdca8faa970c41d745c7a6cba53 | 0ae8154eec011e67bf0f4951b4f4e8ff2a76f2cf | refs/heads/main | 2023-03-20T18:26:26.549890 | 2021-03-18T08:04:49 | 2021-03-18T08:04:49 | 348,589,405 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,760 | swift | //
// SceneDelegate.swift
// Memorize
//
// Created by Azuchan on 2021/03/11.
//
import UIKit
import SwiftUI
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
// Create the SwiftUI view that provides the window contents.
let game = EmojiMemoryGame()
let contentView = EmojiMemoryGameView(viewModel: game)
// Use a UIHostingController as window root view controller.
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = UIHostingController(rootView: contentView)
self.window = window
window.makeKeyAndVisible()
}
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not 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,
393228,
393231,
393251,
352294,
344103,
393260,
163892,
393269,
213049,
385082,
376890,
16444,
393277,
254020,
376906,
327757,
254032,
286804,
368728,
180314,
254045,
368736,
376932,
286833,
368753,
286845,
286851,
262284,
360598,
286880,
286889,
377003,
377013,
164029,
327872,
377030,
377037,
180432,
368854,
377047,
377063,
205037,
393457,
393461,
336124,
418044,
336129,
385281,
262405,
180491,
262417,
368913,
262423,
377121,
262437,
254253,
336181,
262455,
262473,
344404,
418135,
262497,
418145,
262501,
213354,
262508,
262512,
213374,
385420,
393613,
262551,
262553,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
262593,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
164362,
328207,
410129,
393748,
262679,
377372,
188959,
385571,
377384,
33322,
352822,
270905,
197178,
418364,
369224,
385610,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
377473,
336513,
385671,
213642,
148106,
352919,
344745,
271018,
361130,
385714,
434868,
164535,
336568,
164539,
328379,
328387,
344777,
418508,
385743,
385749,
139998,
189154,
369382,
418540,
361196,
418555,
344832,
344837,
344843,
328462,
361231,
394002,
418581,
418586,
434971,
369436,
418591,
369439,
262943,
418594,
336676,
418600,
418606,
369464,
361274,
328516,
328520,
361289,
328523,
213848,
361307,
197469,
254813,
361310,
361318,
344936,
361323,
361335,
369544,
361361,
222129,
345036,
386004,
345046,
386012,
386019,
386023,
435188,
418822,
328710,
328715,
377867,
361490,
386070,
336922,
345119,
345134,
361525,
386102,
361537,
377931,
197708,
345172,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
386168,
410746,
361599,
214150,
345224,
386187,
337048,
345247,
361645,
337072,
337076,
345268,
402615,
361657,
337093,
402636,
165086,
66783,
328933,
222438,
386286,
328942,
386292,
206084,
115973,
345377,
345380,
353572,
345383,
263464,
337207,
378170,
369979,
386366,
337224,
337230,
337235,
353634,
197987,
337252,
402792,
345449,
99692,
271731,
378232,
337278,
271746,
181639,
181644,
361869,
181650,
230810,
263585,
181671,
181674,
181679,
337330,
181682,
181687,
370105,
181691,
181697,
361922,
337350,
181717,
271841,
329192,
116211,
402943,
337416,
329227,
419341,
419345,
329234,
419351,
419357,
345631,
370208,
419360,
394787,
419363,
370214,
419369,
419377,
419386,
206397,
214594,
419401,
353868,
419408,
214611,
419412,
403040,
345702,
222831,
370298,
353920,
403073,
403076,
345737,
198282,
403085,
345750,
419484,
345758,
419492,
345766,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
337601,
403139,
337607,
419528,
419531,
272083,
419543,
394967,
419545,
345819,
419548,
181982,
419551,
345829,
419560,
419564,
337647,
370416,
141052,
337661,
337671,
362249,
362252,
395022,
362256,
321300,
116512,
345888,
362274,
378664,
354107,
345916,
354112,
247618,
329545,
354124,
345932,
370510,
337743,
354132,
247639,
370520,
337751,
313181,
354143,
345965,
354157,
345968,
345971,
345975,
403321,
354173,
247692,
337809,
247701,
329625,
436133,
362414,
337845,
190393,
346059,
247760,
346064,
346069,
419810,
354275,
329699,
190440,
247790,
354314,
436290,
378956,
395340,
436307,
100454,
329853,
329857,
329868,
411806,
346273,
362661,
379067,
387261,
346317,
411862,
411865,
411869,
411874,
379108,
411877,
387303,
395496,
338154,
387307,
346350,
387314,
436474,
321787,
379135,
411905,
411917,
43279,
379154,
395539,
387350,
387353,
338201,
182559,
395567,
248112,
264502,
362823,
436556,
190797,
321880,
362844,
379234,
182642,
354674,
420237,
379279,
354728,
338353,
338382,
272849,
338387,
248279,
256474,
182755,
338404,
330225,
248309,
199165,
199189,
420377,
191012,
330320,
199250,
346722,
248427,
191085,
346736,
338544,
191093,
346743,
330384,
346769,
150184,
363198,
223936,
355025,
273109,
355029,
264919,
183006,
338661,
338665,
264942,
330479,
363252,
338680,
207620,
191240,
338701,
338712,
363294,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
355151,
330581,
387929,
330585,
355167,
265056,
355176,
355180,
355185,
330612,
330643,
412600,
207809,
379849,
347082,
396246,
330711,
248794,
248799,
437219,
257009,
265208,
330750,
265215,
199681,
158759,
396329,
347178,
404526,
396337,
396340,
339002,
388155,
339010,
347208,
412765,
339037,
257121,
322660,
265321,
248952,
420985,
330886,
248986,
44199,
380071,
339118,
249015,
339133,
322763,
388320,
363757,
388348,
339199,
175376,
175397,
208167,
273709,
372016,
437553,
347442,
199989,
44343,
175416,
396601,
208189,
437567,
175425,
437571,
126279,
437576,
437584,
331089,
437588,
331094,
396634,
175451,
437596,
429408,
175458,
208228,
175461,
175464,
249210,
175484,
175487,
249215,
175491,
249219,
249228,
249235,
175514,
175517,
396706,
175523,
355749,
396723,
388543,
380353,
380364,
339406,
372177,
208338,
249303,
413143,
339418,
339421,
249310,
249313,
339425,
339429,
339435,
249329,
69114,
372229,
339464,
249355,
208399,
175637,
405017,
134689,
339504,
413251,
265796,
265806,
224854,
224858,
257636,
224871,
372328,
257647,
372338,
224885,
224888,
224891,
224895,
372354,
421509,
126597,
339593,
224905,
159375,
11919,
339602,
126611,
224917,
126618,
208539,
224923,
224927,
224930,
224933,
257705,
224943,
257713,
224949,
257717,
257721,
224954,
257725,
224960,
257733,
224966,
224970,
257740,
339664,
224976,
257745,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
339696,
225013,
257788,
225021,
257791,
225027,
257796,
257802,
257805,
225039,
257808,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
257825,
225059,
339748,
257837,
413485,
225071,
225074,
257843,
372533,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
323404,
257869,
257872,
225105,
397140,
225109,
225113,
257881,
257884,
257887,
225120,
413539,
257891,
225128,
257897,
339818,
225138,
339827,
257909,
372598,
225142,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
184245,
372698,
372704,
372707,
356336,
372739,
266298,
217158,
421961,
200786,
356440,
217180,
430181,
356467,
266365,
192640,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
225439,
225442,
438434,
225445,
225448,
356521,
438441,
225451,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
389322,
225485,
225488,
225491,
225494,
266454,
225497,
225500,
225503,
225506,
356580,
217319,
225511,
225515,
225519,
381177,
397572,
389381,
356631,
381212,
258333,
356638,
356641,
356644,
356647,
389417,
356650,
356656,
332081,
307507,
356662,
397623,
332091,
225599,
332098,
201030,
348489,
151884,
430422,
348503,
250201,
332126,
332130,
250211,
340328,
250217,
348523,
332153,
356734,
250239,
389503,
438657,
332158,
389507,
348548,
356741,
332175,
160152,
373146,
340380,
373149,
373169,
266688,
201158,
127473,
217590,
340473,
266757,
340512,
381483,
356908,
356917,
348734,
356935,
348745,
381513,
389724,
332381,
373344,
381546,
119432,
340628,
184983,
373399,
340639,
332455,
389806,
381626,
373450,
357070,
357074,
332512,
332521,
340724,
332534,
155647,
348926,
389927,
152371,
348979,
348983,
340792,
398141,
127815,
357202,
389971,
136024,
357208,
389979,
357212,
430940,
357215,
439138,
201580,
201583,
349041,
340850,
201589,
430967,
324473,
398202,
119675,
324476,
340859,
324479,
324482,
373635,
324485,
324488,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
373672,
324525,
111539,
324534,
324539,
324542,
398280,
349129,
340940,
340942,
209874,
431073,
398307,
340964,
209896,
201712,
209904,
381947,
201724,
431100,
431107,
349203,
357411,
250915,
250917,
357419,
209980,
209996,
431180,
341072,
349268,
250968,
210011,
373853,
341094,
210026,
210032,
349296,
210037,
349309,
152704,
349313,
160896,
210053,
210056,
259217,
373905,
210068,
251045,
210108,
333003,
333010,
210132,
333016,
210144,
218355,
218361,
275709,
275713,
242947,
275717,
349460,
333079,
251161,
349486,
349492,
251190,
415034,
251211,
357710,
210261,
365912,
259423,
374113,
374118,
333164,
234867,
390518,
357756,
136591,
374161,
349591,
333222,
259516,
415168,
415187,
415192,
415194,
415197,
415208,
366057,
366064,
423424,
415258,
415264,
366118,
382503,
415271,
349739,
144940,
415279,
415282,
349748,
415286,
210488,
415291,
415295,
349762,
333387,
333396,
374359,
366173,
333415,
423529,
423533,
210547,
415354,
333440,
267910,
333472,
333499,
210632,
333512,
259789,
358100,
366301,
153311,
333535,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
268042,
210700,
366349,
210707,
399129,
210720,
366384,
358192,
210740,
366388,
358201,
399166,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
341852,
350046,
399200,
399208,
358256,
268144,
341877,
399222,
325494,
243584,
325505,
333699,
399244,
333725,
382891,
382898,
350153,
358348,
333777,
399318,
358372,
350194,
333819,
350204,
350207,
350214,
219144,
268299,
350225,
186388,
350241,
374819,
350245,
350249,
350252,
178221,
350272,
243782,
350281,
374865,
342113,
342134,
374904,
268435,
350411,
350417,
350423,
350426,
334047,
350449,
375027,
358645,
350459,
350462,
350465,
350469,
325895,
268553,
350477,
268560,
350481,
432406,
350487,
350491,
325915,
350494,
325918,
325920,
350500,
194854,
350505,
391469,
350510,
358701,
358714,
358717,
383307,
334162,
358738,
383331,
383334,
391531,
383342,
268669,
194942,
391564,
383375,
366991,
268702,
416159,
342431,
375209,
326059,
375220,
334263,
358857,
195041,
334306,
104940,
375279,
162289,
416255,
350724,
350740,
334359,
342551,
342555,
334364,
416294,
350762,
252463,
334386,
358962,
358973,
334397,
252483,
219719,
244309,
399957,
334425,
326240,
375401,
268922,
334466,
334469,
162446,
326291,
342680,
342685,
260767,
342711,
260798,
260802,
350918,
342737,
391895,
154329,
416476,
113389,
342769,
203508,
375541,
342777,
391938,
391949,
326417,
375569,
375572,
375575,
375580,
162592,
326444,
383794,
326452,
326455,
375613,
244542,
326463,
326468,
326474,
326479,
326486,
342875,
326494,
326503,
375657,
433001,
326508,
400238,
326511,
211832,
392061,
359296,
351105,
252801,
260993,
400260,
211846,
342921,
236432,
342931,
400279,
392092,
400286,
252838,
359335,
252846,
400307,
351169,
359362,
170950,
187335,
359367,
359383,
359389,
383968,
359411,
261109,
261112,
244728,
383999,
261130,
326669,
261148,
359452,
211999,
261155,
261160,
359471,
375868,
343132,
384099,
384102,
326764,
367724,
384108,
326767,
187503,
343155,
384115,
212095,
351366,
384144,
351382,
351399,
367795,
367801,
351424,
367817,
326858,
244938,
253132,
343246,
351450,
343272,
351467,
351480,
351483,
351492,
343307,
261391,
359695,
253202,
261395,
253218,
171304,
384299,
376111,
326970,
384324,
343366,
212296,
212304,
367966,
343394,
343399,
367981,
343410,
155000,
327035,
253321,
155021,
384398,
245143,
343453,
155045,
40358,
245163,
114093,
343478,
359867,
384444,
146878,
327112,
384457,
327116,
327118,
359887,
359891,
343509,
368093,
155103,
343535,
343540,
368120,
343545,
409092,
253445,
359948,
359951,
245295,
359984,
343610,
400977,
400982,
343650,
327276,
245358,
138865,
155255,
155274,
368289,
425639,
425652,
155323,
425663,
155328,
155352,
212700,
155356,
155364,
245477,
155372,
212723,
245495,
409336,
155394,
155404,
245528,
155423,
360224,
155439,
204592,
155444,
155448,
384829,
384831,
360262,
155463,
155477,
376665,
155484,
261982,
425823,
155488,
376672,
155492,
327532,
261997,
376686,
262000,
262003,
425846,
262006,
327542,
262009,
147319,
262012,
155517,
155523,
155526,
360327,
376715,
155532,
262028,
262031,
262034,
262037,
262040,
262043,
155550,
253854,
262046,
262049,
262052,
155560,
155563,
155566,
393152,
311244,
393170,
155604,
155620,
253924,
155622,
253927,
327655,
360432,
204785,
393204,
360439,
253944,
393209,
393215
] |
38f539dda286627748d3cd7e34881ccafad8ce13 | 88a353907f04a976b4b9b2bab34b2c25a5ca1e3a | /ofoDemo/RigisterSucceedController.swift | 571b5f1694074baa1ffdb31927ad49cb97adc6e4 | [] | no_license | junnan525060/Epark | 480f3fa64c0dc22cf995f01c7df885e32019093f | 61365a61ca54b4348fc813361361a82cdd21b79f | refs/heads/master | 2021-07-24T00:43:00.135266 | 2017-11-05T01:56:50 | 2017-11-05T01:56:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,129 | swift | //
// RigisterSucceedController.swift
// ofoDemo
//
// Created by 郭焕杰 on 2017/10/14.
// Copyright © 2017年 hjackguo.github.io. All rights reserved.
//
import UIKit
class RigisterSucceedController: UIViewController {
@IBAction func `return`(_ sender: Any) {
performSegue(withIdentifier: "returnToMain", sender: self)
}
@IBAction func returnToLogin(_ sender: Any) {
performSegue(withIdentifier: "returnToMain", sender: self)
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
49fc7152d19a2db819a1292a5d5ad2d23da1d6f6 | 5ea036f67f96b0e3ebe1f6679f60bc34e2321c45 | /Sources/PuiCore/Template/ios/VIPER/IOSVIPEREntityTemplate.swift | 65a16fb703b77126b5e597536da932c9c673ada4 | [] | no_license | sakiyamaK/Pui | b291b30adbb714bc8bb63cd1ba7e0b5468bb88c9 | 424ea12b5d8451720df2a932e4ac93a666befdc6 | refs/heads/main | 2023-05-04T13:47:02.045789 | 2021-05-26T15:01:37 | 2021-05-26T15:01:37 | 337,992,121 | 1 | 0 | null | 2021-03-03T11:09:29 | 2021-02-11T10:10:38 | Swift | UTF-8 | Swift | false | false | 508 | swift |
import Foundation
struct IOSVIPEREntityTemplate: Template {
var dirPath: String { "./" + Const.templateDirName + "/" + FrontType.ios.name + "/" + ArchitectureType.viper.name + "/Entity/" }
var fileName: String { Const.prefix + "Entity.swift" }
var code: String {
"""
//
// \(Const.prefix)Entity.swift
// \(Const.targetName)
//
// Created by \(Const.userName) on \(Const.yearStr)/\(Const.monthStr)/\(Const.dayStr).
//
import Foundation
struct \(Const.prefix)Entity: Decodable {
}
"""
}
}
| [
-1
] |
0e00fc49c8339c19030c6c2d3af8d554fd0e81f6 | 21105a47f3eea1b7d9e5b586ae05f74841445fe8 | /Chart of Accounts/Controller/SettingsController/ChangeLanguageController.swift | 8908d5e8b70e45fa079a3bbad544e2b28e9b5f0e | [] | no_license | AsliddinRasulov477/Chart-of-Accounts | b7e4ce1fd396d43a936e9662da39d378b39398c1 | 0c54db582b1f048b7290481476b6f533e89873ac | refs/heads/main | 2023-02-03T23:26:59.889838 | 2020-12-26T19:06:59 | 2020-12-26T19:06:59 | 324,618,600 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,554 | swift | //
// ChangeLanguageControllerViewController.swift
// 3003
//
// Created by Asliddin Rasulov on 24/10/20.
//
import UIKit
class ChangeLanguageController: UIViewController {
@IBOutlet weak var tableView: UITableView!
let langsArray = ["uz-Cyrl", "ru", "uz"]
let langsCellTitle = ["Узбек тили", "Русский", "O'zbek tili"]
override func viewDidLoad() {
super.viewDidLoad()
tableView.rowHeight = view.frame.height / 17
tableView.tableFooterView = UIView()
}
}
extension ChangeLanguageController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 3
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "langCell", for: indexPath)
if LocalizationSystem.shared.locale == Locale(identifier: langsArray[indexPath.row]) {
cell.accessoryType = .checkmark
} else {
cell.accessoryType = .none
}
cell.textLabel?.text = langsCellTitle[indexPath.row]
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
LocalizationSystem.shared.locale =
Bundle.main.localizations.filter { $0 != "Base" }.map { Locale(identifier: $0) }[indexPath.row + 1]
tableView.reloadData()
title = "til".localized
}
}
| [
-1
] |
cd8c43f1d365adf0c7d5d6d7c2188dd4a0790196 | 373af9f2cb2435525358e14b7fae7e50aa349674 | /Pods/UICircularProgressRing/UICircularProgressRing/UICircularProgressRingView.swift | bd8f95c8b4138c6955b9d15f0341b34bb2f8fa46 | [
"MIT"
] | permissive | TiciaChance/Rise | 373a66113ced5599a9e39f86da5c9980330e63a1 | 3bbbe0384d8dc1d613e719ca603ca277e3297baa | refs/heads/master | 2021-01-20T10:47:56.758722 | 2017-01-04T20:36:11 | 2017-01-04T20:36:11 | 74,627,708 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 16,781 | swift | //
// UICircularProgressRingView.swift
// UICircularProgressRing
//
// Copyright (c) 2016 Luis Padron
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
// associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute,
// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
// is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
import UIKit
/**
# UICiruclarProgressRingView
This is the UIView subclass that creates and handles everything
to do with the progress ring
This class has a custom CALayer (UICircularProgressRingLayer) which
handels the drawing and animating of the view
The properties in this class correspond with the properties in UICircularProgressRingLayer.
When they are set in here, they are also set for the layer and drawn accordingly
Read the docs for what each property does and what can be customized.
## Author:
Luis Padron
*/
@IBDesignable open class UICircularProgressRingView: UIView {
// MARK: Delegate
/**
The delegate for the UICircularProgressRingView
## Important ##
When progress is done updating via UICircularProgressRingView.setValue(_:), the
finishedUpdatingProgressFor(_ ring: UICircularProgressRingView) will be called.
The ring will be passed to the delegate in order to keep track of multiple ring updates if needed.
## Author:
Luis Padron
*/
open var delegate: UICircularProgressRingDelegate?
// MARK: Value Properties
/**
The value property for the progress ring. ex: (23)/100
## Important ##
Default = 0
Recommended to assign value using setProgress(_:) instead as you have more control over what happens
This is public simply for storyboard support
## Author:
Luis Padron
*/
@IBInspectable open var value: CGFloat = 0 {
didSet {
self.ringLayer.value = self.value
}
}
/**
The max value for the progress ring. ex: 23/(100)
Used to calculate amount of progress depending on self.value and self.maxValue
## Important ##
Default = 100
## Author:
Luis Padron
*/
@IBInspectable open var maxValue: CGFloat = 100 {
didSet {
self.ringLayer.maxValue = self.maxValue
}
}
// MARK: View Style
/**
Variable for the style of the progress ring.
Range: [1,4]
The four styles are
- 1: Radius of the inner ring is smaller (inner ring inside outer ring)
- 2: Radius of inner ring is equal to outer ring (both at same location)
- 3: Radius of inner ring is equal to outer ring, and the outer ring is dashed
- 4: Radius of inner ring is equal to outer ring, and the outer ring is dotted
## Important ##
Default = 1
## Author:
Luis Padron
*/
@IBInspectable open var viewStyle: Int = 1 {
didSet {
self.ringLayer.viewStyle = self.viewStyle
}
}
/**
An array of CGFloats, used to calculate the dash length for viewStyle = 3
## Important ##
Default = [7.0, 7.0]
## Author:
Luis Padron
*/
open var patternForDashes: [CGFloat] = [7.0, 7.0] {
didSet {
self.ringLayer.patternForDashes = self.patternForDashes
}
}
/**
The start angle for the entire progress ring view.
Please note that Cocoa Touch uses a clockwise rotating unit circle.
I.e: 90 degrees is at the bottom and 270 degrees is at the top
## Important ##
Default = 0 (degrees)
Values should be in degrees (they're converted to radians internally)
## Author:
Luis Padron
*/
@IBInspectable open var startAngle: CGFloat = 0 {
didSet {
self.ringLayer.startAngle = self.startAngle
}
}
/**
The end angle for the entire progress ring
Please note that Cocoa Touch uses a clockwise rotating unit circle.
I.e: 90 degrees is at the bottom and 270 degrees is at the top
## Important ##
Default = 0 (degrees)
Values should be in degrees (they're converted to radians internally)
## Author:
Luis Padron
*/
@IBInspectable open var endAngle: CGFloat = 360 {
didSet {
self.ringLayer.endAngle = self.endAngle
}
}
// MARK: Outer Ring properties
/**
The width of the outer ring for the progres bar
## Important ##
Default = 10.0
## Author:
Luis Padron
*/
@IBInspectable open var outerRingWidth: CGFloat = 10.0 {
didSet {
self.ringLayer.outerRingWidth = self.outerRingWidth
}
}
/**
The color for the outer ring
## Important ##
Default = UIColor.gray
## Author:
Luis Padron
*/
@IBInspectable open var outerRingColor: UIColor = UIColor.gray {
didSet {
self.ringLayer.outerRingColor = self.outerRingColor
}
}
/**
The style for the outer ring end cap (how it is drawn on screen)
Range [1,3]
- 1: Line with a squared off end
- 2: Line with a rounded off end
- 3: Line with a square end
- <1 & >3: Defaults to style 1
## Important ##
Default = 1
## Author:
Luis Padron
*/
@IBInspectable open var outerRingCapStyle: Int = 1 {
didSet {
switch self.outerRingCapStyle{
case 1:
self.outStyle = .butt
self.ringLayer.outerCapStyle = .butt
case 2:
self.outStyle = .round
self.ringLayer.outerCapStyle = .round
case 3:
self.outStyle = .square
self.ringLayer.outerCapStyle = .square
default:
self.outStyle = .butt
self.ringLayer.outerCapStyle = .butt
}
}
}
/**
A private outerRingCapStyle variable, this is set whenever the
IB compatible variable above is set.
Basically in here because IB doesn't support CGLineCap selection.
*/
fileprivate var outStyle: CGLineCap = .butt
// MARK: Inner Ring properties
/**
The width of the inner ring for the progres bar
## Important ##
Default = 5.0
## Author:
Luis Padron
*/
@IBInspectable open var innerRingWidth: CGFloat = 5.0 {
didSet {
self.ringLayer.innerRingWidth = self.innerRingWidth
}
}
/**
The color of the inner ring for the progres bar
## Important ##
Default = UIColor.blue
## Author:
Luis Padron
*/
@IBInspectable open var innerRingColor: UIColor = UIColor.blue {
didSet {
self.ringLayer.innerRingColor = self.innerRingColor
}
}
/**
The spacing between the outer ring and inner ring
## Important ##
This only applies when using progressRingStyle = 1
Default = 1
## Author:
Luis Padron
*/
@IBInspectable open var innerRingSpacing: CGFloat = 1 {
didSet {
self.ringLayer.innerRingSpacing = self.innerRingSpacing
}
}
/**
The style for the inner ring end cap (how it is drawn on screen)
Range [1,3]
- 1: Line with a squared off end
- 2: Line with a rounded off end
- 3: Line with a square end
- <1 & >3: Defaults to style 2
## Important ##
Default = 2
## Author:
Luis Padron
*/
@IBInspectable open var innerRingCapStyle: Int = 2 {
didSet {
switch self.innerRingCapStyle {
case 1:
self.inStyle = .butt
self.ringLayer.innerCapStyle = .butt
case 2:
self.inStyle = .round
self.ringLayer.innerCapStyle = .round
case 3:
self.inStyle = .square
self.ringLayer.innerCapStyle = .square
default:
self.inStyle = .butt
self.ringLayer.innerCapStyle = .butt
}
}
}
/**
A private innerRingCapStyle variable, this is set whenever the
IB compatible variable above is set.
Basically in here because IB doesn't support CGLineCap selection.
*/
fileprivate var inStyle: CGLineCap = .butt
// MARK: Label
/**
A toggle for showing or hiding the value label.
If false the current value will not be shown.
## Important ##
Default = true
## Author:
Luis Padron
*/
@IBInspectable open var shouldShowValueText: Bool = true {
didSet {
self.ringLayer.shouldShowValueText = self.shouldShowValueText
}
}
/**
The text color for the value label field
## Important ##
Default = UIColor.black
## Author:
Luis Padron
*/
@IBInspectable open var fontColor: UIColor = UIColor.black {
didSet {
self.ringLayer.fontColor = self.fontColor
}
}
/**
The text/font size for the value label
## Important ##
Default = 18
## Author:
Luis Padron
*/
@IBInspectable open var fontSize: CGFloat = 18 {
didSet {
self.ringLayer.fontSize = self.fontSize
}
}
/**
The name of the custom font for value label to use
Provide name as a string, and make sure "Fonts Provided by application"
is set inside the Info.plist of the project.
## Important ##
Default = nil
## Author:
Luis Padron
*/
@IBInspectable open var customFontWithName: String? {
didSet {
self.ringLayer.customFontWithName = self.customFontWithName
}
}
/**
The name of the value indicator the value label will
appened to the value
Example: " GB" -> "100 GB"
## Important ##
Default = "%"
## Author:
Luis Padron
*/
@IBInspectable open var valueIndicator: String = "%" {
didSet {
self.ringLayer.valueIndicator = self.valueIndicator
}
}
/**
A toggle for showing or hiding floating points from
the value in the value label
## Important ##
Default = false (dont show)
To customize number of decmial places to show, assign a value to decimalPlaces.
## Author:
Luis Padron
*/
@IBInspectable open var showFloatingPoint: Bool = false {
didSet {
self.ringLayer.showFloatingPoint = self.showFloatingPoint
}
}
/**
The amount of decimal places to show in the value label
## Important ##
Default = 2
Only used when showFloatingPoint = true
## Author:
Luis Padron
*/
@IBInspectable open var decimalPlaces: Int = 2 {
didSet {
self.ringLayer.decimalPlaces = self.decimalPlaces
}
}
// MARK: Animation properties
/**
The type of animation function the ring view will use
## Important ##
Default = kCAMediaTimingFunctionEaseIn
String should be from kCAMediaTimingFunction_____
Only used when calling .setValue(animated: true)
## Author:
Luis Padron
*/
open var animationStyle: String = kCAMediaTimingFunctionEaseIn {
didSet {
self.ringLayer.animationStyle = self.animationStyle
}
}
/**
This returns whether or not the ring is currently animating
## Important ##
Get only property
## Author:
Luis Padron
*/
open var isAnimating: Bool {
get { return (self.layer.animation(forKey: "value") != nil) ? true : false }
}
// MARK: CALayer
/**
Set the ring layer to the default layer, cated as custom layer
*/
var ringLayer: UICircularProgressRingLayer {
return self.layer as! UICircularProgressRingLayer
}
/**
Overrides the default layer with the custom UICircularProgressRingLayer class
*/
override open class var layerClass: AnyClass {
get {
return UICircularProgressRingLayer.self
}
}
// MARK: Methods
/**
Overriden public init to initialize the layer and view
*/
override public init(frame: CGRect) {
super.init(frame: frame)
// Call the private initializer
initialize()
}
/**
Overriden public init to initialize the layer and view
*/
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
// Call the private initializer
initialize()
}
/**
This method initializes the custom CALayer
For some reason didSet doesnt get called during initializing, so
has to be done manually in here or else nothing would be drawn.
*/
fileprivate func initialize() {
// Helps with pixelation and blurriness on retina devices
self.layer.contentsScale = UIScreen.main.scale
self.layer.shouldRasterize = true
self.layer.rasterizationScale = UIScreen.main.scale * 2
self.ringLayer.value = value
self.ringLayer.maxValue = maxValue
self.ringLayer.viewStyle = viewStyle
self.ringLayer.patternForDashes = patternForDashes
self.ringLayer.startAngle = startAngle
self.ringLayer.endAngle = endAngle
self.ringLayer.outerRingWidth = outerRingWidth
self.ringLayer.outerRingColor = outerRingColor
self.ringLayer.outerCapStyle = outStyle
self.ringLayer.innerRingWidth = innerRingWidth
self.ringLayer.innerRingColor = innerRingColor
self.ringLayer.innerCapStyle = inStyle
self.ringLayer.innerRingSpacing = innerRingSpacing
self.ringLayer.shouldShowValueText = shouldShowValueText
self.ringLayer.fontColor = fontColor
self.ringLayer.fontSize = fontSize
self.ringLayer.customFontWithName = customFontWithName
self.ringLayer.showFloatingPoint = showFloatingPoint
self.ringLayer.decimalPlaces = decimalPlaces
}
/**
Overriden because custom drawing is happening in UICircularProgressRingLayer
*/
override open func draw(_ rect: CGRect) {
}
/**
Sets the current value for the progress ring
- Parameter newVal: The value to be set for the progress ring
- Parameter animationDuration: The time interval duration for the animation
- Parameter completion: The completion closure block that will be called when animtion is finished (also called when animationDuration = 0), default is nil
## Important ##
Animatin duration = 0 will cause no animation to occur
## Author:
Luis Padron
*/
open func setProgress(_ value: CGFloat, animationDuration: TimeInterval, completion: (() -> Void)? = nil) {
// Only animte if duration sent is greater than zero
self.ringLayer.animated = animationDuration > 0
self.ringLayer.animationDuration = animationDuration
// Create a transaction to be notified when animation is complete
CATransaction.begin()
CATransaction.setCompletionBlock {
// Call the closure block
self.delegate?.finishedUpdatingProgress(self)
if let comp = completion {
comp()
}
}
self.ringLayer.value = value
CATransaction.commit()
}
}
| [
-1
] |
6215539985a3ee760aad6cf2389a97ef15545792 | 4c9f9974d52737c6a676634bd4892f910e339a19 | /Beacon Detection Project/Beacon Identification/Beacon Identification/AppDelegate.swift | c755d60d1352dc5a26b435974aef05da6383fbfb | [
"MIT"
] | permissive | UrBudWalt/Beacon-Detection-Project | 902fc0dfa10c9593aa3361f3387d84a67695efba | f83810dbf4d3810d85954dd0f392a49322cb1fce | refs/heads/main | 2023-08-11T10:36:46.567151 | 2021-09-22T11:40:13 | 2021-09-22T11:40:13 | 409,174,148 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,627 | swift | //
// AppDelegate.swift
// Beacon Identification
//
// Created by Walter Bassage on 15/06/2018.
// Copyright © 2018 Walter Bassage. 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: "Beacon_Identification")
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
/*
Typical reasons for an error here include:
* The parent directory does not exist, cannot be created, or disallows writing.
* The persistent store is not accessible, due to permissions or data protection when the device is locked.
* The device is out of space.
* The store could not be migrated to the current model version.
Check the error message to determine what the actual problem was.
*/
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
return container
}()
// MARK: - Core Data Saving support
func saveContext () {
let context = persistentContainer.viewContext
if context.hasChanges {
do {
try context.save()
} catch {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
}
}
}
| [
294405,
243717,
163848,
313353,
320008,
320014,
313360,
288275,
322580,
289300,
290326,
329747,
139803,
103964,
322080,
306721,
229408,
296483,
322083,
229411,
306726,
309287,
308266,
292907,
217132,
322092,
40495,
316465,
288306,
322102,
324663,
164408,
308281,
322109,
286783,
315457,
313409,
313413,
349765,
320582,
309832,
288329,
242250,
215117,
196177,
241746,
344661,
231000,
212571,
300124,
287323,
309342,
325220,
306790,
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,
317665,
298210,
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,
298950,
306632,
310733,
289744,
310740,
235994,
286174,
315359,
240098,
323555,
236008,
319465,
248299,
311789,
326640,
188913,
203761,
320498,
314357,
288246,
309243,
300540,
310782
] |
2ff6629c5e001da5cc4c7a48b754177cae973970 | 422a9ae39eb3900aa6359de0cbe2ae973c805582 | /ContactsList/Models/Person.swift | 81777e4d2b669478dba16b8453c9de028642d757 | [] | no_license | codensk/ContactsList | 4f8a6340c518a4dc710f35866de0faa3d133cfa1 | c5a280d99c5ce3329f9275cfda64cdb36343cf84 | refs/heads/main | 2023-05-27T11:23:22.058017 | 2021-06-09T09:32:05 | 2021-06-09T09:32:05 | 374,952,290 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 275 | swift | //
// Person.swift
// ContactsList
//
// Created by SERGEY VOROBEV on 08.06.2021.
//
struct Person {
let firstName: String
let lastName: String
let email: String
let phone: String
var fullName: String {
"\(firstName) \(lastName)"
}
}
| [
-1
] |
c250399fa7d25600d5934cf09208f1c0f113172f | b02258d4710fd5e164b9ca667a8779a1eb92af9f | /test/Parse/matching_patterns.swift | 3250453279f452545486dd29e9a7e86e9466ebf2 | [
"Apache-2.0",
"Swift-exception"
] | permissive | ekhavana/swift | 17bf104d2682cb67c264f5118483e0a2616bca81 | 7a25908491edc3027b24b47693d66e140dd56c4d | refs/heads/master | 2021-06-03T04:23:30.861724 | 2017-06-09T18:00:12 | 2017-06-09T18:00:12 | 93,901,053 | 0 | 0 | Apache-2.0 | 2021-01-03T10:40:06 | 2017-06-09T22:23:14 | C++ | UTF-8 | Swift | false | false | 9,572 | swift | // RUN: %target-typecheck-verify-swift -I %S/Inputs -enable-source-import
import imported_enums
// TODO: Implement tuple equality in the library.
// BLOCKED: <rdar://problem/13822406>
func ~= (x: (Int,Int,Int), y: (Int,Int,Int)) -> Bool {
return true
}
var x:Int
func square(_ x: Int) -> Int { return x*x }
struct A<B> {
struct C<D> { }
}
switch x {
// Expressions as patterns.
case 0:
()
case 1 + 2:
()
case square(9):
()
// 'var' and 'let' patterns.
case var a:
a = 1
case let a: // expected-warning {{case is already handled by previous patterns; consider removing it}}
a = 1 // expected-error {{cannot assign}}
case var var a: // expected-error {{'var' cannot appear nested inside another 'var' or 'let' pattern}}
// expected-warning@-1 {{case is already handled by previous patterns; consider removing it}}
a += 1
case var let a: // expected-error {{'let' cannot appear nested inside another 'var' or 'let' pattern}}
// expected-warning@-1 {{case is already handled by previous patterns; consider removing it}}
print(a, terminator: "")
case var (var b): // expected-error {{'var' cannot appear nested inside another 'var'}}
// expected-warning@-1 {{case is already handled by previous patterns; consider removing it}}
b += 1
// 'Any' pattern.
case _: // expected-warning {{case is already handled by previous patterns; consider removing it}}
()
// patterns are resolved in expression-only positions are errors.
case 1 + (_): // expected-error{{'_' can only appear in a pattern or on the left side of an assignment}}
()
}
switch (x,x) {
case (var a, var a): // expected-error {{definition conflicts with previous value}} expected-note {{previous definition of 'a' is here}} expected-warning {{variable 'a' was never used; consider replacing with '_' or removing it}} expected-warning {{variable 'a' was never used; consider replacing with '_' or removing it}}
fallthrough
case _: // expected-warning {{case is already handled by previous patterns; consider removing it}}
()
}
var e : Any = 0
switch e { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
// 'is' pattern.
case is Int,
is A<Int>,
is A<Int>.C<Int>,
is (Int, Int),
is (a: Int, b: Int):
()
}
// Enum patterns.
enum Foo { case A, B, C }
func == <T>(_: Voluntary<T>, _: Voluntary<T>) -> Bool { return true }
enum Voluntary<T> : Equatable {
case Naught
case Mere(T)
case Twain(T, T)
func enumMethod(_ other: Voluntary<T>, foo: Foo) {
switch self {
case other:
()
case .Naught,
.Naught(),
.Naught(_, _): // expected-error{{tuple pattern has the wrong length for tuple type '()'}}
()
case .Mere,
.Mere(), // expected-error{{tuple pattern cannot match values of the non-tuple type 'T'}}
.Mere(_),
.Mere(_, _): // expected-error{{tuple pattern cannot match values of the non-tuple type 'T'}}
()
case .Twain(), // expected-error{{tuple pattern has the wrong length for tuple type '(T, T)'}}
.Twain(_),
.Twain(_, _),
.Twain(_, _, _): // expected-error{{tuple pattern has the wrong length for tuple type '(T, T)'}}
()
}
switch foo {
case .Naught: // expected-error{{pattern cannot match values of type 'Foo'}}
()
case .A, .B, .C:
()
}
}
}
var n : Voluntary<Int> = .Naught
switch n {
case Foo.A: // expected-error{{enum case 'A' is not a member of type 'Voluntary<Int>'}}
()
case Voluntary<Int>.Naught,
Voluntary<Int>.Naught(),
Voluntary<Int>.Naught(_, _), // expected-error{{tuple pattern has the wrong length for tuple type '()'}}
Voluntary.Naught,
.Naught:
()
case Voluntary<Int>.Mere,
Voluntary<Int>.Mere(_),
Voluntary<Int>.Mere(_, _), // expected-error{{tuple pattern cannot match values of the non-tuple type 'Int'}}
Voluntary.Mere,
Voluntary.Mere(_),
.Mere,
.Mere(_):
()
case .Twain,
.Twain(_),
.Twain(_, _),
.Twain(_, _, _): // expected-error{{tuple pattern has the wrong length for tuple type '(Int, Int)'}}
()
}
var notAnEnum = 0
switch notAnEnum {
case .Foo: // expected-error{{pattern cannot match values of type 'Int'}}
()
}
struct ContainsEnum {
enum Possible<T> {
case Naught
case Mere(T)
case Twain(T, T)
}
func member(_ n: Possible<Int>) {
switch n { // expected-error {{switch must be exhaustive}}
// expected-note@-1 {{missing case: '.Mere(_)'}}
// expected-note@-2 {{missing case: '.Twain(_, _)'}}
case ContainsEnum.Possible<Int>.Naught,
ContainsEnum.Possible.Naught, // expected-warning {{case is already handled by previous patterns; consider removing it}}
Possible<Int>.Naught, // expected-warning {{case is already handled by previous patterns; consider removing it}}
Possible.Naught, // expected-warning {{case is already handled by previous patterns; consider removing it}}
.Naught: // expected-warning {{case is already handled by previous patterns; consider removing it}}
()
}
}
}
func nonmemberAccessesMemberType(_ n: ContainsEnum.Possible<Int>) {
switch n { // expected-error {{switch must be exhaustive}}
// expected-note@-1 {{missing case: '.Mere(_)'}}
// expected-note@-2 {{missing case: '.Twain(_, _)'}}
case ContainsEnum.Possible<Int>.Naught,
.Naught: // expected-warning {{case is already handled by previous patterns; consider removing it}}
()
}
}
var m : ImportedEnum = .Simple
switch m {
case imported_enums.ImportedEnum.Simple,
ImportedEnum.Simple, // expected-warning {{case is already handled by previous patterns; consider removing it}}
.Simple: // expected-warning {{case is already handled by previous patterns; consider removing it}}
()
case imported_enums.ImportedEnum.Compound,
imported_enums.ImportedEnum.Compound(_), // expected-warning {{case is already handled by previous patterns; consider removing it}}
ImportedEnum.Compound, // expected-warning {{case is already handled by previous patterns; consider removing it}}
ImportedEnum.Compound(_), // expected-warning {{case is already handled by previous patterns; consider removing it}}
.Compound, // expected-warning {{case is already handled by previous patterns; consider removing it}}
.Compound(_): // expected-warning {{case is already handled by previous patterns; consider removing it}}
()
}
// Check that single-element tuple payloads work sensibly in patterns.
enum LabeledScalarPayload {
case Payload(name: Int)
}
var lsp: LabeledScalarPayload = .Payload(name: 0)
func acceptInt(_: Int) {}
func acceptString(_: String) {}
switch lsp {
case .Payload(0):
()
case .Payload(name: 0):
()
case let .Payload(x):
acceptInt(x)
acceptString("\(x)")
case let .Payload(name: x): // expected-warning {{case is already handled by previous patterns; consider removing it}}
acceptInt(x)
acceptString("\(x)")
case let .Payload((name: x)): // expected-warning {{case is already handled by previous patterns; consider removing it}}
acceptInt(x)
acceptString("\(x)")
case .Payload(let (name: x)): // expected-warning {{case is already handled by previous patterns; consider removing it}}
acceptInt(x)
acceptString("\(x)")
case .Payload(let (name: x)): // expected-warning {{case is already handled by previous patterns; consider removing it}}
acceptInt(x)
acceptString("\(x)")
case .Payload(let x): // expected-warning {{case is already handled by previous patterns; consider removing it}}
acceptInt(x)
acceptString("\(x)")
case .Payload((let x)): // expected-warning {{case is already handled by previous patterns; consider removing it}}
acceptInt(x)
acceptString("\(x)")
}
// Property patterns.
struct S {
static var stat: Int = 0
var x, y : Int
var comp : Int {
return x + y
}
func nonProperty() {}
}
// Tuple patterns.
var t = (1, 2, 3)
prefix operator +++
infix operator +++
prefix func +++(x: (Int,Int,Int)) -> (Int,Int,Int) { return x }
func +++(x: (Int,Int,Int), y: (Int,Int,Int)) -> (Int,Int,Int) {
return (x.0+y.0, x.1+y.1, x.2+y.2)
}
switch t {
case (_, var a, 3):
a += 1
case var (_, b, 3):
b += 1
case var (_, var c, 3): // expected-error{{'var' cannot appear nested inside another 'var'}}
c += 1
case (1, 2, 3):
()
// patterns in expression-only positions are errors.
case +++(_, var d, 3):
// expected-error@-1{{'+++' is not a prefix unary operator}}
()
case (_, var e, 3) +++ (1, 2, 3):
// expected-error@-1{{'_' can only appear in a pattern}}
// expected-error@-2{{'var' binding pattern cannot appear in an expression}}
()
}
// FIXME: We don't currently allow subpatterns for "isa" patterns that
// require interesting conditional downcasts.
class Base { }
class Derived : Base { }
switch [Derived(), Derived(), Base()] {
case let ds as [Derived]: // expected-error{{downcast pattern value of type '[Derived]' cannot be used}}
()
default:
()
}
// Optional patterns.
let op1 : Int?
let op2 : Int??
switch op1 {
case nil: break
case 1?: break
case _?: break
}
switch op2 {
case nil: break
case _?: break
case (1?)?: break
case (_?)?: break // expected-warning {{case is already handled by previous patterns; consider removing it}}
}
// <rdar://problem/20365753> Bogus diagnostic "refutable pattern match can fail"
let (responseObject: Int?) = op1
// expected-error @-1 {{expected ',' separator}} {{25-25=,}}
// expected-error @-2 {{expected pattern}}
| [
73187,
86516,
90647
] |
75ff42aa12cda300be8ea4574ef3c23b9791f67b | a9efb7b995f1c8b5e61aaca011233aab79e11ef5 | /Flickery/Models/RootClass.swift | 23f0667109b1a921dc68cd3942ef02ca6b3cdbbc | [
"MIT"
] | permissive | iSame7/Flickery | 4f8cfb56f820efca2b0022fd467e611e506ab487 | d4241ade88de4cff301302741536fd0622ec6748 | refs/heads/master | 2021-01-12T12:58:10.518847 | 2019-06-18T08:23:15 | 2019-06-18T08:23:15 | 70,133,352 | 4 | 1 | null | 2019-03-18T10:41:58 | 2016-10-06T07:44:16 | Swift | UTF-8 | Swift | false | false | 918 | swift | //
// RootClass.swift
//
// Create by Sameh Mabrouk on 5/10/2016
// Copyright © 2016. All rights reserved.
import Foundation
struct RootClass {
var photos : Photo!
var stat : String!
/**
* Instantiate the instance using the passed dictionary values to set the properties values
*/
init(fromDictionary dictionary: NSDictionary){
if let photosData = dictionary["photos"] as? NSDictionary{
photos = Photo(fromDictionary: photosData)
}
stat = dictionary["stat"] as? String
}
/**
* Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> NSDictionary
{
let dictionary = NSMutableDictionary()
if photos != nil{
dictionary["photos"] = photos.toDictionary()
}
if stat != nil{
dictionary["stat"] = stat
}
return dictionary
}
}
| [
-1
] |
33b89ba1d29a103ca7011c83d9042d2bf7b33bae | c2e354a3252739fd0ca6f1a0f3e03cc775007f59 | /aoc2020/day5.swift | 54f4e4f8700c3ab6362f11bdbfd79298fa67026a | [] | no_license | DanCatchpole/aoc2020 | 87ceff172addbf10bd753f413c4de76689b38935 | 89e16277ffdad62e6904da80273592e539d44e84 | refs/heads/main | 2023-01-28T15:59:53.583057 | 2020-12-08T13:03:01 | 2020-12-08T13:03:01 | 317,575,104 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,696 | swift | //
// day5.swift
// aoc2020
//
// Created by Dan on 06/12/2020.
//
import Foundation
class Day5 : Day {
var input: [String]
var numRows = 128
var numCols = 8
override init() {
self.input = []
let path = FileManager.default.homeDirectoryForCurrentUser.path + "/aoc2020input/day5.txt"
let data = try! String(contentsOfFile: path, encoding: .ascii)
// remove empty string at the end of the file
self.input = data.components(separatedBy: .newlines).filter{ $0 != "" }
}
func stringToID(str: String) -> Int {
var possibleRows = Array(0...127)
var possibleCols = Array(0...7)
for char in str {
if char == "B" {
possibleRows = Array(possibleRows.dropFirst(possibleRows.count/2))
}
if char == "F" {
possibleRows = Array(possibleRows.dropLast(possibleRows.count/2))
}
if char == "R" {
possibleCols = Array(possibleCols.dropFirst(possibleCols.count/2))
}
if char == "L" {
possibleCols = Array(possibleCols.dropLast(possibleCols.count/2))
}
}
return possibleRows[0] * 8 + possibleCols[0]
}
override func partA() -> String {
return String(self.input.map {stringToID(str: $0)}.max()!)
}
override func partB() -> String {
let possibleSeats = Array(0...(127*8 + 7))
let actualSeats = self.input.map {stringToID(str: $0)}
return String(possibleSeats.filter { actualSeats.contains($0 - 1) && actualSeats.contains($0 + 1) && !actualSeats.contains($0) }[0])
}
}
| [
-1
] |
2834512ea6aa410ce1d05c3239464e03bf0ee177 | ca2be5718bf9d05094d2dab905d40c0aeff4810a | /TheGram/profileImageViewController.swift | c0ddca44723e299d2d53f8d6322426d2177625a0 | [
"Apache-2.0"
] | permissive | Brandon05/Insta-Gram | 9074ccb024e9a815ae0be50b6b4415d071442afb | a4130f9bd78975b7792084642391e417fd9c5f66 | refs/heads/master | 2021-08-22T10:51:42.039269 | 2017-11-30T01:32:33 | 2017-11-30T01:32:33 | 52,254,225 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,747 | swift | //
// profileImageViewController.swift
// TheGram
//
// Created by Brandon Sanchez on 2/21/16.
// Copyright © 2016 Brandon Sanchez. All rights reserved.
//
import UIKit
import imglyKit
class profileImageViewController: IMGLYCameraViewController {
var profileImage: UIImage!
override func viewDidLoad() {
super.viewDidLoad()
self.recordingModes
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func CompletionBlock(_ result: IMGLYEditorResult, profileImage: UIImage?) {
if let profileimage = profileImage, result == .done {
self.profileImage = profileimage
if self.profileImage != nil {
print("working")
}
//UIImageWriteToSavedPhotosAlbum(image, self, "image:didFinishSavingWithError:contextInfo:", nil)
}
dismiss(animated: true, completion: nil)
if (Thread.isMainThread) {
print("yes")
}
DispatchQueue.main.async {
[unowned self] in
self.performSegue(withIdentifier: "unwindToEditProfile", sender: self)
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let editProfileViewController = segue.destination as! EditProfileViewController
editProfileViewController.userProfileImage = profileImage!
}
internal override func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
let image = info[UIImagePickerControllerOriginalImage] as? UIImage
self.dismiss(animated: true, completion: {
if let completionBlock = self.completionBlock {
completionBlock(image, nil)
} else {
if let image = image {
self.showEditorNavigationControllerWithImage(image)
}
}
})
}
fileprivate func showEditorNavigationControllerWithImage(_ image: UIImage) {
let editorViewController = IMGLYMainEditorViewController()
editorViewController.highResolutionImage = image
if let cameraController = cameraController {
editorViewController.initialFilterType = cameraController.effectFilter.filterType
editorViewController.initialFilterIntensity = cameraController.effectFilter.inputIntensity
}
editorViewController.completionBlock = CompletionBlock
let navigationController = IMGLYNavigationController(rootViewController: editorViewController)
navigationController.navigationBar.barStyle = .black
navigationController.navigationBar.isTranslucent = false
navigationController.navigationBar.titleTextAttributes = [ NSForegroundColorAttributeName : UIColor.white ]
//navigationController.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Done, target: self, action: "tappedDone")
print("works")
//performSegueWithIdentifier("CaptionEditorSegue", sender: self)
self.present(navigationController, animated: true, completion: nil)
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
c38c22e6f7b2fd4e90d8a1d4ac4fe7dfbfa8dd44 | f86c2e71a405ad8a20b998a082093aaea0c3a3e6 | /Amplify/Categories/Predictions/Models/Celebrity.swift | 1e051da7e3d95bf4f7eb49cf517acdd585cb4963 | [
"Apache-2.0"
] | permissive | ethan1022/amplify-ios | 84897b0c7fe46813bb8858c87683bc74eb2908a0 | 6bf7d74b656f84d85f8dd283ba4da8d207131835 | refs/heads/main | 2023-04-10T21:27:20.487039 | 2021-04-21T08:59:53 | 2021-04-21T08:59:53 | 360,092,118 | 0 | 0 | Apache-2.0 | 2021-04-21T08:36:12 | 2021-04-21T08:36:11 | null | UTF-8 | Swift | false | false | 856 | swift | //
// Copyright Amazon.com Inc. or its affiliates.
// All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0
//
import Foundation
import CoreGraphics
public struct Celebrity {
public let metadata: CelebrityMetadata
public let boundingBox: CGRect
public let landmarks: [Landmark]
public init(metadata: CelebrityMetadata, boundingBox: CGRect, landmarks: [Landmark]) {
self.metadata = metadata
self.boundingBox = boundingBox
self.landmarks = landmarks
}
}
public struct CelebrityMetadata {
public let name: String
public let identifier: String
public let urls: [URL]
public let pose: Pose
public init(name: String, identifier: String, urls: [URL], pose: Pose) {
self.name = name
self.identifier = identifier
self.urls = urls
self.pose = pose
}
}
| [
-1
] |
dea5e10eac2e369c0b5dd5b45235b879da41dcff | 5d2fa9270d3b62e1e47a43c7d4b649b49d820f89 | /TaskNoorTests/TaskNoorTests.swift | cc443bfa4bfe7e69824015c7cb3cbe5e582f29cd | [] | no_license | AliveluYadav/TaskNoor | a1145bcee9ec8369a34867d3ae0c724336f24e46 | 10ac5b62b69184849a37c38d0a90e957771c3646 | refs/heads/master | 2020-06-15T03:14:34.848996 | 2019-07-04T07:25:00 | 2019-07-04T07:25:00 | 195,190,511 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 913 | swift | //
// TaskNoorTests.swift
// TaskNoorTests
//
// Created by LetMeCall Corp on 12/12/18.
// Copyright © 2018 LetMeCall Corp. All rights reserved.
//
import XCTest
@testable import TaskNoor
class TaskNoorTests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
360462,
98333,
16419,
229413,
204840,
278570,
344107,
155694,
253999,
229430,
319542,
163896,
180280,
352315,
376894,
352326,
254027,
311372,
163917,
311374,
196691,
278615,
385116,
237663,
254048,
319591,
221290,
278634,
131178,
319598,
352368,
204916,
131191,
237689,
131198,
278655,
319629,
311438,
278677,
196760,
426138,
278685,
311458,
278691,
49316,
32941,
278704,
377009,
278708,
180408,
131256,
295098,
139479,
254170,
229597,
311519,
205035,
385262,
286958,
327929,
344313,
147717,
368905,
180493,
278797,
254226,
368916,
262421,
377114,
237856,
237857,
278816,
311597,
98610,
180535,
336183,
278842,
287041,
139589,
319821,
254286,
344401,
377169,
368981,
155990,
368984,
106847,
98657,
270701,
246127,
270706,
139640,
246137,
106874,
246136,
311685,
106888,
385417,
311691,
385422,
213403,
385454,
311727,
377264,
311738,
33211,
278970,
336317,
319930,
336320,
311745,
278978,
254406,
188871,
278989,
278993,
278999,
328152,
369116,
287198,
279008,
279013,
279018,
311786,
319981,
319987,
279029,
254456,
279032,
377338,
377343,
279039,
254465,
287241,
279050,
139792,
303636,
279062,
393751,
254488,
279065,
377376,
377386,
197167,
385588,
352829,
115270,
377418,
385615,
426576,
369235,
139872,
66150,
344680,
295536,
287346,
139892,
287352,
344696,
279164,
189057,
311941,
336518,
311945,
369289,
344715,
279177,
311949,
287374,
377489,
311954,
352917,
230040,
271000,
377497,
303771,
377500,
295576,
205471,
344738,
139939,
279206,
295590,
287404,
205487,
295599,
303793,
336564,
164533,
287417,
287422,
66242,
377539,
164560,
385747,
279252,
361176,
418520,
287452,
295652,
246503,
369385,
418546,
312052,
172792,
344827,
221948,
279294,
205568,
295682,
197386,
434957,
312079,
295697,
426774,
197399,
426775,
336671,
344865,
197411,
279336,
295724,
353069,
197422,
353070,
164656,
295729,
312108,
328499,
353078,
197431,
230199,
353079,
336702,
295746,
353094,
353095,
353109,
377686,
230234,
189275,
435039,
295776,
303972,
385893,
246641,
246643,
295798,
246648,
361337,
279417,
254850,
369538,
287622,
426895,
295824,
189348,
353195,
140204,
377772,
353197,
304051,
230332,
377790,
353215,
353216,
213957,
213960,
345033,
279498,
386006,
418776,
50143,
123881,
320494,
304110,
287731,
271350,
295927,
304122,
320507,
328700,
312314,
328706,
410627,
320516,
295942,
386056,
353290,
230410,
377869,
320527,
238610,
418837,
140310,
320536,
197657,
336929,
369701,
345132,
238639,
312373,
238651,
377926,
361543,
238664,
214086,
296019,
353367,
156764,
156765,
304222,
230499,
173166,
312434,
377972,
353397,
337017,
377983,
402565,
279685,
222343,
386189,
296086,
238743,
296092,
238765,
279728,
238769,
402613,
230588,
353479,
353481,
353482,
402634,
189652,
189653,
419029,
148696,
296153,
279774,
304351,
304356,
222440,
328940,
279792,
353523,
386294,
386301,
320770,
386306,
279814,
328971,
312587,
353551,
320796,
222494,
115998,
369956,
279854,
353584,
345396,
386359,
345402,
116026,
378172,
222524,
279875,
345415,
312648,
337225,
304456,
230729,
238927,
353616,
296273,
222559,
378209,
230756,
386412,
230765,
296303,
279920,
312689,
296307,
116084,
181625,
337281,
148867,
378244,
296329,
304524,
296335,
9619,
370071,
279974,
173491,
304564,
279989,
353719,
280004,
361927,
370123,
148940,
280013,
312782,
222675,
353750,
271843,
280041,
361963,
329200,
296433,
321009,
280055,
288249,
230913,
329225,
230921,
296461,
304656,
329232,
370197,
402985,
394794,
230959,
288309,
312889,
288318,
124485,
288326,
288327,
280147,
239198,
157281,
99938,
312940,
222832,
247416,
337534,
337535,
263809,
312965,
288392,
239250,
419478,
345752,
255649,
321199,
337591,
321207,
296632,
280251,
321219,
280267,
403148,
9936,
9937,
370388,
272085,
345814,
181975,
280278,
280280,
18138,
345821,
321247,
321249,
345833,
345834,
280300,
67315,
173814,
313081,
124669,
288512,
288516,
280329,
321295,
321302,
345879,
116505,
321310,
255776,
313120,
247590,
362283,
378668,
296755,
321337,
345919,
436031,
403267,
280392,
345929,
337745,
18262,
362327,
370522,
345951,
362337,
345955,
296806,
288619,
296814,
214895,
313199,
362352,
313203,
124798,
182144,
305026,
67463,
329622,
337815,
124824,
214937,
436131,
354212,
313254,
436137,
362417,
124852,
288697,
362431,
214977,
280514,
214984,
321480,
362443,
247757,
231375,
280541,
329695,
436191,
313319,
337895,
247785,
436205,
296941,
329712,
362480,
223218,
313339,
43014,
354316,
313357,
182296,
239650,
329765,
354343,
354345,
223274,
321583,
124975,
346162,
124984,
288828,
436285,
288833,
288834,
436292,
403525,
436301,
338001,
354385,
338003,
280661,
329814,
338007,
354393,
280675,
329829,
280677,
43110,
321637,
436329,
313447,
288879,
280694,
223350,
288889,
215164,
313469,
215166,
280712,
215178,
346271,
436383,
362659,
239793,
125109,
182456,
379071,
280768,
149703,
338119,
346314,
321745,
280795,
387296,
280802,
379106,
338150,
346346,
321772,
125169,
338164,
436470,
125183,
149760,
411906,
125188,
313608,
125193,
321800,
125198,
125199,
272658,
125203,
338197,
125208,
305440,
125217,
338218,
321840,
379186,
125235,
280887,
125240,
321860,
182597,
182598,
280902,
289110,
215385,
272729,
379225,
354655,
321894,
280939,
313713,
354676,
313727,
436608,
362881,
248194,
436611,
240002,
395659,
395661,
108944,
240016,
190871,
149916,
420253,
141728,
289189,
108972,
272813,
338356,
436661,
281037,
289232,
281040,
256477,
330218,
281072,
109042,
174593,
240131,
420369,
289304,
322078,
207393,
182817,
289332,
174648,
338489,
338490,
322120,
281166,
297560,
354911,
436832,
436834,
191082,
313966,
420463,
281199,
346737,
313971,
346740,
420471,
330379,
330387,
117396,
346772,
330388,
264856,
289434,
363163,
346779,
338613,
289462,
314040,
109241,
158394,
248517,
363211,
363230,
289502,
264928,
338662,
330474,
346858,
289518,
322291,
199414,
35583,
363263,
191235,
264968,
322313,
322316,
117517,
322319,
166676,
207640,
281377,
289576,
191283,
273207,
355130,
289598,
355139,
420677,
355146,
355154,
281427,
281433,
322395,
355165,
109409,
355178,
330609,
174963,
207732,
109428,
158593,
240518,
109447,
224145,
355217,
256922,
289690,
240544,
420773,
289703,
256935,
240552,
363438,
347055,
289722,
289727,
273344,
330689,
363458,
379844,
19399,
338899,
330708,
248796,
248797,
207838,
347103,
314342,
52200,
412651,
289774,
347123,
240630,
314362,
257024,
330754,
134150,
330763,
330772,
281626,
175132,
248872,
322612,
314448,
339030,
281697,
314467,
281700,
257125,
322663,
281706,
273515,
207979,
404593,
363641,
363644,
150657,
248961,
330888,
363669,
339100,
380061,
429214,
199839,
339102,
265379,
249002,
306346,
3246,
421048,
339130,
322749,
265412,
290000,
298208,
298212,
298213,
290022,
330984,
298221,
298228,
216315,
208124,
363771,
388349,
437505,
322824,
257305,
126237,
339234,
208164,
109861,
372009,
412971,
298291,
306494,
216386,
224586,
372043,
331090,
314709,
314710,
372054,
159066,
134491,
314720,
314726,
306542,
380271,
314739,
249204,
249205,
208244,
314741,
290169,
290173,
306559,
314751,
224640,
306560,
298374,
314758,
314760,
142729,
388487,
314766,
306579,
224661,
282007,
290207,
314783,
314789,
314791,
396711,
396712,
282024,
241066,
314798,
380337,
380338,
150965,
380357,
339398,
306631,
306639,
413137,
429542,
191981,
282096,
191990,
290301,
282114,
372227,
323080,
323087,
323089,
175639,
388632,
396827,
282141,
134686,
282146,
306723,
347694,
290358,
265798,
282183,
265804,
224847,
118353,
396882,
290390,
44635,
396895,
323172,
282213,
323178,
224883,
314998,
323196,
175741,
339584,
224901,
282245,
323207,
282246,
290443,
323217,
282259,
257699,
323236,
298661,
282280,
61101,
364207,
224946,
110268,
224958,
282303,
323264,
274115,
306890,
241361,
241365,
298712,
298720,
12010,
282348,
282358,
175873,
339715,
323331,
323332,
216839,
339720,
372496,
323346,
249626,
282400,
241441,
339745,
315171,
257830,
421672,
282417,
200498,
282427,
315202,
307011,
282438,
339783,
413521,
216918,
241495,
282480,
241528,
315264,
339841,
241540,
315273,
315274,
372626,
380821,
282518,
282519,
118685,
298909,
323507,
290745,
274371,
151497,
372701,
298980,
380908,
282633,
241692,
102437,
315432,
315434,
102445,
233517,
176175,
282672,
241716,
241720,
225351,
315465,
315476,
307289,
200794,
315487,
356447,
315497,
315498,
438377,
299121,
233589,
266357,
233590,
422019,
241808,
381073,
323729,
233636,
299174,
405687,
184505,
299198,
258239,
389313,
299203,
299209,
372941,
282831,
266449,
356576,
176362,
307435,
438511,
381172,
356602,
184570,
184575,
381208,
315673,
299293,
151839,
233762,
217380,
151847,
282919,
332083,
332085,
332089,
315706,
282939,
241986,
438596,
332101,
323913,
348492,
323916,
323920,
250192,
282960,
348500,
168281,
332123,
332127,
323935,
242023,
242029,
160110,
242033,
291192,
315773,
291198,
340357,
225670,
332167,
242058,
373134,
291224,
242078,
283038,
61857,
315810,
315811,
381347,
61859,
340398,
61873,
299441,
61880,
283064,
291265,
127427,
127428,
283075,
291267,
324039,
373197,
176601,
242139,
160225,
242148,
127465,
291311,
233978,
291333,
340490,
348682,
258581,
291358,
283184,
234036,
315960,
348732,
242237,
70209,
348742,
70215,
348749,
381517,
332378,
201308,
242273,
242277,
111208,
184940,
373358,
389745,
209530,
291454,
373375,
152195,
348806,
184973,
316049,
111253,
316053,
111258,
111259,
332446,
176808,
299699,
299700,
422596,
422599,
291530,
225995,
242386,
422617,
422626,
299746,
234217,
299759,
299776,
291585,
430849,
291592,
62220,
422673,
430865,
291604,
422680,
291612,
152365,
422703,
422709,
152374,
242485,
160571,
430910,
160575,
160580,
299849,
283467,
381773,
201549,
201551,
242529,
349026,
357218,
275303,
177001,
201577,
308076,
242541,
209783,
209785,
177019,
185211,
308092,
398206,
291712,
381829,
316298,
349067,
308107,
349072,
308112,
209817,
324506,
324507,
390045,
127902,
185250,
324517,
185254,
316333,
373687,
316343,
349121,
373706,
316364,
340955,
340961,
324586,
340974,
316405,
349175,
201720,
127992,
357379,
324625,
308243,
316437,
201755,
300068,
357414,
300084,
324666,
324667,
308287,
21569,
218186,
300111,
341073,
439384,
250981,
300135,
316520,
300136,
316526,
357486,
144496,
300150,
291959,
300151,
160891,
341115,
300158,
349316,
349318,
373903,
169104,
177296,
308372,
324760,
119962,
300187,
300188,
283802,
300201,
300202,
373945,
259268,
283847,
62665,
283852,
283853,
259280,
333011,
316627,
357595,
333022,
234733,
234742,
128251,
292091,
316669,
439562,
292107,
242954,
414990,
251153,
177428,
349462,
333090,
382258,
300343,
382269,
333117,
193859,
300359,
177484,
406861,
259406,
234831,
251213,
120148,
283991,
357719,
374109,
316765,
292195,
333160,
243056,
316787,
111993,
357762,
112017,
234898,
259475,
275859,
112018,
357786,
251298,
333220,
316842,
374191,
210358,
284089,
292283,
415171,
300487,
300489,
284107,
366037,
210390,
210391,
210392,
210393,
144867,
103909,
316902,
54765,
251378,
308723,
333300,
333303,
300536,
300542,
210433,
366083,
292356,
259599,
316946,
308756,
398869,
374296,
374299,
308764,
349726,
333343,
431649,
349741,
169518,
431663,
194110,
235070,
349763,
292423,
218696,
292425,
243274,
128587,
333388,
333393,
300630,
128599,
235095,
333408,
300644,
374372,
415338,
243307,
54893,
325231,
333430,
366203,
325245,
194180,
415375,
153251,
300714,
210603,
415420,
333503,
218819,
333509,
259781,
333517,
333520,
333521,
333523,
325346,
333542,
153319,
325352,
284401,
325371,
194303,
194304,
284429,
284431,
243472,
161554,
366360,
284442,
325404,
325410,
341796,
333610,
399147,
431916,
284459,
300848,
317232,
259899,
325439,
325445,
153415,
341836,
415567,
325457,
317269,
341847,
284507,
350044,
128862,
300894,
284514,
276327,
292712,
325484,
423789,
292720,
325492,
276341,
341879,
317304,
333688,
112509,
194429,
325503,
55167,
333701,
243591,
317323,
325515,
243597,
325518,
333722,
350109,
292771,
300963,
333735,
415655,
284587,
292782,
317360,
243637,
284619,
301008,
153554,
219101,
292836,
292837,
317415,
325619,
432116,
333817,
292858,
415741,
333828,
358410,
399373,
317467,
145435,
292902,
325674,
243759,
129076,
243767,
358456,
325694,
309345,
194666,
260207,
432240,
333940,
284788,
292992,
333955,
415881,
104587,
235662,
325776,
317587,
284826,
333991,
333992,
284842,
333996,
227513,
301251,
309444,
227524,
334042,
194782,
301279,
317664,
243962,
375039,
309503,
194820,
375051,
325905,
334103,
325912,
227616,
211235,
432421,
211238,
325931,
358703,
358709,
260418,
325968,
6481,
366930,
366929,
6489,
334171,
391520,
383332,
383336,
317820,
211326,
317831,
227725,
252308,
39324,
121245,
317852,
285084,
285090,
375207,
342450,
293303,
293310,
342466,
416197,
129483,
342476,
317901,
6606,
334290,
326100,
285150,
342498,
358882,
334309,
195045,
391655,
432618,
375276,
301571,
342536,
342553,
416286,
375333,
293419,
244269,
375343,
23092,
375351,
244281,
301638,
309830,
293448,
55881,
416341,
244310,
416351,
268899,
244327,
39530,
301689,
244347,
326287,
375440,
334481,
227990,
318106,
318107,
342682,
318130,
383667,
293556,
342706,
342713,
285373,
39614,
154316,
318173,
375526,
285415,
342762,
342763,
293612,
154359,
432893,
162561,
285444,
383754,
326414,
310036,
326429,
293664,
326433,
400166,
293672,
318250,
318252,
285487,
301871,
375609,
293693,
342847,
252741,
318278,
293711,
244568,
244570,
293730,
351077,
342887,
326505,
400239,
310131,
269178,
400252,
359298,
359299,
260996,
113542,
416646,
228233,
392074,
228234,
236428,
56208,
326553,
318364,
310176,
310178,
310182,
293800,
236461,
293806,
252847,
326581,
326587,
326601,
359381,
433115,
343005,
130016,
64485,
326635,
203757,
187374,
383983,
383982,
277492,
318461,
293886,
293893,
433165,
384016,
146448,
433174,
326685,
252958,
252980,
203830,
359478,
302139,
359495,
392290,
253029,
228458,
318572,
15471,
351344,
187506,
285814,
285820,
392318,
187521,
384131,
302213,
302216,
228491,
228493,
285838,
162961,
326804,
285851,
351390,
302240,
343203,
253099,
253100,
318639,
367799,
113850,
294074,
64700,
228540,
228542,
302274,
367810,
343234,
244940,
228563,
359647,
195808,
310497,
228588,
253167,
302325,
261377,
228609,
245019,
253216,
130338,
130343,
130348,
261425,
351537,
171317,
318775,
286013,
286018,
146762,
294218,
294219,
318805,
425304,
294243,
163175,
327024,
327025,
327031,
318848,
294275,
253317,
384393,
368011,
318864,
318868,
212375,
318875,
212382,
310692,
245161,
286129,
286132,
228795,
425405,
302529,
302531,
163268,
425418,
310732,
302540,
64975,
310736,
327121,
228827,
310748,
286172,
310757,
187878,
245223,
343542,
343543,
286202,
359930,
286205,
302590,
228867,
253451,
253452,
359950,
146964,
253463,
187938,
286244,
245287,
245292,
286254,
425535,
196164,
56902,
228943,
179801,
196187,
343647,
286306,
310889,
204397,
138863,
188016,
294529,
229001,
310923,
188048,
302739,
425626,
229020,
302754,
245412,
40613,
40614,
40615,
229029,
384695,
319162,
327358,
286399,
319177,
212685,
384720,
245457,
302802,
278234,
294622,
278240,
229088,
212716,
212717,
294638,
360177,
286459,
278272,
319233,
360195,
278291,
294678,
286494,
294700,
409394,
319288,
319292,
360252,
360264,
188251,
376669,
245599,
237408,
425825,
302946,
425833,
417654,
188292,
327557,
253829,
294807,
376732,
311199,
319392,
253856,
294823,
327596,
294843,
188348,
237504,
294850,
384964,
163781,
344013,
212942,
212946,
24532,
212951,
360417,
294886,
253929,
327661,
278512,
311281,
311282
] |
025818d2e85e186c9e09c7fc02d3eee54ea7f753 | dacedaf28d17641a687e91d1e3d23dd679d73b03 | /Hanoi/Hanoi/TowerOfHanoi/Disk.swift | 12eb3c01c6c066232644da04b29a2715e8740151 | [] | no_license | MatheusVaccaro/WWDC2018 | 8e49a755201ba36f6401e49265922f4dd372d2e5 | 4068283e30b9862b189c81a75d8af228006a6ec0 | refs/heads/master | 2021-04-15T09:41:55.846203 | 2018-04-01T04:12:36 | 2018-04-01T04:12:36 | 126,276,014 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,796 | swift | //
// Disk.swift
// Hanoi
//
// Created by Matheus Vaccaro on 20/03/18.
// Copyright © 2018 Matheus Vaccaro. All rights reserved.
//
import Foundation
import SceneKit
class Disk {
let node: SCNNode
let outerRadius: CGFloat
let innerRadius: CGFloat = Disk.innerRadius
let color: UIColor
let height: CGFloat = Disk.height
var isSelected: Bool {
didSet {
if oldValue != isSelected {
isSelected ? addParticles() : removeParticles()
}
}
}
static let height: CGFloat = 1
static let innerRadius: CGFloat = Peg.outerRadius
var relativeMaxY: Float {
return node.position.y + Float(height / 2)
}
var relativeMinY: Float {
return node.position.y - Float(height / 2)
}
init(outerRadius: CGFloat) {
self.isSelected = false
self.outerRadius = outerRadius
let colorAndDiffuse = Disk.generateDiskColorAndDiffuse(forOuterRadius: outerRadius)
let color = colorAndDiffuse.0
let diffuse = colorAndDiffuse.1
self.color = color
let disk = SCNTube(innerRadius: Disk.innerRadius, outerRadius: outerRadius, height: height)
disk.firstMaterial?.diffuse.contents = diffuse
self.node = SCNNode(geometry: disk)
}
private static func generateDiskColorAndDiffuse(forOuterRadius radius: CGFloat) -> (UIColor, Any) {
let path = "art.scnassets/"
switch radius.truncatingRemainder(dividingBy: 7) {
case 0...1:
return (UIColor.red, path + "redWoodTexture.png")
case 1...2:
return (UIColor.orange, path + "orangeWoodTexture.png")
case 2...3:
return (UIColor.yellow, path + "yellowWoodTexture.png")
case 3...4:
return (UIColor.green, path + "greenWoodTexture.png")
case 4...5:
return (UIColor.cyan, path + "cyanWoodTexture.png")
case 5...6:
return (UIColor.blue, path + "blueWoodTexture.png")
case 6...7:
return (UIColor.magenta, path + "pinkWoodTexture.png")
default:
let random = UIColor.random()
return (random, random)
}
}
private func addParticles() {
let particleSystemName = "SmokeParticleSystem.scnp"
let bokehParticleSystem = SCNParticleSystem(named: particleSystemName, inDirectory: nil)
bokehParticleSystem?.particleColor = self.color
bokehParticleSystem?.emitterShape = self.node.geometry
if let emitter = bokehParticleSystem {
self.node.addParticleSystem(emitter)
}
}
private func removeParticles() {
self.node.removeAllParticleSystems()
}
}
| [
-1
] |
cb6f3db65716c1213d72ffa9013afe4d75e46f19 | 0b25588f9fb31d32a839e586484371e66348f2c2 | /LiveenWallet/AppDelegate.swift | ba2802de2297e629889de9ae1645ec2d25db857f | [] | no_license | techinpark2/liveen-wallet-ios | bd31688052ad9ad325982ee7117e041ac6703995 | a96065beaa187cc6f56ed9cf6b5cb9fb2cbac3a6 | refs/heads/master | 2020-03-14T21:06:34.818959 | 2018-04-23T12:03:25 | 2018-04-23T12:03:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,185 | swift | //
// AppDelegate.swift
// LiveenWallet
//
// Created by 이도현 on 2018. 4. 22..
// Copyright © 2018년 veenfoundation. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
229388,
294924,
278542,
229391,
327695,
278545,
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,
352318,
286791,
237640,
278605,
286797,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
327814,
131209,
303241,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
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,
189039,
295538,
172660,
189040,
189044,
287349,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
287390,
303773,
164509,
172705,
287394,
172702,
303780,
172707,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
279231,
287427,
312006,
107208,
107212,
172748,
287436,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
279267,
312035,
295654,
279272,
312048,
230128,
312050,
230131,
189169,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
304005,
295813,
304007,
320391,
213895,
304009,
304011,
230284,
304013,
279438,
213902,
295822,
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,
295949,
197645,
230413,
320528,
140312,
295961,
238620,
197663,
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,
66690,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
165038,
238766,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
291714,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
296264,
238919,
320840,
296267,
296271,
222545,
230739,
312663,
337244,
222556,
230752,
312676,
230760,
173418,
410987,
148843,
230763,
230768,
296305,
312692,
230773,
304505,
181626,
304506,
279929,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
288214,
280021,
239064,
329177,
288217,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
148990,
321022,
206336,
402942,
296446,
296450,
230916,
230919,
214535,
304651,
370187,
304653,
230923,
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,
280276,
313044,
321239,
280283,
18140,
313052,
288478,
313055,
419555,
321252,
313066,
280302,
288494,
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,
280388,
304968,
280393,
280402,
173907,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
10170,
296890,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
313340,
239612,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
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,
280891,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
354653,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
240011,
199051,
289166,
240017,
297363,
190868,
297365,
240021,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
305594,
289210,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
338440,
150025,
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,
158317,
19053,
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,
183172,
158596,
338823,
322440,
314249,
240519,
183184,
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,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
298306,
380226,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
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,
282127,
290321,
282130,
323090,
282133,
290325,
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,
323229,
282269,
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,
307009,
413506,
241475,
307012,
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,
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,
184479,
299167,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
176311,
299191,
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,
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,
291231,
61855,
283042,
291238,
291241,
127403,
127405,
127407,
291247,
299440,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
315856,
176592,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
127457,
291299,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
135672,
233979,
291323,
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,
135844,
299684,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
242396,
299740,
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,
291716,
234373,
316294,
226182,
234375,
308105,
226185,
234379,
324490,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
226200,
234396,
234398,
291742,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
234410,
291754,
291756,
324522,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
234431,
242623,
324544,
324546,
226239,
324548,
234437,
226245,
234439,
234434,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
324599,
234487,
234490,
234493,
234496,
316416,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
234519,
316439,
234520,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
234549,
300085,
300088,
234553,
234556,
234558,
316479,
234561,
308291,
316483,
234563,
234568,
234570,
316491,
300108,
234572,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
300133,
234597,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
275579,
234620,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
234648,
234653,
300189,
119967,
324766,
324768,
283805,
234657,
242852,
234661,
283813,
300197,
234664,
177318,
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,
349451,
349464,
415009,
283939,
259367,
283951,
292143,
300344,
226617,
243003,
283963,
226628,
283973,
300357,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
324978,
136562,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
284084,
284087,
292279,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
226802,
292338,
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,
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,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
276086,
284278,
292470,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
284290,
325250,
284292,
292485,
292479,
276098,
284297,
317066,
284299,
317068,
276109,
284301,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
276166,
284358,
358089,
284362,
276170,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
325408,
300832,
300834,
317221,
227109,
358183,
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,
284529,
292721,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
358292,
284564,
317332,
284566,
399252,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
317353,
276395,
292776,
292784,
276402,
358326,
161718,
276410,
276411,
358330,
276418,
276425,
301009,
301011,
301013,
292823,
301015,
301017,
358360,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
292843,
276460,
276464,
178161,
227314,
276466,
276472,
325624,
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,
276539,
235581,
178238,
325692,
276544,
284739,
243779,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
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,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
309450,
301258,
276685,
309455,
276689,
309462,
301272,
276699,
309468,
194780,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
227571,
309491,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
276843,
293227,
276848,
293232,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
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,
129603,
318020,
301636,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
342707,
318132,
154292,
293555,
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,
293666,
285474,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
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,
342994,
276586,
293849,
293861,
228327,
228328,
228330,
318442,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
285690,
121850,
302075,
244731,
293882,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
310344,
277577,
293960,
277583,
203857,
310355,
293971,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
302205,
285821,
392326,
285831,
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,
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,
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,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
245191,
310727,
64966,
163272,
277959,
292968,
302541,
277963,
302543,
277966,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
302617,
286233,
302621,
286240,
146977,
187939,
294435,
40484,
40486,
286246,
40488,
278057,
294439,
40491,
294440,
294443,
294445,
310831,
245288,
286248,
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,
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,
302793,
294601,
343757,
212690,
278227,
286420,
319187,
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,
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
] |
6be02553be0c225a6f2d06b1874977cdaedb73e6 | 31191c2fac6d1946bd80d0734989c434928271f0 | /iOS Text Reminder/iOS Text ReminderUITests/iOS_Text_ReminderUITests.swift | 822c92577d30cec56c2ca8cb673e2c8355bf9c89 | [] | no_license | ajay1128/Task-Manager-Email-Reminder-System | 65e2a17303fdc58632bce225bf9a29f3beba1e75 | 86b343cc110e7d691dcfadae7ff23c009a446bf1 | refs/heads/master | 2020-04-04T00:11:04.316132 | 2018-11-27T23:28:48 | 2018-11-27T23:28:48 | 155,643,109 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,201 | swift | //
// iOS_Text_ReminderUITests.swift
// iOS Text ReminderUITests
//
// Created by Jonathan Steward on 11/7/18.
// Copyright © 2018 Jonathan Steward. All rights reserved.
//
import XCTest
class iOS_Text_ReminderUITests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
| [
155665,
229414,
344106,
278571,
229425,
180279,
319543,
229431,
352314,
213051,
376892,
32829,
286787,
237638,
311373,
196687,
278607,
311377,
368732,
180317,
278637,
319599,
278642,
131190,
131199,
278669,
278676,
327834,
278684,
278690,
311459,
278703,
278707,
180409,
278713,
295099,
139459,
131270,
229591,
385240,
147679,
147680,
311520,
319719,
295147,
286957,
262403,
180494,
319764,
278805,
311582,
278817,
311596,
336177,
98611,
368949,
278843,
287040,
311622,
319816,
254285,
344402,
229716,
278895,
287089,
139641,
311692,
106893,
156069,
254373,
311723,
377265,
319931,
311739,
278974,
336319,
311744,
336323,
278979,
278988,
278992,
279000,
369121,
279009,
279014,
319976,
279017,
311787,
360945,
279030,
279033,
279042,
287237,
279053,
303635,
279060,
279061,
254487,
279066,
188954,
279092,
352831,
377419,
303693,
369236,
115287,
189016,
287327,
279143,
279150,
287345,
344697,
189054,
287359,
311944,
279176,
344714,
311948,
311950,
311953,
287379,
336531,
180886,
295575,
352921,
303772,
221853,
205469,
295591,
279207,
295598,
279215,
279218,
164532,
287418,
303802,
66243,
287434,
279249,
303826,
369365,
369366,
279253,
230105,
361178,
295653,
369383,
230120,
361194,
312046,
279278,
279293,
205566,
295688,
312076,
295698,
221980,
336678,
262952,
262957,
164655,
328495,
303921,
336693,
230198,
222017,
295745,
279379,
295769,
230238,
435038,
279393,
303973,
279398,
295799,
336765,
287623,
320394,
189327,
279465,
140203,
304050,
189373,
345030,
279499,
123880,
320492,
320495,
320504,
214009,
312313,
312317,
328701,
418819,
320520,
230411,
320526,
361487,
238611,
140311,
336930,
189487,
345137,
361522,
312372,
238646,
238650,
320571,
336962,
238663,
361547,
205911,
156763,
361570,
230500,
214116,
214119,
279659,
230514,
238706,
279666,
312435,
279686,
222344,
140426,
337037,
238764,
148674,
312519,
148687,
189651,
279766,
189656,
279775,
304352,
304353,
279780,
279789,
279803,
320769,
312588,
320795,
320802,
304422,
353581,
116014,
312628,
345397,
345398,
222523,
181568,
279874,
337226,
230730,
345418,
337228,
296269,
222542,
238928,
296274,
230757,
296304,
312688,
230772,
337280,
296328,
296330,
304523,
9618,
279955,
148899,
148900,
279979,
173492,
337359,
329168,
312785,
222674,
329170,
353751,
280025,
239069,
329181,
320997,
280042,
280043,
329198,
337391,
296434,
288252,
312830,
230922,
304655,
329231,
222754,
312879,
230960,
288305,
239159,
288319,
288322,
280131,
124486,
288328,
99937,
345697,
312937,
312941,
206447,
288377,
337533,
280193,
288391,
239251,
280217,
345753,
198304,
255651,
280252,
280253,
296636,
321217,
280259,
239305,
296649,
313042,
345813,
280279,
18139,
321250,
337638,
181992,
345832,
288492,
141037,
34547,
67316,
313082,
288508,
288515,
116491,
280333,
124691,
116502,
321308,
321309,
255781,
280373,
280377,
321338,
345918,
280391,
280396,
345942,
362326,
370526,
345950,
362336,
296807,
362351,
313200,
313204,
124795,
280451,
67464,
305032,
337816,
124826,
239515,
329627,
354210,
313257,
214978,
280517,
362442,
346066,
231382,
354268,
190437,
174058,
354283,
313322,
247786,
296942,
337899,
124912,
313338,
239610,
182277,
354312,
313356,
305173,
223269,
354342,
346153,
354346,
313388,
124974,
215095,
288829,
288835,
313415,
239689,
354386,
223317,
321632,
280676,
313446,
215144,
288878,
215165,
329884,
215204,
125108,
280761,
223418,
280767,
338118,
346319,
321744,
280792,
280803,
338151,
182503,
125166,
125170,
395511,
313595,
125184,
125192,
125197,
125200,
338196,
125204,
272661,
125215,
125216,
338217,
125225,
321839,
125236,
362809,
289109,
379224,
272730,
215395,
239973,
280938,
321901,
354671,
354672,
199030,
223611,
248188,
313726,
240003,
158087,
240020,
190870,
190872,
289185,
436644,
289195,
338359,
289229,
281038,
281039,
256476,
281071,
322057,
182802,
322077,
289328,
330291,
338491,
322119,
281165,
436831,
281200,
313970,
297600,
346771,
363155,
289435,
314020,
248494,
166581,
314043,
355006,
363212,
158424,
322269,
338658,
289511,
330473,
330476,
289517,
215790,
199415,
289534,
322302,
35584,
322312,
346889,
264971,
322320,
166677,
207639,
289580,
355129,
355136,
355138,
355147,
355148,
355153,
281426,
281434,
322396,
281444,
355173,
355174,
314240,
158594,
330627,
240517,
355216,
256920,
289691,
240543,
256934,
289720,
289723,
330688,
281541,
19398,
191445,
207839,
314343,
289773,
248815,
347122,
330759,
330766,
347150,
330789,
281647,
322609,
314437,
257093,
207954,
339031,
314458,
281699,
257126,
322664,
363643,
314493,
150656,
248960,
347286,
339101,
339106,
3243,
208044,
322733,
339131,
290001,
339167,
298209,
208123,
322826,
126229,
257323,
298290,
208179,
159033,
216387,
372039,
109899,
224591,
331091,
150868,
314708,
314711,
314721,
281958,
314727,
134504,
306541,
314734,
314740,
314742,
314745,
224637,
306558,
314759,
388488,
298378,
314765,
314771,
306580,
224662,
282008,
314776,
282013,
290206,
314788,
298406,
282023,
314790,
241067,
314797,
134586,
380350,
306630,
200136,
306634,
339403,
3559,
191980,
282097,
191991,
290304,
323079,
323083,
208397,
323088,
282132,
282135,
175640,
282147,
372261,
306730,
290359,
134715,
323132,
282182,
290391,
306777,
323171,
282214,
314997,
290425,
339579,
282244,
282248,
224907,
323226,
282279,
298664,
224951,
224952,
306875,
282302,
323262,
323265,
241360,
282321,
241366,
224985,
282330,
282336,
12009,
282347,
282349,
323315,
200444,
282366,
175874,
249606,
282375,
323335,
282379,
216844,
118549,
282390,
282399,
241440,
282401,
339746,
216868,
241447,
282418,
282424,
282428,
241471,
339782,
315209,
159563,
241494,
339799,
307038,
282471,
282476,
339840,
315265,
282503,
315272,
315275,
184207,
282517,
298912,
118693,
126896,
282572,
282573,
323554,
298987,
282634,
241695,
315431,
102441,
315433,
102446,
282671,
241717,
249912,
307269,
233548,
315468,
176209,
315477,
53334,
323678,
356446,
217194,
233578,
307306,
381071,
241809,
323730,
299166,
233635,
299176,
184489,
323761,
184498,
258233,
299197,
299202,
176325,
299208,
233678,
282832,
356575,
307431,
356603,
184574,
217352,
61720,
315674,
282908,
299294,
282912,
233761,
282920,
315698,
282938,
307514,
127292,
332100,
323914,
201037,
348499,
250196,
348501,
168280,
332128,
381286,
242027,
242028,
160111,
250227,
315768,
291193,
315769,
291200,
340356,
242059,
291225,
242079,
283039,
283088,
283089,
176602,
242138,
291297,
324098,
233987,
340489,
283154,
291359,
348709,
348710,
283185,
234037,
340539,
332379,
111197,
242274,
176751,
356990,
291455,
152196,
316044,
184974,
316048,
316050,
340645,
176810,
291529,
225996,
135888,
242385,
299737,
234216,
234233,
242428,
291584,
299777,
291591,
283418,
234276,
234290,
348999,
283466,
234330,
201562,
275294,
127840,
349025,
357219,
177002,
308075,
242540,
242542,
201590,
177018,
308093,
291713,
340865,
299912,
349066,
316299,
234382,
308111,
308113,
209820,
283551,
177074,
127945,
340960,
234469,
340967,
324587,
234476,
201721,
234499,
357380,
234513,
300087,
21567,
308288,
160834,
349254,
250955,
300109,
234578,
250965,
234588,
250982,
234606,
300147,
234626,
349317,
234635,
177297,
308375,
324761,
119965,
234655,
300192,
234662,
300200,
373937,
324790,
300215,
283841,
283846,
259275,
316628,
259285,
357594,
251124,
316661,
234741,
292092,
242955,
177420,
292145,
300342,
333115,
193858,
300354,
300355,
234830,
259408,
283990,
357720,
300378,
300379,
316764,
292194,
234864,
316786,
243073,
292242,
112019,
234902,
374189,
284086,
259513,
54719,
415170,
292291,
300488,
300490,
234957,
144862,
300526,
259569,
308722,
251379,
300539,
210429,
366081,
218632,
316951,
374297,
349727,
374327,
210489,
235069,
349764,
194118,
292424,
292426,
333389,
128589,
333394,
349780,
128600,
235096,
300643,
300645,
415334,
243306,
54895,
325246,
333438,
317102,
259780,
333508,
333522,
325345,
153318,
333543,
284410,
284425,
300812,
284430,
161553,
284436,
169751,
325403,
341791,
325411,
186148,
186149,
333609,
284460,
300849,
325444,
153416,
325449,
325460,
317268,
341846,
284508,
300893,
259937,
284515,
276326,
292713,
292719,
325491,
333687,
350072,
317305,
325508,
333700,
243592,
325514,
350091,
350092,
350102,
333727,
219046,
333734,
284584,
292783,
300983,
292835,
317416,
325620,
333827,
243720,
178215,
325675,
243763,
325695,
194667,
284789,
235661,
333968,
153752,
284827,
333990,
284843,
227517,
309443,
227525,
301255,
227536,
301270,
301271,
325857,
317676,
309504,
194832,
227601,
334104,
211239,
334121,
317738,
325930,
227655,
383309,
391521,
366948,
416103,
211327,
227721,
285074,
227730,
285083,
317851,
293275,
39323,
227743,
285089,
293281,
375211,
334259,
342454,
293309,
317889,
129484,
326093,
285152,
195044,
334315,
293368,
317949,
334345,
309770,
342537,
342560,
227881,
293420,
23093,
244279,
244280,
301635,
309831,
301647,
326229,
244311,
309847,
375396,
244326,
301688,
244345,
334473,
326288,
285348,
318127,
293552,
342705,
285362,
285360,
154295,
342714,
342757,
285419,
170735,
342775,
359166,
375552,
228099,
285443,
285450,
326413,
285457,
285467,
318247,
293673,
318251,
301883,
342846,
293702,
244569,
252766,
301919,
293729,
351078,
342888,
228214,
211835,
269179,
228232,
252812,
310166,
400282,
310177,
359332,
359333,
293801,
326571,
252848,
326580,
326586,
359365,
211913,
56270,
252878,
359380,
343020,
203758,
293894,
384015,
293911,
326684,
384031,
318515,
203829,
253028,
318571,
187508,
302202,
285819,
285823,
285833,
285834,
318602,
228492,
162962,
187539,
359574,
285850,
351389,
302239,
253098,
302251,
367798,
64699,
294075,
228541,
343230,
310496,
228587,
302319,
351475,
228608,
245018,
130342,
130344,
130347,
286012,
294210,
359747,
359748,
294220,
318804,
294236,
327023,
327030,
310650,
294278,
318860,
318876,
343457,
245160,
286128,
286133,
310714,
228796,
302530,
228804,
310731,
327122,
310747,
286176,
187877,
310758,
40439,
253431,
286201,
359931,
245249,
228868,
302602,
294413,
359949,
253456,
302613,
146976,
425534,
286281,
196184,
212574,
204386,
204394,
138862,
310896,
294517,
286344,
286351,
188049,
229021,
245413,
286387,
286392,
302778,
286400,
319176,
212684,
286419,
294621,
294629,
286457,
286463,
319232,
360194,
278292,
294699,
319289,
237397,
237411,
327556,
188293,
311183,
294806,
294808,
253851,
319393,
294820,
253868,
343993,
188349,
98240,
24531,
212953,
360416,
294887,
253930,
278507,
311277,
327666
] |
0d67cc24f79f730cfbf616798af0ecc8417d5600 | a04642d9a0d7b3cced43fc7d9764ed8d3d6f7c28 | /LinhKa_Collection_p1_v3/Item.swift | 99760ffdaaa95558e612eb05ee4922f24bd377b1 | [] | no_license | vtahdn/LinhKa_Collection_p1_v3 | 512b2c5573c3ce9cba034867c8543a0350e39998 | cb10d64a4134687bbf7ae578d4789fce4858b5a9 | refs/heads/master | 2020-03-31T02:49:14.421812 | 2018-10-06T13:11:28 | 2018-10-06T13:11:28 | 151,840,850 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 461 | swift | //
// Item.swift
// LinhKa_Collection_p1_v3
//
// Created by macbook on 10/6/18.
// Copyright © 2018 Viet. All rights reserved.
//
import Foundation
class Item {
var name: String
var content: String
var images: [String]
var code: String
init(name: String, content: String, images: [String], code: String) {
self.name = name
self.content = content
self.images = images
self.code = code
}
} | [
-1
] |
872a9d928fd33c3173de101ef5c8a5c3a08f8517 | 447e2b5564e91ab406f329543b92e25d12caf055 | /Sources/AWSSDKSwift/Services/SWF/SWF_Shapes.swift | 72f338eb2b48a7ea56eee704080e26e064fa32cb | [
"Apache-2.0",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | krsakai/aws-sdk-swift | 363df10b11618eac48f305905d510f7f13bd56f7 | cd54730bb3264c122120b1cf74e449bc06e85afb | refs/heads/master | 2022-11-22T19:00:15.024276 | 2020-07-24T13:53:01 | 2020-07-24T14:03:50 | 282,223,693 | 0 | 0 | Apache-2.0 | 2020-07-24T13:13:34 | 2020-07-24T13:13:33 | null | UTF-8 | Swift | false | false | 295,222 | swift | //===----------------------------------------------------------------------===//
//
// This source file is part of the AWSSDKSwift open source project
//
// Copyright (c) 2017-2020 the AWSSDKSwift project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of AWSSDKSwift project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/swift-aws/aws-sdk-swift/blob/master/CodeGenerator/Sources/CodeGenerator/main.swift. DO NOT EDIT.
import AWSSDKSwiftCore
import Foundation
extension SWF {
//MARK: Enums
public enum ActivityTaskTimeoutType: String, CustomStringConvertible, Codable {
case startToClose = "START_TO_CLOSE"
case scheduleToStart = "SCHEDULE_TO_START"
case scheduleToClose = "SCHEDULE_TO_CLOSE"
case heartbeat = "HEARTBEAT"
public var description: String { return self.rawValue }
}
public enum CancelTimerFailedCause: String, CustomStringConvertible, Codable {
case timerIdUnknown = "TIMER_ID_UNKNOWN"
case operationNotPermitted = "OPERATION_NOT_PERMITTED"
public var description: String { return self.rawValue }
}
public enum CancelWorkflowExecutionFailedCause: String, CustomStringConvertible, Codable {
case unhandledDecision = "UNHANDLED_DECISION"
case operationNotPermitted = "OPERATION_NOT_PERMITTED"
public var description: String { return self.rawValue }
}
public enum ChildPolicy: String, CustomStringConvertible, Codable {
case terminate = "TERMINATE"
case requestCancel = "REQUEST_CANCEL"
case abandon = "ABANDON"
public var description: String { return self.rawValue }
}
public enum CloseStatus: String, CustomStringConvertible, Codable {
case completed = "COMPLETED"
case failed = "FAILED"
case canceled = "CANCELED"
case terminated = "TERMINATED"
case continuedAsNew = "CONTINUED_AS_NEW"
case timedOut = "TIMED_OUT"
public var description: String { return self.rawValue }
}
public enum CompleteWorkflowExecutionFailedCause: String, CustomStringConvertible, Codable {
case unhandledDecision = "UNHANDLED_DECISION"
case operationNotPermitted = "OPERATION_NOT_PERMITTED"
public var description: String { return self.rawValue }
}
public enum ContinueAsNewWorkflowExecutionFailedCause: String, CustomStringConvertible, Codable {
case unhandledDecision = "UNHANDLED_DECISION"
case workflowTypeDeprecated = "WORKFLOW_TYPE_DEPRECATED"
case workflowTypeDoesNotExist = "WORKFLOW_TYPE_DOES_NOT_EXIST"
case defaultExecutionStartToCloseTimeoutUndefined = "DEFAULT_EXECUTION_START_TO_CLOSE_TIMEOUT_UNDEFINED"
case defaultTaskStartToCloseTimeoutUndefined = "DEFAULT_TASK_START_TO_CLOSE_TIMEOUT_UNDEFINED"
case defaultTaskListUndefined = "DEFAULT_TASK_LIST_UNDEFINED"
case defaultChildPolicyUndefined = "DEFAULT_CHILD_POLICY_UNDEFINED"
case continueAsNewWorkflowExecutionRateExceeded = "CONTINUE_AS_NEW_WORKFLOW_EXECUTION_RATE_EXCEEDED"
case operationNotPermitted = "OPERATION_NOT_PERMITTED"
public var description: String { return self.rawValue }
}
public enum DecisionTaskTimeoutType: String, CustomStringConvertible, Codable {
case startToClose = "START_TO_CLOSE"
public var description: String { return self.rawValue }
}
public enum DecisionType: String, CustomStringConvertible, Codable {
case scheduleactivitytask = "ScheduleActivityTask"
case requestcancelactivitytask = "RequestCancelActivityTask"
case completeworkflowexecution = "CompleteWorkflowExecution"
case failworkflowexecution = "FailWorkflowExecution"
case cancelworkflowexecution = "CancelWorkflowExecution"
case continueasnewworkflowexecution = "ContinueAsNewWorkflowExecution"
case recordmarker = "RecordMarker"
case starttimer = "StartTimer"
case canceltimer = "CancelTimer"
case signalexternalworkflowexecution = "SignalExternalWorkflowExecution"
case requestcancelexternalworkflowexecution = "RequestCancelExternalWorkflowExecution"
case startchildworkflowexecution = "StartChildWorkflowExecution"
case schedulelambdafunction = "ScheduleLambdaFunction"
public var description: String { return self.rawValue }
}
public enum EventType: String, CustomStringConvertible, Codable {
case workflowexecutionstarted = "WorkflowExecutionStarted"
case workflowexecutioncancelrequested = "WorkflowExecutionCancelRequested"
case workflowexecutioncompleted = "WorkflowExecutionCompleted"
case completeworkflowexecutionfailed = "CompleteWorkflowExecutionFailed"
case workflowexecutionfailed = "WorkflowExecutionFailed"
case failworkflowexecutionfailed = "FailWorkflowExecutionFailed"
case workflowexecutiontimedout = "WorkflowExecutionTimedOut"
case workflowexecutioncanceled = "WorkflowExecutionCanceled"
case cancelworkflowexecutionfailed = "CancelWorkflowExecutionFailed"
case workflowexecutioncontinuedasnew = "WorkflowExecutionContinuedAsNew"
case continueasnewworkflowexecutionfailed = "ContinueAsNewWorkflowExecutionFailed"
case workflowexecutionterminated = "WorkflowExecutionTerminated"
case decisiontaskscheduled = "DecisionTaskScheduled"
case decisiontaskstarted = "DecisionTaskStarted"
case decisiontaskcompleted = "DecisionTaskCompleted"
case decisiontasktimedout = "DecisionTaskTimedOut"
case activitytaskscheduled = "ActivityTaskScheduled"
case scheduleactivitytaskfailed = "ScheduleActivityTaskFailed"
case activitytaskstarted = "ActivityTaskStarted"
case activitytaskcompleted = "ActivityTaskCompleted"
case activitytaskfailed = "ActivityTaskFailed"
case activitytasktimedout = "ActivityTaskTimedOut"
case activitytaskcanceled = "ActivityTaskCanceled"
case activitytaskcancelrequested = "ActivityTaskCancelRequested"
case requestcancelactivitytaskfailed = "RequestCancelActivityTaskFailed"
case workflowexecutionsignaled = "WorkflowExecutionSignaled"
case markerrecorded = "MarkerRecorded"
case recordmarkerfailed = "RecordMarkerFailed"
case timerstarted = "TimerStarted"
case starttimerfailed = "StartTimerFailed"
case timerfired = "TimerFired"
case timercanceled = "TimerCanceled"
case canceltimerfailed = "CancelTimerFailed"
case startchildworkflowexecutioninitiated = "StartChildWorkflowExecutionInitiated"
case startchildworkflowexecutionfailed = "StartChildWorkflowExecutionFailed"
case childworkflowexecutionstarted = "ChildWorkflowExecutionStarted"
case childworkflowexecutioncompleted = "ChildWorkflowExecutionCompleted"
case childworkflowexecutionfailed = "ChildWorkflowExecutionFailed"
case childworkflowexecutiontimedout = "ChildWorkflowExecutionTimedOut"
case childworkflowexecutioncanceled = "ChildWorkflowExecutionCanceled"
case childworkflowexecutionterminated = "ChildWorkflowExecutionTerminated"
case signalexternalworkflowexecutioninitiated = "SignalExternalWorkflowExecutionInitiated"
case signalexternalworkflowexecutionfailed = "SignalExternalWorkflowExecutionFailed"
case externalworkflowexecutionsignaled = "ExternalWorkflowExecutionSignaled"
case requestcancelexternalworkflowexecutioninitiated = "RequestCancelExternalWorkflowExecutionInitiated"
case requestcancelexternalworkflowexecutionfailed = "RequestCancelExternalWorkflowExecutionFailed"
case externalworkflowexecutioncancelrequested = "ExternalWorkflowExecutionCancelRequested"
case lambdafunctionscheduled = "LambdaFunctionScheduled"
case lambdafunctionstarted = "LambdaFunctionStarted"
case lambdafunctioncompleted = "LambdaFunctionCompleted"
case lambdafunctionfailed = "LambdaFunctionFailed"
case lambdafunctiontimedout = "LambdaFunctionTimedOut"
case schedulelambdafunctionfailed = "ScheduleLambdaFunctionFailed"
case startlambdafunctionfailed = "StartLambdaFunctionFailed"
public var description: String { return self.rawValue }
}
public enum ExecutionStatus: String, CustomStringConvertible, Codable {
case open = "OPEN"
case closed = "CLOSED"
public var description: String { return self.rawValue }
}
public enum FailWorkflowExecutionFailedCause: String, CustomStringConvertible, Codable {
case unhandledDecision = "UNHANDLED_DECISION"
case operationNotPermitted = "OPERATION_NOT_PERMITTED"
public var description: String { return self.rawValue }
}
public enum LambdaFunctionTimeoutType: String, CustomStringConvertible, Codable {
case startToClose = "START_TO_CLOSE"
public var description: String { return self.rawValue }
}
public enum RecordMarkerFailedCause: String, CustomStringConvertible, Codable {
case operationNotPermitted = "OPERATION_NOT_PERMITTED"
public var description: String { return self.rawValue }
}
public enum RegistrationStatus: String, CustomStringConvertible, Codable {
case registered = "REGISTERED"
case deprecated = "DEPRECATED"
public var description: String { return self.rawValue }
}
public enum RequestCancelActivityTaskFailedCause: String, CustomStringConvertible, Codable {
case activityIdUnknown = "ACTIVITY_ID_UNKNOWN"
case operationNotPermitted = "OPERATION_NOT_PERMITTED"
public var description: String { return self.rawValue }
}
public enum RequestCancelExternalWorkflowExecutionFailedCause: String, CustomStringConvertible, Codable {
case unknownExternalWorkflowExecution = "UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION"
case requestCancelExternalWorkflowExecutionRateExceeded = "REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_RATE_EXCEEDED"
case operationNotPermitted = "OPERATION_NOT_PERMITTED"
public var description: String { return self.rawValue }
}
public enum ScheduleActivityTaskFailedCause: String, CustomStringConvertible, Codable {
case activityTypeDeprecated = "ACTIVITY_TYPE_DEPRECATED"
case activityTypeDoesNotExist = "ACTIVITY_TYPE_DOES_NOT_EXIST"
case activityIdAlreadyInUse = "ACTIVITY_ID_ALREADY_IN_USE"
case openActivitiesLimitExceeded = "OPEN_ACTIVITIES_LIMIT_EXCEEDED"
case activityCreationRateExceeded = "ACTIVITY_CREATION_RATE_EXCEEDED"
case defaultScheduleToCloseTimeoutUndefined = "DEFAULT_SCHEDULE_TO_CLOSE_TIMEOUT_UNDEFINED"
case defaultTaskListUndefined = "DEFAULT_TASK_LIST_UNDEFINED"
case defaultScheduleToStartTimeoutUndefined = "DEFAULT_SCHEDULE_TO_START_TIMEOUT_UNDEFINED"
case defaultStartToCloseTimeoutUndefined = "DEFAULT_START_TO_CLOSE_TIMEOUT_UNDEFINED"
case defaultHeartbeatTimeoutUndefined = "DEFAULT_HEARTBEAT_TIMEOUT_UNDEFINED"
case operationNotPermitted = "OPERATION_NOT_PERMITTED"
public var description: String { return self.rawValue }
}
public enum ScheduleLambdaFunctionFailedCause: String, CustomStringConvertible, Codable {
case idAlreadyInUse = "ID_ALREADY_IN_USE"
case openLambdaFunctionsLimitExceeded = "OPEN_LAMBDA_FUNCTIONS_LIMIT_EXCEEDED"
case lambdaFunctionCreationRateExceeded = "LAMBDA_FUNCTION_CREATION_RATE_EXCEEDED"
case lambdaServiceNotAvailableInRegion = "LAMBDA_SERVICE_NOT_AVAILABLE_IN_REGION"
public var description: String { return self.rawValue }
}
public enum SignalExternalWorkflowExecutionFailedCause: String, CustomStringConvertible, Codable {
case unknownExternalWorkflowExecution = "UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION"
case signalExternalWorkflowExecutionRateExceeded = "SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_RATE_EXCEEDED"
case operationNotPermitted = "OPERATION_NOT_PERMITTED"
public var description: String { return self.rawValue }
}
public enum StartChildWorkflowExecutionFailedCause: String, CustomStringConvertible, Codable {
case workflowTypeDoesNotExist = "WORKFLOW_TYPE_DOES_NOT_EXIST"
case workflowTypeDeprecated = "WORKFLOW_TYPE_DEPRECATED"
case openChildrenLimitExceeded = "OPEN_CHILDREN_LIMIT_EXCEEDED"
case openWorkflowsLimitExceeded = "OPEN_WORKFLOWS_LIMIT_EXCEEDED"
case childCreationRateExceeded = "CHILD_CREATION_RATE_EXCEEDED"
case workflowAlreadyRunning = "WORKFLOW_ALREADY_RUNNING"
case defaultExecutionStartToCloseTimeoutUndefined = "DEFAULT_EXECUTION_START_TO_CLOSE_TIMEOUT_UNDEFINED"
case defaultTaskListUndefined = "DEFAULT_TASK_LIST_UNDEFINED"
case defaultTaskStartToCloseTimeoutUndefined = "DEFAULT_TASK_START_TO_CLOSE_TIMEOUT_UNDEFINED"
case defaultChildPolicyUndefined = "DEFAULT_CHILD_POLICY_UNDEFINED"
case operationNotPermitted = "OPERATION_NOT_PERMITTED"
public var description: String { return self.rawValue }
}
public enum StartLambdaFunctionFailedCause: String, CustomStringConvertible, Codable {
case assumeRoleFailed = "ASSUME_ROLE_FAILED"
public var description: String { return self.rawValue }
}
public enum StartTimerFailedCause: String, CustomStringConvertible, Codable {
case timerIdAlreadyInUse = "TIMER_ID_ALREADY_IN_USE"
case openTimersLimitExceeded = "OPEN_TIMERS_LIMIT_EXCEEDED"
case timerCreationRateExceeded = "TIMER_CREATION_RATE_EXCEEDED"
case operationNotPermitted = "OPERATION_NOT_PERMITTED"
public var description: String { return self.rawValue }
}
public enum WorkflowExecutionCancelRequestedCause: String, CustomStringConvertible, Codable {
case childPolicyApplied = "CHILD_POLICY_APPLIED"
public var description: String { return self.rawValue }
}
public enum WorkflowExecutionTerminatedCause: String, CustomStringConvertible, Codable {
case childPolicyApplied = "CHILD_POLICY_APPLIED"
case eventLimitExceeded = "EVENT_LIMIT_EXCEEDED"
case operatorInitiated = "OPERATOR_INITIATED"
public var description: String { return self.rawValue }
}
public enum WorkflowExecutionTimeoutType: String, CustomStringConvertible, Codable {
case startToClose = "START_TO_CLOSE"
public var description: String { return self.rawValue }
}
//MARK: Shapes
public struct ActivityTask: AWSDecodableShape {
/// The unique ID of the task.
public let activityId: String
/// The type of this activity task.
public let activityType: ActivityType
/// The inputs provided when the activity task was scheduled. The form of the input is user defined and should be meaningful to the activity implementation.
public let input: String?
/// The ID of the ActivityTaskStarted event recorded in the history.
public let startedEventId: Int64
/// The opaque string used as a handle on the task. This token is used by workers to communicate progress and response information back to the system about the task.
public let taskToken: String
/// The workflow execution that started this activity task.
public let workflowExecution: WorkflowExecution
public init(activityId: String, activityType: ActivityType, input: String? = nil, startedEventId: Int64, taskToken: String, workflowExecution: WorkflowExecution) {
self.activityId = activityId
self.activityType = activityType
self.input = input
self.startedEventId = startedEventId
self.taskToken = taskToken
self.workflowExecution = workflowExecution
}
private enum CodingKeys: String, CodingKey {
case activityId = "activityId"
case activityType = "activityType"
case input = "input"
case startedEventId = "startedEventId"
case taskToken = "taskToken"
case workflowExecution = "workflowExecution"
}
}
public struct ActivityTaskCancelRequestedEventAttributes: AWSDecodableShape {
/// The unique ID of the task.
public let activityId: String
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the RequestCancelActivityTask decision for this cancellation request. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
public init(activityId: String, decisionTaskCompletedEventId: Int64) {
self.activityId = activityId
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
}
private enum CodingKeys: String, CodingKey {
case activityId = "activityId"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
}
}
public struct ActivityTaskCanceledEventAttributes: AWSDecodableShape {
/// Details of the cancellation.
public let details: String?
/// If set, contains the ID of the last ActivityTaskCancelRequested event recorded for this activity task. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let latestCancelRequestedEventId: Int64?
/// The ID of the ActivityTaskScheduled event that was recorded when this activity task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let scheduledEventId: Int64
/// The ID of the ActivityTaskStarted event recorded when this activity task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let startedEventId: Int64
public init(details: String? = nil, latestCancelRequestedEventId: Int64? = nil, scheduledEventId: Int64, startedEventId: Int64) {
self.details = details
self.latestCancelRequestedEventId = latestCancelRequestedEventId
self.scheduledEventId = scheduledEventId
self.startedEventId = startedEventId
}
private enum CodingKeys: String, CodingKey {
case details = "details"
case latestCancelRequestedEventId = "latestCancelRequestedEventId"
case scheduledEventId = "scheduledEventId"
case startedEventId = "startedEventId"
}
}
public struct ActivityTaskCompletedEventAttributes: AWSDecodableShape {
/// The results of the activity task.
public let result: String?
/// The ID of the ActivityTaskScheduled event that was recorded when this activity task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let scheduledEventId: Int64
/// The ID of the ActivityTaskStarted event recorded when this activity task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let startedEventId: Int64
public init(result: String? = nil, scheduledEventId: Int64, startedEventId: Int64) {
self.result = result
self.scheduledEventId = scheduledEventId
self.startedEventId = startedEventId
}
private enum CodingKeys: String, CodingKey {
case result = "result"
case scheduledEventId = "scheduledEventId"
case startedEventId = "startedEventId"
}
}
public struct ActivityTaskFailedEventAttributes: AWSDecodableShape {
/// The details of the failure.
public let details: String?
/// The reason provided for the failure.
public let reason: String?
/// The ID of the ActivityTaskScheduled event that was recorded when this activity task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let scheduledEventId: Int64
/// The ID of the ActivityTaskStarted event recorded when this activity task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let startedEventId: Int64
public init(details: String? = nil, reason: String? = nil, scheduledEventId: Int64, startedEventId: Int64) {
self.details = details
self.reason = reason
self.scheduledEventId = scheduledEventId
self.startedEventId = startedEventId
}
private enum CodingKeys: String, CodingKey {
case details = "details"
case reason = "reason"
case scheduledEventId = "scheduledEventId"
case startedEventId = "startedEventId"
}
}
public struct ActivityTaskScheduledEventAttributes: AWSDecodableShape {
/// The unique ID of the activity task.
public let activityId: String
/// The type of the activity task.
public let activityType: ActivityType
/// Data attached to the event that can be used by the decider in subsequent workflow tasks. This data isn't sent to the activity.
public let control: String?
/// The ID of the DecisionTaskCompleted event corresponding to the decision that resulted in the scheduling of this activity task. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
/// The maximum time before which the worker processing this task must report progress by calling RecordActivityTaskHeartbeat. If the timeout is exceeded, the activity task is automatically timed out. If the worker subsequently attempts to record a heartbeat or return a result, it is ignored.
public let heartbeatTimeout: String?
/// The input provided to the activity task.
public let input: String?
/// The maximum amount of time for this activity task.
public let scheduleToCloseTimeout: String?
/// The maximum amount of time the activity task can wait to be assigned to a worker.
public let scheduleToStartTimeout: String?
/// The maximum amount of time a worker may take to process the activity task.
public let startToCloseTimeout: String?
/// The task list in which the activity task has been scheduled.
public let taskList: TaskList
/// The priority to assign to the scheduled activity task. If set, this overrides any default priority value that was assigned when the activity type was registered. Valid values are integers that range from Java's Integer.MIN_VALUE (-2147483648) to Integer.MAX_VALUE (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see Setting Task Priority in the Amazon SWF Developer Guide.
public let taskPriority: String?
public init(activityId: String, activityType: ActivityType, control: String? = nil, decisionTaskCompletedEventId: Int64, heartbeatTimeout: String? = nil, input: String? = nil, scheduleToCloseTimeout: String? = nil, scheduleToStartTimeout: String? = nil, startToCloseTimeout: String? = nil, taskList: TaskList, taskPriority: String? = nil) {
self.activityId = activityId
self.activityType = activityType
self.control = control
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
self.heartbeatTimeout = heartbeatTimeout
self.input = input
self.scheduleToCloseTimeout = scheduleToCloseTimeout
self.scheduleToStartTimeout = scheduleToStartTimeout
self.startToCloseTimeout = startToCloseTimeout
self.taskList = taskList
self.taskPriority = taskPriority
}
private enum CodingKeys: String, CodingKey {
case activityId = "activityId"
case activityType = "activityType"
case control = "control"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
case heartbeatTimeout = "heartbeatTimeout"
case input = "input"
case scheduleToCloseTimeout = "scheduleToCloseTimeout"
case scheduleToStartTimeout = "scheduleToStartTimeout"
case startToCloseTimeout = "startToCloseTimeout"
case taskList = "taskList"
case taskPriority = "taskPriority"
}
}
public struct ActivityTaskStartedEventAttributes: AWSDecodableShape {
/// Identity of the worker that was assigned this task. This aids diagnostics when problems arise. The form of this identity is user defined.
public let identity: String?
/// The ID of the ActivityTaskScheduled event that was recorded when this activity task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let scheduledEventId: Int64
public init(identity: String? = nil, scheduledEventId: Int64) {
self.identity = identity
self.scheduledEventId = scheduledEventId
}
private enum CodingKeys: String, CodingKey {
case identity = "identity"
case scheduledEventId = "scheduledEventId"
}
}
public struct ActivityTaskStatus: AWSDecodableShape {
/// Set to true if cancellation of the task is requested.
public let cancelRequested: Bool
public init(cancelRequested: Bool) {
self.cancelRequested = cancelRequested
}
private enum CodingKeys: String, CodingKey {
case cancelRequested = "cancelRequested"
}
}
public struct ActivityTaskTimedOutEventAttributes: AWSDecodableShape {
/// Contains the content of the details parameter for the last call made by the activity to RecordActivityTaskHeartbeat.
public let details: String?
/// The ID of the ActivityTaskScheduled event that was recorded when this activity task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let scheduledEventId: Int64
/// The ID of the ActivityTaskStarted event recorded when this activity task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let startedEventId: Int64
/// The type of the timeout that caused this event.
public let timeoutType: ActivityTaskTimeoutType
public init(details: String? = nil, scheduledEventId: Int64, startedEventId: Int64, timeoutType: ActivityTaskTimeoutType) {
self.details = details
self.scheduledEventId = scheduledEventId
self.startedEventId = startedEventId
self.timeoutType = timeoutType
}
private enum CodingKeys: String, CodingKey {
case details = "details"
case scheduledEventId = "scheduledEventId"
case startedEventId = "startedEventId"
case timeoutType = "timeoutType"
}
}
public struct ActivityType: AWSEncodableShape & AWSDecodableShape {
/// The name of this activity. The combination of activity type name and version must be unique within a domain.
public let name: String
/// The version of this activity. The combination of activity type name and version must be unique with in a domain.
public let version: String
public init(name: String, version: String) {
self.name = name
self.version = version
}
public func validate(name: String) throws {
try validate(self.name, name: "name", parent: name, max: 256)
try validate(self.name, name: "name", parent: name, min: 1)
try validate(self.version, name: "version", parent: name, max: 64)
try validate(self.version, name: "version", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case name = "name"
case version = "version"
}
}
public struct ActivityTypeConfiguration: AWSDecodableShape {
/// The default maximum time, in seconds, before which a worker processing a task must report progress by calling RecordActivityTaskHeartbeat. You can specify this value only when registering an activity type. The registered default value can be overridden when you schedule a task through the ScheduleActivityTask Decision. If the activity worker subsequently attempts to record a heartbeat or returns a result, the activity worker receives an UnknownResource fault. In this case, Amazon SWF no longer considers the activity task to be valid; the activity worker should clean up the activity task. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let defaultTaskHeartbeatTimeout: String?
/// The default task list specified for this activity type at registration. This default is used if a task list isn't provided when a task is scheduled through the ScheduleActivityTask Decision. You can override the default registered task list when scheduling a task through the ScheduleActivityTask Decision.
public let defaultTaskList: TaskList?
/// The default task priority for tasks of this activity type, specified at registration. If not set, then 0 is used as the default priority. This default can be overridden when scheduling an activity task. Valid values are integers that range from Java's Integer.MIN_VALUE (-2147483648) to Integer.MAX_VALUE (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see Setting Task Priority in the Amazon SWF Developer Guide.
public let defaultTaskPriority: String?
/// The default maximum duration, specified when registering the activity type, for tasks of this activity type. You can override this default when scheduling a task through the ScheduleActivityTask Decision. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let defaultTaskScheduleToCloseTimeout: String?
/// The default maximum duration, specified when registering the activity type, that a task of an activity type can wait before being assigned to a worker. You can override this default when scheduling a task through the ScheduleActivityTask Decision. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let defaultTaskScheduleToStartTimeout: String?
/// The default maximum duration for tasks of an activity type specified when registering the activity type. You can override this default when scheduling a task through the ScheduleActivityTask Decision. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let defaultTaskStartToCloseTimeout: String?
public init(defaultTaskHeartbeatTimeout: String? = nil, defaultTaskList: TaskList? = nil, defaultTaskPriority: String? = nil, defaultTaskScheduleToCloseTimeout: String? = nil, defaultTaskScheduleToStartTimeout: String? = nil, defaultTaskStartToCloseTimeout: String? = nil) {
self.defaultTaskHeartbeatTimeout = defaultTaskHeartbeatTimeout
self.defaultTaskList = defaultTaskList
self.defaultTaskPriority = defaultTaskPriority
self.defaultTaskScheduleToCloseTimeout = defaultTaskScheduleToCloseTimeout
self.defaultTaskScheduleToStartTimeout = defaultTaskScheduleToStartTimeout
self.defaultTaskStartToCloseTimeout = defaultTaskStartToCloseTimeout
}
private enum CodingKeys: String, CodingKey {
case defaultTaskHeartbeatTimeout = "defaultTaskHeartbeatTimeout"
case defaultTaskList = "defaultTaskList"
case defaultTaskPriority = "defaultTaskPriority"
case defaultTaskScheduleToCloseTimeout = "defaultTaskScheduleToCloseTimeout"
case defaultTaskScheduleToStartTimeout = "defaultTaskScheduleToStartTimeout"
case defaultTaskStartToCloseTimeout = "defaultTaskStartToCloseTimeout"
}
}
public struct ActivityTypeDetail: AWSDecodableShape {
/// The configuration settings registered with the activity type.
public let configuration: ActivityTypeConfiguration
/// General information about the activity type. The status of activity type (returned in the ActivityTypeInfo structure) can be one of the following. REGISTERED – The type is registered and available. Workers supporting this type should be running. DEPRECATED – The type was deprecated using DeprecateActivityType, but is still in use. You should keep workers supporting this type running. You cannot create new tasks of this type.
public let typeInfo: ActivityTypeInfo
public init(configuration: ActivityTypeConfiguration, typeInfo: ActivityTypeInfo) {
self.configuration = configuration
self.typeInfo = typeInfo
}
private enum CodingKeys: String, CodingKey {
case configuration = "configuration"
case typeInfo = "typeInfo"
}
}
public struct ActivityTypeInfo: AWSDecodableShape {
/// The ActivityType type structure representing the activity type.
public let activityType: ActivityType
/// The date and time this activity type was created through RegisterActivityType.
public let creationDate: TimeStamp
/// If DEPRECATED, the date and time DeprecateActivityType was called.
public let deprecationDate: TimeStamp?
/// The description of the activity type provided in RegisterActivityType.
public let description: String?
/// The current status of the activity type.
public let status: RegistrationStatus
public init(activityType: ActivityType, creationDate: TimeStamp, deprecationDate: TimeStamp? = nil, description: String? = nil, status: RegistrationStatus) {
self.activityType = activityType
self.creationDate = creationDate
self.deprecationDate = deprecationDate
self.description = description
self.status = status
}
private enum CodingKeys: String, CodingKey {
case activityType = "activityType"
case creationDate = "creationDate"
case deprecationDate = "deprecationDate"
case description = "description"
case status = "status"
}
}
public struct ActivityTypeInfos: AWSDecodableShape {
/// If a NextPageToken was returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextPageToken. Keep all other arguments unchanged. The configured maximumPageSize determines how many results can be returned in a single call.
public let nextPageToken: String?
/// List of activity type information.
public let typeInfos: [ActivityTypeInfo]
public init(nextPageToken: String? = nil, typeInfos: [ActivityTypeInfo]) {
self.nextPageToken = nextPageToken
self.typeInfos = typeInfos
}
private enum CodingKeys: String, CodingKey {
case nextPageToken = "nextPageToken"
case typeInfos = "typeInfos"
}
}
public struct CancelTimerDecisionAttributes: AWSEncodableShape {
/// The unique ID of the timer to cancel.
public let timerId: String
public init(timerId: String) {
self.timerId = timerId
}
public func validate(name: String) throws {
try validate(self.timerId, name: "timerId", parent: name, max: 256)
try validate(self.timerId, name: "timerId", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case timerId = "timerId"
}
}
public struct CancelTimerFailedEventAttributes: AWSDecodableShape {
/// The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide.
public let cause: CancelTimerFailedCause
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the CancelTimer decision to cancel this timer. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
/// The timerId provided in the CancelTimer decision that failed.
public let timerId: String
public init(cause: CancelTimerFailedCause, decisionTaskCompletedEventId: Int64, timerId: String) {
self.cause = cause
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
self.timerId = timerId
}
private enum CodingKeys: String, CodingKey {
case cause = "cause"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
case timerId = "timerId"
}
}
public struct CancelWorkflowExecutionDecisionAttributes: AWSEncodableShape {
/// Details of the cancellation.
public let details: String?
public init(details: String? = nil) {
self.details = details
}
public func validate(name: String) throws {
try validate(self.details, name: "details", parent: name, max: 32768)
}
private enum CodingKeys: String, CodingKey {
case details = "details"
}
}
public struct CancelWorkflowExecutionFailedEventAttributes: AWSDecodableShape {
/// The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide.
public let cause: CancelWorkflowExecutionFailedCause
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the CancelWorkflowExecution decision for this cancellation request. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
public init(cause: CancelWorkflowExecutionFailedCause, decisionTaskCompletedEventId: Int64) {
self.cause = cause
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
}
private enum CodingKeys: String, CodingKey {
case cause = "cause"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
}
}
public struct ChildWorkflowExecutionCanceledEventAttributes: AWSDecodableShape {
/// Details of the cancellation (if provided).
public let details: String?
/// The ID of the StartChildWorkflowExecutionInitiated event corresponding to the StartChildWorkflowExecution Decision to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let initiatedEventId: Int64
/// The ID of the ChildWorkflowExecutionStarted event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let startedEventId: Int64
/// The child workflow execution that was canceled.
public let workflowExecution: WorkflowExecution
/// The type of the child workflow execution.
public let workflowType: WorkflowType
public init(details: String? = nil, initiatedEventId: Int64, startedEventId: Int64, workflowExecution: WorkflowExecution, workflowType: WorkflowType) {
self.details = details
self.initiatedEventId = initiatedEventId
self.startedEventId = startedEventId
self.workflowExecution = workflowExecution
self.workflowType = workflowType
}
private enum CodingKeys: String, CodingKey {
case details = "details"
case initiatedEventId = "initiatedEventId"
case startedEventId = "startedEventId"
case workflowExecution = "workflowExecution"
case workflowType = "workflowType"
}
}
public struct ChildWorkflowExecutionCompletedEventAttributes: AWSDecodableShape {
/// The ID of the StartChildWorkflowExecutionInitiated event corresponding to the StartChildWorkflowExecution Decision to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let initiatedEventId: Int64
/// The result of the child workflow execution.
public let result: String?
/// The ID of the ChildWorkflowExecutionStarted event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let startedEventId: Int64
/// The child workflow execution that was completed.
public let workflowExecution: WorkflowExecution
/// The type of the child workflow execution.
public let workflowType: WorkflowType
public init(initiatedEventId: Int64, result: String? = nil, startedEventId: Int64, workflowExecution: WorkflowExecution, workflowType: WorkflowType) {
self.initiatedEventId = initiatedEventId
self.result = result
self.startedEventId = startedEventId
self.workflowExecution = workflowExecution
self.workflowType = workflowType
}
private enum CodingKeys: String, CodingKey {
case initiatedEventId = "initiatedEventId"
case result = "result"
case startedEventId = "startedEventId"
case workflowExecution = "workflowExecution"
case workflowType = "workflowType"
}
}
public struct ChildWorkflowExecutionFailedEventAttributes: AWSDecodableShape {
/// The details of the failure (if provided).
public let details: String?
/// The ID of the StartChildWorkflowExecutionInitiated event corresponding to the StartChildWorkflowExecution Decision to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let initiatedEventId: Int64
/// The reason for the failure (if provided).
public let reason: String?
/// The ID of the ChildWorkflowExecutionStarted event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let startedEventId: Int64
/// The child workflow execution that failed.
public let workflowExecution: WorkflowExecution
/// The type of the child workflow execution.
public let workflowType: WorkflowType
public init(details: String? = nil, initiatedEventId: Int64, reason: String? = nil, startedEventId: Int64, workflowExecution: WorkflowExecution, workflowType: WorkflowType) {
self.details = details
self.initiatedEventId = initiatedEventId
self.reason = reason
self.startedEventId = startedEventId
self.workflowExecution = workflowExecution
self.workflowType = workflowType
}
private enum CodingKeys: String, CodingKey {
case details = "details"
case initiatedEventId = "initiatedEventId"
case reason = "reason"
case startedEventId = "startedEventId"
case workflowExecution = "workflowExecution"
case workflowType = "workflowType"
}
}
public struct ChildWorkflowExecutionStartedEventAttributes: AWSDecodableShape {
/// The ID of the StartChildWorkflowExecutionInitiated event corresponding to the StartChildWorkflowExecution Decision to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let initiatedEventId: Int64
/// The child workflow execution that was started.
public let workflowExecution: WorkflowExecution
/// The type of the child workflow execution.
public let workflowType: WorkflowType
public init(initiatedEventId: Int64, workflowExecution: WorkflowExecution, workflowType: WorkflowType) {
self.initiatedEventId = initiatedEventId
self.workflowExecution = workflowExecution
self.workflowType = workflowType
}
private enum CodingKeys: String, CodingKey {
case initiatedEventId = "initiatedEventId"
case workflowExecution = "workflowExecution"
case workflowType = "workflowType"
}
}
public struct ChildWorkflowExecutionTerminatedEventAttributes: AWSDecodableShape {
/// The ID of the StartChildWorkflowExecutionInitiated event corresponding to the StartChildWorkflowExecution Decision to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let initiatedEventId: Int64
/// The ID of the ChildWorkflowExecutionStarted event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let startedEventId: Int64
/// The child workflow execution that was terminated.
public let workflowExecution: WorkflowExecution
/// The type of the child workflow execution.
public let workflowType: WorkflowType
public init(initiatedEventId: Int64, startedEventId: Int64, workflowExecution: WorkflowExecution, workflowType: WorkflowType) {
self.initiatedEventId = initiatedEventId
self.startedEventId = startedEventId
self.workflowExecution = workflowExecution
self.workflowType = workflowType
}
private enum CodingKeys: String, CodingKey {
case initiatedEventId = "initiatedEventId"
case startedEventId = "startedEventId"
case workflowExecution = "workflowExecution"
case workflowType = "workflowType"
}
}
public struct ChildWorkflowExecutionTimedOutEventAttributes: AWSDecodableShape {
/// The ID of the StartChildWorkflowExecutionInitiated event corresponding to the StartChildWorkflowExecution Decision to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let initiatedEventId: Int64
/// The ID of the ChildWorkflowExecutionStarted event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let startedEventId: Int64
/// The type of the timeout that caused the child workflow execution to time out.
public let timeoutType: WorkflowExecutionTimeoutType
/// The child workflow execution that timed out.
public let workflowExecution: WorkflowExecution
/// The type of the child workflow execution.
public let workflowType: WorkflowType
public init(initiatedEventId: Int64, startedEventId: Int64, timeoutType: WorkflowExecutionTimeoutType, workflowExecution: WorkflowExecution, workflowType: WorkflowType) {
self.initiatedEventId = initiatedEventId
self.startedEventId = startedEventId
self.timeoutType = timeoutType
self.workflowExecution = workflowExecution
self.workflowType = workflowType
}
private enum CodingKeys: String, CodingKey {
case initiatedEventId = "initiatedEventId"
case startedEventId = "startedEventId"
case timeoutType = "timeoutType"
case workflowExecution = "workflowExecution"
case workflowType = "workflowType"
}
}
public struct CloseStatusFilter: AWSEncodableShape {
/// The close status that must match the close status of an execution for it to meet the criteria of this filter.
public let status: CloseStatus
public init(status: CloseStatus) {
self.status = status
}
private enum CodingKeys: String, CodingKey {
case status = "status"
}
}
public struct CompleteWorkflowExecutionDecisionAttributes: AWSEncodableShape {
/// The result of the workflow execution. The form of the result is implementation defined.
public let result: String?
public init(result: String? = nil) {
self.result = result
}
public func validate(name: String) throws {
try validate(self.result, name: "result", parent: name, max: 32768)
}
private enum CodingKeys: String, CodingKey {
case result = "result"
}
}
public struct CompleteWorkflowExecutionFailedEventAttributes: AWSDecodableShape {
/// The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide.
public let cause: CompleteWorkflowExecutionFailedCause
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the CompleteWorkflowExecution decision to complete this execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
public init(cause: CompleteWorkflowExecutionFailedCause, decisionTaskCompletedEventId: Int64) {
self.cause = cause
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
}
private enum CodingKeys: String, CodingKey {
case cause = "cause"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
}
}
public struct ContinueAsNewWorkflowExecutionDecisionAttributes: AWSEncodableShape {
/// If set, specifies the policy to use for the child workflow executions of the new execution if it is terminated by calling the TerminateWorkflowExecution action explicitly or due to an expired timeout. This policy overrides the default child policy specified when registering the workflow type using RegisterWorkflowType. The supported child policies are: TERMINATE – The child executions are terminated. REQUEST_CANCEL – A request to cancel is attempted for each child execution by recording a WorkflowExecutionCancelRequested event in its history. It is up to the decider to take appropriate actions when it receives an execution history with this event. ABANDON – No action is taken. The child executions continue to run. A child policy for this workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default child policy was specified at registration time then a fault is returned.
public let childPolicy: ChildPolicy?
/// If set, specifies the total duration for this workflow execution. This overrides the defaultExecutionStartToCloseTimeout specified when registering the workflow type. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. An execution start-to-close timeout for this workflow execution must be specified either as a default for the workflow type or through this field. If neither this field is set nor a default execution start-to-close timeout was specified at registration time then a fault is returned.
public let executionStartToCloseTimeout: String?
/// The input provided to the new workflow execution.
public let input: String?
/// The IAM role to attach to the new (continued) execution.
public let lambdaRole: String?
/// The list of tags to associate with the new workflow execution. A maximum of 5 tags can be specified. You can list workflow executions with a specific tag by calling ListOpenWorkflowExecutions or ListClosedWorkflowExecutions and specifying a TagFilter.
public let tagList: [String]?
/// The task list to use for the decisions of the new (continued) workflow execution.
public let taskList: TaskList?
/// The task priority that, if set, specifies the priority for the decision tasks for this workflow execution. This overrides the defaultTaskPriority specified when registering the workflow type. Valid values are integers that range from Java's Integer.MIN_VALUE (-2147483648) to Integer.MAX_VALUE (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see Setting Task Priority in the Amazon SWF Developer Guide.
public let taskPriority: String?
/// Specifies the maximum duration of decision tasks for the new workflow execution. This parameter overrides the defaultTaskStartToCloseTimout specified when registering the workflow type using RegisterWorkflowType. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. A task start-to-close timeout for the new workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default task start-to-close timeout was specified at registration time then a fault is returned.
public let taskStartToCloseTimeout: String?
/// The version of the workflow to start.
public let workflowTypeVersion: String?
public init(childPolicy: ChildPolicy? = nil, executionStartToCloseTimeout: String? = nil, input: String? = nil, lambdaRole: String? = nil, tagList: [String]? = nil, taskList: TaskList? = nil, taskPriority: String? = nil, taskStartToCloseTimeout: String? = nil, workflowTypeVersion: String? = nil) {
self.childPolicy = childPolicy
self.executionStartToCloseTimeout = executionStartToCloseTimeout
self.input = input
self.lambdaRole = lambdaRole
self.tagList = tagList
self.taskList = taskList
self.taskPriority = taskPriority
self.taskStartToCloseTimeout = taskStartToCloseTimeout
self.workflowTypeVersion = workflowTypeVersion
}
public func validate(name: String) throws {
try validate(self.executionStartToCloseTimeout, name: "executionStartToCloseTimeout", parent: name, max: 8)
try validate(self.input, name: "input", parent: name, max: 32768)
try validate(self.lambdaRole, name: "lambdaRole", parent: name, max: 1600)
try validate(self.lambdaRole, name: "lambdaRole", parent: name, min: 1)
try self.tagList?.forEach {
try validate($0, name: "tagList[]", parent: name, max: 256)
try validate($0, name: "tagList[]", parent: name, min: 0)
}
try validate(self.tagList, name: "tagList", parent: name, max: 5)
try self.taskList?.validate(name: "\(name).taskList")
try validate(self.taskStartToCloseTimeout, name: "taskStartToCloseTimeout", parent: name, max: 8)
try validate(self.workflowTypeVersion, name: "workflowTypeVersion", parent: name, max: 64)
try validate(self.workflowTypeVersion, name: "workflowTypeVersion", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case childPolicy = "childPolicy"
case executionStartToCloseTimeout = "executionStartToCloseTimeout"
case input = "input"
case lambdaRole = "lambdaRole"
case tagList = "tagList"
case taskList = "taskList"
case taskPriority = "taskPriority"
case taskStartToCloseTimeout = "taskStartToCloseTimeout"
case workflowTypeVersion = "workflowTypeVersion"
}
}
public struct ContinueAsNewWorkflowExecutionFailedEventAttributes: AWSDecodableShape {
/// The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide.
public let cause: ContinueAsNewWorkflowExecutionFailedCause
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the ContinueAsNewWorkflowExecution decision that started this execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
public init(cause: ContinueAsNewWorkflowExecutionFailedCause, decisionTaskCompletedEventId: Int64) {
self.cause = cause
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
}
private enum CodingKeys: String, CodingKey {
case cause = "cause"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
}
}
public struct CountClosedWorkflowExecutionsInput: AWSEncodableShape {
/// If specified, only workflow executions that match this close status are counted. This filter has an affect only if executionStatus is specified as CLOSED. closeStatusFilter, executionFilter, typeFilter and tagFilter are mutually exclusive. You can specify at most one of these in a request.
public let closeStatusFilter: CloseStatusFilter?
/// If specified, only workflow executions that meet the close time criteria of the filter are counted. startTimeFilter and closeTimeFilter are mutually exclusive. You must specify one of these in a request but not both.
public let closeTimeFilter: ExecutionTimeFilter?
/// The name of the domain containing the workflow executions to count.
public let domain: String
/// If specified, only workflow executions matching the WorkflowId in the filter are counted. closeStatusFilter, executionFilter, typeFilter and tagFilter are mutually exclusive. You can specify at most one of these in a request.
public let executionFilter: WorkflowExecutionFilter?
/// If specified, only workflow executions that meet the start time criteria of the filter are counted. startTimeFilter and closeTimeFilter are mutually exclusive. You must specify one of these in a request but not both.
public let startTimeFilter: ExecutionTimeFilter?
/// If specified, only executions that have a tag that matches the filter are counted. closeStatusFilter, executionFilter, typeFilter and tagFilter are mutually exclusive. You can specify at most one of these in a request.
public let tagFilter: TagFilter?
/// If specified, indicates the type of the workflow executions to be counted. closeStatusFilter, executionFilter, typeFilter and tagFilter are mutually exclusive. You can specify at most one of these in a request.
public let typeFilter: WorkflowTypeFilter?
public init(closeStatusFilter: CloseStatusFilter? = nil, closeTimeFilter: ExecutionTimeFilter? = nil, domain: String, executionFilter: WorkflowExecutionFilter? = nil, startTimeFilter: ExecutionTimeFilter? = nil, tagFilter: TagFilter? = nil, typeFilter: WorkflowTypeFilter? = nil) {
self.closeStatusFilter = closeStatusFilter
self.closeTimeFilter = closeTimeFilter
self.domain = domain
self.executionFilter = executionFilter
self.startTimeFilter = startTimeFilter
self.tagFilter = tagFilter
self.typeFilter = typeFilter
}
public func validate(name: String) throws {
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try self.executionFilter?.validate(name: "\(name).executionFilter")
try self.tagFilter?.validate(name: "\(name).tagFilter")
try self.typeFilter?.validate(name: "\(name).typeFilter")
}
private enum CodingKeys: String, CodingKey {
case closeStatusFilter = "closeStatusFilter"
case closeTimeFilter = "closeTimeFilter"
case domain = "domain"
case executionFilter = "executionFilter"
case startTimeFilter = "startTimeFilter"
case tagFilter = "tagFilter"
case typeFilter = "typeFilter"
}
}
public struct CountOpenWorkflowExecutionsInput: AWSEncodableShape {
/// The name of the domain containing the workflow executions to count.
public let domain: String
/// If specified, only workflow executions matching the WorkflowId in the filter are counted. executionFilter, typeFilter and tagFilter are mutually exclusive. You can specify at most one of these in a request.
public let executionFilter: WorkflowExecutionFilter?
/// Specifies the start time criteria that workflow executions must meet in order to be counted.
public let startTimeFilter: ExecutionTimeFilter
/// If specified, only executions that have a tag that matches the filter are counted. executionFilter, typeFilter and tagFilter are mutually exclusive. You can specify at most one of these in a request.
public let tagFilter: TagFilter?
/// Specifies the type of the workflow executions to be counted. executionFilter, typeFilter and tagFilter are mutually exclusive. You can specify at most one of these in a request.
public let typeFilter: WorkflowTypeFilter?
public init(domain: String, executionFilter: WorkflowExecutionFilter? = nil, startTimeFilter: ExecutionTimeFilter, tagFilter: TagFilter? = nil, typeFilter: WorkflowTypeFilter? = nil) {
self.domain = domain
self.executionFilter = executionFilter
self.startTimeFilter = startTimeFilter
self.tagFilter = tagFilter
self.typeFilter = typeFilter
}
public func validate(name: String) throws {
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try self.executionFilter?.validate(name: "\(name).executionFilter")
try self.tagFilter?.validate(name: "\(name).tagFilter")
try self.typeFilter?.validate(name: "\(name).typeFilter")
}
private enum CodingKeys: String, CodingKey {
case domain = "domain"
case executionFilter = "executionFilter"
case startTimeFilter = "startTimeFilter"
case tagFilter = "tagFilter"
case typeFilter = "typeFilter"
}
}
public struct CountPendingActivityTasksInput: AWSEncodableShape {
/// The name of the domain that contains the task list.
public let domain: String
/// The name of the task list.
public let taskList: TaskList
public init(domain: String, taskList: TaskList) {
self.domain = domain
self.taskList = taskList
}
public func validate(name: String) throws {
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try self.taskList.validate(name: "\(name).taskList")
}
private enum CodingKeys: String, CodingKey {
case domain = "domain"
case taskList = "taskList"
}
}
public struct CountPendingDecisionTasksInput: AWSEncodableShape {
/// The name of the domain that contains the task list.
public let domain: String
/// The name of the task list.
public let taskList: TaskList
public init(domain: String, taskList: TaskList) {
self.domain = domain
self.taskList = taskList
}
public func validate(name: String) throws {
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try self.taskList.validate(name: "\(name).taskList")
}
private enum CodingKeys: String, CodingKey {
case domain = "domain"
case taskList = "taskList"
}
}
public struct Decision: AWSEncodableShape {
/// Provides the details of the CancelTimer decision. It isn't set for other decision types.
public let cancelTimerDecisionAttributes: CancelTimerDecisionAttributes?
/// Provides the details of the CancelWorkflowExecution decision. It isn't set for other decision types.
public let cancelWorkflowExecutionDecisionAttributes: CancelWorkflowExecutionDecisionAttributes?
/// Provides the details of the CompleteWorkflowExecution decision. It isn't set for other decision types.
public let completeWorkflowExecutionDecisionAttributes: CompleteWorkflowExecutionDecisionAttributes?
/// Provides the details of the ContinueAsNewWorkflowExecution decision. It isn't set for other decision types.
public let continueAsNewWorkflowExecutionDecisionAttributes: ContinueAsNewWorkflowExecutionDecisionAttributes?
/// Specifies the type of the decision.
public let decisionType: DecisionType
/// Provides the details of the FailWorkflowExecution decision. It isn't set for other decision types.
public let failWorkflowExecutionDecisionAttributes: FailWorkflowExecutionDecisionAttributes?
/// Provides the details of the RecordMarker decision. It isn't set for other decision types.
public let recordMarkerDecisionAttributes: RecordMarkerDecisionAttributes?
/// Provides the details of the RequestCancelActivityTask decision. It isn't set for other decision types.
public let requestCancelActivityTaskDecisionAttributes: RequestCancelActivityTaskDecisionAttributes?
/// Provides the details of the RequestCancelExternalWorkflowExecution decision. It isn't set for other decision types.
public let requestCancelExternalWorkflowExecutionDecisionAttributes: RequestCancelExternalWorkflowExecutionDecisionAttributes?
/// Provides the details of the ScheduleActivityTask decision. It isn't set for other decision types.
public let scheduleActivityTaskDecisionAttributes: ScheduleActivityTaskDecisionAttributes?
/// Provides the details of the ScheduleLambdaFunction decision. It isn't set for other decision types.
public let scheduleLambdaFunctionDecisionAttributes: ScheduleLambdaFunctionDecisionAttributes?
/// Provides the details of the SignalExternalWorkflowExecution decision. It isn't set for other decision types.
public let signalExternalWorkflowExecutionDecisionAttributes: SignalExternalWorkflowExecutionDecisionAttributes?
/// Provides the details of the StartChildWorkflowExecution decision. It isn't set for other decision types.
public let startChildWorkflowExecutionDecisionAttributes: StartChildWorkflowExecutionDecisionAttributes?
/// Provides the details of the StartTimer decision. It isn't set for other decision types.
public let startTimerDecisionAttributes: StartTimerDecisionAttributes?
public init(cancelTimerDecisionAttributes: CancelTimerDecisionAttributes? = nil, cancelWorkflowExecutionDecisionAttributes: CancelWorkflowExecutionDecisionAttributes? = nil, completeWorkflowExecutionDecisionAttributes: CompleteWorkflowExecutionDecisionAttributes? = nil, continueAsNewWorkflowExecutionDecisionAttributes: ContinueAsNewWorkflowExecutionDecisionAttributes? = nil, decisionType: DecisionType, failWorkflowExecutionDecisionAttributes: FailWorkflowExecutionDecisionAttributes? = nil, recordMarkerDecisionAttributes: RecordMarkerDecisionAttributes? = nil, requestCancelActivityTaskDecisionAttributes: RequestCancelActivityTaskDecisionAttributes? = nil, requestCancelExternalWorkflowExecutionDecisionAttributes: RequestCancelExternalWorkflowExecutionDecisionAttributes? = nil, scheduleActivityTaskDecisionAttributes: ScheduleActivityTaskDecisionAttributes? = nil, scheduleLambdaFunctionDecisionAttributes: ScheduleLambdaFunctionDecisionAttributes? = nil, signalExternalWorkflowExecutionDecisionAttributes: SignalExternalWorkflowExecutionDecisionAttributes? = nil, startChildWorkflowExecutionDecisionAttributes: StartChildWorkflowExecutionDecisionAttributes? = nil, startTimerDecisionAttributes: StartTimerDecisionAttributes? = nil) {
self.cancelTimerDecisionAttributes = cancelTimerDecisionAttributes
self.cancelWorkflowExecutionDecisionAttributes = cancelWorkflowExecutionDecisionAttributes
self.completeWorkflowExecutionDecisionAttributes = completeWorkflowExecutionDecisionAttributes
self.continueAsNewWorkflowExecutionDecisionAttributes = continueAsNewWorkflowExecutionDecisionAttributes
self.decisionType = decisionType
self.failWorkflowExecutionDecisionAttributes = failWorkflowExecutionDecisionAttributes
self.recordMarkerDecisionAttributes = recordMarkerDecisionAttributes
self.requestCancelActivityTaskDecisionAttributes = requestCancelActivityTaskDecisionAttributes
self.requestCancelExternalWorkflowExecutionDecisionAttributes = requestCancelExternalWorkflowExecutionDecisionAttributes
self.scheduleActivityTaskDecisionAttributes = scheduleActivityTaskDecisionAttributes
self.scheduleLambdaFunctionDecisionAttributes = scheduleLambdaFunctionDecisionAttributes
self.signalExternalWorkflowExecutionDecisionAttributes = signalExternalWorkflowExecutionDecisionAttributes
self.startChildWorkflowExecutionDecisionAttributes = startChildWorkflowExecutionDecisionAttributes
self.startTimerDecisionAttributes = startTimerDecisionAttributes
}
public func validate(name: String) throws {
try self.cancelTimerDecisionAttributes?.validate(name: "\(name).cancelTimerDecisionAttributes")
try self.cancelWorkflowExecutionDecisionAttributes?.validate(name: "\(name).cancelWorkflowExecutionDecisionAttributes")
try self.completeWorkflowExecutionDecisionAttributes?.validate(name: "\(name).completeWorkflowExecutionDecisionAttributes")
try self.continueAsNewWorkflowExecutionDecisionAttributes?.validate(name: "\(name).continueAsNewWorkflowExecutionDecisionAttributes")
try self.failWorkflowExecutionDecisionAttributes?.validate(name: "\(name).failWorkflowExecutionDecisionAttributes")
try self.recordMarkerDecisionAttributes?.validate(name: "\(name).recordMarkerDecisionAttributes")
try self.requestCancelActivityTaskDecisionAttributes?.validate(name: "\(name).requestCancelActivityTaskDecisionAttributes")
try self.requestCancelExternalWorkflowExecutionDecisionAttributes?.validate(name: "\(name).requestCancelExternalWorkflowExecutionDecisionAttributes")
try self.scheduleActivityTaskDecisionAttributes?.validate(name: "\(name).scheduleActivityTaskDecisionAttributes")
try self.scheduleLambdaFunctionDecisionAttributes?.validate(name: "\(name).scheduleLambdaFunctionDecisionAttributes")
try self.signalExternalWorkflowExecutionDecisionAttributes?.validate(name: "\(name).signalExternalWorkflowExecutionDecisionAttributes")
try self.startChildWorkflowExecutionDecisionAttributes?.validate(name: "\(name).startChildWorkflowExecutionDecisionAttributes")
try self.startTimerDecisionAttributes?.validate(name: "\(name).startTimerDecisionAttributes")
}
private enum CodingKeys: String, CodingKey {
case cancelTimerDecisionAttributes = "cancelTimerDecisionAttributes"
case cancelWorkflowExecutionDecisionAttributes = "cancelWorkflowExecutionDecisionAttributes"
case completeWorkflowExecutionDecisionAttributes = "completeWorkflowExecutionDecisionAttributes"
case continueAsNewWorkflowExecutionDecisionAttributes = "continueAsNewWorkflowExecutionDecisionAttributes"
case decisionType = "decisionType"
case failWorkflowExecutionDecisionAttributes = "failWorkflowExecutionDecisionAttributes"
case recordMarkerDecisionAttributes = "recordMarkerDecisionAttributes"
case requestCancelActivityTaskDecisionAttributes = "requestCancelActivityTaskDecisionAttributes"
case requestCancelExternalWorkflowExecutionDecisionAttributes = "requestCancelExternalWorkflowExecutionDecisionAttributes"
case scheduleActivityTaskDecisionAttributes = "scheduleActivityTaskDecisionAttributes"
case scheduleLambdaFunctionDecisionAttributes = "scheduleLambdaFunctionDecisionAttributes"
case signalExternalWorkflowExecutionDecisionAttributes = "signalExternalWorkflowExecutionDecisionAttributes"
case startChildWorkflowExecutionDecisionAttributes = "startChildWorkflowExecutionDecisionAttributes"
case startTimerDecisionAttributes = "startTimerDecisionAttributes"
}
}
public struct DecisionTask: AWSDecodableShape {
/// A paginated list of history events of the workflow execution. The decider uses this during the processing of the decision task.
public let events: [HistoryEvent]
/// If a NextPageToken was returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextPageToken. Keep all other arguments unchanged. The configured maximumPageSize determines how many results can be returned in a single call.
public let nextPageToken: String?
/// The ID of the DecisionTaskStarted event of the previous decision task of this workflow execution that was processed by the decider. This can be used to determine the events in the history new since the last decision task received by the decider.
public let previousStartedEventId: Int64?
/// The ID of the DecisionTaskStarted event recorded in the history.
public let startedEventId: Int64
/// The opaque string used as a handle on the task. This token is used by workers to communicate progress and response information back to the system about the task.
public let taskToken: String
/// The workflow execution for which this decision task was created.
public let workflowExecution: WorkflowExecution
/// The type of the workflow execution for which this decision task was created.
public let workflowType: WorkflowType
public init(events: [HistoryEvent], nextPageToken: String? = nil, previousStartedEventId: Int64? = nil, startedEventId: Int64, taskToken: String, workflowExecution: WorkflowExecution, workflowType: WorkflowType) {
self.events = events
self.nextPageToken = nextPageToken
self.previousStartedEventId = previousStartedEventId
self.startedEventId = startedEventId
self.taskToken = taskToken
self.workflowExecution = workflowExecution
self.workflowType = workflowType
}
private enum CodingKeys: String, CodingKey {
case events = "events"
case nextPageToken = "nextPageToken"
case previousStartedEventId = "previousStartedEventId"
case startedEventId = "startedEventId"
case taskToken = "taskToken"
case workflowExecution = "workflowExecution"
case workflowType = "workflowType"
}
}
public struct DecisionTaskCompletedEventAttributes: AWSDecodableShape {
/// User defined context for the workflow execution.
public let executionContext: String?
/// The ID of the DecisionTaskScheduled event that was recorded when this decision task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let scheduledEventId: Int64
/// The ID of the DecisionTaskStarted event recorded when this decision task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let startedEventId: Int64
public init(executionContext: String? = nil, scheduledEventId: Int64, startedEventId: Int64) {
self.executionContext = executionContext
self.scheduledEventId = scheduledEventId
self.startedEventId = startedEventId
}
private enum CodingKeys: String, CodingKey {
case executionContext = "executionContext"
case scheduledEventId = "scheduledEventId"
case startedEventId = "startedEventId"
}
}
public struct DecisionTaskScheduledEventAttributes: AWSDecodableShape {
/// The maximum duration for this decision task. The task is considered timed out if it doesn't completed within this duration. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let startToCloseTimeout: String?
/// The name of the task list in which the decision task was scheduled.
public let taskList: TaskList
/// A task priority that, if set, specifies the priority for this decision task. Valid values are integers that range from Java's Integer.MIN_VALUE (-2147483648) to Integer.MAX_VALUE (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see Setting Task Priority in the Amazon SWF Developer Guide.
public let taskPriority: String?
public init(startToCloseTimeout: String? = nil, taskList: TaskList, taskPriority: String? = nil) {
self.startToCloseTimeout = startToCloseTimeout
self.taskList = taskList
self.taskPriority = taskPriority
}
private enum CodingKeys: String, CodingKey {
case startToCloseTimeout = "startToCloseTimeout"
case taskList = "taskList"
case taskPriority = "taskPriority"
}
}
public struct DecisionTaskStartedEventAttributes: AWSDecodableShape {
/// Identity of the decider making the request. This enables diagnostic tracing when problems arise. The form of this identity is user defined.
public let identity: String?
/// The ID of the DecisionTaskScheduled event that was recorded when this decision task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let scheduledEventId: Int64
public init(identity: String? = nil, scheduledEventId: Int64) {
self.identity = identity
self.scheduledEventId = scheduledEventId
}
private enum CodingKeys: String, CodingKey {
case identity = "identity"
case scheduledEventId = "scheduledEventId"
}
}
public struct DecisionTaskTimedOutEventAttributes: AWSDecodableShape {
/// The ID of the DecisionTaskScheduled event that was recorded when this decision task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let scheduledEventId: Int64
/// The ID of the DecisionTaskStarted event recorded when this decision task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let startedEventId: Int64
/// The type of timeout that expired before the decision task could be completed.
public let timeoutType: DecisionTaskTimeoutType
public init(scheduledEventId: Int64, startedEventId: Int64, timeoutType: DecisionTaskTimeoutType) {
self.scheduledEventId = scheduledEventId
self.startedEventId = startedEventId
self.timeoutType = timeoutType
}
private enum CodingKeys: String, CodingKey {
case scheduledEventId = "scheduledEventId"
case startedEventId = "startedEventId"
case timeoutType = "timeoutType"
}
}
public struct DeprecateActivityTypeInput: AWSEncodableShape {
/// The activity type to deprecate.
public let activityType: ActivityType
/// The name of the domain in which the activity type is registered.
public let domain: String
public init(activityType: ActivityType, domain: String) {
self.activityType = activityType
self.domain = domain
}
public func validate(name: String) throws {
try self.activityType.validate(name: "\(name).activityType")
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case activityType = "activityType"
case domain = "domain"
}
}
public struct DeprecateDomainInput: AWSEncodableShape {
/// The name of the domain to deprecate.
public let name: String
public init(name: String) {
self.name = name
}
public func validate(name: String) throws {
try validate(self.name, name: "name", parent: name, max: 256)
try validate(self.name, name: "name", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case name = "name"
}
}
public struct DeprecateWorkflowTypeInput: AWSEncodableShape {
/// The name of the domain in which the workflow type is registered.
public let domain: String
/// The workflow type to deprecate.
public let workflowType: WorkflowType
public init(domain: String, workflowType: WorkflowType) {
self.domain = domain
self.workflowType = workflowType
}
public func validate(name: String) throws {
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try self.workflowType.validate(name: "\(name).workflowType")
}
private enum CodingKeys: String, CodingKey {
case domain = "domain"
case workflowType = "workflowType"
}
}
public struct DescribeActivityTypeInput: AWSEncodableShape {
/// The activity type to get information about. Activity types are identified by the name and version that were supplied when the activity was registered.
public let activityType: ActivityType
/// The name of the domain in which the activity type is registered.
public let domain: String
public init(activityType: ActivityType, domain: String) {
self.activityType = activityType
self.domain = domain
}
public func validate(name: String) throws {
try self.activityType.validate(name: "\(name).activityType")
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case activityType = "activityType"
case domain = "domain"
}
}
public struct DescribeDomainInput: AWSEncodableShape {
/// The name of the domain to describe.
public let name: String
public init(name: String) {
self.name = name
}
public func validate(name: String) throws {
try validate(self.name, name: "name", parent: name, max: 256)
try validate(self.name, name: "name", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case name = "name"
}
}
public struct DescribeWorkflowExecutionInput: AWSEncodableShape {
/// The name of the domain containing the workflow execution.
public let domain: String
/// The workflow execution to describe.
public let execution: WorkflowExecution
public init(domain: String, execution: WorkflowExecution) {
self.domain = domain
self.execution = execution
}
public func validate(name: String) throws {
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try self.execution.validate(name: "\(name).execution")
}
private enum CodingKeys: String, CodingKey {
case domain = "domain"
case execution = "execution"
}
}
public struct DescribeWorkflowTypeInput: AWSEncodableShape {
/// The name of the domain in which this workflow type is registered.
public let domain: String
/// The workflow type to describe.
public let workflowType: WorkflowType
public init(domain: String, workflowType: WorkflowType) {
self.domain = domain
self.workflowType = workflowType
}
public func validate(name: String) throws {
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try self.workflowType.validate(name: "\(name).workflowType")
}
private enum CodingKeys: String, CodingKey {
case domain = "domain"
case workflowType = "workflowType"
}
}
public struct DomainConfiguration: AWSDecodableShape {
/// The retention period for workflow executions in this domain.
public let workflowExecutionRetentionPeriodInDays: String
public init(workflowExecutionRetentionPeriodInDays: String) {
self.workflowExecutionRetentionPeriodInDays = workflowExecutionRetentionPeriodInDays
}
private enum CodingKeys: String, CodingKey {
case workflowExecutionRetentionPeriodInDays = "workflowExecutionRetentionPeriodInDays"
}
}
public struct DomainDetail: AWSDecodableShape {
/// The domain configuration. Currently, this includes only the domain's retention period.
public let configuration: DomainConfiguration
/// The basic information about a domain, such as its name, status, and description.
public let domainInfo: DomainInfo
public init(configuration: DomainConfiguration, domainInfo: DomainInfo) {
self.configuration = configuration
self.domainInfo = domainInfo
}
private enum CodingKeys: String, CodingKey {
case configuration = "configuration"
case domainInfo = "domainInfo"
}
}
public struct DomainInfo: AWSDecodableShape {
/// The ARN of the domain.
public let arn: String?
/// The description of the domain provided through RegisterDomain.
public let description: String?
/// The name of the domain. This name is unique within the account.
public let name: String
/// The status of the domain: REGISTERED – The domain is properly registered and available. You can use this domain for registering types and creating new workflow executions. DEPRECATED – The domain was deprecated using DeprecateDomain, but is still in use. You should not create new workflow executions in this domain.
public let status: RegistrationStatus
public init(arn: String? = nil, description: String? = nil, name: String, status: RegistrationStatus) {
self.arn = arn
self.description = description
self.name = name
self.status = status
}
private enum CodingKeys: String, CodingKey {
case arn = "arn"
case description = "description"
case name = "name"
case status = "status"
}
}
public struct DomainInfos: AWSDecodableShape {
/// A list of DomainInfo structures.
public let domainInfos: [DomainInfo]
/// If a NextPageToken was returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextPageToken. Keep all other arguments unchanged. The configured maximumPageSize determines how many results can be returned in a single call.
public let nextPageToken: String?
public init(domainInfos: [DomainInfo], nextPageToken: String? = nil) {
self.domainInfos = domainInfos
self.nextPageToken = nextPageToken
}
private enum CodingKeys: String, CodingKey {
case domainInfos = "domainInfos"
case nextPageToken = "nextPageToken"
}
}
public struct ExecutionTimeFilter: AWSEncodableShape {
/// Specifies the latest start or close date and time to return.
public let latestDate: TimeStamp?
/// Specifies the oldest start or close date and time to return.
public let oldestDate: TimeStamp
public init(latestDate: TimeStamp? = nil, oldestDate: TimeStamp) {
self.latestDate = latestDate
self.oldestDate = oldestDate
}
private enum CodingKeys: String, CodingKey {
case latestDate = "latestDate"
case oldestDate = "oldestDate"
}
}
public struct ExternalWorkflowExecutionCancelRequestedEventAttributes: AWSDecodableShape {
/// The ID of the RequestCancelExternalWorkflowExecutionInitiated event corresponding to the RequestCancelExternalWorkflowExecution decision to cancel this external workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let initiatedEventId: Int64
/// The external workflow execution to which the cancellation request was delivered.
public let workflowExecution: WorkflowExecution
public init(initiatedEventId: Int64, workflowExecution: WorkflowExecution) {
self.initiatedEventId = initiatedEventId
self.workflowExecution = workflowExecution
}
private enum CodingKeys: String, CodingKey {
case initiatedEventId = "initiatedEventId"
case workflowExecution = "workflowExecution"
}
}
public struct ExternalWorkflowExecutionSignaledEventAttributes: AWSDecodableShape {
/// The ID of the SignalExternalWorkflowExecutionInitiated event corresponding to the SignalExternalWorkflowExecution decision to request this signal. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let initiatedEventId: Int64
/// The external workflow execution that the signal was delivered to.
public let workflowExecution: WorkflowExecution
public init(initiatedEventId: Int64, workflowExecution: WorkflowExecution) {
self.initiatedEventId = initiatedEventId
self.workflowExecution = workflowExecution
}
private enum CodingKeys: String, CodingKey {
case initiatedEventId = "initiatedEventId"
case workflowExecution = "workflowExecution"
}
}
public struct FailWorkflowExecutionDecisionAttributes: AWSEncodableShape {
/// Details of the failure.
public let details: String?
/// A descriptive reason for the failure that may help in diagnostics.
public let reason: String?
public init(details: String? = nil, reason: String? = nil) {
self.details = details
self.reason = reason
}
public func validate(name: String) throws {
try validate(self.details, name: "details", parent: name, max: 32768)
try validate(self.reason, name: "reason", parent: name, max: 256)
}
private enum CodingKeys: String, CodingKey {
case details = "details"
case reason = "reason"
}
}
public struct FailWorkflowExecutionFailedEventAttributes: AWSDecodableShape {
/// The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide.
public let cause: FailWorkflowExecutionFailedCause
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the FailWorkflowExecution decision to fail this execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
public init(cause: FailWorkflowExecutionFailedCause, decisionTaskCompletedEventId: Int64) {
self.cause = cause
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
}
private enum CodingKeys: String, CodingKey {
case cause = "cause"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
}
}
public struct GetWorkflowExecutionHistoryInput: AWSEncodableShape {
/// The name of the domain containing the workflow execution.
public let domain: String
/// Specifies the workflow execution for which to return the history.
public let execution: WorkflowExecution
/// The maximum number of results that are returned per call. Use nextPageToken to obtain further pages of results.
public let maximumPageSize: Int?
/// If NextPageToken is returned there are more results available. The value of NextPageToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 60 seconds. Using an expired pagination token will return a 400 error: "Specified token has exceeded its maximum lifetime". The configured maximumPageSize determines how many results can be returned in a single call.
public let nextPageToken: String?
/// When set to true, returns the events in reverse order. By default the results are returned in ascending order of the eventTimeStamp of the events.
public let reverseOrder: Bool?
public init(domain: String, execution: WorkflowExecution, maximumPageSize: Int? = nil, nextPageToken: String? = nil, reverseOrder: Bool? = nil) {
self.domain = domain
self.execution = execution
self.maximumPageSize = maximumPageSize
self.nextPageToken = nextPageToken
self.reverseOrder = reverseOrder
}
public func validate(name: String) throws {
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try self.execution.validate(name: "\(name).execution")
try validate(self.maximumPageSize, name: "maximumPageSize", parent: name, max: 1000)
try validate(self.maximumPageSize, name: "maximumPageSize", parent: name, min: 0)
try validate(self.nextPageToken, name: "nextPageToken", parent: name, max: 2048)
}
private enum CodingKeys: String, CodingKey {
case domain = "domain"
case execution = "execution"
case maximumPageSize = "maximumPageSize"
case nextPageToken = "nextPageToken"
case reverseOrder = "reverseOrder"
}
}
public struct History: AWSDecodableShape {
/// The list of history events.
public let events: [HistoryEvent]
/// If a NextPageToken was returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextPageToken. Keep all other arguments unchanged. The configured maximumPageSize determines how many results can be returned in a single call.
public let nextPageToken: String?
public init(events: [HistoryEvent], nextPageToken: String? = nil) {
self.events = events
self.nextPageToken = nextPageToken
}
private enum CodingKeys: String, CodingKey {
case events = "events"
case nextPageToken = "nextPageToken"
}
}
public struct HistoryEvent: AWSDecodableShape {
/// If the event is of type ActivityTaskCanceled then this member is set and provides detailed information about the event. It isn't set for other event types.
public let activityTaskCanceledEventAttributes: ActivityTaskCanceledEventAttributes?
/// If the event is of type ActivityTaskcancelRequested then this member is set and provides detailed information about the event. It isn't set for other event types.
public let activityTaskCancelRequestedEventAttributes: ActivityTaskCancelRequestedEventAttributes?
/// If the event is of type ActivityTaskCompleted then this member is set and provides detailed information about the event. It isn't set for other event types.
public let activityTaskCompletedEventAttributes: ActivityTaskCompletedEventAttributes?
/// If the event is of type ActivityTaskFailed then this member is set and provides detailed information about the event. It isn't set for other event types.
public let activityTaskFailedEventAttributes: ActivityTaskFailedEventAttributes?
/// If the event is of type ActivityTaskScheduled then this member is set and provides detailed information about the event. It isn't set for other event types.
public let activityTaskScheduledEventAttributes: ActivityTaskScheduledEventAttributes?
/// If the event is of type ActivityTaskStarted then this member is set and provides detailed information about the event. It isn't set for other event types.
public let activityTaskStartedEventAttributes: ActivityTaskStartedEventAttributes?
/// If the event is of type ActivityTaskTimedOut then this member is set and provides detailed information about the event. It isn't set for other event types.
public let activityTaskTimedOutEventAttributes: ActivityTaskTimedOutEventAttributes?
/// If the event is of type CancelTimerFailed then this member is set and provides detailed information about the event. It isn't set for other event types.
public let cancelTimerFailedEventAttributes: CancelTimerFailedEventAttributes?
/// If the event is of type CancelWorkflowExecutionFailed then this member is set and provides detailed information about the event. It isn't set for other event types.
public let cancelWorkflowExecutionFailedEventAttributes: CancelWorkflowExecutionFailedEventAttributes?
/// If the event is of type ChildWorkflowExecutionCanceled then this member is set and provides detailed information about the event. It isn't set for other event types.
public let childWorkflowExecutionCanceledEventAttributes: ChildWorkflowExecutionCanceledEventAttributes?
/// If the event is of type ChildWorkflowExecutionCompleted then this member is set and provides detailed information about the event. It isn't set for other event types.
public let childWorkflowExecutionCompletedEventAttributes: ChildWorkflowExecutionCompletedEventAttributes?
/// If the event is of type ChildWorkflowExecutionFailed then this member is set and provides detailed information about the event. It isn't set for other event types.
public let childWorkflowExecutionFailedEventAttributes: ChildWorkflowExecutionFailedEventAttributes?
/// If the event is of type ChildWorkflowExecutionStarted then this member is set and provides detailed information about the event. It isn't set for other event types.
public let childWorkflowExecutionStartedEventAttributes: ChildWorkflowExecutionStartedEventAttributes?
/// If the event is of type ChildWorkflowExecutionTerminated then this member is set and provides detailed information about the event. It isn't set for other event types.
public let childWorkflowExecutionTerminatedEventAttributes: ChildWorkflowExecutionTerminatedEventAttributes?
/// If the event is of type ChildWorkflowExecutionTimedOut then this member is set and provides detailed information about the event. It isn't set for other event types.
public let childWorkflowExecutionTimedOutEventAttributes: ChildWorkflowExecutionTimedOutEventAttributes?
/// If the event is of type CompleteWorkflowExecutionFailed then this member is set and provides detailed information about the event. It isn't set for other event types.
public let completeWorkflowExecutionFailedEventAttributes: CompleteWorkflowExecutionFailedEventAttributes?
/// If the event is of type ContinueAsNewWorkflowExecutionFailed then this member is set and provides detailed information about the event. It isn't set for other event types.
public let continueAsNewWorkflowExecutionFailedEventAttributes: ContinueAsNewWorkflowExecutionFailedEventAttributes?
/// If the event is of type DecisionTaskCompleted then this member is set and provides detailed information about the event. It isn't set for other event types.
public let decisionTaskCompletedEventAttributes: DecisionTaskCompletedEventAttributes?
/// If the event is of type DecisionTaskScheduled then this member is set and provides detailed information about the event. It isn't set for other event types.
public let decisionTaskScheduledEventAttributes: DecisionTaskScheduledEventAttributes?
/// If the event is of type DecisionTaskStarted then this member is set and provides detailed information about the event. It isn't set for other event types.
public let decisionTaskStartedEventAttributes: DecisionTaskStartedEventAttributes?
/// If the event is of type DecisionTaskTimedOut then this member is set and provides detailed information about the event. It isn't set for other event types.
public let decisionTaskTimedOutEventAttributes: DecisionTaskTimedOutEventAttributes?
/// The system generated ID of the event. This ID uniquely identifies the event with in the workflow execution history.
public let eventId: Int64
/// The date and time when the event occurred.
public let eventTimestamp: TimeStamp
/// The type of the history event.
public let eventType: EventType
/// If the event is of type ExternalWorkflowExecutionCancelRequested then this member is set and provides detailed information about the event. It isn't set for other event types.
public let externalWorkflowExecutionCancelRequestedEventAttributes: ExternalWorkflowExecutionCancelRequestedEventAttributes?
/// If the event is of type ExternalWorkflowExecutionSignaled then this member is set and provides detailed information about the event. It isn't set for other event types.
public let externalWorkflowExecutionSignaledEventAttributes: ExternalWorkflowExecutionSignaledEventAttributes?
/// If the event is of type FailWorkflowExecutionFailed then this member is set and provides detailed information about the event. It isn't set for other event types.
public let failWorkflowExecutionFailedEventAttributes: FailWorkflowExecutionFailedEventAttributes?
/// Provides the details of the LambdaFunctionCompleted event. It isn't set for other event types.
public let lambdaFunctionCompletedEventAttributes: LambdaFunctionCompletedEventAttributes?
/// Provides the details of the LambdaFunctionFailed event. It isn't set for other event types.
public let lambdaFunctionFailedEventAttributes: LambdaFunctionFailedEventAttributes?
/// Provides the details of the LambdaFunctionScheduled event. It isn't set for other event types.
public let lambdaFunctionScheduledEventAttributes: LambdaFunctionScheduledEventAttributes?
/// Provides the details of the LambdaFunctionStarted event. It isn't set for other event types.
public let lambdaFunctionStartedEventAttributes: LambdaFunctionStartedEventAttributes?
/// Provides the details of the LambdaFunctionTimedOut event. It isn't set for other event types.
public let lambdaFunctionTimedOutEventAttributes: LambdaFunctionTimedOutEventAttributes?
/// If the event is of type MarkerRecorded then this member is set and provides detailed information about the event. It isn't set for other event types.
public let markerRecordedEventAttributes: MarkerRecordedEventAttributes?
/// If the event is of type DecisionTaskFailed then this member is set and provides detailed information about the event. It isn't set for other event types.
public let recordMarkerFailedEventAttributes: RecordMarkerFailedEventAttributes?
/// If the event is of type RequestCancelActivityTaskFailed then this member is set and provides detailed information about the event. It isn't set for other event types.
public let requestCancelActivityTaskFailedEventAttributes: RequestCancelActivityTaskFailedEventAttributes?
/// If the event is of type RequestCancelExternalWorkflowExecutionFailed then this member is set and provides detailed information about the event. It isn't set for other event types.
public let requestCancelExternalWorkflowExecutionFailedEventAttributes: RequestCancelExternalWorkflowExecutionFailedEventAttributes?
/// If the event is of type RequestCancelExternalWorkflowExecutionInitiated then this member is set and provides detailed information about the event. It isn't set for other event types.
public let requestCancelExternalWorkflowExecutionInitiatedEventAttributes: RequestCancelExternalWorkflowExecutionInitiatedEventAttributes?
/// If the event is of type ScheduleActivityTaskFailed then this member is set and provides detailed information about the event. It isn't set for other event types.
public let scheduleActivityTaskFailedEventAttributes: ScheduleActivityTaskFailedEventAttributes?
/// Provides the details of the ScheduleLambdaFunctionFailed event. It isn't set for other event types.
public let scheduleLambdaFunctionFailedEventAttributes: ScheduleLambdaFunctionFailedEventAttributes?
/// If the event is of type SignalExternalWorkflowExecutionFailed then this member is set and provides detailed information about the event. It isn't set for other event types.
public let signalExternalWorkflowExecutionFailedEventAttributes: SignalExternalWorkflowExecutionFailedEventAttributes?
/// If the event is of type SignalExternalWorkflowExecutionInitiated then this member is set and provides detailed information about the event. It isn't set for other event types.
public let signalExternalWorkflowExecutionInitiatedEventAttributes: SignalExternalWorkflowExecutionInitiatedEventAttributes?
/// If the event is of type StartChildWorkflowExecutionFailed then this member is set and provides detailed information about the event. It isn't set for other event types.
public let startChildWorkflowExecutionFailedEventAttributes: StartChildWorkflowExecutionFailedEventAttributes?
/// If the event is of type StartChildWorkflowExecutionInitiated then this member is set and provides detailed information about the event. It isn't set for other event types.
public let startChildWorkflowExecutionInitiatedEventAttributes: StartChildWorkflowExecutionInitiatedEventAttributes?
/// Provides the details of the StartLambdaFunctionFailed event. It isn't set for other event types.
public let startLambdaFunctionFailedEventAttributes: StartLambdaFunctionFailedEventAttributes?
/// If the event is of type StartTimerFailed then this member is set and provides detailed information about the event. It isn't set for other event types.
public let startTimerFailedEventAttributes: StartTimerFailedEventAttributes?
/// If the event is of type TimerCanceled then this member is set and provides detailed information about the event. It isn't set for other event types.
public let timerCanceledEventAttributes: TimerCanceledEventAttributes?
/// If the event is of type TimerFired then this member is set and provides detailed information about the event. It isn't set for other event types.
public let timerFiredEventAttributes: TimerFiredEventAttributes?
/// If the event is of type TimerStarted then this member is set and provides detailed information about the event. It isn't set for other event types.
public let timerStartedEventAttributes: TimerStartedEventAttributes?
/// If the event is of type WorkflowExecutionCanceled then this member is set and provides detailed information about the event. It isn't set for other event types.
public let workflowExecutionCanceledEventAttributes: WorkflowExecutionCanceledEventAttributes?
/// If the event is of type WorkflowExecutionCancelRequested then this member is set and provides detailed information about the event. It isn't set for other event types.
public let workflowExecutionCancelRequestedEventAttributes: WorkflowExecutionCancelRequestedEventAttributes?
/// If the event is of type WorkflowExecutionCompleted then this member is set and provides detailed information about the event. It isn't set for other event types.
public let workflowExecutionCompletedEventAttributes: WorkflowExecutionCompletedEventAttributes?
/// If the event is of type WorkflowExecutionContinuedAsNew then this member is set and provides detailed information about the event. It isn't set for other event types.
public let workflowExecutionContinuedAsNewEventAttributes: WorkflowExecutionContinuedAsNewEventAttributes?
/// If the event is of type WorkflowExecutionFailed then this member is set and provides detailed information about the event. It isn't set for other event types.
public let workflowExecutionFailedEventAttributes: WorkflowExecutionFailedEventAttributes?
/// If the event is of type WorkflowExecutionSignaled then this member is set and provides detailed information about the event. It isn't set for other event types.
public let workflowExecutionSignaledEventAttributes: WorkflowExecutionSignaledEventAttributes?
/// If the event is of type WorkflowExecutionStarted then this member is set and provides detailed information about the event. It isn't set for other event types.
public let workflowExecutionStartedEventAttributes: WorkflowExecutionStartedEventAttributes?
/// If the event is of type WorkflowExecutionTerminated then this member is set and provides detailed information about the event. It isn't set for other event types.
public let workflowExecutionTerminatedEventAttributes: WorkflowExecutionTerminatedEventAttributes?
/// If the event is of type WorkflowExecutionTimedOut then this member is set and provides detailed information about the event. It isn't set for other event types.
public let workflowExecutionTimedOutEventAttributes: WorkflowExecutionTimedOutEventAttributes?
public init(activityTaskCanceledEventAttributes: ActivityTaskCanceledEventAttributes? = nil, activityTaskCancelRequestedEventAttributes: ActivityTaskCancelRequestedEventAttributes? = nil, activityTaskCompletedEventAttributes: ActivityTaskCompletedEventAttributes? = nil, activityTaskFailedEventAttributes: ActivityTaskFailedEventAttributes? = nil, activityTaskScheduledEventAttributes: ActivityTaskScheduledEventAttributes? = nil, activityTaskStartedEventAttributes: ActivityTaskStartedEventAttributes? = nil, activityTaskTimedOutEventAttributes: ActivityTaskTimedOutEventAttributes? = nil, cancelTimerFailedEventAttributes: CancelTimerFailedEventAttributes? = nil, cancelWorkflowExecutionFailedEventAttributes: CancelWorkflowExecutionFailedEventAttributes? = nil, childWorkflowExecutionCanceledEventAttributes: ChildWorkflowExecutionCanceledEventAttributes? = nil, childWorkflowExecutionCompletedEventAttributes: ChildWorkflowExecutionCompletedEventAttributes? = nil, childWorkflowExecutionFailedEventAttributes: ChildWorkflowExecutionFailedEventAttributes? = nil, childWorkflowExecutionStartedEventAttributes: ChildWorkflowExecutionStartedEventAttributes? = nil, childWorkflowExecutionTerminatedEventAttributes: ChildWorkflowExecutionTerminatedEventAttributes? = nil, childWorkflowExecutionTimedOutEventAttributes: ChildWorkflowExecutionTimedOutEventAttributes? = nil, completeWorkflowExecutionFailedEventAttributes: CompleteWorkflowExecutionFailedEventAttributes? = nil, continueAsNewWorkflowExecutionFailedEventAttributes: ContinueAsNewWorkflowExecutionFailedEventAttributes? = nil, decisionTaskCompletedEventAttributes: DecisionTaskCompletedEventAttributes? = nil, decisionTaskScheduledEventAttributes: DecisionTaskScheduledEventAttributes? = nil, decisionTaskStartedEventAttributes: DecisionTaskStartedEventAttributes? = nil, decisionTaskTimedOutEventAttributes: DecisionTaskTimedOutEventAttributes? = nil, eventId: Int64, eventTimestamp: TimeStamp, eventType: EventType, externalWorkflowExecutionCancelRequestedEventAttributes: ExternalWorkflowExecutionCancelRequestedEventAttributes? = nil, externalWorkflowExecutionSignaledEventAttributes: ExternalWorkflowExecutionSignaledEventAttributes? = nil, failWorkflowExecutionFailedEventAttributes: FailWorkflowExecutionFailedEventAttributes? = nil, lambdaFunctionCompletedEventAttributes: LambdaFunctionCompletedEventAttributes? = nil, lambdaFunctionFailedEventAttributes: LambdaFunctionFailedEventAttributes? = nil, lambdaFunctionScheduledEventAttributes: LambdaFunctionScheduledEventAttributes? = nil, lambdaFunctionStartedEventAttributes: LambdaFunctionStartedEventAttributes? = nil, lambdaFunctionTimedOutEventAttributes: LambdaFunctionTimedOutEventAttributes? = nil, markerRecordedEventAttributes: MarkerRecordedEventAttributes? = nil, recordMarkerFailedEventAttributes: RecordMarkerFailedEventAttributes? = nil, requestCancelActivityTaskFailedEventAttributes: RequestCancelActivityTaskFailedEventAttributes? = nil, requestCancelExternalWorkflowExecutionFailedEventAttributes: RequestCancelExternalWorkflowExecutionFailedEventAttributes? = nil, requestCancelExternalWorkflowExecutionInitiatedEventAttributes: RequestCancelExternalWorkflowExecutionInitiatedEventAttributes? = nil, scheduleActivityTaskFailedEventAttributes: ScheduleActivityTaskFailedEventAttributes? = nil, scheduleLambdaFunctionFailedEventAttributes: ScheduleLambdaFunctionFailedEventAttributes? = nil, signalExternalWorkflowExecutionFailedEventAttributes: SignalExternalWorkflowExecutionFailedEventAttributes? = nil, signalExternalWorkflowExecutionInitiatedEventAttributes: SignalExternalWorkflowExecutionInitiatedEventAttributes? = nil, startChildWorkflowExecutionFailedEventAttributes: StartChildWorkflowExecutionFailedEventAttributes? = nil, startChildWorkflowExecutionInitiatedEventAttributes: StartChildWorkflowExecutionInitiatedEventAttributes? = nil, startLambdaFunctionFailedEventAttributes: StartLambdaFunctionFailedEventAttributes? = nil, startTimerFailedEventAttributes: StartTimerFailedEventAttributes? = nil, timerCanceledEventAttributes: TimerCanceledEventAttributes? = nil, timerFiredEventAttributes: TimerFiredEventAttributes? = nil, timerStartedEventAttributes: TimerStartedEventAttributes? = nil, workflowExecutionCanceledEventAttributes: WorkflowExecutionCanceledEventAttributes? = nil, workflowExecutionCancelRequestedEventAttributes: WorkflowExecutionCancelRequestedEventAttributes? = nil, workflowExecutionCompletedEventAttributes: WorkflowExecutionCompletedEventAttributes? = nil, workflowExecutionContinuedAsNewEventAttributes: WorkflowExecutionContinuedAsNewEventAttributes? = nil, workflowExecutionFailedEventAttributes: WorkflowExecutionFailedEventAttributes? = nil, workflowExecutionSignaledEventAttributes: WorkflowExecutionSignaledEventAttributes? = nil, workflowExecutionStartedEventAttributes: WorkflowExecutionStartedEventAttributes? = nil, workflowExecutionTerminatedEventAttributes: WorkflowExecutionTerminatedEventAttributes? = nil, workflowExecutionTimedOutEventAttributes: WorkflowExecutionTimedOutEventAttributes? = nil) {
self.activityTaskCanceledEventAttributes = activityTaskCanceledEventAttributes
self.activityTaskCancelRequestedEventAttributes = activityTaskCancelRequestedEventAttributes
self.activityTaskCompletedEventAttributes = activityTaskCompletedEventAttributes
self.activityTaskFailedEventAttributes = activityTaskFailedEventAttributes
self.activityTaskScheduledEventAttributes = activityTaskScheduledEventAttributes
self.activityTaskStartedEventAttributes = activityTaskStartedEventAttributes
self.activityTaskTimedOutEventAttributes = activityTaskTimedOutEventAttributes
self.cancelTimerFailedEventAttributes = cancelTimerFailedEventAttributes
self.cancelWorkflowExecutionFailedEventAttributes = cancelWorkflowExecutionFailedEventAttributes
self.childWorkflowExecutionCanceledEventAttributes = childWorkflowExecutionCanceledEventAttributes
self.childWorkflowExecutionCompletedEventAttributes = childWorkflowExecutionCompletedEventAttributes
self.childWorkflowExecutionFailedEventAttributes = childWorkflowExecutionFailedEventAttributes
self.childWorkflowExecutionStartedEventAttributes = childWorkflowExecutionStartedEventAttributes
self.childWorkflowExecutionTerminatedEventAttributes = childWorkflowExecutionTerminatedEventAttributes
self.childWorkflowExecutionTimedOutEventAttributes = childWorkflowExecutionTimedOutEventAttributes
self.completeWorkflowExecutionFailedEventAttributes = completeWorkflowExecutionFailedEventAttributes
self.continueAsNewWorkflowExecutionFailedEventAttributes = continueAsNewWorkflowExecutionFailedEventAttributes
self.decisionTaskCompletedEventAttributes = decisionTaskCompletedEventAttributes
self.decisionTaskScheduledEventAttributes = decisionTaskScheduledEventAttributes
self.decisionTaskStartedEventAttributes = decisionTaskStartedEventAttributes
self.decisionTaskTimedOutEventAttributes = decisionTaskTimedOutEventAttributes
self.eventId = eventId
self.eventTimestamp = eventTimestamp
self.eventType = eventType
self.externalWorkflowExecutionCancelRequestedEventAttributes = externalWorkflowExecutionCancelRequestedEventAttributes
self.externalWorkflowExecutionSignaledEventAttributes = externalWorkflowExecutionSignaledEventAttributes
self.failWorkflowExecutionFailedEventAttributes = failWorkflowExecutionFailedEventAttributes
self.lambdaFunctionCompletedEventAttributes = lambdaFunctionCompletedEventAttributes
self.lambdaFunctionFailedEventAttributes = lambdaFunctionFailedEventAttributes
self.lambdaFunctionScheduledEventAttributes = lambdaFunctionScheduledEventAttributes
self.lambdaFunctionStartedEventAttributes = lambdaFunctionStartedEventAttributes
self.lambdaFunctionTimedOutEventAttributes = lambdaFunctionTimedOutEventAttributes
self.markerRecordedEventAttributes = markerRecordedEventAttributes
self.recordMarkerFailedEventAttributes = recordMarkerFailedEventAttributes
self.requestCancelActivityTaskFailedEventAttributes = requestCancelActivityTaskFailedEventAttributes
self.requestCancelExternalWorkflowExecutionFailedEventAttributes = requestCancelExternalWorkflowExecutionFailedEventAttributes
self.requestCancelExternalWorkflowExecutionInitiatedEventAttributes = requestCancelExternalWorkflowExecutionInitiatedEventAttributes
self.scheduleActivityTaskFailedEventAttributes = scheduleActivityTaskFailedEventAttributes
self.scheduleLambdaFunctionFailedEventAttributes = scheduleLambdaFunctionFailedEventAttributes
self.signalExternalWorkflowExecutionFailedEventAttributes = signalExternalWorkflowExecutionFailedEventAttributes
self.signalExternalWorkflowExecutionInitiatedEventAttributes = signalExternalWorkflowExecutionInitiatedEventAttributes
self.startChildWorkflowExecutionFailedEventAttributes = startChildWorkflowExecutionFailedEventAttributes
self.startChildWorkflowExecutionInitiatedEventAttributes = startChildWorkflowExecutionInitiatedEventAttributes
self.startLambdaFunctionFailedEventAttributes = startLambdaFunctionFailedEventAttributes
self.startTimerFailedEventAttributes = startTimerFailedEventAttributes
self.timerCanceledEventAttributes = timerCanceledEventAttributes
self.timerFiredEventAttributes = timerFiredEventAttributes
self.timerStartedEventAttributes = timerStartedEventAttributes
self.workflowExecutionCanceledEventAttributes = workflowExecutionCanceledEventAttributes
self.workflowExecutionCancelRequestedEventAttributes = workflowExecutionCancelRequestedEventAttributes
self.workflowExecutionCompletedEventAttributes = workflowExecutionCompletedEventAttributes
self.workflowExecutionContinuedAsNewEventAttributes = workflowExecutionContinuedAsNewEventAttributes
self.workflowExecutionFailedEventAttributes = workflowExecutionFailedEventAttributes
self.workflowExecutionSignaledEventAttributes = workflowExecutionSignaledEventAttributes
self.workflowExecutionStartedEventAttributes = workflowExecutionStartedEventAttributes
self.workflowExecutionTerminatedEventAttributes = workflowExecutionTerminatedEventAttributes
self.workflowExecutionTimedOutEventAttributes = workflowExecutionTimedOutEventAttributes
}
private enum CodingKeys: String, CodingKey {
case activityTaskCanceledEventAttributes = "activityTaskCanceledEventAttributes"
case activityTaskCancelRequestedEventAttributes = "activityTaskCancelRequestedEventAttributes"
case activityTaskCompletedEventAttributes = "activityTaskCompletedEventAttributes"
case activityTaskFailedEventAttributes = "activityTaskFailedEventAttributes"
case activityTaskScheduledEventAttributes = "activityTaskScheduledEventAttributes"
case activityTaskStartedEventAttributes = "activityTaskStartedEventAttributes"
case activityTaskTimedOutEventAttributes = "activityTaskTimedOutEventAttributes"
case cancelTimerFailedEventAttributes = "cancelTimerFailedEventAttributes"
case cancelWorkflowExecutionFailedEventAttributes = "cancelWorkflowExecutionFailedEventAttributes"
case childWorkflowExecutionCanceledEventAttributes = "childWorkflowExecutionCanceledEventAttributes"
case childWorkflowExecutionCompletedEventAttributes = "childWorkflowExecutionCompletedEventAttributes"
case childWorkflowExecutionFailedEventAttributes = "childWorkflowExecutionFailedEventAttributes"
case childWorkflowExecutionStartedEventAttributes = "childWorkflowExecutionStartedEventAttributes"
case childWorkflowExecutionTerminatedEventAttributes = "childWorkflowExecutionTerminatedEventAttributes"
case childWorkflowExecutionTimedOutEventAttributes = "childWorkflowExecutionTimedOutEventAttributes"
case completeWorkflowExecutionFailedEventAttributes = "completeWorkflowExecutionFailedEventAttributes"
case continueAsNewWorkflowExecutionFailedEventAttributes = "continueAsNewWorkflowExecutionFailedEventAttributes"
case decisionTaskCompletedEventAttributes = "decisionTaskCompletedEventAttributes"
case decisionTaskScheduledEventAttributes = "decisionTaskScheduledEventAttributes"
case decisionTaskStartedEventAttributes = "decisionTaskStartedEventAttributes"
case decisionTaskTimedOutEventAttributes = "decisionTaskTimedOutEventAttributes"
case eventId = "eventId"
case eventTimestamp = "eventTimestamp"
case eventType = "eventType"
case externalWorkflowExecutionCancelRequestedEventAttributes = "externalWorkflowExecutionCancelRequestedEventAttributes"
case externalWorkflowExecutionSignaledEventAttributes = "externalWorkflowExecutionSignaledEventAttributes"
case failWorkflowExecutionFailedEventAttributes = "failWorkflowExecutionFailedEventAttributes"
case lambdaFunctionCompletedEventAttributes = "lambdaFunctionCompletedEventAttributes"
case lambdaFunctionFailedEventAttributes = "lambdaFunctionFailedEventAttributes"
case lambdaFunctionScheduledEventAttributes = "lambdaFunctionScheduledEventAttributes"
case lambdaFunctionStartedEventAttributes = "lambdaFunctionStartedEventAttributes"
case lambdaFunctionTimedOutEventAttributes = "lambdaFunctionTimedOutEventAttributes"
case markerRecordedEventAttributes = "markerRecordedEventAttributes"
case recordMarkerFailedEventAttributes = "recordMarkerFailedEventAttributes"
case requestCancelActivityTaskFailedEventAttributes = "requestCancelActivityTaskFailedEventAttributes"
case requestCancelExternalWorkflowExecutionFailedEventAttributes = "requestCancelExternalWorkflowExecutionFailedEventAttributes"
case requestCancelExternalWorkflowExecutionInitiatedEventAttributes = "requestCancelExternalWorkflowExecutionInitiatedEventAttributes"
case scheduleActivityTaskFailedEventAttributes = "scheduleActivityTaskFailedEventAttributes"
case scheduleLambdaFunctionFailedEventAttributes = "scheduleLambdaFunctionFailedEventAttributes"
case signalExternalWorkflowExecutionFailedEventAttributes = "signalExternalWorkflowExecutionFailedEventAttributes"
case signalExternalWorkflowExecutionInitiatedEventAttributes = "signalExternalWorkflowExecutionInitiatedEventAttributes"
case startChildWorkflowExecutionFailedEventAttributes = "startChildWorkflowExecutionFailedEventAttributes"
case startChildWorkflowExecutionInitiatedEventAttributes = "startChildWorkflowExecutionInitiatedEventAttributes"
case startLambdaFunctionFailedEventAttributes = "startLambdaFunctionFailedEventAttributes"
case startTimerFailedEventAttributes = "startTimerFailedEventAttributes"
case timerCanceledEventAttributes = "timerCanceledEventAttributes"
case timerFiredEventAttributes = "timerFiredEventAttributes"
case timerStartedEventAttributes = "timerStartedEventAttributes"
case workflowExecutionCanceledEventAttributes = "workflowExecutionCanceledEventAttributes"
case workflowExecutionCancelRequestedEventAttributes = "workflowExecutionCancelRequestedEventAttributes"
case workflowExecutionCompletedEventAttributes = "workflowExecutionCompletedEventAttributes"
case workflowExecutionContinuedAsNewEventAttributes = "workflowExecutionContinuedAsNewEventAttributes"
case workflowExecutionFailedEventAttributes = "workflowExecutionFailedEventAttributes"
case workflowExecutionSignaledEventAttributes = "workflowExecutionSignaledEventAttributes"
case workflowExecutionStartedEventAttributes = "workflowExecutionStartedEventAttributes"
case workflowExecutionTerminatedEventAttributes = "workflowExecutionTerminatedEventAttributes"
case workflowExecutionTimedOutEventAttributes = "workflowExecutionTimedOutEventAttributes"
}
}
public struct LambdaFunctionCompletedEventAttributes: AWSDecodableShape {
/// The results of the Lambda task.
public let result: String?
/// The ID of the LambdaFunctionScheduled event that was recorded when this Lambda task was scheduled. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
public let scheduledEventId: Int64
/// The ID of the LambdaFunctionStarted event recorded when this activity task started. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
public let startedEventId: Int64
public init(result: String? = nil, scheduledEventId: Int64, startedEventId: Int64) {
self.result = result
self.scheduledEventId = scheduledEventId
self.startedEventId = startedEventId
}
private enum CodingKeys: String, CodingKey {
case result = "result"
case scheduledEventId = "scheduledEventId"
case startedEventId = "startedEventId"
}
}
public struct LambdaFunctionFailedEventAttributes: AWSDecodableShape {
/// The details of the failure.
public let details: String?
/// The reason provided for the failure.
public let reason: String?
/// The ID of the LambdaFunctionScheduled event that was recorded when this activity task was scheduled. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
public let scheduledEventId: Int64
/// The ID of the LambdaFunctionStarted event recorded when this activity task started. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
public let startedEventId: Int64
public init(details: String? = nil, reason: String? = nil, scheduledEventId: Int64, startedEventId: Int64) {
self.details = details
self.reason = reason
self.scheduledEventId = scheduledEventId
self.startedEventId = startedEventId
}
private enum CodingKeys: String, CodingKey {
case details = "details"
case reason = "reason"
case scheduledEventId = "scheduledEventId"
case startedEventId = "startedEventId"
}
}
public struct LambdaFunctionScheduledEventAttributes: AWSDecodableShape {
/// Data attached to the event that the decider can use in subsequent workflow tasks. This data isn't sent to the Lambda task.
public let control: String?
/// The ID of the LambdaFunctionCompleted event corresponding to the decision that resulted in scheduling this activity task. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
/// The unique ID of the Lambda task.
public let id: String
/// The input provided to the Lambda task.
public let input: String?
/// The name of the Lambda function.
public let name: String
/// The maximum amount of time a worker can take to process the Lambda task.
public let startToCloseTimeout: String?
public init(control: String? = nil, decisionTaskCompletedEventId: Int64, id: String, input: String? = nil, name: String, startToCloseTimeout: String? = nil) {
self.control = control
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
self.id = id
self.input = input
self.name = name
self.startToCloseTimeout = startToCloseTimeout
}
private enum CodingKeys: String, CodingKey {
case control = "control"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
case id = "id"
case input = "input"
case name = "name"
case startToCloseTimeout = "startToCloseTimeout"
}
}
public struct LambdaFunctionStartedEventAttributes: AWSDecodableShape {
/// The ID of the LambdaFunctionScheduled event that was recorded when this activity task was scheduled. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
public let scheduledEventId: Int64
public init(scheduledEventId: Int64) {
self.scheduledEventId = scheduledEventId
}
private enum CodingKeys: String, CodingKey {
case scheduledEventId = "scheduledEventId"
}
}
public struct LambdaFunctionTimedOutEventAttributes: AWSDecodableShape {
/// The ID of the LambdaFunctionScheduled event that was recorded when this activity task was scheduled. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
public let scheduledEventId: Int64
/// The ID of the ActivityTaskStarted event that was recorded when this activity task started. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
public let startedEventId: Int64
/// The type of the timeout that caused this event.
public let timeoutType: LambdaFunctionTimeoutType?
public init(scheduledEventId: Int64, startedEventId: Int64, timeoutType: LambdaFunctionTimeoutType? = nil) {
self.scheduledEventId = scheduledEventId
self.startedEventId = startedEventId
self.timeoutType = timeoutType
}
private enum CodingKeys: String, CodingKey {
case scheduledEventId = "scheduledEventId"
case startedEventId = "startedEventId"
case timeoutType = "timeoutType"
}
}
public struct ListActivityTypesInput: AWSEncodableShape {
/// The name of the domain in which the activity types have been registered.
public let domain: String
/// The maximum number of results that are returned per call. Use nextPageToken to obtain further pages of results.
public let maximumPageSize: Int?
/// If specified, only lists the activity types that have this name.
public let name: String?
/// If NextPageToken is returned there are more results available. The value of NextPageToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 60 seconds. Using an expired pagination token will return a 400 error: "Specified token has exceeded its maximum lifetime". The configured maximumPageSize determines how many results can be returned in a single call.
public let nextPageToken: String?
/// Specifies the registration status of the activity types to list.
public let registrationStatus: RegistrationStatus
/// When set to true, returns the results in reverse order. By default, the results are returned in ascending alphabetical order by name of the activity types.
public let reverseOrder: Bool?
public init(domain: String, maximumPageSize: Int? = nil, name: String? = nil, nextPageToken: String? = nil, registrationStatus: RegistrationStatus, reverseOrder: Bool? = nil) {
self.domain = domain
self.maximumPageSize = maximumPageSize
self.name = name
self.nextPageToken = nextPageToken
self.registrationStatus = registrationStatus
self.reverseOrder = reverseOrder
}
public func validate(name: String) throws {
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try validate(self.maximumPageSize, name: "maximumPageSize", parent: name, max: 1000)
try validate(self.maximumPageSize, name: "maximumPageSize", parent: name, min: 0)
try validate(self.name, name: "name", parent: name, max: 256)
try validate(self.name, name: "name", parent: name, min: 1)
try validate(self.nextPageToken, name: "nextPageToken", parent: name, max: 2048)
}
private enum CodingKeys: String, CodingKey {
case domain = "domain"
case maximumPageSize = "maximumPageSize"
case name = "name"
case nextPageToken = "nextPageToken"
case registrationStatus = "registrationStatus"
case reverseOrder = "reverseOrder"
}
}
public struct ListClosedWorkflowExecutionsInput: AWSEncodableShape {
/// If specified, only workflow executions that match this close status are listed. For example, if TERMINATED is specified, then only TERMINATED workflow executions are listed. closeStatusFilter, executionFilter, typeFilter and tagFilter are mutually exclusive. You can specify at most one of these in a request.
public let closeStatusFilter: CloseStatusFilter?
/// If specified, the workflow executions are included in the returned results based on whether their close times are within the range specified by this filter. Also, if this parameter is specified, the returned results are ordered by their close times. startTimeFilter and closeTimeFilter are mutually exclusive. You must specify one of these in a request but not both.
public let closeTimeFilter: ExecutionTimeFilter?
/// The name of the domain that contains the workflow executions to list.
public let domain: String
/// If specified, only workflow executions matching the workflow ID specified in the filter are returned. closeStatusFilter, executionFilter, typeFilter and tagFilter are mutually exclusive. You can specify at most one of these in a request.
public let executionFilter: WorkflowExecutionFilter?
/// The maximum number of results that are returned per call. Use nextPageToken to obtain further pages of results.
public let maximumPageSize: Int?
/// If NextPageToken is returned there are more results available. The value of NextPageToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 60 seconds. Using an expired pagination token will return a 400 error: "Specified token has exceeded its maximum lifetime". The configured maximumPageSize determines how many results can be returned in a single call.
public let nextPageToken: String?
/// When set to true, returns the results in reverse order. By default the results are returned in descending order of the start or the close time of the executions.
public let reverseOrder: Bool?
/// If specified, the workflow executions are included in the returned results based on whether their start times are within the range specified by this filter. Also, if this parameter is specified, the returned results are ordered by their start times. startTimeFilter and closeTimeFilter are mutually exclusive. You must specify one of these in a request but not both.
public let startTimeFilter: ExecutionTimeFilter?
/// If specified, only executions that have the matching tag are listed. closeStatusFilter, executionFilter, typeFilter and tagFilter are mutually exclusive. You can specify at most one of these in a request.
public let tagFilter: TagFilter?
/// If specified, only executions of the type specified in the filter are returned. closeStatusFilter, executionFilter, typeFilter and tagFilter are mutually exclusive. You can specify at most one of these in a request.
public let typeFilter: WorkflowTypeFilter?
public init(closeStatusFilter: CloseStatusFilter? = nil, closeTimeFilter: ExecutionTimeFilter? = nil, domain: String, executionFilter: WorkflowExecutionFilter? = nil, maximumPageSize: Int? = nil, nextPageToken: String? = nil, reverseOrder: Bool? = nil, startTimeFilter: ExecutionTimeFilter? = nil, tagFilter: TagFilter? = nil, typeFilter: WorkflowTypeFilter? = nil) {
self.closeStatusFilter = closeStatusFilter
self.closeTimeFilter = closeTimeFilter
self.domain = domain
self.executionFilter = executionFilter
self.maximumPageSize = maximumPageSize
self.nextPageToken = nextPageToken
self.reverseOrder = reverseOrder
self.startTimeFilter = startTimeFilter
self.tagFilter = tagFilter
self.typeFilter = typeFilter
}
public func validate(name: String) throws {
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try self.executionFilter?.validate(name: "\(name).executionFilter")
try validate(self.maximumPageSize, name: "maximumPageSize", parent: name, max: 1000)
try validate(self.maximumPageSize, name: "maximumPageSize", parent: name, min: 0)
try validate(self.nextPageToken, name: "nextPageToken", parent: name, max: 2048)
try self.tagFilter?.validate(name: "\(name).tagFilter")
try self.typeFilter?.validate(name: "\(name).typeFilter")
}
private enum CodingKeys: String, CodingKey {
case closeStatusFilter = "closeStatusFilter"
case closeTimeFilter = "closeTimeFilter"
case domain = "domain"
case executionFilter = "executionFilter"
case maximumPageSize = "maximumPageSize"
case nextPageToken = "nextPageToken"
case reverseOrder = "reverseOrder"
case startTimeFilter = "startTimeFilter"
case tagFilter = "tagFilter"
case typeFilter = "typeFilter"
}
}
public struct ListDomainsInput: AWSEncodableShape {
/// The maximum number of results that are returned per call. Use nextPageToken to obtain further pages of results.
public let maximumPageSize: Int?
/// If NextPageToken is returned there are more results available. The value of NextPageToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 60 seconds. Using an expired pagination token will return a 400 error: "Specified token has exceeded its maximum lifetime". The configured maximumPageSize determines how many results can be returned in a single call.
public let nextPageToken: String?
/// Specifies the registration status of the domains to list.
public let registrationStatus: RegistrationStatus
/// When set to true, returns the results in reverse order. By default, the results are returned in ascending alphabetical order by name of the domains.
public let reverseOrder: Bool?
public init(maximumPageSize: Int? = nil, nextPageToken: String? = nil, registrationStatus: RegistrationStatus, reverseOrder: Bool? = nil) {
self.maximumPageSize = maximumPageSize
self.nextPageToken = nextPageToken
self.registrationStatus = registrationStatus
self.reverseOrder = reverseOrder
}
public func validate(name: String) throws {
try validate(self.maximumPageSize, name: "maximumPageSize", parent: name, max: 1000)
try validate(self.maximumPageSize, name: "maximumPageSize", parent: name, min: 0)
try validate(self.nextPageToken, name: "nextPageToken", parent: name, max: 2048)
}
private enum CodingKeys: String, CodingKey {
case maximumPageSize = "maximumPageSize"
case nextPageToken = "nextPageToken"
case registrationStatus = "registrationStatus"
case reverseOrder = "reverseOrder"
}
}
public struct ListOpenWorkflowExecutionsInput: AWSEncodableShape {
/// The name of the domain that contains the workflow executions to list.
public let domain: String
/// If specified, only workflow executions matching the workflow ID specified in the filter are returned. executionFilter, typeFilter and tagFilter are mutually exclusive. You can specify at most one of these in a request.
public let executionFilter: WorkflowExecutionFilter?
/// The maximum number of results that are returned per call. Use nextPageToken to obtain further pages of results.
public let maximumPageSize: Int?
/// If NextPageToken is returned there are more results available. The value of NextPageToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 60 seconds. Using an expired pagination token will return a 400 error: "Specified token has exceeded its maximum lifetime". The configured maximumPageSize determines how many results can be returned in a single call.
public let nextPageToken: String?
/// When set to true, returns the results in reverse order. By default the results are returned in descending order of the start time of the executions.
public let reverseOrder: Bool?
/// Workflow executions are included in the returned results based on whether their start times are within the range specified by this filter.
public let startTimeFilter: ExecutionTimeFilter
/// If specified, only executions that have the matching tag are listed. executionFilter, typeFilter and tagFilter are mutually exclusive. You can specify at most one of these in a request.
public let tagFilter: TagFilter?
/// If specified, only executions of the type specified in the filter are returned. executionFilter, typeFilter and tagFilter are mutually exclusive. You can specify at most one of these in a request.
public let typeFilter: WorkflowTypeFilter?
public init(domain: String, executionFilter: WorkflowExecutionFilter? = nil, maximumPageSize: Int? = nil, nextPageToken: String? = nil, reverseOrder: Bool? = nil, startTimeFilter: ExecutionTimeFilter, tagFilter: TagFilter? = nil, typeFilter: WorkflowTypeFilter? = nil) {
self.domain = domain
self.executionFilter = executionFilter
self.maximumPageSize = maximumPageSize
self.nextPageToken = nextPageToken
self.reverseOrder = reverseOrder
self.startTimeFilter = startTimeFilter
self.tagFilter = tagFilter
self.typeFilter = typeFilter
}
public func validate(name: String) throws {
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try self.executionFilter?.validate(name: "\(name).executionFilter")
try validate(self.maximumPageSize, name: "maximumPageSize", parent: name, max: 1000)
try validate(self.maximumPageSize, name: "maximumPageSize", parent: name, min: 0)
try validate(self.nextPageToken, name: "nextPageToken", parent: name, max: 2048)
try self.tagFilter?.validate(name: "\(name).tagFilter")
try self.typeFilter?.validate(name: "\(name).typeFilter")
}
private enum CodingKeys: String, CodingKey {
case domain = "domain"
case executionFilter = "executionFilter"
case maximumPageSize = "maximumPageSize"
case nextPageToken = "nextPageToken"
case reverseOrder = "reverseOrder"
case startTimeFilter = "startTimeFilter"
case tagFilter = "tagFilter"
case typeFilter = "typeFilter"
}
}
public struct ListTagsForResourceInput: AWSEncodableShape {
/// The Amazon Resource Name (ARN) for the Amazon SWF domain.
public let resourceArn: String
public init(resourceArn: String) {
self.resourceArn = resourceArn
}
public func validate(name: String) throws {
try validate(self.resourceArn, name: "resourceArn", parent: name, max: 1600)
try validate(self.resourceArn, name: "resourceArn", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case resourceArn = "resourceArn"
}
}
public struct ListTagsForResourceOutput: AWSDecodableShape {
/// An array of tags associated with the domain.
public let tags: [ResourceTag]?
public init(tags: [ResourceTag]? = nil) {
self.tags = tags
}
private enum CodingKeys: String, CodingKey {
case tags = "tags"
}
}
public struct ListWorkflowTypesInput: AWSEncodableShape {
/// The name of the domain in which the workflow types have been registered.
public let domain: String
/// The maximum number of results that are returned per call. Use nextPageToken to obtain further pages of results.
public let maximumPageSize: Int?
/// If specified, lists the workflow type with this name.
public let name: String?
/// If NextPageToken is returned there are more results available. The value of NextPageToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 60 seconds. Using an expired pagination token will return a 400 error: "Specified token has exceeded its maximum lifetime". The configured maximumPageSize determines how many results can be returned in a single call.
public let nextPageToken: String?
/// Specifies the registration status of the workflow types to list.
public let registrationStatus: RegistrationStatus
/// When set to true, returns the results in reverse order. By default the results are returned in ascending alphabetical order of the name of the workflow types.
public let reverseOrder: Bool?
public init(domain: String, maximumPageSize: Int? = nil, name: String? = nil, nextPageToken: String? = nil, registrationStatus: RegistrationStatus, reverseOrder: Bool? = nil) {
self.domain = domain
self.maximumPageSize = maximumPageSize
self.name = name
self.nextPageToken = nextPageToken
self.registrationStatus = registrationStatus
self.reverseOrder = reverseOrder
}
public func validate(name: String) throws {
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try validate(self.maximumPageSize, name: "maximumPageSize", parent: name, max: 1000)
try validate(self.maximumPageSize, name: "maximumPageSize", parent: name, min: 0)
try validate(self.name, name: "name", parent: name, max: 256)
try validate(self.name, name: "name", parent: name, min: 1)
try validate(self.nextPageToken, name: "nextPageToken", parent: name, max: 2048)
}
private enum CodingKeys: String, CodingKey {
case domain = "domain"
case maximumPageSize = "maximumPageSize"
case name = "name"
case nextPageToken = "nextPageToken"
case registrationStatus = "registrationStatus"
case reverseOrder = "reverseOrder"
}
}
public struct MarkerRecordedEventAttributes: AWSDecodableShape {
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the RecordMarker decision that requested this marker. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
/// The details of the marker.
public let details: String?
/// The name of the marker.
public let markerName: String
public init(decisionTaskCompletedEventId: Int64, details: String? = nil, markerName: String) {
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
self.details = details
self.markerName = markerName
}
private enum CodingKeys: String, CodingKey {
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
case details = "details"
case markerName = "markerName"
}
}
public struct PendingTaskCount: AWSDecodableShape {
/// The number of tasks in the task list.
public let count: Int
/// If set to true, indicates that the actual count was more than the maximum supported by this API and the count returned is the truncated value.
public let truncated: Bool?
public init(count: Int, truncated: Bool? = nil) {
self.count = count
self.truncated = truncated
}
private enum CodingKeys: String, CodingKey {
case count = "count"
case truncated = "truncated"
}
}
public struct PollForActivityTaskInput: AWSEncodableShape {
/// The name of the domain that contains the task lists being polled.
public let domain: String
/// Identity of the worker making the request, recorded in the ActivityTaskStarted event in the workflow history. This enables diagnostic tracing when problems arise. The form of this identity is user defined.
public let identity: String?
/// Specifies the task list to poll for activity tasks. The specified string must not start or end with whitespace. It must not contain a : (colon), / (slash), | (vertical bar), or any control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not be the literal string arn.
public let taskList: TaskList
public init(domain: String, identity: String? = nil, taskList: TaskList) {
self.domain = domain
self.identity = identity
self.taskList = taskList
}
public func validate(name: String) throws {
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try validate(self.identity, name: "identity", parent: name, max: 256)
try self.taskList.validate(name: "\(name).taskList")
}
private enum CodingKeys: String, CodingKey {
case domain = "domain"
case identity = "identity"
case taskList = "taskList"
}
}
public struct PollForDecisionTaskInput: AWSEncodableShape {
/// The name of the domain containing the task lists to poll.
public let domain: String
/// Identity of the decider making the request, which is recorded in the DecisionTaskStarted event in the workflow history. This enables diagnostic tracing when problems arise. The form of this identity is user defined.
public let identity: String?
/// The maximum number of results that are returned per call. Use nextPageToken to obtain further pages of results. This is an upper limit only; the actual number of results returned per call may be fewer than the specified maximum.
public let maximumPageSize: Int?
/// If NextPageToken is returned there are more results available. The value of NextPageToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 60 seconds. Using an expired pagination token will return a 400 error: "Specified token has exceeded its maximum lifetime". The configured maximumPageSize determines how many results can be returned in a single call. The nextPageToken returned by this action cannot be used with GetWorkflowExecutionHistory to get the next page. You must call PollForDecisionTask again (with the nextPageToken) to retrieve the next page of history records. Calling PollForDecisionTask with a nextPageToken doesn't return a new decision task.
public let nextPageToken: String?
/// When set to true, returns the events in reverse order. By default the results are returned in ascending order of the eventTimestamp of the events.
public let reverseOrder: Bool?
/// Specifies the task list to poll for decision tasks. The specified string must not start or end with whitespace. It must not contain a : (colon), / (slash), | (vertical bar), or any control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not be the literal string arn.
public let taskList: TaskList
public init(domain: String, identity: String? = nil, maximumPageSize: Int? = nil, nextPageToken: String? = nil, reverseOrder: Bool? = nil, taskList: TaskList) {
self.domain = domain
self.identity = identity
self.maximumPageSize = maximumPageSize
self.nextPageToken = nextPageToken
self.reverseOrder = reverseOrder
self.taskList = taskList
}
public func validate(name: String) throws {
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try validate(self.identity, name: "identity", parent: name, max: 256)
try validate(self.maximumPageSize, name: "maximumPageSize", parent: name, max: 1000)
try validate(self.maximumPageSize, name: "maximumPageSize", parent: name, min: 0)
try validate(self.nextPageToken, name: "nextPageToken", parent: name, max: 2048)
try self.taskList.validate(name: "\(name).taskList")
}
private enum CodingKeys: String, CodingKey {
case domain = "domain"
case identity = "identity"
case maximumPageSize = "maximumPageSize"
case nextPageToken = "nextPageToken"
case reverseOrder = "reverseOrder"
case taskList = "taskList"
}
}
public struct RecordActivityTaskHeartbeatInput: AWSEncodableShape {
/// If specified, contains details about the progress of the task.
public let details: String?
/// The taskToken of the ActivityTask. taskToken is generated by the service and should be treated as an opaque value. If the task is passed to another process, its taskToken must also be passed. This enables it to provide its progress and respond with results.
public let taskToken: String
public init(details: String? = nil, taskToken: String) {
self.details = details
self.taskToken = taskToken
}
public func validate(name: String) throws {
try validate(self.details, name: "details", parent: name, max: 2048)
try validate(self.taskToken, name: "taskToken", parent: name, max: 1024)
try validate(self.taskToken, name: "taskToken", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case details = "details"
case taskToken = "taskToken"
}
}
public struct RecordMarkerDecisionAttributes: AWSEncodableShape {
/// The details of the marker.
public let details: String?
/// The name of the marker.
public let markerName: String
public init(details: String? = nil, markerName: String) {
self.details = details
self.markerName = markerName
}
public func validate(name: String) throws {
try validate(self.details, name: "details", parent: name, max: 32768)
try validate(self.markerName, name: "markerName", parent: name, max: 256)
try validate(self.markerName, name: "markerName", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case details = "details"
case markerName = "markerName"
}
}
public struct RecordMarkerFailedEventAttributes: AWSDecodableShape {
/// The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide.
public let cause: RecordMarkerFailedCause
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the RecordMarkerFailed decision for this cancellation request. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
/// The marker's name.
public let markerName: String
public init(cause: RecordMarkerFailedCause, decisionTaskCompletedEventId: Int64, markerName: String) {
self.cause = cause
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
self.markerName = markerName
}
private enum CodingKeys: String, CodingKey {
case cause = "cause"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
case markerName = "markerName"
}
}
public struct RegisterActivityTypeInput: AWSEncodableShape {
/// If set, specifies the default maximum time before which a worker processing a task of this type must report progress by calling RecordActivityTaskHeartbeat. If the timeout is exceeded, the activity task is automatically timed out. This default can be overridden when scheduling an activity task using the ScheduleActivityTask Decision. If the activity worker subsequently attempts to record a heartbeat or returns a result, the activity worker receives an UnknownResource fault. In this case, Amazon SWF no longer considers the activity task to be valid; the activity worker should clean up the activity task. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let defaultTaskHeartbeatTimeout: String?
/// If set, specifies the default task list to use for scheduling tasks of this activity type. This default task list is used if a task list isn't provided when a task is scheduled through the ScheduleActivityTask Decision.
public let defaultTaskList: TaskList?
/// The default task priority to assign to the activity type. If not assigned, then 0 is used. Valid values are integers that range from Java's Integer.MIN_VALUE (-2147483648) to Integer.MAX_VALUE (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see Setting Task Priority in the in the Amazon SWF Developer Guide..
public let defaultTaskPriority: String?
/// If set, specifies the default maximum duration for a task of this activity type. This default can be overridden when scheduling an activity task using the ScheduleActivityTask Decision. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let defaultTaskScheduleToCloseTimeout: String?
/// If set, specifies the default maximum duration that a task of this activity type can wait before being assigned to a worker. This default can be overridden when scheduling an activity task using the ScheduleActivityTask Decision. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let defaultTaskScheduleToStartTimeout: String?
/// If set, specifies the default maximum duration that a worker can take to process tasks of this activity type. This default can be overridden when scheduling an activity task using the ScheduleActivityTask Decision. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let defaultTaskStartToCloseTimeout: String?
/// A textual description of the activity type.
public let description: String?
/// The name of the domain in which this activity is to be registered.
public let domain: String
/// The name of the activity type within the domain. The specified string must not start or end with whitespace. It must not contain a : (colon), / (slash), | (vertical bar), or any control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not be the literal string arn.
public let name: String
/// The version of the activity type. The activity type consists of the name and version, the combination of which must be unique within the domain. The specified string must not start or end with whitespace. It must not contain a : (colon), / (slash), | (vertical bar), or any control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not be the literal string arn.
public let version: String
public init(defaultTaskHeartbeatTimeout: String? = nil, defaultTaskList: TaskList? = nil, defaultTaskPriority: String? = nil, defaultTaskScheduleToCloseTimeout: String? = nil, defaultTaskScheduleToStartTimeout: String? = nil, defaultTaskStartToCloseTimeout: String? = nil, description: String? = nil, domain: String, name: String, version: String) {
self.defaultTaskHeartbeatTimeout = defaultTaskHeartbeatTimeout
self.defaultTaskList = defaultTaskList
self.defaultTaskPriority = defaultTaskPriority
self.defaultTaskScheduleToCloseTimeout = defaultTaskScheduleToCloseTimeout
self.defaultTaskScheduleToStartTimeout = defaultTaskScheduleToStartTimeout
self.defaultTaskStartToCloseTimeout = defaultTaskStartToCloseTimeout
self.description = description
self.domain = domain
self.name = name
self.version = version
}
public func validate(name: String) throws {
try validate(self.defaultTaskHeartbeatTimeout, name: "defaultTaskHeartbeatTimeout", parent: name, max: 8)
try self.defaultTaskList?.validate(name: "\(name).defaultTaskList")
try validate(self.defaultTaskScheduleToCloseTimeout, name: "defaultTaskScheduleToCloseTimeout", parent: name, max: 8)
try validate(self.defaultTaskScheduleToStartTimeout, name: "defaultTaskScheduleToStartTimeout", parent: name, max: 8)
try validate(self.defaultTaskStartToCloseTimeout, name: "defaultTaskStartToCloseTimeout", parent: name, max: 8)
try validate(self.description, name: "description", parent: name, max: 1024)
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try validate(self.name, name: "name", parent: name, max: 256)
try validate(self.name, name: "name", parent: name, min: 1)
try validate(self.version, name: "version", parent: name, max: 64)
try validate(self.version, name: "version", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case defaultTaskHeartbeatTimeout = "defaultTaskHeartbeatTimeout"
case defaultTaskList = "defaultTaskList"
case defaultTaskPriority = "defaultTaskPriority"
case defaultTaskScheduleToCloseTimeout = "defaultTaskScheduleToCloseTimeout"
case defaultTaskScheduleToStartTimeout = "defaultTaskScheduleToStartTimeout"
case defaultTaskStartToCloseTimeout = "defaultTaskStartToCloseTimeout"
case description = "description"
case domain = "domain"
case name = "name"
case version = "version"
}
}
public struct RegisterDomainInput: AWSEncodableShape {
/// A text description of the domain.
public let description: String?
/// Name of the domain to register. The name must be unique in the region that the domain is registered in. The specified string must not start or end with whitespace. It must not contain a : (colon), / (slash), | (vertical bar), or any control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not be the literal string arn.
public let name: String
/// Tags to be added when registering a domain. Tags may only contain unicode letters, digits, whitespace, or these symbols: _ . : / = + - @.
public let tags: [ResourceTag]?
/// The duration (in days) that records and histories of workflow executions on the domain should be kept by the service. After the retention period, the workflow execution isn't available in the results of visibility calls. If you pass the value NONE or 0 (zero), then the workflow execution history isn't retained. As soon as the workflow execution completes, the execution record and its history are deleted. The maximum workflow execution retention period is 90 days. For more information about Amazon SWF service limits, see: Amazon SWF Service Limits in the Amazon SWF Developer Guide.
public let workflowExecutionRetentionPeriodInDays: String
public init(description: String? = nil, name: String, tags: [ResourceTag]? = nil, workflowExecutionRetentionPeriodInDays: String) {
self.description = description
self.name = name
self.tags = tags
self.workflowExecutionRetentionPeriodInDays = workflowExecutionRetentionPeriodInDays
}
public func validate(name: String) throws {
try validate(self.description, name: "description", parent: name, max: 1024)
try validate(self.name, name: "name", parent: name, max: 256)
try validate(self.name, name: "name", parent: name, min: 1)
try self.tags?.forEach {
try $0.validate(name: "\(name).tags[]")
}
try validate(self.workflowExecutionRetentionPeriodInDays, name: "workflowExecutionRetentionPeriodInDays", parent: name, max: 8)
try validate(self.workflowExecutionRetentionPeriodInDays, name: "workflowExecutionRetentionPeriodInDays", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case description = "description"
case name = "name"
case tags = "tags"
case workflowExecutionRetentionPeriodInDays = "workflowExecutionRetentionPeriodInDays"
}
}
public struct RegisterWorkflowTypeInput: AWSEncodableShape {
/// If set, specifies the default policy to use for the child workflow executions when a workflow execution of this type is terminated, by calling the TerminateWorkflowExecution action explicitly or due to an expired timeout. This default can be overridden when starting a workflow execution using the StartWorkflowExecution action or the StartChildWorkflowExecution Decision. The supported child policies are: TERMINATE – The child executions are terminated. REQUEST_CANCEL – A request to cancel is attempted for each child execution by recording a WorkflowExecutionCancelRequested event in its history. It is up to the decider to take appropriate actions when it receives an execution history with this event. ABANDON – No action is taken. The child executions continue to run.
public let defaultChildPolicy: ChildPolicy?
/// If set, specifies the default maximum duration for executions of this workflow type. You can override this default when starting an execution through the StartWorkflowExecution Action or StartChildWorkflowExecution Decision. The duration is specified in seconds; an integer greater than or equal to 0. Unlike some of the other timeout parameters in Amazon SWF, you cannot specify a value of "NONE" for defaultExecutionStartToCloseTimeout; there is a one-year max limit on the time that a workflow execution can run. Exceeding this limit always causes the workflow execution to time out.
public let defaultExecutionStartToCloseTimeout: String?
/// The default IAM role attached to this workflow type. Executions of this workflow type need IAM roles to invoke Lambda functions. If you don't specify an IAM role when you start this workflow type, the default Lambda role is attached to the execution. For more information, see https://docs.aws.amazon.com/amazonswf/latest/developerguide/lambda-task.html in the Amazon SWF Developer Guide.
public let defaultLambdaRole: String?
/// If set, specifies the default task list to use for scheduling decision tasks for executions of this workflow type. This default is used only if a task list isn't provided when starting the execution through the StartWorkflowExecution Action or StartChildWorkflowExecution Decision.
public let defaultTaskList: TaskList?
/// The default task priority to assign to the workflow type. If not assigned, then 0 is used. Valid values are integers that range from Java's Integer.MIN_VALUE (-2147483648) to Integer.MAX_VALUE (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see Setting Task Priority in the Amazon SWF Developer Guide.
public let defaultTaskPriority: String?
/// If set, specifies the default maximum duration of decision tasks for this workflow type. This default can be overridden when starting a workflow execution using the StartWorkflowExecution action or the StartChildWorkflowExecution Decision. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let defaultTaskStartToCloseTimeout: String?
/// Textual description of the workflow type.
public let description: String?
/// The name of the domain in which to register the workflow type.
public let domain: String
/// The name of the workflow type. The specified string must not start or end with whitespace. It must not contain a : (colon), / (slash), | (vertical bar), or any control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not be the literal string arn.
public let name: String
/// The version of the workflow type. The workflow type consists of the name and version, the combination of which must be unique within the domain. To get a list of all currently registered workflow types, use the ListWorkflowTypes action. The specified string must not start or end with whitespace. It must not contain a : (colon), / (slash), | (vertical bar), or any control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not be the literal string arn.
public let version: String
public init(defaultChildPolicy: ChildPolicy? = nil, defaultExecutionStartToCloseTimeout: String? = nil, defaultLambdaRole: String? = nil, defaultTaskList: TaskList? = nil, defaultTaskPriority: String? = nil, defaultTaskStartToCloseTimeout: String? = nil, description: String? = nil, domain: String, name: String, version: String) {
self.defaultChildPolicy = defaultChildPolicy
self.defaultExecutionStartToCloseTimeout = defaultExecutionStartToCloseTimeout
self.defaultLambdaRole = defaultLambdaRole
self.defaultTaskList = defaultTaskList
self.defaultTaskPriority = defaultTaskPriority
self.defaultTaskStartToCloseTimeout = defaultTaskStartToCloseTimeout
self.description = description
self.domain = domain
self.name = name
self.version = version
}
public func validate(name: String) throws {
try validate(self.defaultExecutionStartToCloseTimeout, name: "defaultExecutionStartToCloseTimeout", parent: name, max: 8)
try validate(self.defaultLambdaRole, name: "defaultLambdaRole", parent: name, max: 1600)
try validate(self.defaultLambdaRole, name: "defaultLambdaRole", parent: name, min: 1)
try self.defaultTaskList?.validate(name: "\(name).defaultTaskList")
try validate(self.defaultTaskStartToCloseTimeout, name: "defaultTaskStartToCloseTimeout", parent: name, max: 8)
try validate(self.description, name: "description", parent: name, max: 1024)
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try validate(self.name, name: "name", parent: name, max: 256)
try validate(self.name, name: "name", parent: name, min: 1)
try validate(self.version, name: "version", parent: name, max: 64)
try validate(self.version, name: "version", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case defaultChildPolicy = "defaultChildPolicy"
case defaultExecutionStartToCloseTimeout = "defaultExecutionStartToCloseTimeout"
case defaultLambdaRole = "defaultLambdaRole"
case defaultTaskList = "defaultTaskList"
case defaultTaskPriority = "defaultTaskPriority"
case defaultTaskStartToCloseTimeout = "defaultTaskStartToCloseTimeout"
case description = "description"
case domain = "domain"
case name = "name"
case version = "version"
}
}
public struct RequestCancelActivityTaskDecisionAttributes: AWSEncodableShape {
/// The activityId of the activity task to be canceled.
public let activityId: String
public init(activityId: String) {
self.activityId = activityId
}
public func validate(name: String) throws {
try validate(self.activityId, name: "activityId", parent: name, max: 256)
try validate(self.activityId, name: "activityId", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case activityId = "activityId"
}
}
public struct RequestCancelActivityTaskFailedEventAttributes: AWSDecodableShape {
/// The activityId provided in the RequestCancelActivityTask decision that failed.
public let activityId: String
/// The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide.
public let cause: RequestCancelActivityTaskFailedCause
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the RequestCancelActivityTask decision for this cancellation request. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
public init(activityId: String, cause: RequestCancelActivityTaskFailedCause, decisionTaskCompletedEventId: Int64) {
self.activityId = activityId
self.cause = cause
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
}
private enum CodingKeys: String, CodingKey {
case activityId = "activityId"
case cause = "cause"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
}
}
public struct RequestCancelExternalWorkflowExecutionDecisionAttributes: AWSEncodableShape {
/// The data attached to the event that can be used by the decider in subsequent workflow tasks.
public let control: String?
/// The runId of the external workflow execution to cancel.
public let runId: String?
/// The workflowId of the external workflow execution to cancel.
public let workflowId: String
public init(control: String? = nil, runId: String? = nil, workflowId: String) {
self.control = control
self.runId = runId
self.workflowId = workflowId
}
public func validate(name: String) throws {
try validate(self.control, name: "control", parent: name, max: 32768)
try validate(self.runId, name: "runId", parent: name, max: 64)
try validate(self.workflowId, name: "workflowId", parent: name, max: 256)
try validate(self.workflowId, name: "workflowId", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case control = "control"
case runId = "runId"
case workflowId = "workflowId"
}
}
public struct RequestCancelExternalWorkflowExecutionFailedEventAttributes: AWSDecodableShape {
/// The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide.
public let cause: RequestCancelExternalWorkflowExecutionFailedCause
/// The data attached to the event that the decider can use in subsequent workflow tasks. This data isn't sent to the workflow execution.
public let control: String?
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the RequestCancelExternalWorkflowExecution decision for this cancellation request. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
/// The ID of the RequestCancelExternalWorkflowExecutionInitiated event corresponding to the RequestCancelExternalWorkflowExecution decision to cancel this external workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let initiatedEventId: Int64
/// The runId of the external workflow execution.
public let runId: String?
/// The workflowId of the external workflow to which the cancel request was to be delivered.
public let workflowId: String
public init(cause: RequestCancelExternalWorkflowExecutionFailedCause, control: String? = nil, decisionTaskCompletedEventId: Int64, initiatedEventId: Int64, runId: String? = nil, workflowId: String) {
self.cause = cause
self.control = control
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
self.initiatedEventId = initiatedEventId
self.runId = runId
self.workflowId = workflowId
}
private enum CodingKeys: String, CodingKey {
case cause = "cause"
case control = "control"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
case initiatedEventId = "initiatedEventId"
case runId = "runId"
case workflowId = "workflowId"
}
}
public struct RequestCancelExternalWorkflowExecutionInitiatedEventAttributes: AWSDecodableShape {
/// Data attached to the event that can be used by the decider in subsequent workflow tasks.
public let control: String?
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the RequestCancelExternalWorkflowExecution decision for this cancellation request. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
/// The runId of the external workflow execution to be canceled.
public let runId: String?
/// The workflowId of the external workflow execution to be canceled.
public let workflowId: String
public init(control: String? = nil, decisionTaskCompletedEventId: Int64, runId: String? = nil, workflowId: String) {
self.control = control
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
self.runId = runId
self.workflowId = workflowId
}
private enum CodingKeys: String, CodingKey {
case control = "control"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
case runId = "runId"
case workflowId = "workflowId"
}
}
public struct RequestCancelWorkflowExecutionInput: AWSEncodableShape {
/// The name of the domain containing the workflow execution to cancel.
public let domain: String
/// The runId of the workflow execution to cancel.
public let runId: String?
/// The workflowId of the workflow execution to cancel.
public let workflowId: String
public init(domain: String, runId: String? = nil, workflowId: String) {
self.domain = domain
self.runId = runId
self.workflowId = workflowId
}
public func validate(name: String) throws {
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try validate(self.runId, name: "runId", parent: name, max: 64)
try validate(self.workflowId, name: "workflowId", parent: name, max: 256)
try validate(self.workflowId, name: "workflowId", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case domain = "domain"
case runId = "runId"
case workflowId = "workflowId"
}
}
public struct ResourceTag: AWSEncodableShape & AWSDecodableShape {
/// The key of a tag.
public let key: String
/// The value of a tag.
public let value: String?
public init(key: String, value: String? = nil) {
self.key = key
self.value = value
}
public func validate(name: String) throws {
try validate(self.key, name: "key", parent: name, max: 128)
try validate(self.key, name: "key", parent: name, min: 1)
try validate(self.value, name: "value", parent: name, max: 256)
}
private enum CodingKeys: String, CodingKey {
case key = "key"
case value = "value"
}
}
public struct RespondActivityTaskCanceledInput: AWSEncodableShape {
/// Information about the cancellation.
public let details: String?
/// The taskToken of the ActivityTask. taskToken is generated by the service and should be treated as an opaque value. If the task is passed to another process, its taskToken must also be passed. This enables it to provide its progress and respond with results.
public let taskToken: String
public init(details: String? = nil, taskToken: String) {
self.details = details
self.taskToken = taskToken
}
public func validate(name: String) throws {
try validate(self.details, name: "details", parent: name, max: 32768)
try validate(self.taskToken, name: "taskToken", parent: name, max: 1024)
try validate(self.taskToken, name: "taskToken", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case details = "details"
case taskToken = "taskToken"
}
}
public struct RespondActivityTaskCompletedInput: AWSEncodableShape {
/// The result of the activity task. It is a free form string that is implementation specific.
public let result: String?
/// The taskToken of the ActivityTask. taskToken is generated by the service and should be treated as an opaque value. If the task is passed to another process, its taskToken must also be passed. This enables it to provide its progress and respond with results.
public let taskToken: String
public init(result: String? = nil, taskToken: String) {
self.result = result
self.taskToken = taskToken
}
public func validate(name: String) throws {
try validate(self.result, name: "result", parent: name, max: 32768)
try validate(self.taskToken, name: "taskToken", parent: name, max: 1024)
try validate(self.taskToken, name: "taskToken", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case result = "result"
case taskToken = "taskToken"
}
}
public struct RespondActivityTaskFailedInput: AWSEncodableShape {
/// Detailed information about the failure.
public let details: String?
/// Description of the error that may assist in diagnostics.
public let reason: String?
/// The taskToken of the ActivityTask. taskToken is generated by the service and should be treated as an opaque value. If the task is passed to another process, its taskToken must also be passed. This enables it to provide its progress and respond with results.
public let taskToken: String
public init(details: String? = nil, reason: String? = nil, taskToken: String) {
self.details = details
self.reason = reason
self.taskToken = taskToken
}
public func validate(name: String) throws {
try validate(self.details, name: "details", parent: name, max: 32768)
try validate(self.reason, name: "reason", parent: name, max: 256)
try validate(self.taskToken, name: "taskToken", parent: name, max: 1024)
try validate(self.taskToken, name: "taskToken", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case details = "details"
case reason = "reason"
case taskToken = "taskToken"
}
}
public struct RespondDecisionTaskCompletedInput: AWSEncodableShape {
/// The list of decisions (possibly empty) made by the decider while processing this decision task. See the docs for the Decision structure for details.
public let decisions: [Decision]?
/// User defined context to add to workflow execution.
public let executionContext: String?
/// The taskToken from the DecisionTask. taskToken is generated by the service and should be treated as an opaque value. If the task is passed to another process, its taskToken must also be passed. This enables it to provide its progress and respond with results.
public let taskToken: String
public init(decisions: [Decision]? = nil, executionContext: String? = nil, taskToken: String) {
self.decisions = decisions
self.executionContext = executionContext
self.taskToken = taskToken
}
public func validate(name: String) throws {
try self.decisions?.forEach {
try $0.validate(name: "\(name).decisions[]")
}
try validate(self.executionContext, name: "executionContext", parent: name, max: 32768)
try validate(self.taskToken, name: "taskToken", parent: name, max: 1024)
try validate(self.taskToken, name: "taskToken", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case decisions = "decisions"
case executionContext = "executionContext"
case taskToken = "taskToken"
}
}
public struct Run: AWSDecodableShape {
/// The runId of a workflow execution. This ID is generated by the service and can be used to uniquely identify the workflow execution within a domain.
public let runId: String?
public init(runId: String? = nil) {
self.runId = runId
}
private enum CodingKeys: String, CodingKey {
case runId = "runId"
}
}
public struct ScheduleActivityTaskDecisionAttributes: AWSEncodableShape {
/// The activityId of the activity task. The specified string must not start or end with whitespace. It must not contain a : (colon), / (slash), | (vertical bar), or any control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not contain the literal string arn.
public let activityId: String
/// The type of the activity task to schedule.
public let activityType: ActivityType
/// Data attached to the event that can be used by the decider in subsequent workflow tasks. This data isn't sent to the activity.
public let control: String?
/// If set, specifies the maximum time before which a worker processing a task of this type must report progress by calling RecordActivityTaskHeartbeat. If the timeout is exceeded, the activity task is automatically timed out. If the worker subsequently attempts to record a heartbeat or returns a result, it is ignored. This overrides the default heartbeat timeout specified when registering the activity type using RegisterActivityType. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let heartbeatTimeout: String?
/// The input provided to the activity task.
public let input: String?
/// The maximum duration for this activity task. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. A schedule-to-close timeout for this activity task must be specified either as a default for the activity type or through this field. If neither this field is set nor a default schedule-to-close timeout was specified at registration time then a fault is returned.
public let scheduleToCloseTimeout: String?
/// If set, specifies the maximum duration the activity task can wait to be assigned to a worker. This overrides the default schedule-to-start timeout specified when registering the activity type using RegisterActivityType. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. A schedule-to-start timeout for this activity task must be specified either as a default for the activity type or through this field. If neither this field is set nor a default schedule-to-start timeout was specified at registration time then a fault is returned.
public let scheduleToStartTimeout: String?
/// If set, specifies the maximum duration a worker may take to process this activity task. This overrides the default start-to-close timeout specified when registering the activity type using RegisterActivityType. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. A start-to-close timeout for this activity task must be specified either as a default for the activity type or through this field. If neither this field is set nor a default start-to-close timeout was specified at registration time then a fault is returned.
public let startToCloseTimeout: String?
/// If set, specifies the name of the task list in which to schedule the activity task. If not specified, the defaultTaskList registered with the activity type is used. A task list for this activity task must be specified either as a default for the activity type or through this field. If neither this field is set nor a default task list was specified at registration time then a fault is returned. The specified string must not start or end with whitespace. It must not contain a : (colon), / (slash), | (vertical bar), or any control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not contain the literal string arn.
public let taskList: TaskList?
/// If set, specifies the priority with which the activity task is to be assigned to a worker. This overrides the defaultTaskPriority specified when registering the activity type using RegisterActivityType. Valid values are integers that range from Java's Integer.MIN_VALUE (-2147483648) to Integer.MAX_VALUE (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see Setting Task Priority in the Amazon SWF Developer Guide.
public let taskPriority: String?
public init(activityId: String, activityType: ActivityType, control: String? = nil, heartbeatTimeout: String? = nil, input: String? = nil, scheduleToCloseTimeout: String? = nil, scheduleToStartTimeout: String? = nil, startToCloseTimeout: String? = nil, taskList: TaskList? = nil, taskPriority: String? = nil) {
self.activityId = activityId
self.activityType = activityType
self.control = control
self.heartbeatTimeout = heartbeatTimeout
self.input = input
self.scheduleToCloseTimeout = scheduleToCloseTimeout
self.scheduleToStartTimeout = scheduleToStartTimeout
self.startToCloseTimeout = startToCloseTimeout
self.taskList = taskList
self.taskPriority = taskPriority
}
public func validate(name: String) throws {
try validate(self.activityId, name: "activityId", parent: name, max: 256)
try validate(self.activityId, name: "activityId", parent: name, min: 1)
try self.activityType.validate(name: "\(name).activityType")
try validate(self.control, name: "control", parent: name, max: 32768)
try validate(self.heartbeatTimeout, name: "heartbeatTimeout", parent: name, max: 8)
try validate(self.input, name: "input", parent: name, max: 32768)
try validate(self.scheduleToCloseTimeout, name: "scheduleToCloseTimeout", parent: name, max: 8)
try validate(self.scheduleToStartTimeout, name: "scheduleToStartTimeout", parent: name, max: 8)
try validate(self.startToCloseTimeout, name: "startToCloseTimeout", parent: name, max: 8)
try self.taskList?.validate(name: "\(name).taskList")
}
private enum CodingKeys: String, CodingKey {
case activityId = "activityId"
case activityType = "activityType"
case control = "control"
case heartbeatTimeout = "heartbeatTimeout"
case input = "input"
case scheduleToCloseTimeout = "scheduleToCloseTimeout"
case scheduleToStartTimeout = "scheduleToStartTimeout"
case startToCloseTimeout = "startToCloseTimeout"
case taskList = "taskList"
case taskPriority = "taskPriority"
}
}
public struct ScheduleActivityTaskFailedEventAttributes: AWSDecodableShape {
/// The activityId provided in the ScheduleActivityTask decision that failed.
public let activityId: String
/// The activity type provided in the ScheduleActivityTask decision that failed.
public let activityType: ActivityType
/// The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide.
public let cause: ScheduleActivityTaskFailedCause
/// The ID of the DecisionTaskCompleted event corresponding to the decision that resulted in the scheduling of this activity task. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
public init(activityId: String, activityType: ActivityType, cause: ScheduleActivityTaskFailedCause, decisionTaskCompletedEventId: Int64) {
self.activityId = activityId
self.activityType = activityType
self.cause = cause
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
}
private enum CodingKeys: String, CodingKey {
case activityId = "activityId"
case activityType = "activityType"
case cause = "cause"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
}
}
public struct ScheduleLambdaFunctionDecisionAttributes: AWSEncodableShape {
/// The data attached to the event that the decider can use in subsequent workflow tasks. This data isn't sent to the Lambda task.
public let control: String?
/// A string that identifies the Lambda function execution in the event history.
public let id: String
/// The optional input data to be supplied to the Lambda function.
public let input: String?
/// The name, or ARN, of the Lambda function to schedule.
public let name: String
/// The timeout value, in seconds, after which the Lambda function is considered to be failed once it has started. This can be any integer from 1-300 (1s-5m). If no value is supplied, than a default value of 300s is assumed.
public let startToCloseTimeout: String?
public init(control: String? = nil, id: String, input: String? = nil, name: String, startToCloseTimeout: String? = nil) {
self.control = control
self.id = id
self.input = input
self.name = name
self.startToCloseTimeout = startToCloseTimeout
}
public func validate(name: String) throws {
try validate(self.control, name: "control", parent: name, max: 32768)
try validate(self.id, name: "id", parent: name, max: 256)
try validate(self.id, name: "id", parent: name, min: 1)
try validate(self.input, name: "input", parent: name, max: 32768)
try validate(self.input, name: "input", parent: name, min: 0)
try validate(self.name, name: "name", parent: name, max: 64)
try validate(self.name, name: "name", parent: name, min: 1)
try validate(self.startToCloseTimeout, name: "startToCloseTimeout", parent: name, max: 8)
}
private enum CodingKeys: String, CodingKey {
case control = "control"
case id = "id"
case input = "input"
case name = "name"
case startToCloseTimeout = "startToCloseTimeout"
}
}
public struct ScheduleLambdaFunctionFailedEventAttributes: AWSDecodableShape {
/// The cause of the failure. To help diagnose issues, use this information to trace back the chain of events leading up to this event. If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide.
public let cause: ScheduleLambdaFunctionFailedCause
/// The ID of the LambdaFunctionCompleted event corresponding to the decision that resulted in scheduling this Lambda task. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
/// The ID provided in the ScheduleLambdaFunction decision that failed.
public let id: String
/// The name of the Lambda function.
public let name: String
public init(cause: ScheduleLambdaFunctionFailedCause, decisionTaskCompletedEventId: Int64, id: String, name: String) {
self.cause = cause
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
self.id = id
self.name = name
}
private enum CodingKeys: String, CodingKey {
case cause = "cause"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
case id = "id"
case name = "name"
}
}
public struct SignalExternalWorkflowExecutionDecisionAttributes: AWSEncodableShape {
/// The data attached to the event that can be used by the decider in subsequent decision tasks.
public let control: String?
/// The input data to be provided with the signal. The target workflow execution uses the signal name and input data to process the signal.
public let input: String?
/// The runId of the workflow execution to be signaled.
public let runId: String?
/// The name of the signal.The target workflow execution uses the signal name and input to process the signal.
public let signalName: String
/// The workflowId of the workflow execution to be signaled.
public let workflowId: String
public init(control: String? = nil, input: String? = nil, runId: String? = nil, signalName: String, workflowId: String) {
self.control = control
self.input = input
self.runId = runId
self.signalName = signalName
self.workflowId = workflowId
}
public func validate(name: String) throws {
try validate(self.control, name: "control", parent: name, max: 32768)
try validate(self.input, name: "input", parent: name, max: 32768)
try validate(self.runId, name: "runId", parent: name, max: 64)
try validate(self.signalName, name: "signalName", parent: name, max: 256)
try validate(self.signalName, name: "signalName", parent: name, min: 1)
try validate(self.workflowId, name: "workflowId", parent: name, max: 256)
try validate(self.workflowId, name: "workflowId", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case control = "control"
case input = "input"
case runId = "runId"
case signalName = "signalName"
case workflowId = "workflowId"
}
}
public struct SignalExternalWorkflowExecutionFailedEventAttributes: AWSDecodableShape {
/// The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide.
public let cause: SignalExternalWorkflowExecutionFailedCause
/// The data attached to the event that the decider can use in subsequent workflow tasks. This data isn't sent to the workflow execution.
public let control: String?
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the SignalExternalWorkflowExecution decision for this signal. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
/// The ID of the SignalExternalWorkflowExecutionInitiated event corresponding to the SignalExternalWorkflowExecution decision to request this signal. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let initiatedEventId: Int64
/// The runId of the external workflow execution that the signal was being delivered to.
public let runId: String?
/// The workflowId of the external workflow execution that the signal was being delivered to.
public let workflowId: String
public init(cause: SignalExternalWorkflowExecutionFailedCause, control: String? = nil, decisionTaskCompletedEventId: Int64, initiatedEventId: Int64, runId: String? = nil, workflowId: String) {
self.cause = cause
self.control = control
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
self.initiatedEventId = initiatedEventId
self.runId = runId
self.workflowId = workflowId
}
private enum CodingKeys: String, CodingKey {
case cause = "cause"
case control = "control"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
case initiatedEventId = "initiatedEventId"
case runId = "runId"
case workflowId = "workflowId"
}
}
public struct SignalExternalWorkflowExecutionInitiatedEventAttributes: AWSDecodableShape {
/// Data attached to the event that can be used by the decider in subsequent decision tasks.
public let control: String?
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the SignalExternalWorkflowExecution decision for this signal. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
/// The input provided to the signal.
public let input: String?
/// The runId of the external workflow execution to send the signal to.
public let runId: String?
/// The name of the signal.
public let signalName: String
/// The workflowId of the external workflow execution.
public let workflowId: String
public init(control: String? = nil, decisionTaskCompletedEventId: Int64, input: String? = nil, runId: String? = nil, signalName: String, workflowId: String) {
self.control = control
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
self.input = input
self.runId = runId
self.signalName = signalName
self.workflowId = workflowId
}
private enum CodingKeys: String, CodingKey {
case control = "control"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
case input = "input"
case runId = "runId"
case signalName = "signalName"
case workflowId = "workflowId"
}
}
public struct SignalWorkflowExecutionInput: AWSEncodableShape {
/// The name of the domain containing the workflow execution to signal.
public let domain: String
/// Data to attach to the WorkflowExecutionSignaled event in the target workflow execution's history.
public let input: String?
/// The runId of the workflow execution to signal.
public let runId: String?
/// The name of the signal. This name must be meaningful to the target workflow.
public let signalName: String
/// The workflowId of the workflow execution to signal.
public let workflowId: String
public init(domain: String, input: String? = nil, runId: String? = nil, signalName: String, workflowId: String) {
self.domain = domain
self.input = input
self.runId = runId
self.signalName = signalName
self.workflowId = workflowId
}
public func validate(name: String) throws {
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try validate(self.input, name: "input", parent: name, max: 32768)
try validate(self.runId, name: "runId", parent: name, max: 64)
try validate(self.signalName, name: "signalName", parent: name, max: 256)
try validate(self.signalName, name: "signalName", parent: name, min: 1)
try validate(self.workflowId, name: "workflowId", parent: name, max: 256)
try validate(self.workflowId, name: "workflowId", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case domain = "domain"
case input = "input"
case runId = "runId"
case signalName = "signalName"
case workflowId = "workflowId"
}
}
public struct StartChildWorkflowExecutionDecisionAttributes: AWSEncodableShape {
/// If set, specifies the policy to use for the child workflow executions if the workflow execution being started is terminated by calling the TerminateWorkflowExecution action explicitly or due to an expired timeout. This policy overrides the default child policy specified when registering the workflow type using RegisterWorkflowType. The supported child policies are: TERMINATE – The child executions are terminated. REQUEST_CANCEL – A request to cancel is attempted for each child execution by recording a WorkflowExecutionCancelRequested event in its history. It is up to the decider to take appropriate actions when it receives an execution history with this event. ABANDON – No action is taken. The child executions continue to run. A child policy for this workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default child policy was specified at registration time then a fault is returned.
public let childPolicy: ChildPolicy?
/// The data attached to the event that can be used by the decider in subsequent workflow tasks. This data isn't sent to the child workflow execution.
public let control: String?
/// The total duration for this workflow execution. This overrides the defaultExecutionStartToCloseTimeout specified when registering the workflow type. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. An execution start-to-close timeout for this workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default execution start-to-close timeout was specified at registration time then a fault is returned.
public let executionStartToCloseTimeout: String?
/// The input to be provided to the workflow execution.
public let input: String?
/// The IAM role attached to the child workflow execution.
public let lambdaRole: String?
/// The list of tags to associate with the child workflow execution. A maximum of 5 tags can be specified. You can list workflow executions with a specific tag by calling ListOpenWorkflowExecutions or ListClosedWorkflowExecutions and specifying a TagFilter.
public let tagList: [String]?
/// The name of the task list to be used for decision tasks of the child workflow execution. A task list for this workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default task list was specified at registration time then a fault is returned. The specified string must not start or end with whitespace. It must not contain a : (colon), / (slash), | (vertical bar), or any control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not contain the literal string arn.
public let taskList: TaskList?
/// A task priority that, if set, specifies the priority for a decision task of this workflow execution. This overrides the defaultTaskPriority specified when registering the workflow type. Valid values are integers that range from Java's Integer.MIN_VALUE (-2147483648) to Integer.MAX_VALUE (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see Setting Task Priority in the Amazon SWF Developer Guide.
public let taskPriority: String?
/// Specifies the maximum duration of decision tasks for this workflow execution. This parameter overrides the defaultTaskStartToCloseTimout specified when registering the workflow type using RegisterWorkflowType. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. A task start-to-close timeout for this workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default task start-to-close timeout was specified at registration time then a fault is returned.
public let taskStartToCloseTimeout: String?
/// The workflowId of the workflow execution. The specified string must not start or end with whitespace. It must not contain a : (colon), / (slash), | (vertical bar), or any control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not contain the literal string arn.
public let workflowId: String
/// The type of the workflow execution to be started.
public let workflowType: WorkflowType
public init(childPolicy: ChildPolicy? = nil, control: String? = nil, executionStartToCloseTimeout: String? = nil, input: String? = nil, lambdaRole: String? = nil, tagList: [String]? = nil, taskList: TaskList? = nil, taskPriority: String? = nil, taskStartToCloseTimeout: String? = nil, workflowId: String, workflowType: WorkflowType) {
self.childPolicy = childPolicy
self.control = control
self.executionStartToCloseTimeout = executionStartToCloseTimeout
self.input = input
self.lambdaRole = lambdaRole
self.tagList = tagList
self.taskList = taskList
self.taskPriority = taskPriority
self.taskStartToCloseTimeout = taskStartToCloseTimeout
self.workflowId = workflowId
self.workflowType = workflowType
}
public func validate(name: String) throws {
try validate(self.control, name: "control", parent: name, max: 32768)
try validate(self.executionStartToCloseTimeout, name: "executionStartToCloseTimeout", parent: name, max: 8)
try validate(self.input, name: "input", parent: name, max: 32768)
try validate(self.lambdaRole, name: "lambdaRole", parent: name, max: 1600)
try validate(self.lambdaRole, name: "lambdaRole", parent: name, min: 1)
try self.tagList?.forEach {
try validate($0, name: "tagList[]", parent: name, max: 256)
try validate($0, name: "tagList[]", parent: name, min: 0)
}
try validate(self.tagList, name: "tagList", parent: name, max: 5)
try self.taskList?.validate(name: "\(name).taskList")
try validate(self.taskStartToCloseTimeout, name: "taskStartToCloseTimeout", parent: name, max: 8)
try validate(self.workflowId, name: "workflowId", parent: name, max: 256)
try validate(self.workflowId, name: "workflowId", parent: name, min: 1)
try self.workflowType.validate(name: "\(name).workflowType")
}
private enum CodingKeys: String, CodingKey {
case childPolicy = "childPolicy"
case control = "control"
case executionStartToCloseTimeout = "executionStartToCloseTimeout"
case input = "input"
case lambdaRole = "lambdaRole"
case tagList = "tagList"
case taskList = "taskList"
case taskPriority = "taskPriority"
case taskStartToCloseTimeout = "taskStartToCloseTimeout"
case workflowId = "workflowId"
case workflowType = "workflowType"
}
}
public struct StartChildWorkflowExecutionFailedEventAttributes: AWSDecodableShape {
/// The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. When cause is set to OPERATION_NOT_PERMITTED, the decision fails because it lacks sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide.
public let cause: StartChildWorkflowExecutionFailedCause
/// The data attached to the event that the decider can use in subsequent workflow tasks. This data isn't sent to the child workflow execution.
public let control: String?
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the StartChildWorkflowExecution Decision to request this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events.
public let decisionTaskCompletedEventId: Int64
/// When the cause is WORKFLOW_ALREADY_RUNNING, initiatedEventId is the ID of the StartChildWorkflowExecutionInitiated event that corresponds to the StartChildWorkflowExecution Decision to start the workflow execution. You can use this information to diagnose problems by tracing back the chain of events leading up to this event. When the cause isn't WORKFLOW_ALREADY_RUNNING, initiatedEventId is set to 0 because the StartChildWorkflowExecutionInitiated event doesn't exist.
public let initiatedEventId: Int64
/// The workflowId of the child workflow execution.
public let workflowId: String
/// The workflow type provided in the StartChildWorkflowExecution Decision that failed.
public let workflowType: WorkflowType
public init(cause: StartChildWorkflowExecutionFailedCause, control: String? = nil, decisionTaskCompletedEventId: Int64, initiatedEventId: Int64, workflowId: String, workflowType: WorkflowType) {
self.cause = cause
self.control = control
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
self.initiatedEventId = initiatedEventId
self.workflowId = workflowId
self.workflowType = workflowType
}
private enum CodingKeys: String, CodingKey {
case cause = "cause"
case control = "control"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
case initiatedEventId = "initiatedEventId"
case workflowId = "workflowId"
case workflowType = "workflowType"
}
}
public struct StartChildWorkflowExecutionInitiatedEventAttributes: AWSDecodableShape {
/// The policy to use for the child workflow executions if this execution gets terminated by explicitly calling the TerminateWorkflowExecution action or due to an expired timeout. The supported child policies are: TERMINATE – The child executions are terminated. REQUEST_CANCEL – A request to cancel is attempted for each child execution by recording a WorkflowExecutionCancelRequested event in its history. It is up to the decider to take appropriate actions when it receives an execution history with this event. ABANDON – No action is taken. The child executions continue to run.
public let childPolicy: ChildPolicy
/// Data attached to the event that can be used by the decider in subsequent decision tasks. This data isn't sent to the activity.
public let control: String?
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the StartChildWorkflowExecution Decision to request this child workflow execution. This information can be useful for diagnosing problems by tracing back the cause of events.
public let decisionTaskCompletedEventId: Int64
/// The maximum duration for the child workflow execution. If the workflow execution isn't closed within this duration, it is timed out and force-terminated. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let executionStartToCloseTimeout: String?
/// The inputs provided to the child workflow execution.
public let input: String?
/// The IAM role to attach to the child workflow execution.
public let lambdaRole: String?
/// The list of tags to associated with the child workflow execution.
public let tagList: [String]?
/// The name of the task list used for the decision tasks of the child workflow execution.
public let taskList: TaskList
/// The priority assigned for the decision tasks for this workflow execution. Valid values are integers that range from Java's Integer.MIN_VALUE (-2147483648) to Integer.MAX_VALUE (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see Setting Task Priority in the Amazon SWF Developer Guide.
public let taskPriority: String?
/// The maximum duration allowed for the decision tasks for this workflow execution. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let taskStartToCloseTimeout: String?
/// The workflowId of the child workflow execution.
public let workflowId: String
/// The type of the child workflow execution.
public let workflowType: WorkflowType
public init(childPolicy: ChildPolicy, control: String? = nil, decisionTaskCompletedEventId: Int64, executionStartToCloseTimeout: String? = nil, input: String? = nil, lambdaRole: String? = nil, tagList: [String]? = nil, taskList: TaskList, taskPriority: String? = nil, taskStartToCloseTimeout: String? = nil, workflowId: String, workflowType: WorkflowType) {
self.childPolicy = childPolicy
self.control = control
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
self.executionStartToCloseTimeout = executionStartToCloseTimeout
self.input = input
self.lambdaRole = lambdaRole
self.tagList = tagList
self.taskList = taskList
self.taskPriority = taskPriority
self.taskStartToCloseTimeout = taskStartToCloseTimeout
self.workflowId = workflowId
self.workflowType = workflowType
}
private enum CodingKeys: String, CodingKey {
case childPolicy = "childPolicy"
case control = "control"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
case executionStartToCloseTimeout = "executionStartToCloseTimeout"
case input = "input"
case lambdaRole = "lambdaRole"
case tagList = "tagList"
case taskList = "taskList"
case taskPriority = "taskPriority"
case taskStartToCloseTimeout = "taskStartToCloseTimeout"
case workflowId = "workflowId"
case workflowType = "workflowType"
}
}
public struct StartLambdaFunctionFailedEventAttributes: AWSDecodableShape {
/// The cause of the failure. To help diagnose issues, use this information to trace back the chain of events leading up to this event. If cause is set to OPERATION_NOT_PERMITTED, the decision failed because the IAM role attached to the execution lacked sufficient permissions. For details and example IAM policies, see Lambda Tasks in the Amazon SWF Developer Guide.
public let cause: StartLambdaFunctionFailedCause?
/// A description that can help diagnose the cause of the fault.
public let message: String?
/// The ID of the ActivityTaskScheduled event that was recorded when this activity task was scheduled. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
public let scheduledEventId: Int64?
public init(cause: StartLambdaFunctionFailedCause? = nil, message: String? = nil, scheduledEventId: Int64? = nil) {
self.cause = cause
self.message = message
self.scheduledEventId = scheduledEventId
}
private enum CodingKeys: String, CodingKey {
case cause = "cause"
case message = "message"
case scheduledEventId = "scheduledEventId"
}
}
public struct StartTimerDecisionAttributes: AWSEncodableShape {
/// The data attached to the event that can be used by the decider in subsequent workflow tasks.
public let control: String?
/// The duration to wait before firing the timer. The duration is specified in seconds, an integer greater than or equal to 0.
public let startToFireTimeout: String
/// The unique ID of the timer. The specified string must not start or end with whitespace. It must not contain a : (colon), / (slash), | (vertical bar), or any control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not contain the literal string arn.
public let timerId: String
public init(control: String? = nil, startToFireTimeout: String, timerId: String) {
self.control = control
self.startToFireTimeout = startToFireTimeout
self.timerId = timerId
}
public func validate(name: String) throws {
try validate(self.control, name: "control", parent: name, max: 32768)
try validate(self.startToFireTimeout, name: "startToFireTimeout", parent: name, max: 8)
try validate(self.startToFireTimeout, name: "startToFireTimeout", parent: name, min: 1)
try validate(self.timerId, name: "timerId", parent: name, max: 256)
try validate(self.timerId, name: "timerId", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case control = "control"
case startToFireTimeout = "startToFireTimeout"
case timerId = "timerId"
}
}
public struct StartTimerFailedEventAttributes: AWSDecodableShape {
/// The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes. If cause is set to OPERATION_NOT_PERMITTED, the decision failed because it lacked sufficient permissions. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide.
public let cause: StartTimerFailedCause
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the StartTimer decision for this activity task. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
/// The timerId provided in the StartTimer decision that failed.
public let timerId: String
public init(cause: StartTimerFailedCause, decisionTaskCompletedEventId: Int64, timerId: String) {
self.cause = cause
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
self.timerId = timerId
}
private enum CodingKeys: String, CodingKey {
case cause = "cause"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
case timerId = "timerId"
}
}
public struct StartWorkflowExecutionInput: AWSEncodableShape {
/// If set, specifies the policy to use for the child workflow executions of this workflow execution if it is terminated, by calling the TerminateWorkflowExecution action explicitly or due to an expired timeout. This policy overrides the default child policy specified when registering the workflow type using RegisterWorkflowType. The supported child policies are: TERMINATE – The child executions are terminated. REQUEST_CANCEL – A request to cancel is attempted for each child execution by recording a WorkflowExecutionCancelRequested event in its history. It is up to the decider to take appropriate actions when it receives an execution history with this event. ABANDON – No action is taken. The child executions continue to run. A child policy for this workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default child policy was specified at registration time then a fault is returned.
public let childPolicy: ChildPolicy?
/// The name of the domain in which the workflow execution is created.
public let domain: String
/// The total duration for this workflow execution. This overrides the defaultExecutionStartToCloseTimeout specified when registering the workflow type. The duration is specified in seconds; an integer greater than or equal to 0. Exceeding this limit causes the workflow execution to time out. Unlike some of the other timeout parameters in Amazon SWF, you cannot specify a value of "NONE" for this timeout; there is a one-year max limit on the time that a workflow execution can run. An execution start-to-close timeout must be specified either through this parameter or as a default when the workflow type is registered. If neither this parameter nor a default execution start-to-close timeout is specified, a fault is returned.
public let executionStartToCloseTimeout: String?
/// The input for the workflow execution. This is a free form string which should be meaningful to the workflow you are starting. This input is made available to the new workflow execution in the WorkflowExecutionStarted history event.
public let input: String?
/// The IAM role to attach to this workflow execution. Executions of this workflow type need IAM roles to invoke Lambda functions. If you don't attach an IAM role, any attempt to schedule a Lambda task fails. This results in a ScheduleLambdaFunctionFailed history event. For more information, see https://docs.aws.amazon.com/amazonswf/latest/developerguide/lambda-task.html in the Amazon SWF Developer Guide.
public let lambdaRole: String?
/// The list of tags to associate with the workflow execution. You can specify a maximum of 5 tags. You can list workflow executions with a specific tag by calling ListOpenWorkflowExecutions or ListClosedWorkflowExecutions and specifying a TagFilter.
public let tagList: [String]?
/// The task list to use for the decision tasks generated for this workflow execution. This overrides the defaultTaskList specified when registering the workflow type. A task list for this workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default task list was specified at registration time then a fault is returned. The specified string must not start or end with whitespace. It must not contain a : (colon), / (slash), | (vertical bar), or any control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not be the literal string arn.
public let taskList: TaskList?
/// The task priority to use for this workflow execution. This overrides any default priority that was assigned when the workflow type was registered. If not set, then the default task priority for the workflow type is used. Valid values are integers that range from Java's Integer.MIN_VALUE (-2147483648) to Integer.MAX_VALUE (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see Setting Task Priority in the Amazon SWF Developer Guide.
public let taskPriority: String?
/// Specifies the maximum duration of decision tasks for this workflow execution. This parameter overrides the defaultTaskStartToCloseTimout specified when registering the workflow type using RegisterWorkflowType. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration. A task start-to-close timeout for this workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default task start-to-close timeout was specified at registration time then a fault is returned.
public let taskStartToCloseTimeout: String?
/// The user defined identifier associated with the workflow execution. You can use this to associate a custom identifier with the workflow execution. You may specify the same identifier if a workflow execution is logically a restart of a previous execution. You cannot have two open workflow executions with the same workflowId at the same time within the same domain. The specified string must not start or end with whitespace. It must not contain a : (colon), / (slash), | (vertical bar), or any control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not be the literal string arn.
public let workflowId: String
/// The type of the workflow to start.
public let workflowType: WorkflowType
public init(childPolicy: ChildPolicy? = nil, domain: String, executionStartToCloseTimeout: String? = nil, input: String? = nil, lambdaRole: String? = nil, tagList: [String]? = nil, taskList: TaskList? = nil, taskPriority: String? = nil, taskStartToCloseTimeout: String? = nil, workflowId: String, workflowType: WorkflowType) {
self.childPolicy = childPolicy
self.domain = domain
self.executionStartToCloseTimeout = executionStartToCloseTimeout
self.input = input
self.lambdaRole = lambdaRole
self.tagList = tagList
self.taskList = taskList
self.taskPriority = taskPriority
self.taskStartToCloseTimeout = taskStartToCloseTimeout
self.workflowId = workflowId
self.workflowType = workflowType
}
public func validate(name: String) throws {
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try validate(self.executionStartToCloseTimeout, name: "executionStartToCloseTimeout", parent: name, max: 8)
try validate(self.input, name: "input", parent: name, max: 32768)
try validate(self.lambdaRole, name: "lambdaRole", parent: name, max: 1600)
try validate(self.lambdaRole, name: "lambdaRole", parent: name, min: 1)
try self.tagList?.forEach {
try validate($0, name: "tagList[]", parent: name, max: 256)
try validate($0, name: "tagList[]", parent: name, min: 0)
}
try validate(self.tagList, name: "tagList", parent: name, max: 5)
try self.taskList?.validate(name: "\(name).taskList")
try validate(self.taskStartToCloseTimeout, name: "taskStartToCloseTimeout", parent: name, max: 8)
try validate(self.workflowId, name: "workflowId", parent: name, max: 256)
try validate(self.workflowId, name: "workflowId", parent: name, min: 1)
try self.workflowType.validate(name: "\(name).workflowType")
}
private enum CodingKeys: String, CodingKey {
case childPolicy = "childPolicy"
case domain = "domain"
case executionStartToCloseTimeout = "executionStartToCloseTimeout"
case input = "input"
case lambdaRole = "lambdaRole"
case tagList = "tagList"
case taskList = "taskList"
case taskPriority = "taskPriority"
case taskStartToCloseTimeout = "taskStartToCloseTimeout"
case workflowId = "workflowId"
case workflowType = "workflowType"
}
}
public struct TagFilter: AWSEncodableShape {
/// Specifies the tag that must be associated with the execution for it to meet the filter criteria. Tags may only contain unicode letters, digits, whitespace, or these symbols: _ . : / = + - @.
public let tag: String
public init(tag: String) {
self.tag = tag
}
public func validate(name: String) throws {
try validate(self.tag, name: "tag", parent: name, max: 256)
try validate(self.tag, name: "tag", parent: name, min: 0)
}
private enum CodingKeys: String, CodingKey {
case tag = "tag"
}
}
public struct TagResourceInput: AWSEncodableShape {
/// The Amazon Resource Name (ARN) for the Amazon SWF domain.
public let resourceArn: String
/// The list of tags to add to a domain. Tags may only contain unicode letters, digits, whitespace, or these symbols: _ . : / = + - @.
public let tags: [ResourceTag]
public init(resourceArn: String, tags: [ResourceTag]) {
self.resourceArn = resourceArn
self.tags = tags
}
public func validate(name: String) throws {
try validate(self.resourceArn, name: "resourceArn", parent: name, max: 1600)
try validate(self.resourceArn, name: "resourceArn", parent: name, min: 1)
try self.tags.forEach {
try $0.validate(name: "\(name).tags[]")
}
}
private enum CodingKeys: String, CodingKey {
case resourceArn = "resourceArn"
case tags = "tags"
}
}
public struct TaskList: AWSEncodableShape & AWSDecodableShape {
/// The name of the task list.
public let name: String
public init(name: String) {
self.name = name
}
public func validate(name: String) throws {
try validate(self.name, name: "name", parent: name, max: 256)
try validate(self.name, name: "name", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case name = "name"
}
}
public struct TerminateWorkflowExecutionInput: AWSEncodableShape {
/// If set, specifies the policy to use for the child workflow executions of the workflow execution being terminated. This policy overrides the child policy specified for the workflow execution at registration time or when starting the execution. The supported child policies are: TERMINATE – The child executions are terminated. REQUEST_CANCEL – A request to cancel is attempted for each child execution by recording a WorkflowExecutionCancelRequested event in its history. It is up to the decider to take appropriate actions when it receives an execution history with this event. ABANDON – No action is taken. The child executions continue to run. A child policy for this workflow execution must be specified either as a default for the workflow type or through this parameter. If neither this parameter is set nor a default child policy was specified at registration time then a fault is returned.
public let childPolicy: ChildPolicy?
/// Details for terminating the workflow execution.
public let details: String?
/// The domain of the workflow execution to terminate.
public let domain: String
/// A descriptive reason for terminating the workflow execution.
public let reason: String?
/// The runId of the workflow execution to terminate.
public let runId: String?
/// The workflowId of the workflow execution to terminate.
public let workflowId: String
public init(childPolicy: ChildPolicy? = nil, details: String? = nil, domain: String, reason: String? = nil, runId: String? = nil, workflowId: String) {
self.childPolicy = childPolicy
self.details = details
self.domain = domain
self.reason = reason
self.runId = runId
self.workflowId = workflowId
}
public func validate(name: String) throws {
try validate(self.details, name: "details", parent: name, max: 32768)
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try validate(self.reason, name: "reason", parent: name, max: 256)
try validate(self.runId, name: "runId", parent: name, max: 64)
try validate(self.workflowId, name: "workflowId", parent: name, max: 256)
try validate(self.workflowId, name: "workflowId", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case childPolicy = "childPolicy"
case details = "details"
case domain = "domain"
case reason = "reason"
case runId = "runId"
case workflowId = "workflowId"
}
}
public struct TimerCanceledEventAttributes: AWSDecodableShape {
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the CancelTimer decision to cancel this timer. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
/// The ID of the TimerStarted event that was recorded when this timer was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let startedEventId: Int64
/// The unique ID of the timer that was canceled.
public let timerId: String
public init(decisionTaskCompletedEventId: Int64, startedEventId: Int64, timerId: String) {
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
self.startedEventId = startedEventId
self.timerId = timerId
}
private enum CodingKeys: String, CodingKey {
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
case startedEventId = "startedEventId"
case timerId = "timerId"
}
}
public struct TimerFiredEventAttributes: AWSDecodableShape {
/// The ID of the TimerStarted event that was recorded when this timer was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let startedEventId: Int64
/// The unique ID of the timer that fired.
public let timerId: String
public init(startedEventId: Int64, timerId: String) {
self.startedEventId = startedEventId
self.timerId = timerId
}
private enum CodingKeys: String, CodingKey {
case startedEventId = "startedEventId"
case timerId = "timerId"
}
}
public struct TimerStartedEventAttributes: AWSDecodableShape {
/// Data attached to the event that can be used by the decider in subsequent workflow tasks.
public let control: String?
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the StartTimer decision for this activity task. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
/// The duration of time after which the timer fires. The duration is specified in seconds, an integer greater than or equal to 0.
public let startToFireTimeout: String
/// The unique ID of the timer that was started.
public let timerId: String
public init(control: String? = nil, decisionTaskCompletedEventId: Int64, startToFireTimeout: String, timerId: String) {
self.control = control
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
self.startToFireTimeout = startToFireTimeout
self.timerId = timerId
}
private enum CodingKeys: String, CodingKey {
case control = "control"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
case startToFireTimeout = "startToFireTimeout"
case timerId = "timerId"
}
}
public struct UndeprecateActivityTypeInput: AWSEncodableShape {
/// The activity type to undeprecate.
public let activityType: ActivityType
/// The name of the domain of the deprecated activity type.
public let domain: String
public init(activityType: ActivityType, domain: String) {
self.activityType = activityType
self.domain = domain
}
public func validate(name: String) throws {
try self.activityType.validate(name: "\(name).activityType")
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case activityType = "activityType"
case domain = "domain"
}
}
public struct UndeprecateDomainInput: AWSEncodableShape {
/// The name of the domain of the deprecated workflow type.
public let name: String
public init(name: String) {
self.name = name
}
public func validate(name: String) throws {
try validate(self.name, name: "name", parent: name, max: 256)
try validate(self.name, name: "name", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case name = "name"
}
}
public struct UndeprecateWorkflowTypeInput: AWSEncodableShape {
/// The name of the domain of the deprecated workflow type.
public let domain: String
/// The name of the domain of the deprecated workflow type.
public let workflowType: WorkflowType
public init(domain: String, workflowType: WorkflowType) {
self.domain = domain
self.workflowType = workflowType
}
public func validate(name: String) throws {
try validate(self.domain, name: "domain", parent: name, max: 256)
try validate(self.domain, name: "domain", parent: name, min: 1)
try self.workflowType.validate(name: "\(name).workflowType")
}
private enum CodingKeys: String, CodingKey {
case domain = "domain"
case workflowType = "workflowType"
}
}
public struct UntagResourceInput: AWSEncodableShape {
/// The Amazon Resource Name (ARN) for the Amazon SWF domain.
public let resourceArn: String
/// The list of tags to remove from the Amazon SWF domain.
public let tagKeys: [String]
public init(resourceArn: String, tagKeys: [String]) {
self.resourceArn = resourceArn
self.tagKeys = tagKeys
}
public func validate(name: String) throws {
try validate(self.resourceArn, name: "resourceArn", parent: name, max: 1600)
try validate(self.resourceArn, name: "resourceArn", parent: name, min: 1)
try self.tagKeys.forEach {
try validate($0, name: "tagKeys[]", parent: name, max: 128)
try validate($0, name: "tagKeys[]", parent: name, min: 1)
}
}
private enum CodingKeys: String, CodingKey {
case resourceArn = "resourceArn"
case tagKeys = "tagKeys"
}
}
public struct WorkflowExecution: AWSEncodableShape & AWSDecodableShape {
/// A system-generated unique identifier for the workflow execution.
public let runId: String
/// The user defined identifier associated with the workflow execution.
public let workflowId: String
public init(runId: String, workflowId: String) {
self.runId = runId
self.workflowId = workflowId
}
public func validate(name: String) throws {
try validate(self.runId, name: "runId", parent: name, max: 64)
try validate(self.runId, name: "runId", parent: name, min: 1)
try validate(self.workflowId, name: "workflowId", parent: name, max: 256)
try validate(self.workflowId, name: "workflowId", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case runId = "runId"
case workflowId = "workflowId"
}
}
public struct WorkflowExecutionCancelRequestedEventAttributes: AWSDecodableShape {
/// If set, indicates that the request to cancel the workflow execution was automatically generated, and specifies the cause. This happens if the parent workflow execution times out or is terminated, and the child policy is set to cancel child executions.
public let cause: WorkflowExecutionCancelRequestedCause?
/// The ID of the RequestCancelExternalWorkflowExecutionInitiated event corresponding to the RequestCancelExternalWorkflowExecution decision to cancel this workflow execution.The source event with this ID can be found in the history of the source workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let externalInitiatedEventId: Int64?
/// The external workflow execution for which the cancellation was requested.
public let externalWorkflowExecution: WorkflowExecution?
public init(cause: WorkflowExecutionCancelRequestedCause? = nil, externalInitiatedEventId: Int64? = nil, externalWorkflowExecution: WorkflowExecution? = nil) {
self.cause = cause
self.externalInitiatedEventId = externalInitiatedEventId
self.externalWorkflowExecution = externalWorkflowExecution
}
private enum CodingKeys: String, CodingKey {
case cause = "cause"
case externalInitiatedEventId = "externalInitiatedEventId"
case externalWorkflowExecution = "externalWorkflowExecution"
}
}
public struct WorkflowExecutionCanceledEventAttributes: AWSDecodableShape {
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the CancelWorkflowExecution decision for this cancellation request. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
/// The details of the cancellation.
public let details: String?
public init(decisionTaskCompletedEventId: Int64, details: String? = nil) {
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
self.details = details
}
private enum CodingKeys: String, CodingKey {
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
case details = "details"
}
}
public struct WorkflowExecutionCompletedEventAttributes: AWSDecodableShape {
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the CompleteWorkflowExecution decision to complete this execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
/// The result produced by the workflow execution upon successful completion.
public let result: String?
public init(decisionTaskCompletedEventId: Int64, result: String? = nil) {
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
self.result = result
}
private enum CodingKeys: String, CodingKey {
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
case result = "result"
}
}
public struct WorkflowExecutionConfiguration: AWSDecodableShape {
/// The policy to use for the child workflow executions if this workflow execution is terminated, by calling the TerminateWorkflowExecution action explicitly or due to an expired timeout. The supported child policies are: TERMINATE – The child executions are terminated. REQUEST_CANCEL – A request to cancel is attempted for each child execution by recording a WorkflowExecutionCancelRequested event in its history. It is up to the decider to take appropriate actions when it receives an execution history with this event. ABANDON – No action is taken. The child executions continue to run.
public let childPolicy: ChildPolicy
/// The total duration for this workflow execution. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let executionStartToCloseTimeout: String
/// The IAM role attached to the child workflow execution.
public let lambdaRole: String?
/// The task list used for the decision tasks generated for this workflow execution.
public let taskList: TaskList
/// The priority assigned to decision tasks for this workflow execution. Valid values are integers that range from Java's Integer.MIN_VALUE (-2147483648) to Integer.MAX_VALUE (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see Setting Task Priority in the Amazon SWF Developer Guide.
public let taskPriority: String?
/// The maximum duration allowed for decision tasks for this workflow execution. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let taskStartToCloseTimeout: String
public init(childPolicy: ChildPolicy, executionStartToCloseTimeout: String, lambdaRole: String? = nil, taskList: TaskList, taskPriority: String? = nil, taskStartToCloseTimeout: String) {
self.childPolicy = childPolicy
self.executionStartToCloseTimeout = executionStartToCloseTimeout
self.lambdaRole = lambdaRole
self.taskList = taskList
self.taskPriority = taskPriority
self.taskStartToCloseTimeout = taskStartToCloseTimeout
}
private enum CodingKeys: String, CodingKey {
case childPolicy = "childPolicy"
case executionStartToCloseTimeout = "executionStartToCloseTimeout"
case lambdaRole = "lambdaRole"
case taskList = "taskList"
case taskPriority = "taskPriority"
case taskStartToCloseTimeout = "taskStartToCloseTimeout"
}
}
public struct WorkflowExecutionContinuedAsNewEventAttributes: AWSDecodableShape {
/// The policy to use for the child workflow executions of the new execution if it is terminated by calling the TerminateWorkflowExecution action explicitly or due to an expired timeout. The supported child policies are: TERMINATE – The child executions are terminated. REQUEST_CANCEL – A request to cancel is attempted for each child execution by recording a WorkflowExecutionCancelRequested event in its history. It is up to the decider to take appropriate actions when it receives an execution history with this event. ABANDON – No action is taken. The child executions continue to run.
public let childPolicy: ChildPolicy
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the ContinueAsNewWorkflowExecution decision that started this execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
/// The total duration allowed for the new workflow execution. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let executionStartToCloseTimeout: String?
/// The input provided to the new workflow execution.
public let input: String?
/// The IAM role to attach to the new (continued) workflow execution.
public let lambdaRole: String?
/// The runId of the new workflow execution.
public let newExecutionRunId: String
/// The list of tags associated with the new workflow execution.
public let tagList: [String]?
/// The task list to use for the decisions of the new (continued) workflow execution.
public let taskList: TaskList
/// The priority of the task to use for the decisions of the new (continued) workflow execution.
public let taskPriority: String?
/// The maximum duration of decision tasks for the new workflow execution. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let taskStartToCloseTimeout: String?
/// The workflow type of this execution.
public let workflowType: WorkflowType
public init(childPolicy: ChildPolicy, decisionTaskCompletedEventId: Int64, executionStartToCloseTimeout: String? = nil, input: String? = nil, lambdaRole: String? = nil, newExecutionRunId: String, tagList: [String]? = nil, taskList: TaskList, taskPriority: String? = nil, taskStartToCloseTimeout: String? = nil, workflowType: WorkflowType) {
self.childPolicy = childPolicy
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
self.executionStartToCloseTimeout = executionStartToCloseTimeout
self.input = input
self.lambdaRole = lambdaRole
self.newExecutionRunId = newExecutionRunId
self.tagList = tagList
self.taskList = taskList
self.taskPriority = taskPriority
self.taskStartToCloseTimeout = taskStartToCloseTimeout
self.workflowType = workflowType
}
private enum CodingKeys: String, CodingKey {
case childPolicy = "childPolicy"
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
case executionStartToCloseTimeout = "executionStartToCloseTimeout"
case input = "input"
case lambdaRole = "lambdaRole"
case newExecutionRunId = "newExecutionRunId"
case tagList = "tagList"
case taskList = "taskList"
case taskPriority = "taskPriority"
case taskStartToCloseTimeout = "taskStartToCloseTimeout"
case workflowType = "workflowType"
}
}
public struct WorkflowExecutionCount: AWSDecodableShape {
/// The number of workflow executions.
public let count: Int
/// If set to true, indicates that the actual count was more than the maximum supported by this API and the count returned is the truncated value.
public let truncated: Bool?
public init(count: Int, truncated: Bool? = nil) {
self.count = count
self.truncated = truncated
}
private enum CodingKeys: String, CodingKey {
case count = "count"
case truncated = "truncated"
}
}
public struct WorkflowExecutionDetail: AWSDecodableShape {
/// The configuration settings for this workflow execution including timeout values, tasklist etc.
public let executionConfiguration: WorkflowExecutionConfiguration
/// Information about the workflow execution.
public let executionInfo: WorkflowExecutionInfo
/// The time when the last activity task was scheduled for this workflow execution. You can use this information to determine if the workflow has not made progress for an unusually long period of time and might require a corrective action.
public let latestActivityTaskTimestamp: TimeStamp?
/// The latest executionContext provided by the decider for this workflow execution. A decider can provide an executionContext (a free-form string) when closing a decision task using RespondDecisionTaskCompleted.
public let latestExecutionContext: String?
/// The number of tasks for this workflow execution. This includes open and closed tasks of all types.
public let openCounts: WorkflowExecutionOpenCounts
public init(executionConfiguration: WorkflowExecutionConfiguration, executionInfo: WorkflowExecutionInfo, latestActivityTaskTimestamp: TimeStamp? = nil, latestExecutionContext: String? = nil, openCounts: WorkflowExecutionOpenCounts) {
self.executionConfiguration = executionConfiguration
self.executionInfo = executionInfo
self.latestActivityTaskTimestamp = latestActivityTaskTimestamp
self.latestExecutionContext = latestExecutionContext
self.openCounts = openCounts
}
private enum CodingKeys: String, CodingKey {
case executionConfiguration = "executionConfiguration"
case executionInfo = "executionInfo"
case latestActivityTaskTimestamp = "latestActivityTaskTimestamp"
case latestExecutionContext = "latestExecutionContext"
case openCounts = "openCounts"
}
}
public struct WorkflowExecutionFailedEventAttributes: AWSDecodableShape {
/// The ID of the DecisionTaskCompleted event corresponding to the decision task that resulted in the FailWorkflowExecution decision to fail this execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let decisionTaskCompletedEventId: Int64
/// The details of the failure.
public let details: String?
/// The descriptive reason provided for the failure.
public let reason: String?
public init(decisionTaskCompletedEventId: Int64, details: String? = nil, reason: String? = nil) {
self.decisionTaskCompletedEventId = decisionTaskCompletedEventId
self.details = details
self.reason = reason
}
private enum CodingKeys: String, CodingKey {
case decisionTaskCompletedEventId = "decisionTaskCompletedEventId"
case details = "details"
case reason = "reason"
}
}
public struct WorkflowExecutionFilter: AWSEncodableShape {
/// The workflowId to pass of match the criteria of this filter.
public let workflowId: String
public init(workflowId: String) {
self.workflowId = workflowId
}
public func validate(name: String) throws {
try validate(self.workflowId, name: "workflowId", parent: name, max: 256)
try validate(self.workflowId, name: "workflowId", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case workflowId = "workflowId"
}
}
public struct WorkflowExecutionInfo: AWSDecodableShape {
/// Set to true if a cancellation is requested for this workflow execution.
public let cancelRequested: Bool?
/// If the execution status is closed then this specifies how the execution was closed: COMPLETED – the execution was successfully completed. CANCELED – the execution was canceled.Cancellation allows the implementation to gracefully clean up before the execution is closed. TERMINATED – the execution was force terminated. FAILED – the execution failed to complete. TIMED_OUT – the execution did not complete in the alloted time and was automatically timed out. CONTINUED_AS_NEW – the execution is logically continued. This means the current execution was completed and a new execution was started to carry on the workflow.
public let closeStatus: CloseStatus?
/// The time when the workflow execution was closed. Set only if the execution status is CLOSED.
public let closeTimestamp: TimeStamp?
/// The workflow execution this information is about.
public let execution: WorkflowExecution
/// The current status of the execution.
public let executionStatus: ExecutionStatus
/// If this workflow execution is a child of another execution then contains the workflow execution that started this execution.
public let parent: WorkflowExecution?
/// The time when the execution was started.
public let startTimestamp: TimeStamp
/// The list of tags associated with the workflow execution. Tags can be used to identify and list workflow executions of interest through the visibility APIs. A workflow execution can have a maximum of 5 tags.
public let tagList: [String]?
/// The type of the workflow execution.
public let workflowType: WorkflowType
public init(cancelRequested: Bool? = nil, closeStatus: CloseStatus? = nil, closeTimestamp: TimeStamp? = nil, execution: WorkflowExecution, executionStatus: ExecutionStatus, parent: WorkflowExecution? = nil, startTimestamp: TimeStamp, tagList: [String]? = nil, workflowType: WorkflowType) {
self.cancelRequested = cancelRequested
self.closeStatus = closeStatus
self.closeTimestamp = closeTimestamp
self.execution = execution
self.executionStatus = executionStatus
self.parent = parent
self.startTimestamp = startTimestamp
self.tagList = tagList
self.workflowType = workflowType
}
private enum CodingKeys: String, CodingKey {
case cancelRequested = "cancelRequested"
case closeStatus = "closeStatus"
case closeTimestamp = "closeTimestamp"
case execution = "execution"
case executionStatus = "executionStatus"
case parent = "parent"
case startTimestamp = "startTimestamp"
case tagList = "tagList"
case workflowType = "workflowType"
}
}
public struct WorkflowExecutionInfos: AWSDecodableShape {
/// The list of workflow information structures.
public let executionInfos: [WorkflowExecutionInfo]
/// If a NextPageToken was returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextPageToken. Keep all other arguments unchanged. The configured maximumPageSize determines how many results can be returned in a single call.
public let nextPageToken: String?
public init(executionInfos: [WorkflowExecutionInfo], nextPageToken: String? = nil) {
self.executionInfos = executionInfos
self.nextPageToken = nextPageToken
}
private enum CodingKeys: String, CodingKey {
case executionInfos = "executionInfos"
case nextPageToken = "nextPageToken"
}
}
public struct WorkflowExecutionOpenCounts: AWSDecodableShape {
/// The count of activity tasks whose status is OPEN.
public let openActivityTasks: Int
/// The count of child workflow executions whose status is OPEN.
public let openChildWorkflowExecutions: Int
/// The count of decision tasks whose status is OPEN. A workflow execution can have at most one open decision task.
public let openDecisionTasks: Int
/// The count of Lambda tasks whose status is OPEN.
public let openLambdaFunctions: Int?
/// The count of timers started by this workflow execution that have not fired yet.
public let openTimers: Int
public init(openActivityTasks: Int, openChildWorkflowExecutions: Int, openDecisionTasks: Int, openLambdaFunctions: Int? = nil, openTimers: Int) {
self.openActivityTasks = openActivityTasks
self.openChildWorkflowExecutions = openChildWorkflowExecutions
self.openDecisionTasks = openDecisionTasks
self.openLambdaFunctions = openLambdaFunctions
self.openTimers = openTimers
}
private enum CodingKeys: String, CodingKey {
case openActivityTasks = "openActivityTasks"
case openChildWorkflowExecutions = "openChildWorkflowExecutions"
case openDecisionTasks = "openDecisionTasks"
case openLambdaFunctions = "openLambdaFunctions"
case openTimers = "openTimers"
}
}
public struct WorkflowExecutionSignaledEventAttributes: AWSDecodableShape {
/// The ID of the SignalExternalWorkflowExecutionInitiated event corresponding to the SignalExternalWorkflow decision to signal this workflow execution.The source event with this ID can be found in the history of the source workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event. This field is set only if the signal was initiated by another workflow execution.
public let externalInitiatedEventId: Int64?
/// The workflow execution that sent the signal. This is set only of the signal was sent by another workflow execution.
public let externalWorkflowExecution: WorkflowExecution?
/// The inputs provided with the signal. The decider can use the signal name and inputs to determine how to process the signal.
public let input: String?
/// The name of the signal received. The decider can use the signal name and inputs to determine how to the process the signal.
public let signalName: String
public init(externalInitiatedEventId: Int64? = nil, externalWorkflowExecution: WorkflowExecution? = nil, input: String? = nil, signalName: String) {
self.externalInitiatedEventId = externalInitiatedEventId
self.externalWorkflowExecution = externalWorkflowExecution
self.input = input
self.signalName = signalName
}
private enum CodingKeys: String, CodingKey {
case externalInitiatedEventId = "externalInitiatedEventId"
case externalWorkflowExecution = "externalWorkflowExecution"
case input = "input"
case signalName = "signalName"
}
}
public struct WorkflowExecutionStartedEventAttributes: AWSDecodableShape {
/// The policy to use for the child workflow executions if this workflow execution is terminated, by calling the TerminateWorkflowExecution action explicitly or due to an expired timeout. The supported child policies are: TERMINATE – The child executions are terminated. REQUEST_CANCEL – A request to cancel is attempted for each child execution by recording a WorkflowExecutionCancelRequested event in its history. It is up to the decider to take appropriate actions when it receives an execution history with this event. ABANDON – No action is taken. The child executions continue to run.
public let childPolicy: ChildPolicy
/// If this workflow execution was started due to a ContinueAsNewWorkflowExecution decision, then it contains the runId of the previous workflow execution that was closed and continued as this execution.
public let continuedExecutionRunId: String?
/// The maximum duration for this workflow execution. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let executionStartToCloseTimeout: String?
/// The input provided to the workflow execution.
public let input: String?
/// The IAM role attached to the workflow execution.
public let lambdaRole: String?
/// The ID of the StartChildWorkflowExecutionInitiated event corresponding to the StartChildWorkflowExecution Decision to start this workflow execution. The source event with this ID can be found in the history of the source workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
public let parentInitiatedEventId: Int64?
/// The source workflow execution that started this workflow execution. The member isn't set if the workflow execution was not started by a workflow.
public let parentWorkflowExecution: WorkflowExecution?
/// The list of tags associated with this workflow execution. An execution can have up to 5 tags.
public let tagList: [String]?
/// The name of the task list for scheduling the decision tasks for this workflow execution.
public let taskList: TaskList
/// The priority of the decision tasks in the workflow execution.
public let taskPriority: String?
/// The maximum duration of decision tasks for this workflow type. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let taskStartToCloseTimeout: String?
/// The workflow type of this execution.
public let workflowType: WorkflowType
public init(childPolicy: ChildPolicy, continuedExecutionRunId: String? = nil, executionStartToCloseTimeout: String? = nil, input: String? = nil, lambdaRole: String? = nil, parentInitiatedEventId: Int64? = nil, parentWorkflowExecution: WorkflowExecution? = nil, tagList: [String]? = nil, taskList: TaskList, taskPriority: String? = nil, taskStartToCloseTimeout: String? = nil, workflowType: WorkflowType) {
self.childPolicy = childPolicy
self.continuedExecutionRunId = continuedExecutionRunId
self.executionStartToCloseTimeout = executionStartToCloseTimeout
self.input = input
self.lambdaRole = lambdaRole
self.parentInitiatedEventId = parentInitiatedEventId
self.parentWorkflowExecution = parentWorkflowExecution
self.tagList = tagList
self.taskList = taskList
self.taskPriority = taskPriority
self.taskStartToCloseTimeout = taskStartToCloseTimeout
self.workflowType = workflowType
}
private enum CodingKeys: String, CodingKey {
case childPolicy = "childPolicy"
case continuedExecutionRunId = "continuedExecutionRunId"
case executionStartToCloseTimeout = "executionStartToCloseTimeout"
case input = "input"
case lambdaRole = "lambdaRole"
case parentInitiatedEventId = "parentInitiatedEventId"
case parentWorkflowExecution = "parentWorkflowExecution"
case tagList = "tagList"
case taskList = "taskList"
case taskPriority = "taskPriority"
case taskStartToCloseTimeout = "taskStartToCloseTimeout"
case workflowType = "workflowType"
}
}
public struct WorkflowExecutionTerminatedEventAttributes: AWSDecodableShape {
/// If set, indicates that the workflow execution was automatically terminated, and specifies the cause. This happens if the parent workflow execution times out or is terminated and the child policy is set to terminate child executions.
public let cause: WorkflowExecutionTerminatedCause?
/// The policy used for the child workflow executions of this workflow execution. The supported child policies are: TERMINATE – The child executions are terminated. REQUEST_CANCEL – A request to cancel is attempted for each child execution by recording a WorkflowExecutionCancelRequested event in its history. It is up to the decider to take appropriate actions when it receives an execution history with this event. ABANDON – No action is taken. The child executions continue to run.
public let childPolicy: ChildPolicy
/// The details provided for the termination.
public let details: String?
/// The reason provided for the termination.
public let reason: String?
public init(cause: WorkflowExecutionTerminatedCause? = nil, childPolicy: ChildPolicy, details: String? = nil, reason: String? = nil) {
self.cause = cause
self.childPolicy = childPolicy
self.details = details
self.reason = reason
}
private enum CodingKeys: String, CodingKey {
case cause = "cause"
case childPolicy = "childPolicy"
case details = "details"
case reason = "reason"
}
}
public struct WorkflowExecutionTimedOutEventAttributes: AWSDecodableShape {
/// The policy used for the child workflow executions of this workflow execution. The supported child policies are: TERMINATE – The child executions are terminated. REQUEST_CANCEL – A request to cancel is attempted for each child execution by recording a WorkflowExecutionCancelRequested event in its history. It is up to the decider to take appropriate actions when it receives an execution history with this event. ABANDON – No action is taken. The child executions continue to run.
public let childPolicy: ChildPolicy
/// The type of timeout that caused this event.
public let timeoutType: WorkflowExecutionTimeoutType
public init(childPolicy: ChildPolicy, timeoutType: WorkflowExecutionTimeoutType) {
self.childPolicy = childPolicy
self.timeoutType = timeoutType
}
private enum CodingKeys: String, CodingKey {
case childPolicy = "childPolicy"
case timeoutType = "timeoutType"
}
}
public struct WorkflowType: AWSEncodableShape & AWSDecodableShape {
/// The name of the workflow type. The combination of workflow type name and version must be unique with in a domain.
public let name: String
/// The version of the workflow type. The combination of workflow type name and version must be unique with in a domain.
public let version: String
public init(name: String, version: String) {
self.name = name
self.version = version
}
public func validate(name: String) throws {
try validate(self.name, name: "name", parent: name, max: 256)
try validate(self.name, name: "name", parent: name, min: 1)
try validate(self.version, name: "version", parent: name, max: 64)
try validate(self.version, name: "version", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case name = "name"
case version = "version"
}
}
public struct WorkflowTypeConfiguration: AWSDecodableShape {
/// The default policy to use for the child workflow executions when a workflow execution of this type is terminated, by calling the TerminateWorkflowExecution action explicitly or due to an expired timeout. This default can be overridden when starting a workflow execution using the StartWorkflowExecution action or the StartChildWorkflowExecution Decision. The supported child policies are: TERMINATE – The child executions are terminated. REQUEST_CANCEL – A request to cancel is attempted for each child execution by recording a WorkflowExecutionCancelRequested event in its history. It is up to the decider to take appropriate actions when it receives an execution history with this event. ABANDON – No action is taken. The child executions continue to run.
public let defaultChildPolicy: ChildPolicy?
/// The default maximum duration, specified when registering the workflow type, for executions of this workflow type. This default can be overridden when starting a workflow execution using the StartWorkflowExecution action or the StartChildWorkflowExecution Decision. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let defaultExecutionStartToCloseTimeout: String?
/// The default IAM role attached to this workflow type. Executions of this workflow type need IAM roles to invoke Lambda functions. If you don't specify an IAM role when starting this workflow type, the default Lambda role is attached to the execution. For more information, see https://docs.aws.amazon.com/amazonswf/latest/developerguide/lambda-task.html in the Amazon SWF Developer Guide.
public let defaultLambdaRole: String?
/// The default task list, specified when registering the workflow type, for decisions tasks scheduled for workflow executions of this type. This default can be overridden when starting a workflow execution using the StartWorkflowExecution action or the StartChildWorkflowExecution Decision.
public let defaultTaskList: TaskList?
/// The default task priority, specified when registering the workflow type, for all decision tasks of this workflow type. This default can be overridden when starting a workflow execution using the StartWorkflowExecution action or the StartChildWorkflowExecution decision. Valid values are integers that range from Java's Integer.MIN_VALUE (-2147483648) to Integer.MAX_VALUE (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see Setting Task Priority in the Amazon SWF Developer Guide.
public let defaultTaskPriority: String?
/// The default maximum duration, specified when registering the workflow type, that a decision task for executions of this workflow type might take before returning completion or failure. If the task doesn'tdo close in the specified time then the task is automatically timed out and rescheduled. If the decider eventually reports a completion or failure, it is ignored. This default can be overridden when starting a workflow execution using the StartWorkflowExecution action or the StartChildWorkflowExecution Decision. The duration is specified in seconds, an integer greater than or equal to 0. You can use NONE to specify unlimited duration.
public let defaultTaskStartToCloseTimeout: String?
public init(defaultChildPolicy: ChildPolicy? = nil, defaultExecutionStartToCloseTimeout: String? = nil, defaultLambdaRole: String? = nil, defaultTaskList: TaskList? = nil, defaultTaskPriority: String? = nil, defaultTaskStartToCloseTimeout: String? = nil) {
self.defaultChildPolicy = defaultChildPolicy
self.defaultExecutionStartToCloseTimeout = defaultExecutionStartToCloseTimeout
self.defaultLambdaRole = defaultLambdaRole
self.defaultTaskList = defaultTaskList
self.defaultTaskPriority = defaultTaskPriority
self.defaultTaskStartToCloseTimeout = defaultTaskStartToCloseTimeout
}
private enum CodingKeys: String, CodingKey {
case defaultChildPolicy = "defaultChildPolicy"
case defaultExecutionStartToCloseTimeout = "defaultExecutionStartToCloseTimeout"
case defaultLambdaRole = "defaultLambdaRole"
case defaultTaskList = "defaultTaskList"
case defaultTaskPriority = "defaultTaskPriority"
case defaultTaskStartToCloseTimeout = "defaultTaskStartToCloseTimeout"
}
}
public struct WorkflowTypeDetail: AWSDecodableShape {
/// Configuration settings of the workflow type registered through RegisterWorkflowType
public let configuration: WorkflowTypeConfiguration
/// General information about the workflow type. The status of the workflow type (returned in the WorkflowTypeInfo structure) can be one of the following. REGISTERED – The type is registered and available. Workers supporting this type should be running. DEPRECATED – The type was deprecated using DeprecateWorkflowType, but is still in use. You should keep workers supporting this type running. You cannot create new workflow executions of this type.
public let typeInfo: WorkflowTypeInfo
public init(configuration: WorkflowTypeConfiguration, typeInfo: WorkflowTypeInfo) {
self.configuration = configuration
self.typeInfo = typeInfo
}
private enum CodingKeys: String, CodingKey {
case configuration = "configuration"
case typeInfo = "typeInfo"
}
}
public struct WorkflowTypeFilter: AWSEncodableShape {
/// Name of the workflow type.
public let name: String
/// Version of the workflow type.
public let version: String?
public init(name: String, version: String? = nil) {
self.name = name
self.version = version
}
public func validate(name: String) throws {
try validate(self.name, name: "name", parent: name, max: 256)
try validate(self.name, name: "name", parent: name, min: 1)
try validate(self.version, name: "version", parent: name, max: 64)
}
private enum CodingKeys: String, CodingKey {
case name = "name"
case version = "version"
}
}
public struct WorkflowTypeInfo: AWSDecodableShape {
/// The date when this type was registered.
public let creationDate: TimeStamp
/// If the type is in deprecated state, then it is set to the date when the type was deprecated.
public let deprecationDate: TimeStamp?
/// The description of the type registered through RegisterWorkflowType.
public let description: String?
/// The current status of the workflow type.
public let status: RegistrationStatus
/// The workflow type this information is about.
public let workflowType: WorkflowType
public init(creationDate: TimeStamp, deprecationDate: TimeStamp? = nil, description: String? = nil, status: RegistrationStatus, workflowType: WorkflowType) {
self.creationDate = creationDate
self.deprecationDate = deprecationDate
self.description = description
self.status = status
self.workflowType = workflowType
}
private enum CodingKeys: String, CodingKey {
case creationDate = "creationDate"
case deprecationDate = "deprecationDate"
case description = "description"
case status = "status"
case workflowType = "workflowType"
}
}
public struct WorkflowTypeInfos: AWSDecodableShape {
/// If a NextPageToken was returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextPageToken. Keep all other arguments unchanged. The configured maximumPageSize determines how many results can be returned in a single call.
public let nextPageToken: String?
/// The list of workflow type information.
public let typeInfos: [WorkflowTypeInfo]
public init(nextPageToken: String? = nil, typeInfos: [WorkflowTypeInfo]) {
self.nextPageToken = nextPageToken
self.typeInfos = typeInfos
}
private enum CodingKeys: String, CodingKey {
case nextPageToken = "nextPageToken"
case typeInfos = "typeInfos"
}
}
}
| [
-1
] |
6ba07803b71331314cd81acde7e760029e6cc932 | 2dd443eec7248cc76906744494dfdad872e4276f | /3 - Navigation and Workflows/1 - Optionals/lab/solution/Lab - Optionals.playground/Pages/3. Exercise - Functions and Optionals.xcplaygroundpage/Contents.swift | 5bfe13ebc72f0c31c6928545e9786927fe49cd46 | [] | no_license | HANICA-MAD/AppDevSwiftBook | 266eebbb4fd6a45275466034a5170eaa6b5df1ad | 14b41e5d372cc5ad212fc4bbbbd1fd452f0e6270 | refs/heads/master | 2020-04-21T01:25:45.398190 | 2019-02-05T10:35:23 | 2019-02-05T10:35:23 | 169,223,387 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,629 | swift | /*:
## Exercise - Functions and Optionals
If an app asks for a user's age, it may be because the app requires a user to be over a certain age to use some of the services it provides. Write a function called `checkAge` that takes one parameter of type `String`. The function should try to convert this parameter into an `Int` value and then check if the user is over 18 years old. If he/she is old enough, print "Welcome!", otherwise print "Sorry, but you aren't old enough to use our app." If the `String` parameter cannot be converted into an `Int` value, print "Sorry, something went wrong. Can you please re-enter your age?" Call the function and pass in `userInputAge` below as the single parameter. Then call the function and pass in a string that can be converted to an integer.
*/
let userInputAge: String = "34e"
func checkAge(age: String) -> Int? {
if let age = Int(age) {
if age >= 18 {
print("Welcome!")
} else {
print("Sorry, but you aren't old enough to use our app.")
}
return age
} else {
print("Sorry, something went wrong. Can you please re-endter your age?")
return nil
}
}
checkAge(age: userInputAge)
print(checkAge(age: "17"))
/*:
Go back and update your function to return the age as an integer. Will your function always return a value? Make sure your return type accurately reflects this. Call the function and print the return value.
*/
print(checkAge(age: userInputAge))
print(checkAge(age: "20"))
/*:
Imagine you are creating an app for making purchases. Write a function that will take in the name of an item for purchase as a `String` and will return the cost of that item as an optional `Double`. In the body of the function, check to see if the item is in stock by accessing it in the dictionary `stock`. If it is, return the price of the item by accessing it in the dictionary `prices`. If the item is out of stock, return `nil`. Call the function and pass in a `String` that exists in the dictionaries below. Print the return value.
*/
var prices = ["Chips": 2.99, "Donuts": 1.89, "Juice": 3.99, "Apple": 0.50, "Banana": 0.25, "Broccoli": 0.99]
var stock = ["Chips": 4, "Donuts": 0, "Juice": 12, "Apple": 6, "Banana": 6, "Broccoli": 3]
func price(item: String) -> Double? {
if let stock = stock[item] {
if stock > 0 {
return prices[item]
} else {
return nil
}
} else {
return nil
}
}
print(price(item: "Donuts"))
print(price(item: "Juice"))
//: [Previous](@previous) | page 3 of 6 | [Next: App Exercise - Food Functions](@next)
| [
-1
] |
3e21a426505391b045d36740397ff4556c870c88 | c5f43cd27b3bf15e1d5cc74d62b51bd8daf2e145 | /zundoko/zundoko/Array.swift | da6fb29e595c766de699901ec2dbe3055ee245a0 | [
"WTFPL"
] | permissive | el-hoshino/zundoko | af900c514dba624cb51781d14fd74f5c231f7098 | 23e1fbbed386a0a9dbc27e1c03b5656e590b53a2 | refs/heads/master | 2021-04-03T09:24:04.818436 | 2018-03-08T17:11:23 | 2018-03-08T17:11:23 | 124,416,633 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 517 | swift | //
// Array.swift
// zundoko
//
// Created by 史翔新 on 2018/03/09.
// Copyright © 2018年 史翔新. All rights reserved.
//
import Foundation
extension Array {
var random: Element? {
guard self.isEmpty == false else { return nil }
let randomIndex = arc4random_uniform(UInt32(self.count))
return self[Int(randomIndex)]
}
mutating func keepLast(_ n: Int = 1) {
guard self.count > n else { return }
let removingElementsCount = self.count - n
self.removeFirst(removingElementsCount)
}
}
| [
-1
] |
43d8ff4556253a4b35c30b5d15a031aaa621f4d9 | 14e554ecf0b2a776f0e82ad0d1b1e21f59a77f29 | /animal-mvvm/animal-mvvm/View Contorllers/ViewController.swift | 507909f51429be148731ce97535f19d01d08c8e0 | [] | no_license | mdo91/ios-mvvm-2 | aeea6e832446ed7f78bfcb8207458cee829265d6 | b859c119e4d3939a1c6b41a0da73cb1b346674a5 | refs/heads/master | 2023-06-02T16:32:00.574418 | 2021-07-03T20:01:19 | 2021-07-03T20:01:19 | 327,980,194 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 273 | swift | //
// ViewController.swift
// animal-mvvm
//
// Created by Mdo on 10/05/2021.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
| [
391441,
125202,
409238,
352920,
411673,
399130,
155424,
340649,
325690,
343233,
351170,
413252,
399958,
337752,
402524,
389725,
416479,
354144,
425824,
197471,
437220,
340851,
248953,
286846
] |
aae8088f344602e5951d00e4238cf7c7f92d8364 | 9fdc79d70dc7f527046246d212d0b4a2f9164b6f | /Calculator/ViewController.swift | d26f474bcccf23f90e2e99ef484d3b65b2d80b3c | [] | no_license | Nurtilek-Nurbekov/Calcuclator | c2cb6ad471e1ff9db5cbedb72b77122c0e3d9e5c | 55d7ca3363504dbcc715b7798b21198ec8c6c7ec | refs/heads/main | 2023-02-03T09:50:18.960310 | 2020-12-27T16:11:38 | 2020-12-27T16:11:38 | 324,820,610 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 275 | swift | //
// ViewController.swift
// Calculator
//
// Created by Nurtilek on 27/12/20.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
| [
254464,
253058,
327555,
398203,
225157,
356742,
384145,
391441,
409238,
375576,
384153,
399130,
258589,
254494,
155551,
155424,
187937,
345378,
436128,
254497,
254495,
397091,
351400,
384300,
356652,
380334,
366385,
319284,
383797,
396725,
402616,
397114,
378171,
181692,
319165,
111292,
384447,
266816,
360903,
359368,
437582,
330960,
346065,
146645,
257750,
399958,
402524,
362845,
412766,
399201,
418146,
332513,
257638,
384103,
257641,
257642,
374122,
352876,
376687,
349297,
210674,
344695,
211833,
320506,
361595
] |
d362ffeaede4b8fe75c5e9e32a16b01da627f549 | af3ac3f4371082542e7da6e02b3523444c0565d9 | /Sources/QuranKit/AyahNumber.swift | bcdcd02861674f7f9aa43b52b17d6fc72d0d3605 | [
"Apache-2.0"
] | permissive | abdelouali/quran-ios | 6cbae7851f0e118207164682f9808281b6d472b9 | c23eab5b312c47d7d300ab1d318bfa9f508fa39e | refs/heads/main | 2023-04-18T15:13:58.013487 | 2023-04-08T12:02:29 | 2023-04-08T12:02:29 | 57,238,698 | 0 | 0 | null | 2016-04-27T19:00:54 | 2016-04-27T19:00:54 | null | UTF-8 | Swift | false | false | 2,132 | swift | //
// AyahNumber.swift
// Quran
//
// Created by Mohamed Afifi on 4/24/16.
//
// Quran for iOS is a Quran reading application for iOS.
// Copyright (C) 2017 Quran.com
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
import Foundation
public struct AyahNumber: Navigatable {
public var quran: Quran { sura.quran }
public let sura: Sura
public let ayah: Int
public init?(quran: Quran, sura: Int, ayah: Int) {
guard let sura = Sura(quran: quran, suraNumber: sura) else {
return nil
}
self.init(sura: sura, ayah: ayah)
}
public init?(sura: Sura, ayah: Int) {
if !(1 ... sura.numberOfVerses).contains(ayah) {
return nil
}
self.sura = sura
self.ayah = ayah
}
public var description: String {
"<AyahNumber sura=\(sura.suraNumber) ayah=\(ayah)>"
}
public static func < (lhs: AyahNumber, rhs: AyahNumber) -> Bool {
if lhs.sura == rhs.sura {
return lhs.ayah < rhs.ayah
}
return lhs.sura < rhs.sura
}
public var previous: AyahNumber? {
if self != sura.firstVerse {
// same sura
return AyahNumber(sura: sura, ayah: ayah - 1)
}
// previous sura, last verse
return sura.previous?.lastVerse
}
public var next: AyahNumber? {
if self != sura.lastVerse {
// same sura
return AyahNumber(sura: sura, ayah: ayah + 1)
}
// next sura, first verse
return sura.next?.firstVerse
}
public var page: Page {
quran.pages.binarySearchFirst { self >= $0.firstVerse }
}
}
| [
-1
] |
be68a497f17b30e0172ca137bb34c5be6d709f6f | ca34919011a1fc057105d2decdb7a8cfffb66517 | /Sources/S3/URLBuilder/URLBuilder.swift | da5e206dace5ba3a7acdd41af4ee58a75c8149fc | [
"MIT"
] | permissive | dpgao/S3 | f014fd2d56c90bebc6c5bc3d80cb6ad1a45740b6 | 9f5e3ae65ad063d891c34b9ce3de7649009bda48 | refs/heads/master | 2020-04-14T16:31:05.105955 | 2020-02-20T13:48:58 | 2020-02-20T13:48:58 | 241,894,439 | 0 | 0 | MIT | 2020-02-20T13:43:55 | 2020-02-20T13:43:54 | null | UTF-8 | Swift | false | false | 1,304 | swift | //
// URLBuilder.swift
// S3
//
// Created by Ondrej Rafaj on 16/05/2018.
//
import Foundation
import Vapor
import S3Signer
extension Region {
/// Host URL including scheme
public func hostUrlString(bucket: String? = nil) -> String {
if let bucket = bucket {
return urlProtocol + host.finished(with: "/") + bucket
}
return urlProtocol + host.finished(with: "/")
}
private var urlProtocol: String {
return useTLS ? "https://" : "http://"
}
}
/// URL builder
public protocol URLBuilder {
/// Initializer
init(_ container: Container, defaultBucket: String, config: S3Signer.Config)
/// Plain Base URL with no bucket specified
/// *Format: https://s3.eu-west-2.amazonaws.com/
func plain(region: Region?) throws -> URL
/// Base URL for S3 region
/// *Format: https://bucket.s3.eu-west-2.amazonaws.com/path_or_parameter*
func url(region: Region?, bucket: String?, path: String?) throws -> URL
/// Base URL for a file in a bucket
/// * Format: https://s3.eu-west-2.amazonaws.com/bucket/file.txt
/// * We can't have a bucket in the host or DELETE will attempt to delete the bucket, not file!
func url(file: LocationConvertible) throws -> URL
}
| [
-1
] |
d88405cd0b5d80aa99c77f5230e4020abb034e3f | 56f42ed5bccf3d254eba5babcf42df08e75b6183 | /Example/RxCocoa-Texture/RepoProvider.swift | dfa1a3e81908499f01ff16870216979400af3b22 | [
"MIT"
] | permissive | jjhyuk/RxCocoa-Texture | 1c1b6959b9c67f78218e28dc86ca56585b1c8a90 | ae09fe8352fbe46de9382456395cc4536e47a411 | refs/heads/master | 2023-08-11T14:28:53.333242 | 2021-10-11T09:45:14 | 2021-10-11T09:45:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,762 | swift | //
// RepoProvider.swift
//
// Created by Geektree0101.
// Copyright © 2018 RxSwiftCommunity. All rights reserved.
//
import Foundation
import RxSwift
import RxCocoa
struct RepoProvider {
private static let repoRelay = BehaviorRelay<[Int: (repo: Repository, count: Int, updatedAt: Date)]>(value: [:])
private static let repoObservable = repoRelay
.asObservable()
.subscribe(on: SerialDispatchQueueScheduler(queue: queue, internalSerialQueueName: UUID().uuidString))
.share(replay: 1, scope: .whileConnected)
private static let queue = DispatchQueue(label: "RepoProvider.RxMVVMTexture.com", qos: .utility)
static func addAndUpdate(_ repo: Repository) {
queue.async {
var repoValue = self.repoRelay.value
if let record = repoValue[repo.id] {
record.repo.merge(repo)
repoValue[repo.id] = (repo: record.repo, count: record.count + 1, updatedAt: Date())
} else {
repoValue[repo.id] = (repo: repo, count: 1, updatedAt: Date())
}
self.repoRelay.accept(repoValue)
}
}
static func update(_ repo: Repository) {
queue.async {
var repoValue = self.repoRelay.value
if let record = repoValue[repo.id] {
record.repo.merge(repo)
repoValue[repo.id] = (repo: record.repo, count: record.count, updatedAt: Date())
}
self.repoRelay.accept(repoValue)
}
}
static func retain(id: Int) {
queue.async {
var repoValue = self.repoRelay.value
var record = repoValue[id]
guard record != nil else { return }
record?.count += 1
repoValue[id] = record
self.repoRelay.accept(repoValue)
}
}
static func release(id: Int) {
queue.async {
var repoValue = self.repoRelay.value
var record = repoValue[id]
guard record != nil else { return }
record?.count -= 1
if record?.count ?? 0 < 1 {
record = nil
}
repoValue[id] = record
self.repoRelay.accept(repoValue)
}
}
static func repo(id: Int) -> Repository? {
var repo: Repository?
queue.sync {
repo = self.repoRelay.value[id]?.repo
}
return repo
}
static func observable(id: Int) -> Observable<Repository?> {
return repoObservable
.map { $0[id] }
.distinctUntilChanged { $0?.updatedAt == $1?.updatedAt }
.map { $0?.repo }
.share(replay: 1, scope: .whileConnected)
}
}
| [
-1
] |
9f59dd2c6b34d054d4ba20518176701ca797699b | ae21606594b203a9498023ca297e160d14bda71e | /UnstoppableWallet/UnstoppableWallet/Modules/SendNft/Eip1155/IntegerAmountInput/IntegerFormAmountInputView.swift | 31cba27b345cf86d9b7ce7b5a1b83e7ac68623fa | [
"MIT"
] | permissive | horizontalsystems/unstoppable-wallet-ios | adfee34f60be6ecc553ac6f101e7c36d2c9fa962 | 6ce0b2c787e1d5429cc276e14166869859d5c3a1 | refs/heads/master | 2023-09-01T19:24:01.146797 | 2023-09-01T11:26:39 | 2023-09-01T11:28:28 | 142,568,914 | 546 | 207 | MIT | 2023-09-14T12:55:39 | 2018-07-27T11:27:32 | Swift | UTF-8 | Swift | false | false | 2,273 | swift | import UIKit
import ThemeKit
import SnapKit
import RxSwift
class IntegerFormAmountInputView: UIView {
private let viewModel: IntegerAmountInputViewModel
private let disposeBag = DisposeBag()
private let amountInputView = IntegerAmountInputView()
init(viewModel: IntegerAmountInputViewModel) {
self.viewModel = viewModel
super.init(frame: .zero)
backgroundColor = .clear
addSubview(amountInputView)
amountInputView.snp.makeConstraints { maker in
maker.edges.equalToSuperview()
}
amountInputView.isValidText = { [weak self] in self?.viewModel.isValid(amount: $0) ?? true }
amountInputView.onChangeText = { [weak self] in self?.viewModel.onChange(amount: $0) }
amountInputView.onTapMax = { [weak self] in self?.viewModel.onTapMax() }
subscribe(disposeBag, viewModel.amountDriver) { [weak self] in self?.set(amount: $0) }
subscribe(disposeBag, viewModel.isMaxEnabledDriver) { [weak self] in self?.amountInputView.maxButtonVisible = $0 }
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func becomeFirstResponder() -> Bool {
amountInputView.becomeFirstResponder()
}
private func set(amount: String?) {
guard amountInputView.inputText != amount && !viewModel.equalValue(lhs: amountInputView.inputText, rhs: amount) else { //avoid issue with point ("1" and "1.")
return
}
amountInputView.inputText = amount
}
}
extension IntegerFormAmountInputView {
var viewHeight: CGFloat {
amountInputView.viewHeight
}
var editable: Bool {
get { amountInputView.editable }
set { amountInputView.editable = newValue }
}
var clearHidden: Bool {
get { amountInputView.clearHidden }
set { amountInputView.clearHidden = newValue }
}
}
extension IntegerFormAmountInputView: IHeightControlView {
var onChangeHeight: (() -> ())? {
get { amountInputView.onChangeHeight }
set { amountInputView.onChangeHeight = newValue }
}
func height(containerWidth: CGFloat) -> CGFloat {
amountInputView.height(containerWidth: containerWidth)
}
}
| [
-1
] |
411d6b16355fee7c8b61176dd5e8641f487cb3c5 | 5a6ce002d980094bbb676fc4120d78e06b741b4a | /Sources/GLSceneLib/Reactive/EventMap.swift | 06d1c003e4277752d1dbc27ac8d3c195a58d5dd3 | [] | no_license | omochi/GLSceneLib | 182cb57906340f74e19c0daf012533e04684c543 | f86eeac43355f4f3965af57a2b311c1b91120225 | refs/heads/master | 2021-07-17T19:08:02.328920 | 2017-10-24T04:55:48 | 2017-10-24T04:55:48 | 107,650,405 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,025 | swift | public class EventSourceMap<TSource: EventSourceProtocol, U> : EventSourceProtocol {
public typealias T = TSource.Event
public init(_ source: TSource, _ f: @escaping (T) -> U) {
self.source = source
self.f = f
}
public func addHandler(_ handler: @escaping (U) -> ()) -> Disposer {
let sink = Sink(f, handler)
return source.addHandler { sink.send($0) }
}
private class Sink {
public init(
_ f: @escaping (T) -> U,
_ handler: @escaping (U) -> Void)
{
self.f = { (t: T) in
let u: U = f(t)
handler(u)
}
}
public func send(_ t: T) {
f(t)
}
private let f: (T) -> Void
}
private let source: TSource
private let f: (T) -> U
}
extension EventSourceProtocol {
public func map<U>(_ f: @escaping (Event) -> U) -> EventSource<U> {
return EventSourceMap(self, f).asEventSource()
}
}
| [
-1
] |
5c49facc43fe55842c29efa806db14558afb3ceb | d8f4fe2e8ce9d883d20fb28fd24535465874ee43 | /runtime/Swift/Antlr4/org/antlr/v4/runtime/CommonToken.swift | f9d8541ff2c9145af891fdd125cfa8c3a2eacd68 | [
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause"
] | permissive | janyou/antlr4 | 05eb51e3d0cbf2ac5e08136247d307dd490683e8 | 57d8cc2e0cf51273bd39b0e0af4045fa24be4713 | refs/heads/master | 2020-06-29T02:44:14.022632 | 2016-12-14T00:11:26 | 2016-12-14T00:11:26 | 72,973,348 | 0 | 0 | null | 2016-11-06T06:04:25 | 2016-11-06T06:04:23 | null | UTF-8 | Swift | false | false | 7,756 | swift | /* Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
public class CommonToken: WritableToken {
/**
* An empty {@link org.antlr.v4.runtime.misc.Pair} which is used as the default value of
* {@link #source} for tokens that do not have a source.
*/
internal static let EMPTY_SOURCE: (TokenSource?, CharStream?) = (nil, nil)
/**
* This is the backing field for {@link #getType} and {@link #setType}.
*/
internal var type: Int
/**
* This is the backing field for {@link #getLine} and {@link #setLine}.
*/
internal var line: Int = 0
/**
* This is the backing field for {@link #getCharPositionInLine} and
* {@link #setCharPositionInLine}.
*/
internal var charPositionInLine: Int = -1
// set to invalid position
/**
* This is the backing field for {@link #getChannel} and
* {@link #setChannel}.
*/
internal var channel: Int = DEFAULT_CHANNEL
/**
* This is the backing field for {@link #getTokenSource} and
* {@link #getInputStream}.
*
* <p>
* These properties share a field to reduce the memory footprint of
* {@link org.antlr.v4.runtime.CommonToken}. Tokens created by a {@link org.antlr.v4.runtime.CommonTokenFactory} from
* the same source and input stream share a reference to the same
* {@link org.antlr.v4.runtime.misc.Pair} containing these values.</p>
*/
internal var source: (TokenSource?, CharStream?)
/**
* This is the backing field for {@link #getText} when the token text is
* explicitly set in the constructor or via {@link #setText}.
*
* @see #getText()
*/
internal var text: String?
/**
* This is the backing field for {@link #getTokenIndex} and
* {@link #setTokenIndex}.
*/
internal var index: Int = -1
/**
* This is the backing field for {@link #getStartIndex} and
* {@link #setStartIndex}.
*/
internal var start: Int = 0
/**
* This is the backing field for {@link #getStopIndex} and
* {@link #setStopIndex}.
*/
internal var stop: Int = 0
/**
* Constructs a new {@link org.antlr.v4.runtime.CommonToken} with the specified token type.
*
* @param type The token type.
*/
private var _visited: Bool = false
public init(_ type: Int) {
self.type = type
self.source = CommonToken.EMPTY_SOURCE
}
public init(_ source: (TokenSource?, CharStream?), _ type: Int, _ channel: Int, _ start: Int, _ stop: Int) {
self.source = source
self.type = type
self.channel = channel
self.start = start
self.stop = stop
if let tsource = source.0 {
self.line = tsource.getLine()
self.charPositionInLine = tsource.getCharPositionInLine()
}
}
/**
* Constructs a new {@link org.antlr.v4.runtime.CommonToken} with the specified token type and
* text.
*
* @param type The token type.
* @param text The text of the token.
*/
public init(_ type: Int, _ text: String?) {
self.type = type
self.channel = CommonToken.DEFAULT_CHANNEL
self.text = text
self.source = CommonToken.EMPTY_SOURCE
}
/**
* Constructs a new {@link org.antlr.v4.runtime.CommonToken} as a copy of another {@link org.antlr.v4.runtime.Token}.
*
* <p>
* If {@code oldToken} is also a {@link org.antlr.v4.runtime.CommonToken} instance, the newly
* constructed token will share a reference to the {@link #text} field and
* the {@link org.antlr.v4.runtime.misc.Pair} stored in {@link #source}. Otherwise, {@link #text} will
* be assigned the result of calling {@link #getText}, and {@link #source}
* will be constructed from the result of {@link org.antlr.v4.runtime.Token#getTokenSource} and
* {@link org.antlr.v4.runtime.Token#getInputStream}.</p>
*
* @param oldToken The token to copy.
*/
public init(_ oldToken: Token) {
type = oldToken.getType()
line = oldToken.getLine()
index = oldToken.getTokenIndex()
charPositionInLine = oldToken.getCharPositionInLine()
channel = oldToken.getChannel()
start = oldToken.getStartIndex()
stop = oldToken.getStopIndex()
if oldToken is CommonToken {
text = (oldToken as! CommonToken).text
source = (oldToken as! CommonToken).source
} else {
text = oldToken.getText()
source = (oldToken.getTokenSource(), oldToken.getInputStream())
}
}
public func getType() -> Int {
return type
}
public func setLine(_ line: Int) {
self.line = line
}
public func getText() -> String? {
if text != nil {
return text!
}
if let input = getInputStream() {
let n: Int = input.size()
if start < n && stop < n {
return input.getText(Interval.of(start, stop))
} else {
return "<EOF>"
}
}
return nil
}
/**
* Explicitly set the text for this token. If {code text} is not
* {@code null}, then {@link #getText} will return this value rather than
* extracting the text from the input.
*
* @param text The explicit text of the token, or {@code null} if the text
* should be obtained from the input along with the start and stop indexes
* of the token.
*/
public func setText(_ text: String) {
self.text = text
}
public func getLine() -> Int {
return line
}
public func getCharPositionInLine() -> Int {
return charPositionInLine
}
public func setCharPositionInLine(_ charPositionInLine: Int) {
self.charPositionInLine = charPositionInLine
}
public func getChannel() -> Int {
return channel
}
public func setChannel(_ channel: Int) {
self.channel = channel
}
public func setType(_ type: Int) {
self.type = type
}
public func getStartIndex() -> Int {
return start
}
public func setStartIndex(_ start: Int) {
self.start = start
}
public func getStopIndex() -> Int {
return stop
}
public func setStopIndex(_ stop: Int) {
self.stop = stop
}
public func getTokenIndex() -> Int {
return index
}
public func setTokenIndex(_ index: Int) {
self.index = index
}
public func getTokenSource() -> TokenSource? {
return source.0
}
public func getInputStream() -> CharStream? {
return source.1
}
public var description: String {
var channelStr: String = ""
if channel > 0 {
channelStr = "channel=\(channel)"
}
var txt: String
if let tokenText = getText() {
txt = tokenText.replaceAll("\n", replacement: "\\n")
txt = txt.replaceAll("\r", replacement: "\\r")
txt = txt.replaceAll("\t", replacement: "\\t")
} else {
txt = "<no text>"
}
let desc: StringBuilder = StringBuilder()
desc.append("[@\(getTokenIndex()),")
desc.append("\(start):\(stop)='\(txt)',")
desc.append("<\(type)>\(channelStr),")
desc.append("\(line):\(getCharPositionInLine())]")
return desc.toString()
}
public var visited: Bool {
get {
return _visited
}
set {
_visited = newValue
}
}
}
| [
-1
] |
97643de8fd9647e04f5010ee895902227bc8ee60 | 2ece5bf4a84d08c44e4e1058bcc7f23caaa13890 | /Styleout Watches/Controller/GetQuotationController.swift | 77a5c715786d1f7eff9e48afbdeebca74ec4104e | [] | no_license | zohaib319/Styleout-IOS | 9ce37ac7bd676770124db2f6b18677387edd6c87 | db5bc6a9621ad33537967e4221f766b5fe338cd3 | refs/heads/master | 2022-04-28T16:18:00.730240 | 2020-04-26T05:56:29 | 2020-04-26T05:56:29 | 254,336,806 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 347 | swift | //
// GetQuotationController.swift
// Styleout Watches
//
// Created by Zohaib on 23/04/2020.
// Copyright © 2020 Zohaib. All rights reserved.
//
import UIKit
class GetQuotationController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
| [
-1
] |
c3c3fbc338c3d8a01a385162c0cc138696de7a3a | b401b12bf89e0676f686a9b1d8a0d554e56cba43 | /Sources/UIKIt/UIViewExtensions.swift | 6c63f7d2adc5505564cee32ca881322064d7acef | [
"MIT"
] | permissive | dalu93/SwiftHelpSet | c3321735653bd63d07404eea86f0a5b781493051 | b01dda4540e94c01c537167ad2ab615c77330b24 | refs/heads/master | 2020-04-12T06:30:07.226396 | 2016-09-16T11:34:03 | 2016-09-16T11:34:03 | 64,469,136 | 9 | 2 | null | 2016-08-20T14:47:09 | 2016-07-29T09:36:22 | Swift | UTF-8 | Swift | false | false | 4,765 | swift | //
// UIViewExtensions.swift
// SwiftHelpSet
//
// Created by Luca D'Alberti on 7/29/16.
// Copyright © 2016 dalu93. All rights reserved.
//
import UIKit
// MARK: - UIView support
public extension UIView {
/**
Pins the view to the superview edges (Top, Bottom, Trailing and Leading).
The superview property of the view cannot be nil
- parameter edge: The edge to constraint
*/
public func pinToSuperView(edge: ViewEdgeType) {
let superview = _setup()
switch edge {
case .all:
pinToSuperView(edge: .top)
pinToSuperView(edge: .bottom)
pinToSuperView(edge: .leading)
pinToSuperView(edge: .trailing)
case .top:
superview.addConstraint(
.PinTop(
view: self,
superview: superview
)
)
case .bottom:
superview.addConstraint(
.PinBottom(
view: self,
superview: superview
)
)
case .leading:
superview.addConstraint(
.PinLeading(
view: self,
superview: superview
)
)
case .trailing:
superview.addConstraint(
.PinTrailing(
view: self,
superview: superview
)
)
}
}
public func centerInSuperview() {
let superview = _setup()
superview.addConstraints(NSLayoutConstraint.Center(view: self, on: superview))
}
/**
Pins a dimension or both
- parameter dimension: Dimension description
*/
public func pin(dimension: ViewDimensionType) {
let superview = _setup()
switch dimension {
case .all(let width, let height):
pin(dimension: .height(height))
pin(dimension: .width(width))
case .height(let height):
superview.addConstraint(
NSLayoutConstraint.PinHeight(
view: self,
value: height
)
)
case .width(let width):
superview.addConstraint(
NSLayoutConstraint.PinWidth(
view: self,
value: width
)
)
}
}
/**
Makes a `UIView` instance rounded with a specific `radius`
- parameter radius: The radius
*/
public func roundWith(radius: CGFloat) {
self.clipsToBounds = true
self.layer.cornerRadius = radius
}
/**
Animates the `UIView` changes in the `animations` closure
- parameter animations: The closure with view changes
- parameter duration: The duration
- parameter completion: The completion closure
*/
static func animate(with animations: @escaping () -> (), duration: TimeInterval, completion: @escaping ((Bool) -> ()) = { _ in }) {
UIView.animate(
withDuration: duration,
animations: animations,
completion: completion
)
}
}
// MARK: - UIActivityIndicator shortcut
public extension UIView {
/**
Creates and return a centered UIActivityIndicatorView with a specific style.
The UIActivityIndicatorView is initialized with the property
`hidesWhenStopped` equal to `true`. It is, then, added in the view hierarchy.
- Note: Please, do not add again the UIActivityIndicatorView to your view
hiearchy. It is already added.
- parameter style: The UIActivityIndicatorViewStyle
- returns: A centered UIActivityIndicatorView instance
*/
public func centeredActivityIndicatorView(with style: UIActivityIndicatorViewStyle) -> UIActivityIndicatorView {
let indicator = UIActivityIndicatorView(activityIndicatorStyle: style)
indicator.hidesWhenStopped = true
indicator.translatesAutoresizingMaskIntoConstraints = false
addSubview(indicator)
addConstraints(NSLayoutConstraint.Center(view: indicator, on: self))
return indicator
}
}
// MARK: - Helpers
private extension UIView {
func _setup() -> UIView {
guard let superview = superview else { fatalError("The view has no superview in this moment: \(#line)") }
translatesAutoresizingMaskIntoConstraints = false
return superview
}
}
| [
-1
] |
d28d3455f2ae71e093e7937c9d87b590f2e232fe | 1d17fd7dc96a5b07a64276860c4d4d5d007d9063 | /LoginPage/FundooNotes/Util/UIHelper.swift | 9170a5b5006a84479c96ebc0e6ed6cd61bf5324a | [] | no_license | pratikzanjurne/Swift_Demo_Apps | fe3b6f5f8e0aa7db79dac301c941ef1dbbedd774 | d59dc14b1d3485cead6dbe5072b9d30d0980664c | refs/heads/master | 2020-03-25T18:14:41.905422 | 2018-10-06T13:49:12 | 2018-10-06T13:49:12 | 144,020,269 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,500 | swift | import Foundation
import UIKit
class UIHelper {
static let shared = UIHelper()
private init(){
}
func postNotification(Name:String){
NotificationCenter.default.post(name: NSNotification.Name(Name), object: nil)
}
func givePlaceholder(textView:UITextView,placeholder:String){
if textView.text == ""{
textView.text = placeholder
textView.textColor = UIColor.lightGray
}
}
func removePlaceholder(textview:UITextView,placeholder:String){
if textview.text == placeholder{
textview.text = ""
textview.textColor = UIColor.black
}
}
func setShadow(view:UIView){
view.layer.shadowColor = UIColor.lightGray.cgColor
view.layer.shadowOffset = CGSize(width:0,height: 0)
view.layer.shadowRadius = 2
view.layer.shadowOpacity = 0.5
view.layer.masksToBounds = false;
}
func setCornerRadius(view:UIView ,radius:CGFloat){
view.layer.cornerRadius = radius
view.layer.borderWidth = 1.0
view.layer.borderColor = UIColor.clear.cgColor
view.layer.masksToBounds = true;
}
}
//extension UIView {
//
// func withPadding(padding: UIEdgeInsets) -> UIView {
// let container = UIView()
// container.addSubview(self)
// snp_makeConstraints { make in
// make.edges.equalTo(container).inset(padding)
// }
// return container
// }
//}
| [
-1
] |
af6037a72320b84116b7f7a82dd4892a38ac0a6a | 743ecc430d019942519cafb91cd036bb1b790709 | /LadoTsivtsivadze_55/Infrastructure/Protocols/DataSource/TableViewDataSource.swift | 3ee33cb83eef6368946c168da41670a52b09c401 | [] | no_license | Ladolado3911/LadoTsivtsivadze_55 | 15d74fe86432385b02d33e0f2bde03f79c715f32 | b2f2c66b98d5436ccc1d54c03430a6faf74dfd89 | refs/heads/main | 2023-06-24T12:54:45.127931 | 2021-07-17T14:04:39 | 2021-07-17T14:04:39 | 386,675,682 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,049 | swift | //
// TableDataSource.swift
// LadoTsivtsivadze_51
//
// Created by lado tsivtsivadze on 7/13/21.
//
import UIKit
protocol TableViewDataSource: TableDataSource {
associatedtype DataArray
associatedtype RootController
associatedtype Element
var tableview: UITableView! { get set }
var cellsArr: [Cell]! { get set }
init(tableView tblView: UITableView,
cellsArray arr: [Cell],
rootController controller: RootController,
dataArray data: DataArray,
dataElement element: Element)
init(tableView tblView: UITableView,
cellsArray arr: [Cell],
rootController controller: RootController,
count data: Int)
func configTable()
func configCells()
}
extension TableViewDataSource {
func configTable() {
self.tableview.dataSource = self
self.tableview.delegate = self
}
func configCells() {
cellsArr.forEach { cell in
let nib = UINib(nibName: cell.nibName, bundle: nil)
self.tableview.register(nib, forCellReuseIdentifier: cell.identifier)
}
}
}
class GenericTableDataSource<T, E, F>: NSObject, TableViewDataSource {
typealias DataArray = T
typealias RootController = E
typealias Element = F
var tableview: UITableView!
var cellsArr: [Cell]!
var rootController: RootController!
var data: DataArray?
var element: Element!
var count: Int?
var counter: Int {
if let data = self.data as? Array<Any> {
print("here")
return data.count
}
else {
print("here2")
return count ?? 0
}
}
required init(tableView tblView: UITableView,
cellsArray arr: [Cell],
rootController controller: RootController,
dataArray data: DataArray,
dataElement element: Element) {
super.init()
self.tableview = tblView
self.cellsArr = arr
self.rootController = controller
self.data = data
self.element = element
self.configTable()
self.configCells()
self.tableview.reloadData()
}
required init(tableView tblView: UITableView,
cellsArray arr: [Cell],
rootController controller: RootController,
count counter: Int) {
super.init()
self.tableview = tblView
self.cellsArr = arr
self.rootController = controller
self.count = counter
self.configTable()
self.configCells()
self.tableview.reloadData()
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
print(counter)
return counter
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
return UITableViewCell()
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 50
}
}
| [
-1
] |
b5cf5cbd2e73f4e46a63dcbab15713c025ed6fc9 | 89f399ca7c772ef5caa241e176baaeff3de95d60 | /CPT331.iOS/CPT331.iOS/UIView.swift | 86e23d86195ef9cddb8a3de605ddbcd6972e1c56 | [] | no_license | coreyjenkins/CPT331 | d3c087ee1c6b26b5007983fad16fddbbd46b02ad | 7a1d97cee6a29578e0308c7742f3f54d9133f840 | refs/heads/master | 2021-04-09T13:34:10.632847 | 2016-11-18T00:53:08 | 2016-11-18T00:53:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,334 | swift | //
// UIView.swift
// CPT331.iOS
//
// Created by Peter Weller on 7/10/2016.
// Copyright © 2016 Peter Weller. All rights reserved.
//
import UIKit
extension UIView {
/**
Forces the view to match the frame size of its parent view by setting top, trailing, bottom & leading constraints.
- Parameters:
- view: the specified view must be the parent view
*/
func sizeToFit(parent parentView:UIView) {
self.translatesAutoresizingMaskIntoConstraints = false
parentView.addConstraints([
NSLayoutConstraint(item: self, attribute: .Top, relatedBy: .Equal, toItem: parentView, attribute: .Top, multiplier: 1, constant: 0),
NSLayoutConstraint(item: self, attribute: .Trailing, relatedBy: .Equal, toItem: parentView, attribute: .Trailing, multiplier: 1, constant: 0),
NSLayoutConstraint(item: self, attribute: .Bottom, relatedBy: .Equal, toItem: parentView, attribute: .Bottom, multiplier: 1, constant: 0),
NSLayoutConstraint(item: self, attribute: .Leading, relatedBy: .Equal, toItem: parentView, attribute: .Leading, multiplier: 1, constant: 0)
])
}
/**
Adds a loading indicator to the center of the view.
- Parameters:
- style: the style of the indicator view: .Gray, .White, .WhiteLarge
- Returns: the loading indicator subview so that it can be later hidden by calling indicator.removeFromSuperView()
*/
func showLoadingIndicator(style style:UIActivityIndicatorViewStyle = .Gray) -> UIActivityIndicatorView {
let indicator = UIActivityIndicatorView(frame: self.bounds)
indicator.activityIndicatorViewStyle = style
indicator.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
indicator.userInteractionEnabled = false
self.addSubview(indicator)
indicator.startAnimating()
return indicator
}
/**
Adds UILabel to the center of the view.
- Parameters:
- message: the message to be displayed, default: "Network Connection Required"
- fontSize: label font size, default: 15
- color: label color, default: dark grey
- Returns: the label subview so that it can be later hidden by calling label.removeFromSuperView()
*/
func showMessage(message:String, fontSize:CGFloat = 15, color:UIColor = UIColor(red: 0.1, green: 0.1, blue: 0.1, alpha: 0.7)) -> UILabel {
let label = UILabel(frame: self.bounds)
// Formatting
label.text = message
label.textColor = color
label.textAlignment = .Center
label.font = UIFont.systemFontOfSize(fontSize)
label.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
self.addSubview(label)
return label
}
/**
Adds a network required message to the center of the view.
- Returns: the label subview so that it can be later hidden by calling label.removeFromSuperView()
*/
func showNetworkMissingMessage(message:String="Network Connection Required", color:UIColor = UIColor(red: 0.1, green: 0.1, blue: 0.1, alpha: 0.7)) -> UILabel {
return self.showMessage("Network Connection Required")
}
} | [
-1
] |
716ec6a49ff3c11dba5726f1f9546a654888db9e | 8cb165d98f81aa51e12b0a1b26545001ba02895d | /FunAdsCoreKit/02.Private/Viewcontroller/TacoDialogView.swift | 550d44f33d2c3fcd385e36453f44925d53cae7f5 | [] | no_license | trinhson97/FunAdsCoreKit | a7ad2e6a9367a17071b6bc7ca6f71a21fea4ebcf | 20ba1a459bfc9f5fa6ecef3a2cdb91c7a2cc5e22 | refs/heads/master | 2023-08-04T11:20:16.807686 | 2021-09-18T03:50:45 | 2021-09-18T03:50:45 | 387,277,465 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 1,022 | swift |
import UIKit
class TacoDialogView: MessageView {
fileprivate static var tacoTitles = [
1 : "Just one, Please",
2 : "Make it two!",
3 : "Three!!!",
4 : "Cuatro!!!!",
]
var getTacosAction: ((_ count: Int) -> Void)?
var cancelAction: (() -> Void)?
fileprivate var count = 1 {
didSet {
iconLabel?.text = String(repeating: "🌮", count: count)//String(count: count, repeatedValue: )
bodyLabel?.text = TacoDialogView.tacoTitles[count] ?? "\(count)" + String(repeating: "!", count: count)
}
}
@IBAction func getTacos() {
getTacosAction?(Int(tacoSlider.value))
}
@IBAction func cancel() {
cancelAction?()
}
@IBOutlet weak var tacoSlider: UISlider!
@IBAction func tacoSliderSlid(_ slider: UISlider) {
count = Int(slider.value)
}
@IBAction func tacoSliderFinished(_ slider: UISlider) {
slider.setValue(Float(count), animated: true)
}
}
| [
-1
] |
5e9478228157f3b73e5f6c2073f14a114b752472 | 5d22b205467aa952da6224bfa5a9d35f2b432122 | /MMPDF_iOS/MMPDF_iOS/Detail/View/MMOutlineItemCell.swift | e01f8da690dfc1c2dcd1e1cad65b7e9426e9aa65 | [
"MIT"
] | permissive | mumuWorld/MMPDFPlayer | 69dcfe6cf13d554a4edfb92818d55f697424f2e7 | 76ba635886a1bfb8d46ed7c7cee71ed8dc4f26d1 | refs/heads/main | 2023-07-14T16:01:31.848559 | 2021-08-15T15:15:47 | 2021-08-15T15:15:47 | 390,958,797 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,053 | swift | //
// MMOutlineItemCell.swift
// MMPDF_iOS
//
// Created by Mumu on 2021/8/7.
//
import UIKit
class MMOutlineItemCell: UITableViewCell {
var item: MMPDFOutlineItem? {
didSet {
guard let t_item = item else { return }
titleLabel.font = getFitFont(item: t_item)
titleLabel.text = t_item.outline.label
title_leading.constant = CGFloat(t_item.level * 16 + 8)
pageCountLabel.text = t_item.outline.destination?.page?.label
}
}
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var title_leading: NSLayoutConstraint!
@IBOutlet weak var pageCountLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
}
func getFitFont(item: MMPDFOutlineItem) -> UIFont {
if item.level == 0 {
return UIFont.systemFont(ofSize: 17, weight: .medium)
} else {
let size = max(10, 17 - item.level)
return UIFont.systemFont(ofSize: CGFloat(size))
}
}
}
| [
-1
] |
7848a9292f4aa41f30a5d521428b6aee8daf7ab2 | 4caf1bcca35351eb08aee8acf67651e71be0cd8f | /FlicksBox/FlicksBox/ViewControllers/Profile/ProfilePasswordInputsView.swift | d05a65d54b755fe39abfd1a9e0a21bbb43fb547c | [] | 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 | 5,376 | swift | //
// ProfileNameInputsView.swift
// FlicksBox
//
// Created by Alkirys on 04.06.2021.
//
import UIKit
import Botticelli
final class ProfilePasswordInputsView: SBView {
let oldPasswordLabel: SBLabel
let oldPasswordInput: SBTextField
let newPasswordLabel: SBLabel
let newPasswordInput: SBTextField
let againPasswordLabel: SBLabel
let againPasswordInput: SBTextField
override init(frame: CGRect) {
oldPasswordLabel = SBLabel()
oldPasswordInput = SBTextField()
newPasswordLabel = SBLabel()
newPasswordInput = SBTextField()
againPasswordLabel = SBLabel()
againPasswordInput = SBTextField()
super.init(frame: frame)
addSubview(oldPasswordLabel)
addSubview(oldPasswordInput)
addSubview(newPasswordLabel)
addSubview(newPasswordInput)
addSubview(againPasswordLabel)
addSubview(againPasswordInput)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func configureSubviews() {
configurateOldPasswordLabel()
configurateOldPasswordInput()
configurateNewPasswordLabel()
configurateNewPasswordInput()
configurateAgainPasswordLabel()
configurateAgainPasswordInput()
}
override func layoutSubviews() {
super.layoutSubviews()
configurateView()
configureSubviews()
}
private func configurateView() {
self.backgroundColor = UIColor(red: 18/255, green: 17/255, blue: 16/255, alpha: 1)
self.layer.masksToBounds = true
self.layer.cornerRadius = 5
}
func getData() -> UserPassword {
return UserPassword(
new_password: newPasswordInput.text ?? "",
old_password: oldPasswordInput.text ?? "",
repeated_new_password: againPasswordInput.text ?? ""
)
}
private func configurateOldPasswordLabel() {
oldPasswordLabel.frame = CGRect(
x: self.bounds.minX + self.bounds.width * 0.15,
y: 0,
width: self.bounds.width / 2,
height: 20
)
oldPasswordLabel.text = "Старый пароль"
oldPasswordLabel.textColor = UIColor.white
oldPasswordLabel.font = UIFont.systemFont(ofSize: 20)
addSubview(oldPasswordLabel)
}
private func configurateOldPasswordInput() {
oldPasswordInput.frame = CGRect(
x: self.bounds.minX + self.bounds.width * 0.15,
y: self.bounds.minY + 30,
width: self.bounds.width * 0.7,
height: 40
)
oldPasswordInput.textColor = .black
oldPasswordInput.tintColor = .black
oldPasswordInput.isSecureTextEntry = true
oldPasswordInput.backgroundColor = UIColor(red: 250/255, green: 250/255, blue: 250/255, alpha: 1)
oldPasswordInput.layer.cornerRadius = 5
oldPasswordInput.font = UIFont.systemFont(ofSize: 20)
addSubview(oldPasswordInput)
}
private func configurateNewPasswordLabel() {
newPasswordLabel.frame = CGRect(
x: self.bounds.minX + self.bounds.width * 0.15,
y: self.bounds.minY + 80,
width: self.bounds.width / 2,
height: 20
)
newPasswordLabel.text = "Новый пароль"
newPasswordLabel.textColor = UIColor.white
newPasswordLabel.font = UIFont.systemFont(ofSize: 20)
addSubview(newPasswordLabel)
}
private func configurateNewPasswordInput() {
newPasswordInput.frame = CGRect(
x: self.bounds.minX + self.bounds.width * 0.15,
y: self.bounds.minY + 110,
width: self.bounds.width * 0.7,
height: 40
)
newPasswordInput.textColor = .black
newPasswordInput.tintColor = .black
newPasswordInput.isSecureTextEntry = true
newPasswordInput.backgroundColor = UIColor(red: 250/255, green: 250/255, blue: 250/255, alpha: 1)
newPasswordInput.layer.cornerRadius = 5
newPasswordInput.font = UIFont.systemFont(ofSize: 20)
addSubview(newPasswordInput)
}
private func configurateAgainPasswordLabel() {
againPasswordLabel.frame = CGRect(
x: self.bounds.minX + self.bounds.width * 0.15,
y: self.bounds.minY + 160,
width: self.bounds.width,
height: 20
)
againPasswordLabel.text = "Повторите пароль"
againPasswordLabel.textColor = UIColor.white
againPasswordLabel.font = UIFont.systemFont(ofSize: 20)
addSubview(againPasswordLabel)
}
private func configurateAgainPasswordInput() {
againPasswordInput.frame = CGRect(
x: self.bounds.minX + self.bounds.width * 0.15,
y: self.bounds.minY + 190,
width: self.bounds.width * 0.7,
height: 40
)
againPasswordInput.textColor = .black
againPasswordInput.tintColor = .black
againPasswordInput.isSecureTextEntry = true
againPasswordInput.backgroundColor = UIColor(red: 250/255, green: 250/255, blue: 250/255, alpha: 1)
againPasswordInput.layer.cornerRadius = 5
againPasswordInput.font = UIFont.systemFont(ofSize: 20)
addSubview(againPasswordInput)
}
}
| [
-1
] |
18325ead0384821cae28664338df31e3f356e020 | 0d90aea62bb73099e910db12dc290edda275b84d | /VideoCache/Classes/ResourceLoader.swift | 37fcfbad5242026117c933da7de0aed41bc1b2ea | [
"MIT"
] | permissive | 7ulipa/VideoCache | a807374c64aa9eb0c2e7b7f6618fa4d168593b90 | bbcaa78d92c767ff939a33d41c946998913a1be0 | refs/heads/master | 2020-12-02T10:04:57.346575 | 2017-08-17T08:01:51 | 2017-08-17T08:01:51 | 96,688,684 | 7 | 4 | null | 2017-07-11T07:22:02 | 2017-07-09T14:13:28 | Swift | UTF-8 | Swift | false | false | 660 | swift | //
// ResourceLoader.swift
// Pods
//
// Created by DirGoTii on 02/07/2017.
//
//
import Foundation
import AVFoundation
class ResourceLoader {
static let shared = ResourceLoader()
func load(request: AVAssetResourceLoadingRequest, for asset: AVURLAsset) -> Bool {
if let url = request.request.url {
CacheManager.shared.cache(for: url).load(request: request, for: asset)
return true
}
return false
}
func cancel(request: AVAssetResourceLoadingRequest) {
if let url = request.request.url {
CacheManager.shared.cache(for: url).cancel(request: request)
}
}
}
| [
-1
] |
c089768ef91da8e6e7228bee25a3270b8c812fe9 | 696c0ea066b1dcd8afe03d8b3d01f36b5baeb79e | /beefboard/Controllers/PostsController.swift | 4e1336b390ac868a90f43439d9a1699745fbbaa3 | [] | no_license | beefboard/ios | db4264ee2e36dab71e08db72d502e9affbbcb83d | a67cd20cce4835034d0e252aef7d6a36648a901b | refs/heads/master | 2020-04-13T05:51:43.567837 | 2018-12-14T17:17:35 | 2018-12-14T17:17:35 | 163,005,332 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 10,244 | swift | //
// PostsController.swift
//
// The "main" page of Beefboard, shows a list
// of posts in chronological order
//
//
// Created by Oliver on 02/11/2018.
// Copyright © 2018 Oliver Bell. All rights reserved.
//
import UIKit
import PromiseKit
import AwaitKit
class PostsController: UITableViewController {
@IBOutlet weak var navigationBar: UINavigationItem!
var postsDataSource = PostsDataModel()
private var authSource = AuthModel()
private var auth: User?
private var pinnedPosts: [Post] = []
private var posts: [Post] = []
private var refresher: UIRefreshControl?
private var activityIndicator: UIActivityIndicatorView!
override func viewDidLoad() {
super.viewDidLoad()
// Allow peek and poping
self.registerForPreviewing(with: self, sourceView: tableView)
self.postsDataSource.delegate = self
self.authSource.delegate = self
self.refreshControl?.addTarget(self, action: #selector(PostsController.refreshPosts(refreshControl:)), for: UIControl.Event.valueChanged)
// Show an activity icon
self.activityIndicator = UIActivityIndicatorView(style: .whiteLarge)
self.activityIndicator.color = UIColor.darkGray
self.activityIndicator.center = self.tableView.center
self.activityIndicator.hidesWhenStopped = true
self.activityIndicator.stopAnimating()
self.navigationController?.view.addSubview(activityIndicator)
self.showBarItemsBusy()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// When the posts screen is shown, retrieve our
// current auth info and new posts
self.authSource.retrieveAuth()
self.postsDataSource.refreshPosts()
}
/**
* Handle presenting a view controller, but ensuring
* that the view controller inherits a navigation controller
* for navigation bar
*/
private func presentView(of viewController: UIViewController) {
let navController = UINavigationController(rootViewController: viewController)
self.present(navController, animated: true, completion: nil)
}
@objc func openCreate() {
let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let view = storyBoard.instantiateViewController(withIdentifier: "newPost") as! NewPostController
self.presentView(of: view)
}
@objc func openLogin() {
let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let view = storyBoard.instantiateViewController(withIdentifier: "loginView") as! LoginController
self.presentView(of: view)
}
@objc func openProfile() {
let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let view = storyBoard.instantiateViewController(withIdentifier: "profileView") as! ProfileController
view.details = self.auth
view.isMe = true
self.presentView(of: view)
}
@objc func refreshPosts(refreshControl: UIRefreshControl) {
self.refresher = refreshControl
self.postsDataSource.refreshPosts(excludingCache: true)
}
func getPost(at indexPath: IndexPath) -> Post? {
var post: Post? = nil
switch(indexPath.section) {
case 0:
post = self.pinnedPosts[indexPath.row]
default:
post = self.posts[indexPath.row]
}
return post
}
func showError(title: String, message: String) {
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Ok", style: .default, handler: nil))
self.present(alert, animated: false, completion: nil)
}
func showBarItemsBusy() {
let uiBusy = UIActivityIndicatorView(style: .white)
uiBusy.hidesWhenStopped = true
uiBusy.startAnimating()
self.navigationBar.leftBarButtonItem = UIBarButtonItem(customView: uiBusy)
self.navigationBar.rightBarButtonItem = nil
}
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
switch section {
case 0:
return "Pinned"
default:
return "Posts"
}
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
// Pinned and posts sections
return 2
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// Create the pinned and posts sections
switch(section) {
case 0:
return self.pinnedPosts.count
default:
return self.posts.count
}
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
// Set the row hight depending on if the row has images
if let post = self.getPost(at: indexPath) {
if post.numImages > 0 {
return 310
}
}
return 120
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// Fill in details for the cell
let cell = tableView.dequeueReusableCell(withIdentifier: PostCell.identifier, for: indexPath) as! PostCell
let post = self.getPost(at: indexPath)
cell.configureCell(with: post!)
return cell
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// When a post is clicked, that post will try to be loaded.
// We need to pass the post data to the controller for
// viewing that post
if segue.identifier == "openPost" {
// Unwrappers
if let indexPath = self.tableView.indexPathForSelectedRow {
if let navigationController = segue.destination as? UINavigationController {
if let postDetailsController = navigationController.topViewController as? PostDetailsController {
// Find the post
postDetailsController.post = self.getPost(at: indexPath)
}
}
}
}
}
}
extension PostsController: UIViewControllerPreviewingDelegate {
/**
* Create a post details controller for the
* given index path
**/
private func createPostDetails(for indexPath: IndexPath) -> PostDetailsController {
let post = self.getPost(at: indexPath)
let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let detailsController = storyBoard.instantiateViewController(withIdentifier: "postDetails") as! PostDetailsController
detailsController.post = post
return detailsController
}
func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
guard let indexPath = tableView.indexPathForRow(at: location) else {
return nil
}
self.tableView.selectRow(at: indexPath, animated: false, scrollPosition: .none)
return nil
}
func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit viewControllerToCommit: UIViewController) {
self.navigationController!.pushViewController(viewControllerToCommit, animated: true)
}
}
// Handle all received posts data
extension PostsController: PostsDataModelDelegate {
func didDeletePost() {}
func didFailDeletePost(with error: ApiError) {}
func didPinPost(pinned: Bool) {}
func didFailPinPost(with error: ApiError) {}
func stopLoadingIcons() {
self.activityIndicator.stopAnimating()
// Stop the refresh icon, if it exists
self.refresher?.endRefreshing()
self.refresher = nil
}
func didRecievePosts(posts: [Post], pinnedPosts: [Post]) {
self.stopLoadingIcons()
self.posts = posts
self.pinnedPosts = pinnedPosts
self.tableView.reloadData()
}
func didFailReceive(with error: ApiError) {
self.stopLoadingIcons()
switch (error) {
case ApiError.connectionError:
self.showError(title: "Could not load posts", message: "Connection error")
default:
self.showError(title: "Could not load posts", message: "Unknown error")
}
}
func didCreatePost(post: Post) {}
func didCreatePostProgress(progress: Double) {}
func didFailCreatePost(with: ApiError) {}
}
extension PostsController: AuthModelDelegate {
func showLoginAction() {
let loginAction = UIBarButtonItem(
title: NSLocalizedString("Login", comment: ""),
style: .plain,
target: self,
action: #selector(PostsController.openLogin)
)
self.navigationBar.leftBarButtonItem = loginAction
self.navigationBar.rightBarButtonItem = nil
}
func showProfileAction() {
let profileAction = UIBarButtonItem(
title: "Profile",
style: .plain,
target: self,
action: #selector(PostsController.openProfile)
)
self.navigationBar.leftBarButtonItem = profileAction
}
func showAddAction() {
let profileAction = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(PostsController.openCreate))
self.navigationBar.rightBarButtonItem = profileAction
}
func didReceiveAuth(auth: User?) {
self.auth = auth
if auth == nil {
self.showLoginAction()
} else {
self.showProfileAction()
self.showAddAction()
}
}
func didReceiveAuthError(error: ApiError) {
switch (error) {
case ApiError.connectionError:
return
default:
return
}
}
}
| [
-1
] |
ce41abcaf61f6bed1efb228d997367f3d9bc97b1 | c1ad4491a75423f756f80183e53adea151735c6b | /SampleCrypto/Resources/SceneDelegate.swift | b73e2c3748e8374866c143595d5d98452f7d240d | [] | no_license | dohyung1/samplecrypto | 4312b86f6f7d4b20eb2d2926dd11b8fd1c69d117 | 9fcf1d9eb21c39d79163588c7a3fa185b229b18b | refs/heads/master | 2023-03-05T06:46:58.151262 | 2021-02-10T04:08:16 | 2021-02-10T04:08:16 | 334,787,693 | 1 | 0 | null | 2021-02-10T04:08:17 | 2021-02-01T00:26:46 | Swift | UTF-8 | Swift | false | false | 2,295 | swift | //
// SceneDelegate.swift
// SampleCrypto
//
// Created by Administrator on 1/31/21.
//
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,
164107,
336140,
368913,
262417,
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,
328204,
328207,
410129,
393748,
262679,
377372,
188959,
385571,
377384,
197160,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
385610,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
385671,
148106,
213642,
377485,
352919,
98969,
344745,
361130,
336556,
385714,
434868,
164535,
336568,
328379,
164539,
328387,
352969,
344777,
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,
328690,
435188,
328703,
418822,
328710,
328715,
377867,
361490,
386070,
271382,
336922,
345119,
377888,
345134,
345139,
361525,
386102,
361537,
377931,
345172,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
386168,
410746,
361594,
214150,
345224,
386187,
345247,
361645,
345268,
402615,
361657,
337093,
402636,
328925,
165086,
66783,
165092,
222438,
386286,
328942,
386292,
206084,
328967,
345377,
353572,
345380,
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,
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,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
362274,
378664,
354107,
345916,
354112,
370504,
329545,
345932,
370510,
354132,
337751,
247639,
370520,
313181,
182110,
354143,
354157,
345965,
345968,
345971,
345975,
403321,
1914,
354173,
247692,
395148,
337809,
247701,
329625,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
346059,
346064,
247760,
346069,
419810,
329699,
354275,
190440,
354314,
346140,
436290,
378956,
395340,
436307,
338005,
329816,
100454,
329833,
329853,
329857,
329868,
411806,
329886,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
256214,
411862,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
387314,
436474,
321787,
379135,
411905,
411917,
379154,
395539,
387350,
338201,
387353,
182559,
338212,
395567,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
321911,
420237,
379279,
354728,
338353,
338382,
272849,
248279,
256474,
182755,
338404,
330225,
248309,
248332,
330254,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
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,
412765,
339037,
257121,
322660,
265321,
248952,
420985,
330886,
330890,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
126148,
322763,
330959,
330966,
265433,
265438,
388320,
363757,
388348,
339199,
396552,
175376,
175397,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
126279,
437576,
437584,
331089,
437588,
331094,
396634,
175451,
437596,
429408,
175458,
175461,
175464,
265581,
175478,
249210,
175484,
249215,
175487,
249219,
175491,
249225,
249228,
249235,
175514,
175517,
396703,
396706,
175523,
355749,
396723,
388543,
380353,
216518,
380364,
339406,
372177,
339414,
413143,
249303,
339418,
339421,
249310,
249313,
339425,
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,
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,
225013,
257788,
225021,
339711,
257791,
225027,
257796,
257802,
339722,
257805,
225039,
257808,
249617,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
257825,
225059,
339748,
225068,
257837,
413485,
225071,
225074,
257843,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
257869,
257872,
225105,
397140,
225109,
257881,
225113,
257884,
257887,
225120,
257891,
413539,
225128,
257897,
339818,
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,
192640,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
250012,
225439,
135328,
225442,
438434,
192674,
225445,
225448,
438441,
356521,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
356580,
225511,
217319,
225515,
225519,
381177,
397572,
381212,
356638,
356641,
356644,
356647,
266537,
356650,
389417,
356656,
332081,
307507,
340276,
356662,
397623,
332091,
225599,
201030,
348489,
332107,
151884,
332118,
430422,
348503,
250203,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
332162,
389507,
348548,
356741,
250239,
332175,
160152,
373146,
340380,
373149,
70048,
356783,
373169,
324032,
266688,
201158,
340452,
127473,
217590,
340473,
324095,
324100,
266757,
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,
258723,
332460,
332464,
332473,
381626,
332484,
332487,
373450,
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,
324476,
430973,
340859,
340863,
324479,
324482,
373635,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
398246,
373672,
324525,
111539,
324534,
324539,
324542,
398280,
349129,
340940,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
349173,
381947,
201724,
431100,
349181,
431107,
349203,
209944,
209948,
357411,
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,
160896,
152704,
349313,
210053,
210056,
349320,
373905,
259217,
210068,
210072,
210078,
210081,
210085,
210089,
210096,
210100,
324792,
210108,
357571,
210116,
210128,
210132,
333016,
210139,
210144,
218355,
218361,
275709,
128254,
275713,
242947,
275717,
275723,
333075,
349460,
333079,
251161,
349486,
349492,
415034,
210261,
365912,
259423,
374113,
251236,
374118,
333164,
234867,
390518,
357756,
374161,
112021,
349591,
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,
349748,
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,
358192,
366384,
210740,
366388,
358201,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
358235,
341852,
350046,
399200,
399208,
358256,
268144,
358260,
341877,
399222,
325494,
333690,
325505,
333699,
399244,
333709,
333725,
333737,
382891,
382898,
350153,
358348,
333777,
219094,
399318,
358372,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
219144,
268299,
333838,
350225,
186388,
350232,
333851,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
342113,
252021,
342134,
374904,
268435,
333998,
334012,
260299,
350411,
350417,
350423,
211161,
350426,
350449,
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,
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,
342931,
400279,
252823,
392092,
400286,
252838,
359335,
211885,
252846,
400307,
351169,
359362,
351172,
170950,
359367,
326599,
187335,
359383,
359389,
383968,
343018,
359411,
261109,
261112,
244728,
383999,
261130,
326669,
261148,
359452,
211999,
261155,
261160,
261166,
359471,
375868,
343132,
384099,
384102,
384108,
367724,
187503,
343155,
384115,
212095,
351366,
384136,
384140,
384144,
351382,
384152,
384158,
384161,
351399,
384169,
367795,
244917,
384182,
367801,
384189,
351424,
384192,
343232,
367817,
244938,
384202,
253132,
326858,
384209,
146644,
351450,
384225,
359650,
343272,
351467,
359660,
384247,
351480,
384250,
351483,
351492,
343307,
384270,
261391,
359695,
253202,
261395,
384276,
384284,
245021,
384290,
253218,
171304,
245032,
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,
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,
376672,
155488,
155492,
327532,
261997,
376686,
262000,
262003,
327542,
147319,
262006,
262009,
425846,
262012,
155517,
155523,
155526,
360327,
376715,
155532,
262028,
262031,
262034,
262037,
262040,
262043,
253854,
155550,
262046,
262049,
262052,
327590,
155560,
155563,
155566,
327613,
393152,
311244,
393170,
155604,
155620,
253924,
155622,
327655,
253927,
360432,
393204,
360439,
253944,
393209,
155647
] |
86507d7555de0509cd3033248e339a568d4b5ef9 | abea125f1c363a4ef60709e21cc25782a4c582af | /SnapkitPoc/UseCase/DataPlannerUseCase.swift | 7e179d15843b9999d86ee3462d3e141dcbdaf013 | [] | no_license | iamsagaruk/SnapKPoc | c1326be8fa4ed8a578e63d942d2afb87c5eed6cd | 7d3cdccfa2e5764a3e14ad77f8d8d17378888000 | refs/heads/master | 2022-12-02T19:49:54.102696 | 2020-08-15T04:01:14 | 2020-08-15T04:01:14 | 287,671,404 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 902 | swift | //
// DataPlannerUseCase.swift
// SnapkitPoc
//
// Created by Sagar on 14/08/20.
// Copyright © 2020 Sagar. All rights reserved.
//
import Foundation
import ObjectMapper
typealias DataParsedCompletionHandler = (_ isSuccess: Bool, _ response: Any?, _ error: NetworkErrorModel?) -> Void
public class DataPlannerUseCase {
static let sharedUseCase = DataPlannerUseCase()
func getDetails(completionHandler: @escaping DataParsedCompletionHandler) {
NetworkClient.sharedClient.sendGetRequest(AppConstant.kFetchDataPlanningUrl, parameters: nil, headers: nil) { (isSuccess, response, error) in
if isSuccess {
let articleList = Mapper<PlanningDataResponse>().mapArray(JSONObject: response)
completionHandler(isSuccess, articleList, nil)
} else {
completionHandler(false, nil, error)
}
}
}
}
| [
-1
] |
1f15dcd15876f061bbc48cd0af3c1fbed64e5411 | 6f081428168287552105a7c7b0ad7a95b8627588 | /Sources/Trunk/Endpoints/SearchEndpoint.swift | 4cd20883c0affccbcffaa652bbd8afea04e78427 | [
"BSD-3-Clause"
] | permissive | FledgeXu/Trunk | abd2956990ac8d9b980722b06af486d48cf906cc | 307554d74ffc334ec9fa59fe3d986d3f9745d9f5 | refs/heads/main | 2023-07-08T16:35:38.468755 | 2021-07-31T11:51:42 | 2021-07-31T11:51:42 | 386,870,356 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,417 | swift | //
// SearchEndpoint.swift
//
//
// Created by Fledge Shiu on 2021/7/18.
//
import Foundation
public enum SearchEndpoint {
/// Search results
/// Endpoint: `/api/v2/search`
/// - Parameters:
/// - q: The search query
/// - accountId: If provided, statuses returned will be authored only by this account
/// - maxId: Return results older than this id
/// - minId: Return results immediately newer than this id
/// - type: Enum(accounts, hashtags, statuses)
/// - excludeUnreviewed: Filter out unreviewed tags? Defaults to false. Use true when trying to find trending tags.
/// - resolve: Attempt WebFinger lookup. Defaults to false.
/// - limit: Maximum number of results to load, per type. Defaults to 20. Max 40.
/// - offset: Offset in search results. Used for pagination. Defaults to 0.
/// - following: Only include accounts that the user is following. Defaults to false.
/// - Returns: Results
public static func searchResults(keyword q: String,
accountId: String? = nil,
maxId: String? = nil,
minId: String? = nil,
type: SearchType? = nil,
excludeUnreviewed: Bool? = nil,
resolve: Bool? = nil,
limit: Int? = nil,
offset: Int? = nil,
following: Bool? = nil)-> Request<Results> {
let toBetween = between(1, and: 40, default: 20)
let parameters = [
Parameter(key: "q", value: q),
Parameter(key: "account_id", value: accountId),
Parameter(key: "max_id", value: maxId),
Parameter(key: "min_id", value: minId),
Parameter(key: "type", value: type?.rawValue),
Parameter(key: "exclude_unreviewed", value: excludeUnreviewed.flatMap(trueOrNil)),
Parameter(key: "resolve", value: resolve.flatMap(trueOrNil)),
Parameter(key: "limit", value: limit.map(toBetween).flatMap(toOptionalString)),
Parameter(key: "offset", value: offset.flatMap(toOptionalString)),
Parameter(key: "following", value: following.flatMap(trueOrNil)),
]
return Request(path: "/api/v2/search", method: .GET(.PARAMETERS(parameters)))
}
}
| [
-1
] |
f90864827992241fce43a246ae6af5193e22b581 | fb6b56c3820fc873fb19e830cc9961a340900815 | /Picnic/Detail View/DetailController.swift | 5ebdd519a4035cef3a12eaaabbaf210df8e53c37 | [] | no_license | Michelleannie02/Picnic | 7eda12e1cc8b00fcf2a1909e0b132730767e2658 | 6d7cdb157c3b57107bfae603d20419c0371fd444 | refs/heads/master | 2023-02-18T21:45:16.440436 | 2021-01-23T03:37:10 | 2021-01-23T03:37:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,130 | swift | //
// PicnicDetailViewController.swift
// Picnic
//
// Created by Kyle Burns on 7/18/20.
// Copyright © 2020 Kyle Burns. All rights reserved.
//
import MapKit
let kModalOffset: CGFloat = UIScreen.main.bounds.height * 0.55
let kStagedModalLabelWidthMultiplier: CGFloat = 0.7
let kStagedModalLabelHeightMultiplier: CGFloat = 0.2
class DetailController: UIViewController {
var picnic: Picnic = .empty
let detailView = DetailView(frame: .zero)
override var preferredStatusBarStyle: UIStatusBarStyle { .lightContent }
override func viewDidLoad() {
super.viewDidLoad()
// MARK: Preview Subviews
detailView.configure(picnic: picnic, image: nil)
detailView.liked.addTarget(self, action: #selector(likePress), for: .touchUpInside)
detailView.reviews.delegate = self
ReviewManager.default.addReviewQuery(for: "Reviews", limit: 20, picnic: picnic)
ReviewManager.default.nextPage(for: "Reviews") { reviews in
self.detailView.reviews.update(reviews: reviews)
}
detailView.tagView.isScrollEnabled = false
let tgr = UITapGestureRecognizer(target: self, action: #selector(mapTap))
detailView.mapView.addGestureRecognizer(tgr)
view.addSubview(detailView)
NSLayoutConstraint.activate([
detailView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
detailView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
detailView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
detailView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])
let rightBarButtonItem = UIBarButtonItem(systemItem: .action)
rightBarButtonItem.target = self
rightBarButtonItem.action = #selector(options)
navigationItem.rightBarButtonItem = rightBarButtonItem
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setNeedsStatusBarAppearanceUpdate()
// navigationController?.navigationBar.isTranslucent = true
// navigationController?.navigationBar.shadowImage = UIImage()
// navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
// navigationController?.navigationBar.tintColor = .white
navigationController?.interactivePopGestureRecognizer?.delegate = self
UserManager.default.addSaveListener(picnic: picnic, listener: detailView.liked) { liked in
self.detailView.liked.setActive(isActive: liked)
}
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
UserManager.default.removeSaveListener(listener: detailView.liked)
ReviewManager.default.removeQuery("Reviews")
}
@objc func mapTap(_ sender: UITapGestureRecognizer) {
let mc = MapViewController()
mc.picnic = picnic
navigationController?.pushViewController(mc, animated: true)
}
@objc func likePress(_ sender: HeartButton) {
if sender.isActive {
UserManager.default.unsavePost(picnic: picnic)
} else {
UserManager.default.savePost(picnic: picnic)
}
}
@objc func options() {
let actionSheet = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
actionSheet.addAction(UIAlertAction(title: "Share", style: .default, handler: nil))
actionSheet.addAction(UIAlertAction(title: "Get Directions", style: .default, handler: { alert in
let item = MKMapItem(placemark: MKPlacemark(coordinate: self.picnic.coordinate))
item.name = self.picnic.name
item.openInMaps(launchOptions: [
MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving,
MKLaunchOptionsShowsTrafficKey: true
])
}))
actionSheet.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { _ in
actionSheet.dismiss(animated: true)
}))
present(actionSheet, animated: true)
}
}
extension DetailController: UIViewControllerTransitioningDelegate {
func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
let pc = ShortPresentationController(presentedViewController: presented, presenting: presenting)
pc.offset = kModalOffset
return pc
}
}
extension DetailController: ReviewsDelegate {
func presentModal() {
let reviewModal = ReviewCreationController()
reviewModal.transitioningDelegate = self
reviewModal.modalPresentationStyle = .custom
reviewModal.offset = kModalOffset
reviewModal.picnic = picnic
present(reviewModal, animated: true)
}
}
extension DetailController: UIGestureRecognizerDelegate {
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool {
true
}
}
| [
-1
] |
28d484b293c93e8f75bff805ddf475b53066b92f | 6759f75b07b95dc562708b4113fed879b791bbfe | /EveryoneTutor/Controllers/LoginViewController.swift | 181843ea7b88f89f1ecf13ba199f22ddd5a6ef75 | [] | no_license | voronkinikita/EveryoneTutor | 247a46b3935890a623d23aaa6fea3638aa0b2e9f | d4219808dd964ab0c3c0fb5ec3199d6b48da5437 | refs/heads/main | 2023-02-21T23:00:30.228236 | 2021-01-27T18:30:55 | 2021-01-27T18:30:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 722 | swift | import UIKit
import Firebase
class LoginViewController: UIViewController {
@IBOutlet weak var emailTextfield: UITextField!
@IBOutlet weak var passwordTextfield: UITextField!
@IBOutlet weak var errorLabel: UILabel!
@IBAction func loginPressed(_ sender: UIButton) {
if let email = emailTextfield.text, let password = passwordTextfield.text {
Auth.auth().signIn(withEmail: email, password: password) { authResult, error in
if let e = error {
self.errorLabel.text = e.localizedDescription
} else {
self.performSegue(withIdentifier: K.loginSegue, sender: self)
}
}
}
}
}
| [
268513
] |
df42eec630444a6c3a69ba79831f2aa076d7de9d | 45ab659cbc1da22c8740cadd4c755f1d7f67a3a2 | /Tests/MongoSwiftTests/SDAMMonitoringTests.swift | 889b4c95e4313087a90c75879c683a06b9487077 | [
"Apache-2.0"
] | permissive | 123FLO321/mongo-swift-driver | 7dd777b72e2f9fa43c2087c8d2716a69e79bfa24 | 967aedee6fb5241974f12414011bd5c82ec6df0b | refs/heads/master | 2020-07-13T22:42:29.727884 | 2019-08-29T14:56:29 | 2019-08-29T14:56:29 | 205,171,134 | 1 | 0 | Apache-2.0 | 2019-08-29T14:56:30 | 2019-08-29T13:32:50 | Swift | UTF-8 | Swift | false | false | 5,309 | swift | import Foundation
import mongoc
@testable import MongoSwift
import Nimble
import XCTest
final class SDAMTests: MongoSwiftTestCase {
override func setUp() {
self.continueAfterFailure = false
}
func checkEmptyLists(_ desc: ServerDescription) {
expect(desc.arbiters).to(haveCount(0))
expect(desc.hosts).to(haveCount(0))
expect(desc.passives).to(haveCount(0))
}
func checkUnknownServerType(_ desc: ServerDescription) {
expect(desc.type).to(equal(ServerDescription.ServerType.unknown))
}
func checkDefaultHostPort(_ desc: ServerDescription, _ hostlist: UnsafePointer<mongoc_host_list_t>) {
expect(desc.connectionId).to(equal(ConnectionId(hostlist)))
}
// Basic test based on the "standalone" spec test for SDAM monitoring:
// swiftlint:disable line_length
// https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/tests/monitoring/standalone.json
// swiftlint:enable line_length
func testMonitoring() throws {
guard MongoSwiftTestCase.topologyType == .single else {
print("Skipping test case because of unsupported topology type \(MongoSwiftTestCase.topologyType)")
return
}
let client = try MongoClient.makeTestClient(options: ClientOptions(serverMonitoring: true))
let center = NotificationCenter.default
var receivedEvents = [MongoEvent]()
let observer = center.addObserver(forName: nil, object: nil, queue: nil) { notif in
guard [
"serverDescriptionChanged", "serverOpening", "serverClosed", "topologyDescriptionChanged",
"topologyOpening", "topologyClosed"
].contains(notif.name.rawValue) else { return }
guard let event = notif.userInfo?["event"] as? MongoEvent else {
XCTFail("Notification \(notif) did not contain an event")
return
}
receivedEvents.append(event)
}
// do some basic operations
let db = client.db(type(of: self).testDatabase)
_ = try db.createCollection(self.getCollectionName())
try db.drop()
center.removeObserver(observer)
var opts = ClientOptions()
let connString = try ConnectionString(MongoSwiftTestCase.connStr, options: &opts)
guard let hostlist = mongoc_uri_get_hosts(connString._uri) else {
XCTFail("Could not get hostlists for uri: \(MongoSwiftTestCase.connStr)")
return
}
// check event count and that events are of the expected types
expect(receivedEvents.count).to(beGreaterThanOrEqualTo(5))
expect(receivedEvents[0]).to(beAnInstanceOf(TopologyOpeningEvent.self))
expect(receivedEvents[1]).to(beAnInstanceOf(TopologyDescriptionChangedEvent.self))
expect(receivedEvents[2]).to(beAnInstanceOf(ServerOpeningEvent.self))
expect(receivedEvents[3]).to(beAnInstanceOf(ServerDescriptionChangedEvent.self))
expect(receivedEvents[4]).to(beAnInstanceOf(TopologyDescriptionChangedEvent.self))
// verify that data in ServerDescription and TopologyDescription looks reasonable
let event0 = receivedEvents[0] as! TopologyOpeningEvent
expect(event0.topologyId).toNot(beNil())
let event1 = receivedEvents[1] as! TopologyDescriptionChangedEvent
expect(event1.topologyId).to(equal(event0.topologyId))
expect(event1.previousDescription.type).to(equal(TopologyDescription.TopologyType.unknown))
expect(event1.newDescription.type).to(equal(TopologyDescription.TopologyType.single))
// This is a bit of a deviation from the SDAM spec tests linked above. However, this is how mongoc responds so
// there is no other way to get around this.
expect(event1.newDescription.servers).to(beEmpty())
let event2 = receivedEvents[2] as! ServerOpeningEvent
expect(event2.topologyId).to(equal(event1.topologyId))
expect(event2.connectionId).to(equal(ConnectionId(hostlist)))
let event3 = receivedEvents[3] as! ServerDescriptionChangedEvent
expect(event3.topologyId).to(equal(event2.topologyId))
let prevServer = event3.previousDescription
checkDefaultHostPort(prevServer, hostlist)
checkEmptyLists(prevServer)
checkUnknownServerType(prevServer)
let newServer = event3.newDescription
checkDefaultHostPort(newServer, hostlist)
checkEmptyLists(newServer)
expect(newServer.type).to(equal(ServerDescription.ServerType.standalone))
let event4 = receivedEvents[4] as! TopologyDescriptionChangedEvent
expect(event4.topologyId).to(equal(event3.topologyId))
let prevTopology = event4.previousDescription
expect(prevTopology.type).to(equal(TopologyDescription.TopologyType.single))
expect(prevTopology.servers).to(beEmpty())
let newTopology = event4.newDescription
expect(newTopology.type).to(equal(TopologyDescription.TopologyType.single))
checkDefaultHostPort(newTopology.servers[0], hostlist)
expect(newTopology.servers[0].type).to(equal(ServerDescription.ServerType.standalone))
checkEmptyLists(newTopology.servers[0])
}
}
| [
-1
] |
ffb41050101d136eca38eb73e71e0f0650019f3c | da51d83c52238e06eeeadf504c3aaba2a1d4ec42 | /CombineFramworKDemo/View/ViewController.swift | ad773dbd627a395ee2e314a64ad91fe37eb0f601 | [] | no_license | avinash5782/CombineFramworKDemo | ef913948e43cc67ad25188fb1a9626ca1827b9c2 | ba3162b27d8ef9aa086993dff56de822e210880a | refs/heads/main | 2023-06-05T03:44:09.200858 | 2021-06-20T08:35:33 | 2021-06-20T08:35:33 | 378,596,603 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,752 | swift | //
// ViewController.swift
// CombineFramworKDemo
//
// Created by Avinash on 20/06/21.
//
import UIKit
import Combine
class ViewController: UITableViewController{
var user :[userData] = []
var dataModel : viewModelClass!
var mytableView: UITableView!
var subscriber :AnyCancellable?
override func viewDidLoad() {
super.viewDidLoad()
self.mytableView = UITableView()
self.view.addSubview(self.mytableView)
setupViewMOdel()
}
func setupViewMOdel() {
let apiManger = ApiManager()
let url = URL(string: "https://jsonplaceholder.typicode.com/users")
dataModel = viewModelClass(apiMange: apiManger, Url: url!)
obsrableData()
fetchData()
}
func fetchData() {
dataModel.fetdata()
}
func obsrableData() {
print("called")
subscriber = dataModel.passthroughobj.sink(receiveCompletion: { (value) in
switch value {
case .failure( _): print("data recieved")
case .finished: print("data recieved")
}
}) { (data) in
self.user = data
print("data recieved")
self.tableView.reloadData()
}
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: .subtitle, reuseIdentifier: "TestCell")
let userdata = user[indexPath.item]
cell.textLabel?.text = userdata.name
cell.detailTextLabel?.text = userdata.email
return cell
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return user.count
}
}
| [
-1
] |
7a38f8125630039092c71bfbfaeb9c1e84118894 | f6131e1f5205f00af87adc4b914da6af56298fe3 | /Tests/LinuxMain.swift | 7a728fefef1357eafc335de7aeed7f05ffffc854 | [
"Apache-2.0"
] | permissive | Utagai/mongo-swift-driver | c0de9ea40e94e856011dda44be4369d353cca3bf | 3eeb0ead6ee8787fdfed37bea087a28a58c4c4f9 | refs/heads/master | 2020-04-02T00:57:45.855121 | 2018-12-12T18:13:20 | 2018-12-12T18:13:20 | 153,830,140 | 0 | 0 | Apache-2.0 | 2018-10-19T19:12:02 | 2018-10-19T19:12:02 | null | UTF-8 | Swift | false | false | 122 | swift | import MongoSwiftTests
import XCTest
var tests = [XCTestCaseEntry]()
tests += MongoSwiftTests.allTests()
XCTMain(tests)
| [
254467,
222725,
317063,
349584,
35347,
365843,
238613,
258709,
198423,
217120,
341798,
224296,
235958,
30010,
225212,
350909,
339017,
345420,
332368,
338389,
327256,
339801,
248924,
317667,
344803,
319462,
343655,
313324,
316780,
253806,
350702,
333425,
315124,
342525
] |
118dd73fa1b51d7a070c22ec74c923bdd24ca7b4 | a4886809d60e13fdeb804e3b65ace5990060e635 | /Sources/AltSwiftUI/Source/Constants/SwiftUIConstants.swift | 7ecce94566ae228c708ee33ecbcfce4c59797c76 | [
"MIT"
] | permissive | shamilcm/AltSwiftUI | b8de723d6dbd3f22a0ce1de10cbdfd7078f85d44 | f91ee589c7b5517ad02ac61a6996168489d6dce2 | refs/heads/master | 2023-05-09T13:22:34.983947 | 2021-05-17T02:08:07 | 2021-05-17T02:08:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 617 | swift | //
// SwiftUIConstants.swift
// AltSwiftUI
//
// Created by Wong, Kevin a on 2019/10/07.
// Copyright © 2019 Rakuten Travel. All rights reserved.
//
import UIKit
enum SwiftUIConstants {
static let defaultCellHeight: CGFloat = 44
static let defaultPadding: CGFloat = 10
static let defaultCellPadding: CGFloat = 12
static let defaultSpacing: CGFloat = 5
static var systemGray: UIColor {
if #available(iOS 13.0, *) {
return UIColor.systemGray4
} else {
return UIColor(white: 0.9, alpha: 1)
}
}
static let minHeaderHeight: CGFloat = 35
}
| [
-1
] |
94086c65535447073ea0366dda86337f64d2e3ed | e55c40315e291caf754f1b5e93d2d3e6d01263c9 | /Class/Common/BaseTableViewCell.swift | 7e98e369aa8553a728d12a3f25586b764201c655 | [] | no_license | churabou/PhotoView | 734823aee3794bc2362695371bfe8b7fcf0cced4 | 6057fd697dc0257466068a04effb1c9f96fcbac3 | refs/heads/master | 2020-03-07T13:34:16.055606 | 2018-05-02T15:25:00 | 2018-05-02T15:25:00 | 127,504,307 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 847 | swift | import UIKit
class BaseTableViewCell: UITableViewCell {
fileprivate var constraintsInitialized = false
override open class var requiresConstraintBasedLayout: Bool {
return true
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
initializeView()
}
override func updateConstraints() {
if !constraintsInitialized {
constraintsInitialized = true
initializeConstraints()
}
super.updateConstraints()
}
func initializeView() { /* don't write code here */ }
func initializeConstraints() { /* don't write code here */ }
}
| [
-1
] |
d9b78b944f3bc8d67ed0c137079d35f49e64f553 | 369f8d6a015e0b23ea1710e9c0b174d66e74ea35 | /Sources/Rules.swift | 2b2d2c08eb5630a086ba0e839dd76d834c6d370c | [
"MIT"
] | permissive | TalentLifeFeng/SwiftFormat | 92e4bb41ff04b25645f1e8cf09f8095499fe4453 | 2be2af47d1199e1af3d5e53a82d39cc179385e94 | refs/heads/master | 2022-06-25T09:51:21.152010 | 2020-05-05T22:25:55 | 2020-05-05T22:25:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 208,651 | swift | //
// Rules.swift
// SwiftFormat
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Nick Lockwood
//
// Distributed under the permissive MIT license
// Get the latest version from here:
//
// https://github.com/nicklockwood/SwiftFormat
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
import Foundation
public final class FormatRule: Equatable, Comparable {
private let fn: (Formatter) -> Void
fileprivate(set) var name = ""
let help: String
let orderAfter: [String]
let options: [String]
let sharedOptions: [String]
var deprecationMessage: String? {
return FormatRule.deprecatedMessage[name]
}
var isDeprecated: Bool {
return deprecationMessage != nil
}
fileprivate init(help: String,
orderAfter: [String] = [],
options: [String] = [],
sharedOptions: [String] = [],
_ fn: @escaping (Formatter) -> Void) {
self.fn = fn
self.help = help
self.orderAfter = orderAfter
self.options = options
self.sharedOptions = sharedOptions
}
public func apply(with formatter: Formatter) {
formatter.currentRule = self
fn(formatter)
formatter.currentRule = nil
}
public static func == (lhs: FormatRule, rhs: FormatRule) -> Bool {
return lhs === rhs
}
public static func < (lhs: FormatRule, rhs: FormatRule) -> Bool {
if lhs.orderAfter.contains(rhs.name) {
return false
}
return rhs.orderAfter.contains(lhs.name) || lhs.name < rhs.name
}
static let deprecatedMessage = [
"ranges": "ranges rule is deprecated. Use spaceAroundOperators instead.",
]
}
public let FormatRules = _FormatRules()
private let rulesByName: [String: FormatRule] = {
var rules = [String: FormatRule]()
for (label, value) in Mirror(reflecting: FormatRules).children {
guard let name = label, let rule = value as? FormatRule else {
continue
}
rule.name = name
rules[name] = rule
}
return rules
}()
private func allRules(except rules: [String]) -> [FormatRule] {
precondition(!rules.contains(where: { rulesByName[$0] == nil }))
return Array(rulesByName.keys.sorted().compactMap {
rules.contains($0) ? nil : rulesByName[$0]
})
}
private let _allRules = allRules(except: [])
private let _defaultRules = allRules(except: _disabledByDefault)
private let _deprecatedRules = FormatRule.deprecatedMessage.keys
private let _disabledByDefault = _deprecatedRules + ["isEmpty"]
public extension _FormatRules {
/// A Dictionary of rules by name
var byName: [String: FormatRule] { return rulesByName }
/// All rules
var all: [FormatRule] { return _allRules }
/// Default active rules
var `default`: [FormatRule] { return _defaultRules }
/// Rules that are disabled by default
var disabledByDefault: [String] { return _disabledByDefault }
/// Just the specified rules
func named(_ names: [String]) -> [FormatRule] {
return Array(names.sorted().compactMap { rulesByName[$0] })
}
/// All rules except those specified
func all(except rules: [String]) -> [FormatRule] {
return allRules(except: rules)
}
}
extension _FormatRules {
/// Get all format options used by a given set of rules
func optionsForRules(_ rules: [FormatRule]) -> [String] {
var options = Set<String>()
for rule in rules {
options.formUnion(rule.options + rule.sharedOptions)
}
return options.sorted()
}
// Get shared-only options for a given set of rules
func sharedOptionsForRules(_ rules: [FormatRule]) -> [String] {
var options = Set<String>()
var sharedOptions = Set<String>()
for rule in rules {
options.formUnion(rule.options)
sharedOptions.formUnion(rule.sharedOptions)
}
sharedOptions.subtract(options)
return sharedOptions.sorted()
}
}
public struct _FormatRules {
fileprivate init() {}
/// 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 let spaceAroundParens = FormatRule(
help: "Add or remove space around parentheses."
) { formatter in
func spaceAfter(_ keyword: String, index: Int) -> Bool {
switch keyword {
case "@autoclosure":
if let nextIndex = formatter.index(of: .nonSpaceOrLinebreak, after: index),
formatter.next(.nonSpaceOrCommentOrLinebreak, after: nextIndex) == .identifier("escaping") {
assert(formatter.tokens[nextIndex] == .startOfScope("("))
return false
}
return true
case "@escaping", "@noescape":
return true
case "private", "fileprivate", "internal",
"init", "subscript":
return false
default:
return keyword.first.map { !"@#".contains($0) } ?? true
}
}
func isCaptureList(at i: Int) -> Bool {
assert(formatter.tokens[i] == .endOfScope("]"))
guard formatter.lastToken(before: i + 1, where: {
!$0.isSpaceOrCommentOrLinebreak && $0 != .endOfScope("]")
}) == .startOfScope("{"),
let nextToken = formatter.nextToken(after: i, where: {
!$0.isSpaceOrCommentOrLinebreak && $0 != .startOfScope("(")
}),
[.operator("->", .infix), .keyword("throws"), .keyword("rethrows"), .keyword("in")].contains(nextToken)
else { return false }
return true
}
formatter.forEach(.startOfScope("(")) { i, token in
guard let prevToken = formatter.token(at: i - 1) else {
return
}
switch prevToken {
case let .keyword(string) where spaceAfter(string, index: i - 1):
fallthrough
case .endOfScope("]") where isCaptureList(at: i - 1),
.endOfScope(")") where formatter.isAttribute(at: i - 1):
formatter.insertToken(.space(" "), at: i)
case .space:
if let token = formatter.token(at: i - 2) {
switch token {
case let .keyword(string) where !spaceAfter(string, index: i - 2):
fallthrough
case .identifier, .number:
fallthrough
case .endOfScope("}"), .endOfScope(">"),
.endOfScope("]") where !isCaptureList(at: i - 2),
.endOfScope(")") where !formatter.isAttribute(at: i - 2):
formatter.removeToken(at: i - 1)
default:
break
}
}
default:
break
}
}
formatter.forEach(.endOfScope(")")) { i, _ in
guard let nextToken = formatter.token(at: i + 1) else {
return
}
switch nextToken {
case .identifier, .keyword, .startOfScope("{"):
formatter.insertToken(.space(" "), at: i + 1)
case .space where formatter.token(at: i + 2) == .startOfScope("["):
formatter.removeToken(at: i + 1)
default:
break
}
}
}
/// Remove space immediately inside parens
public let spaceInsideParens = FormatRule(
help: "Remove space inside parentheses."
) { formatter in
formatter.forEach(.startOfScope("(")) { i, _ in
if formatter.token(at: i + 1)?.isSpace == true,
formatter.token(at: i + 2)?.isComment == false {
formatter.removeToken(at: i + 1)
}
}
formatter.forEach(.endOfScope(")")) { i, _ in
if formatter.token(at: i - 1)?.isSpace == true,
formatter.token(at: i - 2)?.isCommentOrLinebreak == false {
formatter.removeToken(at: 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 let spaceAroundBrackets = FormatRule(
help: "Add or remove space around square brackets."
) { formatter in
formatter.forEach(.startOfScope("[")) { i, token in
guard let prevToken = formatter.token(at: i - 1) else {
return
}
switch prevToken {
case .keyword:
formatter.insertToken(.space(" "), at: i)
case .space:
if let token = formatter.token(at: i - 2) {
switch token {
case .identifier, .number, .endOfScope("]"), .endOfScope("}"), .endOfScope(")"):
formatter.removeToken(at: i - 1)
default:
break
}
}
default:
break
}
}
formatter.forEach(.endOfScope("]")) { i, _ in
guard let nextToken = formatter.token(at: i + 1) else {
return
}
switch nextToken {
case .identifier, .keyword, .startOfScope("{"):
formatter.insertToken(.space(" "), at: i + 1)
case .space where formatter.token(at: i + 2) == .startOfScope("["):
formatter.removeToken(at: i + 1)
default:
break
}
}
}
/// Remove space immediately inside square brackets
public let spaceInsideBrackets = FormatRule(
help: "Remove space inside square brackets."
) { formatter in
formatter.forEach(.startOfScope("[")) { i, _ in
if formatter.token(at: i + 1)?.isSpace == true,
formatter.token(at: i + 2)?.isComment == false {
formatter.removeToken(at: i + 1)
}
}
formatter.forEach(.endOfScope("]")) { i, _ in
if formatter.token(at: i - 1)?.isSpace == true,
formatter.token(at: i - 2)?.isCommentOrLinebreak == false {
formatter.removeToken(at: 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 let spaceAroundBraces = FormatRule(
help: "Add or remove space around curly braces."
) { formatter in
formatter.forEach(.startOfScope("{")) { i, _ in
if let prevToken = formatter.token(at: i - 1) {
switch prevToken {
case .space, .linebreak,
.startOfScope where !prevToken.isStringDelimiter:
break
default:
formatter.insertToken(.space(" "), at: i)
}
}
}
formatter.forEach(.endOfScope("}")) { i, _ in
if let nextToken = formatter.token(at: i + 1) {
switch nextToken {
case .identifier, .keyword:
formatter.insertToken(.space(" "), at: i + 1)
default:
break
}
}
}
}
/// Ensure that there is space immediately inside braces
public let spaceInsideBraces = FormatRule(
help: "Add or remove space inside curly braces."
) { formatter in
formatter.forEach(.startOfScope("{")) { i, _ in
if let nextToken = formatter.token(at: i + 1) {
if nextToken.isSpace {
if formatter.token(at: i + 2) == .endOfScope("}") {
formatter.removeToken(at: i + 1)
}
} else if !nextToken.isLinebreak, nextToken != .endOfScope("}") {
formatter.insertToken(.space(" "), at: i + 1)
}
}
}
formatter.forEach(.endOfScope("}")) { i, _ in
if let prevToken = formatter.token(at: i - 1),
!prevToken.isSpaceOrLinebreak, prevToken != .startOfScope("{") {
formatter.insertToken(.space(" "), at: i)
}
}
}
/// Ensure there is no space between an opening chevron and the preceding identifier
public let spaceAroundGenerics = FormatRule(
help: "Remove space around angle brackets."
) { formatter in
formatter.forEach(.startOfScope("<")) { i, _ in
if formatter.token(at: i - 1)?.isSpace == true,
formatter.token(at: i - 2)?.isIdentifierOrKeyword == true {
formatter.removeToken(at: i - 1)
}
}
}
/// Remove space immediately inside chevrons
public let spaceInsideGenerics = FormatRule(
help: "Remove space inside angle brackets."
) { formatter in
formatter.forEach(.startOfScope("<")) { i, _ in
if formatter.token(at: i + 1)?.isSpace == true {
formatter.removeToken(at: i + 1)
}
}
formatter.forEach(.endOfScope(">")) { i, _ in
if formatter.token(at: i - 1)?.isSpace == true,
formatter.token(at: i - 2)?.isLinebreak == false {
formatter.removeToken(at: 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.
/// * Delimiters, such as commas and colons, are 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 let spaceAroundOperators = FormatRule(
help: "Add or remove space around operators or delimiters.",
options: ["operatorfunc", "nospaceoperators"]
) { formatter in
formatter.forEachToken { i, token in
switch token {
case .operator(_, .none):
switch formatter.token(at: i + 1) {
case nil, .linebreak?, .endOfScope?, .operator?, .delimiter?,
.startOfScope("(")? where !formatter.options.spaceAroundOperatorDeclarations:
break
case .space?:
switch formatter.next(.nonSpaceOrLinebreak, after: i) {
case nil, .linebreak?, .endOfScope?, .delimiter?,
.startOfScope("(")? where !formatter.options.spaceAroundOperatorDeclarations:
formatter.removeToken(at: i + 1)
default:
break
}
default:
formatter.insertToken(.space(" "), at: i + 1)
}
case .operator("?", .postfix), .operator("!", .postfix):
if let prevToken = formatter.token(at: i - 1),
formatter.token(at: i + 1)?.isSpaceOrLinebreak == false,
[.keyword("as"), .keyword("try")].contains(prevToken) {
formatter.insertToken(.space(" "), at: i + 1)
}
case .operator(".", _):
if formatter.token(at: i + 1)?.isSpace == true {
formatter.removeToken(at: i + 1)
}
guard let prevIndex = formatter.index(of: .nonSpace, before: i) else {
formatter.removeTokens(inRange: 0 ..< i)
break
}
let spaceRequired: Bool
switch formatter.tokens[prevIndex] {
case .operator(_, .infix), .startOfScope("{"):
return
case let token where token.isUnwrapOperator:
if let prevToken = formatter.last(.nonSpace, before: prevIndex),
[.keyword("try"), .keyword("as")].contains(prevToken) {
spaceRequired = true
} else {
spaceRequired = false
}
case .startOfScope, .operator(_, .prefix):
spaceRequired = false
case let token:
spaceRequired = !token.isAttribute && !token.isLvalue
}
if formatter.token(at: i - 1)?.isSpace == true {
if !spaceRequired {
formatter.removeToken(at: i - 1)
}
} else if spaceRequired {
formatter.insertSpace(" ", at: i)
}
case .operator("?", .infix):
break // Spacing around ternary ? is not optional
case let .operator(name, .infix) where formatter.options.noSpaceOperators.contains(name) ||
(!formatter.options.spaceAroundRangeOperators && token.isRangeOperator):
if formatter.token(at: i + 1)?.isSpace == true,
formatter.token(at: i - 1)?.isSpace == true,
let nextToken = formatter.next(.nonSpace, after: i),
!nextToken.isCommentOrLinebreak, !nextToken.isOperator,
let prevToken = formatter.last(.nonSpace, before: i),
!prevToken.isCommentOrLinebreak, !prevToken.isOperator || prevToken.isUnwrapOperator {
formatter.removeToken(at: i + 1)
formatter.removeToken(at: i - 1)
}
case .operator(_, .infix):
if formatter.token(at: i + 1)?.isSpaceOrLinebreak == false {
formatter.insertToken(.space(" "), at: i + 1)
}
if formatter.token(at: i - 1)?.isSpaceOrLinebreak == false {
formatter.insertToken(.space(" "), at: i)
}
case .operator(_, .prefix):
if let prevIndex = formatter.index(of: .nonSpace, before: i, if: {
[.startOfScope("["), .startOfScope("("), .startOfScope("<")].contains($0)
}) {
formatter.removeTokens(inRange: prevIndex + 1 ..< i)
} else if formatter.token(at: i - 1)?.isSpaceOrLinebreak == false {
formatter.insertToken(.space(" "), at: i)
}
case .delimiter(":"):
// TODO: make this check more robust, and remove redundant space
if formatter.token(at: i + 1)?.isIdentifier == true,
formatter.token(at: i + 2) == .delimiter(":") {
// It's a selector
break
}
fallthrough
case .operator(_, .postfix), .delimiter(","), .delimiter(";"), .startOfScope(":"):
switch formatter.token(at: i + 1) {
case nil, .space?, .linebreak?, .endOfScope?, .operator?, .delimiter?:
break
default:
// Ensure there is a space after the token
formatter.insertToken(.space(" "), at: i + 1)
}
if formatter.token(at: i - 1)?.isSpace == true,
formatter.token(at: i - 2)?.isLinebreak == false {
// Remove space before the token
formatter.removeToken(at: i - 1)
}
default:
break
}
}
}
/// Add space around comments, except at the start or end of a line
public let spaceAroundComments = FormatRule(
help: "Add space before and/or after comments."
) { formatter in
formatter.forEach(.startOfScope("//")) { i, _ in
if let prevToken = formatter.token(at: i - 1), !prevToken.isSpaceOrLinebreak {
formatter.insertToken(.space(" "), at: i)
}
}
formatter.forEach(.endOfScope("*/")) { i, _ in
guard let startIndex = formatter.index(of: .startOfScope("/*"), before: i),
case let .commentBody(commentStart)? = formatter.next(.nonSpaceOrLinebreak, after: startIndex),
case let .commentBody(commentEnd)? = formatter.last(.nonSpaceOrLinebreak, before: i),
!commentStart.hasPrefix("@"), !commentEnd.hasSuffix("@") else {
return
}
if let nextToken = formatter.token(at: i + 1) {
if !nextToken.isSpaceOrLinebreak {
if nextToken != .delimiter(",") {
formatter.insertToken(.space(" "), at: i + 1)
}
} else if formatter.next(.nonSpace, after: i + 1) == .delimiter(",") {
formatter.removeToken(at: i + 1)
}
}
if let prevToken = formatter.token(at: startIndex - 1), !prevToken.isSpaceOrLinebreak {
if case let .commentBody(text) = prevToken, text.last?.unicodeScalars.last?.isSpace == true {
return
}
formatter.insertToken(.space(" "), at: startIndex)
}
}
}
/// Add space inside comments, taking care not to mangle headerdoc or
/// carefully preformatted comments, such as star boxes, etc.
public let spaceInsideComments = FormatRule(
help: "Add leading and/or trailing space inside comments."
) { formatter in
formatter.forEach(.startOfScope("//")) { i, _ in
guard let nextToken = formatter.token(at: i + 1),
case let .commentBody(string) = nextToken else { return }
guard let first = string.first else { return }
if "/!:".contains(first) {
let nextIndex = string.index(after: string.startIndex)
if nextIndex < string.endIndex, case let next = string[nextIndex], !" \t/".contains(next) {
let string = String(string.first!) + " " + String(string.dropFirst())
formatter.replaceToken(at: i + 1, with: .commentBody(string))
}
} else if !" \t".contains(first), !string.hasPrefix("===") { // Special-case check for swift stdlib codebase
formatter.insertToken(.space(" "), at: i + 1)
}
}
formatter.forEach(.startOfScope("/*")) { i, _ in
guard let nextToken = formatter.token(at: i + 1), case let .commentBody(string) = nextToken,
!string.hasPrefix("---"), !string.hasPrefix("@"), !string.hasSuffix("---"), !string.hasSuffix("@") else {
return
}
if let first = string.first, "*!:".contains(first) {
let nextIndex = string.index(after: string.startIndex)
if nextIndex < string.endIndex, case let next = string[nextIndex],
!" /t".contains(next), !string.hasPrefix("**"), !string.hasPrefix("*/") {
let string = String(string.first!) + " " + String(string.dropFirst())
formatter.replaceToken(at: i + 1, with: .commentBody(string))
}
} else {
formatter.insertToken(.space(" "), at: i + 1)
}
if let i = formatter.index(of: .endOfScope("*/"), after: i), let prevToken = formatter.token(at: i - 1) {
if !prevToken.isSpaceOrLinebreak, !prevToken.string.hasSuffix("*") {
formatter.insertToken(.space(" "), at: i)
}
}
}
}
/// Adds or removes the space around range operators
public let ranges = FormatRule(
help: "Add or remove space around range operators.",
options: ["ranges"],
sharedOptions: ["nospaceoperators"]
) { formatter in
formatter.forEach(.rangeOperator) { i, token in
guard case let .operator(name, .infix) = token else { return }
if !formatter.options.spaceAroundRangeOperators ||
formatter.options.noSpaceOperators.contains(name) {
if formatter.token(at: i + 1)?.isSpace == true,
formatter.token(at: i - 1)?.isSpace == true,
let nextToken = formatter.next(.nonSpace, after: i),
!nextToken.isCommentOrLinebreak, !nextToken.isOperator(ofType: .prefix),
let prevToken = formatter.last(.nonSpace, before: i),
!prevToken.isCommentOrLinebreak, !prevToken.isOperator(ofType: .postfix) {
formatter.removeToken(at: i + 1)
formatter.removeToken(at: i - 1)
}
} else {
if formatter.token(at: i + 1)?.isSpaceOrLinebreak == false {
formatter.insertToken(.space(" "), at: i + 1)
}
if formatter.token(at: i - 1)?.isSpaceOrLinebreak == false {
formatter.insertToken(.space(" "), at: i)
}
}
}
}
/// Collapse all consecutive space 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 let consecutiveSpaces = FormatRule(
help: "Replace consecutive spaces with a single space."
) { formatter in
formatter.forEach(.space) { i, token in
switch token {
case .space(""):
formatter.removeToken(at: i)
case .space(" "):
break
default:
guard let prevToken = formatter.token(at: i - 1),
let nextToken = formatter.token(at: i + 1) else {
return
}
switch prevToken {
case .linebreak, .startOfScope("/*"), .startOfScope("//"), .commentBody:
return
case .endOfScope("*/") where nextToken == .startOfScope("/*") &&
formatter.currentScope(at: i) == .startOfScope("/*"):
return
default:
break
}
switch nextToken {
case .linebreak, .endOfScope("*/"), .commentBody:
return
default:
formatter.replaceToken(at: i, with: .space(" "))
}
}
}
}
/// Remove trailing space from the end of lines, as it has no semantic
/// meaning and leads to noise in commits.
public let trailingSpace = FormatRule(
help: "Remove trailing space at end of a line.",
options: ["trimwhitespace"]
) { formatter in
formatter.forEach(.space) { i, _ in
if formatter.token(at: i + 1)?.isLinebreak ?? true,
formatter.options.truncateBlankLines || formatter.token(at: i - 1)?.isLinebreak == false {
formatter.removeToken(at: i)
}
}
}
/// Collapse all consecutive blank lines into a single blank line
public let consecutiveBlankLines = FormatRule(
help: "Replace consecutive blank lines with a single blank line."
) { formatter in
formatter.forEach(.linebreak) { i, _ in
guard let prevIndex = formatter.index(of: .nonSpace, before: i, if: { $0.isLinebreak }) else {
return
}
if let prevToken = formatter.last(.nonSpaceOrLinebreak, before: prevIndex) {
switch prevToken {
case .startOfScope where prevToken.isStringDelimiter, .stringBody:
return
default:
break
}
}
if let nextIndex = formatter.index(of: .nonSpace, after: i) {
if formatter.tokens[nextIndex].isLinebreak {
formatter.removeTokens(inRange: i + 1 ... nextIndex)
}
} else if !formatter.options.fragment {
formatter.removeTokens(inRange: i ..< formatter.tokens.count)
}
}
}
/// Remove blank lines immediately after an opening brace, bracket, paren or chevron
public let blankLinesAtStartOfScope = FormatRule(
help: "Remove leading blank line at the start of a scope."
) { formatter in
guard formatter.options.removeBlankLines else { return }
formatter.forEach(.startOfScope) { i, token in
guard ["{", "(", "[", "<"].contains(token.string),
let indexOfFirstLineBreak = formatter.index(of: .nonSpaceOrComment, after: i),
// If there is extra code on the same line, ignore it
formatter.tokens[indexOfFirstLineBreak].isLinebreak
else { return }
// Find next non-space token
var index = indexOfFirstLineBreak + 1
var indexOfLastLineBreak = indexOfFirstLineBreak
loop: while let token = formatter.token(at: index) {
switch token {
case .linebreak:
indexOfLastLineBreak = index
case .space:
break
default:
break loop
}
index += 1
}
if indexOfFirstLineBreak != indexOfLastLineBreak {
formatter.removeTokens(inRange: indexOfFirstLineBreak ..< indexOfLastLineBreak)
return
}
}
}
/// Remove blank lines immediately before a closing brace, bracket, paren or chevron
/// unless it's followed by more code on the same line (e.g. } else { )
public let blankLinesAtEndOfScope = FormatRule(
help: "Remove trailing blank line at the end of a scope."
) { formatter in
guard formatter.options.removeBlankLines else { return }
formatter.forEach(.endOfScope) { i, token in
guard ["}", ")", "]", ">"].contains(token.string),
// If there is extra code after the closing scope on the same line, ignore it
(formatter.next(.nonSpaceOrComment, after: i).map { $0.isLinebreak }) ?? true
else { return }
// Find previous non-space token
var index = i - 1
var indexOfFirstLineBreak: Int?
var indexOfLastLineBreak: Int?
loop: while let token = formatter.token(at: index) {
switch token {
case .linebreak:
indexOfFirstLineBreak = index
if indexOfLastLineBreak == nil {
indexOfLastLineBreak = index
}
case .space:
break
default:
break loop
}
index -= 1
}
if let indexOfFirstLineBreak = indexOfFirstLineBreak,
indexOfFirstLineBreak != indexOfLastLineBreak {
formatter.removeTokens(inRange: indexOfFirstLineBreak ..< indexOfLastLineBreak!)
return
}
}
}
/// Adds a blank line immediately after a closing brace, unless followed by another closing brace
public let blankLinesBetweenScopes = FormatRule(
help: """
Insert blank line before class, struct, enum, extension, protocol or function
declarations.
""",
sharedOptions: ["linebreaks"]
) { formatter in
guard formatter.options.insertBlankLines else { return }
var spaceableScopeStack = [true]
var isSpaceableScopeType = false
formatter.forEachToken { i, token in
switch token {
case .keyword("class"),
.keyword("struct"),
.keyword("extension"),
.keyword("enum"):
isSpaceableScopeType =
(formatter.last(.nonSpaceOrCommentOrLinebreak, before: i) != .keyword("import"))
case .keyword("func"), .keyword("var"):
isSpaceableScopeType = false
case .startOfScope("{"):
spaceableScopeStack.append(isSpaceableScopeType)
isSpaceableScopeType = false
case .endOfScope("}"):
spaceableScopeStack.removeLast()
guard spaceableScopeStack.last == true,
let openingBraceIndex = formatter.index(of: .startOfScope("{"), before: i),
formatter.lastIndex(of: .linebreak, in: openingBraceIndex + 1 ..< i) != nil else {
// Inline braces
break
}
var i = i
if let nextTokenIndex = formatter.index(of: .nonSpace, after: i, if: {
$0 == .startOfScope("(")
}), let closingParenIndex = formatter.index(of:
.endOfScope(")"), after: nextTokenIndex) {
i = closingParenIndex
}
guard let nextTokenIndex = formatter.index(of: .nonSpaceOrLinebreak, after: i) else {
break
}
switch formatter.tokens[nextTokenIndex] {
case .error, .endOfScope,
.operator(".", _), .delimiter(","), .delimiter(":"),
.keyword("else"), .keyword("catch"):
break
case .keyword("while"):
if let previousBraceIndex = formatter.index(of: .startOfScope("{"), before: i),
formatter.last(.nonSpaceOrCommentOrLinebreak, before: previousBraceIndex)
!= .keyword("repeat") {
fallthrough
}
default:
if let firstLinebreakIndex = formatter.index(of: .linebreak, in: i + 1 ..< nextTokenIndex),
formatter.index(of: .linebreak, in: firstLinebreakIndex + 1 ..< nextTokenIndex) == nil {
// Insert linebreak
formatter.insertLinebreak(at: firstLinebreakIndex)
}
}
default:
break
}
}
}
/// Adds a blank line around MARK: comments
public let blankLinesAroundMark = FormatRule(
help: "Insert blank line before and after `MARK:` comments.",
sharedOptions: ["linebreaks"]
) { formatter in
guard formatter.options.insertBlankLines else { return }
formatter.forEachToken { i, token in
guard case let .commentBody(comment) = token, comment.hasPrefix("MARK:"),
let startIndex = formatter.index(of: .nonSpace, before: i),
formatter.tokens[startIndex] == .startOfScope("//") else { return }
if let nextIndex = formatter.index(of: .linebreak, after: i),
let nextToken = formatter.next(.nonSpace, after: nextIndex),
!nextToken.isLinebreak, nextToken != .endOfScope("}") {
formatter.insertLinebreak(at: nextIndex)
}
if let lastIndex = formatter.index(of: .linebreak, before: startIndex),
let lastToken = formatter.last(.nonSpace, before: lastIndex),
!lastToken.isLinebreak, lastToken != .startOfScope("{") {
formatter.insertLinebreak(at: lastIndex)
}
}
}
/// 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 let linebreakAtEndOfFile = FormatRule(
help: "Add empty blank line at end of file.",
sharedOptions: ["linebreaks"]
) { formatter in
guard !formatter.options.fragment else { return }
var wasLinebreak = true
formatter.forEachToken { _, token in
switch token {
case .linebreak:
wasLinebreak = true
case .space:
break
default:
wasLinebreak = false
}
}
if formatter.isEnabled, !wasLinebreak {
formatter.insertLinebreak(at: 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 let indent = FormatRule(
help: "Indent code in accordance with the scope level.",
orderAfter: ["trailingSpace", "wrap", "wrapArguments"],
options: ["indent", "tabwidth", "indentcase", "ifdef", "xcodeindentation"],
sharedOptions: ["trimwhitespace"]
) { formatter in
var scopeStack: [Token] = []
var scopeStartLineIndexes: [Int] = []
var lastNonSpaceOrLinebreakIndex = -1
var lastNonSpaceIndex = -1
var indentStack = [""]
var stringBodyIndentStack = [""]
var indentCounts = [1]
var linewrapStack = [false]
var lineIndex = 0
func isGuardElseClause(at index: Int, token: Token) -> Bool {
func hasKeyword(_ string: String) -> Bool {
return formatter.index(of: .keyword(string), after: formatter.startOfLine(at: index) - 1) ?? index < index
}
let nextToken = formatter.next(.nonSpaceOrCommentOrLinebreak, after: index)
// Handle `{ return }` on its own line
guard nextToken != .startOfScope("{") else { return false }
// Make sure `else` on the line following a single-clause `guard` gets indented extra
// example: `guard true\nelse { return }`
if hasKeyword("guard"), hasKeyword("else") || nextToken == .keyword("else") {
// Avoid over-indenting the line following a single-line guard, like `guard true else { return }`
return (formatter.index(of: .endOfScope("}"), before: index) ?? -1) < formatter.startOfLine(at: index)
}
let startIndex = token.isStartOfScope ||
nextToken == .keyword("else") ? index :
formatter.index(of: formatter.currentScope(at: index) ?? token, before: index) ?? index
guard let lastGuardIndex = formatter.index(of: .keyword("guard"), before: startIndex) else {
return false
}
let lastStartIndex = formatter.index(of: .startOfScope("{"), before: startIndex - 1) ?? -1
let lastEndIndex = formatter.index(of: .endOfScope("}"), before: startIndex) ?? -1
return lastGuardIndex > lastStartIndex && linewrapStack.last == true && lastEndIndex < lastGuardIndex
}
func inFunctionDeclarationWhereReturnTypeIsWrappedToStartOfLine(at i: Int) -> Bool {
guard let returnOperatorIndex = formatter.startOfReturnType(at: i) else {
return false
}
return formatter.last(.nonSpaceOrComment, before: returnOperatorIndex)?.isLinebreak == true
}
if formatter.options.fragment,
let firstIndex = formatter.index(of: .nonSpaceOrLinebreak, after: -1),
let indentToken = formatter.token(at: firstIndex - 1), case let .space(string) = indentToken {
indentStack[0] = string
}
formatter.forEachToken { i, token in
func popScope() {
if linewrapStack.last == true {
indentStack.removeLast()
stringBodyIndentStack.removeLast()
}
indentStack.removeLast()
stringBodyIndentStack.removeLast()
indentCounts.removeLast()
linewrapStack.removeLast()
scopeStartLineIndexes.removeLast()
scopeStack.removeLast()
}
func stringBodyIndent(at i: Int) -> String {
var space = ""
let start = formatter.startOfLine(at: i)
if let index = formatter.index(of: .nonSpace, in: start ..< i),
case let .stringBody(string) = formatter.tokens[index],
string.unicodeScalars.first?.isSpace == true {
var index = string.startIndex
while index < string.endIndex, string[index].unicodeScalars.first!.isSpace {
space.append(string[index])
index = string.index(after: index)
}
}
return space
}
var i = i
switch token {
case let .startOfScope(string):
switch string {
case ":" where scopeStack.last == .endOfScope("case"):
popScope()
case "{" where !formatter.isStartOfClosure(at: i, in: scopeStack.last) && linewrapStack.last == true &&
(!formatter.options.xcodeIndentation || !isGuardElseClause(at: i, token: token)):
indentStack.removeLast()
linewrapStack[linewrapStack.count - 1] = false
default:
break
}
// Handle start of scope
scopeStack.append(token)
var indentCount: Int
if lineIndex > scopeStartLineIndexes.last ?? -1 {
indentCount = 1
} else {
indentCount = indentCounts.last! + 1
}
var indent = indentStack[indentStack.count - indentCount]
// If using xcodeindentation, increase indent if '->' for function return value
// is wrapped to start of a line in the current scope.
if formatter.options.xcodeIndentation,
string == "{",
inFunctionDeclarationWhereReturnTypeIsWrappedToStartOfLine(at: i - 1) {
indent += formatter.options.indent
}
switch string {
case "/*":
if scopeStack.count < 2 || scopeStack[scopeStack.count - 2] != .startOfScope("/*") {
// Comments only indent one space
indent += " "
}
case ":":
indent += formatter.options.indent
if formatter.options.indentCase,
scopeStack.count < 2 || scopeStack[scopeStack.count - 2] != .startOfScope("#if") {
indent += formatter.options.indent
}
case "#if":
if let lineIndex = formatter.index(of: .linebreak, after: i),
let nextKeyword = formatter.next(.nonSpaceOrCommentOrLinebreak, after: lineIndex), [
.endOfScope("case"), .endOfScope("default"), .keyword("@unknown"),
].contains(nextKeyword) {
indent = indentStack[indentStack.count - indentCount - 1]
if formatter.options.indentCase {
indent += formatter.options.indent
}
}
switch formatter.options.ifdefIndent {
case .indent:
i += formatter.insertSpace(indent, at: formatter.startOfLine(at: i))
indent += formatter.options.indent
case .noIndent:
i += formatter.insertSpace(indent, at: formatter.startOfLine(at: i))
case .outdent:
i += formatter.insertSpace("", at: formatter.startOfLine(at: i))
}
case "[", "(":
guard let linebreakIndex = formatter.index(of: .linebreak, after: i),
let nextIndex = formatter.index(of: .nonSpace, after: i),
nextIndex != linebreakIndex else {
fallthrough
}
if formatter.last(.nonSpaceOrComment, before: linebreakIndex) != .delimiter(","),
formatter.next(.nonSpaceOrComment, after: linebreakIndex) != .delimiter(",") {
fallthrough
}
let start = formatter.startOfLine(at: i)
// Align indent with previous value
indentCount = 1
indent = formatter.spaceEquivalentToTokens(from: start, upTo: nextIndex)
default:
if token.isMultilineStringDelimiter {
// Don't indent multiline string literals
break
}
let stringIndent = stringBodyIndent(at: i)
stringBodyIndentStack[stringBodyIndentStack.count - 1] = stringIndent
indent += stringIndent + formatter.options.indent
}
indentStack.append(indent)
stringBodyIndentStack.append("")
indentCounts.append(indentCount)
scopeStartLineIndexes.append(lineIndex)
linewrapStack.append(false)
case .space:
if i == 0, !formatter.options.fragment,
formatter.token(at: i + 1)?.isLinebreak != true {
formatter.removeToken(at: i)
}
case .error("}"), .error("]"), .error(")"), .error(">"):
// Handled over-terminated fragment
if let prevToken = formatter.token(at: i - 1) {
if case let .space(string) = prevToken {
let prevButOneToken = formatter.token(at: i - 2)
if prevButOneToken == nil || prevButOneToken!.isLinebreak {
indentStack[0] = string
}
} else if prevToken.isLinebreak {
indentStack[0] = ""
}
}
return
case .keyword("#else"), .keyword("#elseif"):
var indent = indentStack[indentStack.count - 2]
if scopeStack.last == .startOfScope(":") {
indent = indentStack[indentStack.count - 4]
if formatter.options.indentCase {
indent += formatter.options.indent
}
}
let start = formatter.startOfLine(at: i)
switch formatter.options.ifdefIndent {
case .indent, .noIndent:
i += formatter.insertSpace(indent, at: start)
case .outdent:
i += formatter.insertSpace("", at: start)
}
default:
// Handle end of scope
if let scope = scopeStack.last, token.isEndOfScope(scope) {
let indentCount = indentCounts.last! - 1
popScope()
guard !token.isLinebreak, lineIndex > scopeStartLineIndexes.last ?? -1 else {
break
}
// If indentCount > 0, drop back to previous indent level
if indentCount > 0 {
indentStack.removeLast()
indentStack.append(indentStack.last ?? "")
stringBodyIndentStack.removeLast()
stringBodyIndentStack.append(stringBodyIndentStack.last ?? "")
}
// Check if line on which scope ends should be unindented
let start = formatter.startOfLine(at: i)
guard !formatter.isCommentedCode(at: start),
// Don't reduce indent if end of scope is not first token in line
formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: start - 1) == i else {
break
}
// Reduce indent for closing scope of guard else back to normal
if formatter.options.xcodeIndentation, linewrapStack.last == true,
isGuardElseClause(at: i, token: token) {
indentStack.removeLast()
linewrapStack[linewrapStack.count - 1] = false
}
// Only indent if this is the last scope terminator in the line
guard formatter.next(.endOfScope, in: i + 1 ..< formatter.endOfLine(at: i)) == nil else {
break
}
if token == .endOfScope("#endif"), formatter.options.ifdefIndent == .outdent {
i += formatter.insertSpace("", at: start)
} else {
var indent = indentStack.last ?? ""
if [.endOfScope("case"), .endOfScope("default")].contains(token),
formatter.options.indentCase, scopeStack.last != .startOfScope("#if") {
indent += formatter.options.indent
}
let stringIndent = stringBodyIndentStack.last!
i += formatter.insertSpace(stringIndent + indent, at: start)
}
} else if token == .endOfScope("#endif"), indentStack.count > 1 {
var indent = indentStack[indentStack.count - 2]
if scopeStack.last == .startOfScope(":"), indentStack.count > 1 {
indent = indentStack[indentStack.count - 4]
if formatter.options.indentCase {
indent += formatter.options.indent
}
popScope()
}
switch formatter.options.ifdefIndent {
case .indent, .noIndent:
i += formatter.insertSpace(indent, at: formatter.startOfLine(at: i))
case .outdent:
i += formatter.insertSpace("", at: formatter.startOfLine(at: i))
}
if scopeStack.last == .startOfScope("#if") {
popScope()
}
}
}
switch token {
case .endOfScope("case"):
scopeStack.append(token)
var indent = (indentStack.last ?? "")
if formatter.next(.nonSpaceOrComment, after: i)?.isLinebreak == true {
indent += formatter.options.indent
} else {
if formatter.options.indentCase {
indent += formatter.options.indent
}
// Align indent with previous case value
indent += formatter.spaceEquivalentToWidth(5)
}
indentStack.append(indent)
stringBodyIndentStack.append("")
indentCounts.append(1)
scopeStartLineIndexes.append(lineIndex)
linewrapStack.append(false)
fallthrough
case .endOfScope("default"), .keyword("@unknown"),
.startOfScope("#if"), .keyword("#else"), .keyword("#elseif"):
var index = formatter.startOfLine(at: i)
if index == i || index == i - 1 {
let indent: String
if case let .space(space) = formatter.tokens[index] {
indent = space
} else {
indent = ""
}
index -= 1
while let prevToken = formatter.token(at: index - 1), prevToken.isComment,
let startIndex = formatter.index(of: .nonSpaceOrComment, before: index),
formatter.tokens[startIndex].isLinebreak {
// Set indent for comment immediately before this line to match this line
if !formatter.isCommentedCode(at: startIndex + 1) {
formatter.insertSpace(indent, at: startIndex + 1)
}
if case .endOfScope("*/") = prevToken,
var index = formatter.index(of: .startOfScope("/*"), after: startIndex) {
while let linebreakIndex = formatter.index(of: .linebreak, after: index) {
formatter.insertSpace(indent + " ", at: linebreakIndex + 1)
index = linebreakIndex
}
}
index = startIndex
}
}
case .linebreak:
// Detect linewrap
let nextTokenIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: i)
let linewrapped =
!formatter.isEndOfStatement(at: lastNonSpaceOrLinebreakIndex, in: scopeStack.last) ||
!(nextTokenIndex == nil ||
formatter.isStartOfStatement(at: nextTokenIndex!, in: scopeStack.last)) ||
(formatter.options.xcodeIndentation && isGuardElseClause(at: i, token: token))
// Determine current indent
var indent = indentStack.last ?? ""
if linewrapped, lineIndex == scopeStartLineIndexes.last {
indent = indentStack.count > 1 ? indentStack[indentStack.count - 2] : ""
}
lineIndex += 1
func shouldIndentNextLine(at i: Int) -> Bool {
// If there is a linebreak after certain symbols, we should add
// an additional indentation to the lines at the same indention scope
// after this line.
let endOfLine = formatter.endOfLine(at: i)
switch formatter.token(at: endOfLine - 1) {
case .keyword("return")?, .operator("=", .infix)?:
let endOfNextLine = formatter.endOfLine(at: endOfLine + 1)
switch formatter.last(.nonSpaceOrCommentOrLinebreak, before: endOfNextLine) {
case .operator(_, .infix)?, .delimiter(",")?:
return formatter.options.xcodeIndentation
default:
return formatter.lastIndex(of: .startOfScope,
in: i ..< endOfNextLine) == nil
}
default:
return false
}
}
// Begin wrap scope
if linewrapStack.last == true {
if !linewrapped {
indentStack.removeLast()
linewrapStack[linewrapStack.count - 1] = false
indent = indentStack.last!
}
} else if linewrapped {
linewrapStack[linewrapStack.count - 1] = true
func isWrappedDeclaration() -> Bool {
guard formatter.last(.nonSpaceOrCommentOrLinebreak, before: i) == .delimiter(","),
let keywordIndex = formatter.index(of: .keyword, before: i, if: {
["class", "struct", "enum", "protocol", "case",
"func", "var", "let"].contains($0.string)
}) else { return false }
let start: Int
if let currentScope = formatter.currentScope(at: i) {
start = formatter.index(of: currentScope, before: i) ?? formatter.startOfLine(at: i) - 1
} else {
start = formatter.startOfLine(at: i) - 1
}
return keywordIndex > formatter.index(of: .startOfScope, before: i) ?? -1
&& keywordIndex <= formatter.index(of: .keyword, after: start) ?? i
}
// Don't indent enum cases if Xcode indentation is set
// Don't indent line starting with dot if previous line was just a closing scope
let lastToken = formatter.token(at: lastNonSpaceOrLinebreakIndex)
if !formatter.options.xcodeIndentation || !isWrappedDeclaration(),
formatter.token(at: nextTokenIndex ?? -1) != .operator(".", .infix) ||
!(lastToken?.isEndOfScope == true && lastToken != .endOfScope("case") &&
formatter.last(.nonSpace, before:
lastNonSpaceOrLinebreakIndex)?.isLinebreak == true) {
indent += formatter.options.indent
}
indentStack.append(indent)
stringBodyIndentStack.append("")
}
guard var nextNonSpaceIndex = formatter.index(of: .nonSpace, after: i),
// Avoid indenting commented code
!formatter.isCommentedCode(at: nextNonSpaceIndex) else {
break
}
// Apply indent
switch formatter.tokens[nextNonSpaceIndex] {
case .linebreak where formatter.options.truncateBlankLines:
formatter.insertSpace("", at: i + 1)
case .error, .keyword("#else"), .keyword("#elseif"), .endOfScope("#endif"),
.startOfScope("#if") where formatter.options.ifdefIndent != .indent:
break
case .startOfScope("/*"), .commentBody, .endOfScope("*/"):
nextNonSpaceIndex = formatter.endOfScope(at: nextNonSpaceIndex) ?? nextNonSpaceIndex
fallthrough
case .startOfScope("//"):
nextNonSpaceIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak,
after: nextNonSpaceIndex) ?? nextNonSpaceIndex
nextNonSpaceIndex = formatter.index(of: .nonSpaceOrLinebreak,
before: nextNonSpaceIndex) ?? nextNonSpaceIndex
if let lineIndex = formatter.index(of: .linebreak, after: nextNonSpaceIndex),
let nextToken = formatter.next(.nonSpace, after: lineIndex),
[.startOfScope("#if"), .keyword("#else"), .keyword("#elseif")].contains(nextToken) {
break
}
fallthrough
case .startOfScope("#if"):
if let lineIndex = formatter.index(of: .linebreak, after: nextNonSpaceIndex),
let nextKeyword = formatter.next(.nonSpaceOrCommentOrLinebreak, after: lineIndex), [
.endOfScope("case"), .endOfScope("default"), .keyword("@unknown"),
].contains(nextKeyword) {
break
}
formatter.insertSpace(indent, at: i + 1)
case .endOfScope, .keyword("@unknown"):
if let scope = scopeStack.last {
switch scope {
case .startOfScope("/*"), .startOfScope("#if"),
.keyword("#else"), .keyword("#elseif"),
.startOfScope where scope.isStringDelimiter:
formatter.insertSpace(indent, at: i + 1)
default:
break
}
}
default:
formatter.insertSpace(indent, at: i + 1)
}
if linewrapped, shouldIndentNextLine(at: i) {
indentStack[indentStack.count - 1] += formatter.options.indent
}
default:
break
}
// Track token for line wraps
if !token.isSpaceOrComment {
lastNonSpaceIndex = i
if !token.isLinebreak {
lastNonSpaceOrLinebreakIndex = i
}
}
}
}
// Implement brace-wrapping rules
public let braces = FormatRule(
help: "Wrap braces in accordance with selected style (K&R or Allman).",
options: ["allman"],
sharedOptions: ["linebreaks"]
) { formatter in
formatter.forEach(.startOfScope("{")) { i, _ in
guard let closingBraceIndex = formatter.endOfScope(at: i),
// Check this isn't an inline block
formatter.index(of: .linebreak, in: i + 1 ..< closingBraceIndex) != nil,
let prevToken = formatter.last(.nonSpaceOrCommentOrLinebreak, before: i),
![.delimiter(","), .keyword("in")].contains(prevToken),
!prevToken.is(.startOfScope) else {
return
}
if let penultimateToken = formatter.last(.nonSpaceOrComment, before: closingBraceIndex),
!penultimateToken.isLinebreak {
formatter.insertSpace(formatter.indentForLine(at: i), at: closingBraceIndex)
formatter.insertLinebreak(at: closingBraceIndex)
if formatter.token(at: closingBraceIndex - 1)?.isSpace == true {
formatter.removeToken(at: closingBraceIndex - 1)
}
}
guard !formatter.isStartOfClosure(at: i) else {
return
}
if formatter.options.allmanBraces {
// Implement Allman-style braces, where opening brace appears on the next line
switch formatter.last(.nonSpace, before: i) ?? .space("") {
case .identifier, .keyword, .endOfScope, .number,
.operator("?", .postfix), .operator("!", .postfix):
formatter.insertLinebreak(at: i)
if let breakIndex = formatter.index(of: .linebreak, after: i + 1),
let nextIndex = formatter.index(of: .nonSpace, after: breakIndex, if: { $0.isLinebreak }) {
formatter.removeTokens(inRange: breakIndex ..< nextIndex)
}
formatter.insertSpace(formatter.indentForLine(at: i), at: i + 1)
if formatter.tokens[i - 1].isSpace {
formatter.removeToken(at: i - 1)
}
default:
break
}
} else {
// Implement K&R-style braces, where opening brace appears on the same line
guard let prevIndex = formatter.index(of: .nonSpaceOrLinebreak, before: i),
formatter.tokens[prevIndex ..< i].contains(where: { $0.isLinebreak }),
!formatter.tokens[prevIndex].isComment else {
return
}
formatter.replaceTokens(inRange: prevIndex + 1 ..< i, with: [.space(" ")])
}
}
}
/// 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.
/// Also applies to `catch` after `try` and `while` after `repeat`.
public let elseOnSameLine = FormatRule(
help: """
Place `else`, `catch` or `while` keyword in accordance with current style (same or
next line).
""",
options: ["elseposition"],
sharedOptions: ["allman", "linebreaks"]
) { formatter in
func bracesContainLinebreak(_ endIndex: Int) -> Bool {
guard let startIndex = formatter.index(of: .startOfScope("{"), before: endIndex) else {
return false
}
return (startIndex ..< endIndex).contains(where: { formatter.tokens[$0].isLinebreak })
}
formatter.forEachToken { i, token in
switch token {
case .keyword("while"):
if let endIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: i, if: {
$0 == .endOfScope("}")
}), let startIndex = formatter.index(of: .startOfScope("{"), before: endIndex),
formatter.last(.nonSpaceOrCommentOrLinebreak, before: startIndex) == .keyword("repeat") {
fallthrough
}
case .keyword("else"), .keyword("catch"):
guard let prevIndex = formatter.index(of: .nonSpace, before: i) else {
return
}
let shouldWrap = formatter.options.allmanBraces || formatter.options.elseOnNextLine
if !shouldWrap, formatter.tokens[prevIndex].isLinebreak {
if let prevBraceIndex = formatter.index(of: .nonSpaceOrLinebreak, before: prevIndex, if: {
$0 == .endOfScope("}")
}), bracesContainLinebreak(prevBraceIndex) {
formatter.replaceTokens(inRange: prevBraceIndex + 1 ..< i, with: [.space(" ")])
}
} else if shouldWrap, let token = formatter.token(at: prevIndex), !token.isLinebreak,
let prevBraceIndex = (token == .endOfScope("}")) ? prevIndex :
formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: prevIndex, if: {
$0 == .endOfScope("}")
}), bracesContainLinebreak(prevBraceIndex) {
formatter.replaceTokens(inRange: prevIndex + 1 ..< i, with:
[formatter.linebreakToken(for: prevIndex + 1)])
formatter.insertSpace(formatter.indentForLine(at: i), at: prevIndex + 2)
}
default:
break
}
}
}
/// 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 let trailingCommas = FormatRule(
help: "Add or remove trailing comma from the last item in a collection literal.",
options: ["commas"]
) { formatter in
formatter.forEach(.endOfScope("]")) { i, _ in
guard let prevTokenIndex = formatter.index(of: .nonSpaceOrComment, before: i) else { return }
if let startIndex = formatter.index(of: .startOfScope("["), before: i),
let prevToken = formatter.last(.nonSpaceOrComment, before: startIndex) {
switch prevToken {
case .identifier,
.operator("!", .postfix), .operator("?", .postfix),
.endOfScope(")"), .endOfScope("]"):
// Subscript
return
case .delimiter(":"):
// Check for type declaration
if let scopeStart = formatter.index(of: .startOfScope, before: startIndex),
formatter.tokens[scopeStart] == .startOfScope("(") {
if formatter.last(.keyword, before: scopeStart) == .keyword("func") {
return
}
} else if let token = formatter.last(.keyword, before: startIndex),
[.keyword("let"), .keyword("var")].contains(token) {
return
}
case .operator("->", .infix):
return
default:
break
}
}
switch formatter.tokens[prevTokenIndex] {
case .linebreak:
guard let prevTokenIndex = formatter.index(
of: .nonSpaceOrCommentOrLinebreak, before: prevTokenIndex + 1
) else {
break
}
switch formatter.tokens[prevTokenIndex] {
case .startOfScope("["), .delimiter(":"):
break // do nothing
case .delimiter(","):
if !formatter.options.trailingCommas {
formatter.removeToken(at: prevTokenIndex)
}
default:
if formatter.options.trailingCommas {
formatter.insertToken(.delimiter(","), at: prevTokenIndex + 1)
}
}
case .delimiter(","):
formatter.removeToken(at: prevTokenIndex)
default:
break
}
}
}
/// Ensure that TODO, MARK and FIXME comments are followed by a : as required
public let todos = FormatRule(
help: "Use correct formatting for `TODO:`, `MARK:` or `FIXME:` comments."
) { formatter in
formatter.forEachToken { i, token in
guard case var .commentBody(string) = token else {
return
}
var removedSpace = false
if string.hasPrefix("/") {
removedSpace = true
string = string.replacingOccurrences(of: "^/(\\s+)", with: "", options: .regularExpression)
}
for pair in [
"todo:": "TODO:",
"todo :": "TODO:",
"fixme:": "FIXME:",
"fixme :": "FIXME:",
"mark:": "MARK:",
"mark :": "MARK:",
"mark-": "MARK: -",
"mark -": "MARK: -",
] where string.lowercased().hasPrefix(pair.0) {
string = pair.1 + string.dropFirst(pair.0.count)
}
guard let tag = ["TODO", "MARK", "FIXME"].first(where: { string.hasPrefix($0) }) else {
return
}
var suffix: String = String(string[tag.endIndex ..< string.endIndex])
if let first = suffix.unicodeScalars.first, !" :".unicodeScalars.contains(first) {
// If not followed by a space or :, don't mess with it as it may be a custom format
return
}
while let first = suffix.unicodeScalars.first, " :".unicodeScalars.contains(first) {
suffix = String(suffix.dropFirst())
}
if tag == "MARK", suffix.hasPrefix("-"), suffix != "-", !suffix.hasPrefix("- ") {
suffix = "- " + suffix.dropFirst()
}
formatter.replaceToken(at: i, with: .commentBody(tag + ":" + (suffix.isEmpty ? "" : " \(suffix)")))
if removedSpace {
formatter.insertSpace(" ", at: i)
}
}
}
/// Remove semicolons, except where doing so would change the meaning of the code
public let semicolons = FormatRule(
help: "Remove semicolons.",
options: ["semicolons"],
sharedOptions: ["linebreaks"]
) { formatter in
formatter.forEach(.delimiter(";")) { i, _ in
if let nextToken = formatter.next(.nonSpaceOrCommentOrLinebreak, after: i) {
let prevToken = formatter.last(.nonSpaceOrCommentOrLinebreak, before: i)
if prevToken == nil || nextToken == .endOfScope("}") {
// Safe to remove
formatter.removeToken(at: i)
} else if prevToken == .keyword("return") || (
formatter.options.swiftVersion < "3" &&
// Might be a traditional for loop (not supported in Swift 3 and above)
formatter.currentScope(at: i) == .startOfScope("(")
) {
// Not safe to remove or replace
} else if formatter.next(.nonSpaceOrComment, after: i)?.isLinebreak == true {
// Safe to remove
formatter.removeToken(at: i)
} else if !formatter.options.allowInlineSemicolons {
// Replace with a linebreak
if formatter.token(at: i + 1)?.isSpace == true {
formatter.removeToken(at: i + 1)
}
formatter.insertSpace(formatter.indentForLine(at: i), at: i + 1)
formatter.replaceToken(at: i, with: formatter.linebreakToken(for: i))
}
} else {
// Safe to remove
formatter.removeToken(at: i)
}
}
}
/// Standardise linebreak characters as whatever is specified in the options (\n by default)
public let linebreaks = FormatRule(
help: "Use specified linebreak character for all linebreaks (CR, LF or CRLF).",
options: ["linebreaks"]
) { formatter in
formatter.forEach(.linebreak) { i, _ in
formatter.replaceToken(at: i, with: formatter.linebreakToken(for: i))
}
}
/// Standardise the order of property specifiers
public let specifiers = FormatRule(
help: "Use consistent ordering for member specifiers.",
options: ["specifierorder"]
) { formatter in
formatter.forEach(.keyword) { i, token in
switch token.string {
case "let", "func", "var", "class", "extension", "init", "enum",
"struct", "typealias", "subscript", "associatedtype", "protocol":
break
default:
return
}
var specifiers = [String: [Token]]()
var lastSpecifier: (String, [Token])?
var lastIndex = i
var previousIndex = lastIndex
loop: while let index = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: lastIndex) {
switch formatter.tokens[index] {
case .operator(_, .prefix), .operator(_, .infix), .keyword("case"):
// Last specifier was invalid
lastSpecifier = nil
lastIndex = previousIndex
break loop
case let .keyword(string), let .identifier(string):
if !allSpecifiers.contains(string) {
break loop
}
lastSpecifier.map { specifiers[$0.0] = $0.1 }
lastSpecifier = (string, [Token](formatter.tokens[index ..< lastIndex]))
previousIndex = lastIndex
lastIndex = index
case .endOfScope(")"):
if formatter.last(.nonSpaceOrCommentOrLinebreak, before: index) == .identifier("set"),
let openParenIndex = formatter.index(of: .startOfScope("("), before: index),
let index = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: openParenIndex),
case let .keyword(string)? = formatter.token(at: index), aclSpecifiers.contains(string) {
lastSpecifier.map { specifiers[$0.0] = $0.1 }
lastSpecifier = (string + "(set)", [Token](formatter.tokens[index ..< lastIndex]))
previousIndex = lastIndex
lastIndex = index
} else {
break loop
}
default:
// Not a specifier
break loop
}
}
lastSpecifier.map { specifiers[$0.0] = $0.1 }
guard !specifiers.isEmpty else { return }
var sortedSpecifiers = [Token]()
for specifier in formatter.specifierOrder {
if let tokens = specifiers[specifier] {
sortedSpecifiers += tokens
}
}
formatter.replaceTokens(inRange: lastIndex ..< i, with: sortedSpecifiers)
}
}
/// Convert closure arguments to trailing closure syntax where possible
/// NOTE: Parens around trailing closures are sometimes required for disambiguation.
/// SwiftFormat can't detect those cases, so `trailingClosures` is disabled by default
public let trailingClosures = FormatRule(
help: "Use trailing closure syntax where applicable.",
options: ["trailingclosures"]
) { formatter in
let whitelist = Set(
["async", "asyncAfter", "sync", "autoreleasepool"] + formatter.options.trailingClosures
)
let blacklist = Set(["performBatchUpdates"])
formatter.forEach(.startOfScope("(")) { i, _ in
guard let prevToken = formatter.last(.nonSpaceOrCommentOrLinebreak, before: i),
case let .identifier(name) = prevToken, // TODO: are trailing closures allowed in other cases?
!blacklist.contains(name), !formatter.isConditionalStatement(at: i) else {
return
}
guard let closingIndex = formatter.index(of: .endOfScope(")"), after: i), let closingBraceIndex =
formatter.index(of: .nonSpaceOrComment, before: closingIndex, if: { $0 == .endOfScope("}") }),
let openingBraceIndex = formatter.index(of: .startOfScope("{"), before: closingBraceIndex),
formatter.index(of: .endOfScope("}"), before: openingBraceIndex) == nil else {
return
}
guard formatter.next(.nonSpaceOrCommentOrLinebreak, after: closingIndex) != .startOfScope("{"),
var startIndex = formatter.index(of: .nonSpaceOrLinebreak, before: openingBraceIndex) else {
return
}
switch formatter.tokens[startIndex] {
case .delimiter(","), .startOfScope("("):
break
case .delimiter(":"):
guard whitelist.contains(name) else {
return
}
if let commaIndex = formatter.index(of: .delimiter(","), before: openingBraceIndex) {
startIndex = commaIndex
} else if formatter.index(of: .startOfScope("("), before: openingBraceIndex) == i {
startIndex = i
} else {
return
}
default:
return
}
let wasParen = (startIndex == i)
formatter.removeParen(at: closingIndex)
formatter.replaceTokens(inRange: startIndex ..< openingBraceIndex, with:
wasParen ? [.space(" ")] : [.endOfScope(")"), .space(" ")])
}
}
/// Remove redundant parens around the arguments for loops, if statements, closures, etc.
public let redundantParens = FormatRule(
help: "Remove redundant parentheses."
) { formatter in
func nestedParens(in range: ClosedRange<Int>) -> ClosedRange<Int>? {
guard let startIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: range.lowerBound, if: {
$0 == .startOfScope("(")
}), let endIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: range.upperBound, if: {
$0 == .endOfScope(")")
}), formatter.index(of: .endOfScope(")"), after: startIndex) == endIndex else {
return nil
}
return startIndex ... endIndex
}
// TODO: unify with conditionals logic in trailingClosures
let conditionals = Set(["in", "while", "if", "case", "switch", "where", "for", "guard"])
formatter.forEach(.startOfScope("(")) { i, _ in
guard var closingIndex = formatter.index(of: .endOfScope(")"), after: i) else {
return
}
var innerParens = nestedParens(in: i ... closingIndex)
while let range = innerParens, nestedParens(in: range) != nil {
// TODO: this could be a lot more efficient if we kept track of the
// removed token indices instead of recalculating paren positions every time
formatter.removeParen(at: range.upperBound)
formatter.removeParen(at: range.lowerBound)
closingIndex = formatter.index(of: .endOfScope(")"), after: i)!
innerParens = nestedParens(in: i ... closingIndex)
}
let nextToken = formatter.next(.nonSpaceOrCommentOrLinebreak, after: closingIndex) ?? .space("")
if [.operator("->", .infix), .keyword("throws"), .keyword("rethrows")].contains(nextToken) {
return // It's a closure type or function declaration
}
let previousIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: i) ?? -1
let token = formatter.token(at: previousIndex) ?? .space("")
switch token {
case .endOfScope("]"):
if let startIndex = formatter.index(of: .startOfScope("["), before: previousIndex),
formatter.last(.nonSpaceOrCommentOrLinebreak, before: startIndex) == .startOfScope("{") {
fallthrough // Could be a capture list
}
case .startOfScope("{"):
guard formatter.next(.nonSpaceOrCommentOrLinebreak, after: closingIndex) == .keyword("in"),
formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: i) != closingIndex,
formatter.index(of: .delimiter(":"), in: i + 1 ..< closingIndex) == nil else {
// Not a closure
if formatter.last(.nonSpaceOrComment, before: i) == .endOfScope("]") {
return
}
fallthrough
}
if formatter.tokens[i + 1 ..< closingIndex].contains(.identifier("self")) {
return
}
if let index = formatter.tokens[i + 1 ..< closingIndex].index(of: .identifier("_")),
formatter.next(.nonSpaceOrComment, after: index)?.isIdentifier == true {
return
}
formatter.removeParen(at: closingIndex)
formatter.removeParen(at: i)
case .stringBody, .operator("?", .postfix), .operator("!", .postfix),
.operator("->", .infix), .keyword("throws"), .keyword("rethrows"):
return
case .identifier: // TODO: are trailing closures allowed in other cases?
// Parens before closure
guard closingIndex == formatter.index(of: .nonSpace, after: i),
let openingIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: closingIndex, if: {
$0 == .startOfScope("{")
}),
formatter.isStartOfClosure(at: openingIndex) else {
return
}
formatter.removeParen(at: closingIndex)
formatter.removeParen(at: i)
case let .keyword(name) where !conditionals.contains(name) && !["let", "var"].contains(name):
return
case .endOfScope("}"), .endOfScope(")"), .endOfScope("]"), .endOfScope(">"):
if formatter.tokens[previousIndex + 1 ..< i].contains(where: { $0.isLinebreak }) {
fallthrough
}
return // Probably a method invocation
case .delimiter(","), .endOfScope, .keyword:
let nextToken = formatter.next(.nonSpaceOrCommentOrLinebreak, after: closingIndex) ?? .space("")
guard formatter.index(of: .endOfScope("}"), before: closingIndex) == nil,
![.endOfScope("}"), .endOfScope(">")].contains(token) ||
![.startOfScope("{"), .delimiter(",")].contains(nextToken) else {
return
}
let string = token.string
if ![.startOfScope("{"), .delimiter(","), .startOfScope(":")].contains(nextToken),
!(string == "for" && nextToken == .keyword("in")),
!(string == "guard" && nextToken == .keyword("else")) {
// TODO: this is confusing - refactor to move fallthrough to end of case
fallthrough
}
if formatter.index(of: .nonSpaceOrCommentOrLinebreak, in: i + 1 ..< closingIndex) == nil ||
formatter.index(of: .delimiter(","), in: i + 1 ..< closingIndex) != nil {
// Might be a tuple, so we won't remove the parens
// TODO: improve the logic here so we don't misidentify function calls as tuples
return
}
formatter.removeParen(at: closingIndex)
formatter.removeParen(at: i)
case .operator(_, .infix):
guard let nextIndex = formatter.index(of: .nonSpaceOrComment, after: i, if: {
$0 == .startOfScope("{")
}), let lastIndex = formatter.index(of: .endOfScope("}"), after: nextIndex),
formatter.index(of: .nonSpaceOrComment, before: closingIndex) == lastIndex else {
fallthrough
}
formatter.removeParen(at: closingIndex)
formatter.removeParen(at: i)
default:
if let range = innerParens {
formatter.removeParen(at: range.upperBound)
formatter.removeParen(at: range.lowerBound)
closingIndex = formatter.index(of: .endOfScope(")"), after: i)!
innerParens = nil
}
if token == .startOfScope("("),
formatter.last(.nonSpaceOrComment, before: previousIndex) == .identifier("Selector") {
return
}
if let nextNonLinebreak = formatter.next(.nonSpaceOrComment, after: closingIndex) {
switch nextNonLinebreak {
case .startOfScope("["), .startOfScope("("), .operator(_, .postfix):
return
default:
break
}
}
guard formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: i) != closingIndex,
formatter.index(in: i + 1 ..< closingIndex, where: {
switch $0 {
case .operator(".", _):
return false
case .operator, .keyword("as"), .keyword("is"), .keyword("try"):
switch token {
case .operator(_, .prefix), .operator(_, .infix), .keyword("as"), .keyword("is"):
return true
default:
break
}
switch nextToken {
case .operator(_, .postfix), .operator(_, .infix), .keyword("as"), .keyword("is"):
return true
default:
return false
}
case .delimiter(","), .delimiter(":"), .delimiter(";"), .startOfScope("{"):
return true
default:
return false
}
}) == nil else {
return
}
formatter.removeParen(at: closingIndex)
formatter.removeParen(at: i)
}
}
}
/// Remove redundant `get {}` clause inside read-only computed property
public let redundantGet = FormatRule(
help: "Remove unneeded `get` clause inside computed properties."
) { formatter in
formatter.forEach(.identifier("get")) { i, _ in
if formatter.isAccessorKeyword(at: i, checkKeyword: false),
let prevIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: i, if: {
$0 == .startOfScope("{")
}), let openIndex = formatter.index(of: .startOfScope("{"), after: i),
let closeIndex = formatter.index(of: .endOfScope("}"), after: openIndex),
let nextIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: closeIndex, if: {
$0 == .endOfScope("}")
}) {
formatter.removeTokens(inRange: closeIndex ..< nextIndex)
formatter.removeTokens(inRange: prevIndex + 1 ... openIndex)
// TODO: fix-up indenting of lines in between removed braces
}
}
}
/// Remove redundant `= nil` initialization for Optional properties
public let redundantNilInit = FormatRule(
help: "Remove redundant `nil` default value (Optional vars are nil by default)."
) { formatter in
func search(from index: Int) {
if let optionalIndex = formatter.index(of: .unwrapOperator, after: index) {
if formatter.index(of: .endOfStatement, in: index + 1 ..< optionalIndex) != nil {
return
}
if !formatter.tokens[optionalIndex - 1].isSpaceOrCommentOrLinebreak,
let equalsIndex = formatter.index(of: .nonSpaceOrLinebreak, after: optionalIndex, if: {
$0 == .operator("=", .infix)
}), let nilIndex = formatter.index(of: .nonSpaceOrLinebreak, after: equalsIndex, if: {
$0 == .identifier("nil")
}) {
formatter.removeTokens(inRange: optionalIndex + 1 ... nilIndex)
}
search(from: optionalIndex)
}
}
// Check specifiers don't include `lazy`
formatter.forEach(.keyword("var")) { i, _ in
if formatter.specifiersForType(at: i, contains: {
let string = $1.string
return string == "lazy" || (string != "@objc" && string.hasPrefix("@"))
}) {
return // Can't remove the init
}
// Check this isn't a Codable
if let scopeIndex = formatter.index(of: .startOfScope("{"), before: i) {
var prevIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: scopeIndex)
loop: while let index = prevIndex {
switch formatter.tokens[index] {
case .identifier("Codable"), .identifier("Decodable"):
return // Can't safely remove the default value
case .keyword("struct"):
if formatter.index(of: .keyword("init"), after: scopeIndex) == nil {
return // Can't safely remove the default value
}
break loop
case .keyword:
break loop
default:
break
}
prevIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: index)
}
}
// Find the nil
search(from: i)
}
}
/// Remove redundant let/var for unnamed variables
public let redundantLet = FormatRule(
help: "Remove redundant `let`/`var` from ignored variables."
) { formatter in
formatter.forEach(.identifier("_")) { i, _ in
guard formatter.next(.nonSpaceOrCommentOrLinebreak, after: i) != .delimiter(":"),
let prevIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: i, if: {
[.keyword("let"), .keyword("var")].contains($0)
}),
let nextNonSpaceIndex = formatter.index(of: .nonSpaceOrLinebreak, after: prevIndex) else {
return
}
if let prevToken = formatter.last(.nonSpaceOrCommentOrLinebreak, before: prevIndex) {
switch prevToken {
case .keyword("if"), .keyword("guard"), .keyword("while"),
.delimiter(",") where formatter.currentScope(at: i) != .startOfScope("("):
return
default:
break
}
}
formatter.removeTokens(inRange: prevIndex ..< nextNonSpaceIndex)
}
}
/// Remove redundant pattern in case statements
public let redundantPattern = FormatRule(
help: "Remove redundant pattern matching parameter syntax."
) { formatter in
func redundantBindings(inRange range: Range<Int>) -> Bool {
var isEmpty = true
for token in formatter.tokens[range.lowerBound ..< range.upperBound] {
switch token {
case .identifier("_"):
isEmpty = false
case .space, .linebreak, .delimiter(","), .keyword("let"), .keyword("var"):
break
default:
return false
}
}
return !isEmpty
}
formatter.forEach(.startOfScope("(")) { i, _ in
let prevIndex = formatter.index(of: .nonSpaceOrComment, before: i)
if let prevIndex = prevIndex, let prevToken = formatter.token(at: prevIndex),
[.keyword("case"), .endOfScope("case")].contains(prevToken) {
// Not safe to remove
return
}
guard let endIndex = formatter.index(of: .endOfScope(")"), after: i),
let nextToken = formatter.next(.nonSpaceOrCommentOrLinebreak, after: endIndex),
[.startOfScope(":"), .operator("=", .infix)].contains(nextToken),
redundantBindings(inRange: i + 1 ..< endIndex) else {
return
}
formatter.removeTokens(inRange: i ... endIndex)
if let prevIndex = prevIndex, formatter.tokens[prevIndex].isIdentifier,
formatter.last(.nonSpaceOrComment, before: prevIndex)?.string == "." {
// Was an enum case
return
}
// Was an assignment
formatter.insertToken(.identifier("_"), at: i)
if formatter.token(at: i - 1).map({ $0.isSpaceOrLinebreak }) != true {
formatter.insertToken(.space(" "), at: i)
}
}
}
/// Remove redundant raw string values for case statements
public let redundantRawValues = FormatRule(
help: "Remove redundant raw string values for enum cases."
) { formatter in
formatter.forEach(.keyword("enum")) { i, _ in
guard let nameIndex = formatter.index(
of: .nonSpaceOrCommentOrLinebreak, after: i, if: { $0.isIdentifier }
), let colonIndex = formatter.index(
of: .nonSpaceOrCommentOrLinebreak, after: nameIndex, if: { $0 == .delimiter(":") }
), formatter.next(.nonSpaceOrCommentOrLinebreak, after: colonIndex) == .identifier("String"),
let braceIndex = formatter.index(of: .startOfScope("{"), after: colonIndex) else {
return
}
var lastIndex = formatter.index(of: .keyword("case"), after: braceIndex)
while var index = lastIndex {
guard let nameIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: index, if: {
$0.isIdentifier
}) else { break }
if let equalsIndex = formatter.index(of: .nonSpaceOrLinebreak, after: nameIndex, if: {
$0 == .operator("=", .infix)
}), let quoteIndex = formatter.index(of: .nonSpaceOrLinebreak, after: equalsIndex, if: {
$0 == .startOfScope("\"")
}), formatter.token(at: quoteIndex + 2) == .endOfScope("\"") {
if formatter.tokens[nameIndex].unescaped() == formatter.token(at: quoteIndex + 1)?.string {
formatter.removeTokens(inRange: nameIndex + 1 ... quoteIndex + 2)
index = nameIndex
} else {
index = quoteIndex + 2
}
} else {
index = nameIndex
}
lastIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: index, if: {
$0 == .delimiter(",")
}) ?? formatter.index(of: .keyword("case"), after: index)
}
}
}
/// Remove redundant void return values for function declarations
public let redundantVoidReturnType = FormatRule(
help: "Remove explicit `Void` return type."
) { formatter in
formatter.forEach(.operator("->", .infix)) { i, _ in
guard var endIndex = formatter.index(of: .nonSpace, after: i) else { return }
switch formatter.tokens[endIndex] {
case .identifier("Void"):
break
case .startOfScope("("):
guard let nextIndex = formatter.index(of: .nonSpace, after: endIndex) else { return }
switch formatter.tokens[nextIndex] {
case .endOfScope(")"):
endIndex = nextIndex
case .identifier("Void"):
guard let nextIndex = formatter.index(of: .nonSpace, after: nextIndex),
case .endOfScope(")") = formatter.tokens[nextIndex] else { return }
endIndex = nextIndex
default:
return
}
default:
return
}
guard formatter.next(.nonSpaceOrCommentOrLinebreak, after: endIndex) == .startOfScope("{") else {
return
}
guard let prevToken = formatter.last(.nonSpaceOrCommentOrLinebreak, before: i),
[.endOfScope(")"), .keyword("throws"), .keyword("rethrows")].contains(prevToken) else { return }
guard let prevIndex = formatter.index(of: .endOfScope(")"), before: i),
let startIndex = formatter.index(of: .startOfScope("("), before: prevIndex),
let startToken = formatter.last(.nonSpaceOrCommentOrLinebreak, before: startIndex),
startToken.isIdentifier || [.startOfScope("{"), .endOfScope("]")].contains(startToken) else {
return
}
formatter.removeTokens(inRange: i ..< formatter.index(of: .nonSpace, after: endIndex)!)
}
}
/// Remove redundant return keyword from single-line closures
public let redundantReturn = FormatRule(
help: "Remove unneeded `return` keyword."
) { formatter in
formatter.forEach(.keyword("return")) { i, _ in
guard let startIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: i) else {
return
}
switch formatter.tokens[startIndex] {
case .keyword("in"):
break
case .startOfScope("{"):
guard var prevIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: startIndex) else {
break
}
if formatter.options.swiftVersion < "5.1", formatter.isAccessorKeyword(at: prevIndex) {
return
}
if formatter.tokens[prevIndex] == .endOfScope(")"),
let j = formatter.index(of: .startOfScope("("), before: prevIndex) {
prevIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: j) ?? j
if formatter.tokens[prevIndex] == .operator("?", .postfix) {
prevIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: prevIndex) ?? prevIndex
}
let prevToken = formatter.tokens[prevIndex]
guard prevToken.isIdentifier || prevToken == .keyword("init") else {
return
}
}
let prevToken = formatter.tokens[prevIndex]
guard ![.delimiter(":"), .startOfScope("(")].contains(prevToken),
var prevKeywordIndex = formatter.indexOfLastSignificantKeyword(at: startIndex) else {
break
}
switch formatter.tokens[prevKeywordIndex].string {
case "let", "var":
guard formatter.options.swiftVersion >= "5.1" || prevToken == .operator("=", .infix) ||
formatter.lastIndex(of: .operator("=", .infix), in: prevKeywordIndex + 1 ..< prevIndex) != nil,
!formatter.isConditionalStatement(at: prevKeywordIndex) else {
return
}
case "func", "throws", "rethrows", "init", "subscript":
if formatter.options.swiftVersion < "5.1" {
return
}
default:
return
}
default:
return
}
formatter.removeToken(at: i)
if var nextIndex = formatter.index(of: .nonSpace, after: i - 1, if: { $0.isLinebreak }) {
if let i = formatter.index(of: .nonSpaceOrLinebreak, after: nextIndex) {
nextIndex = i - 1
}
formatter.removeTokens(inRange: i ... nextIndex)
} else if formatter.token(at: i)?.isSpace == true {
formatter.removeToken(at: i)
}
}
}
/// Remove redundant backticks around non-keywords, or in places where keywords don't need escaping
public let redundantBackticks = FormatRule(
help: "Remove redundant backticks around identifiers."
) { formatter in
formatter.forEach(.identifier) { i, token in
guard token.string.first == "`", !formatter.backticksRequired(at: i) else {
return
}
formatter.replaceToken(at: i, with: .identifier(token.unescaped()))
}
}
/// Remove redundant self keyword
// TODO: restructure this to use forEachToken to avoid exposing processCommentBody mechanism
public let redundantSelf = FormatRule(
help: "Insert/remove explicit `self` where applicable.",
options: ["self", "selfrequired"]
) { formatter in
func processBody(at index: inout Int,
localNames: Set<String>,
members: Set<String>,
typeStack: inout [String],
membersByType: inout [String: Set<String>],
classMembersByType: inout [String: Set<String>],
isTypeRoot: Bool,
isInit: Bool) {
let selfRequired = formatter.options.selfRequired + [
"expect", // Special case to support autoclosure arguments in the Nimble framework
]
let explicitSelf = formatter.options.explicitSelf
let isWhereClause = index > 0 && formatter.tokens[index - 1] == .keyword("where")
assert(isWhereClause || formatter.currentScope(at: index).map { token -> Bool in
[.startOfScope("{"), .startOfScope(":"), .startOfScope("#if")].contains(token)
} ?? true)
if explicitSelf == .remove {
// Check if scope actually includes self before we waste a bunch of time
var scopeCount = 0
loop: for i in index ..< formatter.tokens.count {
switch formatter.tokens[i] {
case .identifier("self"):
break loop // Contains self
case .startOfScope("{"), .startOfScope(":"):
scopeCount += 1
case .endOfScope("}"), .endOfScope("case"), .endOfScope("default"):
if scopeCount == 0 {
index = i + 1
return // Does not contain self
}
scopeCount -= 1
default:
break
}
}
}
// Gather members & local variables
let type = (isTypeRoot && typeStack.count == 1) ? typeStack.first : nil
var members = type.flatMap { membersByType[$0] } ?? members
var classMembers = type.flatMap { classMembersByType[$0] } ?? Set<String>()
var localNames = localNames
if !isTypeRoot || explicitSelf != .remove {
var i = index
var classOrStatic = false
outer: while let token = formatter.token(at: i) {
switch token {
case .keyword("import"):
guard let nextIndex = formatter.index(of: .identifier, after: i) else {
return // error
}
i = nextIndex
case .keyword("class"), .keyword("static"):
classOrStatic = true
case .keyword("repeat"):
guard let nextIndex = formatter.index(of: .keyword("while"), after: i) else {
return // error
}
i = nextIndex
case .keyword("if"), .keyword("while"):
guard let nextIndex = formatter.index(of: .startOfScope("{"), after: i) else {
return // error
}
i = nextIndex
continue
case .keyword("switch"):
guard let nextIndex = formatter.index(of: .startOfScope("{"), after: i),
var endIndex = formatter.index(of: .endOfScope, after: nextIndex) else {
return // error
}
while formatter.tokens[endIndex] != .endOfScope("}") {
guard let nextIndex = formatter.index(of: .startOfScope(":"), after: endIndex),
let _endIndex = formatter.index(of: .endOfScope, after: nextIndex) else {
return // error
}
endIndex = _endIndex
}
i = endIndex
case .keyword("var"), .keyword("let"):
i += 1
if isTypeRoot {
if classOrStatic {
formatter.processDeclaredVariables(at: &i, names: &classMembers)
classOrStatic = false
} else {
formatter.processDeclaredVariables(at: &i, names: &members)
}
} else {
formatter.processDeclaredVariables(at: &i, names: &localNames)
}
case .keyword("func"):
guard let nameToken = formatter.next(.nonSpaceOrCommentOrLinebreak, after: i) else {
break
}
if isTypeRoot {
if classOrStatic {
classMembers.insert(nameToken.unescaped())
classOrStatic = false
} else {
members.insert(nameToken.unescaped())
}
} else {
localNames.insert(nameToken.unescaped())
}
case .startOfScope("("), .startOfScope("#if"), .startOfScope(":"):
break
case .startOfScope:
classOrStatic = false
i = formatter.endOfScope(at: i) ?? (formatter.tokens.count - 1)
case .endOfScope("}"), .endOfScope("case"), .endOfScope("default"):
break outer
default:
break
}
i += 1
}
}
if let type = type {
membersByType[type] = members
classMembersByType[type] = classMembers
}
// Remove or add `self`
var scopeStack = [Token]()
var lastKeyword = ""
var lastKeywordIndex = 0
var classOrStatic = false
while let token = formatter.token(at: index) {
switch token {
case .keyword("is"), .keyword("as"), .keyword("try"):
break
case .keyword("init"), .keyword("subscript"),
.keyword("func") where lastKeyword != "import":
lastKeyword = ""
if classOrStatic {
if !isTypeRoot {
return // error unless formatter.options.fragment = true
}
processFunction(at: &index, localNames: localNames, members: classMembers,
typeStack: &typeStack, membersByType: &membersByType,
classMembersByType: &classMembersByType)
classOrStatic = false
} else {
processFunction(at: &index, localNames: localNames, members: members,
typeStack: &typeStack, membersByType: &membersByType,
classMembersByType: &classMembersByType)
}
assert(formatter.token(at: index) != .endOfScope("}"))
continue
case .keyword("static"):
classOrStatic = true
case .keyword("class"):
if formatter.next(.nonSpaceOrCommentOrLinebreak, after: index)?.isIdentifier == true {
fallthrough
}
if formatter.last(.nonSpaceOrCommentOrLinebreak, before: index) != .delimiter(":") {
classOrStatic = true
}
case .keyword("extension"), .keyword("struct"), .keyword("enum"):
guard formatter.last(.nonSpaceOrCommentOrLinebreak, before: index) != .keyword("import"),
let scopeStart = formatter.index(of: .startOfScope("{"), after: index) else { return }
guard let nameToken = formatter.next(.identifier, after: index),
case let .identifier(name) = nameToken else {
return // error
}
index = scopeStart + 1
typeStack.append(name)
processBody(at: &index, localNames: ["init"], members: [], typeStack: &typeStack,
membersByType: &membersByType, classMembersByType: &classMembersByType,
isTypeRoot: true, isInit: false)
typeStack.removeLast()
case .keyword("var"), .keyword("let"):
index += 1
switch lastKeyword {
case "lazy" where formatter.options.swiftVersion < "4":
loop: while let nextIndex =
formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: index) {
switch formatter.tokens[nextIndex] {
case .keyword("as"), .keyword("is"), .keyword("try"):
break
case .keyword, .startOfScope("{"):
break loop
default:
break
}
index = nextIndex
}
lastKeyword = ""
case "if", "while", "guard":
assert(!isTypeRoot)
// Guard is included because it's an error to reference guard vars in body
var scopedNames = localNames
formatter.processDeclaredVariables(at: &index, names: &scopedNames,
removeSelf: explicitSelf != .insert)
guard let startIndex = formatter.index(of: .startOfScope("{"), after: index) else {
return // error
}
index = startIndex + 1
processBody(at: &index, localNames: scopedNames, members: members, typeStack: &typeStack,
membersByType: &membersByType, classMembersByType: &classMembersByType,
isTypeRoot: false, isInit: isInit)
lastKeyword = ""
default:
lastKeyword = token.string
}
classOrStatic = false
case .keyword("where") where lastKeyword == "in":
lastKeyword = ""
var localNames = localNames
guard let keywordIndex = formatter.index(of: .keyword, before: index),
let prevKeywordIndex = formatter.index(of: .keyword, before: keywordIndex),
let prevKeywordToken = formatter.token(at: prevKeywordIndex),
case .keyword("for") = prevKeywordToken else {
return
}
for token in formatter.tokens[prevKeywordIndex + 1 ..< keywordIndex] {
if case let .identifier(name) = token, name != "_" {
localNames.insert(token.unescaped())
}
}
index += 1
processBody(at: &index, localNames: localNames, members: members, typeStack: &typeStack,
membersByType: &membersByType, classMembersByType: &classMembersByType,
isTypeRoot: false, isInit: isInit)
continue
case .keyword("while") where lastKeyword == "repeat":
lastKeyword = ""
case let .keyword(name):
lastKeyword = name
lastKeywordIndex = index
case .startOfScope("//"), .startOfScope("/*"):
if case let .commentBody(comment)? = formatter.next(.nonSpace, after: index) {
formatter.processCommentBody(comment)
if token == .startOfScope("//") {
formatter.processLinebreak()
}
}
index = formatter.endOfScope(at: index) ?? (formatter.tokens.count - 1)
case .startOfScope("("):
if case let .identifier(fn)? = formatter.last(.nonSpaceOrCommentOrLinebreak, before: index),
selfRequired.contains(fn) {
index = formatter.index(of: .endOfScope(")"), after: index) ?? index
break
}
fallthrough
case .startOfScope where token.isStringDelimiter, .startOfScope("#if"), .startOfScope("["):
scopeStack.append(token)
case .startOfScope(":"):
lastKeyword = ""
case .startOfScope("{") where lastKeyword == "catch":
lastKeyword = ""
var localNames = localNames
localNames.insert("error") // Implicit error argument
index += 1
processBody(at: &index, localNames: localNames, members: members, typeStack: &typeStack,
membersByType: &membersByType, classMembersByType: &classMembersByType,
isTypeRoot: false, isInit: isInit)
continue
case .startOfScope("{") where lastKeyword == "in":
lastKeyword = ""
var localNames = localNames
guard let keywordIndex = formatter.index(of: .keyword, before: index),
let prevKeywordIndex = formatter.index(of: .keyword, before: keywordIndex),
let prevKeywordToken = formatter.token(at: prevKeywordIndex),
case .keyword("for") = prevKeywordToken else { return }
for token in formatter.tokens[prevKeywordIndex + 1 ..< keywordIndex] {
if case let .identifier(name) = token, name != "_" {
localNames.insert(token.unescaped())
}
}
index += 1
if classOrStatic {
assert(isTypeRoot)
processBody(at: &index, localNames: localNames, members: classMembers, typeStack: &typeStack,
membersByType: &membersByType, classMembersByType: &classMembersByType,
isTypeRoot: false, isInit: false)
classOrStatic = false
} else {
processBody(at: &index, localNames: localNames, members: members, typeStack: &typeStack,
membersByType: &membersByType, classMembersByType: &classMembersByType,
isTypeRoot: false, isInit: isInit)
}
continue
case .startOfScope("{") where isWhereClause:
return
case .startOfScope("{") where lastKeyword == "switch":
lastKeyword = ""
index += 1
loop: while let token = formatter.token(at: index) {
index += 1
switch token {
case .endOfScope("case"), .endOfScope("default"):
let localNames = localNames
processBody(at: &index, localNames: localNames, members: members, typeStack: &typeStack,
membersByType: &membersByType, classMembersByType: &classMembersByType,
isTypeRoot: false, isInit: isInit)
index -= 1
case .endOfScope("}"):
break loop
default:
break
}
}
case .startOfScope("{") where ["for", "where", "if", "else", "while", "do"].contains(lastKeyword):
if let scopeIndex = formatter.index(of: .startOfScope, before: index), scopeIndex > lastKeywordIndex {
index = formatter.endOfScope(at: index) ?? (formatter.tokens.count - 1)
break
}
lastKeyword = ""
fallthrough
case .startOfScope("{") where lastKeyword == "repeat":
index += 1
processBody(at: &index, localNames: localNames, members: members, typeStack: &typeStack,
membersByType: &membersByType, classMembersByType: &classMembersByType,
isTypeRoot: false, isInit: isInit)
continue
case .startOfScope("{") where lastKeyword == "var":
lastKeyword = ""
if formatter.isStartOfClosure(at: index, in: scopeStack.last) {
fallthrough
}
var prevIndex = index - 1
var name: String?
while let token = formatter.token(at: prevIndex), token != .keyword("var") {
if token.isLvalue, let nextToken = formatter.nextToken(after: prevIndex, where: {
!$0.isSpaceOrCommentOrLinebreak && !$0.isStartOfScope
}), nextToken.isRvalue, !nextToken.isOperator(".") {
// It's a closure
fallthrough
}
if case let .identifier(_name) = token {
// Is the declared variable
name = _name
}
prevIndex -= 1
}
if let name = name {
processAccessors(["get", "set", "willSet", "didSet"], for: name,
at: &index, localNames: localNames, members: members,
typeStack: &typeStack, membersByType: &membersByType,
classMembersByType: &classMembersByType)
}
continue
case .startOfScope:
index = formatter.endOfScope(at: index) ?? (formatter.tokens.count - 1)
case .identifier("self"):
guard formatter.isEnabled, !isTypeRoot, !localNames.contains("self"),
let dotIndex = formatter.index(of: .nonSpaceOrLinebreak, after: index, if: {
$0 == .operator(".", .infix)
}), let nextIndex = formatter.index(of: .nonSpaceOrLinebreak, after: dotIndex, if: {
$0.isIdentifier && !localNames.contains($0.unescaped())
}) else {
break
}
if explicitSelf == .insert {
break
} else if explicitSelf == .initOnly, isInit {
if formatter.next(.nonSpaceOrCommentOrLinebreak, after: nextIndex) == .operator("=", .infix) {
break
} else if let scopeEnd = formatter.index(of: .endOfScope(")"), after: nextIndex),
formatter.next(.nonSpaceOrCommentOrLinebreak, after: scopeEnd) == .operator("=", .infix) {
break
}
}
if !formatter.backticksRequired(at: nextIndex, ignoreLeadingDot: true) {
formatter.removeTokens(inRange: index ..< nextIndex)
}
case .identifier("type"): // Special case for type(of:)
guard let parenIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: index, if: {
$0 == .startOfScope("(")
}), formatter.next(.nonSpaceOrCommentOrLinebreak, after: parenIndex) == .identifier("of") else {
fallthrough
}
case .identifier:
guard formatter.isEnabled && !isTypeRoot else {
break
}
if explicitSelf == .insert {
// continue
} else if explicitSelf == .initOnly, isInit {
if formatter.next(.nonSpaceOrCommentOrLinebreak, after: index) == .operator("=", .infix) {
// continue
} else if let scopeEnd = formatter.index(of: .endOfScope(")"), after: index),
formatter.next(.nonSpaceOrCommentOrLinebreak, after: scopeEnd) == .operator("=", .infix) {
// continue
} else {
if token.string == "lazy" {
lastKeyword = "lazy"
lastKeywordIndex = index
}
break
}
} else {
if token.string == "lazy" {
lastKeyword = "lazy"
lastKeywordIndex = index
}
break
}
let isAssignment: Bool
if ["for", "var", "let"].contains(lastKeyword),
let prevToken = formatter.last(.nonSpaceOrCommentOrLinebreak, before: index) {
switch prevToken {
case .identifier, .number,
.operator where ![.operator("=", .infix), .operator(".", .prefix)].contains(prevToken),
.endOfScope where prevToken.isStringDelimiter:
isAssignment = false
lastKeyword = ""
default:
isAssignment = true
}
} else {
isAssignment = false
}
if !isAssignment, token.string == "lazy" {
lastKeyword = "lazy"
lastKeywordIndex = index
}
let name = token.unescaped()
guard members.contains(name), !localNames.contains(name), !isAssignment ||
formatter.last(.nonSpaceOrCommentOrLinebreak, before: index) == .operator("=", .infix),
formatter.next(.nonSpaceOrComment, after: index) != .delimiter(":") else {
break
}
if let lastToken = formatter.last(.nonSpaceOrCommentOrLinebreak, before: index),
lastToken.isOperator(".") {
break
}
formatter.insertTokens([.identifier("self"), .operator(".", .infix)], at: index)
index += 2
case .endOfScope("case"), .endOfScope("default"):
return
case .endOfScope:
if token == .endOfScope("#endif") {
while let scope = scopeStack.last {
scopeStack.removeLast()
if scope != .startOfScope("#if") {
break
}
}
} else if let _ /* scope */ = scopeStack.last {
// TODO: fix this bug
// assert(token.isEndOfScope(scope))
scopeStack.removeLast()
} else {
assert(token.isEndOfScope(formatter.currentScope(at: index)!))
index += 1
return
}
case .linebreak:
formatter.processLinebreak()
default:
break
}
index += 1
}
}
func processAccessors(_ names: [String], for name: String, at index: inout Int,
localNames: Set<String>, members: Set<String>,
typeStack: inout [String],
membersByType: inout [String: Set<String>],
classMembersByType: inout [String: Set<String>]) {
var foundAccessors = false
var localNames = localNames
while let nextIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: index, if: {
if case let .identifier(name) = $0, names.contains(name) { return true } else { return false }
}), let startIndex = formatter.index(of: .startOfScope("{"), after: nextIndex) {
foundAccessors = true
index = startIndex + 1
if let parenStart = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: nextIndex, if: {
$0 == .startOfScope("(")
}), let varToken = formatter.next(.identifier, after: parenStart) {
localNames.insert(varToken.unescaped())
} else {
switch formatter.tokens[nextIndex].string {
case "get":
localNames.insert(name)
case "set":
localNames.insert(name)
localNames.insert("newValue")
case "willSet":
localNames.insert("newValue")
case "didSet":
localNames.insert("oldValue")
default:
break
}
}
processBody(at: &index, localNames: localNames, members: members, typeStack: &typeStack,
membersByType: &membersByType, classMembersByType: &classMembersByType,
isTypeRoot: false, isInit: false)
}
if foundAccessors {
guard let endIndex = formatter.index(of: .endOfScope("}"), after: index) else { return }
index = endIndex + 1
} else {
index += 1
localNames.insert(name)
processBody(at: &index, localNames: localNames, members: members, typeStack: &typeStack,
membersByType: &membersByType, classMembersByType: &classMembersByType,
isTypeRoot: false, isInit: false)
}
}
func processFunction(at index: inout Int, localNames: Set<String>, members: Set<String>,
typeStack: inout [String],
membersByType: inout [String: Set<String>],
classMembersByType: inout [String: Set<String>]) {
let startToken = formatter.tokens[index]
var localNames = localNames
guard let startIndex = formatter.index(of: .startOfScope("("), after: index),
let endIndex = formatter.index(of: .endOfScope(")"), after: startIndex) else {
index += 1 // Prevent endless loop
return
}
// Get argument names
index = startIndex
while index < endIndex {
guard let externalNameIndex = formatter.index(of: .identifier, after: index),
let nextIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: externalNameIndex)
else { break }
let token = formatter.tokens[nextIndex]
switch token {
case let .identifier(name) where name != "_":
localNames.insert(token.unescaped())
case .delimiter(":"):
let externalNameToken = formatter.tokens[externalNameIndex]
if case let .identifier(name) = externalNameToken, name != "_" {
localNames.insert(externalNameToken.unescaped())
}
default:
break
}
index = formatter.index(of: .delimiter(","), after: index) ?? endIndex
}
guard let bodyStartIndex = formatter.index(after: endIndex, where: {
switch $0 {
case .startOfScope("{"): // What we're looking for
return true
case .keyword("throws"),
.keyword("rethrows"),
.keyword("where"),
.keyword("is"):
return false // Keep looking
case .keyword:
return true // Not valid between end of arguments and start of body
default:
return false // Keep looking
}
}), formatter.tokens[bodyStartIndex] == .startOfScope("{") else {
return
}
if startToken == .keyword("subscript") {
index = bodyStartIndex
processAccessors(["get", "set"], for: "", at: &index, localNames: localNames,
members: members, typeStack: &typeStack, membersByType: &membersByType,
classMembersByType: &classMembersByType)
return
} else {
index = bodyStartIndex + 1
processBody(at: &index,
localNames: localNames,
members: members,
typeStack: &typeStack,
membersByType: &membersByType,
classMembersByType: &classMembersByType,
isTypeRoot: false,
isInit: startToken == .keyword("init"))
}
}
var typeStack = [String]()
var membersByType = [String: Set<String>]()
var classMembersByType = [String: Set<String>]()
var index = 0
processBody(at: &index, localNames: ["init"], members: [], typeStack: &typeStack,
membersByType: &membersByType, classMembersByType: &classMembersByType,
isTypeRoot: false, isInit: false)
}
/// Replace unused arguments with an underscore
public let unusedArguments = FormatRule(
help: "Mark unused function arguments with `_`.",
options: ["stripunusedargs"]
) { formatter in
func removeUsed<T>(from argNames: inout [String], with associatedData: inout [T], in range: CountableRange<Int>) {
for i in range {
let token = formatter.tokens[i]
if case .identifier = token, let index = argNames.index(of: token.unescaped()),
formatter.last(.nonSpaceOrCommentOrLinebreak, before: i)?.isOperator(".") == false,
formatter.next(.nonSpaceOrCommentOrLinebreak, after: i) != .delimiter(":") ||
formatter.currentScope(at: i) == .startOfScope("[") {
argNames.remove(at: index)
associatedData.remove(at: index)
if argNames.isEmpty {
break
}
}
}
}
// Closure arguments
formatter.forEach(.keyword("in")) { i, _ in
var argNames = [String]()
var nameIndexPairs = [(Int, Int)]()
if let start = formatter.index(of: .startOfScope("{"), before: i) {
var index = i - 1
var argCountStack = [0]
while index > start {
let token = formatter.tokens[index]
switch token {
case let .keyword(name) where !token.isAttribute && !name.hasPrefix("#") && name != "inout":
return
case .endOfScope("}"), .startOfScope("{"):
return
case .endOfScope(")"):
argCountStack.append(argNames.count)
case .startOfScope("("):
argCountStack.removeLast()
case .delimiter(","):
argCountStack[argCountStack.count - 1] = argNames.count
case .operator("->", .infix):
// Everything after this was part of return value
let count = argCountStack.last ?? 0
argNames.removeSubrange(count ..< argNames.count)
nameIndexPairs.removeSubrange(count ..< nameIndexPairs.count)
case .identifier:
guard argCountStack.count < 3,
let prevToken = formatter.last(.nonSpaceOrCommentOrLinebreak, before: index), [
.delimiter(","), .startOfScope("("), .startOfScope("{"), .endOfScope("]"),
].contains(prevToken), let scopeStart = formatter.index(of: .startOfScope, before: index),
![.startOfScope("["), .startOfScope("<")].contains(formatter.tokens[scopeStart]) else {
break
}
let name = token.unescaped()
if let nextIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: index),
let nextToken = formatter.token(at: nextIndex), case .identifier = nextToken {
let internalName = nextToken.unescaped()
if internalName != "_" {
argNames.append(internalName)
nameIndexPairs.append((index, nextIndex))
}
} else if name != "_" {
argNames.append(name)
nameIndexPairs.append((index, index))
}
default:
break
}
index -= 1
}
}
guard !argNames.isEmpty, let bodyEndIndex = formatter.index(of: .endOfScope("}"), after: i) else {
return
}
removeUsed(from: &argNames, with: &nameIndexPairs, in: i + 1 ..< bodyEndIndex)
for pair in nameIndexPairs {
if case .identifier("_") = formatter.tokens[pair.0], pair.0 != pair.1 {
formatter.removeToken(at: pair.1)
if formatter.tokens[pair.1 - 1] == .space(" ") {
formatter.removeToken(at: pair.1 - 1)
}
} else {
formatter.replaceToken(at: pair.1, with: .identifier("_"))
}
}
}
// Function arguments
guard formatter.options.stripUnusedArguments != .closureOnly else {
return
}
formatter.forEachToken { i, token in
guard case let .keyword(keyword) = token, ["func", "init", "subscript"].contains(keyword),
let startIndex = formatter.index(of: .startOfScope("("), after: i),
let endIndex = formatter.index(of: .endOfScope(")"), after: startIndex) else { return }
let isOperator = (keyword == "subscript") ||
(keyword == "func" && formatter.next(.nonSpaceOrCommentOrLinebreak, after: i)?.isOperator == true)
var index = startIndex
var argNames = [String]()
var nameIndexPairs = [(Int, Int)]()
while index < endIndex {
guard let externalNameIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: index, if: {
if case let .identifier(name) = $0 {
return formatter.options.stripUnusedArguments != .unnamedOnly || name == "_"
}
// Probably an empty argument list
return false
}) else { return }
guard let nextIndex =
formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: externalNameIndex) else { return }
let nextToken = formatter.tokens[nextIndex]
switch nextToken {
case let .identifier(name):
if name != "_" {
argNames.append(nextToken.unescaped())
nameIndexPairs.append((externalNameIndex, nextIndex))
}
case .delimiter(":"):
let externalNameToken = formatter.tokens[externalNameIndex]
if case let .identifier(name) = externalNameToken, name != "_" {
argNames.append(externalNameToken.unescaped())
nameIndexPairs.append((externalNameIndex, externalNameIndex))
}
default:
return
}
index = formatter.index(of: .delimiter(","), after: index) ?? endIndex
}
guard !argNames.isEmpty, let bodyStartIndex = formatter.index(after: endIndex, where: {
switch $0 {
case .startOfScope("{"): // What we're looking for
return true
case .keyword("throws"),
.keyword("rethrows"),
.keyword("where"),
.keyword("is"):
return false // Keep looking
case .keyword:
return true // Not valid between end of arguments and start of body
default:
return false // Keep looking
}
}), formatter.tokens[bodyStartIndex] == .startOfScope("{"),
let bodyEndIndex = formatter.index(of: .endOfScope("}"), after: bodyStartIndex) else {
return
}
removeUsed(from: &argNames, with: &nameIndexPairs, in: bodyStartIndex + 1 ..< bodyEndIndex)
for pair in nameIndexPairs.reversed() {
if pair.0 == pair.1 {
if isOperator {
formatter.replaceToken(at: pair.0, with: .identifier("_"))
} else {
formatter.insertToken(.identifier("_"), at: pair.0 + 1)
formatter.insertToken(.space(" "), at: pair.0 + 1)
}
} else if case .identifier("_") = formatter.tokens[pair.0] {
formatter.removeToken(at: pair.1)
if formatter.tokens[pair.1 - 1] == .space(" ") {
formatter.removeToken(at: pair.1 - 1)
}
} else {
formatter.replaceToken(at: pair.1, with: .identifier("_"))
}
}
}
}
/// Move `let` and `var` inside patterns to the beginning
public let hoistPatternLet = FormatRule(
help: "Reposition `let` or `var` bindings within pattern.",
options: ["patternlet"]
) { formatter in
func indicesOf(_ keyword: String, in range: CountableRange<Int>) -> [Int]? {
var indices = [Int]()
var keywordFound = false, identifierFound = false
var count = 0
for index in range {
switch formatter.tokens[index] {
case .keyword(keyword):
indices.append(index)
keywordFound = true
case .identifier("_"):
break
case .identifier where formatter.last(.nonSpaceOrComment, before: index) != .operator(".", .prefix):
identifierFound = true
if keywordFound {
count += 1
}
case .delimiter(","):
guard keywordFound || !identifierFound else {
return nil
}
keywordFound = false
identifierFound = false
case .startOfScope("{"):
return nil
default:
break
}
}
return (keywordFound || !identifierFound) && count > 0 ? indices : nil
}
formatter.forEach(.startOfScope("(")) { i, _ in
let hoist = formatter.options.hoistPatternLet
// Check if pattern already starts with let/var
var openParenIndex = i
var startIndex = i
var keyword = "let"
if var prevIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: i) {
if case .identifier = formatter.tokens[prevIndex] {
prevIndex = formatter.index(before: prevIndex) {
$0.isSpaceOrCommentOrLinebreak || $0.isStartOfScope || $0 == .endOfScope("case")
} ?? -1
startIndex = prevIndex + 1
prevIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: startIndex) ?? 0
}
let prevToken = formatter.tokens[prevIndex]
if [.keyword("let"), .keyword("var")].contains(prevToken) {
if hoist {
// No changes needed
return
}
var prevKeywordIndex = prevIndex
loop: while let index = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: prevKeywordIndex) {
switch formatter.tokens[index] {
case .keyword("case"), .endOfScope("case"):
break loop
case .keyword("let"), .keyword("var"),
.keyword("as"), .keyword("is"), .keyword("try"):
break
case .keyword, .startOfScope("{"), .endOfScope("}"):
// Tuple assignment, not a pattern
return
default:
break
}
prevKeywordIndex = index
}
guard let prevPrevToken = formatter.last(.nonSpaceOrCommentOrLinebreak, before: prevIndex),
[.keyword("case"), .endOfScope("case"), .delimiter(",")].contains(prevPrevToken) else {
// Tuple assignment, not a pattern
return
}
keyword = prevToken.string
formatter.removeTokens(inRange: prevIndex ..< startIndex)
openParenIndex -= (startIndex - prevIndex)
startIndex = prevIndex
} else if hoist == false {
// No changes needed
return
}
}
guard let endIndex = formatter.index(of: .endOfScope(")"), after: openParenIndex) else {
return
}
if hoist {
// Find let/var keyword indices
guard let indices: [Int] = {
guard let indices = indicesOf(keyword, in: openParenIndex + 1 ..< endIndex) else {
keyword = "var"
return indicesOf(keyword, in: openParenIndex + 1 ..< endIndex)
}
return indices
}() else {
return
}
// Remove keywords inside parens
for index in indices.reversed() {
if formatter.tokens[index + 1].isSpace {
formatter.removeToken(at: index + 1)
}
formatter.removeToken(at: index)
}
// Insert keyword before parens
formatter.insertToken(.keyword(keyword), at: startIndex)
formatter.insertToken(.space(" "), at: startIndex + 1)
if let prevToken = formatter.token(at: startIndex - 1),
!prevToken.isSpaceOrCommentOrLinebreak, !prevToken.isStartOfScope {
formatter.insertToken(.space(" "), at: startIndex)
}
} else {
// Find variable indices
var indices = [Int]()
var index = openParenIndex + 1
var wasParenOrComma = true
while index < endIndex {
let token = formatter.tokens[index]
switch token {
case .delimiter(","), .startOfScope("("):
wasParenOrComma = true
case let .identifier(name) where wasParenOrComma:
wasParenOrComma = false
if name != "_", formatter.next(.nonSpaceOrComment, after: index) != .operator(".", .infix) {
indices.append(index)
}
case _ where token.isSpaceOrCommentOrLinebreak:
break
default:
wasParenOrComma = false
}
index += 1
}
// Insert keyword at indices
for index in indices.reversed() {
formatter.insertTokens([.keyword(keyword), .space(" ")], at: index)
}
}
}
}
public let wrap = FormatRule(
help: "Wrap lines that exceed the specified maximum width.",
options: ["maxwidth", "nowrapoperators"],
sharedOptions: ["wraparguments", "wrapparameters", "wrapcollections", "closingparen", "indent",
"trimwhitespace", "linebreaks", "tabwidth", "maxwidth"]
) { formatter in
let maxWidth = formatter.options.maxWidth
guard maxWidth > 0 else { return }
// Wrap collections first to avoid conflict
formatter.wrapCollectionsAndArguments(completePartialWrapping: false,
wrapSingleArguments: false)
// Wrap other line types
var currentIndex = 0
var indent = ""
var alreadyLinewrapped = false
func isLinewrapToken(_ token: Token?) -> Bool {
switch token {
case .delimiter?, .operator(_, .infix)?:
return true
default:
return false
}
}
formatter.forEachToken { i, token in
if i < currentIndex {
return
}
if token.isLinebreak {
indent = formatter.indentForLine(at: i + 1)
alreadyLinewrapped = isLinewrapToken(formatter.last(.nonSpaceOrComment, before: i))
currentIndex = i + 1
} else if let breakPoint = formatter.indexWhereLineShouldWrapInLine(at: i) {
if !alreadyLinewrapped {
indent += formatter.options.indent
}
alreadyLinewrapped = true
let spaceAdded = formatter.insertSpace(indent, at: breakPoint + 1)
formatter.insertLinebreak(at: breakPoint + 1)
currentIndex = breakPoint + spaceAdded + 2
} else {
currentIndex = formatter.endOfLine(at: i)
}
}
formatter.wrapCollectionsAndArguments(completePartialWrapping: true,
wrapSingleArguments: true)
}
/// Normalize argument wrapping style
public let wrapArguments = FormatRule(
help: "Align wrapped function arguments or collection elements.",
orderAfter: ["wrap"],
options: ["wraparguments", "wrapparameters", "wrapcollections", "closingparen"],
sharedOptions: ["indent", "trimwhitespace", "linebreaks", "tabwidth", "maxwidth"]
) { formatter in
formatter.wrapCollectionsAndArguments(completePartialWrapping: true,
wrapSingleArguments: false)
}
/// Normalize the use of void in closure arguments and return values
public let void = FormatRule(
help: "Use `Void` for type declarations and `()` for values.",
options: ["empty"]
) { formatter in
func isArgumentToken(at index: Int) -> Bool {
guard let nextToken = formatter.next(.nonSpaceOrCommentOrLinebreak, after: index) else {
return false
}
switch nextToken {
case .operator("->", .infix), .keyword("throws"), .keyword("rethrows"):
return true
case .startOfScope("{"):
if formatter.tokens[index] == .endOfScope(")"),
let index = formatter.index(of: .startOfScope("("), before: index),
let nameIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: index, if: {
$0.isIdentifier
}), formatter.last(.nonSpaceOrCommentOrLinebreak, before: nameIndex) == .keyword("func") {
return true
}
return false
case .keyword("in"):
if formatter.tokens[index] == .endOfScope(")"),
let index = formatter.index(of: .startOfScope("("), before: index) {
return formatter.last(.nonSpaceOrCommentOrLinebreak, before: index) == .startOfScope("{")
}
return false
default:
return false
}
}
formatter.forEach(.identifier("Void")) { i, _ in
if let nextIndex = formatter.index(of: .nonSpaceOrLinebreak, after: i, if: {
$0 == .endOfScope(")")
}), var prevIndex = formatter.index(of: .nonSpaceOrLinebreak, before: i), {
let token = formatter.tokens[prevIndex]
if token == .delimiter(":"),
let prevPrevIndex = formatter.index(of: .nonSpaceOrLinebreak, before: prevIndex),
formatter.tokens[prevPrevIndex] == .identifier("_"),
let startIndex = formatter.index(of: .nonSpaceOrLinebreak, before: prevPrevIndex),
formatter.tokens[startIndex] == .startOfScope("(") {
prevIndex = startIndex
return true
}
return token == .startOfScope("(")
}() {
if isArgumentToken(at: nextIndex) {
if !formatter.options.useVoid {
// Convert to parens
formatter.replaceToken(at: i, with: .endOfScope(")"))
formatter.insertToken(.startOfScope("("), at: i)
}
} else if formatter.options.useVoid {
// Strip parens
formatter.removeTokens(inRange: i + 1 ... nextIndex)
formatter.removeTokens(inRange: prevIndex ..< i)
} else {
// Remove Void
formatter.removeTokens(inRange: prevIndex + 1 ..< nextIndex)
}
} else if !formatter.options.useVoid || isArgumentToken(at: i) {
if let prevToken = formatter.last(.nonSpaceOrCommentOrLinebreak, before: i),
[.operator(".", .prefix), .operator(".", .infix), .keyword("typealias")].contains(prevToken) {
return
}
if formatter.next(.nonSpaceOrCommentOrLinebreak, after: i) == .startOfScope("(") { return }
// Convert to parens
formatter.replaceToken(at: i, with: .endOfScope(")"))
formatter.insertToken(.startOfScope("("), at: i)
}
}
guard formatter.options.useVoid else {
return
}
formatter.forEach(.startOfScope("(")) { i, _ in
guard let endIndex = formatter.index(of: .nonSpaceOrLinebreak, after: i, if: {
$0 == .endOfScope(")")
}), let prevToken = formatter.last(.nonSpaceOrCommentOrLinebreak, before: i),
!isArgumentToken(at: endIndex) else {
return
}
if formatter.last(.nonSpaceOrCommentOrLinebreak, before: i) == .operator("->", .infix) {
formatter.replaceTokens(inRange: i ... endIndex, with: [.identifier("Void")])
} else if prevToken == .startOfScope("<") ||
(prevToken == .delimiter(",") && formatter.currentScope(at: i) == .startOfScope("<")) {
formatter.replaceTokens(inRange: i ... endIndex, with: [.identifier("Void")])
}
// TODO: other cases
}
}
/// Standardize formatting of numeric literals
public let numberFormatting = FormatRule(
help: "Use consistent grouping for numeric literals.",
options: ["decimalgrouping", "binarygrouping", "octalgrouping", "hexgrouping",
"fractiongrouping", "exponentgrouping", "hexliteralcase", "exponentcase"]
) { formatter in
func applyGrouping(_ grouping: Grouping, to number: inout String) {
switch grouping {
case .none, .group:
number = number.replacingOccurrences(of: "_", with: "")
case .ignore:
return
}
guard case let .group(group, threshold) = grouping, group > 0, number.count >= threshold else {
return
}
var output = Substring()
var index = number.endIndex
var count = 0
repeat {
index = number.index(before: index)
if count > 0, count % group == 0 {
output.insert("_", at: output.startIndex)
}
count += 1
output.insert(number[index], at: output.startIndex)
} while index != number.startIndex
number = String(output)
}
formatter.forEachToken { i, token in
guard case let .number(number, type) = token else {
return
}
let grouping: Grouping
let prefix: String, exponentSeparator: String, parts: [String]
switch type {
case .integer, .decimal:
grouping = formatter.options.decimalGrouping
prefix = ""
exponentSeparator = formatter.options.uppercaseExponent ? "E" : "e"
parts = number.components(separatedBy: CharacterSet(charactersIn: ".eE"))
case .binary:
grouping = formatter.options.binaryGrouping
prefix = "0b"
exponentSeparator = ""
parts = [String(number[prefix.endIndex...])]
case .octal:
grouping = formatter.options.octalGrouping
prefix = "0o"
exponentSeparator = ""
parts = [String(number[prefix.endIndex...])]
case .hex:
grouping = formatter.options.hexGrouping
prefix = "0x"
exponentSeparator = formatter.options.uppercaseExponent ? "P" : "p"
parts = number[prefix.endIndex...].components(separatedBy: CharacterSet(charactersIn: ".pP")).map {
formatter.options.uppercaseHex ? $0.uppercased() : $0.lowercased()
}
}
var main = parts[0], fraction = "", exponent = ""
switch parts.count {
case 2 where number.contains("."):
fraction = parts[1]
case 2:
exponent = parts[1]
case 3:
fraction = parts[1]
exponent = parts[2]
default:
break
}
applyGrouping(grouping, to: &main)
if formatter.options.fractionGrouping {
applyGrouping(grouping, to: &fraction)
}
if formatter.options.exponentGrouping {
applyGrouping(grouping, to: &exponent)
}
var result = prefix + main
if !fraction.isEmpty {
result += "." + fraction
}
if !exponent.isEmpty {
result += exponentSeparator + exponent
}
formatter.replaceToken(at: i, with: .number(result, type))
}
}
/// Strip header comments from the file
public let fileHeader = FormatRule(
help: "Use specified source file header template for all files.",
options: ["header"],
sharedOptions: ["linebreaks"]
) { formatter in
guard !formatter.options.fragment else { return }
let header: String
switch formatter.options.fileHeader {
case .ignore:
return
case var .replace(string):
if let range = string.range(of: "{file}"),
let file = formatter.options.fileInfo.fileName {
string.replaceSubrange(range, with: file)
}
if let range = string.range(of: "{year}") {
string.replaceSubrange(range, with: currentYear)
}
if let range = string.range(of: "{created}"),
let date = formatter.options.fileInfo.creationDate {
string.replaceSubrange(range, with: shortDateFormatter(date))
}
if let range = string.range(of: "{created.year}"),
let date = formatter.options.fileInfo.creationDate {
string.replaceSubrange(range, with: yearFormatter(date))
}
header = string
}
var lastHeaderTokenIndex = -1
if var startIndex = formatter.index(of: .nonSpaceOrLinebreak, after: -1) {
switch formatter.tokens[startIndex] {
case .startOfScope("//"):
if case let .commentBody(body)? = formatter.next(.nonSpace, after: startIndex) {
formatter.processCommentBody(body)
if !formatter.isEnabled || (body.hasPrefix("/") && !body.hasPrefix("//")) ||
body.hasPrefix("swift-tools-version") {
return
}
}
var lastIndex = startIndex
while let index = formatter.index(of: .linebreak, after: lastIndex) {
if let nextToken = formatter.token(at: index + 1), nextToken != .startOfScope("//") {
switch nextToken {
case .linebreak:
lastHeaderTokenIndex = index + 1
case .space where formatter.token(at: index + 2)?.isLinebreak == true:
lastHeaderTokenIndex = index + 2
default:
break
}
break
}
lastIndex = index
}
case .startOfScope("/*"):
if case let .commentBody(body)? = formatter.next(.nonSpace, after: startIndex) {
formatter.processCommentBody(body)
if !formatter.isEnabled || (body.hasPrefix("*") && !body.hasPrefix("**")) {
return
}
}
while let endIndex = formatter.index(of: .endOfScope("*/"), after: startIndex) {
lastHeaderTokenIndex = endIndex
if let linebreakIndex = formatter.index(of: .linebreak, after: endIndex) {
lastHeaderTokenIndex = linebreakIndex
}
guard let nextIndex = formatter.index(of: .nonSpace, after: lastHeaderTokenIndex) else {
break
}
guard formatter.tokens[nextIndex] == .startOfScope("/*") else {
if let endIndex = formatter.index(of: .nonSpaceOrLinebreak, after: lastHeaderTokenIndex) {
lastHeaderTokenIndex = endIndex - 1
}
break
}
startIndex = nextIndex
}
default:
break
}
}
if header.isEmpty {
formatter.removeTokens(inRange: 0 ..< lastHeaderTokenIndex + 1)
return
}
var headerTokens = tokenize(header)
let endIndex = lastHeaderTokenIndex + headerTokens.count
if formatter.tokens.endIndex >= endIndex, headerTokens == Array(formatter.tokens[
lastHeaderTokenIndex + 1 ... endIndex
]) {
lastHeaderTokenIndex += headerTokens.count
}
let headerLinebreaks = headerTokens.reduce(0) { result, token -> Int in
result + (token.isLinebreak ? 1 : 0)
}
headerTokens += [
.linebreak(formatter.options.linebreak, headerLinebreaks + 1),
.linebreak(formatter.options.linebreak, headerLinebreaks + 2),
]
if let index = formatter.index(of: .nonSpace, after: lastHeaderTokenIndex, if: {
$0.isLinebreak
}) {
lastHeaderTokenIndex = index
}
formatter.replaceTokens(inRange: 0 ..< lastHeaderTokenIndex + 1, with: headerTokens)
}
/// Strip redundant `.init` from type instantiations
public let redundantInit = FormatRule(
help: "Remove explicit `init` if not required."
) { formatter in
formatter.forEach(.identifier("init")) { i, _ in
guard let dotIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: i, if: {
$0 == .operator(".", .infix)
}), let openParenIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: i, if: {
$0 == .startOfScope("(")
}), let closeParenIndex = formatter.index(of: .endOfScope(")"), after: openParenIndex),
formatter.last(.nonSpaceOrCommentOrLinebreak, before: closeParenIndex) != .delimiter(":"),
let prevToken = formatter.last(.nonSpaceOrCommentOrLinebreak, before: dotIndex),
case let .identifier(name) = prevToken, let firstChar = name.first,
firstChar != "$", String(firstChar).uppercased() == String(firstChar) else {
return
}
formatter.removeTokens(inRange: dotIndex ... i)
}
}
/// Sort import statements
public let sortedImports = FormatRule(
help: "Sort import statements alphabetically.",
options: ["importgrouping"],
sharedOptions: ["linebreaks"]
) { formatter in
func sortRanges(_ ranges: [Formatter.ImportRange]) -> [Formatter.ImportRange] {
if case .alphabetized = formatter.options.importGrouping {
return ranges.sorted(by: <)
}
// Group @testable imports at the top or bottom
return ranges.sorted {
// If both have a @testable keyword, or neither has one, just sort alphabetically
guard $0.isTestable != $1.isTestable else {
return $0 < $1
}
return formatter.options.importGrouping == .testableTop ? $0.isTestable : $1.isTestable
}
}
for var importRanges in formatter.parseImports().reversed() {
guard importRanges.count > 1 else { continue }
let range: Range = importRanges.first!.range.lowerBound ..< importRanges.last!.range.upperBound
let sortedRanges = sortRanges(importRanges)
var insertedLinebreak = false
var sortedTokens = sortedRanges.flatMap { inputRange -> [Token] in
var tokens = Array(formatter.tokens[inputRange.range])
if tokens.first?.isLinebreak == false {
insertedLinebreak = true
tokens.insert(formatter.linebreakToken(for: tokens.startIndex), at: tokens.startIndex)
}
return tokens
}
if insertedLinebreak {
sortedTokens.removeFirst()
}
formatter.replaceTokens(inRange: range, with: sortedTokens)
}
}
/// Remove duplicate import statements
public let duplicateImports = FormatRule(
help: "Remove duplicate import statements."
) { formatter in
for var importRanges in formatter.parseImports().reversed() {
for i in importRanges.indices.reversed() {
let range = importRanges.remove(at: i)
guard let j = importRanges.firstIndex(where: { $0.module == range.module }) else {
continue
}
let range2 = importRanges[j]
if !range.isTestable || range2.isTestable {
formatter.removeTokens(inRange: range.range)
continue
}
if j >= i {
formatter.removeTokens(inRange: range2.range)
importRanges.remove(at: j)
}
importRanges.append(range)
}
}
}
/// Strip unnecessary `weak` from @IBOutlet properties (except delegates and datasources)
public let strongOutlets = FormatRule(
help: "Remove `weak` specifier from `@IBOutlet` properties."
) { formatter in
formatter.forEach(.keyword("@IBOutlet")) { i, _ in
guard let varIndex = formatter.index(of: .keyword("var"), after: i),
let weakIndex = (i ..< varIndex).first(where: { formatter.tokens[$0] == .identifier("weak") }),
case let .identifier(name)? = formatter.next(.identifier, after: varIndex) else {
return
}
let lowercased = name.lowercased()
if lowercased.hasSuffix("delegate") || lowercased.hasSuffix("datasource") {
return
}
if formatter.tokens[weakIndex + 1].isSpace {
formatter.removeToken(at: weakIndex + 1)
} else if formatter.tokens[weakIndex - 1].isSpace {
formatter.removeToken(at: weakIndex - 1)
}
formatter.removeToken(at: weakIndex)
}
}
/// Remove white-space between empty braces
public let emptyBraces = FormatRule(
help: "Remove whitespace inside empty braces."
) { formatter in
formatter.forEach(.startOfScope("{")) { i, _ in
guard let closingIndex = formatter.index(of: .nonSpaceOrLinebreak, after: i, if: {
$0 == .endOfScope("}")
}) else {
return
}
if let token = formatter.next(.nonSpaceOrCommentOrLinebreak, after: closingIndex),
[.keyword("else"), .keyword("catch")].contains(token) {
return
}
formatter.removeTokens(inRange: i + 1 ..< closingIndex)
}
}
/// Replace the `&&` operator with `,` where applicable
public let andOperator = FormatRule(
help: "Prefer comma over `&&` in `if`, `guard` or `while` conditions."
) { formatter in
formatter.forEachToken { i, token in
switch token {
case .keyword("if"), .keyword("guard"),
.keyword("while") where formatter.last(.keyword, before: i) != .keyword("repeat"):
break
default:
return
}
guard var endIndex = formatter.index(of: .startOfScope("{"), after: i) else {
return
}
// Crude check for Function Builder
if let nextToken = formatter.next(.nonSpaceOrCommentOrLinebreak, after: endIndex),
case let .identifier(name) = nextToken, let firstChar = name.first.map(String.init),
firstChar == firstChar.uppercased() {
return
} else if formatter.isInViewBuilder(at: i) {
return
}
var index = i + 1
outer: while index < endIndex {
switch formatter.tokens[index] {
case .operator("&&", .infix):
let endOfGroup = formatter.index(of: .delimiter(","), after: index) ?? endIndex
var nextOpIndex = index
while let next = formatter.index(of: .operator, after: nextOpIndex) {
if formatter.tokens[next] == .operator("||", .infix) {
index = endOfGroup
continue outer
}
nextOpIndex = next
}
formatter.replaceToken(at: index, with: .delimiter(","))
if formatter.tokens[index - 1] == .space(" ") {
formatter.removeToken(at: index - 1)
endIndex -= 1
index -= 1
} else if let prevIndex = formatter.index(of: .nonSpace, before: index),
formatter.tokens[prevIndex].isLinebreak, let nonLinbreak =
formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: prevIndex) {
formatter.removeToken(at: index)
formatter.insertToken(.delimiter(","), at: nonLinbreak + 1)
if formatter.tokens[index + 1] == .space(" ") {
formatter.removeToken(at: index + 1)
endIndex -= 1
}
}
case .operator("||", .infix), .operator("=", .infix), .keyword("try"):
index = formatter.index(of: .delimiter(","), after: index) ?? endIndex
case .startOfScope:
index = formatter.endOfScope(at: index) ?? endIndex
default:
break
}
index += 1
}
}
}
/// Replace count == 0 with isEmpty
public let isEmpty = FormatRule(
help: "Prefer `isEmpty` over comparing `count` against zero."
) { formatter in
formatter.forEach(.identifier("count")) { i, _ in
guard let dotIndex = formatter.index(of: .nonSpaceOrLinebreak, before: i, if: {
$0.isOperator(".")
}), let opIndex = formatter.index(of: .nonSpaceOrLinebreak, after: i, if: {
$0.isOperator
}), let endIndex = formatter.index(of: .nonSpaceOrLinebreak, after: opIndex, if: {
$0 == .number("0", .integer)
}) else {
return
}
var isOptional = false
var index = dotIndex
var wasIdentifier = false
loop: while true {
guard let prev = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: index) else {
break
}
switch formatter.tokens[prev] {
case .operator("!", _), .operator(".", _):
break // Ignored
case .operator("?", _):
if formatter.tokens[prev - 1].isSpace {
break loop
}
isOptional = true
case let .operator(op, .infix):
guard ["||", "&&", ":"].contains(op) else {
return
}
break loop
case .keyword, .delimiter, .startOfScope:
break loop
case .identifier:
if wasIdentifier {
break loop
}
wasIdentifier = true
index = prev
continue
case .endOfScope:
guard !wasIdentifier, let start = formatter.index(of: .startOfScope, before: prev) else {
break loop
}
wasIdentifier = false
index = start
continue
default:
break
}
wasIdentifier = false
index = prev
}
let isEmpty: Bool
switch formatter.tokens[opIndex] {
case .operator("==", .infix): isEmpty = true
case .operator("!=", .infix), .operator(">", .infix): isEmpty = false
default: return
}
if isEmpty {
if isOptional {
formatter.replaceTokens(inRange: i ... endIndex, with: [
.identifier("isEmpty"), .space(" "), .operator("==", .infix), .space(" "), .identifier("true"),
])
} else {
formatter.replaceTokens(inRange: i ... endIndex, with: [.identifier("isEmpty")])
}
} else {
if isOptional {
formatter.replaceTokens(inRange: i ... endIndex, with: [
.identifier("isEmpty"), .space(" "), .operator("!=", .infix), .space(" "), .identifier("true"),
])
} else {
formatter.replaceTokens(inRange: i ... endIndex, with: [.identifier("isEmpty")])
formatter.insertToken(.operator("!", .prefix), at: index)
}
}
}
}
/// Remove redundant `let error` from `catch` statements
public let redundantLetError = FormatRule(
help: "Remove redundant `let error` from `catch` clause."
) { formatter in
formatter.forEach(.keyword("catch")) { i, _ in
if let letIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: i, if: {
$0 == .keyword("let")
}), let errorIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: letIndex, if: {
$0 == .identifier("error")
}), let scopeIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: errorIndex, if: {
$0 == .startOfScope("{")
}) {
formatter.removeTokens(inRange: letIndex ..< scopeIndex)
}
}
}
/// Prefer `AnyObject` over `class` for class-based protocols
public let anyObjectProtocol = FormatRule(
help: "Prefer `AnyObject` over `class` in protocol definitions."
) { formatter in
guard formatter.options.swiftVersion >= "4.1" else {
return
}
formatter.forEach(.keyword("protocol")) { i, _ in
guard let nameIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: i, if: {
$0.isIdentifier
}), let colonIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: nameIndex, if: {
$0 == .delimiter(":")
}), let classIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: colonIndex, if: {
$0 == .keyword("class")
}) else {
return
}
formatter.replaceToken(at: classIndex, with: .identifier("AnyObject"))
}
}
/// Remove redundant `break` keyword from switch cases
public let redundantBreak = FormatRule(
help: "Remove redundant `break` in switch case."
) { formatter in
formatter.forEach(.keyword("break")) { i, _ in
guard formatter.last(.nonSpaceOrCommentOrLinebreak, before: i) != .startOfScope(":"),
formatter.next(.nonSpaceOrCommentOrLinebreak, after: i)?.isEndOfScope == true,
var startIndex = formatter.index(of: .nonSpace, before: i),
let endIndex = formatter.index(of: .nonSpace, after: i),
formatter.currentScope(at: i) == .startOfScope(":") else {
return
}
if !formatter.tokens[startIndex].isLinebreak || !formatter.tokens[endIndex].isLinebreak {
startIndex += 1
}
formatter.removeTokens(inRange: startIndex ..< endIndex)
}
}
/// Removed backticks from `self` when strongifying
public let strongifiedSelf = FormatRule(
help: "Remove backticks around `self` in Optional unwrap expressions."
) { formatter in
guard formatter.options.swiftVersion >= "4.2" else {
return
}
formatter.forEach(.identifier("`self`")) { i, _ in
guard let equalIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: i, if: {
$0 == .operator("=", .infix)
}), formatter.next(.nonSpaceOrCommentOrLinebreak, after: equalIndex) == .identifier("self") else {
return
}
formatter.replaceToken(at: i, with: .identifier("self"))
}
}
/// Remove redundant @objc annotation
public let redundantObjc = FormatRule(
help: "Remove redundant `@objc` annotations."
) { formatter in
let objcAttributes = [
"@IBOutlet", "@IBAction",
"@IBDesignable", "@IBInspectable", "@GKInspectable",
"@NSManaged",
]
formatter.forEach(.keyword("@objc")) { i, _ in
guard formatter.next(.nonSpaceOrCommentOrLinebreak, after: i) != .startOfScope("(") else {
return
}
var index = i
loop: while var nextIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: index) {
switch formatter.tokens[nextIndex] {
case .keyword("class"), .keyword("enum"),
// Not actually allowed currently, but: future-proofing!
.keyword("protocol"), .keyword("struct"):
return
case .keyword("private"), .keyword("fileprivate"):
// Can't safely remove objc from private members
return
case let token where token.isAttribute:
if let startIndex = formatter.index(of: .startOfScope("("), after: nextIndex),
let endIndex = formatter.index(of: .endOfScope(")"), after: startIndex) {
nextIndex = endIndex
}
case let .keyword(name), let .identifier(name):
if !allSpecifiers.contains(name) {
break loop
}
default:
break loop
}
index = nextIndex
}
func removeAttribute() {
formatter.removeToken(at: i)
if formatter.token(at: i)?.isSpace == true {
formatter.removeToken(at: i)
} else if formatter.token(at: i - 1)?.isSpace == true {
formatter.removeToken(at: i - 1)
}
}
if formatter.last(.nonSpaceOrCommentOrLinebreak, before: i, if: {
$0.isAttribute && objcAttributes.contains($0.string)
}) != nil || formatter.next(.nonSpaceOrCommentOrLinebreak, after: i, if: {
$0.isAttribute && objcAttributes.contains($0.string)
}) != nil {
removeAttribute()
return
}
guard let scopeStart = formatter.index(of: .startOfScope("{"), before: i),
let keywordIndex = formatter.index(of: .keyword, before: scopeStart) else {
return
}
switch formatter.tokens[keywordIndex] {
case .keyword("class"):
if formatter.specifiersForType(at: keywordIndex, contains: "@objcMembers") {
removeAttribute()
}
case .keyword("extension"):
if formatter.specifiersForType(at: keywordIndex, contains: "@objc") {
removeAttribute()
}
default:
break
}
}
}
/// Replace Array<T>, Dictionary<T, U> and Optional<T> with [T], [T: U] and T?
public let typeSugar = FormatRule(
help: "Prefer shorthand syntax for Arrays, Dictionaries and Optionals."
) { formatter in
formatter.forEach(.startOfScope("<")) { i, _ in
guard let typeIndex = formatter.index(of: .nonSpaceOrLinebreak, before: i, if: {
$0.isIdentifier
}), let endIndex = formatter.index(of: .endOfScope(">"), after: i),
let typeStart = formatter.index(of: .nonSpaceOrLinebreak, in: i + 1 ..< endIndex),
let typeEnd = formatter.lastIndex(of: .nonSpaceOrLinebreak, in: i + 1 ..< endIndex) else {
return
}
if let dotIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: endIndex, if: {
$0.isOperator(".")
}), formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: dotIndex, if: {
![.identifier("self"), .identifier("Type")].contains($0)
}) != nil {
return
}
func dropSwiftNamespaceIfPresent() {
if let dotIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: typeIndex, if: {
$0.isOperator(".")
}), let swiftTokenIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: dotIndex, if: {
$0 == .identifier("Swift")
}) {
formatter.removeTokens(inRange: swiftTokenIndex ..< typeIndex)
}
}
switch formatter.tokens[typeIndex] {
case .identifier("Array"):
formatter.replaceTokens(inRange: typeIndex ... endIndex, with:
[.startOfScope("[")] + formatter.tokens[typeStart ... typeEnd] + [.endOfScope("]")])
dropSwiftNamespaceIfPresent()
case .identifier("Dictionary"):
guard let commaIndex = formatter.index(of: .delimiter(","), in: typeStart ..< typeEnd) else {
return
}
formatter.replaceToken(at: commaIndex, with: .delimiter(":"))
formatter.replaceTokens(inRange: typeIndex ... endIndex, with:
[.startOfScope("[")] + formatter.tokens[typeStart ... typeEnd] + [.endOfScope("]")])
dropSwiftNamespaceIfPresent()
case .identifier("Optional"):
var typeTokens = formatter.tokens[typeStart ... typeEnd]
if formatter.tokens[typeStart] == .startOfScope("("),
let commaEnd = formatter.index(of: .endOfScope(")"), after: typeStart),
commaEnd < typeEnd {
typeTokens.insert(.startOfScope("("), at: typeTokens.startIndex)
typeTokens.append(.endOfScope(")"))
}
typeTokens.append(.operator("?", .postfix))
formatter.replaceTokens(inRange: typeIndex ... endIndex, with: Array(typeTokens))
dropSwiftNamespaceIfPresent()
default:
return
}
}
}
/// Remove redundant access control level modifiers in extensions
public let redundantExtensionACL = FormatRule(
help: "Remove redundant access control specifiers."
) { formatter in
formatter.forEach(.keyword("extension")) { i, _ in
var acl = ""
guard formatter.specifiersForType(at: i, contains: {
acl = $1.string
return aclSpecifiers.contains(acl)
}), let startIndex = formatter.index(of: .startOfScope("{"), after: i),
var endIndex = formatter.index(of: .endOfScope("}"), after: startIndex) else {
return
}
if acl == "private" { acl = "fileprivate" }
while let aclIndex = formatter.lastIndex(of: .keyword(acl), in: startIndex + 1 ..< endIndex) {
formatter.removeToken(at: aclIndex)
if formatter.token(at: aclIndex)?.isSpace == true {
formatter.removeToken(at: aclIndex)
}
endIndex = aclIndex
}
}
}
/// Replace `fileprivate` with `private` where possible
public let redundantFileprivate = FormatRule(
help: "Prefer `private` over `fileprivate` where equivalent."
) { formatter in
guard !formatter.options.fragment else {
return
}
var hasUnreplacedFileprivates = false
formatter.forEach(.keyword("fileprivate")) { i, _ in
// check if definition is at file-scope
if formatter.index(of: .startOfScope, before: i) == nil {
formatter.replaceToken(at: i, with: .keyword("private"))
} else {
hasUnreplacedFileprivates = true
}
}
guard hasUnreplacedFileprivates, formatter.options.swiftVersion >= "4" else {
return
}
let importRanges = formatter.parseImports()
var fileJustContainsOneType: Bool?
func ifCodeInRange(_ range: CountableRange<Int>) -> Bool {
var index = range.lowerBound
while index < range.upperBound, let nextIndex =
formatter.index(of: .nonSpaceOrCommentOrLinebreak, in: index ..< range.upperBound) {
guard let importRange = importRanges.first(where: {
$0.contains(where: { $0.range.contains(nextIndex) })
}) else {
return true
}
index = importRange.last!.range.upperBound + 1
}
return false
}
func isTypeInitialized(_ name: String, in range: CountableRange<Int>) -> Bool {
for i in range {
switch formatter.tokens[i] {
case .identifier(name):
if let dotIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: i, if: {
$0 == .operator(".", .infix)
}), formatter.next(.nonSpaceOrCommentOrLinebreak, after: dotIndex) == .identifier("init") {
return true
} else if formatter.next(.nonSpaceOrCommentOrLinebreak, after: i) == .startOfScope("(") {
return true
}
case .identifier("init"):
// TODO: this will return true if *any* type is initialized using type inference.
// Is there a way to narrow this down a bit?
if formatter.last(.nonSpaceOrCommentOrLinebreak, before: i) == .operator(".", .prefix) {
return true
}
default:
break
}
}
return false
}
func isMemberReferenced(_ name: String, in range: CountableRange<Int>) -> Bool {
for i in range {
guard case .identifier(name) = formatter.tokens[i] else { continue }
if let dotIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: i, if: {
$0 == .operator(".", .infix)
}), formatter.last(.nonSpaceOrCommentOrLinebreak, before: dotIndex)
!= .identifier("self") {
return true
}
}
return false
}
func isInitOverridden(for type: String, in range: CountableRange<Int>) -> Bool {
for i in range {
guard case .keyword("init") = formatter.tokens[i],
formatter.specifiersForType(at: i, contains: "override"),
let scopeIndex = formatter.index(of: .startOfScope("{"), before: i),
let colonIndex = formatter.index(of: .delimiter(":"), before: scopeIndex),
formatter.next(.nonSpaceOrCommentOrLinebreak, in: colonIndex + 1 ..< scopeIndex)
== .identifier(type) else {
continue
}
return true
}
return false
}
func membersAreReferenced(_: Set<String> /* unused */, inSubclassOf className: String) -> Bool {
for i in 0 ..< formatter.tokens.count where formatter.tokens[i] == .keyword("class") {
guard let nameIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: i, if: {
$0.isIdentifier
}), let openBraceIndex = formatter.index(of: .startOfScope("{"), after: nameIndex),
let colonIndex =
formatter.index(of: .delimiter(":"), in: nameIndex + 1 ..< openBraceIndex),
formatter.index(of: .identifier(className), in: colonIndex + 1 ..< openBraceIndex)
!= nil else {
continue
}
// TODO: check if member names are actually referenced
// this is complicated by the need to check if there are extensions on the subclass
return true
}
return false
}
formatter.forEach(.keyword("fileprivate")) { i, _ in
// Check if definition is a member of a file-scope type
guard let scopeIndex = formatter.index(of: .startOfScope, before: i, if: {
$0 == .startOfScope("{")
}), let typeIndex = formatter.index(of: .keyword, before: scopeIndex, if: {
["class", "struct", "enum"].contains($0.string)
}), case let .identifier(typeName)? = formatter.next(.identifier, after: typeIndex),
let endIndex = formatter.index(of: .endOfScope, after: scopeIndex),
formatter.currentScope(at: typeIndex) == nil else {
return
}
// Get member type
guard let keywordIndex = formatter.index(of: .keyword, in: i + 1 ..< endIndex),
let memberType = formatter.declarationType(at: keywordIndex),
// TODO: check if member types are exposed in the interface, otherwise convert them too
["let", "var", "func", "init"].contains(memberType) else {
return
}
// Check that type doesn't (potentially) conform to a protocol
// TODO: use a whitelist of known protocols to make this check less blunt
guard !formatter.tokens[typeIndex ..< scopeIndex].contains(.delimiter(":")) else {
return
}
// Check for code outside of main type definition
let startIndex = formatter.startOfSpecifiers(at: typeIndex)
if fileJustContainsOneType == nil {
fileJustContainsOneType = !ifCodeInRange(0 ..< startIndex) &&
!ifCodeInRange(endIndex + 1 ..< formatter.tokens.count)
}
if fileJustContainsOneType == true {
formatter.replaceToken(at: i, with: .keyword("private"))
return
}
// Check if type name is initialized outside type, and if so don't
// change any fileprivate members in case we break memberwise initializer
// TODO: check if struct contains an overridden init; if so we can skip this check
if formatter.tokens[typeIndex] == .keyword("struct"),
isTypeInitialized(typeName, in: 0 ..< startIndex) ||
isTypeInitialized(typeName, in: endIndex + 1 ..< formatter.tokens.count) {
return
}
// Check if member is referenced outside type
if memberType == "init" {
// Make initializer private if it's not called anywhere
if !isTypeInitialized(typeName, in: 0 ..< startIndex),
!isTypeInitialized(typeName, in: endIndex + 1 ..< formatter.tokens.count),
!isInitOverridden(for: typeName, in: 0 ..< startIndex),
!isInitOverridden(for: typeName, in: endIndex + 1 ..< formatter.tokens.count) {
formatter.replaceToken(at: i, with: .keyword("private"))
}
} else if let names = formatter.namesInDeclaration(at: keywordIndex), !names.contains(where: {
isMemberReferenced($0, in: 0 ..< startIndex) ||
isMemberReferenced($0, in: endIndex + 1 ..< formatter.tokens.count)
}), formatter.tokens[typeIndex] != .keyword("class") ||
!membersAreReferenced(names, inSubclassOf: typeName) {
formatter.replaceToken(at: i, with: .keyword("private"))
}
}
}
/// Reorders "yoda conditions" where constant is placed on lhs of a comparison
public let yodaConditions = FormatRule(
help: "Prefer constant values to be on the right-hand-side of expressions."
) { formatter in
let comparisonOperators = ["==", "!=", "<", "<=", ">", ">="].map {
Token.operator($0, .infix)
}
func valuesInRangeAreConstant(_ range: CountableRange<Int>) -> Bool {
var index = formatter.index(of: .nonSpaceOrCommentOrLinebreak, in: range)
while var i = index {
switch formatter.tokens[i] {
case .startOfScope where isConstant(at: i):
guard let endIndex = formatter.index(of: .endOfScope, after: i) else {
return false
}
i = endIndex
fallthrough
case _ where isConstant(at: i), .delimiter(","), .delimiter(":"):
index = formatter.index(of: .nonSpaceOrCommentOrLinebreak, in: i + 1 ..< range.upperBound)
case .identifier:
guard let nextIndex =
formatter.index(of: .nonSpaceOrComment, in: i + 1 ..< range.upperBound),
formatter.tokens[nextIndex] == .delimiter(":") else {
return false
}
// Identifier is a label
index = nextIndex
default:
return false
}
}
return true
}
func isConstant(at index: Int) -> Bool {
var index = index
while case .operator(_, .postfix) = formatter.tokens[index] {
index -= 1
}
guard let token = formatter.token(at: index) else {
return false
}
switch token {
case .number, .identifier("true"), .identifier("false"), .identifier("nil"),
.operator(".", .prefix) where formatter.token(at: index + 1)?.isIdentifier == true,
.identifier where formatter.token(at: index - 1) == .operator(".", .prefix) &&
formatter.token(at: index - 2) != .operator("\\", .prefix):
return true
case .endOfScope("]"), .endOfScope(")"):
guard let startIndex = formatter.index(of: .startOfScope, before: index),
!formatter.isSubscriptOrFunctionCall(at: startIndex) else {
return false
}
return valuesInRangeAreConstant(startIndex + 1 ..< index)
case .startOfScope("["), .startOfScope("("):
guard !formatter.isSubscriptOrFunctionCall(at: index),
let endIndex = formatter.index(of: .endOfScope, after: index) else {
return false
}
return valuesInRangeAreConstant(index + 1 ..< endIndex)
case .startOfScope, .endOfScope:
// TODO: what if string contains interpolation?
return token.isStringDelimiter
default:
return false
}
}
func isOperator(at index: Int?) -> Bool {
guard let index = index else {
return false
}
switch formatter.tokens[index] {
// Discount operators with higher precedence than ==
case .operator("=", .infix),
.operator("&&", .infix), .operator("||", .infix),
.operator("?", .infix), .operator(":", .infix):
return false
case .operator(_, .infix), .keyword("as"), .keyword("is"):
return true
default:
return false
}
}
func startOfValue(at index: Int) -> Int? {
var index = index
while case .operator(_, .postfix)? = formatter.token(at: index) {
index -= 1
}
if case .endOfScope? = formatter.token(at: index) {
guard let i = formatter.index(of: .startOfScope, before: index) else {
return nil
}
index = i
}
while case .operator(_, .prefix)? = formatter.token(at: index - 1) {
index -= 1
}
return index
}
func endOfExpression(at index: Int) -> Int? {
var lastIndex = index
var index: Int? = index
var wasOperator = true
while var i = index {
let token = formatter.tokens[i]
switch token {
case .operator("&&", .infix), .operator("||", .infix),
.operator("?", .infix), .operator(":", .infix):
return lastIndex
case .operator(_, .infix):
wasOperator = true
case .operator(_, .prefix) where wasOperator, .operator(_, .postfix):
break
case .keyword("as"):
wasOperator = true
if case let .operator(name, .postfix)? = formatter.token(at: i + 1),
["?", "!"].contains(name) {
i += 1
}
case .number, .identifier:
guard wasOperator else {
return lastIndex
}
wasOperator = false
case .startOfScope where wasOperator,
.startOfScope("{") where formatter.isStartOfClosure(at: i),
.startOfScope("(") where formatter.isSubscriptOrFunctionCall(at: i),
.startOfScope("[") where formatter.isSubscriptOrFunctionCall(at: i):
wasOperator = false
guard let endIndex = formatter.endOfScope(at: i) else {
return nil
}
i = endIndex
default:
return lastIndex
}
lastIndex = i
index = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: i)
}
return lastIndex
}
formatter.forEachToken(where: { comparisonOperators.contains($0) }) { i, token in
guard let prevIndex = formatter.index(of: .nonSpace, before: i),
isConstant(at: prevIndex), let startIndex = startOfValue(at: prevIndex),
!isOperator(at: formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: startIndex)),
let nextIndex = formatter.index(of: .nonSpace, after: i), !isConstant(at: nextIndex) ||
isOperator(at: formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: nextIndex)) else {
return
}
let op: String
switch token.string {
case ">": op = "<"
case ">=": op = "<="
case "<": op = ">"
case "<=": op = ">="
case let _op: op = _op
}
guard let endIndex = endOfExpression(at: nextIndex) else {
return
}
let expression = Array(formatter.tokens[nextIndex ... endIndex])
let constant = Array(formatter.tokens[startIndex ... prevIndex])
formatter.replaceTokens(inRange: nextIndex ... endIndex, with: constant)
formatter.replaceToken(at: i, with: .operator(op, .infix))
formatter.replaceTokens(inRange: startIndex ... prevIndex, with: expression)
}
}
public let leadingDelimiters = FormatRule(
help: "Move leading delimiters to the end of the previous line.",
sharedOptions: ["linebreaks"]
) { formatter in
formatter.forEach(.delimiter) { i, _ in
guard let endOfLine = formatter.index(of: .nonSpace, before: i, if: {
$0.isLinebreak
}) else {
return
}
let nextIndex = formatter.index(of: .nonSpace, after: i) ?? (i + 1)
formatter.insertSpace(formatter.indentForLine(at: i), at: nextIndex)
formatter.insertLinebreak(at: nextIndex)
formatter.removeTokens(inRange: i + 1 ..< nextIndex)
guard case .commentBody? = formatter.last(.nonSpace, before: endOfLine) else {
formatter.removeTokens(inRange: endOfLine ..< i)
return
}
let startIndex = formatter.index(of: .nonSpaceOrComment, before: endOfLine) ?? -1
formatter.removeTokens(inRange: endOfLine ..< i)
let comment = Array(formatter.tokens[startIndex + 1 ..< endOfLine])
formatter.insertTokens(comment, at: endOfLine + 1)
formatter.removeTokens(inRange: startIndex + 1 ..< endOfLine)
}
}
}
| [
-1
] |
3b6768ce6855ea30f7703ee5afa6437cb699f0a2 | f0ebaedf4f7d2d6bccc2eeb003baa54f384d0078 | /Tests/Matchers/EachLikeTests.swift | 3d0bb14dde03396524d9496770ded292f51a804f | [
"MIT"
] | permissive | dadurigon/PactSwift | 91f1efab1937e43aa0823cc14aaacfeb29e9730c | 581204c299d32f093d7daf38dc9774c6de485b1f | refs/heads/master | 2022-12-30T21:29:14.679977 | 2020-10-21T12:44:36 | 2020-10-21T13:27:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,394 | swift | //
// Created by Marko Justinek on 11/4/20.
// Copyright © 2020 Itty Bitty Apps Pty Ltd / PACT Foundation. All rights reserved.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
import XCTest
@testable import PactSwift
class EachLikeTests: XCTestCase {
func testMatcher_EachLike_InitsWithValue() throws {
// Array of Strings
let testStringResult = try XCTUnwrap(Matcher.EachLike("foo").value as? [String])
XCTAssertEqual(testStringResult, ["foo"])
// Array of Ints
let testIntResult = try XCTUnwrap(Matcher.EachLike(12345).value as? [Int])
XCTAssertEqual(testIntResult, [12345])
// Array of Dictionaries
let testDictResult = try XCTUnwrap((Matcher.EachLike(["foo": 123.45]).value as? [[String: Double]])?.first)
XCTAssertEqual(testDictResult["foo"], 123.45)
}
func testMatcher_EachLike_InitsWithDefault_MinValue() throws {
// Array of Strings
let testResult = try XCTUnwrap(Matcher.EachLike("foo").min)
XCTAssertEqual(testResult, 1)
}
func testMatcher_EachLike_InitsWithProvided_MinValue() throws {
// Array of Strings
let testResult = try XCTUnwrap(Matcher.EachLike("foo", min: 99).min)
XCTAssertEqual(testResult, 99)
}
func testMatcher_EachLike_InitsWithout_MaxValue() {
XCTAssertNil(Matcher.EachLike("foo").max)
}
func testMatcher_EachLike_InitsWithProvided_MaxValue() throws {
// Array of Strings
let testResult = try XCTUnwrap(Matcher.EachLike("foo", max: 5).max)
XCTAssertEqual(testResult, 5)
}
func testMatcher_EachLike_InitsWithMinAndMaxValue() throws {
// Array of Strings
let testResult = try XCTUnwrap(Matcher.EachLike("foo", min: 1, max: 5))
XCTAssertEqual(testResult.min, 1)
XCTAssertEqual(testResult.max, 5)
}
}
| [
-1
] |
3b743b543792d3551a5190a0b4126af9e627c462 | e3d46dd12ac6abfb341e13be69399788a8446592 | /FavoriteUsersTests/FavoriteUsersTests.swift | 7a552f5fbe46fafd3ff3699f23bd3d3baa313f48 | [] | no_license | blob8129/favorite-users | 610c5efa89c7d66c20d9234e1565abad9631ccc2 | aceb402ea2f4e9c989dee5bdd41d2455dea5a6c6 | refs/heads/main | 2023-06-21T13:06:45.119593 | 2021-07-27T12:10:31 | 2021-07-27T12:10:31 | 388,140,573 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,330 | swift | //
// FavoriteUsersTests.swift
// FavoriteUsersTests
//
// Created by Andrey Volobuev on 21/07/2021.
//
import XCTest
@testable import FavoriteUsers
struct StorageMock<T: Encodable>: AnyStorage {
var value: T?
func set(_ value: Any?, forKey defaultName: String) {
}
func data(forKey defaultName: String) -> Data? {
value.flatMap { try? JSONEncoder().encode($0) }
}
func removeObject(forKey defaultName: String) {
}
}
class ImagesServiceSpy: ImagesServiceProtocol {
var fetchCount = 0
func fetchImage(at url: URL, result: @escaping (Result<(URL, Data), Error>) -> Void) {
fetchCount += 1
}
}
class UsersViewSpy: UsersView {
var viewModels: [UserViewModel]?
var errorCount = 0
func render(_ users: [UserViewModel]) {
self.viewModels = users
}
func showError(description: String) {
errorCount += 1
}
}
class FavoriteUsersTests: XCTestCase {
let validToken = "886:f6759e94-bf49-4d53-afe8-8d3fc93efdf0"
func testAuthorizedUsersRequest() throws {
let interactor = UsersInteractor<UsersRepository>.build(authToken: validToken)
let usersViewSpy = UsersViewSpy()
interactor.view = usersViewSpy
interactor.loadUsers()
XCTAssertEqual(usersViewSpy.viewModels?.count, 15)
XCTAssertTrue((usersViewSpy.viewModels ?? []).allSatisfy { $0.isFavorite == false })
XCTAssertEqual(usersViewSpy.errorCount, 0)
}
func testUnauthorizedUsersRequest() throws {
let interactor = UsersInteractor<UsersRepository>.build(authToken: "invalid token")
let usersViewSpy = UsersViewSpy()
interactor.view = usersViewSpy
interactor.loadUsers()
XCTAssertNil(usersViewSpy.viewModels)
XCTAssertEqual(usersViewSpy.errorCount, 1)
}
func testFavoriteUserssRequest() throws {
let phone1 = "(733)-714-7182"
let phone2 = "(438)-147-1077"
let interactor = UsersInteractor<UsersRepository>
.build(authToken: validToken, isFavoriteSates: [phone1: true, phone2: true])
let usersViewSpy = UsersViewSpy()
interactor.view = usersViewSpy
interactor.loadUsers()
let user1 = usersViewSpy.viewModels?.first { $0.phone == phone1 }
let user2 = usersViewSpy.viewModels?.first { $0.phone == phone2 }
XCTAssertEqual(user1?.isFavorite, true)
XCTAssertEqual(user2?.isFavorite, true)
let usersExceptFavorite = (usersViewSpy.viewModels ?? []).filter { $0.phone == phone1 && $0.phone == phone2 }
XCTAssertTrue(usersExceptFavorite.allSatisfy { $0.isFavorite == false })
}
func testChangeIsFavoriteStateTrue() throws {
let interactor = UsersInteractor<UsersRepository>.build(authToken: validToken)
let usersViewSpy = UsersViewSpy()
interactor.view = usersViewSpy
interactor.loadUsers()
interactor.changeIsFavoriteState(at: 0)
let user1 = usersViewSpy.viewModels?.first { $0.phone == "20335909" }
XCTAssertEqual(user1?.isFavorite, true)
}
func testChangeIsFavoriteStateFalse() throws {
let phone1 = "20335909"
let interactor = UsersInteractor<UsersRepository>.build(authToken: validToken, isFavoriteSates: [phone1: true])
let usersViewSpy = UsersViewSpy()
interactor.view = usersViewSpy
interactor.loadUsers()
interactor.changeIsFavoriteState(at: 0)
let user1 = usersViewSpy.viewModels?.first { $0.phone == phone1 }
XCTAssertEqual(user1?.isFavorite, false)
}
func testImagesLoadedOnItemWillAppear() throws {
let imagesServiceSpy = ImagesServiceSpy()
let interactor = UsersInteractor<UsersRepository>.build(authToken: validToken, imagesService: imagesServiceSpy)
let usersViewSpy = UsersViewSpy()
interactor.view = usersViewSpy
interactor.loadUsers()
interactor.willDisplayItem(at: 0)
interactor.willDisplayItem(at: 1)
interactor.willDisplayItem(at: 2)
XCTAssertEqual(imagesServiceSpy.fetchCount, 3)
}
}
extension UsersInteractor {
static func build(authToken: String,
isFavoriteSates: [String: Bool]? = nil,
imagesService: ImagesServiceProtocol = ImagesServiceSpy()) -> UsersInteractor<UsersRepository> {
var networkService = UsersNetworkServiceStub()
networkService.token = authToken
let repository = UsersRepository(networkService: networkService, decoder: JSONDecoder.customISODateDecoder)
var storageMock = StorageMock<[String: Bool]>()
storageMock.value = isFavoriteSates
let isFavoriteStateStorage = PersistentStorage<[String: Bool]>(storageKey: "any key", defaults: storageMock)
return UsersInteractor<UsersRepository>(baseURL: anyTestURL,
usersRepository: repository,
imagesService: imagesService,
isFavoriteStateStorage: isFavoriteStateStorage)
}
}
| [
-1
] |
9b442d1393f71d70b886da08fce1462808d674f4 | 249ceeca8cd83e986cb838aeaf3cfa289c7c50e4 | /_MasteringSwiftUI/Chapter-7-Food-Delivery-Part-2/FoodDeliveryPart2/FoodDeliveryPart2/Views/OrderForm.swift | 6861febec8ab99b5218da43c69afd9f326a4fca1 | [
"MIT"
] | permissive | ihusnainalii/my-swift-journey | 1c73103ad087a5a40f72e8b937da5cf7b992c81e | 72bb9fe115f94af0cad0d5454736e5c026dbc4f5 | refs/heads/master | 2023-02-24T19:11:49.401255 | 2021-01-28T06:33:22 | 2021-01-28T06:33:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,106 | swift | //
// OrderForm.swift
// FoodDeliveryPart2
//
// Created by Luan Nguyen on 02/01/2021.
//
import SwiftUI
struct OrderForm: View {
// MARK: - PROPERTIES
// Special Request
@State var specialRequest = false
@State var specialRequestInput = ""
// Order Amount
@State var orderAmount = 1
// Details
@State var firstName = ""
@State var lastName = ""
@State var street = ""
@State var city = ""
@State var zip = ""
// Feedback
@State var userFeedback = 0.0
// Order Sheet
@Binding var showOrderSheet: Bool
// MARK: - BODY
var body: some View {
NavigationView {
Form {
// 1.
Section {
// MARK: - SPECIAL REQUESTS
Toggle(isOn: $specialRequest.animation()) {
Text("Any special requests?")
}
.toggleStyle(SwitchToggleStyle(tint: Color("AccentColor")))
if specialRequest {
TextField("Enter your request", text: $specialRequestInput.animation())
}
// MARK: - QUANTITY
Stepper(value: $orderAmount, in: 1...10) {
Text("Quantity: \(orderAmount)")
}
}
// 2.
Section {
// MARK: - DETAILS
TextField("First name", text: $firstName)
TextField("Last name", text: $lastName)
TextField("Street", text: $street)
TextField("City", text: $city)
TextField("ZIP code", text: $zip)
}
// 3.
Section {
VStack {
Text("How do you like our Food Delivery App?")
.padding(.top, 10)
HStack {
Image(systemName: "hand.thumbsdown")
Slider(value: $userFeedback, in: 0.0...10.0)
.accentColor(Color("AccentColor"))
Image(systemName: "hand.thumbsup")
}
}
}
// 4.
Section {
Button(action: {
print("Order placed.")
}, label: {
Text("Place Order")
})
}
} //: FORM
.navigationTitle("Your Order")
.navigationBarItems(leading: Button(action: {
showOrderSheet = false
}, label: {
Text("Cancel")
}))
}
}
}
// MARK: - PREVIEW
#if DEBUG
struct OrderForm_Previews: PreviewProvider {
static var previews: some View {
OrderForm(showOrderSheet: .constant(false))
}
}
#endif
| [
-1
] |
5b4ffc4a6412bcebd82be67c9308327ff2ea0c1e | dd3564f348bf84fd341a7845d419fde6c98dcb1e | /BaekJoon Online Judge/Swift/Step22-Dynamic Programming_1/9461.swift | cbd3b60e1497bf76ca1a23acf56ce1fa29970fe1 | [] | no_license | YebinKim/Algorithm-Study | af01526b9ad866c573eae194767d11e163d9f329 | 63f994fdf3bc549c5ed159f2fd6a47de4b849442 | refs/heads/main | 2023-05-25T19:22:44.139820 | 2023-05-11T12:03:08 | 2023-05-11T12:03:08 | 204,962,764 | 3 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 398 | swift | //
// 9461.swift
// Step14-Dynamic Programming_1
//
// Created by Yebin Kim on 2019/12/09.
// Copyright © 2019 김예빈. All rights reserved.
//
import Foundation
var dp = [1, 1, 1, 2, 2]
for i in 5..<100 {
dp.append(dp[i - 5] + dp[i - 1])
}
if var tc = Int(readLine()!) {
while tc > 0 {
let N = Int(readLine()!)!
print(dp[N - 1])
tc -= 1
}
}
| [
-1
] |
4f854cfc51fcdfa0a36bd23ece6d79fb4733fd41 | c7fbd6a2297c6429106526741dec940bf4c776a6 | /Project8/ViewController.swift | c2554ed40165e51af3d65e2a7afff52765fbcc02 | [] | no_license | othmansh0/Project8 | 615a01ba8e473aac7fefdb4cc59f3f4959a2d4fa | 2c249c1aba55c5e46403e7b6243fc09b1a17a690 | refs/heads/main | 2023-08-18T11:35:15.121588 | 2021-08-20T20:32:18 | 2021-08-20T20:32:18 | 397,309,870 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 13,126 | swift | //
// ViewController.swift
// Project8
//
// Created by othman shahrouri on 8/17/21.
//
import UIKit
//anchors: let us very clearly and descriptively place views relative to each other
// intrinsic content size – how big each view needs to be to show its content.
//Every view in all our UIKit layouts has two important properties that tell UIKit how it can squash or stretch them in order to satisfy constraints:
//Content hugging priority determines how likely this view is to be made larger than its intrinsic content size. If this priority is high it means Auto Layout prefers not to stretch it; if it’s low, it will be more likely to be stretched.
//Content compression resistance priority determines how happy we are for this view to be made smaller than its intrinsic content size.
class ViewController: UIViewController {
var cluesLabel: UILabel!
var answersLabel: UILabel!
var currentAnswer: UITextField!
var scoreLabel: UILabel!
var letterButtons = [UIButton]()
var activatedButtons = [UIButton]()
var solutions = [String]()
var score = 0 {
didSet{//whenever score value changes scoreLabel gets updated
scoreLabel.text = "Score: \(score)"
}
}
var level = 1
override func loadView() {
view = UIView()
view.backgroundColor = .white
//create score label
scoreLabel = UILabel()
scoreLabel.translatesAutoresizingMaskIntoConstraints = false
scoreLabel.textAlignment = .right
scoreLabel.text = "Score: 0"
view.addSubview(scoreLabel)
//create clues label
cluesLabel = UILabel()
cluesLabel.translatesAutoresizingMaskIntoConstraints = false
cluesLabel.font = UIFont.systemFont(ofSize: 24)
cluesLabel.text = "CLUES"
//UIFont. numberOfLines is an integer that sets how many lines the text can wrap over, but we’re going to set it to 0 – a magic value that means “as many lines as it takes.”
cluesLabel.numberOfLines = 0
view.addSubview(cluesLabel)
//create answers label
answersLabel = UILabel()
answersLabel.translatesAutoresizingMaskIntoConstraints = false
answersLabel.font = UIFont.systemFont(ofSize: 24)//give us 24-point font in whatever font is currently being used by iOS.
answersLabel.text = "ANSWERS"
answersLabel.numberOfLines = 0
answersLabel.textAlignment = .right
view.addSubview(answersLabel)
//Giving them top priority to be stretched
cluesLabel.setContentHuggingPriority(UILayoutPriority(1), for: .vertical)
answersLabel.setContentHuggingPriority(UILayoutPriority(1), for: .vertical)
//create current answer text field
currentAnswer = UITextField()
currentAnswer.translatesAutoresizingMaskIntoConstraints = false
currentAnswer.placeholder = "Tap letters to guess"
currentAnswer.textAlignment = .center
currentAnswer.font = UIFont.systemFont(ofSize: 44)
currentAnswer.isUserInteractionEnabled = false
view.addSubview(currentAnswer)
//create submit button
let submit = UIButton(type: .system)
submit.setTitle("SUBMIT", for: .normal)
submit.addTarget(self, action: #selector(submitTapped), for: .touchUpInside)
submit.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(submit)
let clear = UIButton(type: .system)
clear.translatesAutoresizingMaskIntoConstraints = false
clear.setTitle("CLEAR", for: .normal)
clear.addTarget(self, action: #selector(clearTapped), for: .touchUpInside)
view.addSubview(clear)
//a plain UIView – it host our buttons
let buttonsView = UIView()
buttonsView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(buttonsView)
// it takes the multiplier into account first, then the constant.
NSLayoutConstraint.activate([
//Notice the way I’m pinning the label to view.layoutMarginsGuide – that will make the score label have a little distance from the top + right edge of the screen by view.layoutMarginsGuide
//if i used view.topAnchor no little space would be added
scoreLabel.topAnchor.constraint(equalTo:view.layoutMarginsGuide.topAnchor),
scoreLabel.trailingAnchor.constraint(equalTo: view.layoutMarginsGuide.trailingAnchor),
// pin the top of the clues label to the bottom of the score label
cluesLabel.topAnchor.constraint(equalTo: scoreLabel.bottomAnchor),
// pin the leading edge of the clues label to the leading edge of our layout margins, adding 100 for some space
cluesLabel.leadingAnchor.constraint(equalTo: view.layoutMarginsGuide.leadingAnchor, constant: 100),
// make the clues label 60% of the width of our layout margins, minus 100
cluesLabel.widthAnchor.constraint(equalTo: view.layoutMarginsGuide.widthAnchor, multiplier: 0.6, constant: -100),
// also pin the top of the answers label to the bottom of the score label
answersLabel.topAnchor.constraint(equalTo: scoreLabel.bottomAnchor),
// make the answers label stick to the trailing edge of our layout margins, minus 100
answersLabel.trailingAnchor.constraint(equalTo: view.layoutMarginsGuide.trailingAnchor, constant: -100),
// make the answers label take up 40% of the available space, minus 100
answersLabel.widthAnchor.constraint(equalTo: view.layoutMarginsGuide.widthAnchor, multiplier: 0.4, constant: -100),
// make the answers label match the height of the clues label
answersLabel.heightAnchor.constraint(equalTo: cluesLabel.heightAnchor),
currentAnswer.centerXAnchor.constraint(equalTo: view.centerXAnchor),
currentAnswer.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.5),
currentAnswer.topAnchor.constraint(equalTo: cluesLabel.bottomAnchor, constant: 20),
submit.topAnchor.constraint(equalTo: currentAnswer.bottomAnchor),
submit.centerXAnchor.constraint(equalTo: view.centerXAnchor, constant: -100),
submit.heightAnchor.constraint(equalToConstant: 44),
//for clear button we’ll be setting its Y anchor so that its stays aligned with the Y position of the submit button...Both buttons will remain aligned even if we move one
clear.centerYAnchor.constraint(equalTo: submit.centerYAnchor),
//To stop them overlapping, we’ll subtract 100 from the submit button’s X position, and add 100 to the clear button’s X position
clear.centerXAnchor.constraint(equalTo: view.centerXAnchor, constant: 100),
clear.heightAnchor.constraint(equalToConstant: 44),
buttonsView.widthAnchor.constraint(equalToConstant: 750),
buttonsView.heightAnchor.constraint(equalToConstant: 320),
buttonsView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
buttonsView.topAnchor.constraint(equalTo: submit.bottomAnchor, constant: 20),
buttonsView.bottomAnchor.constraint(equalTo: view.layoutMarginsGuide.bottomAnchor, constant: -20)
])
// set some values for the width and height of each button
let width = 150
let height = 80
// create 20 buttons as a 4x5 grid
for row in 0..<4 {
for col in 0..<5 {
// create a new button and give it a big font size
let letterButton = UIButton(type: .system)
letterButton.titleLabel?.font = UIFont.systemFont(ofSize: 36)
letterButton.layer.borderWidth = 1
letterButton.layer.borderColor = UIColor.lightGray.cgColor
// give the button some temporary text so we can see it on-screen
letterButton.setTitle("WWW", for: .normal)
letterButton.addTarget(self, action: #selector(letterTapped), for: .touchUpInside)
// calculate the frame of this button using its column and row
let frame = CGRect(x: col * width, y: row * height, width: width, height: height)
letterButton.frame = frame
// add it to the buttons view
buttonsView.addSubview(letterButton)
// and also to our letterButtons array
letterButtons.append(letterButton)
}
}
}
override func viewDidLoad() {
super.viewDidLoad()
loadLevel()
}
func levelUp(action: UIAlertAction){
//1. add 1 level
level += 1
//2. remove all items in solutions
solutions.removeAll(keepingCapacity: true)
//3.loading new level
loadLevel()
//4.making all buttons visible again
for btn in letterButtons {
btn.isHidden = false
}
}
@objc func letterTapped(_ sender: UIButton){
if let buttonTitle = sender.titleLabel?.text{
//currentAnswer.text?.append(buttonTitle)
currentAnswer.text = currentAnswer.text?.appending(buttonTitle)
activatedButtons.append(sender)
sender.isHidden = true
}
}
@objc func submitTapped(_ sender: UIButton){
guard let answer = currentAnswer.text else { return }
if let solutionIndex = solutions.firstIndex(of: answer){
activatedButtons.removeAll()
var splitAnswers = answersLabel.text?.components(separatedBy: "\n")
splitAnswers?[solutionIndex] = answer
answersLabel.text = splitAnswers?.joined(separator: "\n")
currentAnswer.text = ""
score += 1
}
else {
let ac = UIAlertController(title: "Incorrect", message: "Incorrect guess,try again", preferredStyle: .alert)
ac.addAction(UIAlertAction(title: "Continue", style: .default))
present(ac,animated: true)
if(score > 0){
score -= 1
}
}
if score % 7 == 0 {
let ac = UIAlertController(title: "Well done!", message: "Are you ready for the next level?", preferredStyle: .alert)
ac.addAction(UIAlertAction(title: "Let's go!", style: .default, handler: levelUp))
present(ac, animated: true)
}
}
@objc func clearTapped(_ sender: UIButton){
currentAnswer.text = ""
for button in activatedButtons {
button.isHidden = false
}
activatedButtons.removeAll()
}
func loadLevel(){
var clueString = ""
var solutionString = ""
var letterBits = [String]()
let fileLevel = "level\(level)"
if let levelFileURL = Bundle.main.url(forResource: fileLevel, withExtension: "txt"){
if let levelContents = try? String(contentsOf: levelFileURL){
var lines = levelContents.components(separatedBy: "\n")
lines.shuffle()
for (index,line) in lines.enumerated(){
let parts = line.components(separatedBy: ": ")
let answer = parts[0]
let clue = parts[1]
clueString += "\(index + 1). \(clue)\n"
let solutionWord = answer.replacingOccurrences(of: "|", with: "")
solutionString += "\(solutionWord.count) letters\n"
solutions.append(solutionWord)
let bits = answer.components(separatedBy: "|")
print(bits)
letterBits += bits
}
}
}
//configure labels and buttons
cluesLabel.text = clueString.trimmingCharacters(in: .whitespacesAndNewlines)
answersLabel.text = solutionString.trimmingCharacters(in: .whitespacesAndNewlines)
letterBits.shuffle()
if letterButtons.count == letterBits.count{
for i in 0..<letterButtons.count{
letterButtons[i].setTitle(letterBits[i], for: .normal)
}
}
}
}
| [
-1
] |
7acc8aee0205c887c74468c1a9607b86403e38f2 | 6077316ce241518bcbccbb0904777f5e70261865 | /AppSpotLists/Model/CustomDatasource/TableViewCustomDataSource.swift | 8b9b8e69663155adffd6d5a20d6b837ae8377f96 | [] | no_license | shaktiprakash099/Appspotlist | b67269f764f07a26ad29a05bd8083b787da0762c | 8f88759e36bb6ddb63753f6e532739b51c510824 | refs/heads/master | 2020-04-09T23:44:01.474499 | 2018-12-14T03:51:26 | 2018-12-14T03:51:26 | 160,664,777 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,597 | swift | //
// TableViewCustomDataSource.swift
// AppSpotLists
//
// Created by GLB-253 on 12/6/18.
// Copyright © 2018 IOSISFUN. All rights reserved.
//
import UIKit
class TableViewCustomDataSource<Model>: NSObject,UITableViewDataSource{
typealias CellConfigurator = (Model,UITableViewCell)-> Void
var models:[Model]
private let reuseIdentifier:String
private let cellConfigurator: CellConfigurator
init(models:[Model],reuseIdentifier:String,cellConfigurator:@escaping CellConfigurator) {
self.models = models
self.reuseIdentifier = reuseIdentifier
self.cellConfigurator = cellConfigurator
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return models.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let model = models[indexPath.row]
let cell = tableView.dequeueReusableCell(withIdentifier: reuseIdentifier, for: indexPath)
cellConfigurator(model,cell)
return cell
}
}
extension TableViewCustomDataSource where Model == ItemsDetailsLists{
static func displayData(for itemLists:[ItemsDetailsLists],withCellidentifier reuseIdentifier: String)->TableViewCustomDataSource{
return TableViewCustomDataSource(models: itemLists, reuseIdentifier: reuseIdentifier, cellConfigurator: { (data, cell ) in
let itemcell:ItemListsTableViewCell = cell as! ItemListsTableViewCell
itemcell.setupParameters(itemlist: data)
})
}
}
| [
-1
] |
88237f44c2113281d58ffb421048c7fe394633a3 | c5e758efbcc60b7d7a2e122638910dfd2d56e76b | /Showcase-iOS/Firebase/Service/DataReferenceableImplementation.swift | 701d392552d00a0c8fa0deaeb4ef6b4117e53d31 | [] | no_license | DVT/ShowcaseiOS | 8dd4d085da86210c2e9407fd61a8a6b462be2e30 | a824b1cca535fd751d387f687bf9bc4a387a09dd | refs/heads/develop | 2021-06-08T06:28:01.705633 | 2019-11-04T10:19:00 | 2019-11-04T10:19:00 | 129,877,320 | 4 | 2 | null | 2019-11-04T10:19:02 | 2018-04-17T09:08:14 | Swift | UTF-8 | Swift | false | false | 791 | swift | import FirebaseDatabase
import Foundation
import Swinject
struct FirebaseRetrieverableImplementation {
// MARK: Properties
private let reference : DataReferenceable?
// MARK: Operation(s)
init(reference : DataReferenceable?) {
self.reference = reference
}
func dataBaseReference() -> DataReferenceable? {
guard let reference = reference?.databaseReference() else {
return nil
}
return reference
}
func fetchFirebaseData(from path: Path, completion: @escaping (Any?, Error?) -> Void) {
dataBaseReference()?.child(path)?.observe(eventType: .childAdded, with: { snapshot in
completion(snapshot, nil)
}, withCancel: { (error) in
completion(nil, error)
})
}
}
| [
-1
] |
90436132b463257cc527c5026335bb7d296fde17 | 8e1fc2d1456f968f6c5002acd3c6ccc8b300dcb0 | /Businect/Businect/ViewController.swift | de2a2d2b29d8221b34f41f5f55164680a6fe616a | [] | no_license | edrissm/Businect | 0e4beb253a465ef62ca26a73611a666dd6164c60 | f07e30b25da176ed918a45d658534df957bf3547 | refs/heads/master | 2020-05-18T07:45:09.738047 | 2019-06-28T08:44:00 | 2019-06-28T08:44:00 | 184,272,998 | 1 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 304 | swift | //
// ViewController.swift
// Businect
//
// Copyright © 2019 Scrum-Made. All rights reserved.
//
import UIKit
//testedriss
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
| [
327555,
323334,
249229,
189326,
319888,
342547,
316949,
314774,
291223,
188950,
314780,
342300,
316317,
135840,
245024,
135842,
172578,
340649,
172586,
242346,
337068,
336557,
241071,
243505,
172722,
314048,
339520,
313029,
319815,
326600,
182474,
146645,
250212,
315492,
247652,
247653,
247655,
56044,
215408,
319990,
327033,
314748,
334205
] |
8d1adf16ca9eb47aa1f1654bd447efeecd97fd31 | abb7fa6d924dbf9d7ad15c53abb3a9cd8a614bf7 | /Grid/main.swift | 0de500b8f26f29c7e9079a621907b5bbee23f532 | [] | no_license | SaganRitual/Grid | e355eacda4d4b582b474536d540224ad5afc09f9 | 5ab8eb92a112b5266efd2f8a53afe5608d4e49a6 | refs/heads/main | 2023-04-03T19:04:35.858911 | 2021-04-03T06:03:16 | 2021-04-03T06:03:16 | 330,299,966 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,772 | swift | // We are a way for the cosmos to know itself. -- C. Sagan
import Foundation
print("Origin at center: \n")
let centeredGrid = Grid<GridCell>(size: GridSize(width: 7, height: 7), origin: .center)
for aix in 0..<centeredGrid.size.area() {
let gridPosition = centeredGrid.getPosition(absoluteIndex: aix)
if aix > 0 && aix % centeredGrid.size.width == 0 { print() }
print(gridPosition, terminator: " ")
}
print("\n\nOrigin at upper left:\n")
let yUpperLeftGrid = Grid<GridCell>(size: GridSize(width: 7, height: 7), origin: .upperLeft)
for aix in 0..<centeredGrid.size.area() {
let gridPosition = yUpperLeftGrid.getPosition(absoluteIndex: aix)
if aix > 0 && aix % centeredGrid.size.width == 0 { print() }
print(gridPosition, terminator: " ")
}
print("\n\nOrigin at lower left:\n")
let yLowerLeftGrid = Grid<GridCell>(size: GridSize(width: 7, height: 7), origin: .lowerLeft)
for aix in 0..<centeredGrid.size.area() {
let gridPosition = yLowerLeftGrid.getPosition(absoluteIndex: aix)
if aix > 0 && aix % centeredGrid.size.width == 0 { print() }
print(gridPosition, terminator: " ")
}
print("\n")
final class TestGridCell: GridCellProtocol {
weak var contents: GridCellContentsProtocol?
let gridPosition: GridPoint
init(_ gridPosition: GridPoint) { self.gridPosition = gridPosition }
func getGridPosition() -> String {
"->\(gridPosition)<-"
}
}
typealias TestGrid = Grid<TestGridCell>
let testGrid = TestGrid(size: GridSize(width: 7, height: 7))
for aix in 0..<testGrid.size.area() {
let gridPosition = testGrid.getPosition(absoluteIndex: aix)
let cell = testGrid.cellAt(gridPosition)
if aix > 0 && aix % testGrid.size.width == 0 { print() }
print(cell.getGridPosition(), terminator: " ")
}
| [
-1
] |
170e9c575de024575ef82670474074cb77b7d95c | f7ca67c97280143119f7b17298b8bbbcfd43b000 | /Pods/JASON/Source/LiteralConvertible.swift | e1cd47e1305ef9e668600301123233de7a52561c | [
"Artistic-2.0",
"MIT"
] | permissive | MrLuckyLan/LSYWeibo | 3c3d1d8cf9a5c8b1d181b5701952313975210125 | 1e638c920a0d5caf2394e21b864d9755225c4606 | refs/heads/master | 2021-01-17T21:57:53.983350 | 2016-07-06T06:09:22 | 2016-07-06T06:09:22 | 62,695,769 | 4 | 0 | null | 2016-07-06T06:10:52 | 2016-07-06T06:10:52 | null | UTF-8 | Swift | false | false | 4,695 | swift | //
// LiteralConvertible.swift
//
// Copyright (c) 2015-2016 Damien (http://delba.io)
//
// 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.
//
// MARK: - StringLiteralConvertible
/// Conforming types can be initialized with arbitrary string literals.
extension JSON: StringLiteralConvertible {
/**
Creates an instance of JSON from a string literal
- parameter stringLiteral: A string literal
- returns: An instance of JSON
*/
public init(stringLiteral value: StringLiteralType) {
self.init(value)
}
/**
Creates an instance of JSON from a string literal
- parameter extendedGraphemeClusterLiteral: A string literal
- returns: An instance of JSON
*/
public init(extendedGraphemeClusterLiteral value: StringLiteralType) {
self.init(value)
}
/**
Creates an instance of JSON from a string literal
- parameter unicodeScalarLiteral: A string literal
- returns: An instance of JSON
*/
public init(unicodeScalarLiteral value: StringLiteralType) {
self.init(value)
}
}
// MARK: - IntegerLiteralConvertible
/// Conforming types can be initialized with integer literals.
extension JSON: IntegerLiteralConvertible {
/**
Creates an instance of JSON from an integer literal.
- parameter integerLiteral: An integer literal
- returns: An instance of JSON
*/
public init(integerLiteral value: IntegerLiteralType) {
self.init(value)
}
}
// MARK: - FloatLiteralConvertible
/// Conforming types can be initialized with float literals.
extension JSON: FloatLiteralConvertible {
/**
Creates an instance of JSON from a float literal.
- parameter floatLiteral: A float literal
- returns: An instance of JSON
*/
public init(floatLiteral value: FloatLiteralType) {
self.init(value)
}
}
// MARK: - BooleanLiteralConvertible
/// Conforming types can be initialized with the Boolean literals true and false.
extension JSON: BooleanLiteralConvertible {
/**
Creates an instance of JSON from a boolean literal.
- parameter booleanLiteral: A boolean literal
- returns: An instance of JSON
*/
public init(booleanLiteral value: BooleanLiteralType) {
self.init(value)
}
}
// MARK: - DictionaryLiteralConvertible
/// Conforming types can be initialized with dictionary literals.
extension JSON: DictionaryLiteralConvertible {
/**
Creates an instance of JSON from a dictionary literal.
- parameter dictionaryLiteral: A dictionary literal
- returns: An instance of JSON
*/
public init(dictionaryLiteral elements: (String, AnyObject)...) {
var dictionary = [String: AnyObject]()
for (key, value) in elements {
dictionary[key] = value
}
self.init(dictionary)
}
}
// MARK: - ArrayLiteralConvertible
/// Conforming types can be initialized with array literals.
extension JSON: ArrayLiteralConvertible {
/**
Creates an instance of JSON from an array literal.
- parameter arrayLiteral: An array literal
- returns: An instance of JSON
*/
public init(arrayLiteral elements: AnyObject...) {
self.init(elements)
}
}
// MARK: - NilLiteralConvertible
/// Conforming types can be initialized with nil.
extension JSON: NilLiteralConvertible {
/**
Creates an instance of JSON from a nil literal.
- parameter nilLiteral: A nil literal
- returns: An instance of JSON
*/
public init(nilLiteral: ()) {
self.init(object: nil)
}
}
| [
395267,
196612,
395271,
395274,
395278,
395280,
395281,
395282,
395283,
395286,
395287,
395289,
395290,
196638,
395295,
395296,
196641,
98341,
61478,
98344,
98345,
98349,
124987,
174139,
174141,
354364,
229438,
229440,
229441,
395328,
174148,
229444,
395332,
327751,
174152,
395333,
395334,
174159,
229456,
112721,
106580,
106582,
106585,
112730,
106586,
106587,
174171,
235658,
229524,
303255,
303256,
125087,
215205,
215211,
215212,
241846,
241852,
241859,
241862,
241864,
317640,
241866,
241870,
262357,
241877,
262359,
241894,
241897,
241901,
241903,
241904,
241907,
241908,
241910,
260342,
241916,
141565,
141569,
241923,
241928,
141577,
141578,
241930,
241934,
241936,
241937,
141586,
141588,
12565,
227604,
227607,
241944,
227608,
12569,
141593,
227612,
141594,
227614,
141599,
141600,
141595,
141596,
141597,
141598,
141603,
241952,
241957,
141606,
141607,
141608,
241962,
289067,
141612,
289068,
289062,
12592,
289074,
289078,
141627,
141629,
141632,
241989,
213319,
213320,
241993,
141640,
227610,
141641,
141642,
141643,
241996,
241998,
241999,
242002,
141651,
242006,
282967,
141655,
215384,
141660,
168285,
141663,
141664,
141670,
141677,
141681,
334196,
190840,
190841,
430456,
190843,
190844,
430458,
375168,
287106,
141700,
141702,
430475,
141707,
430476,
141711,
430483,
217492,
217494,
197018,
197019,
197021,
295330,
295331,
197029,
430502,
168359,
303550,
160205,
381398,
305638,
223741,
61971,
191006,
191007,
57893,
57896,
328232,
57899,
57900,
295467,
57905,
57906,
336445,
336446,
336450,
336451,
336453,
336454,
336455,
336457,
336460,
336464,
336465,
336467,
336469,
336470,
336471,
336472,
336473,
336474,
336478,
336479,
336480,
336482,
336483,
336489,
297620,
297634,
297636,
135861,
242361,
244419,
66247,
244427,
248524,
127693,
244430,
127695,
66261,
127702,
127703,
248541,
127714,
334562,
127716,
334564,
62183,
127727,
127729,
318199,
318200,
142073,
164601,
334590,
318207,
244480,
334591,
334596,
228512,
334600,
318218,
334603,
318220,
318221,
334602,
318223,
334606,
334607,
318231,
318233,
318234,
318236,
318237,
318241,
318246,
187175,
187176,
187174,
187177,
187179,
187180,
314165,
314167,
316216,
396088,
314170,
396089,
396091,
396092,
396094,
148287,
316224,
396098,
314179,
279367,
396104,
396110,
396112,
299858,
396114,
396115,
396118,
396119,
396120,
396122,
396123,
396125,
396126,
396127,
396128,
396129,
299880,
396137,
162668,
299884,
187248,
396147,
396151,
248696,
396153,
187258,
187259,
322430,
60304,
60319,
60321,
60323,
60324,
185258,
60331,
185259,
23469,
185262,
23470,
23472,
60337,
23473,
23474,
23475,
23476,
185267,
23479,
287674,
185275,
23483,
23487,
281539,
23492,
23494,
228306,
23508,
23515,
23517,
23523,
203755,
23531,
23533,
152560,
241992,
23552,
171008,
23559,
23561,
23572,
23574,
23575,
23580,
23581,
23585,
23590,
23591,
23594,
23596,
23599,
189488,
97327,
187442,
189490,
187444,
189492,
189493,
187447,
189491,
23601,
97329,
144435,
23607,
144437,
341054,
341055,
144441,
97339,
341058,
341059,
341060,
23612,
341062,
23616,
341057,
222278,
341066,
341063,
341068,
203862,
285782,
285785,
115805,
115806,
115807,
293982,
115809,
115810,
185446,
115817,
242794,
312427,
115819,
115820,
185452,
185454,
115823,
185455,
115825,
115827,
242803,
115829,
242807,
142459,
294016,
205959,
40088,
312473,
189594,
208026,
40092,
208027,
312478,
312479,
312480,
312481,
189598,
40095,
208029,
40101,
208033,
208039,
27810,
312489,
228513,
189607,
312492,
189609,
40110,
189610,
189612,
312493,
189617,
312497,
189619,
312498,
189621,
312501,
312504,
189623,
189626,
322751,
292041,
292042,
181455,
292049,
152789,
179432,
152821,
152825,
294137,
294138,
206094,
206097,
206098,
294162,
206102,
206104,
206108,
206109,
181533,
294181,
27943,
27944,
181544,
294183,
27948,
312476,
181553,
173368,
206138,
173379,
152906,
152907,
152908,
152909,
152910,
290123,
312482,
290125,
290126,
290127,
290130,
312483,
290135,
290136,
245081,
290137,
290139,
378208,
64865,
222562,
222563,
222566,
228717,
228721,
222579,
222587,
222590,
222591,
222596,
177543,
222599,
222601,
222603,
222604,
54669,
222605,
222606,
222607,
54673,
279954,
54692,
152998,
54698,
54701,
54703,
298431,
370118,
157151,
222689,
222692,
157157,
222693,
112111,
112115,
112120,
112131,
112145,
355859,
362020,
362022,
116267,
282156,
34359,
34362,
34365,
173631,
316993,
173634,
173635,
316995,
173637,
316997,
106085,
319081,
319085,
319088,
300660,
300661,
300662,
319094,
300663,
319103,
175760,
175763,
394905,
394908,
394910,
394912,
339622,
147113,
286378,
147115,
147118,
144438,
292544,
144442,
108230,
144443,
144444,
341052,
108240,
144445,
108245,
212694,
34531,
192230,
192231,
192232,
296681,
34538,
34540,
34541,
216812,
216814,
216815,
216816,
216818,
216819,
296684,
296687,
216822,
296688,
296691,
296692,
216826,
296698,
216828,
216829,
296699,
296700,
216832,
216833,
216834,
296703,
216836,
216837,
216838,
296707,
296708,
296710,
296712,
296713,
313101,
313104,
313108,
313111,
313112,
149274,
149275,
149280,
159523,
321342,
210755,
210756,
210757,
210758,
321353,
218959,
218960,
218963,
218964,
223065,
180058,
229209,
223069,
229213,
169824,
229217,
169826,
292709,
237413,
169830,
128873,
128875,
169835,
223085,
128876,
169837,
128878,
223086,
223087,
128881,
128884,
128882,
128883,
141181,
327550,
108419,
169860,
108421,
141198,
108431,
108432,
108436,
219033,
108446,
108448,
219040,
141219,
219043,
219044,
141223,
141228,
141229,
108460,
108462,
229294,
229295,
141235,
141264,
40931,
40932,
141284,
141290,
40940,
40941,
141293,
141295,
174063,
231406,
174066,
174067,
237559,
174074
] |
4f02f7494d798a637d1617429aec49bf3b68353f | c3b7bb6ac81c72751ceeff05064231e501356055 | /Tasker/TaskListViewController.swift | d6a37971dd0e93e3e71710e7aef6cf79df7e7203 | [] | no_license | LGornall/Tasker | 4adb75f5681867bd4cec2f10bc330716ae33d413 | 4c6733ebeb5f2606dc980a2f751757f78e6b7cbd | refs/heads/master | 2021-04-26T05:41:13.857556 | 2015-07-11T02:40:42 | 2015-07-11T02:40:42 | 35,897,197 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,331 | swift | //
// ViewController.swift
// Tasker
//
// Created by Louis Gornall on 17/05/2015.
// Copyright (c) 2015 Louis Gornall. All rights reserved.
//
import UIKit
import CoreData
class TaskListViewController: UITableViewController, NSFetchedResultsControllerDelegate {
var managedObjectContext: NSManagedObjectContext = (UIApplication.sharedApplication().delegate as! AppDelegate).managedObjectContext!
//get fetched Results controller on init
lazy var fetchedResultController: NSFetchedResultsController = {
let _fetchedResultController = NSFetchedResultsController(fetchRequest: self.taskFetchRequest(), managedObjectContext: self.managedObjectContext, sectionNameKeyPath: nil, cacheName: nil)
return _fetchedResultController
}()
//set a fetchRequest
func taskFetchRequest() -> NSFetchRequest {
let fetchRequest: NSFetchRequest = NSFetchRequest(entityName: "Tasks")
let sortDescriptor = NSSortDescriptor(key: "date", ascending: true)
fetchRequest.sortDescriptors = [sortDescriptor]
return fetchRequest
}
//Funcs for UITableView
//set the section count in the Table
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return fetchedResultController.sections!.count
}
//Set the number of rows within a section
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
let sectionInfo = fetchedResultController.sections![section] as! NSFetchedResultsSectionInfo
return sectionInfo.numberOfObjects
}
//creating the cells with the TaskTableCell.xib
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) ->UITableViewCell {
var custCell = tableView.dequeueReusableCellWithIdentifier("TaskTableCell") as! TaskCell
let task = fetchedResultController.objectAtIndexPath(indexPath) as! Tasks
custCell.loadWithTask(task)
return custCell
}
// Tap on row and pass to mark as completed
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let task:Tasks = fetchedResultController.objectAtIndexPath(indexPath) as! Tasks
//taskController.task = task
if task.completed == 0{
task.completed = 1
println("task is completed")
}else{
task.completed = 0
println("task is not completed")
}
self.managedObjectContext.save(nil)
}
//editing/deleting task
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
}
// creating custom actions for uiTableViewCells
override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? {
var editAction: UITableViewRowAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Edit" , handler: { (action:UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in
let cell = tableView.cellForRowAtIndexPath(indexPath)
tableView.deselectRowAtIndexPath(indexPath, animated: true)
self.performSegueWithIdentifier("edit", sender: cell)
})
editAction.backgroundColor = UIColor.blueColor()
var deleteAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Delete" , handler: { (action:UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in
let managedObject:NSManagedObject = self.fetchedResultController.objectAtIndexPath(indexPath) as! NSManagedObject
self.managedObjectContext.deleteObject(managedObject)
self.managedObjectContext.save(nil)
})
return [editAction, deleteAction]
}
//Did anything Change? Reload
func controllerDidChangeContent(controller: NSFetchedResultsController) {
tableView.reloadData()
}
//standard overridden funcs
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.tableView.contentInset = UIEdgeInsetsMake(20, 0, 0, 0)
fetchedResultController.delegate = self
fetchedResultController.performFetch(nil)
var nib = UINib(nibName: "TaskTableCell", bundle: nil)
tableView.registerNib(nib, forCellReuseIdentifier: "TaskTableCell")
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
if segue.identifier == "edit" {
let cell = sender as! UITableViewCell
let indexPath = tableView.indexPathForCell(cell)
let taskController:AddTaskViewController = segue.destinationViewController as! AddTaskViewController
let task:Tasks = fetchedResultController.objectAtIndexPath(indexPath!) as! Tasks
taskController.task = task
}
}
}
| [
-1
] |
1fd65bf4cba3c2ac9779d97a9e76942525e19259 | febca673798163dea6f6ecbba708a206b256b698 | /Scrumdinger/ScrumdingerApp.swift | 3ed7ed1bcf8beb894b2b0355723ae266c8fbc377 | [] | no_license | superleeyom/Scrumdinger | 80aec2d657d192e160d798f8ea2417a54b6d3397 | 2568c818920a2e558349f6c16212a334b6a963cd | refs/heads/master | 2023-06-22T18:29:54.455962 | 2021-07-20T10:07:59 | 2021-07-20T10:07:59 | 387,749,542 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 234 | swift | //
// ScrumdingerApp.swift
// Scrumdinger
//
// Created by 王礼勇 on 2021/7/20.
//
import SwiftUI
@main
struct ScrumdingerApp: App {
var body: some Scene {
WindowGroup {
MeetingView()
}
}
}
| [
348737,
421204,
418005,
345454
] |
92942b895a5353b6e501981f1d24bcc3e83aa73d | b29e88d5b68237dbb2e3d471bc66553cc768f03d | /CookpadPhotoViewer/Extensions/DateExtension.swift | 01d9ba61c18696ac0458e32c5aa6f86e0ac1d180 | [] | no_license | donly/CookpadPhotoViewer | c63ba91664a2f571f88ca3df8030e63c83c20111 | 78b4ab60c52270055c504fdf718adfb5e303f753 | refs/heads/master | 2020-05-30T05:33:30.432577 | 2017-05-27T10:22:16 | 2017-05-27T10:22:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,192 | swift | //
// DateExtension.swift
// CookpadPhotoViewer
//
// Created by Rebouh Aymen on 22/04/2017.
// Copyright © 2017 Aymen. All rights reserved.
//
import Foundation
extension Date {
func isToday() -> Bool {
let nowComponent = Calendar.current.dateComponents([.day , .month , .year], from: Date())
let dateComponent = Calendar.current.dateComponents([.day , .month , .year], from: self)
return nowComponent.day == dateComponent.day && nowComponent.month == dateComponent.month
&& nowComponent.year == dateComponent.year
}
func isYesterday() -> Bool {
var yesterdayComponent = DateComponents()
yesterdayComponent.day = -1
let yesterdayDate = Calendar.current.date(byAdding: yesterdayComponent, to: Date())!
yesterdayComponent = Calendar.current.dateComponents([.day , .month , .year], from: yesterdayDate)
let dateComponent = Calendar.current.dateComponents([.day , .month , .year], from: self)
return yesterdayComponent.day == dateComponent.day && yesterdayComponent.month == dateComponent.month
&& yesterdayComponent.year == dateComponent.year
}
}
| [
-1
] |
ccea9a7fa68ddbc3bdcdbc3d24a2bdbd22d18ce7 | f87108a1c2bce1f254529512dcf41c97774406ff | /submodules/TelegramApi/Sources/Api4.swift | fbbd0ce0df1223ee6eb7fc2839dcf1e5e051f7db | [] | no_license | luozhifa2000/Telegram-iOS-Double-Bottom-Postufgram | 3cabc7bca7804cdc00a8d2eb59aaa9237ced07f9 | 49e7241df8c382f4eac749ea94354493b51be0b1 | refs/heads/master | 2023-07-01T05:41:58.202931 | 2021-08-11T13:54:27 | 2021-08-11T13:54:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 498,975 | swift | public extension Api {
public struct updates {
public enum Difference: TypeConstructorDescription {
case differenceEmpty(date: Int32, seq: Int32)
case difference(newMessages: [Api.Message], newEncryptedMessages: [Api.EncryptedMessage], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User], state: Api.updates.State)
case differenceSlice(newMessages: [Api.Message], newEncryptedMessages: [Api.EncryptedMessage], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User], intermediateState: Api.updates.State)
case differenceTooLong(pts: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .differenceEmpty(let date, let seq):
if boxed {
buffer.appendInt32(1567990072)
}
serializeInt32(date, buffer: buffer, boxed: false)
serializeInt32(seq, buffer: buffer, boxed: false)
break
case .difference(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let state):
if boxed {
buffer.appendInt32(16030880)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(newMessages.count))
for item in newMessages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(newEncryptedMessages.count))
for item in newEncryptedMessages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(otherUpdates.count))
for item in otherUpdates {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
state.serialize(buffer, true)
break
case .differenceSlice(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let intermediateState):
if boxed {
buffer.appendInt32(-1459938943)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(newMessages.count))
for item in newMessages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(newEncryptedMessages.count))
for item in newEncryptedMessages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(otherUpdates.count))
for item in otherUpdates {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
intermediateState.serialize(buffer, true)
break
case .differenceTooLong(let pts):
if boxed {
buffer.appendInt32(1258196845)
}
serializeInt32(pts, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .differenceEmpty(let date, let seq):
return ("differenceEmpty", [("date", date), ("seq", seq)])
case .difference(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let state):
return ("difference", [("newMessages", newMessages), ("newEncryptedMessages", newEncryptedMessages), ("otherUpdates", otherUpdates), ("chats", chats), ("users", users), ("state", state)])
case .differenceSlice(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let intermediateState):
return ("differenceSlice", [("newMessages", newMessages), ("newEncryptedMessages", newEncryptedMessages), ("otherUpdates", otherUpdates), ("chats", chats), ("users", users), ("intermediateState", intermediateState)])
case .differenceTooLong(let pts):
return ("differenceTooLong", [("pts", pts)])
}
}
public static func parse_differenceEmpty(_ reader: BufferReader) -> Difference? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.updates.Difference.differenceEmpty(date: _1!, seq: _2!)
}
else {
return nil
}
}
public static func parse_difference(_ reader: BufferReader) -> Difference? {
var _1: [Api.Message]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
}
var _2: [Api.EncryptedMessage]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.EncryptedMessage.self)
}
var _3: [Api.Update]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Update.self)
}
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
var _6: Api.updates.State?
if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.updates.State
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.updates.Difference.difference(newMessages: _1!, newEncryptedMessages: _2!, otherUpdates: _3!, chats: _4!, users: _5!, state: _6!)
}
else {
return nil
}
}
public static func parse_differenceSlice(_ reader: BufferReader) -> Difference? {
var _1: [Api.Message]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
}
var _2: [Api.EncryptedMessage]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.EncryptedMessage.self)
}
var _3: [Api.Update]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Update.self)
}
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
var _6: Api.updates.State?
if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.updates.State
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.updates.Difference.differenceSlice(newMessages: _1!, newEncryptedMessages: _2!, otherUpdates: _3!, chats: _4!, users: _5!, intermediateState: _6!)
}
else {
return nil
}
}
public static func parse_differenceTooLong(_ reader: BufferReader) -> Difference? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.updates.Difference.differenceTooLong(pts: _1!)
}
else {
return nil
}
}
}
public enum State: TypeConstructorDescription {
case state(pts: Int32, qts: Int32, date: Int32, seq: Int32, unreadCount: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .state(let pts, let qts, let date, let seq, let unreadCount):
if boxed {
buffer.appendInt32(-1519637954)
}
serializeInt32(pts, buffer: buffer, boxed: false)
serializeInt32(qts, buffer: buffer, boxed: false)
serializeInt32(date, buffer: buffer, boxed: false)
serializeInt32(seq, buffer: buffer, boxed: false)
serializeInt32(unreadCount, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .state(let pts, let qts, let date, let seq, let unreadCount):
return ("state", [("pts", pts), ("qts", qts), ("date", date), ("seq", seq), ("unreadCount", unreadCount)])
}
}
public static func parse_state(_ reader: BufferReader) -> State? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
_3 = reader.readInt32()
var _4: Int32?
_4 = reader.readInt32()
var _5: Int32?
_5 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.updates.State.state(pts: _1!, qts: _2!, date: _3!, seq: _4!, unreadCount: _5!)
}
else {
return nil
}
}
}
public enum ChannelDifference: TypeConstructorDescription {
case channelDifferenceEmpty(flags: Int32, pts: Int32, timeout: Int32?)
case channelDifferenceTooLong(flags: Int32, timeout: Int32?, dialog: Api.Dialog, messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
case channelDifference(flags: Int32, pts: Int32, timeout: Int32?, newMessages: [Api.Message], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .channelDifferenceEmpty(let flags, let pts, let timeout):
if boxed {
buffer.appendInt32(1041346555)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(pts, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(timeout!, buffer: buffer, boxed: false)}
break
case .channelDifferenceTooLong(let flags, let timeout, let dialog, let messages, let chats, let users):
if boxed {
buffer.appendInt32(-1531132162)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(timeout!, buffer: buffer, boxed: false)}
dialog.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(messages.count))
for item in messages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
case .channelDifference(let flags, let pts, let timeout, let newMessages, let otherUpdates, let chats, let users):
if boxed {
buffer.appendInt32(543450958)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(pts, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(timeout!, buffer: buffer, boxed: false)}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(newMessages.count))
for item in newMessages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(otherUpdates.count))
for item in otherUpdates {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .channelDifferenceEmpty(let flags, let pts, let timeout):
return ("channelDifferenceEmpty", [("flags", flags), ("pts", pts), ("timeout", timeout)])
case .channelDifferenceTooLong(let flags, let timeout, let dialog, let messages, let chats, let users):
return ("channelDifferenceTooLong", [("flags", flags), ("timeout", timeout), ("dialog", dialog), ("messages", messages), ("chats", chats), ("users", users)])
case .channelDifference(let flags, let pts, let timeout, let newMessages, let otherUpdates, let chats, let users):
return ("channelDifference", [("flags", flags), ("pts", pts), ("timeout", timeout), ("newMessages", newMessages), ("otherUpdates", otherUpdates), ("chats", chats), ("users", users)])
}
}
public static func parse_channelDifferenceEmpty(_ reader: BufferReader) -> ChannelDifference? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
if Int(_1!) & Int(1 << 1) != 0 {_3 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
if _c1 && _c2 && _c3 {
return Api.updates.ChannelDifference.channelDifferenceEmpty(flags: _1!, pts: _2!, timeout: _3)
}
else {
return nil
}
}
public static func parse_channelDifferenceTooLong(_ reader: BufferReader) -> ChannelDifference? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
if Int(_1!) & Int(1 << 1) != 0 {_2 = reader.readInt32() }
var _3: Api.Dialog?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.Dialog
}
var _4: [Api.Message]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
}
var _5: [Api.Chat]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _6: [Api.User]?
if let _ = reader.readInt32() {
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 1) == 0) || _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.updates.ChannelDifference.channelDifferenceTooLong(flags: _1!, timeout: _2, dialog: _3!, messages: _4!, chats: _5!, users: _6!)
}
else {
return nil
}
}
public static func parse_channelDifference(_ reader: BufferReader) -> ChannelDifference? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
if Int(_1!) & Int(1 << 1) != 0 {_3 = reader.readInt32() }
var _4: [Api.Message]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
}
var _5: [Api.Update]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Update.self)
}
var _6: [Api.Chat]?
if let _ = reader.readInt32() {
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _7: [Api.User]?
if let _ = reader.readInt32() {
_7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
return Api.updates.ChannelDifference.channelDifference(flags: _1!, pts: _2!, timeout: _3, newMessages: _4!, otherUpdates: _5!, chats: _6!, users: _7!)
}
else {
return nil
}
}
}
}
}
public extension Api {
public struct upload {
public enum WebFile: TypeConstructorDescription {
case webFile(size: Int32, mimeType: String, fileType: Api.storage.FileType, mtime: Int32, bytes: Buffer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .webFile(let size, let mimeType, let fileType, let mtime, let bytes):
if boxed {
buffer.appendInt32(568808380)
}
serializeInt32(size, buffer: buffer, boxed: false)
serializeString(mimeType, buffer: buffer, boxed: false)
fileType.serialize(buffer, true)
serializeInt32(mtime, buffer: buffer, boxed: false)
serializeBytes(bytes, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .webFile(let size, let mimeType, let fileType, let mtime, let bytes):
return ("webFile", [("size", size), ("mimeType", mimeType), ("fileType", fileType), ("mtime", mtime), ("bytes", bytes)])
}
}
public static func parse_webFile(_ reader: BufferReader) -> WebFile? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: Api.storage.FileType?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.storage.FileType
}
var _4: Int32?
_4 = reader.readInt32()
var _5: Buffer?
_5 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.upload.WebFile.webFile(size: _1!, mimeType: _2!, fileType: _3!, mtime: _4!, bytes: _5!)
}
else {
return nil
}
}
}
public enum File: TypeConstructorDescription {
case file(type: Api.storage.FileType, mtime: Int32, bytes: Buffer)
case fileCdnRedirect(dcId: Int32, fileToken: Buffer, encryptionKey: Buffer, encryptionIv: Buffer, fileHashes: [Api.FileHash])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .file(let type, let mtime, let bytes):
if boxed {
buffer.appendInt32(157948117)
}
type.serialize(buffer, true)
serializeInt32(mtime, buffer: buffer, boxed: false)
serializeBytes(bytes, buffer: buffer, boxed: false)
break
case .fileCdnRedirect(let dcId, let fileToken, let encryptionKey, let encryptionIv, let fileHashes):
if boxed {
buffer.appendInt32(-242427324)
}
serializeInt32(dcId, buffer: buffer, boxed: false)
serializeBytes(fileToken, buffer: buffer, boxed: false)
serializeBytes(encryptionKey, buffer: buffer, boxed: false)
serializeBytes(encryptionIv, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(fileHashes.count))
for item in fileHashes {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .file(let type, let mtime, let bytes):
return ("file", [("type", type), ("mtime", mtime), ("bytes", bytes)])
case .fileCdnRedirect(let dcId, let fileToken, let encryptionKey, let encryptionIv, let fileHashes):
return ("fileCdnRedirect", [("dcId", dcId), ("fileToken", fileToken), ("encryptionKey", encryptionKey), ("encryptionIv", encryptionIv), ("fileHashes", fileHashes)])
}
}
public static func parse_file(_ reader: BufferReader) -> File? {
var _1: Api.storage.FileType?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.storage.FileType
}
var _2: Int32?
_2 = reader.readInt32()
var _3: Buffer?
_3 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.upload.File.file(type: _1!, mtime: _2!, bytes: _3!)
}
else {
return nil
}
}
public static func parse_fileCdnRedirect(_ reader: BufferReader) -> File? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Buffer?
_2 = parseBytes(reader)
var _3: Buffer?
_3 = parseBytes(reader)
var _4: Buffer?
_4 = parseBytes(reader)
var _5: [Api.FileHash]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.FileHash.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.upload.File.fileCdnRedirect(dcId: _1!, fileToken: _2!, encryptionKey: _3!, encryptionIv: _4!, fileHashes: _5!)
}
else {
return nil
}
}
}
public enum CdnFile: TypeConstructorDescription {
case cdnFileReuploadNeeded(requestToken: Buffer)
case cdnFile(bytes: Buffer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .cdnFileReuploadNeeded(let requestToken):
if boxed {
buffer.appendInt32(-290921362)
}
serializeBytes(requestToken, buffer: buffer, boxed: false)
break
case .cdnFile(let bytes):
if boxed {
buffer.appendInt32(-1449145777)
}
serializeBytes(bytes, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .cdnFileReuploadNeeded(let requestToken):
return ("cdnFileReuploadNeeded", [("requestToken", requestToken)])
case .cdnFile(let bytes):
return ("cdnFile", [("bytes", bytes)])
}
}
public static func parse_cdnFileReuploadNeeded(_ reader: BufferReader) -> CdnFile? {
var _1: Buffer?
_1 = parseBytes(reader)
let _c1 = _1 != nil
if _c1 {
return Api.upload.CdnFile.cdnFileReuploadNeeded(requestToken: _1!)
}
else {
return nil
}
}
public static func parse_cdnFile(_ reader: BufferReader) -> CdnFile? {
var _1: Buffer?
_1 = parseBytes(reader)
let _c1 = _1 != nil
if _c1 {
return Api.upload.CdnFile.cdnFile(bytes: _1!)
}
else {
return nil
}
}
}
}
}
public extension Api {
public struct stickers {
public enum SuggestedShortName: TypeConstructorDescription {
case suggestedShortName(shortName: String)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .suggestedShortName(let shortName):
if boxed {
buffer.appendInt32(-2046910401)
}
serializeString(shortName, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .suggestedShortName(let shortName):
return ("suggestedShortName", [("shortName", shortName)])
}
}
public static func parse_suggestedShortName(_ reader: BufferReader) -> SuggestedShortName? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.stickers.SuggestedShortName.suggestedShortName(shortName: _1!)
}
else {
return nil
}
}
}
}
}
public extension Api {
public struct storage {
public enum FileType: TypeConstructorDescription {
case fileUnknown
case filePartial
case fileJpeg
case fileGif
case filePng
case filePdf
case fileMp3
case fileMov
case fileMp4
case fileWebp
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .fileUnknown:
if boxed {
buffer.appendInt32(-1432995067)
}
break
case .filePartial:
if boxed {
buffer.appendInt32(1086091090)
}
break
case .fileJpeg:
if boxed {
buffer.appendInt32(8322574)
}
break
case .fileGif:
if boxed {
buffer.appendInt32(-891180321)
}
break
case .filePng:
if boxed {
buffer.appendInt32(172975040)
}
break
case .filePdf:
if boxed {
buffer.appendInt32(-1373745011)
}
break
case .fileMp3:
if boxed {
buffer.appendInt32(1384777335)
}
break
case .fileMov:
if boxed {
buffer.appendInt32(1258941372)
}
break
case .fileMp4:
if boxed {
buffer.appendInt32(-1278304028)
}
break
case .fileWebp:
if boxed {
buffer.appendInt32(276907596)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .fileUnknown:
return ("fileUnknown", [])
case .filePartial:
return ("filePartial", [])
case .fileJpeg:
return ("fileJpeg", [])
case .fileGif:
return ("fileGif", [])
case .filePng:
return ("filePng", [])
case .filePdf:
return ("filePdf", [])
case .fileMp3:
return ("fileMp3", [])
case .fileMov:
return ("fileMov", [])
case .fileMp4:
return ("fileMp4", [])
case .fileWebp:
return ("fileWebp", [])
}
}
public static func parse_fileUnknown(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileUnknown
}
public static func parse_filePartial(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.filePartial
}
public static func parse_fileJpeg(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileJpeg
}
public static func parse_fileGif(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileGif
}
public static func parse_filePng(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.filePng
}
public static func parse_filePdf(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.filePdf
}
public static func parse_fileMp3(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileMp3
}
public static func parse_fileMov(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileMov
}
public static func parse_fileMp4(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileMp4
}
public static func parse_fileWebp(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileWebp
}
}
}
}
public extension Api {
public struct account {
public enum TmpPassword: TypeConstructorDescription {
case tmpPassword(tmpPassword: Buffer, validUntil: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .tmpPassword(let tmpPassword, let validUntil):
if boxed {
buffer.appendInt32(-614138572)
}
serializeBytes(tmpPassword, buffer: buffer, boxed: false)
serializeInt32(validUntil, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .tmpPassword(let tmpPassword, let validUntil):
return ("tmpPassword", [("tmpPassword", tmpPassword), ("validUntil", validUntil)])
}
}
public static func parse_tmpPassword(_ reader: BufferReader) -> TmpPassword? {
var _1: Buffer?
_1 = parseBytes(reader)
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.account.TmpPassword.tmpPassword(tmpPassword: _1!, validUntil: _2!)
}
else {
return nil
}
}
}
public enum PasswordSettings: TypeConstructorDescription {
case passwordSettings(flags: Int32, email: String?, secureSettings: Api.SecureSecretSettings?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .passwordSettings(let flags, let email, let secureSettings):
if boxed {
buffer.appendInt32(-1705233435)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(email!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {secureSettings!.serialize(buffer, true)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .passwordSettings(let flags, let email, let secureSettings):
return ("passwordSettings", [("flags", flags), ("email", email), ("secureSettings", secureSettings)])
}
}
public static func parse_passwordSettings(_ reader: BufferReader) -> PasswordSettings? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
if Int(_1!) & Int(1 << 0) != 0 {_2 = parseString(reader) }
var _3: Api.SecureSecretSettings?
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.SecureSecretSettings
} }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
if _c1 && _c2 && _c3 {
return Api.account.PasswordSettings.passwordSettings(flags: _1!, email: _2, secureSettings: _3)
}
else {
return nil
}
}
}
public enum Takeout: TypeConstructorDescription {
case takeout(id: Int64)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .takeout(let id):
if boxed {
buffer.appendInt32(1304052993)
}
serializeInt64(id, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .takeout(let id):
return ("takeout", [("id", id)])
}
}
public static func parse_takeout(_ reader: BufferReader) -> Takeout? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
if _c1 {
return Api.account.Takeout.takeout(id: _1!)
}
else {
return nil
}
}
}
public enum Themes: TypeConstructorDescription {
case themesNotModified
case themes(hash: Int32, themes: [Api.Theme])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .themesNotModified:
if boxed {
buffer.appendInt32(-199313886)
}
break
case .themes(let hash, let themes):
if boxed {
buffer.appendInt32(2137482273)
}
serializeInt32(hash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(themes.count))
for item in themes {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .themesNotModified:
return ("themesNotModified", [])
case .themes(let hash, let themes):
return ("themes", [("hash", hash), ("themes", themes)])
}
}
public static func parse_themesNotModified(_ reader: BufferReader) -> Themes? {
return Api.account.Themes.themesNotModified
}
public static func parse_themes(_ reader: BufferReader) -> Themes? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.Theme]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Theme.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.account.Themes.themes(hash: _1!, themes: _2!)
}
else {
return nil
}
}
}
public enum WallPapers: TypeConstructorDescription {
case wallPapersNotModified
case wallPapers(hash: Int32, wallpapers: [Api.WallPaper])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .wallPapersNotModified:
if boxed {
buffer.appendInt32(471437699)
}
break
case .wallPapers(let hash, let wallpapers):
if boxed {
buffer.appendInt32(1881892265)
}
serializeInt32(hash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(wallpapers.count))
for item in wallpapers {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .wallPapersNotModified:
return ("wallPapersNotModified", [])
case .wallPapers(let hash, let wallpapers):
return ("wallPapers", [("hash", hash), ("wallpapers", wallpapers)])
}
}
public static func parse_wallPapersNotModified(_ reader: BufferReader) -> WallPapers? {
return Api.account.WallPapers.wallPapersNotModified
}
public static func parse_wallPapers(_ reader: BufferReader) -> WallPapers? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.WallPaper]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.WallPaper.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.account.WallPapers.wallPapers(hash: _1!, wallpapers: _2!)
}
else {
return nil
}
}
}
public enum PasswordInputSettings: TypeConstructorDescription {
case passwordInputSettings(flags: Int32, newAlgo: Api.PasswordKdfAlgo?, newPasswordHash: Buffer?, hint: String?, email: String?, newSecureSettings: Api.SecureSecretSettings?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .passwordInputSettings(let flags, let newAlgo, let newPasswordHash, let hint, let email, let newSecureSettings):
if boxed {
buffer.appendInt32(-1036572727)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {newAlgo!.serialize(buffer, true)}
if Int(flags) & Int(1 << 0) != 0 {serializeBytes(newPasswordHash!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 0) != 0 {serializeString(hint!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {serializeString(email!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {newSecureSettings!.serialize(buffer, true)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .passwordInputSettings(let flags, let newAlgo, let newPasswordHash, let hint, let email, let newSecureSettings):
return ("passwordInputSettings", [("flags", flags), ("newAlgo", newAlgo), ("newPasswordHash", newPasswordHash), ("hint", hint), ("email", email), ("newSecureSettings", newSecureSettings)])
}
}
public static func parse_passwordInputSettings(_ reader: BufferReader) -> PasswordInputSettings? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.PasswordKdfAlgo?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.PasswordKdfAlgo
} }
var _3: Buffer?
if Int(_1!) & Int(1 << 0) != 0 {_3 = parseBytes(reader) }
var _4: String?
if Int(_1!) & Int(1 << 0) != 0 {_4 = parseString(reader) }
var _5: String?
if Int(_1!) & Int(1 << 1) != 0 {_5 = parseString(reader) }
var _6: Api.SecureSecretSettings?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.SecureSecretSettings
} }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.account.PasswordInputSettings.passwordInputSettings(flags: _1!, newAlgo: _2, newPasswordHash: _3, hint: _4, email: _5, newSecureSettings: _6)
}
else {
return nil
}
}
}
public enum WebAuthorizations: TypeConstructorDescription {
case webAuthorizations(authorizations: [Api.WebAuthorization], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .webAuthorizations(let authorizations, let users):
if boxed {
buffer.appendInt32(-313079300)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(authorizations.count))
for item in authorizations {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .webAuthorizations(let authorizations, let users):
return ("webAuthorizations", [("authorizations", authorizations), ("users", users)])
}
}
public static func parse_webAuthorizations(_ reader: BufferReader) -> WebAuthorizations? {
var _1: [Api.WebAuthorization]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.WebAuthorization.self)
}
var _2: [Api.User]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.account.WebAuthorizations.webAuthorizations(authorizations: _1!, users: _2!)
}
else {
return nil
}
}
}
public enum SentEmailCode: TypeConstructorDescription {
case sentEmailCode(emailPattern: String, length: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .sentEmailCode(let emailPattern, let length):
if boxed {
buffer.appendInt32(-2128640689)
}
serializeString(emailPattern, buffer: buffer, boxed: false)
serializeInt32(length, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .sentEmailCode(let emailPattern, let length):
return ("sentEmailCode", [("emailPattern", emailPattern), ("length", length)])
}
}
public static func parse_sentEmailCode(_ reader: BufferReader) -> SentEmailCode? {
var _1: String?
_1 = parseString(reader)
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.account.SentEmailCode.sentEmailCode(emailPattern: _1!, length: _2!)
}
else {
return nil
}
}
}
public enum ResetPasswordResult: TypeConstructorDescription {
case resetPasswordFailedWait(retryDate: Int32)
case resetPasswordRequestedWait(untilDate: Int32)
case resetPasswordOk
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .resetPasswordFailedWait(let retryDate):
if boxed {
buffer.appendInt32(-478701471)
}
serializeInt32(retryDate, buffer: buffer, boxed: false)
break
case .resetPasswordRequestedWait(let untilDate):
if boxed {
buffer.appendInt32(-370148227)
}
serializeInt32(untilDate, buffer: buffer, boxed: false)
break
case .resetPasswordOk:
if boxed {
buffer.appendInt32(-383330754)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .resetPasswordFailedWait(let retryDate):
return ("resetPasswordFailedWait", [("retryDate", retryDate)])
case .resetPasswordRequestedWait(let untilDate):
return ("resetPasswordRequestedWait", [("untilDate", untilDate)])
case .resetPasswordOk:
return ("resetPasswordOk", [])
}
}
public static func parse_resetPasswordFailedWait(_ reader: BufferReader) -> ResetPasswordResult? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.account.ResetPasswordResult.resetPasswordFailedWait(retryDate: _1!)
}
else {
return nil
}
}
public static func parse_resetPasswordRequestedWait(_ reader: BufferReader) -> ResetPasswordResult? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.account.ResetPasswordResult.resetPasswordRequestedWait(untilDate: _1!)
}
else {
return nil
}
}
public static func parse_resetPasswordOk(_ reader: BufferReader) -> ResetPasswordResult? {
return Api.account.ResetPasswordResult.resetPasswordOk
}
}
public enum ContentSettings: TypeConstructorDescription {
case contentSettings(flags: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .contentSettings(let flags):
if boxed {
buffer.appendInt32(1474462241)
}
serializeInt32(flags, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .contentSettings(let flags):
return ("contentSettings", [("flags", flags)])
}
}
public static func parse_contentSettings(_ reader: BufferReader) -> ContentSettings? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.account.ContentSettings.contentSettings(flags: _1!)
}
else {
return nil
}
}
}
public enum Authorizations: TypeConstructorDescription {
case authorizations(authorizations: [Api.Authorization])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .authorizations(let authorizations):
if boxed {
buffer.appendInt32(307276766)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(authorizations.count))
for item in authorizations {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .authorizations(let authorizations):
return ("authorizations", [("authorizations", authorizations)])
}
}
public static func parse_authorizations(_ reader: BufferReader) -> Authorizations? {
var _1: [Api.Authorization]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Authorization.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.account.Authorizations.authorizations(authorizations: _1!)
}
else {
return nil
}
}
}
public enum AuthorizationForm: TypeConstructorDescription {
case authorizationForm(flags: Int32, requiredTypes: [Api.SecureRequiredType], values: [Api.SecureValue], errors: [Api.SecureValueError], users: [Api.User], privacyPolicyUrl: String?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .authorizationForm(let flags, let requiredTypes, let values, let errors, let users, let privacyPolicyUrl):
if boxed {
buffer.appendInt32(-1389486888)
}
serializeInt32(flags, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(requiredTypes.count))
for item in requiredTypes {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(values.count))
for item in values {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(errors.count))
for item in errors {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
if Int(flags) & Int(1 << 0) != 0 {serializeString(privacyPolicyUrl!, buffer: buffer, boxed: false)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .authorizationForm(let flags, let requiredTypes, let values, let errors, let users, let privacyPolicyUrl):
return ("authorizationForm", [("flags", flags), ("requiredTypes", requiredTypes), ("values", values), ("errors", errors), ("users", users), ("privacyPolicyUrl", privacyPolicyUrl)])
}
}
public static func parse_authorizationForm(_ reader: BufferReader) -> AuthorizationForm? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.SecureRequiredType]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureRequiredType.self)
}
var _3: [Api.SecureValue]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureValue.self)
}
var _4: [Api.SecureValueError]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureValueError.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
var _6: String?
if Int(_1!) & Int(1 << 0) != 0 {_6 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.account.AuthorizationForm.authorizationForm(flags: _1!, requiredTypes: _2!, values: _3!, errors: _4!, users: _5!, privacyPolicyUrl: _6)
}
else {
return nil
}
}
}
public enum Password: TypeConstructorDescription {
case password(flags: Int32, currentAlgo: Api.PasswordKdfAlgo?, srpB: Buffer?, srpId: Int64?, hint: String?, emailUnconfirmedPattern: String?, newAlgo: Api.PasswordKdfAlgo, newSecureAlgo: Api.SecurePasswordKdfAlgo, secureRandom: Buffer, pendingResetDate: Int32?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .password(let flags, let currentAlgo, let srpB, let srpId, let hint, let emailUnconfirmedPattern, let newAlgo, let newSecureAlgo, let secureRandom, let pendingResetDate):
if boxed {
buffer.appendInt32(408623183)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {currentAlgo!.serialize(buffer, true)}
if Int(flags) & Int(1 << 2) != 0 {serializeBytes(srpB!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {serializeInt64(srpId!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 3) != 0 {serializeString(hint!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 4) != 0 {serializeString(emailUnconfirmedPattern!, buffer: buffer, boxed: false)}
newAlgo.serialize(buffer, true)
newSecureAlgo.serialize(buffer, true)
serializeBytes(secureRandom, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 5) != 0 {serializeInt32(pendingResetDate!, buffer: buffer, boxed: false)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .password(let flags, let currentAlgo, let srpB, let srpId, let hint, let emailUnconfirmedPattern, let newAlgo, let newSecureAlgo, let secureRandom, let pendingResetDate):
return ("password", [("flags", flags), ("currentAlgo", currentAlgo), ("srpB", srpB), ("srpId", srpId), ("hint", hint), ("emailUnconfirmedPattern", emailUnconfirmedPattern), ("newAlgo", newAlgo), ("newSecureAlgo", newSecureAlgo), ("secureRandom", secureRandom), ("pendingResetDate", pendingResetDate)])
}
}
public static func parse_password(_ reader: BufferReader) -> Password? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.PasswordKdfAlgo?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.PasswordKdfAlgo
} }
var _3: Buffer?
if Int(_1!) & Int(1 << 2) != 0 {_3 = parseBytes(reader) }
var _4: Int64?
if Int(_1!) & Int(1 << 2) != 0 {_4 = reader.readInt64() }
var _5: String?
if Int(_1!) & Int(1 << 3) != 0 {_5 = parseString(reader) }
var _6: String?
if Int(_1!) & Int(1 << 4) != 0 {_6 = parseString(reader) }
var _7: Api.PasswordKdfAlgo?
if let signature = reader.readInt32() {
_7 = Api.parse(reader, signature: signature) as? Api.PasswordKdfAlgo
}
var _8: Api.SecurePasswordKdfAlgo?
if let signature = reader.readInt32() {
_8 = Api.parse(reader, signature: signature) as? Api.SecurePasswordKdfAlgo
}
var _9: Buffer?
_9 = parseBytes(reader)
var _10: Int32?
if Int(_1!) & Int(1 << 5) != 0 {_10 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 2) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 2) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 4) == 0) || _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
let _c9 = _9 != nil
let _c10 = (Int(_1!) & Int(1 << 5) == 0) || _10 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 {
return Api.account.Password.password(flags: _1!, currentAlgo: _2, srpB: _3, srpId: _4, hint: _5, emailUnconfirmedPattern: _6, newAlgo: _7!, newSecureAlgo: _8!, secureRandom: _9!, pendingResetDate: _10)
}
else {
return nil
}
}
}
public enum PrivacyRules: TypeConstructorDescription {
case privacyRules(rules: [Api.PrivacyRule], chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .privacyRules(let rules, let chats, let users):
if boxed {
buffer.appendInt32(1352683077)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(rules.count))
for item in rules {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .privacyRules(let rules, let chats, let users):
return ("privacyRules", [("rules", rules), ("chats", chats), ("users", users)])
}
}
public static func parse_privacyRules(_ reader: BufferReader) -> PrivacyRules? {
var _1: [Api.PrivacyRule]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PrivacyRule.self)
}
var _2: [Api.Chat]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _3: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.account.PrivacyRules.privacyRules(rules: _1!, chats: _2!, users: _3!)
}
else {
return nil
}
}
}
public enum AutoDownloadSettings: TypeConstructorDescription {
case autoDownloadSettings(low: Api.AutoDownloadSettings, medium: Api.AutoDownloadSettings, high: Api.AutoDownloadSettings)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .autoDownloadSettings(let low, let medium, let high):
if boxed {
buffer.appendInt32(1674235686)
}
low.serialize(buffer, true)
medium.serialize(buffer, true)
high.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .autoDownloadSettings(let low, let medium, let high):
return ("autoDownloadSettings", [("low", low), ("medium", medium), ("high", high)])
}
}
public static func parse_autoDownloadSettings(_ reader: BufferReader) -> AutoDownloadSettings? {
var _1: Api.AutoDownloadSettings?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.AutoDownloadSettings
}
var _2: Api.AutoDownloadSettings?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.AutoDownloadSettings
}
var _3: Api.AutoDownloadSettings?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.AutoDownloadSettings
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.account.AutoDownloadSettings.autoDownloadSettings(low: _1!, medium: _2!, high: _3!)
}
else {
return nil
}
}
}
}
}
public extension Api {
public struct photos {
public enum Photo: TypeConstructorDescription {
case photo(photo: Api.Photo, users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .photo(let photo, let users):
if boxed {
buffer.appendInt32(539045032)
}
photo.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .photo(let photo, let users):
return ("photo", [("photo", photo), ("users", users)])
}
}
public static func parse_photo(_ reader: BufferReader) -> Photo? {
var _1: Api.Photo?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.Photo
}
var _2: [Api.User]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.photos.Photo.photo(photo: _1!, users: _2!)
}
else {
return nil
}
}
}
public enum Photos: TypeConstructorDescription {
case photos(photos: [Api.Photo], users: [Api.User])
case photosSlice(count: Int32, photos: [Api.Photo], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .photos(let photos, let users):
if boxed {
buffer.appendInt32(-1916114267)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(photos.count))
for item in photos {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
case .photosSlice(let count, let photos, let users):
if boxed {
buffer.appendInt32(352657236)
}
serializeInt32(count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(photos.count))
for item in photos {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .photos(let photos, let users):
return ("photos", [("photos", photos), ("users", users)])
case .photosSlice(let count, let photos, let users):
return ("photosSlice", [("count", count), ("photos", photos), ("users", users)])
}
}
public static func parse_photos(_ reader: BufferReader) -> Photos? {
var _1: [Api.Photo]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Photo.self)
}
var _2: [Api.User]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.photos.Photos.photos(photos: _1!, users: _2!)
}
else {
return nil
}
}
public static func parse_photosSlice(_ reader: BufferReader) -> Photos? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.Photo]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Photo.self)
}
var _3: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.photos.Photos.photosSlice(count: _1!, photos: _2!, users: _3!)
}
else {
return nil
}
}
}
}
}
public extension Api {
public struct phone {
public enum JoinAsPeers: TypeConstructorDescription {
case joinAsPeers(peers: [Api.Peer], chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .joinAsPeers(let peers, let chats, let users):
if boxed {
buffer.appendInt32(-1343921601)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(peers.count))
for item in peers {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .joinAsPeers(let peers, let chats, let users):
return ("joinAsPeers", [("peers", peers), ("chats", chats), ("users", users)])
}
}
public static func parse_joinAsPeers(_ reader: BufferReader) -> JoinAsPeers? {
var _1: [Api.Peer]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self)
}
var _2: [Api.Chat]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _3: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.phone.JoinAsPeers.joinAsPeers(peers: _1!, chats: _2!, users: _3!)
}
else {
return nil
}
}
}
public enum GroupCall: TypeConstructorDescription {
case groupCall(call: Api.GroupCall, participants: [Api.GroupCallParticipant], participantsNextOffset: String, chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .groupCall(let call, let participants, let participantsNextOffset, let chats, let users):
if boxed {
buffer.appendInt32(-1636664659)
}
call.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(participants.count))
for item in participants {
item.serialize(buffer, true)
}
serializeString(participantsNextOffset, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .groupCall(let call, let participants, let participantsNextOffset, let chats, let users):
return ("groupCall", [("call", call), ("participants", participants), ("participantsNextOffset", participantsNextOffset), ("chats", chats), ("users", users)])
}
}
public static func parse_groupCall(_ reader: BufferReader) -> GroupCall? {
var _1: Api.GroupCall?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.GroupCall
}
var _2: [Api.GroupCallParticipant]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.GroupCallParticipant.self)
}
var _3: String?
_3 = parseString(reader)
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.phone.GroupCall.groupCall(call: _1!, participants: _2!, participantsNextOffset: _3!, chats: _4!, users: _5!)
}
else {
return nil
}
}
}
public enum GroupParticipants: TypeConstructorDescription {
case groupParticipants(count: Int32, participants: [Api.GroupCallParticipant], nextOffset: String, chats: [Api.Chat], users: [Api.User], version: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .groupParticipants(let count, let participants, let nextOffset, let chats, let users, let version):
if boxed {
buffer.appendInt32(-193506890)
}
serializeInt32(count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(participants.count))
for item in participants {
item.serialize(buffer, true)
}
serializeString(nextOffset, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
serializeInt32(version, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .groupParticipants(let count, let participants, let nextOffset, let chats, let users, let version):
return ("groupParticipants", [("count", count), ("participants", participants), ("nextOffset", nextOffset), ("chats", chats), ("users", users), ("version", version)])
}
}
public static func parse_groupParticipants(_ reader: BufferReader) -> GroupParticipants? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.GroupCallParticipant]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.GroupCallParticipant.self)
}
var _3: String?
_3 = parseString(reader)
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
var _6: Int32?
_6 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.phone.GroupParticipants.groupParticipants(count: _1!, participants: _2!, nextOffset: _3!, chats: _4!, users: _5!, version: _6!)
}
else {
return nil
}
}
}
public enum ExportedGroupCallInvite: TypeConstructorDescription {
case exportedGroupCallInvite(link: String)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .exportedGroupCallInvite(let link):
if boxed {
buffer.appendInt32(541839704)
}
serializeString(link, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .exportedGroupCallInvite(let link):
return ("exportedGroupCallInvite", [("link", link)])
}
}
public static func parse_exportedGroupCallInvite(_ reader: BufferReader) -> ExportedGroupCallInvite? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.phone.ExportedGroupCallInvite.exportedGroupCallInvite(link: _1!)
}
else {
return nil
}
}
}
public enum PhoneCall: TypeConstructorDescription {
case phoneCall(phoneCall: Api.PhoneCall, users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .phoneCall(let phoneCall, let users):
if boxed {
buffer.appendInt32(-326966976)
}
phoneCall.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .phoneCall(let phoneCall, let users):
return ("phoneCall", [("phoneCall", phoneCall), ("users", users)])
}
}
public static func parse_phoneCall(_ reader: BufferReader) -> PhoneCall? {
var _1: Api.PhoneCall?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.PhoneCall
}
var _2: [Api.User]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.phone.PhoneCall.phoneCall(phoneCall: _1!, users: _2!)
}
else {
return nil
}
}
}
}
}
public extension Api {
public struct functions {
public struct messages {
public static func getMessages(id: [Api.InputMessage]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
let buffer = Buffer()
buffer.appendInt32(1673946374)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count))
for item in id {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "messages.getMessages", parameters: [("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in
let reader = BufferReader(buffer)
var result: Api.messages.Messages?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Messages
}
return result
})
}
public static func getDialogs(flags: Int32, folderId: Int32?, offsetDate: Int32, offsetId: Int32, offsetPeer: Api.InputPeer, limit: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Dialogs>) {
let buffer = Buffer()
buffer.appendInt32(-1594999949)
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(folderId!, buffer: buffer, boxed: false)}
serializeInt32(offsetDate, buffer: buffer, boxed: false)
serializeInt32(offsetId, buffer: buffer, boxed: false)
offsetPeer.serialize(buffer, true)
serializeInt32(limit, buffer: buffer, boxed: false)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getDialogs", parameters: [("flags", flags), ("folderId", folderId), ("offsetDate", offsetDate), ("offsetId", offsetId), ("offsetPeer", offsetPeer), ("limit", limit), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Dialogs? in
let reader = BufferReader(buffer)
var result: Api.messages.Dialogs?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Dialogs
}
return result
})
}
public static func getHistory(peer: Api.InputPeer, offsetId: Int32, offsetDate: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
let buffer = Buffer()
buffer.appendInt32(-591691168)
peer.serialize(buffer, true)
serializeInt32(offsetId, buffer: buffer, boxed: false)
serializeInt32(offsetDate, buffer: buffer, boxed: false)
serializeInt32(addOffset, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
serializeInt32(maxId, buffer: buffer, boxed: false)
serializeInt32(minId, buffer: buffer, boxed: false)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getHistory", parameters: [("peer", peer), ("offsetId", offsetId), ("offsetDate", offsetDate), ("addOffset", addOffset), ("limit", limit), ("maxId", maxId), ("minId", minId), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in
let reader = BufferReader(buffer)
var result: Api.messages.Messages?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Messages
}
return result
})
}
public static func search(flags: Int32, peer: Api.InputPeer, q: String, fromId: Api.InputPeer?, topMsgId: Int32?, filter: Api.MessagesFilter, minDate: Int32, maxDate: Int32, offsetId: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
let buffer = Buffer()
buffer.appendInt32(204812012)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeString(q, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {fromId!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(topMsgId!, buffer: buffer, boxed: false)}
filter.serialize(buffer, true)
serializeInt32(minDate, buffer: buffer, boxed: false)
serializeInt32(maxDate, buffer: buffer, boxed: false)
serializeInt32(offsetId, buffer: buffer, boxed: false)
serializeInt32(addOffset, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
serializeInt32(maxId, buffer: buffer, boxed: false)
serializeInt32(minId, buffer: buffer, boxed: false)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.search", parameters: [("flags", flags), ("peer", peer), ("q", q), ("fromId", fromId), ("topMsgId", topMsgId), ("filter", filter), ("minDate", minDate), ("maxDate", maxDate), ("offsetId", offsetId), ("addOffset", addOffset), ("limit", limit), ("maxId", maxId), ("minId", minId), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in
let reader = BufferReader(buffer)
var result: Api.messages.Messages?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Messages
}
return result
})
}
public static func readHistory(peer: Api.InputPeer, maxId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.AffectedMessages>) {
let buffer = Buffer()
buffer.appendInt32(238054714)
peer.serialize(buffer, true)
serializeInt32(maxId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.readHistory", parameters: [("peer", peer), ("maxId", maxId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AffectedMessages? in
let reader = BufferReader(buffer)
var result: Api.messages.AffectedMessages?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.AffectedMessages
}
return result
})
}
public static func deleteHistory(flags: Int32, peer: Api.InputPeer, maxId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.AffectedHistory>) {
let buffer = Buffer()
buffer.appendInt32(469850889)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeInt32(maxId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.deleteHistory", parameters: [("flags", flags), ("peer", peer), ("maxId", maxId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AffectedHistory? in
let reader = BufferReader(buffer)
var result: Api.messages.AffectedHistory?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.AffectedHistory
}
return result
})
}
public static func deleteMessages(flags: Int32, id: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.AffectedMessages>) {
let buffer = Buffer()
buffer.appendInt32(-443640366)
serializeInt32(flags, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count))
for item in id {
serializeInt32(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "messages.deleteMessages", parameters: [("flags", flags), ("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AffectedMessages? in
let reader = BufferReader(buffer)
var result: Api.messages.AffectedMessages?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.AffectedMessages
}
return result
})
}
public static func receivedMessages(maxId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.ReceivedNotifyMessage]>) {
let buffer = Buffer()
buffer.appendInt32(94983360)
serializeInt32(maxId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.receivedMessages", parameters: [("maxId", maxId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.ReceivedNotifyMessage]? in
let reader = BufferReader(buffer)
var result: [Api.ReceivedNotifyMessage]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.ReceivedNotifyMessage.self)
}
return result
})
}
public static func setTyping(flags: Int32, peer: Api.InputPeer, topMsgId: Int32?, action: Api.SendMessageAction) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1486110434)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(topMsgId!, buffer: buffer, boxed: false)}
action.serialize(buffer, true)
return (FunctionDescription(name: "messages.setTyping", parameters: [("flags", flags), ("peer", peer), ("topMsgId", topMsgId), ("action", action)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func sendMessage(flags: Int32, peer: Api.InputPeer, replyToMsgId: Int32?, message: String, randomId: Int64, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, scheduleDate: Int32?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(1376532592)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(replyToMsgId!, buffer: buffer, boxed: false)}
serializeString(message, buffer: buffer, boxed: false)
serializeInt64(randomId, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
if Int(flags) & Int(1 << 3) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(entities!.count))
for item in entities! {
item.serialize(buffer, true)
}}
if Int(flags) & Int(1 << 10) != 0 {serializeInt32(scheduleDate!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "messages.sendMessage", parameters: [("flags", flags), ("peer", peer), ("replyToMsgId", replyToMsgId), ("message", message), ("randomId", randomId), ("replyMarkup", replyMarkup), ("entities", entities), ("scheduleDate", scheduleDate)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func sendMedia(flags: Int32, peer: Api.InputPeer, replyToMsgId: Int32?, media: Api.InputMedia, message: String, randomId: Int64, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, scheduleDate: Int32?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(881978281)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(replyToMsgId!, buffer: buffer, boxed: false)}
media.serialize(buffer, true)
serializeString(message, buffer: buffer, boxed: false)
serializeInt64(randomId, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
if Int(flags) & Int(1 << 3) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(entities!.count))
for item in entities! {
item.serialize(buffer, true)
}}
if Int(flags) & Int(1 << 10) != 0 {serializeInt32(scheduleDate!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "messages.sendMedia", parameters: [("flags", flags), ("peer", peer), ("replyToMsgId", replyToMsgId), ("media", media), ("message", message), ("randomId", randomId), ("replyMarkup", replyMarkup), ("entities", entities), ("scheduleDate", scheduleDate)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func forwardMessages(flags: Int32, fromPeer: Api.InputPeer, id: [Int32], randomId: [Int64], toPeer: Api.InputPeer, scheduleDate: Int32?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-637606386)
serializeInt32(flags, buffer: buffer, boxed: false)
fromPeer.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count))
for item in id {
serializeInt32(item, buffer: buffer, boxed: false)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(randomId.count))
for item in randomId {
serializeInt64(item, buffer: buffer, boxed: false)
}
toPeer.serialize(buffer, true)
if Int(flags) & Int(1 << 10) != 0 {serializeInt32(scheduleDate!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "messages.forwardMessages", parameters: [("flags", flags), ("fromPeer", fromPeer), ("id", id), ("randomId", randomId), ("toPeer", toPeer), ("scheduleDate", scheduleDate)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func reportSpam(peer: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-820669733)
peer.serialize(buffer, true)
return (FunctionDescription(name: "messages.reportSpam", parameters: [("peer", peer)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getPeerSettings(peer: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.PeerSettings>) {
let buffer = Buffer()
buffer.appendInt32(913498268)
peer.serialize(buffer, true)
return (FunctionDescription(name: "messages.getPeerSettings", parameters: [("peer", peer)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.PeerSettings? in
let reader = BufferReader(buffer)
var result: Api.PeerSettings?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.PeerSettings
}
return result
})
}
public static func report(peer: Api.InputPeer, id: [Int32], reason: Api.ReportReason, message: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1991005362)
peer.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count))
for item in id {
serializeInt32(item, buffer: buffer, boxed: false)
}
reason.serialize(buffer, true)
serializeString(message, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.report", parameters: [("peer", peer), ("id", id), ("reason", reason), ("message", message)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getChats(id: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Chats>) {
let buffer = Buffer()
buffer.appendInt32(1013621127)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count))
for item in id {
serializeInt32(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "messages.getChats", parameters: [("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in
let reader = BufferReader(buffer)
var result: Api.messages.Chats?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Chats
}
return result
})
}
public static func getFullChat(chatId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.ChatFull>) {
let buffer = Buffer()
buffer.appendInt32(998448230)
serializeInt32(chatId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getFullChat", parameters: [("chatId", chatId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.ChatFull? in
let reader = BufferReader(buffer)
var result: Api.messages.ChatFull?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.ChatFull
}
return result
})
}
public static func editChatTitle(chatId: Int32, title: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-599447467)
serializeInt32(chatId, buffer: buffer, boxed: false)
serializeString(title, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.editChatTitle", parameters: [("chatId", chatId), ("title", title)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func editChatPhoto(chatId: Int32, photo: Api.InputChatPhoto) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-900957736)
serializeInt32(chatId, buffer: buffer, boxed: false)
photo.serialize(buffer, true)
return (FunctionDescription(name: "messages.editChatPhoto", parameters: [("chatId", chatId), ("photo", photo)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func addChatUser(chatId: Int32, userId: Api.InputUser, fwdLimit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-106911223)
serializeInt32(chatId, buffer: buffer, boxed: false)
userId.serialize(buffer, true)
serializeInt32(fwdLimit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.addChatUser", parameters: [("chatId", chatId), ("userId", userId), ("fwdLimit", fwdLimit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func deleteChatUser(flags: Int32, chatId: Int32, userId: Api.InputUser) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-986430054)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(chatId, buffer: buffer, boxed: false)
userId.serialize(buffer, true)
return (FunctionDescription(name: "messages.deleteChatUser", parameters: [("flags", flags), ("chatId", chatId), ("userId", userId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func createChat(users: [Api.InputUser], title: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(164303470)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
serializeString(title, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.createChat", parameters: [("users", users), ("title", title)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func getDhConfig(version: Int32, randomLength: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.DhConfig>) {
let buffer = Buffer()
buffer.appendInt32(651135312)
serializeInt32(version, buffer: buffer, boxed: false)
serializeInt32(randomLength, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getDhConfig", parameters: [("version", version), ("randomLength", randomLength)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.DhConfig? in
let reader = BufferReader(buffer)
var result: Api.messages.DhConfig?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.DhConfig
}
return result
})
}
public static func requestEncryption(userId: Api.InputUser, randomId: Int32, gA: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.EncryptedChat>) {
let buffer = Buffer()
buffer.appendInt32(-162681021)
userId.serialize(buffer, true)
serializeInt32(randomId, buffer: buffer, boxed: false)
serializeBytes(gA, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.requestEncryption", parameters: [("userId", userId), ("randomId", randomId), ("gA", gA)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.EncryptedChat? in
let reader = BufferReader(buffer)
var result: Api.EncryptedChat?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.EncryptedChat
}
return result
})
}
public static func acceptEncryption(peer: Api.InputEncryptedChat, gB: Buffer, keyFingerprint: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.EncryptedChat>) {
let buffer = Buffer()
buffer.appendInt32(1035731989)
peer.serialize(buffer, true)
serializeBytes(gB, buffer: buffer, boxed: false)
serializeInt64(keyFingerprint, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.acceptEncryption", parameters: [("peer", peer), ("gB", gB), ("keyFingerprint", keyFingerprint)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.EncryptedChat? in
let reader = BufferReader(buffer)
var result: Api.EncryptedChat?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.EncryptedChat
}
return result
})
}
public static func discardEncryption(flags: Int32, chatId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-208425312)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(chatId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.discardEncryption", parameters: [("flags", flags), ("chatId", chatId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func setEncryptedTyping(peer: Api.InputEncryptedChat, typing: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(2031374829)
peer.serialize(buffer, true)
typing.serialize(buffer, true)
return (FunctionDescription(name: "messages.setEncryptedTyping", parameters: [("peer", peer), ("typing", typing)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func readEncryptedHistory(peer: Api.InputEncryptedChat, maxDate: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(2135648522)
peer.serialize(buffer, true)
serializeInt32(maxDate, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.readEncryptedHistory", parameters: [("peer", peer), ("maxDate", maxDate)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func sendEncrypted(flags: Int32, peer: Api.InputEncryptedChat, randomId: Int64, data: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.SentEncryptedMessage>) {
let buffer = Buffer()
buffer.appendInt32(1157265941)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeInt64(randomId, buffer: buffer, boxed: false)
serializeBytes(data, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.sendEncrypted", parameters: [("flags", flags), ("peer", peer), ("randomId", randomId), ("data", data)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.SentEncryptedMessage? in
let reader = BufferReader(buffer)
var result: Api.messages.SentEncryptedMessage?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.SentEncryptedMessage
}
return result
})
}
public static func sendEncryptedFile(flags: Int32, peer: Api.InputEncryptedChat, randomId: Int64, data: Buffer, file: Api.InputEncryptedFile) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.SentEncryptedMessage>) {
let buffer = Buffer()
buffer.appendInt32(1431914525)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeInt64(randomId, buffer: buffer, boxed: false)
serializeBytes(data, buffer: buffer, boxed: false)
file.serialize(buffer, true)
return (FunctionDescription(name: "messages.sendEncryptedFile", parameters: [("flags", flags), ("peer", peer), ("randomId", randomId), ("data", data), ("file", file)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.SentEncryptedMessage? in
let reader = BufferReader(buffer)
var result: Api.messages.SentEncryptedMessage?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.SentEncryptedMessage
}
return result
})
}
public static func sendEncryptedService(peer: Api.InputEncryptedChat, randomId: Int64, data: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.SentEncryptedMessage>) {
let buffer = Buffer()
buffer.appendInt32(852769188)
peer.serialize(buffer, true)
serializeInt64(randomId, buffer: buffer, boxed: false)
serializeBytes(data, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.sendEncryptedService", parameters: [("peer", peer), ("randomId", randomId), ("data", data)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.SentEncryptedMessage? in
let reader = BufferReader(buffer)
var result: Api.messages.SentEncryptedMessage?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.SentEncryptedMessage
}
return result
})
}
public static func receivedQueue(maxQts: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Int64]>) {
let buffer = Buffer()
buffer.appendInt32(1436924774)
serializeInt32(maxQts, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.receivedQueue", parameters: [("maxQts", maxQts)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Int64]? in
let reader = BufferReader(buffer)
var result: [Int64]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
return result
})
}
public static func reportEncryptedSpam(peer: Api.InputEncryptedChat) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1259113487)
peer.serialize(buffer, true)
return (FunctionDescription(name: "messages.reportEncryptedSpam", parameters: [("peer", peer)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func readMessageContents(id: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.AffectedMessages>) {
let buffer = Buffer()
buffer.appendInt32(916930423)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count))
for item in id {
serializeInt32(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "messages.readMessageContents", parameters: [("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AffectedMessages? in
let reader = BufferReader(buffer)
var result: Api.messages.AffectedMessages?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.AffectedMessages
}
return result
})
}
public static func getStickers(emoticon: String, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Stickers>) {
let buffer = Buffer()
buffer.appendInt32(71126828)
serializeString(emoticon, buffer: buffer, boxed: false)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getStickers", parameters: [("emoticon", emoticon), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Stickers? in
let reader = BufferReader(buffer)
var result: Api.messages.Stickers?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Stickers
}
return result
})
}
public static func getAllStickers(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.AllStickers>) {
let buffer = Buffer()
buffer.appendInt32(479598769)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getAllStickers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AllStickers? in
let reader = BufferReader(buffer)
var result: Api.messages.AllStickers?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.AllStickers
}
return result
})
}
public static func getWebPagePreview(flags: Int32, message: String, entities: [Api.MessageEntity]?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.MessageMedia>) {
let buffer = Buffer()
buffer.appendInt32(-1956073268)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(message, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 3) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(entities!.count))
for item in entities! {
item.serialize(buffer, true)
}}
return (FunctionDescription(name: "messages.getWebPagePreview", parameters: [("flags", flags), ("message", message), ("entities", entities)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.MessageMedia? in
let reader = BufferReader(buffer)
var result: Api.MessageMedia?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.MessageMedia
}
return result
})
}
public static func exportChatInvite(flags: Int32, peer: Api.InputPeer, expireDate: Int32?, usageLimit: Int32?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.ExportedChatInvite>) {
let buffer = Buffer()
buffer.appendInt32(347716823)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(expireDate!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(usageLimit!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "messages.exportChatInvite", parameters: [("flags", flags), ("peer", peer), ("expireDate", expireDate), ("usageLimit", usageLimit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.ExportedChatInvite? in
let reader = BufferReader(buffer)
var result: Api.ExportedChatInvite?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.ExportedChatInvite
}
return result
})
}
public static func checkChatInvite(hash: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.ChatInvite>) {
let buffer = Buffer()
buffer.appendInt32(1051570619)
serializeString(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.checkChatInvite", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.ChatInvite? in
let reader = BufferReader(buffer)
var result: Api.ChatInvite?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.ChatInvite
}
return result
})
}
public static func importChatInvite(hash: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(1817183516)
serializeString(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.importChatInvite", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func getStickerSet(stickerset: Api.InputStickerSet) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.StickerSet>) {
let buffer = Buffer()
buffer.appendInt32(639215886)
stickerset.serialize(buffer, true)
return (FunctionDescription(name: "messages.getStickerSet", parameters: [("stickerset", stickerset)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.StickerSet? in
let reader = BufferReader(buffer)
var result: Api.messages.StickerSet?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.StickerSet
}
return result
})
}
public static func installStickerSet(stickerset: Api.InputStickerSet, archived: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.StickerSetInstallResult>) {
let buffer = Buffer()
buffer.appendInt32(-946871200)
stickerset.serialize(buffer, true)
archived.serialize(buffer, true)
return (FunctionDescription(name: "messages.installStickerSet", parameters: [("stickerset", stickerset), ("archived", archived)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.StickerSetInstallResult? in
let reader = BufferReader(buffer)
var result: Api.messages.StickerSetInstallResult?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.StickerSetInstallResult
}
return result
})
}
public static func uninstallStickerSet(stickerset: Api.InputStickerSet) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-110209570)
stickerset.serialize(buffer, true)
return (FunctionDescription(name: "messages.uninstallStickerSet", parameters: [("stickerset", stickerset)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func startBot(bot: Api.InputUser, peer: Api.InputPeer, randomId: Int64, startParam: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-421563528)
bot.serialize(buffer, true)
peer.serialize(buffer, true)
serializeInt64(randomId, buffer: buffer, boxed: false)
serializeString(startParam, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.startBot", parameters: [("bot", bot), ("peer", peer), ("randomId", randomId), ("startParam", startParam)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func getMessagesViews(peer: Api.InputPeer, id: [Int32], increment: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.MessageViews>) {
let buffer = Buffer()
buffer.appendInt32(1468322785)
peer.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count))
for item in id {
serializeInt32(item, buffer: buffer, boxed: false)
}
increment.serialize(buffer, true)
return (FunctionDescription(name: "messages.getMessagesViews", parameters: [("peer", peer), ("id", id), ("increment", increment)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.MessageViews? in
let reader = BufferReader(buffer)
var result: Api.messages.MessageViews?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.MessageViews
}
return result
})
}
public static func editChatAdmin(chatId: Int32, userId: Api.InputUser, isAdmin: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1444503762)
serializeInt32(chatId, buffer: buffer, boxed: false)
userId.serialize(buffer, true)
isAdmin.serialize(buffer, true)
return (FunctionDescription(name: "messages.editChatAdmin", parameters: [("chatId", chatId), ("userId", userId), ("isAdmin", isAdmin)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func migrateChat(chatId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(363051235)
serializeInt32(chatId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.migrateChat", parameters: [("chatId", chatId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func searchGlobal(flags: Int32, folderId: Int32?, q: String, filter: Api.MessagesFilter, minDate: Int32, maxDate: Int32, offsetRate: Int32, offsetPeer: Api.InputPeer, offsetId: Int32, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
let buffer = Buffer()
buffer.appendInt32(1271290010)
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(folderId!, buffer: buffer, boxed: false)}
serializeString(q, buffer: buffer, boxed: false)
filter.serialize(buffer, true)
serializeInt32(minDate, buffer: buffer, boxed: false)
serializeInt32(maxDate, buffer: buffer, boxed: false)
serializeInt32(offsetRate, buffer: buffer, boxed: false)
offsetPeer.serialize(buffer, true)
serializeInt32(offsetId, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.searchGlobal", parameters: [("flags", flags), ("folderId", folderId), ("q", q), ("filter", filter), ("minDate", minDate), ("maxDate", maxDate), ("offsetRate", offsetRate), ("offsetPeer", offsetPeer), ("offsetId", offsetId), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in
let reader = BufferReader(buffer)
var result: Api.messages.Messages?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Messages
}
return result
})
}
public static func reorderStickerSets(flags: Int32, order: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(2016638777)
serializeInt32(flags, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(order.count))
for item in order {
serializeInt64(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "messages.reorderStickerSets", parameters: [("flags", flags), ("order", order)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getDocumentByHash(sha256: Buffer, size: Int32, mimeType: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Document>) {
let buffer = Buffer()
buffer.appendInt32(864953444)
serializeBytes(sha256, buffer: buffer, boxed: false)
serializeInt32(size, buffer: buffer, boxed: false)
serializeString(mimeType, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getDocumentByHash", parameters: [("sha256", sha256), ("size", size), ("mimeType", mimeType)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Document? in
let reader = BufferReader(buffer)
var result: Api.Document?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Document
}
return result
})
}
public static func getSavedGifs(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.SavedGifs>) {
let buffer = Buffer()
buffer.appendInt32(-2084618926)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getSavedGifs", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.SavedGifs? in
let reader = BufferReader(buffer)
var result: Api.messages.SavedGifs?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.SavedGifs
}
return result
})
}
public static func saveGif(id: Api.InputDocument, unsave: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(846868683)
id.serialize(buffer, true)
unsave.serialize(buffer, true)
return (FunctionDescription(name: "messages.saveGif", parameters: [("id", id), ("unsave", unsave)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getInlineBotResults(flags: Int32, bot: Api.InputUser, peer: Api.InputPeer, geoPoint: Api.InputGeoPoint?, query: String, offset: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.BotResults>) {
let buffer = Buffer()
buffer.appendInt32(1364105629)
serializeInt32(flags, buffer: buffer, boxed: false)
bot.serialize(buffer, true)
peer.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {geoPoint!.serialize(buffer, true)}
serializeString(query, buffer: buffer, boxed: false)
serializeString(offset, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getInlineBotResults", parameters: [("flags", flags), ("bot", bot), ("peer", peer), ("geoPoint", geoPoint), ("query", query), ("offset", offset)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.BotResults? in
let reader = BufferReader(buffer)
var result: Api.messages.BotResults?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.BotResults
}
return result
})
}
public static func setInlineBotResults(flags: Int32, queryId: Int64, results: [Api.InputBotInlineResult], cacheTime: Int32, nextOffset: String?, switchPm: Api.InlineBotSwitchPM?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-346119674)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(queryId, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(results.count))
for item in results {
item.serialize(buffer, true)
}
serializeInt32(cacheTime, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {serializeString(nextOffset!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 3) != 0 {switchPm!.serialize(buffer, true)}
return (FunctionDescription(name: "messages.setInlineBotResults", parameters: [("flags", flags), ("queryId", queryId), ("results", results), ("cacheTime", cacheTime), ("nextOffset", nextOffset), ("switchPm", switchPm)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func sendInlineBotResult(flags: Int32, peer: Api.InputPeer, replyToMsgId: Int32?, randomId: Int64, queryId: Int64, id: String, scheduleDate: Int32?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(570955184)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(replyToMsgId!, buffer: buffer, boxed: false)}
serializeInt64(randomId, buffer: buffer, boxed: false)
serializeInt64(queryId, buffer: buffer, boxed: false)
serializeString(id, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 10) != 0 {serializeInt32(scheduleDate!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "messages.sendInlineBotResult", parameters: [("flags", flags), ("peer", peer), ("replyToMsgId", replyToMsgId), ("randomId", randomId), ("queryId", queryId), ("id", id), ("scheduleDate", scheduleDate)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func getMessageEditData(peer: Api.InputPeer, id: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.MessageEditData>) {
let buffer = Buffer()
buffer.appendInt32(-39416522)
peer.serialize(buffer, true)
serializeInt32(id, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getMessageEditData", parameters: [("peer", peer), ("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.MessageEditData? in
let reader = BufferReader(buffer)
var result: Api.messages.MessageEditData?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.MessageEditData
}
return result
})
}
public static func editMessage(flags: Int32, peer: Api.InputPeer, id: Int32, message: String?, media: Api.InputMedia?, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, scheduleDate: Int32?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(1224152952)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeInt32(id, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 11) != 0 {serializeString(message!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 14) != 0 {media!.serialize(buffer, true)}
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
if Int(flags) & Int(1 << 3) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(entities!.count))
for item in entities! {
item.serialize(buffer, true)
}}
if Int(flags) & Int(1 << 15) != 0 {serializeInt32(scheduleDate!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "messages.editMessage", parameters: [("flags", flags), ("peer", peer), ("id", id), ("message", message), ("media", media), ("replyMarkup", replyMarkup), ("entities", entities), ("scheduleDate", scheduleDate)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func editInlineBotMessage(flags: Int32, id: Api.InputBotInlineMessageID, message: String?, media: Api.InputMedia?, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-2091549254)
serializeInt32(flags, buffer: buffer, boxed: false)
id.serialize(buffer, true)
if Int(flags) & Int(1 << 11) != 0 {serializeString(message!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 14) != 0 {media!.serialize(buffer, true)}
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
if Int(flags) & Int(1 << 3) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(entities!.count))
for item in entities! {
item.serialize(buffer, true)
}}
return (FunctionDescription(name: "messages.editInlineBotMessage", parameters: [("flags", flags), ("id", id), ("message", message), ("media", media), ("replyMarkup", replyMarkup), ("entities", entities)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getBotCallbackAnswer(flags: Int32, peer: Api.InputPeer, msgId: Int32, data: Buffer?, password: Api.InputCheckPasswordSRP?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.BotCallbackAnswer>) {
let buffer = Buffer()
buffer.appendInt32(-1824339449)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeBytes(data!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {password!.serialize(buffer, true)}
return (FunctionDescription(name: "messages.getBotCallbackAnswer", parameters: [("flags", flags), ("peer", peer), ("msgId", msgId), ("data", data), ("password", password)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.BotCallbackAnswer? in
let reader = BufferReader(buffer)
var result: Api.messages.BotCallbackAnswer?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.BotCallbackAnswer
}
return result
})
}
public static func setBotCallbackAnswer(flags: Int32, queryId: Int64, message: String?, url: String?, cacheTime: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-712043766)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(queryId, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(message!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {serializeString(url!, buffer: buffer, boxed: false)}
serializeInt32(cacheTime, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.setBotCallbackAnswer", parameters: [("flags", flags), ("queryId", queryId), ("message", message), ("url", url), ("cacheTime", cacheTime)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getPeerDialogs(peers: [Api.InputDialogPeer]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.PeerDialogs>) {
let buffer = Buffer()
buffer.appendInt32(-462373635)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(peers.count))
for item in peers {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "messages.getPeerDialogs", parameters: [("peers", peers)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.PeerDialogs? in
let reader = BufferReader(buffer)
var result: Api.messages.PeerDialogs?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.PeerDialogs
}
return result
})
}
public static func saveDraft(flags: Int32, replyToMsgId: Int32?, peer: Api.InputPeer, message: String, entities: [Api.MessageEntity]?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1137057461)
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(replyToMsgId!, buffer: buffer, boxed: false)}
peer.serialize(buffer, true)
serializeString(message, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 3) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(entities!.count))
for item in entities! {
item.serialize(buffer, true)
}}
return (FunctionDescription(name: "messages.saveDraft", parameters: [("flags", flags), ("replyToMsgId", replyToMsgId), ("peer", peer), ("message", message), ("entities", entities)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getAllDrafts() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(1782549861)
return (FunctionDescription(name: "messages.getAllDrafts", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func getFeaturedStickers(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.FeaturedStickers>) {
let buffer = Buffer()
buffer.appendInt32(766298703)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getFeaturedStickers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.FeaturedStickers? in
let reader = BufferReader(buffer)
var result: Api.messages.FeaturedStickers?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.FeaturedStickers
}
return result
})
}
public static func readFeaturedStickers(id: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1527873830)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count))
for item in id {
serializeInt64(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "messages.readFeaturedStickers", parameters: [("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getRecentStickers(flags: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.RecentStickers>) {
let buffer = Buffer()
buffer.appendInt32(1587647177)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getRecentStickers", parameters: [("flags", flags), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.RecentStickers? in
let reader = BufferReader(buffer)
var result: Api.messages.RecentStickers?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.RecentStickers
}
return result
})
}
public static func saveRecentSticker(flags: Int32, id: Api.InputDocument, unsave: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(958863608)
serializeInt32(flags, buffer: buffer, boxed: false)
id.serialize(buffer, true)
unsave.serialize(buffer, true)
return (FunctionDescription(name: "messages.saveRecentSticker", parameters: [("flags", flags), ("id", id), ("unsave", unsave)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func clearRecentStickers(flags: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1986437075)
serializeInt32(flags, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.clearRecentStickers", parameters: [("flags", flags)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getArchivedStickers(flags: Int32, offsetId: Int64, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.ArchivedStickers>) {
let buffer = Buffer()
buffer.appendInt32(1475442322)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(offsetId, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getArchivedStickers", parameters: [("flags", flags), ("offsetId", offsetId), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.ArchivedStickers? in
let reader = BufferReader(buffer)
var result: Api.messages.ArchivedStickers?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.ArchivedStickers
}
return result
})
}
public static func getMaskStickers(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.AllStickers>) {
let buffer = Buffer()
buffer.appendInt32(1706608543)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getMaskStickers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AllStickers? in
let reader = BufferReader(buffer)
var result: Api.messages.AllStickers?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.AllStickers
}
return result
})
}
public static func getAttachedStickers(media: Api.InputStickeredMedia) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.StickerSetCovered]>) {
let buffer = Buffer()
buffer.appendInt32(-866424884)
media.serialize(buffer, true)
return (FunctionDescription(name: "messages.getAttachedStickers", parameters: [("media", media)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.StickerSetCovered]? in
let reader = BufferReader(buffer)
var result: [Api.StickerSetCovered]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerSetCovered.self)
}
return result
})
}
public static func setGameScore(flags: Int32, peer: Api.InputPeer, id: Int32, userId: Api.InputUser, score: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-1896289088)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeInt32(id, buffer: buffer, boxed: false)
userId.serialize(buffer, true)
serializeInt32(score, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.setGameScore", parameters: [("flags", flags), ("peer", peer), ("id", id), ("userId", userId), ("score", score)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func setInlineGameScore(flags: Int32, id: Api.InputBotInlineMessageID, userId: Api.InputUser, score: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(363700068)
serializeInt32(flags, buffer: buffer, boxed: false)
id.serialize(buffer, true)
userId.serialize(buffer, true)
serializeInt32(score, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.setInlineGameScore", parameters: [("flags", flags), ("id", id), ("userId", userId), ("score", score)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getGameHighScores(peer: Api.InputPeer, id: Int32, userId: Api.InputUser) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.HighScores>) {
let buffer = Buffer()
buffer.appendInt32(-400399203)
peer.serialize(buffer, true)
serializeInt32(id, buffer: buffer, boxed: false)
userId.serialize(buffer, true)
return (FunctionDescription(name: "messages.getGameHighScores", parameters: [("peer", peer), ("id", id), ("userId", userId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.HighScores? in
let reader = BufferReader(buffer)
var result: Api.messages.HighScores?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.HighScores
}
return result
})
}
public static func getInlineGameHighScores(id: Api.InputBotInlineMessageID, userId: Api.InputUser) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.HighScores>) {
let buffer = Buffer()
buffer.appendInt32(258170395)
id.serialize(buffer, true)
userId.serialize(buffer, true)
return (FunctionDescription(name: "messages.getInlineGameHighScores", parameters: [("id", id), ("userId", userId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.HighScores? in
let reader = BufferReader(buffer)
var result: Api.messages.HighScores?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.HighScores
}
return result
})
}
public static func getCommonChats(userId: Api.InputUser, maxId: Int32, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Chats>) {
let buffer = Buffer()
buffer.appendInt32(218777796)
userId.serialize(buffer, true)
serializeInt32(maxId, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getCommonChats", parameters: [("userId", userId), ("maxId", maxId), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in
let reader = BufferReader(buffer)
var result: Api.messages.Chats?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Chats
}
return result
})
}
public static func getAllChats(exceptIds: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Chats>) {
let buffer = Buffer()
buffer.appendInt32(-341307408)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(exceptIds.count))
for item in exceptIds {
serializeInt32(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "messages.getAllChats", parameters: [("exceptIds", exceptIds)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in
let reader = BufferReader(buffer)
var result: Api.messages.Chats?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Chats
}
return result
})
}
public static func getWebPage(url: String, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.WebPage>) {
let buffer = Buffer()
buffer.appendInt32(852135825)
serializeString(url, buffer: buffer, boxed: false)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getWebPage", parameters: [("url", url), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.WebPage? in
let reader = BufferReader(buffer)
var result: Api.WebPage?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.WebPage
}
return result
})
}
public static func toggleDialogPin(flags: Int32, peer: Api.InputDialogPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1489903017)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
return (FunctionDescription(name: "messages.toggleDialogPin", parameters: [("flags", flags), ("peer", peer)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func reorderPinnedDialogs(flags: Int32, folderId: Int32, order: [Api.InputDialogPeer]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(991616823)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(folderId, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(order.count))
for item in order {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "messages.reorderPinnedDialogs", parameters: [("flags", flags), ("folderId", folderId), ("order", order)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getPinnedDialogs(folderId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.PeerDialogs>) {
let buffer = Buffer()
buffer.appendInt32(-692498958)
serializeInt32(folderId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getPinnedDialogs", parameters: [("folderId", folderId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.PeerDialogs? in
let reader = BufferReader(buffer)
var result: Api.messages.PeerDialogs?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.PeerDialogs
}
return result
})
}
public static func setBotShippingResults(flags: Int32, queryId: Int64, error: String?, shippingOptions: [Api.ShippingOption]?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-436833542)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(queryId, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(error!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(shippingOptions!.count))
for item in shippingOptions! {
item.serialize(buffer, true)
}}
return (FunctionDescription(name: "messages.setBotShippingResults", parameters: [("flags", flags), ("queryId", queryId), ("error", error), ("shippingOptions", shippingOptions)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func setBotPrecheckoutResults(flags: Int32, queryId: Int64, error: String?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(163765653)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(queryId, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(error!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "messages.setBotPrecheckoutResults", parameters: [("flags", flags), ("queryId", queryId), ("error", error)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func uploadMedia(peer: Api.InputPeer, media: Api.InputMedia) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.MessageMedia>) {
let buffer = Buffer()
buffer.appendInt32(1369162417)
peer.serialize(buffer, true)
media.serialize(buffer, true)
return (FunctionDescription(name: "messages.uploadMedia", parameters: [("peer", peer), ("media", media)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.MessageMedia? in
let reader = BufferReader(buffer)
var result: Api.MessageMedia?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.MessageMedia
}
return result
})
}
public static func sendScreenshotNotification(peer: Api.InputPeer, replyToMsgId: Int32, randomId: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-914493408)
peer.serialize(buffer, true)
serializeInt32(replyToMsgId, buffer: buffer, boxed: false)
serializeInt64(randomId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.sendScreenshotNotification", parameters: [("peer", peer), ("replyToMsgId", replyToMsgId), ("randomId", randomId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func getFavedStickers(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.FavedStickers>) {
let buffer = Buffer()
buffer.appendInt32(567151374)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getFavedStickers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.FavedStickers? in
let reader = BufferReader(buffer)
var result: Api.messages.FavedStickers?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.FavedStickers
}
return result
})
}
public static func faveSticker(id: Api.InputDocument, unfave: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1174420133)
id.serialize(buffer, true)
unfave.serialize(buffer, true)
return (FunctionDescription(name: "messages.faveSticker", parameters: [("id", id), ("unfave", unfave)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getUnreadMentions(peer: Api.InputPeer, offsetId: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
let buffer = Buffer()
buffer.appendInt32(1180140658)
peer.serialize(buffer, true)
serializeInt32(offsetId, buffer: buffer, boxed: false)
serializeInt32(addOffset, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
serializeInt32(maxId, buffer: buffer, boxed: false)
serializeInt32(minId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getUnreadMentions", parameters: [("peer", peer), ("offsetId", offsetId), ("addOffset", addOffset), ("limit", limit), ("maxId", maxId), ("minId", minId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in
let reader = BufferReader(buffer)
var result: Api.messages.Messages?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Messages
}
return result
})
}
public static func readMentions(peer: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.AffectedHistory>) {
let buffer = Buffer()
buffer.appendInt32(251759059)
peer.serialize(buffer, true)
return (FunctionDescription(name: "messages.readMentions", parameters: [("peer", peer)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AffectedHistory? in
let reader = BufferReader(buffer)
var result: Api.messages.AffectedHistory?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.AffectedHistory
}
return result
})
}
public static func getRecentLocations(peer: Api.InputPeer, limit: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
let buffer = Buffer()
buffer.appendInt32(-1144759543)
peer.serialize(buffer, true)
serializeInt32(limit, buffer: buffer, boxed: false)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getRecentLocations", parameters: [("peer", peer), ("limit", limit), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in
let reader = BufferReader(buffer)
var result: Api.messages.Messages?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Messages
}
return result
})
}
public static func sendMultiMedia(flags: Int32, peer: Api.InputPeer, replyToMsgId: Int32?, multiMedia: [Api.InputSingleMedia], scheduleDate: Int32?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-872345397)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(replyToMsgId!, buffer: buffer, boxed: false)}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(multiMedia.count))
for item in multiMedia {
item.serialize(buffer, true)
}
if Int(flags) & Int(1 << 10) != 0 {serializeInt32(scheduleDate!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "messages.sendMultiMedia", parameters: [("flags", flags), ("peer", peer), ("replyToMsgId", replyToMsgId), ("multiMedia", multiMedia), ("scheduleDate", scheduleDate)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func uploadEncryptedFile(peer: Api.InputEncryptedChat, file: Api.InputEncryptedFile) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.EncryptedFile>) {
let buffer = Buffer()
buffer.appendInt32(1347929239)
peer.serialize(buffer, true)
file.serialize(buffer, true)
return (FunctionDescription(name: "messages.uploadEncryptedFile", parameters: [("peer", peer), ("file", file)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.EncryptedFile? in
let reader = BufferReader(buffer)
var result: Api.EncryptedFile?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.EncryptedFile
}
return result
})
}
public static func searchStickerSets(flags: Int32, q: String, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.FoundStickerSets>) {
let buffer = Buffer()
buffer.appendInt32(-1028140917)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(q, buffer: buffer, boxed: false)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.searchStickerSets", parameters: [("flags", flags), ("q", q), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.FoundStickerSets? in
let reader = BufferReader(buffer)
var result: Api.messages.FoundStickerSets?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.FoundStickerSets
}
return result
})
}
public static func getSplitRanges() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.MessageRange]>) {
let buffer = Buffer()
buffer.appendInt32(486505992)
return (FunctionDescription(name: "messages.getSplitRanges", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.MessageRange]? in
let reader = BufferReader(buffer)
var result: [Api.MessageRange]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageRange.self)
}
return result
})
}
public static func markDialogUnread(flags: Int32, peer: Api.InputDialogPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1031349873)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
return (FunctionDescription(name: "messages.markDialogUnread", parameters: [("flags", flags), ("peer", peer)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getDialogUnreadMarks() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.DialogPeer]>) {
let buffer = Buffer()
buffer.appendInt32(585256482)
return (FunctionDescription(name: "messages.getDialogUnreadMarks", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.DialogPeer]? in
let reader = BufferReader(buffer)
var result: [Api.DialogPeer]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.DialogPeer.self)
}
return result
})
}
public static func clearAllDrafts() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(2119757468)
return (FunctionDescription(name: "messages.clearAllDrafts", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func updatePinnedMessage(flags: Int32, peer: Api.InputPeer, id: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-760547348)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeInt32(id, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.updatePinnedMessage", parameters: [("flags", flags), ("peer", peer), ("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func sendVote(peer: Api.InputPeer, msgId: Int32, options: [Buffer]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(283795844)
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(options.count))
for item in options {
serializeBytes(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "messages.sendVote", parameters: [("peer", peer), ("msgId", msgId), ("options", options)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func getPollResults(peer: Api.InputPeer, msgId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(1941660731)
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getPollResults", parameters: [("peer", peer), ("msgId", msgId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func getOnlines(peer: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.ChatOnlines>) {
let buffer = Buffer()
buffer.appendInt32(1848369232)
peer.serialize(buffer, true)
return (FunctionDescription(name: "messages.getOnlines", parameters: [("peer", peer)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.ChatOnlines? in
let reader = BufferReader(buffer)
var result: Api.ChatOnlines?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.ChatOnlines
}
return result
})
}
public static func getStatsURL(flags: Int32, peer: Api.InputPeer, params: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.StatsURL>) {
let buffer = Buffer()
buffer.appendInt32(-2127811866)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeString(params, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getStatsURL", parameters: [("flags", flags), ("peer", peer), ("params", params)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.StatsURL? in
let reader = BufferReader(buffer)
var result: Api.StatsURL?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.StatsURL
}
return result
})
}
public static func editChatAbout(peer: Api.InputPeer, about: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-554301545)
peer.serialize(buffer, true)
serializeString(about, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.editChatAbout", parameters: [("peer", peer), ("about", about)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func editChatDefaultBannedRights(peer: Api.InputPeer, bannedRights: Api.ChatBannedRights) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-1517917375)
peer.serialize(buffer, true)
bannedRights.serialize(buffer, true)
return (FunctionDescription(name: "messages.editChatDefaultBannedRights", parameters: [("peer", peer), ("bannedRights", bannedRights)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func getEmojiKeywords(langCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.EmojiKeywordsDifference>) {
let buffer = Buffer()
buffer.appendInt32(899735650)
serializeString(langCode, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getEmojiKeywords", parameters: [("langCode", langCode)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.EmojiKeywordsDifference? in
let reader = BufferReader(buffer)
var result: Api.EmojiKeywordsDifference?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.EmojiKeywordsDifference
}
return result
})
}
public static func getEmojiKeywordsDifference(langCode: String, fromVersion: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.EmojiKeywordsDifference>) {
let buffer = Buffer()
buffer.appendInt32(352892591)
serializeString(langCode, buffer: buffer, boxed: false)
serializeInt32(fromVersion, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getEmojiKeywordsDifference", parameters: [("langCode", langCode), ("fromVersion", fromVersion)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.EmojiKeywordsDifference? in
let reader = BufferReader(buffer)
var result: Api.EmojiKeywordsDifference?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.EmojiKeywordsDifference
}
return result
})
}
public static func getEmojiKeywordsLanguages(langCodes: [String]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.EmojiLanguage]>) {
let buffer = Buffer()
buffer.appendInt32(1318675378)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(langCodes.count))
for item in langCodes {
serializeString(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "messages.getEmojiKeywordsLanguages", parameters: [("langCodes", langCodes)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.EmojiLanguage]? in
let reader = BufferReader(buffer)
var result: [Api.EmojiLanguage]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.EmojiLanguage.self)
}
return result
})
}
public static func getEmojiURL(langCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.EmojiURL>) {
let buffer = Buffer()
buffer.appendInt32(-709817306)
serializeString(langCode, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getEmojiURL", parameters: [("langCode", langCode)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.EmojiURL? in
let reader = BufferReader(buffer)
var result: Api.EmojiURL?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.EmojiURL
}
return result
})
}
public static func getSearchCounters(peer: Api.InputPeer, filters: [Api.MessagesFilter]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.messages.SearchCounter]>) {
let buffer = Buffer()
buffer.appendInt32(1932455680)
peer.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(filters.count))
for item in filters {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "messages.getSearchCounters", parameters: [("peer", peer), ("filters", filters)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.messages.SearchCounter]? in
let reader = BufferReader(buffer)
var result: [Api.messages.SearchCounter]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.messages.SearchCounter.self)
}
return result
})
}
public static func requestUrlAuth(flags: Int32, peer: Api.InputPeer?, msgId: Int32?, buttonId: Int32?, url: String?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.UrlAuthResult>) {
let buffer = Buffer()
buffer.appendInt32(428848198)
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {peer!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(msgId!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(buttonId!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {serializeString(url!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "messages.requestUrlAuth", parameters: [("flags", flags), ("peer", peer), ("msgId", msgId), ("buttonId", buttonId), ("url", url)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.UrlAuthResult? in
let reader = BufferReader(buffer)
var result: Api.UrlAuthResult?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.UrlAuthResult
}
return result
})
}
public static func acceptUrlAuth(flags: Int32, peer: Api.InputPeer?, msgId: Int32?, buttonId: Int32?, url: String?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.UrlAuthResult>) {
let buffer = Buffer()
buffer.appendInt32(-1322487515)
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {peer!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(msgId!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(buttonId!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {serializeString(url!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "messages.acceptUrlAuth", parameters: [("flags", flags), ("peer", peer), ("msgId", msgId), ("buttonId", buttonId), ("url", url)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.UrlAuthResult? in
let reader = BufferReader(buffer)
var result: Api.UrlAuthResult?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.UrlAuthResult
}
return result
})
}
public static func hidePeerSettingsBar(peer: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1336717624)
peer.serialize(buffer, true)
return (FunctionDescription(name: "messages.hidePeerSettingsBar", parameters: [("peer", peer)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getScheduledHistory(peer: Api.InputPeer, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
let buffer = Buffer()
buffer.appendInt32(-490575781)
peer.serialize(buffer, true)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getScheduledHistory", parameters: [("peer", peer), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in
let reader = BufferReader(buffer)
var result: Api.messages.Messages?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Messages
}
return result
})
}
public static func getScheduledMessages(peer: Api.InputPeer, id: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
let buffer = Buffer()
buffer.appendInt32(-1111817116)
peer.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count))
for item in id {
serializeInt32(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "messages.getScheduledMessages", parameters: [("peer", peer), ("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in
let reader = BufferReader(buffer)
var result: Api.messages.Messages?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Messages
}
return result
})
}
public static func sendScheduledMessages(peer: Api.InputPeer, id: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-1120369398)
peer.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count))
for item in id {
serializeInt32(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "messages.sendScheduledMessages", parameters: [("peer", peer), ("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func deleteScheduledMessages(peer: Api.InputPeer, id: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(1504586518)
peer.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count))
for item in id {
serializeInt32(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "messages.deleteScheduledMessages", parameters: [("peer", peer), ("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func getPollVotes(flags: Int32, peer: Api.InputPeer, id: Int32, option: Buffer?, offset: String?, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.VotesList>) {
let buffer = Buffer()
buffer.appendInt32(-1200736242)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeInt32(id, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeBytes(option!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {serializeString(offset!, buffer: buffer, boxed: false)}
serializeInt32(limit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getPollVotes", parameters: [("flags", flags), ("peer", peer), ("id", id), ("option", option), ("offset", offset), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.VotesList? in
let reader = BufferReader(buffer)
var result: Api.messages.VotesList?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.VotesList
}
return result
})
}
public static func toggleStickerSets(flags: Int32, stickersets: [Api.InputStickerSet]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1257951254)
serializeInt32(flags, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(stickersets.count))
for item in stickersets {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "messages.toggleStickerSets", parameters: [("flags", flags), ("stickersets", stickersets)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getDialogFilters() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.DialogFilter]>) {
let buffer = Buffer()
buffer.appendInt32(-241247891)
return (FunctionDescription(name: "messages.getDialogFilters", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.DialogFilter]? in
let reader = BufferReader(buffer)
var result: [Api.DialogFilter]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.DialogFilter.self)
}
return result
})
}
public static func getSuggestedDialogFilters() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.DialogFilterSuggested]>) {
let buffer = Buffer()
buffer.appendInt32(-1566780372)
return (FunctionDescription(name: "messages.getSuggestedDialogFilters", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.DialogFilterSuggested]? in
let reader = BufferReader(buffer)
var result: [Api.DialogFilterSuggested]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.DialogFilterSuggested.self)
}
return result
})
}
public static func updateDialogFilter(flags: Int32, id: Int32, filter: Api.DialogFilter?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(450142282)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(id, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {filter!.serialize(buffer, true)}
return (FunctionDescription(name: "messages.updateDialogFilter", parameters: [("flags", flags), ("id", id), ("filter", filter)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func updateDialogFiltersOrder(order: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-983318044)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(order.count))
for item in order {
serializeInt32(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "messages.updateDialogFiltersOrder", parameters: [("order", order)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getOldFeaturedStickers(offset: Int32, limit: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.FeaturedStickers>) {
let buffer = Buffer()
buffer.appendInt32(1608974939)
serializeInt32(offset, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getOldFeaturedStickers", parameters: [("offset", offset), ("limit", limit), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.FeaturedStickers? in
let reader = BufferReader(buffer)
var result: Api.messages.FeaturedStickers?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.FeaturedStickers
}
return result
})
}
public static func getReplies(peer: Api.InputPeer, msgId: Int32, offsetId: Int32, offsetDate: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
let buffer = Buffer()
buffer.appendInt32(615875002)
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
serializeInt32(offsetId, buffer: buffer, boxed: false)
serializeInt32(offsetDate, buffer: buffer, boxed: false)
serializeInt32(addOffset, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
serializeInt32(maxId, buffer: buffer, boxed: false)
serializeInt32(minId, buffer: buffer, boxed: false)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getReplies", parameters: [("peer", peer), ("msgId", msgId), ("offsetId", offsetId), ("offsetDate", offsetDate), ("addOffset", addOffset), ("limit", limit), ("maxId", maxId), ("minId", minId), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in
let reader = BufferReader(buffer)
var result: Api.messages.Messages?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Messages
}
return result
})
}
public static func getDiscussionMessage(peer: Api.InputPeer, msgId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.DiscussionMessage>) {
let buffer = Buffer()
buffer.appendInt32(1147761405)
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getDiscussionMessage", parameters: [("peer", peer), ("msgId", msgId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.DiscussionMessage? in
let reader = BufferReader(buffer)
var result: Api.messages.DiscussionMessage?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.DiscussionMessage
}
return result
})
}
public static func readDiscussion(peer: Api.InputPeer, msgId: Int32, readMaxId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-147740172)
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
serializeInt32(readMaxId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.readDiscussion", parameters: [("peer", peer), ("msgId", msgId), ("readMaxId", readMaxId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func unpinAllMessages(peer: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.AffectedHistory>) {
let buffer = Buffer()
buffer.appendInt32(-265962357)
peer.serialize(buffer, true)
return (FunctionDescription(name: "messages.unpinAllMessages", parameters: [("peer", peer)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AffectedHistory? in
let reader = BufferReader(buffer)
var result: Api.messages.AffectedHistory?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.AffectedHistory
}
return result
})
}
public static func deleteChat(chatId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-2094760687)
serializeInt32(chatId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.deleteChat", parameters: [("chatId", chatId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func deletePhoneCallHistory(flags: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.AffectedFoundMessages>) {
let buffer = Buffer()
buffer.appendInt32(-104078327)
serializeInt32(flags, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.deletePhoneCallHistory", parameters: [("flags", flags)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AffectedFoundMessages? in
let reader = BufferReader(buffer)
var result: Api.messages.AffectedFoundMessages?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.AffectedFoundMessages
}
return result
})
}
public static func checkHistoryImport(importHead: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.HistoryImportParsed>) {
let buffer = Buffer()
buffer.appendInt32(1140726259)
serializeString(importHead, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.checkHistoryImport", parameters: [("importHead", importHead)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.HistoryImportParsed? in
let reader = BufferReader(buffer)
var result: Api.messages.HistoryImportParsed?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.HistoryImportParsed
}
return result
})
}
public static func initHistoryImport(peer: Api.InputPeer, file: Api.InputFile, mediaCount: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.HistoryImport>) {
let buffer = Buffer()
buffer.appendInt32(873008187)
peer.serialize(buffer, true)
file.serialize(buffer, true)
serializeInt32(mediaCount, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.initHistoryImport", parameters: [("peer", peer), ("file", file), ("mediaCount", mediaCount)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.HistoryImport? in
let reader = BufferReader(buffer)
var result: Api.messages.HistoryImport?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.HistoryImport
}
return result
})
}
public static func uploadImportedMedia(peer: Api.InputPeer, importId: Int64, fileName: String, media: Api.InputMedia) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.MessageMedia>) {
let buffer = Buffer()
buffer.appendInt32(713433234)
peer.serialize(buffer, true)
serializeInt64(importId, buffer: buffer, boxed: false)
serializeString(fileName, buffer: buffer, boxed: false)
media.serialize(buffer, true)
return (FunctionDescription(name: "messages.uploadImportedMedia", parameters: [("peer", peer), ("importId", importId), ("fileName", fileName), ("media", media)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.MessageMedia? in
let reader = BufferReader(buffer)
var result: Api.MessageMedia?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.MessageMedia
}
return result
})
}
public static func startHistoryImport(peer: Api.InputPeer, importId: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1271008444)
peer.serialize(buffer, true)
serializeInt64(importId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.startHistoryImport", parameters: [("peer", peer), ("importId", importId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getExportedChatInvites(flags: Int32, peer: Api.InputPeer, adminId: Api.InputUser, offsetDate: Int32?, offsetLink: String?, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.ExportedChatInvites>) {
let buffer = Buffer()
buffer.appendInt32(-1565154314)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
adminId.serialize(buffer, true)
if Int(flags) & Int(1 << 2) != 0 {serializeInt32(offsetDate!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {serializeString(offsetLink!, buffer: buffer, boxed: false)}
serializeInt32(limit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getExportedChatInvites", parameters: [("flags", flags), ("peer", peer), ("adminId", adminId), ("offsetDate", offsetDate), ("offsetLink", offsetLink), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.ExportedChatInvites? in
let reader = BufferReader(buffer)
var result: Api.messages.ExportedChatInvites?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.ExportedChatInvites
}
return result
})
}
public static func getExportedChatInvite(peer: Api.InputPeer, link: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.ExportedChatInvite>) {
let buffer = Buffer()
buffer.appendInt32(1937010524)
peer.serialize(buffer, true)
serializeString(link, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getExportedChatInvite", parameters: [("peer", peer), ("link", link)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.ExportedChatInvite? in
let reader = BufferReader(buffer)
var result: Api.messages.ExportedChatInvite?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.ExportedChatInvite
}
return result
})
}
public static func editExportedChatInvite(flags: Int32, peer: Api.InputPeer, link: String, expireDate: Int32?, usageLimit: Int32?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.ExportedChatInvite>) {
let buffer = Buffer()
buffer.appendInt32(48562110)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeString(link, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(expireDate!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(usageLimit!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "messages.editExportedChatInvite", parameters: [("flags", flags), ("peer", peer), ("link", link), ("expireDate", expireDate), ("usageLimit", usageLimit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.ExportedChatInvite? in
let reader = BufferReader(buffer)
var result: Api.messages.ExportedChatInvite?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.ExportedChatInvite
}
return result
})
}
public static func deleteRevokedExportedChatInvites(peer: Api.InputPeer, adminId: Api.InputUser) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1452833749)
peer.serialize(buffer, true)
adminId.serialize(buffer, true)
return (FunctionDescription(name: "messages.deleteRevokedExportedChatInvites", parameters: [("peer", peer), ("adminId", adminId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func deleteExportedChatInvite(peer: Api.InputPeer, link: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-731601877)
peer.serialize(buffer, true)
serializeString(link, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.deleteExportedChatInvite", parameters: [("peer", peer), ("link", link)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getAdminsWithInvites(peer: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.ChatAdminsWithInvites>) {
let buffer = Buffer()
buffer.appendInt32(958457583)
peer.serialize(buffer, true)
return (FunctionDescription(name: "messages.getAdminsWithInvites", parameters: [("peer", peer)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.ChatAdminsWithInvites? in
let reader = BufferReader(buffer)
var result: Api.messages.ChatAdminsWithInvites?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.ChatAdminsWithInvites
}
return result
})
}
public static func getChatInviteImporters(peer: Api.InputPeer, link: String, offsetDate: Int32, offsetUser: Api.InputUser, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.ChatInviteImporters>) {
let buffer = Buffer()
buffer.appendInt32(654013065)
peer.serialize(buffer, true)
serializeString(link, buffer: buffer, boxed: false)
serializeInt32(offsetDate, buffer: buffer, boxed: false)
offsetUser.serialize(buffer, true)
serializeInt32(limit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getChatInviteImporters", parameters: [("peer", peer), ("link", link), ("offsetDate", offsetDate), ("offsetUser", offsetUser), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.ChatInviteImporters? in
let reader = BufferReader(buffer)
var result: Api.messages.ChatInviteImporters?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.ChatInviteImporters
}
return result
})
}
public static func setHistoryTTL(peer: Api.InputPeer, period: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-1207017500)
peer.serialize(buffer, true)
serializeInt32(period, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.setHistoryTTL", parameters: [("peer", peer), ("period", period)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func checkHistoryImportPeer(peer: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.CheckedHistoryImportPeer>) {
let buffer = Buffer()
buffer.appendInt32(1573261059)
peer.serialize(buffer, true)
return (FunctionDescription(name: "messages.checkHistoryImportPeer", parameters: [("peer", peer)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.CheckedHistoryImportPeer? in
let reader = BufferReader(buffer)
var result: Api.messages.CheckedHistoryImportPeer?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.CheckedHistoryImportPeer
}
return result
})
}
}
public struct channels {
public static func readHistory(channel: Api.InputChannel, maxId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-871347913)
channel.serialize(buffer, true)
serializeInt32(maxId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "channels.readHistory", parameters: [("channel", channel), ("maxId", maxId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func deleteMessages(channel: Api.InputChannel, id: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.AffectedMessages>) {
let buffer = Buffer()
buffer.appendInt32(-2067661490)
channel.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count))
for item in id {
serializeInt32(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "channels.deleteMessages", parameters: [("channel", channel), ("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AffectedMessages? in
let reader = BufferReader(buffer)
var result: Api.messages.AffectedMessages?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.AffectedMessages
}
return result
})
}
public static func deleteUserHistory(channel: Api.InputChannel, userId: Api.InputUser) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.AffectedHistory>) {
let buffer = Buffer()
buffer.appendInt32(-787622117)
channel.serialize(buffer, true)
userId.serialize(buffer, true)
return (FunctionDescription(name: "channels.deleteUserHistory", parameters: [("channel", channel), ("userId", userId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AffectedHistory? in
let reader = BufferReader(buffer)
var result: Api.messages.AffectedHistory?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.AffectedHistory
}
return result
})
}
public static func reportSpam(channel: Api.InputChannel, userId: Api.InputUser, id: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-32999408)
channel.serialize(buffer, true)
userId.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count))
for item in id {
serializeInt32(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "channels.reportSpam", parameters: [("channel", channel), ("userId", userId), ("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getMessages(channel: Api.InputChannel, id: [Api.InputMessage]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
let buffer = Buffer()
buffer.appendInt32(-1383294429)
channel.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count))
for item in id {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "channels.getMessages", parameters: [("channel", channel), ("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in
let reader = BufferReader(buffer)
var result: Api.messages.Messages?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Messages
}
return result
})
}
public static func getParticipants(channel: Api.InputChannel, filter: Api.ChannelParticipantsFilter, offset: Int32, limit: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.channels.ChannelParticipants>) {
let buffer = Buffer()
buffer.appendInt32(306054633)
channel.serialize(buffer, true)
filter.serialize(buffer, true)
serializeInt32(offset, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "channels.getParticipants", parameters: [("channel", channel), ("filter", filter), ("offset", offset), ("limit", limit), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.channels.ChannelParticipants? in
let reader = BufferReader(buffer)
var result: Api.channels.ChannelParticipants?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.channels.ChannelParticipants
}
return result
})
}
public static func getParticipant(channel: Api.InputChannel, participant: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.channels.ChannelParticipant>) {
let buffer = Buffer()
buffer.appendInt32(-1599378234)
channel.serialize(buffer, true)
participant.serialize(buffer, true)
return (FunctionDescription(name: "channels.getParticipant", parameters: [("channel", channel), ("participant", participant)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.channels.ChannelParticipant? in
let reader = BufferReader(buffer)
var result: Api.channels.ChannelParticipant?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.channels.ChannelParticipant
}
return result
})
}
public static func getChannels(id: [Api.InputChannel]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Chats>) {
let buffer = Buffer()
buffer.appendInt32(176122811)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count))
for item in id {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "channels.getChannels", parameters: [("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in
let reader = BufferReader(buffer)
var result: Api.messages.Chats?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Chats
}
return result
})
}
public static func getFullChannel(channel: Api.InputChannel) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.ChatFull>) {
let buffer = Buffer()
buffer.appendInt32(141781513)
channel.serialize(buffer, true)
return (FunctionDescription(name: "channels.getFullChannel", parameters: [("channel", channel)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.ChatFull? in
let reader = BufferReader(buffer)
var result: Api.messages.ChatFull?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.ChatFull
}
return result
})
}
public static func createChannel(flags: Int32, title: String, about: String, geoPoint: Api.InputGeoPoint?, address: String?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(1029681423)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(title, buffer: buffer, boxed: false)
serializeString(about, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {geoPoint!.serialize(buffer, true)}
if Int(flags) & Int(1 << 2) != 0 {serializeString(address!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "channels.createChannel", parameters: [("flags", flags), ("title", title), ("about", about), ("geoPoint", geoPoint), ("address", address)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func editAdmin(channel: Api.InputChannel, userId: Api.InputUser, adminRights: Api.ChatAdminRights, rank: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-751007486)
channel.serialize(buffer, true)
userId.serialize(buffer, true)
adminRights.serialize(buffer, true)
serializeString(rank, buffer: buffer, boxed: false)
return (FunctionDescription(name: "channels.editAdmin", parameters: [("channel", channel), ("userId", userId), ("adminRights", adminRights), ("rank", rank)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func editTitle(channel: Api.InputChannel, title: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(1450044624)
channel.serialize(buffer, true)
serializeString(title, buffer: buffer, boxed: false)
return (FunctionDescription(name: "channels.editTitle", parameters: [("channel", channel), ("title", title)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func editPhoto(channel: Api.InputChannel, photo: Api.InputChatPhoto) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-248621111)
channel.serialize(buffer, true)
photo.serialize(buffer, true)
return (FunctionDescription(name: "channels.editPhoto", parameters: [("channel", channel), ("photo", photo)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func checkUsername(channel: Api.InputChannel, username: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(283557164)
channel.serialize(buffer, true)
serializeString(username, buffer: buffer, boxed: false)
return (FunctionDescription(name: "channels.checkUsername", parameters: [("channel", channel), ("username", username)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func updateUsername(channel: Api.InputChannel, username: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(890549214)
channel.serialize(buffer, true)
serializeString(username, buffer: buffer, boxed: false)
return (FunctionDescription(name: "channels.updateUsername", parameters: [("channel", channel), ("username", username)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func joinChannel(channel: Api.InputChannel) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(615851205)
channel.serialize(buffer, true)
return (FunctionDescription(name: "channels.joinChannel", parameters: [("channel", channel)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func leaveChannel(channel: Api.InputChannel) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-130635115)
channel.serialize(buffer, true)
return (FunctionDescription(name: "channels.leaveChannel", parameters: [("channel", channel)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func inviteToChannel(channel: Api.InputChannel, users: [Api.InputUser]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(429865580)
channel.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "channels.inviteToChannel", parameters: [("channel", channel), ("users", users)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func deleteChannel(channel: Api.InputChannel) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-1072619549)
channel.serialize(buffer, true)
return (FunctionDescription(name: "channels.deleteChannel", parameters: [("channel", channel)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func exportMessageLink(flags: Int32, channel: Api.InputChannel, id: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.ExportedMessageLink>) {
let buffer = Buffer()
buffer.appendInt32(-432034325)
serializeInt32(flags, buffer: buffer, boxed: false)
channel.serialize(buffer, true)
serializeInt32(id, buffer: buffer, boxed: false)
return (FunctionDescription(name: "channels.exportMessageLink", parameters: [("flags", flags), ("channel", channel), ("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.ExportedMessageLink? in
let reader = BufferReader(buffer)
var result: Api.ExportedMessageLink?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.ExportedMessageLink
}
return result
})
}
public static func toggleSignatures(channel: Api.InputChannel, enabled: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(527021574)
channel.serialize(buffer, true)
enabled.serialize(buffer, true)
return (FunctionDescription(name: "channels.toggleSignatures", parameters: [("channel", channel), ("enabled", enabled)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func getAdminedPublicChannels(flags: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Chats>) {
let buffer = Buffer()
buffer.appendInt32(-122669393)
serializeInt32(flags, buffer: buffer, boxed: false)
return (FunctionDescription(name: "channels.getAdminedPublicChannels", parameters: [("flags", flags)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in
let reader = BufferReader(buffer)
var result: Api.messages.Chats?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Chats
}
return result
})
}
public static func editBanned(channel: Api.InputChannel, participant: Api.InputPeer, bannedRights: Api.ChatBannedRights) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-1763259007)
channel.serialize(buffer, true)
participant.serialize(buffer, true)
bannedRights.serialize(buffer, true)
return (FunctionDescription(name: "channels.editBanned", parameters: [("channel", channel), ("participant", participant), ("bannedRights", bannedRights)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func getAdminLog(flags: Int32, channel: Api.InputChannel, q: String, eventsFilter: Api.ChannelAdminLogEventsFilter?, admins: [Api.InputUser]?, maxId: Int64, minId: Int64, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.channels.AdminLogResults>) {
let buffer = Buffer()
buffer.appendInt32(870184064)
serializeInt32(flags, buffer: buffer, boxed: false)
channel.serialize(buffer, true)
serializeString(q, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {eventsFilter!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(admins!.count))
for item in admins! {
item.serialize(buffer, true)
}}
serializeInt64(maxId, buffer: buffer, boxed: false)
serializeInt64(minId, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "channels.getAdminLog", parameters: [("flags", flags), ("channel", channel), ("q", q), ("eventsFilter", eventsFilter), ("admins", admins), ("maxId", maxId), ("minId", minId), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.channels.AdminLogResults? in
let reader = BufferReader(buffer)
var result: Api.channels.AdminLogResults?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.channels.AdminLogResults
}
return result
})
}
public static func setStickers(channel: Api.InputChannel, stickerset: Api.InputStickerSet) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-359881479)
channel.serialize(buffer, true)
stickerset.serialize(buffer, true)
return (FunctionDescription(name: "channels.setStickers", parameters: [("channel", channel), ("stickerset", stickerset)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func readMessageContents(channel: Api.InputChannel, id: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-357180360)
channel.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count))
for item in id {
serializeInt32(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "channels.readMessageContents", parameters: [("channel", channel), ("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func deleteHistory(channel: Api.InputChannel, maxId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1355375294)
channel.serialize(buffer, true)
serializeInt32(maxId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "channels.deleteHistory", parameters: [("channel", channel), ("maxId", maxId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func togglePreHistoryHidden(channel: Api.InputChannel, enabled: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-356796084)
channel.serialize(buffer, true)
enabled.serialize(buffer, true)
return (FunctionDescription(name: "channels.togglePreHistoryHidden", parameters: [("channel", channel), ("enabled", enabled)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func getLeftChannels(offset: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Chats>) {
let buffer = Buffer()
buffer.appendInt32(-2092831552)
serializeInt32(offset, buffer: buffer, boxed: false)
return (FunctionDescription(name: "channels.getLeftChannels", parameters: [("offset", offset)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in
let reader = BufferReader(buffer)
var result: Api.messages.Chats?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Chats
}
return result
})
}
public static func getGroupsForDiscussion() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Chats>) {
let buffer = Buffer()
buffer.appendInt32(-170208392)
return (FunctionDescription(name: "channels.getGroupsForDiscussion", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in
let reader = BufferReader(buffer)
var result: Api.messages.Chats?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Chats
}
return result
})
}
public static func setDiscussionGroup(broadcast: Api.InputChannel, group: Api.InputChannel) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1079520178)
broadcast.serialize(buffer, true)
group.serialize(buffer, true)
return (FunctionDescription(name: "channels.setDiscussionGroup", parameters: [("broadcast", broadcast), ("group", group)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func editCreator(channel: Api.InputChannel, userId: Api.InputUser, password: Api.InputCheckPasswordSRP) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-1892102881)
channel.serialize(buffer, true)
userId.serialize(buffer, true)
password.serialize(buffer, true)
return (FunctionDescription(name: "channels.editCreator", parameters: [("channel", channel), ("userId", userId), ("password", password)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func editLocation(channel: Api.InputChannel, geoPoint: Api.InputGeoPoint, address: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1491484525)
channel.serialize(buffer, true)
geoPoint.serialize(buffer, true)
serializeString(address, buffer: buffer, boxed: false)
return (FunctionDescription(name: "channels.editLocation", parameters: [("channel", channel), ("geoPoint", geoPoint), ("address", address)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func toggleSlowMode(channel: Api.InputChannel, seconds: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-304832784)
channel.serialize(buffer, true)
serializeInt32(seconds, buffer: buffer, boxed: false)
return (FunctionDescription(name: "channels.toggleSlowMode", parameters: [("channel", channel), ("seconds", seconds)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func getInactiveChannels() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.InactiveChats>) {
let buffer = Buffer()
buffer.appendInt32(300429806)
return (FunctionDescription(name: "channels.getInactiveChannels", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.InactiveChats? in
let reader = BufferReader(buffer)
var result: Api.messages.InactiveChats?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.InactiveChats
}
return result
})
}
public static func convertToGigagroup(channel: Api.InputChannel) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(187239529)
channel.serialize(buffer, true)
return (FunctionDescription(name: "channels.convertToGigagroup", parameters: [("channel", channel)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
}
public struct payments {
public static func getPaymentForm(flags: Int32, peer: Api.InputPeer, msgId: Int32, themeParams: Api.DataJSON?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.payments.PaymentForm>) {
let buffer = Buffer()
buffer.appendInt32(-1976353651)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {themeParams!.serialize(buffer, true)}
return (FunctionDescription(name: "payments.getPaymentForm", parameters: [("flags", flags), ("peer", peer), ("msgId", msgId), ("themeParams", themeParams)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.payments.PaymentForm? in
let reader = BufferReader(buffer)
var result: Api.payments.PaymentForm?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.payments.PaymentForm
}
return result
})
}
public static func getPaymentReceipt(peer: Api.InputPeer, msgId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.payments.PaymentReceipt>) {
let buffer = Buffer()
buffer.appendInt32(611897804)
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "payments.getPaymentReceipt", parameters: [("peer", peer), ("msgId", msgId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.payments.PaymentReceipt? in
let reader = BufferReader(buffer)
var result: Api.payments.PaymentReceipt?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.payments.PaymentReceipt
}
return result
})
}
public static func validateRequestedInfo(flags: Int32, peer: Api.InputPeer, msgId: Int32, info: Api.PaymentRequestedInfo) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.payments.ValidatedRequestedInfo>) {
let buffer = Buffer()
buffer.appendInt32(-619695760)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
info.serialize(buffer, true)
return (FunctionDescription(name: "payments.validateRequestedInfo", parameters: [("flags", flags), ("peer", peer), ("msgId", msgId), ("info", info)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.payments.ValidatedRequestedInfo? in
let reader = BufferReader(buffer)
var result: Api.payments.ValidatedRequestedInfo?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.payments.ValidatedRequestedInfo
}
return result
})
}
public static func sendPaymentForm(flags: Int32, formId: Int64, peer: Api.InputPeer, msgId: Int32, requestedInfoId: String?, shippingOptionId: String?, credentials: Api.InputPaymentCredentials, tipAmount: Int64?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.payments.PaymentResult>) {
let buffer = Buffer()
buffer.appendInt32(818134173)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(formId, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(requestedInfoId!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {serializeString(shippingOptionId!, buffer: buffer, boxed: false)}
credentials.serialize(buffer, true)
if Int(flags) & Int(1 << 2) != 0 {serializeInt64(tipAmount!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "payments.sendPaymentForm", parameters: [("flags", flags), ("formId", formId), ("peer", peer), ("msgId", msgId), ("requestedInfoId", requestedInfoId), ("shippingOptionId", shippingOptionId), ("credentials", credentials), ("tipAmount", tipAmount)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.payments.PaymentResult? in
let reader = BufferReader(buffer)
var result: Api.payments.PaymentResult?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.payments.PaymentResult
}
return result
})
}
public static func getSavedInfo() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.payments.SavedInfo>) {
let buffer = Buffer()
buffer.appendInt32(578650699)
return (FunctionDescription(name: "payments.getSavedInfo", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.payments.SavedInfo? in
let reader = BufferReader(buffer)
var result: Api.payments.SavedInfo?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.payments.SavedInfo
}
return result
})
}
public static func clearSavedInfo(flags: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-667062079)
serializeInt32(flags, buffer: buffer, boxed: false)
return (FunctionDescription(name: "payments.clearSavedInfo", parameters: [("flags", flags)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getBankCardData(number: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.payments.BankCardData>) {
let buffer = Buffer()
buffer.appendInt32(779736953)
serializeString(number, buffer: buffer, boxed: false)
return (FunctionDescription(name: "payments.getBankCardData", parameters: [("number", number)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.payments.BankCardData? in
let reader = BufferReader(buffer)
var result: Api.payments.BankCardData?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.payments.BankCardData
}
return result
})
}
}
public struct stats {
public static func getBroadcastStats(flags: Int32, channel: Api.InputChannel) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.stats.BroadcastStats>) {
let buffer = Buffer()
buffer.appendInt32(-1421720550)
serializeInt32(flags, buffer: buffer, boxed: false)
channel.serialize(buffer, true)
return (FunctionDescription(name: "stats.getBroadcastStats", parameters: [("flags", flags), ("channel", channel)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.stats.BroadcastStats? in
let reader = BufferReader(buffer)
var result: Api.stats.BroadcastStats?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.stats.BroadcastStats
}
return result
})
}
public static func loadAsyncGraph(flags: Int32, token: String, x: Int64?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.StatsGraph>) {
let buffer = Buffer()
buffer.appendInt32(1646092192)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(token, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt64(x!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "stats.loadAsyncGraph", parameters: [("flags", flags), ("token", token), ("x", x)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.StatsGraph? in
let reader = BufferReader(buffer)
var result: Api.StatsGraph?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.StatsGraph
}
return result
})
}
public static func getMegagroupStats(flags: Int32, channel: Api.InputChannel) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.stats.MegagroupStats>) {
let buffer = Buffer()
buffer.appendInt32(-589330937)
serializeInt32(flags, buffer: buffer, boxed: false)
channel.serialize(buffer, true)
return (FunctionDescription(name: "stats.getMegagroupStats", parameters: [("flags", flags), ("channel", channel)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.stats.MegagroupStats? in
let reader = BufferReader(buffer)
var result: Api.stats.MegagroupStats?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.stats.MegagroupStats
}
return result
})
}
public static func getMessagePublicForwards(channel: Api.InputChannel, msgId: Int32, offsetRate: Int32, offsetPeer: Api.InputPeer, offsetId: Int32, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
let buffer = Buffer()
buffer.appendInt32(1445996571)
channel.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
serializeInt32(offsetRate, buffer: buffer, boxed: false)
offsetPeer.serialize(buffer, true)
serializeInt32(offsetId, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "stats.getMessagePublicForwards", parameters: [("channel", channel), ("msgId", msgId), ("offsetRate", offsetRate), ("offsetPeer", offsetPeer), ("offsetId", offsetId), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in
let reader = BufferReader(buffer)
var result: Api.messages.Messages?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Messages
}
return result
})
}
public static func getMessageStats(flags: Int32, channel: Api.InputChannel, msgId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.stats.MessageStats>) {
let buffer = Buffer()
buffer.appendInt32(-1226791947)
serializeInt32(flags, buffer: buffer, boxed: false)
channel.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "stats.getMessageStats", parameters: [("flags", flags), ("channel", channel), ("msgId", msgId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.stats.MessageStats? in
let reader = BufferReader(buffer)
var result: Api.stats.MessageStats?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.stats.MessageStats
}
return result
})
}
}
public struct auth {
public static func sendCode(phoneNumber: String, apiId: Int32, apiHash: String, settings: Api.CodeSettings) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.SentCode>) {
let buffer = Buffer()
buffer.appendInt32(-1502141361)
serializeString(phoneNumber, buffer: buffer, boxed: false)
serializeInt32(apiId, buffer: buffer, boxed: false)
serializeString(apiHash, buffer: buffer, boxed: false)
settings.serialize(buffer, true)
return (FunctionDescription(name: "auth.sendCode", parameters: [("phoneNumber", phoneNumber), ("apiId", apiId), ("apiHash", apiHash), ("settings", settings)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.SentCode? in
let reader = BufferReader(buffer)
var result: Api.auth.SentCode?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.auth.SentCode
}
return result
})
}
public static func signUp(phoneNumber: String, phoneCodeHash: String, firstName: String, lastName: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.Authorization>) {
let buffer = Buffer()
buffer.appendInt32(-2131827673)
serializeString(phoneNumber, buffer: buffer, boxed: false)
serializeString(phoneCodeHash, buffer: buffer, boxed: false)
serializeString(firstName, buffer: buffer, boxed: false)
serializeString(lastName, buffer: buffer, boxed: false)
return (FunctionDescription(name: "auth.signUp", parameters: [("phoneNumber", phoneNumber), ("phoneCodeHash", phoneCodeHash), ("firstName", firstName), ("lastName", lastName)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.Authorization? in
let reader = BufferReader(buffer)
var result: Api.auth.Authorization?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.auth.Authorization
}
return result
})
}
public static func signIn(phoneNumber: String, phoneCodeHash: String, phoneCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.Authorization>) {
let buffer = Buffer()
buffer.appendInt32(-1126886015)
serializeString(phoneNumber, buffer: buffer, boxed: false)
serializeString(phoneCodeHash, buffer: buffer, boxed: false)
serializeString(phoneCode, buffer: buffer, boxed: false)
return (FunctionDescription(name: "auth.signIn", parameters: [("phoneNumber", phoneNumber), ("phoneCodeHash", phoneCodeHash), ("phoneCode", phoneCode)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.Authorization? in
let reader = BufferReader(buffer)
var result: Api.auth.Authorization?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.auth.Authorization
}
return result
})
}
public static func logOut() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1461180992)
return (FunctionDescription(name: "auth.logOut", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func resetAuthorizations() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1616179942)
return (FunctionDescription(name: "auth.resetAuthorizations", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func exportAuthorization(dcId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.ExportedAuthorization>) {
let buffer = Buffer()
buffer.appendInt32(-440401971)
serializeInt32(dcId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "auth.exportAuthorization", parameters: [("dcId", dcId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.ExportedAuthorization? in
let reader = BufferReader(buffer)
var result: Api.auth.ExportedAuthorization?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.auth.ExportedAuthorization
}
return result
})
}
public static func importAuthorization(id: Int32, bytes: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.Authorization>) {
let buffer = Buffer()
buffer.appendInt32(-470837741)
serializeInt32(id, buffer: buffer, boxed: false)
serializeBytes(bytes, buffer: buffer, boxed: false)
return (FunctionDescription(name: "auth.importAuthorization", parameters: [("id", id), ("bytes", bytes)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.Authorization? in
let reader = BufferReader(buffer)
var result: Api.auth.Authorization?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.auth.Authorization
}
return result
})
}
public static func bindTempAuthKey(permAuthKeyId: Int64, nonce: Int64, expiresAt: Int32, encryptedMessage: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-841733627)
serializeInt64(permAuthKeyId, buffer: buffer, boxed: false)
serializeInt64(nonce, buffer: buffer, boxed: false)
serializeInt32(expiresAt, buffer: buffer, boxed: false)
serializeBytes(encryptedMessage, buffer: buffer, boxed: false)
return (FunctionDescription(name: "auth.bindTempAuthKey", parameters: [("permAuthKeyId", permAuthKeyId), ("nonce", nonce), ("expiresAt", expiresAt), ("encryptedMessage", encryptedMessage)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func importBotAuthorization(flags: Int32, apiId: Int32, apiHash: String, botAuthToken: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.Authorization>) {
let buffer = Buffer()
buffer.appendInt32(1738800940)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(apiId, buffer: buffer, boxed: false)
serializeString(apiHash, buffer: buffer, boxed: false)
serializeString(botAuthToken, buffer: buffer, boxed: false)
return (FunctionDescription(name: "auth.importBotAuthorization", parameters: [("flags", flags), ("apiId", apiId), ("apiHash", apiHash), ("botAuthToken", botAuthToken)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.Authorization? in
let reader = BufferReader(buffer)
var result: Api.auth.Authorization?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.auth.Authorization
}
return result
})
}
public static func checkPassword(password: Api.InputCheckPasswordSRP) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.Authorization>) {
let buffer = Buffer()
buffer.appendInt32(-779399914)
password.serialize(buffer, true)
return (FunctionDescription(name: "auth.checkPassword", parameters: [("password", password)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.Authorization? in
let reader = BufferReader(buffer)
var result: Api.auth.Authorization?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.auth.Authorization
}
return result
})
}
public static func requestPasswordRecovery() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.PasswordRecovery>) {
let buffer = Buffer()
buffer.appendInt32(-661144474)
return (FunctionDescription(name: "auth.requestPasswordRecovery", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.PasswordRecovery? in
let reader = BufferReader(buffer)
var result: Api.auth.PasswordRecovery?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.auth.PasswordRecovery
}
return result
})
}
public static func recoverPassword(flags: Int32, code: String, newSettings: Api.account.PasswordInputSettings?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.Authorization>) {
let buffer = Buffer()
buffer.appendInt32(923364464)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(code, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {newSettings!.serialize(buffer, true)}
return (FunctionDescription(name: "auth.recoverPassword", parameters: [("flags", flags), ("code", code), ("newSettings", newSettings)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.Authorization? in
let reader = BufferReader(buffer)
var result: Api.auth.Authorization?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.auth.Authorization
}
return result
})
}
public static func resendCode(phoneNumber: String, phoneCodeHash: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.SentCode>) {
let buffer = Buffer()
buffer.appendInt32(1056025023)
serializeString(phoneNumber, buffer: buffer, boxed: false)
serializeString(phoneCodeHash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "auth.resendCode", parameters: [("phoneNumber", phoneNumber), ("phoneCodeHash", phoneCodeHash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.SentCode? in
let reader = BufferReader(buffer)
var result: Api.auth.SentCode?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.auth.SentCode
}
return result
})
}
public static func cancelCode(phoneNumber: String, phoneCodeHash: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(520357240)
serializeString(phoneNumber, buffer: buffer, boxed: false)
serializeString(phoneCodeHash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "auth.cancelCode", parameters: [("phoneNumber", phoneNumber), ("phoneCodeHash", phoneCodeHash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func dropTempAuthKeys(exceptAuthKeys: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1907842680)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(exceptAuthKeys.count))
for item in exceptAuthKeys {
serializeInt64(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "auth.dropTempAuthKeys", parameters: [("exceptAuthKeys", exceptAuthKeys)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func exportLoginToken(apiId: Int32, apiHash: String, exceptIds: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.LoginToken>) {
let buffer = Buffer()
buffer.appendInt32(-1313598185)
serializeInt32(apiId, buffer: buffer, boxed: false)
serializeString(apiHash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(exceptIds.count))
for item in exceptIds {
serializeInt32(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "auth.exportLoginToken", parameters: [("apiId", apiId), ("apiHash", apiHash), ("exceptIds", exceptIds)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.LoginToken? in
let reader = BufferReader(buffer)
var result: Api.auth.LoginToken?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.auth.LoginToken
}
return result
})
}
public static func importLoginToken(token: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.LoginToken>) {
let buffer = Buffer()
buffer.appendInt32(-1783866140)
serializeBytes(token, buffer: buffer, boxed: false)
return (FunctionDescription(name: "auth.importLoginToken", parameters: [("token", token)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.LoginToken? in
let reader = BufferReader(buffer)
var result: Api.auth.LoginToken?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.auth.LoginToken
}
return result
})
}
public static func acceptLoginToken(token: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Authorization>) {
let buffer = Buffer()
buffer.appendInt32(-392909491)
serializeBytes(token, buffer: buffer, boxed: false)
return (FunctionDescription(name: "auth.acceptLoginToken", parameters: [("token", token)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Authorization? in
let reader = BufferReader(buffer)
var result: Api.Authorization?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Authorization
}
return result
})
}
public static func checkRecoveryPassword(code: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(221691769)
serializeString(code, buffer: buffer, boxed: false)
return (FunctionDescription(name: "auth.checkRecoveryPassword", parameters: [("code", code)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
}
public struct bots {
public static func sendCustomRequest(customMethod: String, params: Api.DataJSON) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.DataJSON>) {
let buffer = Buffer()
buffer.appendInt32(-1440257555)
serializeString(customMethod, buffer: buffer, boxed: false)
params.serialize(buffer, true)
return (FunctionDescription(name: "bots.sendCustomRequest", parameters: [("customMethod", customMethod), ("params", params)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.DataJSON? in
let reader = BufferReader(buffer)
var result: Api.DataJSON?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.DataJSON
}
return result
})
}
public static func answerWebhookJSONQuery(queryId: Int64, data: Api.DataJSON) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-434028723)
serializeInt64(queryId, buffer: buffer, boxed: false)
data.serialize(buffer, true)
return (FunctionDescription(name: "bots.answerWebhookJSONQuery", parameters: [("queryId", queryId), ("data", data)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func setBotCommands(scope: Api.BotCommandScope, langCode: String, commands: [Api.BotCommand]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(85399130)
scope.serialize(buffer, true)
serializeString(langCode, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(commands.count))
for item in commands {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "bots.setBotCommands", parameters: [("scope", scope), ("langCode", langCode), ("commands", commands)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func resetBotCommands(scope: Api.BotCommandScope, langCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1032708345)
scope.serialize(buffer, true)
serializeString(langCode, buffer: buffer, boxed: false)
return (FunctionDescription(name: "bots.resetBotCommands", parameters: [("scope", scope), ("langCode", langCode)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getBotCommands(scope: Api.BotCommandScope, langCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.BotCommand]>) {
let buffer = Buffer()
buffer.appendInt32(-481554986)
scope.serialize(buffer, true)
serializeString(langCode, buffer: buffer, boxed: false)
return (FunctionDescription(name: "bots.getBotCommands", parameters: [("scope", scope), ("langCode", langCode)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.BotCommand]? in
let reader = BufferReader(buffer)
var result: [Api.BotCommand]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.BotCommand.self)
}
return result
})
}
}
public struct users {
public static func getUsers(id: [Api.InputUser]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.User]>) {
let buffer = Buffer()
buffer.appendInt32(227648840)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count))
for item in id {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "users.getUsers", parameters: [("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.User]? in
let reader = BufferReader(buffer)
var result: [Api.User]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
return result
})
}
public static func getFullUser(id: Api.InputUser) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.UserFull>) {
let buffer = Buffer()
buffer.appendInt32(-902781519)
id.serialize(buffer, true)
return (FunctionDescription(name: "users.getFullUser", parameters: [("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.UserFull? in
let reader = BufferReader(buffer)
var result: Api.UserFull?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.UserFull
}
return result
})
}
public static func setSecureValueErrors(id: Api.InputUser, errors: [Api.SecureValueError]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1865902923)
id.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(errors.count))
for item in errors {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "users.setSecureValueErrors", parameters: [("id", id), ("errors", errors)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
}
public struct contacts {
public static func getContactIDs(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Int32]>) {
let buffer = Buffer()
buffer.appendInt32(749357634)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "contacts.getContactIDs", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Int32]? in
let reader = BufferReader(buffer)
var result: [Int32]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
}
return result
})
}
public static func getStatuses() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.ContactStatus]>) {
let buffer = Buffer()
buffer.appendInt32(-995929106)
return (FunctionDescription(name: "contacts.getStatuses", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.ContactStatus]? in
let reader = BufferReader(buffer)
var result: [Api.ContactStatus]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.ContactStatus.self)
}
return result
})
}
public static func getContacts(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.contacts.Contacts>) {
let buffer = Buffer()
buffer.appendInt32(-1071414113)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "contacts.getContacts", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.contacts.Contacts? in
let reader = BufferReader(buffer)
var result: Api.contacts.Contacts?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.contacts.Contacts
}
return result
})
}
public static func importContacts(contacts: [Api.InputContact]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.contacts.ImportedContacts>) {
let buffer = Buffer()
buffer.appendInt32(746589157)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(contacts.count))
for item in contacts {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "contacts.importContacts", parameters: [("contacts", contacts)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.contacts.ImportedContacts? in
let reader = BufferReader(buffer)
var result: Api.contacts.ImportedContacts?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.contacts.ImportedContacts
}
return result
})
}
public static func deleteContacts(id: [Api.InputUser]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(157945344)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count))
for item in id {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "contacts.deleteContacts", parameters: [("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func deleteByPhones(phones: [String]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(269745566)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(phones.count))
for item in phones {
serializeString(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "contacts.deleteByPhones", parameters: [("phones", phones)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func block(id: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1758204945)
id.serialize(buffer, true)
return (FunctionDescription(name: "contacts.block", parameters: [("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func unblock(id: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1096393392)
id.serialize(buffer, true)
return (FunctionDescription(name: "contacts.unblock", parameters: [("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getBlocked(offset: Int32, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.contacts.Blocked>) {
let buffer = Buffer()
buffer.appendInt32(-176409329)
serializeInt32(offset, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "contacts.getBlocked", parameters: [("offset", offset), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.contacts.Blocked? in
let reader = BufferReader(buffer)
var result: Api.contacts.Blocked?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.contacts.Blocked
}
return result
})
}
public static func search(q: String, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.contacts.Found>) {
let buffer = Buffer()
buffer.appendInt32(301470424)
serializeString(q, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "contacts.search", parameters: [("q", q), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.contacts.Found? in
let reader = BufferReader(buffer)
var result: Api.contacts.Found?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.contacts.Found
}
return result
})
}
public static func resolveUsername(username: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.contacts.ResolvedPeer>) {
let buffer = Buffer()
buffer.appendInt32(-113456221)
serializeString(username, buffer: buffer, boxed: false)
return (FunctionDescription(name: "contacts.resolveUsername", parameters: [("username", username)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.contacts.ResolvedPeer? in
let reader = BufferReader(buffer)
var result: Api.contacts.ResolvedPeer?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.contacts.ResolvedPeer
}
return result
})
}
public static func getTopPeers(flags: Int32, offset: Int32, limit: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.contacts.TopPeers>) {
let buffer = Buffer()
buffer.appendInt32(-728224331)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(offset, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "contacts.getTopPeers", parameters: [("flags", flags), ("offset", offset), ("limit", limit), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.contacts.TopPeers? in
let reader = BufferReader(buffer)
var result: Api.contacts.TopPeers?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.contacts.TopPeers
}
return result
})
}
public static func resetTopPeerRating(category: Api.TopPeerCategory, peer: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(451113900)
category.serialize(buffer, true)
peer.serialize(buffer, true)
return (FunctionDescription(name: "contacts.resetTopPeerRating", parameters: [("category", category), ("peer", peer)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func resetSaved() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-2020263951)
return (FunctionDescription(name: "contacts.resetSaved", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getSaved() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.SavedContact]>) {
let buffer = Buffer()
buffer.appendInt32(-2098076769)
return (FunctionDescription(name: "contacts.getSaved", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.SavedContact]? in
let reader = BufferReader(buffer)
var result: [Api.SavedContact]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.SavedContact.self)
}
return result
})
}
public static func toggleTopPeers(enabled: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-2062238246)
enabled.serialize(buffer, true)
return (FunctionDescription(name: "contacts.toggleTopPeers", parameters: [("enabled", enabled)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func addContact(flags: Int32, id: Api.InputUser, firstName: String, lastName: String, phone: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-386636848)
serializeInt32(flags, buffer: buffer, boxed: false)
id.serialize(buffer, true)
serializeString(firstName, buffer: buffer, boxed: false)
serializeString(lastName, buffer: buffer, boxed: false)
serializeString(phone, buffer: buffer, boxed: false)
return (FunctionDescription(name: "contacts.addContact", parameters: [("flags", flags), ("id", id), ("firstName", firstName), ("lastName", lastName), ("phone", phone)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func acceptContact(id: Api.InputUser) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-130964977)
id.serialize(buffer, true)
return (FunctionDescription(name: "contacts.acceptContact", parameters: [("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func getLocated(flags: Int32, geoPoint: Api.InputGeoPoint, selfExpires: Int32?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-750207932)
serializeInt32(flags, buffer: buffer, boxed: false)
geoPoint.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(selfExpires!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "contacts.getLocated", parameters: [("flags", flags), ("geoPoint", geoPoint), ("selfExpires", selfExpires)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func blockFromReplies(flags: Int32, msgId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(698914348)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(msgId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "contacts.blockFromReplies", parameters: [("flags", flags), ("msgId", msgId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
}
public struct help {
public static func test() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1058929929)
return (FunctionDescription(name: "help.test", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getConfig() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Config>) {
let buffer = Buffer()
buffer.appendInt32(-990308245)
return (FunctionDescription(name: "help.getConfig", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Config? in
let reader = BufferReader(buffer)
var result: Api.Config?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Config
}
return result
})
}
public static func getNearestDc() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.NearestDc>) {
let buffer = Buffer()
buffer.appendInt32(531836966)
return (FunctionDescription(name: "help.getNearestDc", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.NearestDc? in
let reader = BufferReader(buffer)
var result: Api.NearestDc?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.NearestDc
}
return result
})
}
public static func getAppUpdate(source: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.help.AppUpdate>) {
let buffer = Buffer()
buffer.appendInt32(1378703997)
serializeString(source, buffer: buffer, boxed: false)
return (FunctionDescription(name: "help.getAppUpdate", parameters: [("source", source)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.AppUpdate? in
let reader = BufferReader(buffer)
var result: Api.help.AppUpdate?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.help.AppUpdate
}
return result
})
}
public static func getInviteText() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.help.InviteText>) {
let buffer = Buffer()
buffer.appendInt32(1295590211)
return (FunctionDescription(name: "help.getInviteText", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.InviteText? in
let reader = BufferReader(buffer)
var result: Api.help.InviteText?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.help.InviteText
}
return result
})
}
public static func getSupport() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.help.Support>) {
let buffer = Buffer()
buffer.appendInt32(-1663104819)
return (FunctionDescription(name: "help.getSupport", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.Support? in
let reader = BufferReader(buffer)
var result: Api.help.Support?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.help.Support
}
return result
})
}
public static func getAppChangelog(prevAppVersion: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-1877938321)
serializeString(prevAppVersion, buffer: buffer, boxed: false)
return (FunctionDescription(name: "help.getAppChangelog", parameters: [("prevAppVersion", prevAppVersion)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func setBotUpdatesStatus(pendingUpdatesCount: Int32, message: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-333262899)
serializeInt32(pendingUpdatesCount, buffer: buffer, boxed: false)
serializeString(message, buffer: buffer, boxed: false)
return (FunctionDescription(name: "help.setBotUpdatesStatus", parameters: [("pendingUpdatesCount", pendingUpdatesCount), ("message", message)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getCdnConfig() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.CdnConfig>) {
let buffer = Buffer()
buffer.appendInt32(1375900482)
return (FunctionDescription(name: "help.getCdnConfig", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.CdnConfig? in
let reader = BufferReader(buffer)
var result: Api.CdnConfig?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.CdnConfig
}
return result
})
}
public static func getRecentMeUrls(referer: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.help.RecentMeUrls>) {
let buffer = Buffer()
buffer.appendInt32(1036054804)
serializeString(referer, buffer: buffer, boxed: false)
return (FunctionDescription(name: "help.getRecentMeUrls", parameters: [("referer", referer)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.RecentMeUrls? in
let reader = BufferReader(buffer)
var result: Api.help.RecentMeUrls?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.help.RecentMeUrls
}
return result
})
}
public static func getTermsOfServiceUpdate() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.help.TermsOfServiceUpdate>) {
let buffer = Buffer()
buffer.appendInt32(749019089)
return (FunctionDescription(name: "help.getTermsOfServiceUpdate", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.TermsOfServiceUpdate? in
let reader = BufferReader(buffer)
var result: Api.help.TermsOfServiceUpdate?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.help.TermsOfServiceUpdate
}
return result
})
}
public static func acceptTermsOfService(id: Api.DataJSON) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-294455398)
id.serialize(buffer, true)
return (FunctionDescription(name: "help.acceptTermsOfService", parameters: [("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getDeepLinkInfo(path: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.help.DeepLinkInfo>) {
let buffer = Buffer()
buffer.appendInt32(1072547679)
serializeString(path, buffer: buffer, boxed: false)
return (FunctionDescription(name: "help.getDeepLinkInfo", parameters: [("path", path)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.DeepLinkInfo? in
let reader = BufferReader(buffer)
var result: Api.help.DeepLinkInfo?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.help.DeepLinkInfo
}
return result
})
}
public static func getAppConfig() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.JSONValue>) {
let buffer = Buffer()
buffer.appendInt32(-1735311088)
return (FunctionDescription(name: "help.getAppConfig", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.JSONValue? in
let reader = BufferReader(buffer)
var result: Api.JSONValue?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.JSONValue
}
return result
})
}
public static func saveAppLog(events: [Api.InputAppEvent]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1862465352)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(events.count))
for item in events {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "help.saveAppLog", parameters: [("events", events)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getPassportConfig(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.help.PassportConfig>) {
let buffer = Buffer()
buffer.appendInt32(-966677240)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "help.getPassportConfig", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.PassportConfig? in
let reader = BufferReader(buffer)
var result: Api.help.PassportConfig?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.help.PassportConfig
}
return result
})
}
public static func getSupportName() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.help.SupportName>) {
let buffer = Buffer()
buffer.appendInt32(-748624084)
return (FunctionDescription(name: "help.getSupportName", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.SupportName? in
let reader = BufferReader(buffer)
var result: Api.help.SupportName?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.help.SupportName
}
return result
})
}
public static func getUserInfo(userId: Api.InputUser) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.help.UserInfo>) {
let buffer = Buffer()
buffer.appendInt32(59377875)
userId.serialize(buffer, true)
return (FunctionDescription(name: "help.getUserInfo", parameters: [("userId", userId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.UserInfo? in
let reader = BufferReader(buffer)
var result: Api.help.UserInfo?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.help.UserInfo
}
return result
})
}
public static func editUserInfo(userId: Api.InputUser, message: String, entities: [Api.MessageEntity]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.help.UserInfo>) {
let buffer = Buffer()
buffer.appendInt32(1723407216)
userId.serialize(buffer, true)
serializeString(message, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(entities.count))
for item in entities {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "help.editUserInfo", parameters: [("userId", userId), ("message", message), ("entities", entities)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.UserInfo? in
let reader = BufferReader(buffer)
var result: Api.help.UserInfo?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.help.UserInfo
}
return result
})
}
public static func getPromoData() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.help.PromoData>) {
let buffer = Buffer()
buffer.appendInt32(-1063816159)
return (FunctionDescription(name: "help.getPromoData", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.PromoData? in
let reader = BufferReader(buffer)
var result: Api.help.PromoData?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.help.PromoData
}
return result
})
}
public static func hidePromoData(peer: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(505748629)
peer.serialize(buffer, true)
return (FunctionDescription(name: "help.hidePromoData", parameters: [("peer", peer)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func dismissSuggestion(peer: Api.InputPeer, suggestion: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-183649631)
peer.serialize(buffer, true)
serializeString(suggestion, buffer: buffer, boxed: false)
return (FunctionDescription(name: "help.dismissSuggestion", parameters: [("peer", peer), ("suggestion", suggestion)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getCountriesList(langCode: String, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.help.CountriesList>) {
let buffer = Buffer()
buffer.appendInt32(1935116200)
serializeString(langCode, buffer: buffer, boxed: false)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "help.getCountriesList", parameters: [("langCode", langCode), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.CountriesList? in
let reader = BufferReader(buffer)
var result: Api.help.CountriesList?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.help.CountriesList
}
return result
})
}
}
public struct updates {
public static func getState() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.updates.State>) {
let buffer = Buffer()
buffer.appendInt32(-304838614)
return (FunctionDescription(name: "updates.getState", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.updates.State? in
let reader = BufferReader(buffer)
var result: Api.updates.State?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.updates.State
}
return result
})
}
public static func getDifference(flags: Int32, pts: Int32, ptsTotalLimit: Int32?, date: Int32, qts: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.updates.Difference>) {
let buffer = Buffer()
buffer.appendInt32(630429265)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(pts, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(ptsTotalLimit!, buffer: buffer, boxed: false)}
serializeInt32(date, buffer: buffer, boxed: false)
serializeInt32(qts, buffer: buffer, boxed: false)
return (FunctionDescription(name: "updates.getDifference", parameters: [("flags", flags), ("pts", pts), ("ptsTotalLimit", ptsTotalLimit), ("date", date), ("qts", qts)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.updates.Difference? in
let reader = BufferReader(buffer)
var result: Api.updates.Difference?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.updates.Difference
}
return result
})
}
public static func getChannelDifference(flags: Int32, channel: Api.InputChannel, filter: Api.ChannelMessagesFilter, pts: Int32, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.updates.ChannelDifference>) {
let buffer = Buffer()
buffer.appendInt32(51854712)
serializeInt32(flags, buffer: buffer, boxed: false)
channel.serialize(buffer, true)
filter.serialize(buffer, true)
serializeInt32(pts, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "updates.getChannelDifference", parameters: [("flags", flags), ("channel", channel), ("filter", filter), ("pts", pts), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.updates.ChannelDifference? in
let reader = BufferReader(buffer)
var result: Api.updates.ChannelDifference?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.updates.ChannelDifference
}
return result
})
}
}
public struct folders {
public static func editPeerFolders(folderPeers: [Api.InputFolderPeer]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(1749536939)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(folderPeers.count))
for item in folderPeers {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "folders.editPeerFolders", parameters: [("folderPeers", folderPeers)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func deleteFolder(folderId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(472471681)
serializeInt32(folderId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "folders.deleteFolder", parameters: [("folderId", folderId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
}
public struct upload {
public static func saveFilePart(fileId: Int64, filePart: Int32, bytes: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1291540959)
serializeInt64(fileId, buffer: buffer, boxed: false)
serializeInt32(filePart, buffer: buffer, boxed: false)
serializeBytes(bytes, buffer: buffer, boxed: false)
return (FunctionDescription(name: "upload.saveFilePart", parameters: [("fileId", fileId), ("filePart", filePart), ("bytes", bytes)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getFile(flags: Int32, location: Api.InputFileLocation, offset: Int32, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.upload.File>) {
let buffer = Buffer()
buffer.appendInt32(-1319462148)
serializeInt32(flags, buffer: buffer, boxed: false)
location.serialize(buffer, true)
serializeInt32(offset, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "upload.getFile", parameters: [("flags", flags), ("location", location), ("offset", offset), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.upload.File? in
let reader = BufferReader(buffer)
var result: Api.upload.File?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.upload.File
}
return result
})
}
public static func saveBigFilePart(fileId: Int64, filePart: Int32, fileTotalParts: Int32, bytes: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-562337987)
serializeInt64(fileId, buffer: buffer, boxed: false)
serializeInt32(filePart, buffer: buffer, boxed: false)
serializeInt32(fileTotalParts, buffer: buffer, boxed: false)
serializeBytes(bytes, buffer: buffer, boxed: false)
return (FunctionDescription(name: "upload.saveBigFilePart", parameters: [("fileId", fileId), ("filePart", filePart), ("fileTotalParts", fileTotalParts), ("bytes", bytes)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getWebFile(location: Api.InputWebFileLocation, offset: Int32, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.upload.WebFile>) {
let buffer = Buffer()
buffer.appendInt32(619086221)
location.serialize(buffer, true)
serializeInt32(offset, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "upload.getWebFile", parameters: [("location", location), ("offset", offset), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.upload.WebFile? in
let reader = BufferReader(buffer)
var result: Api.upload.WebFile?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.upload.WebFile
}
return result
})
}
public static func getCdnFile(fileToken: Buffer, offset: Int32, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.upload.CdnFile>) {
let buffer = Buffer()
buffer.appendInt32(536919235)
serializeBytes(fileToken, buffer: buffer, boxed: false)
serializeInt32(offset, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "upload.getCdnFile", parameters: [("fileToken", fileToken), ("offset", offset), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.upload.CdnFile? in
let reader = BufferReader(buffer)
var result: Api.upload.CdnFile?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.upload.CdnFile
}
return result
})
}
public static func reuploadCdnFile(fileToken: Buffer, requestToken: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.FileHash]>) {
let buffer = Buffer()
buffer.appendInt32(-1691921240)
serializeBytes(fileToken, buffer: buffer, boxed: false)
serializeBytes(requestToken, buffer: buffer, boxed: false)
return (FunctionDescription(name: "upload.reuploadCdnFile", parameters: [("fileToken", fileToken), ("requestToken", requestToken)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.FileHash]? in
let reader = BufferReader(buffer)
var result: [Api.FileHash]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.FileHash.self)
}
return result
})
}
public static func getCdnFileHashes(fileToken: Buffer, offset: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.FileHash]>) {
let buffer = Buffer()
buffer.appendInt32(1302676017)
serializeBytes(fileToken, buffer: buffer, boxed: false)
serializeInt32(offset, buffer: buffer, boxed: false)
return (FunctionDescription(name: "upload.getCdnFileHashes", parameters: [("fileToken", fileToken), ("offset", offset)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.FileHash]? in
let reader = BufferReader(buffer)
var result: [Api.FileHash]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.FileHash.self)
}
return result
})
}
public static func getFileHashes(location: Api.InputFileLocation, offset: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.FileHash]>) {
let buffer = Buffer()
buffer.appendInt32(-956147407)
location.serialize(buffer, true)
serializeInt32(offset, buffer: buffer, boxed: false)
return (FunctionDescription(name: "upload.getFileHashes", parameters: [("location", location), ("offset", offset)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.FileHash]? in
let reader = BufferReader(buffer)
var result: [Api.FileHash]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.FileHash.self)
}
return result
})
}
}
public struct stickers {
public static func createStickerSet(flags: Int32, userId: Api.InputUser, title: String, shortName: String, thumb: Api.InputDocument?, stickers: [Api.InputStickerSetItem], software: String?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.StickerSet>) {
let buffer = Buffer()
buffer.appendInt32(-1876841625)
serializeInt32(flags, buffer: buffer, boxed: false)
userId.serialize(buffer, true)
serializeString(title, buffer: buffer, boxed: false)
serializeString(shortName, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {thumb!.serialize(buffer, true)}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(stickers.count))
for item in stickers {
item.serialize(buffer, true)
}
if Int(flags) & Int(1 << 3) != 0 {serializeString(software!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "stickers.createStickerSet", parameters: [("flags", flags), ("userId", userId), ("title", title), ("shortName", shortName), ("thumb", thumb), ("stickers", stickers), ("software", software)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.StickerSet? in
let reader = BufferReader(buffer)
var result: Api.messages.StickerSet?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.StickerSet
}
return result
})
}
public static func removeStickerFromSet(sticker: Api.InputDocument) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.StickerSet>) {
let buffer = Buffer()
buffer.appendInt32(-143257775)
sticker.serialize(buffer, true)
return (FunctionDescription(name: "stickers.removeStickerFromSet", parameters: [("sticker", sticker)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.StickerSet? in
let reader = BufferReader(buffer)
var result: Api.messages.StickerSet?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.StickerSet
}
return result
})
}
public static func changeStickerPosition(sticker: Api.InputDocument, position: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.StickerSet>) {
let buffer = Buffer()
buffer.appendInt32(-4795190)
sticker.serialize(buffer, true)
serializeInt32(position, buffer: buffer, boxed: false)
return (FunctionDescription(name: "stickers.changeStickerPosition", parameters: [("sticker", sticker), ("position", position)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.StickerSet? in
let reader = BufferReader(buffer)
var result: Api.messages.StickerSet?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.StickerSet
}
return result
})
}
public static func addStickerToSet(stickerset: Api.InputStickerSet, sticker: Api.InputStickerSetItem) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.StickerSet>) {
let buffer = Buffer()
buffer.appendInt32(-2041315650)
stickerset.serialize(buffer, true)
sticker.serialize(buffer, true)
return (FunctionDescription(name: "stickers.addStickerToSet", parameters: [("stickerset", stickerset), ("sticker", sticker)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.StickerSet? in
let reader = BufferReader(buffer)
var result: Api.messages.StickerSet?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.StickerSet
}
return result
})
}
public static func setStickerSetThumb(stickerset: Api.InputStickerSet, thumb: Api.InputDocument) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.StickerSet>) {
let buffer = Buffer()
buffer.appendInt32(-1707717072)
stickerset.serialize(buffer, true)
thumb.serialize(buffer, true)
return (FunctionDescription(name: "stickers.setStickerSetThumb", parameters: [("stickerset", stickerset), ("thumb", thumb)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.StickerSet? in
let reader = BufferReader(buffer)
var result: Api.messages.StickerSet?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.StickerSet
}
return result
})
}
public static func checkShortName(shortName: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(676017721)
serializeString(shortName, buffer: buffer, boxed: false)
return (FunctionDescription(name: "stickers.checkShortName", parameters: [("shortName", shortName)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func suggestShortName(title: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.stickers.SuggestedShortName>) {
let buffer = Buffer()
buffer.appendInt32(1303364867)
serializeString(title, buffer: buffer, boxed: false)
return (FunctionDescription(name: "stickers.suggestShortName", parameters: [("title", title)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.stickers.SuggestedShortName? in
let reader = BufferReader(buffer)
var result: Api.stickers.SuggestedShortName?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.stickers.SuggestedShortName
}
return result
})
}
}
public struct account {
public static func registerDevice(flags: Int32, tokenType: Int32, token: String, appSandbox: Api.Bool, secret: Buffer, otherUids: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1754754159)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(tokenType, buffer: buffer, boxed: false)
serializeString(token, buffer: buffer, boxed: false)
appSandbox.serialize(buffer, true)
serializeBytes(secret, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(otherUids.count))
for item in otherUids {
serializeInt32(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "account.registerDevice", parameters: [("flags", flags), ("tokenType", tokenType), ("token", token), ("appSandbox", appSandbox), ("secret", secret), ("otherUids", otherUids)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func unregisterDevice(tokenType: Int32, token: String, otherUids: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(813089983)
serializeInt32(tokenType, buffer: buffer, boxed: false)
serializeString(token, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(otherUids.count))
for item in otherUids {
serializeInt32(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "account.unregisterDevice", parameters: [("tokenType", tokenType), ("token", token), ("otherUids", otherUids)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func updateNotifySettings(peer: Api.InputNotifyPeer, settings: Api.InputPeerNotifySettings) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-2067899501)
peer.serialize(buffer, true)
settings.serialize(buffer, true)
return (FunctionDescription(name: "account.updateNotifySettings", parameters: [("peer", peer), ("settings", settings)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getNotifySettings(peer: Api.InputNotifyPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.PeerNotifySettings>) {
let buffer = Buffer()
buffer.appendInt32(313765169)
peer.serialize(buffer, true)
return (FunctionDescription(name: "account.getNotifySettings", parameters: [("peer", peer)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.PeerNotifySettings? in
let reader = BufferReader(buffer)
var result: Api.PeerNotifySettings?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.PeerNotifySettings
}
return result
})
}
public static func resetNotifySettings() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-612493497)
return (FunctionDescription(name: "account.resetNotifySettings", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func updateProfile(flags: Int32, firstName: String?, lastName: String?, about: String?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.User>) {
let buffer = Buffer()
buffer.appendInt32(2018596725)
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(firstName!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {serializeString(lastName!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {serializeString(about!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "account.updateProfile", parameters: [("flags", flags), ("firstName", firstName), ("lastName", lastName), ("about", about)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.User? in
let reader = BufferReader(buffer)
var result: Api.User?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.User
}
return result
})
}
public static func updateStatus(offline: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1713919532)
offline.serialize(buffer, true)
return (FunctionDescription(name: "account.updateStatus", parameters: [("offline", offline)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getWallPapers(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.WallPapers>) {
let buffer = Buffer()
buffer.appendInt32(-1430579357)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.getWallPapers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.WallPapers? in
let reader = BufferReader(buffer)
var result: Api.account.WallPapers?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.account.WallPapers
}
return result
})
}
public static func reportPeer(peer: Api.InputPeer, reason: Api.ReportReason, message: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-977650298)
peer.serialize(buffer, true)
reason.serialize(buffer, true)
serializeString(message, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.reportPeer", parameters: [("peer", peer), ("reason", reason), ("message", message)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func checkUsername(username: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(655677548)
serializeString(username, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.checkUsername", parameters: [("username", username)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func updateUsername(username: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.User>) {
let buffer = Buffer()
buffer.appendInt32(1040964988)
serializeString(username, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.updateUsername", parameters: [("username", username)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.User? in
let reader = BufferReader(buffer)
var result: Api.User?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.User
}
return result
})
}
public static func getPrivacy(key: Api.InputPrivacyKey) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.PrivacyRules>) {
let buffer = Buffer()
buffer.appendInt32(-623130288)
key.serialize(buffer, true)
return (FunctionDescription(name: "account.getPrivacy", parameters: [("key", key)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.PrivacyRules? in
let reader = BufferReader(buffer)
var result: Api.account.PrivacyRules?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.account.PrivacyRules
}
return result
})
}
public static func setPrivacy(key: Api.InputPrivacyKey, rules: [Api.InputPrivacyRule]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.PrivacyRules>) {
let buffer = Buffer()
buffer.appendInt32(-906486552)
key.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(rules.count))
for item in rules {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "account.setPrivacy", parameters: [("key", key), ("rules", rules)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.PrivacyRules? in
let reader = BufferReader(buffer)
var result: Api.account.PrivacyRules?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.account.PrivacyRules
}
return result
})
}
public static func deleteAccount(reason: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1099779595)
serializeString(reason, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.deleteAccount", parameters: [("reason", reason)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getAccountTTL() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.AccountDaysTTL>) {
let buffer = Buffer()
buffer.appendInt32(150761757)
return (FunctionDescription(name: "account.getAccountTTL", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.AccountDaysTTL? in
let reader = BufferReader(buffer)
var result: Api.AccountDaysTTL?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.AccountDaysTTL
}
return result
})
}
public static func setAccountTTL(ttl: Api.AccountDaysTTL) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(608323678)
ttl.serialize(buffer, true)
return (FunctionDescription(name: "account.setAccountTTL", parameters: [("ttl", ttl)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func sendChangePhoneCode(phoneNumber: String, settings: Api.CodeSettings) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.SentCode>) {
let buffer = Buffer()
buffer.appendInt32(-2108208411)
serializeString(phoneNumber, buffer: buffer, boxed: false)
settings.serialize(buffer, true)
return (FunctionDescription(name: "account.sendChangePhoneCode", parameters: [("phoneNumber", phoneNumber), ("settings", settings)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.SentCode? in
let reader = BufferReader(buffer)
var result: Api.auth.SentCode?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.auth.SentCode
}
return result
})
}
public static func changePhone(phoneNumber: String, phoneCodeHash: String, phoneCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.User>) {
let buffer = Buffer()
buffer.appendInt32(1891839707)
serializeString(phoneNumber, buffer: buffer, boxed: false)
serializeString(phoneCodeHash, buffer: buffer, boxed: false)
serializeString(phoneCode, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.changePhone", parameters: [("phoneNumber", phoneNumber), ("phoneCodeHash", phoneCodeHash), ("phoneCode", phoneCode)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.User? in
let reader = BufferReader(buffer)
var result: Api.User?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.User
}
return result
})
}
public static func updateDeviceLocked(period: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(954152242)
serializeInt32(period, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.updateDeviceLocked", parameters: [("period", period)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getAuthorizations() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.Authorizations>) {
let buffer = Buffer()
buffer.appendInt32(-484392616)
return (FunctionDescription(name: "account.getAuthorizations", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.Authorizations? in
let reader = BufferReader(buffer)
var result: Api.account.Authorizations?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.account.Authorizations
}
return result
})
}
public static func resetAuthorization(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-545786948)
serializeInt64(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.resetAuthorization", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getPassword() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.Password>) {
let buffer = Buffer()
buffer.appendInt32(1418342645)
return (FunctionDescription(name: "account.getPassword", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.Password? in
let reader = BufferReader(buffer)
var result: Api.account.Password?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.account.Password
}
return result
})
}
public static func getPasswordSettings(password: Api.InputCheckPasswordSRP) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.PasswordSettings>) {
let buffer = Buffer()
buffer.appendInt32(-1663767815)
password.serialize(buffer, true)
return (FunctionDescription(name: "account.getPasswordSettings", parameters: [("password", password)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.PasswordSettings? in
let reader = BufferReader(buffer)
var result: Api.account.PasswordSettings?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.account.PasswordSettings
}
return result
})
}
public static func updatePasswordSettings(password: Api.InputCheckPasswordSRP, newSettings: Api.account.PasswordInputSettings) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1516564433)
password.serialize(buffer, true)
newSettings.serialize(buffer, true)
return (FunctionDescription(name: "account.updatePasswordSettings", parameters: [("password", password), ("newSettings", newSettings)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func sendConfirmPhoneCode(hash: String, settings: Api.CodeSettings) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.SentCode>) {
let buffer = Buffer()
buffer.appendInt32(457157256)
serializeString(hash, buffer: buffer, boxed: false)
settings.serialize(buffer, true)
return (FunctionDescription(name: "account.sendConfirmPhoneCode", parameters: [("hash", hash), ("settings", settings)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.SentCode? in
let reader = BufferReader(buffer)
var result: Api.auth.SentCode?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.auth.SentCode
}
return result
})
}
public static func confirmPhone(phoneCodeHash: String, phoneCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1596029123)
serializeString(phoneCodeHash, buffer: buffer, boxed: false)
serializeString(phoneCode, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.confirmPhone", parameters: [("phoneCodeHash", phoneCodeHash), ("phoneCode", phoneCode)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getTmpPassword(password: Api.InputCheckPasswordSRP, period: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.TmpPassword>) {
let buffer = Buffer()
buffer.appendInt32(1151208273)
password.serialize(buffer, true)
serializeInt32(period, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.getTmpPassword", parameters: [("password", password), ("period", period)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.TmpPassword? in
let reader = BufferReader(buffer)
var result: Api.account.TmpPassword?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.account.TmpPassword
}
return result
})
}
public static func getWebAuthorizations() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.WebAuthorizations>) {
let buffer = Buffer()
buffer.appendInt32(405695855)
return (FunctionDescription(name: "account.getWebAuthorizations", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.WebAuthorizations? in
let reader = BufferReader(buffer)
var result: Api.account.WebAuthorizations?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.account.WebAuthorizations
}
return result
})
}
public static func resetWebAuthorization(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(755087855)
serializeInt64(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.resetWebAuthorization", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func resetWebAuthorizations() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1747789204)
return (FunctionDescription(name: "account.resetWebAuthorizations", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getAllSecureValues() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.SecureValue]>) {
let buffer = Buffer()
buffer.appendInt32(-1299661699)
return (FunctionDescription(name: "account.getAllSecureValues", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.SecureValue]? in
let reader = BufferReader(buffer)
var result: [Api.SecureValue]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureValue.self)
}
return result
})
}
public static func getSecureValue(types: [Api.SecureValueType]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.SecureValue]>) {
let buffer = Buffer()
buffer.appendInt32(1936088002)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(types.count))
for item in types {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "account.getSecureValue", parameters: [("types", types)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.SecureValue]? in
let reader = BufferReader(buffer)
var result: [Api.SecureValue]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureValue.self)
}
return result
})
}
public static func saveSecureValue(value: Api.InputSecureValue, secureSecretId: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.SecureValue>) {
let buffer = Buffer()
buffer.appendInt32(-1986010339)
value.serialize(buffer, true)
serializeInt64(secureSecretId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.saveSecureValue", parameters: [("value", value), ("secureSecretId", secureSecretId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.SecureValue? in
let reader = BufferReader(buffer)
var result: Api.SecureValue?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.SecureValue
}
return result
})
}
public static func deleteSecureValue(types: [Api.SecureValueType]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1199522741)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(types.count))
for item in types {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "account.deleteSecureValue", parameters: [("types", types)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getAuthorizationForm(botId: Int32, scope: String, publicKey: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.AuthorizationForm>) {
let buffer = Buffer()
buffer.appendInt32(-1200903967)
serializeInt32(botId, buffer: buffer, boxed: false)
serializeString(scope, buffer: buffer, boxed: false)
serializeString(publicKey, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.getAuthorizationForm", parameters: [("botId", botId), ("scope", scope), ("publicKey", publicKey)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.AuthorizationForm? in
let reader = BufferReader(buffer)
var result: Api.account.AuthorizationForm?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.account.AuthorizationForm
}
return result
})
}
public static func acceptAuthorization(botId: Int32, scope: String, publicKey: String, valueHashes: [Api.SecureValueHash], credentials: Api.SecureCredentialsEncrypted) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-419267436)
serializeInt32(botId, buffer: buffer, boxed: false)
serializeString(scope, buffer: buffer, boxed: false)
serializeString(publicKey, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(valueHashes.count))
for item in valueHashes {
item.serialize(buffer, true)
}
credentials.serialize(buffer, true)
return (FunctionDescription(name: "account.acceptAuthorization", parameters: [("botId", botId), ("scope", scope), ("publicKey", publicKey), ("valueHashes", valueHashes), ("credentials", credentials)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func sendVerifyPhoneCode(phoneNumber: String, settings: Api.CodeSettings) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.SentCode>) {
let buffer = Buffer()
buffer.appendInt32(-1516022023)
serializeString(phoneNumber, buffer: buffer, boxed: false)
settings.serialize(buffer, true)
return (FunctionDescription(name: "account.sendVerifyPhoneCode", parameters: [("phoneNumber", phoneNumber), ("settings", settings)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.SentCode? in
let reader = BufferReader(buffer)
var result: Api.auth.SentCode?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.auth.SentCode
}
return result
})
}
public static func verifyPhone(phoneNumber: String, phoneCodeHash: String, phoneCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1305716726)
serializeString(phoneNumber, buffer: buffer, boxed: false)
serializeString(phoneCodeHash, buffer: buffer, boxed: false)
serializeString(phoneCode, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.verifyPhone", parameters: [("phoneNumber", phoneNumber), ("phoneCodeHash", phoneCodeHash), ("phoneCode", phoneCode)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func sendVerifyEmailCode(email: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.SentEmailCode>) {
let buffer = Buffer()
buffer.appendInt32(1880182943)
serializeString(email, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.sendVerifyEmailCode", parameters: [("email", email)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.SentEmailCode? in
let reader = BufferReader(buffer)
var result: Api.account.SentEmailCode?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.account.SentEmailCode
}
return result
})
}
public static func verifyEmail(email: String, code: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-323339813)
serializeString(email, buffer: buffer, boxed: false)
serializeString(code, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.verifyEmail", parameters: [("email", email), ("code", code)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func initTakeoutSession(flags: Int32, fileMaxSize: Int32?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.Takeout>) {
let buffer = Buffer()
buffer.appendInt32(-262453244)
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 5) != 0 {serializeInt32(fileMaxSize!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "account.initTakeoutSession", parameters: [("flags", flags), ("fileMaxSize", fileMaxSize)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.Takeout? in
let reader = BufferReader(buffer)
var result: Api.account.Takeout?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.account.Takeout
}
return result
})
}
public static func finishTakeoutSession(flags: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(489050862)
serializeInt32(flags, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.finishTakeoutSession", parameters: [("flags", flags)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func confirmPasswordEmail(code: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1881204448)
serializeString(code, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.confirmPasswordEmail", parameters: [("code", code)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func resendPasswordEmail() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(2055154197)
return (FunctionDescription(name: "account.resendPasswordEmail", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func cancelPasswordEmail() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1043606090)
return (FunctionDescription(name: "account.cancelPasswordEmail", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getContactSignUpNotification() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1626880216)
return (FunctionDescription(name: "account.getContactSignUpNotification", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func setContactSignUpNotification(silent: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-806076575)
silent.serialize(buffer, true)
return (FunctionDescription(name: "account.setContactSignUpNotification", parameters: [("silent", silent)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getNotifyExceptions(flags: Int32, peer: Api.InputNotifyPeer?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(1398240377)
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {peer!.serialize(buffer, true)}
return (FunctionDescription(name: "account.getNotifyExceptions", parameters: [("flags", flags), ("peer", peer)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func getWallPaper(wallpaper: Api.InputWallPaper) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.WallPaper>) {
let buffer = Buffer()
buffer.appendInt32(-57811990)
wallpaper.serialize(buffer, true)
return (FunctionDescription(name: "account.getWallPaper", parameters: [("wallpaper", wallpaper)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.WallPaper? in
let reader = BufferReader(buffer)
var result: Api.WallPaper?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.WallPaper
}
return result
})
}
public static func uploadWallPaper(file: Api.InputFile, mimeType: String, settings: Api.WallPaperSettings) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.WallPaper>) {
let buffer = Buffer()
buffer.appendInt32(-578472351)
file.serialize(buffer, true)
serializeString(mimeType, buffer: buffer, boxed: false)
settings.serialize(buffer, true)
return (FunctionDescription(name: "account.uploadWallPaper", parameters: [("file", file), ("mimeType", mimeType), ("settings", settings)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.WallPaper? in
let reader = BufferReader(buffer)
var result: Api.WallPaper?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.WallPaper
}
return result
})
}
public static func saveWallPaper(wallpaper: Api.InputWallPaper, unsave: Api.Bool, settings: Api.WallPaperSettings) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1817860919)
wallpaper.serialize(buffer, true)
unsave.serialize(buffer, true)
settings.serialize(buffer, true)
return (FunctionDescription(name: "account.saveWallPaper", parameters: [("wallpaper", wallpaper), ("unsave", unsave), ("settings", settings)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func installWallPaper(wallpaper: Api.InputWallPaper, settings: Api.WallPaperSettings) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-18000023)
wallpaper.serialize(buffer, true)
settings.serialize(buffer, true)
return (FunctionDescription(name: "account.installWallPaper", parameters: [("wallpaper", wallpaper), ("settings", settings)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func resetWallPapers() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1153722364)
return (FunctionDescription(name: "account.resetWallPapers", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getAutoDownloadSettings() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.AutoDownloadSettings>) {
let buffer = Buffer()
buffer.appendInt32(1457130303)
return (FunctionDescription(name: "account.getAutoDownloadSettings", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.AutoDownloadSettings? in
let reader = BufferReader(buffer)
var result: Api.account.AutoDownloadSettings?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.account.AutoDownloadSettings
}
return result
})
}
public static func saveAutoDownloadSettings(flags: Int32, settings: Api.AutoDownloadSettings) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1995661875)
serializeInt32(flags, buffer: buffer, boxed: false)
settings.serialize(buffer, true)
return (FunctionDescription(name: "account.saveAutoDownloadSettings", parameters: [("flags", flags), ("settings", settings)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func uploadTheme(flags: Int32, file: Api.InputFile, thumb: Api.InputFile?, fileName: String, mimeType: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Document>) {
let buffer = Buffer()
buffer.appendInt32(473805619)
serializeInt32(flags, buffer: buffer, boxed: false)
file.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {thumb!.serialize(buffer, true)}
serializeString(fileName, buffer: buffer, boxed: false)
serializeString(mimeType, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.uploadTheme", parameters: [("flags", flags), ("file", file), ("thumb", thumb), ("fileName", fileName), ("mimeType", mimeType)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Document? in
let reader = BufferReader(buffer)
var result: Api.Document?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Document
}
return result
})
}
public static func createTheme(flags: Int32, slug: String, title: String, document: Api.InputDocument?, settings: Api.InputThemeSettings?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Theme>) {
let buffer = Buffer()
buffer.appendInt32(-2077048289)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(slug, buffer: buffer, boxed: false)
serializeString(title, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {document!.serialize(buffer, true)}
if Int(flags) & Int(1 << 3) != 0 {settings!.serialize(buffer, true)}
return (FunctionDescription(name: "account.createTheme", parameters: [("flags", flags), ("slug", slug), ("title", title), ("document", document), ("settings", settings)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Theme? in
let reader = BufferReader(buffer)
var result: Api.Theme?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Theme
}
return result
})
}
public static func updateTheme(flags: Int32, format: String, theme: Api.InputTheme, slug: String?, title: String?, document: Api.InputDocument?, settings: Api.InputThemeSettings?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Theme>) {
let buffer = Buffer()
buffer.appendInt32(1555261397)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(format, buffer: buffer, boxed: false)
theme.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {serializeString(slug!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {serializeString(title!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {document!.serialize(buffer, true)}
if Int(flags) & Int(1 << 3) != 0 {settings!.serialize(buffer, true)}
return (FunctionDescription(name: "account.updateTheme", parameters: [("flags", flags), ("format", format), ("theme", theme), ("slug", slug), ("title", title), ("document", document), ("settings", settings)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Theme? in
let reader = BufferReader(buffer)
var result: Api.Theme?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Theme
}
return result
})
}
public static func saveTheme(theme: Api.InputTheme, unsave: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-229175188)
theme.serialize(buffer, true)
unsave.serialize(buffer, true)
return (FunctionDescription(name: "account.saveTheme", parameters: [("theme", theme), ("unsave", unsave)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func installTheme(flags: Int32, format: String?, theme: Api.InputTheme?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(2061776695)
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {serializeString(format!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {theme!.serialize(buffer, true)}
return (FunctionDescription(name: "account.installTheme", parameters: [("flags", flags), ("format", format), ("theme", theme)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getTheme(format: String, theme: Api.InputTheme, documentId: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Theme>) {
let buffer = Buffer()
buffer.appendInt32(-1919060949)
serializeString(format, buffer: buffer, boxed: false)
theme.serialize(buffer, true)
serializeInt64(documentId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.getTheme", parameters: [("format", format), ("theme", theme), ("documentId", documentId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Theme? in
let reader = BufferReader(buffer)
var result: Api.Theme?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Theme
}
return result
})
}
public static func getThemes(format: String, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.Themes>) {
let buffer = Buffer()
buffer.appendInt32(676939512)
serializeString(format, buffer: buffer, boxed: false)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.getThemes", parameters: [("format", format), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.Themes? in
let reader = BufferReader(buffer)
var result: Api.account.Themes?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.account.Themes
}
return result
})
}
public static func setContentSettings(flags: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1250643605)
serializeInt32(flags, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.setContentSettings", parameters: [("flags", flags)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func getContentSettings() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.ContentSettings>) {
let buffer = Buffer()
buffer.appendInt32(-1952756306)
return (FunctionDescription(name: "account.getContentSettings", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.ContentSettings? in
let reader = BufferReader(buffer)
var result: Api.account.ContentSettings?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.account.ContentSettings
}
return result
})
}
public static func getMultiWallPapers(wallpapers: [Api.InputWallPaper]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.WallPaper]>) {
let buffer = Buffer()
buffer.appendInt32(1705865692)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(wallpapers.count))
for item in wallpapers {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "account.getMultiWallPapers", parameters: [("wallpapers", wallpapers)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.WallPaper]? in
let reader = BufferReader(buffer)
var result: [Api.WallPaper]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.WallPaper.self)
}
return result
})
}
public static func getGlobalPrivacySettings() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.GlobalPrivacySettings>) {
let buffer = Buffer()
buffer.appendInt32(-349483786)
return (FunctionDescription(name: "account.getGlobalPrivacySettings", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.GlobalPrivacySettings? in
let reader = BufferReader(buffer)
var result: Api.GlobalPrivacySettings?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.GlobalPrivacySettings
}
return result
})
}
public static func setGlobalPrivacySettings(settings: Api.GlobalPrivacySettings) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.GlobalPrivacySettings>) {
let buffer = Buffer()
buffer.appendInt32(517647042)
settings.serialize(buffer, true)
return (FunctionDescription(name: "account.setGlobalPrivacySettings", parameters: [("settings", settings)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.GlobalPrivacySettings? in
let reader = BufferReader(buffer)
var result: Api.GlobalPrivacySettings?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.GlobalPrivacySettings
}
return result
})
}
public static func reportProfilePhoto(peer: Api.InputPeer, photoId: Api.InputPhoto, reason: Api.ReportReason, message: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-91437323)
peer.serialize(buffer, true)
photoId.serialize(buffer, true)
reason.serialize(buffer, true)
serializeString(message, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.reportProfilePhoto", parameters: [("peer", peer), ("photoId", photoId), ("reason", reason), ("message", message)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func resetPassword() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.ResetPasswordResult>) {
let buffer = Buffer()
buffer.appendInt32(-1828139493)
return (FunctionDescription(name: "account.resetPassword", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.ResetPasswordResult? in
let reader = BufferReader(buffer)
var result: Api.account.ResetPasswordResult?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.account.ResetPasswordResult
}
return result
})
}
public static func declinePasswordReset() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1284770294)
return (FunctionDescription(name: "account.declinePasswordReset", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
}
public struct langpack {
public static func getLangPack(langPack: String, langCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.LangPackDifference>) {
let buffer = Buffer()
buffer.appendInt32(-219008246)
serializeString(langPack, buffer: buffer, boxed: false)
serializeString(langCode, buffer: buffer, boxed: false)
return (FunctionDescription(name: "langpack.getLangPack", parameters: [("langPack", langPack), ("langCode", langCode)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.LangPackDifference? in
let reader = BufferReader(buffer)
var result: Api.LangPackDifference?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.LangPackDifference
}
return result
})
}
public static func getStrings(langPack: String, langCode: String, keys: [String]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.LangPackString]>) {
let buffer = Buffer()
buffer.appendInt32(-269862909)
serializeString(langPack, buffer: buffer, boxed: false)
serializeString(langCode, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(keys.count))
for item in keys {
serializeString(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "langpack.getStrings", parameters: [("langPack", langPack), ("langCode", langCode), ("keys", keys)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.LangPackString]? in
let reader = BufferReader(buffer)
var result: [Api.LangPackString]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.LangPackString.self)
}
return result
})
}
public static func getDifference(langPack: String, langCode: String, fromVersion: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.LangPackDifference>) {
let buffer = Buffer()
buffer.appendInt32(-845657435)
serializeString(langPack, buffer: buffer, boxed: false)
serializeString(langCode, buffer: buffer, boxed: false)
serializeInt32(fromVersion, buffer: buffer, boxed: false)
return (FunctionDescription(name: "langpack.getDifference", parameters: [("langPack", langPack), ("langCode", langCode), ("fromVersion", fromVersion)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.LangPackDifference? in
let reader = BufferReader(buffer)
var result: Api.LangPackDifference?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.LangPackDifference
}
return result
})
}
public static func getLanguages(langPack: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.LangPackLanguage]>) {
let buffer = Buffer()
buffer.appendInt32(1120311183)
serializeString(langPack, buffer: buffer, boxed: false)
return (FunctionDescription(name: "langpack.getLanguages", parameters: [("langPack", langPack)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.LangPackLanguage]? in
let reader = BufferReader(buffer)
var result: [Api.LangPackLanguage]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.LangPackLanguage.self)
}
return result
})
}
public static func getLanguage(langPack: String, langCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.LangPackLanguage>) {
let buffer = Buffer()
buffer.appendInt32(1784243458)
serializeString(langPack, buffer: buffer, boxed: false)
serializeString(langCode, buffer: buffer, boxed: false)
return (FunctionDescription(name: "langpack.getLanguage", parameters: [("langPack", langPack), ("langCode", langCode)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.LangPackLanguage? in
let reader = BufferReader(buffer)
var result: Api.LangPackLanguage?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.LangPackLanguage
}
return result
})
}
}
public struct photos {
public static func updateProfilePhoto(id: Api.InputPhoto) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.photos.Photo>) {
let buffer = Buffer()
buffer.appendInt32(1926525996)
id.serialize(buffer, true)
return (FunctionDescription(name: "photos.updateProfilePhoto", parameters: [("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.photos.Photo? in
let reader = BufferReader(buffer)
var result: Api.photos.Photo?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.photos.Photo
}
return result
})
}
public static func uploadProfilePhoto(flags: Int32, file: Api.InputFile?, video: Api.InputFile?, videoStartTs: Double?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.photos.Photo>) {
let buffer = Buffer()
buffer.appendInt32(-1980559511)
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {file!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {video!.serialize(buffer, true)}
if Int(flags) & Int(1 << 2) != 0 {serializeDouble(videoStartTs!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "photos.uploadProfilePhoto", parameters: [("flags", flags), ("file", file), ("video", video), ("videoStartTs", videoStartTs)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.photos.Photo? in
let reader = BufferReader(buffer)
var result: Api.photos.Photo?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.photos.Photo
}
return result
})
}
public static func deletePhotos(id: [Api.InputPhoto]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Int64]>) {
let buffer = Buffer()
buffer.appendInt32(-2016444625)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count))
for item in id {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "photos.deletePhotos", parameters: [("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Int64]? in
let reader = BufferReader(buffer)
var result: [Int64]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
return result
})
}
public static func getUserPhotos(userId: Api.InputUser, offset: Int32, maxId: Int64, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.photos.Photos>) {
let buffer = Buffer()
buffer.appendInt32(-1848823128)
userId.serialize(buffer, true)
serializeInt32(offset, buffer: buffer, boxed: false)
serializeInt64(maxId, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "photos.getUserPhotos", parameters: [("userId", userId), ("offset", offset), ("maxId", maxId), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.photos.Photos? in
let reader = BufferReader(buffer)
var result: Api.photos.Photos?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.photos.Photos
}
return result
})
}
}
public struct phone {
public static func getCallConfig() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.DataJSON>) {
let buffer = Buffer()
buffer.appendInt32(1430593449)
return (FunctionDescription(name: "phone.getCallConfig", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.DataJSON? in
let reader = BufferReader(buffer)
var result: Api.DataJSON?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.DataJSON
}
return result
})
}
public static func requestCall(flags: Int32, userId: Api.InputUser, randomId: Int32, gAHash: Buffer, `protocol`: Api.PhoneCallProtocol) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.phone.PhoneCall>) {
let buffer = Buffer()
buffer.appendInt32(1124046573)
serializeInt32(flags, buffer: buffer, boxed: false)
userId.serialize(buffer, true)
serializeInt32(randomId, buffer: buffer, boxed: false)
serializeBytes(gAHash, buffer: buffer, boxed: false)
`protocol`.serialize(buffer, true)
return (FunctionDescription(name: "phone.requestCall", parameters: [("flags", flags), ("userId", userId), ("randomId", randomId), ("gAHash", gAHash), ("`protocol`", `protocol`)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.phone.PhoneCall? in
let reader = BufferReader(buffer)
var result: Api.phone.PhoneCall?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.phone.PhoneCall
}
return result
})
}
public static func acceptCall(peer: Api.InputPhoneCall, gB: Buffer, `protocol`: Api.PhoneCallProtocol) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.phone.PhoneCall>) {
let buffer = Buffer()
buffer.appendInt32(1003664544)
peer.serialize(buffer, true)
serializeBytes(gB, buffer: buffer, boxed: false)
`protocol`.serialize(buffer, true)
return (FunctionDescription(name: "phone.acceptCall", parameters: [("peer", peer), ("gB", gB), ("`protocol`", `protocol`)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.phone.PhoneCall? in
let reader = BufferReader(buffer)
var result: Api.phone.PhoneCall?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.phone.PhoneCall
}
return result
})
}
public static func confirmCall(peer: Api.InputPhoneCall, gA: Buffer, keyFingerprint: Int64, `protocol`: Api.PhoneCallProtocol) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.phone.PhoneCall>) {
let buffer = Buffer()
buffer.appendInt32(788404002)
peer.serialize(buffer, true)
serializeBytes(gA, buffer: buffer, boxed: false)
serializeInt64(keyFingerprint, buffer: buffer, boxed: false)
`protocol`.serialize(buffer, true)
return (FunctionDescription(name: "phone.confirmCall", parameters: [("peer", peer), ("gA", gA), ("keyFingerprint", keyFingerprint), ("`protocol`", `protocol`)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.phone.PhoneCall? in
let reader = BufferReader(buffer)
var result: Api.phone.PhoneCall?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.phone.PhoneCall
}
return result
})
}
public static func receivedCall(peer: Api.InputPhoneCall) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(399855457)
peer.serialize(buffer, true)
return (FunctionDescription(name: "phone.receivedCall", parameters: [("peer", peer)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func discardCall(flags: Int32, peer: Api.InputPhoneCall, duration: Int32, reason: Api.PhoneCallDiscardReason, connectionId: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-1295269440)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeInt32(duration, buffer: buffer, boxed: false)
reason.serialize(buffer, true)
serializeInt64(connectionId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "phone.discardCall", parameters: [("flags", flags), ("peer", peer), ("duration", duration), ("reason", reason), ("connectionId", connectionId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func setCallRating(flags: Int32, peer: Api.InputPhoneCall, rating: Int32, comment: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(1508562471)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeInt32(rating, buffer: buffer, boxed: false)
serializeString(comment, buffer: buffer, boxed: false)
return (FunctionDescription(name: "phone.setCallRating", parameters: [("flags", flags), ("peer", peer), ("rating", rating), ("comment", comment)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func saveCallDebug(peer: Api.InputPhoneCall, debug: Api.DataJSON) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(662363518)
peer.serialize(buffer, true)
debug.serialize(buffer, true)
return (FunctionDescription(name: "phone.saveCallDebug", parameters: [("peer", peer), ("debug", debug)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func sendSignalingData(peer: Api.InputPhoneCall, data: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-8744061)
peer.serialize(buffer, true)
serializeBytes(data, buffer: buffer, boxed: false)
return (FunctionDescription(name: "phone.sendSignalingData", parameters: [("peer", peer), ("data", data)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func createGroupCall(flags: Int32, peer: Api.InputPeer, randomId: Int32, title: String?, scheduleDate: Int32?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(1221445336)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeInt32(randomId, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(title!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(scheduleDate!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "phone.createGroupCall", parameters: [("flags", flags), ("peer", peer), ("randomId", randomId), ("title", title), ("scheduleDate", scheduleDate)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func joinGroupCall(flags: Int32, call: Api.InputGroupCall, joinAs: Api.InputPeer, inviteHash: String?, params: Api.DataJSON) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-1322057861)
serializeInt32(flags, buffer: buffer, boxed: false)
call.serialize(buffer, true)
joinAs.serialize(buffer, true)
if Int(flags) & Int(1 << 1) != 0 {serializeString(inviteHash!, buffer: buffer, boxed: false)}
params.serialize(buffer, true)
return (FunctionDescription(name: "phone.joinGroupCall", parameters: [("flags", flags), ("call", call), ("joinAs", joinAs), ("inviteHash", inviteHash), ("params", params)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func leaveGroupCall(call: Api.InputGroupCall, source: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(1342404601)
call.serialize(buffer, true)
serializeInt32(source, buffer: buffer, boxed: false)
return (FunctionDescription(name: "phone.leaveGroupCall", parameters: [("call", call), ("source", source)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func inviteToGroupCall(call: Api.InputGroupCall, users: [Api.InputUser]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(2067345760)
call.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
return (FunctionDescription(name: "phone.inviteToGroupCall", parameters: [("call", call), ("users", users)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func discardGroupCall(call: Api.InputGroupCall) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(2054648117)
call.serialize(buffer, true)
return (FunctionDescription(name: "phone.discardGroupCall", parameters: [("call", call)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func toggleGroupCallSettings(flags: Int32, call: Api.InputGroupCall, joinMuted: Api.Bool?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(1958458429)
serializeInt32(flags, buffer: buffer, boxed: false)
call.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {joinMuted!.serialize(buffer, true)}
return (FunctionDescription(name: "phone.toggleGroupCallSettings", parameters: [("flags", flags), ("call", call), ("joinMuted", joinMuted)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func getGroupCall(call: Api.InputGroupCall) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.phone.GroupCall>) {
let buffer = Buffer()
buffer.appendInt32(209498135)
call.serialize(buffer, true)
return (FunctionDescription(name: "phone.getGroupCall", parameters: [("call", call)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.phone.GroupCall? in
let reader = BufferReader(buffer)
var result: Api.phone.GroupCall?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.phone.GroupCall
}
return result
})
}
public static func getGroupParticipants(call: Api.InputGroupCall, ids: [Api.InputPeer], sources: [Int32], offset: String, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.phone.GroupParticipants>) {
let buffer = Buffer()
buffer.appendInt32(-984033109)
call.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(ids.count))
for item in ids {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(sources.count))
for item in sources {
serializeInt32(item, buffer: buffer, boxed: false)
}
serializeString(offset, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "phone.getGroupParticipants", parameters: [("call", call), ("ids", ids), ("sources", sources), ("offset", offset), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.phone.GroupParticipants? in
let reader = BufferReader(buffer)
var result: Api.phone.GroupParticipants?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.phone.GroupParticipants
}
return result
})
}
public static func checkGroupCall(call: Api.InputGroupCall, sources: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Int32]>) {
let buffer = Buffer()
buffer.appendInt32(-1248003721)
call.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(sources.count))
for item in sources {
serializeInt32(item, buffer: buffer, boxed: false)
}
return (FunctionDescription(name: "phone.checkGroupCall", parameters: [("call", call), ("sources", sources)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Int32]? in
let reader = BufferReader(buffer)
var result: [Int32]?
if let _ = reader.readInt32() {
result = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
}
return result
})
}
public static func toggleGroupCallRecord(flags: Int32, call: Api.InputGroupCall, title: String?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-1070962985)
serializeInt32(flags, buffer: buffer, boxed: false)
call.serialize(buffer, true)
if Int(flags) & Int(1 << 1) != 0 {serializeString(title!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "phone.toggleGroupCallRecord", parameters: [("flags", flags), ("call", call), ("title", title)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func editGroupCallParticipant(flags: Int32, call: Api.InputGroupCall, participant: Api.InputPeer, muted: Api.Bool?, volume: Int32?, raiseHand: Api.Bool?, videoStopped: Api.Bool?, videoPaused: Api.Bool?, presentationPaused: Api.Bool?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-1524155713)
serializeInt32(flags, buffer: buffer, boxed: false)
call.serialize(buffer, true)
participant.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {muted!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(volume!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {raiseHand!.serialize(buffer, true)}
if Int(flags) & Int(1 << 3) != 0 {videoStopped!.serialize(buffer, true)}
if Int(flags) & Int(1 << 4) != 0 {videoPaused!.serialize(buffer, true)}
if Int(flags) & Int(1 << 5) != 0 {presentationPaused!.serialize(buffer, true)}
return (FunctionDescription(name: "phone.editGroupCallParticipant", parameters: [("flags", flags), ("call", call), ("participant", participant), ("muted", muted), ("volume", volume), ("raiseHand", raiseHand), ("videoStopped", videoStopped), ("videoPaused", videoPaused), ("presentationPaused", presentationPaused)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func editGroupCallTitle(call: Api.InputGroupCall, title: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(480685066)
call.serialize(buffer, true)
serializeString(title, buffer: buffer, boxed: false)
return (FunctionDescription(name: "phone.editGroupCallTitle", parameters: [("call", call), ("title", title)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func getGroupCallJoinAs(peer: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.phone.JoinAsPeers>) {
let buffer = Buffer()
buffer.appendInt32(-277077702)
peer.serialize(buffer, true)
return (FunctionDescription(name: "phone.getGroupCallJoinAs", parameters: [("peer", peer)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.phone.JoinAsPeers? in
let reader = BufferReader(buffer)
var result: Api.phone.JoinAsPeers?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.phone.JoinAsPeers
}
return result
})
}
public static func exportGroupCallInvite(flags: Int32, call: Api.InputGroupCall) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.phone.ExportedGroupCallInvite>) {
let buffer = Buffer()
buffer.appendInt32(-425040769)
serializeInt32(flags, buffer: buffer, boxed: false)
call.serialize(buffer, true)
return (FunctionDescription(name: "phone.exportGroupCallInvite", parameters: [("flags", flags), ("call", call)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.phone.ExportedGroupCallInvite? in
let reader = BufferReader(buffer)
var result: Api.phone.ExportedGroupCallInvite?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.phone.ExportedGroupCallInvite
}
return result
})
}
public static func toggleGroupCallStartSubscription(call: Api.InputGroupCall, subscribed: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(563885286)
call.serialize(buffer, true)
subscribed.serialize(buffer, true)
return (FunctionDescription(name: "phone.toggleGroupCallStartSubscription", parameters: [("call", call), ("subscribed", subscribed)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func startScheduledGroupCall(call: Api.InputGroupCall) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(1451287362)
call.serialize(buffer, true)
return (FunctionDescription(name: "phone.startScheduledGroupCall", parameters: [("call", call)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func saveDefaultGroupCallJoinAs(peer: Api.InputPeer, joinAs: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1465786252)
peer.serialize(buffer, true)
joinAs.serialize(buffer, true)
return (FunctionDescription(name: "phone.saveDefaultGroupCallJoinAs", parameters: [("peer", peer), ("joinAs", joinAs)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
public static func joinGroupCallPresentation(call: Api.InputGroupCall, params: Api.DataJSON) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(-873829436)
call.serialize(buffer, true)
params.serialize(buffer, true)
return (FunctionDescription(name: "phone.joinGroupCallPresentation", parameters: [("call", call), ("params", params)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
public static func leaveGroupCallPresentation(call: Api.InputGroupCall) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer()
buffer.appendInt32(475058500)
call.serialize(buffer, true)
return (FunctionDescription(name: "phone.leaveGroupCallPresentation", parameters: [("call", call)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer)
var result: Api.Updates?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Updates
}
return result
})
}
}
}
}
| [
-1
] |
b1d73f06f14f85ef09a969921e8223198211a032 | 6cf2709ed8340a90ffad09f5f72e2957bd1637fd | /SGRoutePlan/Classes/BusLine.swift | c98195dd978fe1056ec418e0e173d553ceab729e | [
"MIT"
] | permissive | crash-wu/SGRoutePlan | 148da740a8495419a189d34578b962a772b98b2f | c7cc3191c8502d4fd710207a9dd17e17bd1e7cab | refs/heads/master | 2020-09-20T13:22:19.802648 | 2016-08-22T09:22:38 | 2016-08-22T09:22:38 | 65,894,040 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 940 | swift |
//
// BusLine.swift
// Pods
//
// Created by 吴小星 on 16/8/17.
//
//
import UIKit
import ObjectMapper
/**
* @author crash [email protected] , 16-08-17 11:08:47
*
* @brief 公交线路
*/
public class BusLine: NSObject ,Mappable {
/**
* @author crash [email protected] , 16-08-17 11:08:38
*
* @brief 单条公交结果线路名称,如:3 路—4 路—5 路
*/
public var lineName: String?
/**
* @author crash [email protected] , 16-08-17 11:08:48
*
* @brief 单条公交结果中的各段线路信息
*/
public var segments: [BusSegment]?
public override init() {
super.init()
}
required public convenience init?(_ map: Map) {
self.init()
}
public func mapping(map: Map) {
self.lineName <- map["lineName"]
self.segments <- map["segments"]
}
}
| [
-1
] |
9469d7cbc34b2c5f8788fee7d537bea9f8c9105d | 247dee79cd54f72c8e0ce556e35b114583e9a33f | /Tests/OpenCombineTests/PublisherTests/CollectTests.swift | 74ae348104b55f520ab249560402d52e5c0e4ff5 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | MaxDesiatov/OpenCombine | c0f0e00f872ff49b65ac187f3985c3776be6fd66 | 4fed049b0ab7095d4d26247ef958d3f6e361c569 | refs/heads/wasi | 2021-11-28T08:16:00.645193 | 2020-07-01T19:03:24 | 2020-07-01T19:03:24 | 192,226,442 | 2 | 2 | MIT | 2021-09-26T13:26:12 | 2019-06-16T18:58:52 | Swift | UTF-8 | Swift | false | false | 3,121 | swift | //
// CollectTests.swift
//
//
// Created by Sergej Jaskiewicz on 15.10.2019.
//
import XCTest
#if OPENCOMBINE_COMPATIBILITY_TEST
import Combine
#else
import OpenCombine
#endif
@available(macOS 10.15, iOS 13.0, *)
final class CollectTests: XCTestCase {
func testBasicBehavior() throws {
try ReduceTests.testBasicReductionBehavior(expectedSubscription: "Collect",
expectedResult: [1, 2, 3, 4, 5],
{ $0.collect() })
}
func testUpstreamFinishesWithError() {
ReduceTests.testUpstreamFinishesWithError(expectedSubscription: "Collect",
{ $0.collect() })
}
func testtestUpstreamFinishesImmediately() {
ReduceTests.testUpstreamFinishesImmediately(expectedSubscription: "Collect",
expectedResult: [],
{ $0.collect() })
}
func testCancelAlreadyCancelled() throws {
try ReduceTests.testCancelAlreadyCancelled { $0.collect() }
}
func testRequestsUnlimitedThenSendsSubscription() {
ReduceTests.testRequestsUnlimitedThenSendsSubscription { $0.collect() }
}
func testReceiveSubscriptionTwice() throws {
try ReduceTests
.testReceiveSubscriptionTwice(expectedSubscription: "Collect",
expectedResult: .normalCompletion([0]),
{ $0.collect() })
}
func testCollectReceiveValueBeforeSubscription() {
testReceiveValueBeforeSubscription(value: 0,
expected: .history([], demand: .none),
{ $0.collect() })
}
func testCollectReceiveCompletionBeforeSubscription() {
testReceiveCompletionBeforeSubscription(
inputType: Int.self,
expected: .history([]),
{ $0.collect() }
)
}
func testCollectRequestBeforeSubscription() {
testRequestBeforeSubscription(inputType: Int.self,
shouldCrash: false,
{ $0.collect() })
}
func testCollectCancelBeforeSubscription() {
testCancelBeforeSubscription(inputType: Int.self,
shouldCrash: false,
{ $0.collect() })
}
func testCollectLifecycle() throws {
try testLifecycle(sendValue: 31,
cancellingSubscriptionReleasesSubscriber: false,
{ $0.collect() })
}
func testCollectReflection() throws {
try testReflection(parentInput: Int.self,
parentFailure: Error.self,
description: "Collect",
customMirror: expectedChildren(("count", "0")),
playgroundDescription: "Collect",
{ $0.collect() })
}
}
| [
-1
] |
3fbfb6d28822b36faea69af8245d60b88dc95e31 | eb3afd7681507b8c844cc3d93859d890590e9f5c | /Napalm/Classes/Audio.swift | 3ad733a1beb879e24f48af30757408bfcb251993 | [
"MIT"
] | permissive | cotsog/Napalm | 5b756dca4e9880983185bd74e76224644586fdb7 | a6f47ff4416263e01db103de3bac47001de1438c | refs/heads/master | 2020-05-29T08:49:44.779440 | 2016-09-05T15:24:07 | 2016-09-05T15:24:07 | 68,958,259 | 0 | 0 | null | 2016-09-22T20:09:17 | 2016-09-22T20:09:17 | null | UTF-8 | Swift | false | false | 4,954 | swift | //
// Audio.swift
// Pods
//
// Created by Caleb Kleveter on 7/5/16.
//
//
//
// Copyright (c) 2016 Caleb Kleveter
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
import Foundation
import AudioToolbox
import AVFoundation
/**
For easily playing audio files.
*/
public class NPFAudio {
/**
This enum is used in setting the proper file type in the playSimpleAudio function.
*/
public enum SimpleAudioFileType: String {
/**
For 'simple' audio files with the .wav extension
*/
case wav
/**
For 'simple' audio files with the .caf extension
*/
case caf
/**
For 'simple' audio files with the .aif extension
*/
case aif
}
/**
This enum is used in setting the proper file type in the playAudio function.
*/
public enum AudioFileType: String {
/**
For audio files with the .m4a extension
*/
case m4a
/**
For audio files with the .mp3 extension
*/
case mp3
/**
For audio files with the .acc extension
*/
case acc
/**
For audio files with the .m4b extension
*/
case m4b
/**
For audio files with the .m4p extension
*/
case m4p
/**
For audio files with the .m4v extension
*/
case m4v
/**
For audio files with the .m4r extension
*/
case m4r
/**
For audio files with the .mp4 extension
*/
case mp4
/**
For audio files with the .ac3 extension
*/
case ac3
/**
For audio files with the .eac3 extension
*/
case eac3
/**
For audio files with the .ilbc extension
*/
case ilbc
/**
For audio files with the .lbc extension
*/
case lbc
/**
For audio files with the .ima4 extension
*/
case ima4
}
/**
Plays an audio file with the name and file extension passed in. Uses the simple audio types of .wav, .caf and .aif that are supported by AudioServices.
- parameter fileName: This is the name of the file *without* the extension.
- parameter fileExtension: The extension of the file. This comes from the SimpleAudioFileType enum.
*/
public class func playSimpleAudio(withFileName fileName: String, andExtension fileExtension: SimpleAudioFileType) {
var sound: SystemSoundID = 0
guard let path = Bundle.main().pathForResource(fileName, ofType: fileExtension.rawValue) else {
return
}
let urlPath = URL(fileURLWithPath: path)
AudioServicesCreateSystemSoundID(urlPath, &sound)
AudioServicesPlaySystemSound(sound)
}
/**
Plays an audio file with the name and file extension passed in. Uses the audio types that are not supported by AudioServices such as .m4a and .mp3.
- parameter fileName: This is the name of the file *without* the extension.
- parameter fileExtension: The extension of the file. This comes from the AudioFileType enum.
*/
public class func playAudio(withFileName fileName: String, andExtension fileExtension: AudioFileType) {
let player = AVQueuePlayer()
guard let path = Bundle.main().pathForResource(fileName, ofType: fileExtension.rawValue) else {
return
}
let urlPath = URL(fileURLWithPath: path)
player.removeAllItems()
player.insert(AVPlayerItem(url: urlPath), after: nil)
player.play()
}
}
| [
215206,
279944,
215212,
173425,
142450,
280058,
203546
] |
ed47f1d88c27c50a9c199d80333511176d8b93e4 | 5bd23b1b75079c8d41f91153a6cdda2d72039d6c | /TallerSwiftSampleButtons/ViewController.swift | b73da4a91fde3fc5d1f9662b92d5c97f5ea72586 | [
"MIT"
] | permissive | jorgeSV/TallerSwiftSampleButtons | 3f7d7dabbdb399117fb66bd783c40c063358a076 | b06b444392314568b992376b29569b95fcde9b60 | refs/heads/master | 2021-01-10T20:58:53.397214 | 2014-07-20T00:30:00 | 2014-07-20T00:30:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,956 | swift | //
// ViewController.swift
// TallerSwiftSampleButtons
//
// Created by jorgeSV on 19/7/14.
// Copyright (c) 2014 JorgeSV. All rights reserved.
//
import UIKit
class ViewController: UIViewController, UIAlertViewDelegate
{
override func viewDidLoad()
{
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
for(var pos = 0; pos <= 5; pos++)
{
var button = UIButton()
button = self.createButton(button, position: pos)
self.view.addSubview(button)
}
}
override func didReceiveMemoryWarning()
{
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func createButton(var button: UIButton, position: Int) -> UIButton
{
button = UIButton(frame: CGRectMake(20 + 100 * CGFloat(position % 3), position <= 2 ? 50 : self.view.frame.height - 65, 80, 35))
button.setTitle("Button 0\(position + 1)", forState:UIControlState.Normal)
button.setTitleColor(UIColor.whiteColor(), forState:.Normal)
button.titleLabel.font = UIFont.systemFontOfSize(13)
button.titleLabel.lineBreakMode = .ByTruncatingTail
button.showsTouchWhenHighlighted = true
button.layer.backgroundColor = UIColor.blackColor().CGColor
button.layer.cornerRadius = 3.0
button.addTarget(self, action:Selector("fTouchUpInside:"), forControlEvents:.TouchUpInside)
return button
}
func fTouchUpInside(sender: UIButton)
{
var alert01 = UIAlertView(title: "Touch en: " + sender.titleLabel.text, message: "", delegate: self, cancelButtonTitle: "OK")
alert01.show()
}
func alertView(alertView: UIAlertView!, clickedButtonAtIndex buttonIndex: Int)
{
NSLog("Touch en Botón \(alertView.buttonTitleAtIndex(buttonIndex)) de AlertView")
}
}
| [
-1
] |
71d6136df70f0f5828c8e33e320cc8dad103e064 | f05c1c77742b640372232dc536788b2f4b62be7e | /Pile/Module/Home/TaskTableViewCell.swift | 245df461374f640fb926ba6493927a9455afabe8 | [] | no_license | randyefan/Pile-MC.1 | 5ceaa48d8bb90b91eea8243c4c702f556ec231dc | 39ab559dc5dadc56a808716ef64299d51ab8470f | refs/heads/main | 2023-04-20T20:15:14.672097 | 2021-04-14T10:48:37 | 2021-04-14T10:48:37 | 353,591,175 | 0 | 3 | null | 2021-05-05T16:33:29 | 2021-04-01T05:59:34 | Swift | UTF-8 | Swift | false | false | 494 | swift | //
// TaskTableViewCell.swift
// Pile
//
// Created by Gratianus Martin on 05/04/21.
//
import UIKit
class TaskTableViewCell: UITableViewCell {
@IBOutlet weak var challengeTitleText: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
| [
258720,
393537,
379140,
240134,
313671,
327241,
346761,
384988,
372718,
325907,
317331,
358868,
373908,
384982,
291544,
305659,
358876,
360191
] |
1e6e855c73fdef2537ab1a1b4afac9101c5a8e1b | 04009964de990c001a008bd35f9de1c299f7a628 | /SwiftUITest03-Todo/ContentView/MyBasicCard.swift | 702594cc638d552eefd64de3f47ce99378ff0aca | [] | no_license | jhchoo/SwiftUITest03-Todo | a5c0ef044a9718ee569ee48c42f805890da200ce | 103643cfd66ede7ca21863e5db91981c74c7c6ce | refs/heads/main | 2022-12-30T04:54:02.197941 | 2020-10-20T05:30:09 | 2020-10-20T05:30:09 | 305,581,705 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,176 | swift | //
// MyBasicCard.swift
// SwiftUITest03-Todo
//
// Created by jae hwan choo on 2020/10/19.
//
import SwiftUI
struct MyBasicCard: View {
var icon: String
var title: String
var start: String
var end: String
var bgColor: Color
var body: some View {
HStack(spacing: 20) {
Image(systemName: icon)
.font(.system(size: 40))
.foregroundColor(.white)
VStack(alignment: .leading, spacing: 0) {
Divider().opacity(0)
Text(title)
.fontWeight(.bold)
.font(.system(size: 23))
.foregroundColor(Color.white)
Spacer().frame(height: 5)
Text("\(start) - \(end)")
.foregroundColor(.white)
}
}
.padding(20)
.background(bgColor)
.cornerRadius(20)
}
}
struct MyBasicCard_Previews: PreviewProvider {
static var previews: some View {
MyBasicCard(icon: "book.fill", title: "책읽기", start: "1 PM", end: "3 PM", bgColor: .red)
}
}
| [
-1
] |
429dfb04933d94d92dd3256a640fa7c7b6762492 | 010e940c6fd5440547655b17df6bd0440160573b | /MyVendingMachine/Controllers/MonySlot.swift | e37f81e7fcc6c3efbb6e7334dff58064debfe04b | [] | no_license | zahra98/VendingMachine | cffb7b6f79febff8adce5f6963a22616d0d4b52b | 9d55c7166804e4e6b080ebb951c07f71568e0d3d | refs/heads/main | 2023-06-17T14:56:26.944555 | 2021-07-15T05:05:55 | 2021-07-15T05:05:55 | 385,847,120 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 631 | swift | //
// MonySlot.swift
// MyVendingMachine
//
// Created by mac on 14/07/2021.
//
import Foundation
import UIKit
class MonySlot{
static let shared2 = MonySlot()
private var Balance : Double = 0.0
public var isValidated : Bool = false
public func setBalance ( Money:Double){
Balance = Money
MyVendingMachine.shared.setTotalBalance(balance: Balance)
}
public func getBalance () -> Double{
return Balance
}
public func Validate (Money:String) -> Bool{/* i will take the money from the user as
a string value
*/
return true
}
}
| [
-1
] |
1ab55427dafb962e96a8fdb5e02b3f9390835ce4 | 6a80d9deb7af614b0cff1967c7037f3df87175f2 | /BlueprintFour/Board.swift | 988acde481430138111e502c2c9bf135d87897a5 | [] | no_license | cassandrakane/Gravity-Four | 747693a7478c99779440b79f6a1d7d8f323519a7 | 60795e2b83051e1bc8510fe0510b93df6028acac | refs/heads/master | 2021-01-20T10:46:06.582423 | 2017-03-05T01:54:32 | 2017-03-05T01:54:32 | 83,937,498 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 8,240 | swift | //
// Board.swift
// BlueprintFour
//
// Created by Cassandra Kane on 2/28/16.
// Copyright © 2016 Cassandra Kane. All rights reserved.
//
import UIKit
let kRows = 7
let kCols = 7
enum BoardOrientation{
case North, East, South, West
func toRight() -> BoardOrientation{
switch self{
case .North:
return .West
case .East:
return .North
case .South:
return .East
case .West:
return .North
}
}
}
enum WinType{
case Horizontal /* anchor on left */ , Vertical , DiagonalLeft, DiagonalRight /*anchor on bottom for other 3*/
}
class Board: UIView {
//data[row][column]
var data: [[Chip]]
var pieces: [Chip]
var orientation: BoardOrientation = .North
var turn: ChipType = .Red
init(){
data = [[Chip]](count: kRows, repeatedValue: [Chip](count: kCols, repeatedValue: Chip.init()))
pieces = [Chip]()
for row in 0..<kRows {
for col in 0..<kCols {
let newChip = Chip(type: .Blank, row: row, col: col)
data[row][col] = newChip
}
}
super.init(frame: CGRectZero)
}
required init?(coder aDecoder: NSCoder) {
data = [[Chip]](count: kRows, repeatedValue: [Chip](count: kCols, repeatedValue: Chip.init()))
pieces = [Chip]()
for row in 0..<kRows {
for col in 0..<kCols {
let newChip = Chip(type: .Blank, row: row, col: col)
data[row][col] = newChip
}
}
super.init(coder: aDecoder)
}
/*required init?(coder aDecoder: NSCoder) {
//fatalError("init(coder:) has not been implemented")
}*/
// (rows, columns)
func currentDimensions() -> (Int, Int){
switch orientation{
case .North,.South:
return (kRows, kCols)
case .East, .West:
return (kCols, kRows)
}
}
//calls dropInColumn w/ current turn then toggles turn (if success)
func playChip(col: Int) -> Chip{
let chip = dropInColumn(col, type: turn)
if chip.type != ChipType.Blank {
turn = turn.toggle()
}
return chip
}
//returns a blank chip if no chip was placed (b/c coords are out of bounds)
func dropInColumn(col: Int, type: ChipType) -> Chip{
let dim: (rows: Int, cols: Int) = currentDimensions()
if col >= dim.cols {
return Chip()
}
for row in 0..<dim.rows{
if data[row][col].type == ChipType.Blank {
let newChip = Chip(type: type, row: row, col: col)
self.data[row][col] = newChip
pieces.append(newChip)
return newChip
}
}
return Chip()
}
func rotateRight(){
let dim: (rows: Int, cols: Int) = currentDimensions()
var newData = [[Chip]](count: kRows, repeatedValue: [Chip](count: kCols, repeatedValue: Chip()))
for row in 0..<dim.rows{
for col in 0..<dim.cols{
newData[dim.rows-1-col][row] = data[row][col]
data[row][col].row = dim.rows-1-col
data[row][col].col = row
}
}
data = newData
orientation = orientation.toRight()
}
func rotateLeft(){
let dim: (rows: Int, cols: Int) = currentDimensions()
var newData = [[Chip]](count: kRows, repeatedValue: [Chip](count: kCols, repeatedValue: Chip()))
for row in 0..<dim.rows{
for col in 0..<dim.cols{
newData[col][dim.cols-1-row] = data[row][col]
data[row][col].row = dim.rows-1-col
data[row][col].col = row
}
}
data = newData
orientation = orientation.toRight().toRight().toRight()
}
func applyGravity() -> [(chip: Chip, oldRow: Int, oldCol: Int)]{
let dim: (rows: Int, cols: Int) = currentDimensions()
var piecesMoved = [(chip: Chip, oldRow: Int, oldCol: Int)]()
for col in 0..<dim.cols {
var nextEmpty: Int = 0
for row in 0..<dim.rows{
if data[row][col].type == .Blank {
continue
}
else{
let oldType = data[nextEmpty][col].type
data[nextEmpty][col].type = data[row][col].type
data[row][col].type = oldType
nextEmpty++
piecesMoved.append((data[nextEmpty][col],row,col))
}
}
}
return piecesMoved
}
func checkWin() -> (chip: Chip, type: WinType){
let dim: (rows: Int, cols: Int) = currentDimensions()
//horizontal:
for row in 0..<dim.rows{
for col in 0...dim.cols-4{
if data[row][col].type == .Blank {continue}
if (data[row][col].type == data[row][col+1].type &&
data[row][col].type == data[row][col+2].type &&
data[row][col].type == data[row][col+3].type){
return (data[row][col], .Horizontal)
}
}
}
//vertical:
for col in 0..<dim.cols{
for row in 0...dim.rows-4{
if data[row][col].type == .Blank {continue}
if (data[row][col].type == data[row+1][col].type &&
data[row][col].type == data[row+2][col].type &&
data[row][col].type == data[row+3][col].type){
return (data[row][col], .Vertical)
}
}
}
//diagonal right:
for col in 0...dim.cols-4{
for row in 0...dim.rows-4{
if data[row][col].type == .Blank {continue}
if (data[row][col].type == data[row+1][col+1].type &&
data[row][col].type == data[row+2][col+2].type &&
data[row][col].type == data[row+3][col+3].type){
return (data[row][col], .DiagonalRight)
}
}
}
//diagonal left:
for col in 3..<dim.cols{
for row in 0...dim.rows-4{
if data[row][col].type == .Blank {continue}
if (data[row][col].type == data[row+1][col-1].type &&
data[row][col].type == data[row+2][col-2].type &&
data[row][col].type == data[row+3][col-3].type){
return (data[row][col], .DiagonalLeft)
}
}
}
return (Chip(), .Horizontal)
}
func encodeBoard() -> String{
let dim: (rows: Int, cols: Int) = currentDimensions()
var p = ""
for row in 0..<dim.rows {
for col in 0..<dim.cols{
switch data[dim.rows-1-row][col].type{
case .Red:
p += " X "
case .Black:
p += " Y "
case .Blank:
p += " . "
}
}
p += "\n"
}
//print(p)
return p
}
func printBoard(){
print(encodeBoard())
}
class func decodeBoard(encoded: String) -> Board{
let b = Board()
var index = 1
for r in 0..<kRows {
for col in 0..<kCols{
//b.data[row][col]
let row = kRows-r-1
switch encoded[encoded.startIndex.advancedBy(index)]{
case "X":
b.data[row][col].type = .Red
case "Y":
b.data[row][col].type = .Black
default:
b.data[row][col].type = .Blank
}
index += 3
}
index += 1
}
return b
}
}
| [
-1
] |
ec61e360427e5883947a251b107cb05be095ca1b | bb6f371833bfdd1ff6d980ab2c30062cb4f17642 | /SwiftUITest/Views/LandmarkDetail.swift | 98d0dd067f9e5f606f41d459251042cdddc5ad74 | [] | no_license | quocnb/SwiftUI-Tutorial | 8e0ce941235013faa4011e493284b30ad2b53488 | 7d4988e1a83c3ea5f6b96c8215017b2421d4d73c | refs/heads/master | 2020-06-15T16:50:46.282892 | 2019-07-24T04:33:16 | 2019-07-24T04:33:16 | 195,346,367 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,842 | swift | //
// LandmarkDetail.swift
// SwiftUITest
//
// Created by Quoc Nguyen on 2019/07/05.
// Copyright © 2019 Quoc Nguyen. All rights reserved.
//
import SwiftUI
struct LandmarkDetail : View {
@EnvironmentObject var userData: UserData
var landmark: Landmark
var landmarkIndex: Int {
userData.landmarks.firstIndex(where: { $0.id == landmark.id })!
}
var body: some View {
VStack {
MapView(location: landmark.locationCoordinate)
.edgesIgnoringSafeArea(.top).frame(height: 300)
CircleImage(image: landmark.image(forSize: 250)).offset(x: 0, y: -130).padding(.bottom, -130)
VStack(alignment: .leading) {
HStack {
Text(landmark.name).font(.title)
Button(action: {
self.userData.landmarks[self.landmarkIndex].isFavorite.toggle()
}) {
if self.userData.landmarks[self.landmarkIndex].isFavorite {
Image(systemName: "star.fill")
.foregroundColor(Color.yellow)
} else {
Image(systemName: "star")
.foregroundColor(Color.gray)
}
}
}
HStack {
Text(landmark.park).font(.caption)
Spacer()
Text(landmark.state).font(.caption)
}
}.padding()
Spacer()
}.navigationBarTitle(Text(landmark.name), displayMode: .inline)
}
}
#if DEBUG
struct LandmarkDetail_Previews : PreviewProvider {
static var previews: some View {
LandmarkDetail(landmark: landmarkData[0]).environmentObject(UserData())
}
}
#endif
| [
286807
] |
de7d5e4ed33ff01cb9203ca97c5e98831c74bf39 | 2a3caa1541c39f83939f43645bcc797bb9b3baad | /Views/CurrencyTextField.swift | 77269ba9a8b4c65646ffa126d066c4091f4d935c | [] | no_license | TiagoSantosSilva/Window-Shopper | 5c201eb6a6be84b4639c13d0b0bfc92ab932916a | 5722fdbf14eadd11d458fd6deaed5097bd56a163 | refs/heads/master | 2021-09-04T05:38:54.690928 | 2018-01-16T11:51:43 | 2018-01-16T11:51:43 | 113,780,014 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,837 | swift | //
// CurrencyTextField.swift
// Window-Shopper
//
// Created by Tiago Santos on 10/12/17.
// Copyright © 2017 Tiago Santos. All rights reserved.
//
import UIKit
@IBDesignable
class CurrencyTextField: UITextField {
override func draw(_ rect: CGRect) {
let size = 20
let currencyLbl = UILabel(frame: CGRect(x: 5, y: Int(frame.size.height / 2) - (size / 2), width: size, height: size))
currencyLbl.backgroundColor = #colorLiteral(red: 0.6000000238, green: 0.6000000238, blue: 0.6000000238, alpha: 0.5)
currencyLbl.textAlignment = .center
currencyLbl.textColor = #colorLiteral(red: 0.2549019754, green: 0.2745098174, blue: 0.3019607961, alpha: 1)
currencyLbl.layer.cornerRadius = 5.0
currencyLbl.clipsToBounds = true
let formatter = NumberFormatter()
formatter.numberStyle = .currency
formatter.locale = .current
currencyLbl.text = formatter.currencySymbol
addSubview(currencyLbl)
}
override func prepareForInterfaceBuilder() {
customizeView()
}
override func awakeFromNib() {
super.awakeFromNib()
customizeView()
}
func customizeView() {
backgroundColor = #colorLiteral(red: 0.9999960065, green: 1, blue: 1, alpha: 0.25)
layer.cornerRadius = 5.0
textAlignment = .center
clipsToBounds = true
self.font = UIFont(name: "Avenir", size: 17.0)
guard let placeholderUnWrapped = placeholder else { return }
let place = NSAttributedString(string: placeholderUnWrapped, attributes: [.foregroundColor: #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)])
attributedPlaceholder = place
textColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
}
}
| [
-1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.