blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 2
625
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
47
| license_type
stringclasses 2
values | repo_name
stringlengths 5
116
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 643
values | visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 80.4k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 16
values | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_language
stringclasses 85
values | src_encoding
stringclasses 7
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 1
class | length_bytes
int64 4
6.44M
| extension
stringclasses 17
values | content
stringlengths 4
6.44M
| duplicates
listlengths 1
9.02k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
52c1fdfd857e20e6a6650806b0754ccff1dd21c0 | 01a4a0fea6c769b73549af87ffc22477aa8e31e8 | /antique/ViewModels/BLEConnection.swift | 37060e228faab91e852daeb9367c76695136fc1b | [] | no_license | vongb/swiftui-pos | 57827eaf78f7f7bb0677441c59a55125a8adb00e | 01d4bfcb02b47941bb03ba4d4ca0c34a8141b55d | refs/heads/master | 2023-02-20T16:26:14.593915 | 2021-01-15T09:36:54 | 2021-01-15T09:36:54 | 233,420,643 | 2 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 5,916 | swift | //
// BLEConnection.swift
// antique
//
// adapted from:
// https://www.raywenderlich.com/231-core-bluetooth-tutorial-for-ios-heart-rate-monitor#toc-anchor-008
// https://stackoverflow.com/questions/31353112/ios-corebluetooth-print-cbservice-and-cbcharacteristic
// https://stackoverflow.com/questions/58239721/render-list-after-bluetooth-scanning-starts-swiftui
//
import Foundation
import UIKit
import CoreBluetooth
open class BLEConnection : NSObject, ObservableObject, CBPeripheralDelegate, CBCentralManagerDelegate {
// Properties
private var centralManager: CBCentralManager!
private var peripheral: CBPeripheral!
private var printingService: CBService!
private var printingCharacteristic: CBCharacteristic!
@Published var connected : Bool = false
@Published var scanning : Bool = false
override init() {
super.init()
centralManager = CBCentralManager(delegate: self, queue: nil)
}
func startScan() {
disconnect()
if centralManager.state == .poweredOn {
centralManager.scanForPeripherals(withServices: nil)
}
scanning = centralManager.isScanning
}
// Reset properties
private func disconnect() {
if self.peripheral != nil {
centralManager.cancelPeripheralConnection(self.peripheral)
}
connected = false
peripheral = nil
printingService = nil
printingCharacteristic = nil
scanning = centralManager.isScanning
}
func stopScan() {
centralManager.stopScan()
scanning = centralManager.isScanning
print(centralManager.isScanning)
}
// Handles BT Turning On/Off
public func centralManagerDidUpdateState(_ central: CBCentralManager) {
switch (central.state) {
case .poweredOn:
break
case .unknown:
print("unknown state")
case .resetting:
print("resetting")
case .unsupported:
print("unsupported")
case .unauthorized:
print("unauthorised")
case .poweredOff:
disconnect()
@unknown default:
disconnect()
}
}
// Handles the result of the scan
public func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
if peripheral.name != nil {
// Only connect to this printer to avoid user error
if peripheral.name == "BlueTooth Printer" {
self.peripheral = peripheral
peripheral.delegate = self
centralManager.connect(self.peripheral, options: nil)
}
}
}
// Fail to connect
public func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) {
print("FAILED TO CONNECT: \(String(describing: error))")
connected = false
scanning = centralManager.isScanning
}
// Handles Connection
public func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {
print("Connected to \(peripheral.name ?? "")")
connected = true
peripheral.discoverServices(nil)
scanning = centralManager.isScanning
}
// On Disconnect
public func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
disconnect()
}
// Search for characteristic
public func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
guard let services = peripheral.services else { return }
for service in services {
peripheral.discoverCharacteristics(nil, for: service)
}
}
// Discover Characteristics
public func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
guard let characteristics = service.characteristics else { return }
for characteristic in characteristics {
// Printing characteristic
if characteristic.uuid.uuidString == "BEF8D6C9-9C21-4C9E-B632-BD58C1009F9F" {
printingCharacteristic = characteristic
stopScan()
}
}
}
// Convert incoming text to bytes (20 byte chunks) and send to printer.
public func sendToPrinter(message: String) {
let data = Data(message.utf8)
// print(message.utf8)
// print(data)
let chunks = splitData(data: data)
chunks.forEach { chunk in
if peripheral != nil && printingCharacteristic != nil {
// print("Chunk: \(chunk.description)")
peripheral.writeValue(chunk, for: self.printingCharacteristic, type: .withoutResponse)
} else {
disconnect()
print("disconnected")
}
}
}
// Splits the data object into 20 byte chunks to avoid overflowing the buffer
private func splitData(data: Data) -> [Data] {
var chunks = [Data]()
let dataSize = data.count
let chunkSize = 20
let fullSizedChunks = dataSize / chunkSize
let totalChunks = fullSizedChunks + (dataSize % chunkSize != 0 ? 1 : 0)
for chunkCounter in 0..<totalChunks {
var chunk : Data
let chunkBase = chunkCounter * chunkSize
var diff = chunkSize
if chunkCounter == totalChunks - 1 {
diff = dataSize - chunkBase
}
let range : Range<Data.Index> = chunkBase..<(chunkBase + diff)
chunk = data.subdata(in: range)
chunks.append(chunk)
}
return chunks
}
}
| [
-1
] |
4cf25797730c0559c2cc4b7c5c24cd34a03ad188 | 81b02ae0ac649a8c9b32315e8dd35bc6281795ca | /MapKitNaja/MapKitNaja/AppDelegate.swift | 8ea2d55047fa1b27fa51655f28e309864ddd6628 | [] | no_license | chaiwatkot/how2mapkitnaja | 1943823b0011c3094200d1aea3cc926f5e28ecc9 | cdaf90d2819dd52e4ed8f5dc2901d0d68f7df37c | refs/heads/master | 2022-04-22T10:16:13.652087 | 2020-04-23T11:22:48 | 2020-04-23T11:22:48 | 257,823,316 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,390 | swift | //
// AppDelegate.swift
// MapKitNaja
//
// Created by CHAIWAT CHANTHASEN on 22/4/2563 BE.
// Copyright © 2563 CHAIWAT CHANTHASEN. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
| [
393222,
393224,
393230,
393250,
344102,
393261,
393266,
163891,
213048,
385081,
376889,
393275,
376905,
327756,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
286831,
368752,
286844,
417924,
262283,
286879,
286888,
377012,
327871,
180416,
377036,
180431,
377046,
377060,
327914,
205036,
393456,
393460,
336123,
418043,
336128,
385280,
262404,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
393538,
262472,
213332,
65880,
262496,
418144,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
328206,
410128,
393747,
254490,
188958,
385570,
33316,
197159,
377383,
352821,
188987,
418363,
369223,
385609,
385616,
352856,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
336512,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
328378,
328386,
352968,
418507,
352971,
352973,
385742,
385748,
361179,
189153,
369381,
361195,
418553,
344831,
336643,
344835,
344841,
336659,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418605,
336696,
361273,
328515,
336708,
328519,
336711,
328522,
336714,
426841,
197468,
254812,
361309,
361315,
361322,
328573,
377729,
222128,
345035,
345043,
386003,
386011,
386018,
386022,
435187,
328702,
328714,
361489,
386069,
336921,
386073,
336925,
345118,
377887,
345133,
345138,
386101,
361536,
197707,
189520,
345169,
156761,
361567,
148578,
345199,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
345267,
386258,
328924,
386285,
328941,
386291,
345376,
345379,
410917,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181649,
181654,
230809,
181670,
181673,
181678,
337329,
181681,
181684,
181690,
361917,
181696,
337349,
181703,
337365,
271839,
329191,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
419362,
394786,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
345701,
394853,
222830,
370297,
353919,
403075,
345736,
198280,
403091,
345749,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
337592,
419512,
337599,
419527,
419530,
419535,
272081,
394966,
419542,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
141051,
337659,
337668,
362247,
395021,
362255,
321299,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
337833,
362413,
337844,
346057,
247759,
346063,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
100453,
329832,
329855,
329867,
329885,
346272,
362660,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
321786,
379134,
411903,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
338211,
248111,
362822,
436555,
190796,
321879,
379233,
354673,
321910,
248186,
420236,
379278,
272786,
354727,
338352,
330189,
338381,
338386,
256472,
338403,
338409,
248308,
199164,
330252,
199186,
330267,
354855,
10828,
199249,
346721,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
264918,
183005,
256734,
338660,
338664,
264941,
363251,
207619,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
330642,
412599,
207808,
379848,
396245,
330710,
248792,
248798,
347105,
257008,
183282,
330748,
330760,
330768,
248862,
396328,
158761,
396336,
199728,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
183383,
339036,
412764,
257120,
265320,
248951,
420984,
330889,
248985,
339097,
44197,
380070,
339112,
249014,
126144,
330958,
330965,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
372015,
372018,
199988,
44342,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
437620,
175477,
249208,
175483,
175486,
249214,
175489,
249218,
249224,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
208311,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
249308,
339420,
249312,
339424,
339428,
339434,
69113,
372228,
339461,
208398,
380432,
175635,
339503,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
224897,
372353,
216707,
339588,
126596,
421508,
224904,
159374,
11918,
339601,
224913,
126610,
224916,
224919,
126616,
208538,
224922,
224926,
224929,
224932,
224936,
257704,
224942,
257712,
257716,
257720,
257724,
257732,
339662,
257747,
224981,
224993,
257761,
224999,
339695,
225020,
339710,
257790,
225025,
257794,
339721,
257801,
257804,
225038,
372499,
167700,
225043,
257819,
225053,
184094,
225058,
339747,
339749,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
397112,
225082,
397115,
225087,
225092,
323402,
257868,
257871,
225103,
397139,
225108,
225112,
257883,
257886,
225119,
257896,
274280,
257901,
225137,
257908,
225141,
257912,
257916,
257920,
339844,
225165,
397200,
225170,
380822,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
405533,
430129,
266294,
266297,
217157,
421960,
356439,
430180,
421990,
266350,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
266453,
225493,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
397571,
389380,
61722,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
250199,
250202,
332125,
250210,
348522,
348525,
348527,
332152,
250238,
389502,
356740,
332172,
373145,
340379,
389550,
266687,
340451,
160234,
127471,
340472,
324094,
266754,
324099,
324102,
324111,
340500,
324117,
324131,
332324,
381481,
324139,
356907,
324142,
356916,
324149,
324155,
348733,
324160,
324164,
356934,
348743,
381512,
324170,
324173,
324176,
389723,
332380,
373343,
381545,
340627,
184982,
373398,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
332493,
357069,
357073,
332511,
332520,
340718,
332533,
348924,
373510,
389926,
152370,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
357211,
430939,
357214,
201579,
201582,
349040,
340849,
201588,
430965,
324472,
398201,
119674,
324475,
340858,
340861,
324478,
324481,
373634,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
422816,
324513,
398245,
201637,
324524,
340909,
324533,
5046,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
349180,
439294,
431106,
209943,
209946,
250914,
357410,
209965,
209968,
209971,
209975,
209979,
209987,
209990,
341071,
349267,
250967,
210010,
341091,
210025,
210027,
210030,
210039,
341113,
210044,
349308,
152703,
160895,
349311,
210052,
210055,
349319,
210067,
210071,
210077,
210080,
210084,
251044,
185511,
210088,
210095,
210098,
210107,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
251128,
218360,
275706,
275712,
275715,
275721,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
365911,
259421,
365921,
333154,
251235,
374117,
333162,
234866,
390516,
333175,
136590,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
415207,
366056,
415216,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
333399,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
153227,
333498,
333511,
210631,
259788,
358099,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
210739,
366387,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
399206,
358255,
399215,
268143,
358259,
341876,
333689,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
358339,
333774,
358371,
350189,
350193,
350202,
333818,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
334011,
260289,
350410,
260298,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
325891,
350467,
350475,
268559,
350480,
432405,
350486,
350490,
325914,
325917,
350493,
350498,
350504,
358700,
350509,
391468,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
416157,
268701,
375208,
326058,
375216,
334262,
334275,
326084,
358856,
334304,
334311,
375277,
334321,
350723,
186897,
342545,
334358,
342550,
342554,
334363,
358941,
350761,
252461,
334384,
383536,
358961,
334394,
252482,
219718,
334407,
334420,
350822,
334465,
334468,
162445,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
334528,
260801,
350917,
391894,
154328,
416473,
64230,
342766,
375535,
203506,
342776,
391937,
326416,
375568,
375571,
162591,
326441,
326451,
326454,
244540,
326460,
375612,
326467,
244551,
326473,
326477,
326485,
416597,
326490,
326502,
375656,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
359366,
326598,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
383997,
261129,
359451,
261147,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
367723,
384107,
187502,
384114,
343154,
212094,
351364,
384135,
384139,
384143,
351381,
384151,
384160,
384168,
367794,
244916,
384181,
384188,
351423,
384191,
384198,
326855,
244937,
384201,
253130,
343244,
384208,
146642,
384224,
359649,
343270,
351466,
384246,
351479,
384249,
343306,
261389,
359694,
253200,
261393,
384275,
384283,
245020,
384288,
245029,
171302,
351534,
376110,
245040,
384314,
425276,
384323,
212291,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
154999,
253303,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
359955,
359983,
343630,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
155322,
425662,
155327,
245460,
155351,
155354,
212699,
245475,
155363,
245483,
155371,
409335,
155393,
155403,
245525,
155422,
360223,
155438,
155442,
155447,
155461,
360261,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
262005,
147317,
425845,
262008,
262011,
155516,
155521,
155525,
360326,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
393169,
384977,
155611,
155619,
253923,
155621,
327654,
253926,
204784,
393203,
360438,
253943,
393206,
393212,
155646
] |
5ad2032d2eae1cb9001479ff85ac7bea14df649c | 39e291712ef45fa23698e1337ecb162a3bc98bc5 | /024_SwiftMemory/SwiftMemory/ViewController.swift | 9920cc005ac5f0788c44132e788a4df8b69f68f7 | [] | no_license | Ai0202/udemy_ios | d39805e41de84e61553dcf9aea79af617a6d6835 | 5a7b382521a48ccf6b10a0f3012a7f8c724d8704 | refs/heads/master | 2020-03-21T09:09:13.067614 | 2018-06-23T08:30:29 | 2018-06-23T08:30:29 | 138,377,721 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 19,415 | swift | //
// ViewController.swift
// SwiftMemory
//
// Created by Atsushi on 2018/06/03.
// Copyright © 2018年 Atsushi. All rights reserved.
//
//FIXME ARが動かない
import UIKit
import Firebase
import CoreLocation
import SDWebImage
import ARCL
import MapKit
class ViewController: UIViewController,
UIImagePickerControllerDelegate,
UINavigationControllerDelegate,
UITableViewDelegate,
UITableViewDataSource,
CLLocationManagerDelegate {
let mapView:MKMapView! = MKMapView()
var sceneLocationView = SceneLocationView()
var nowIdo:Double = Double()
var nowKeido:Double = Double()
var locationManager: CLLocationManager!
var fullName = String()
var posts = [Post]()
var posst = Post()
var pathToImage_Array = [String]()
var address_Array = [String]()
var fullName_Array = [String]()
var postImage_Array = [String]()
var comment_Array = [String]()
var addressforpin_Array = [String]()
var onlyAddress_Array = [String]()
var country:String = String()
var administrativeArea:String = String()
var subAdministrativeArea:String = String()
var locality:String = String()
var subLocality:String = String()
var thoroughfare:String = String()
var subThoroughfare:String = String()
var address:String = String()
var distance = 0
@IBOutlet var tableView: UITableView!
var profileImage:URL!
var passImage:UIImage = UIImage()
var uid = Auth.auth().currentUser?.uid
//AR用
//緯度
var lat_Array = [Double]()
//経度
var long_Array = [Double]()
let refreshControl = UIRefreshControl()
var nowtableViewImage = UIImage()
var nowtableViewUserName = String()
var nowtableViewUserImage = UIImage()
@IBOutlet var idoLabel: UILabel!
@IBOutlet var keidoLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
tableView.delegate = self
tableView.dataSource = self
refreshControl.attributedTitle = NSAttributedString(string: "引っ張って更新")
refreshControl.addTarget(self, action:#selector(refresh), for:UIControlEvents.valueChanged)
tableView.addSubview(refreshControl)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
catchLocationData()
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
self.posts = [Post]()
self.fetchPosts()
self.tableView.reloadData()
self.refreshControl.endRefreshing()
}
}
func catchLocationData(){
if CLLocationManager.locationServicesEnabled() {
locationManager = CLLocationManager()
locationManager.delegate = self
locationManager.startUpdatingLocation()
}
}
//送信時に緯度経度を別枠で送信して、
//pinで指す or AR
//Postsの取得
func fetchPosts(){
let ref = Database.database().reference()
//もしアドレスがDB内にあれば
if self.address != ""{
ref.child("address").child(self.address).queryOrderedByKey().observeSingleEvent(of: .value, with: { (snap) in
let postsSnap = snap.value as? [String : AnyObject]
if postsSnap == nil{
return
}
for (_,post) in postsSnap!{
if let userID = post["userID"] as? String{
self.pathToImage_Array = [String]()
self.address_Array = [String]()
self.fullName_Array = [String]()
self.postImage_Array = [String]()
self.comment_Array = [String]()
self.posst = Post()
if let pathToImage = post["pathToImage"] as? String,let address = post["address"] as? String,let comment = post["comment"] as? String,let fullName = post["fullName"] as? String,let postImage = post["postImage"] as? String
{
self.posst.pathToImage = pathToImage
self.posst.address = address
self.posst.comment = comment
self.posst.fullName = fullName
self.posst.postImage = postImage
self.pathToImage_Array.append(self.posst.pathToImage)
self.address_Array.append(self.posst.address)
self.comment_Array.append(self.posst.comment)
self.fullName_Array.append(self.posst.fullName)
self.postImage_Array.append(self.posst.postImage)
//比較して入れるものを限る
if (self.posst.address == self.address)
{
self.posts.append(self.posst)
self.tableView.reloadData()
}
}
}
}
})
}
}
func addressforPinPost(){
//address以下がないのでそこを改善する
let ref = Database.database().reference()
//もしアドレスがDB内にあれば
if self.address != ""{
ref.child("AddressforPin").queryOrderedByKey().observeSingleEvent(of: .value, with: { (snap) in
let postsSnap = snap.value as? [String : AnyObject]
if postsSnap == nil{
return
}
self.addressforpin_Array = [String]()
for (_,post) in postsSnap!{
if let userID = post["addressforpin"] as? String{
self.posst = Post()
if let addressforpin = post["addressforpin"] as? String{
self.posst.addressforpin = addressforpin
self.addressforpin_Array.append(self.posst.addressforpin)
//重複された内容を消去する
let orderedSet:NSOrderedSet = NSOrderedSet(array: self.addressforpin_Array)
self.onlyAddress_Array = orderedSet.array as! [String]
}
}
}
})
}
}
//TableViewのデリゲートメソッド
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 665
}
//セルの数
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.posts.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
cell.selectionStyle = UITableViewCellSelectionStyle.none
//プロフィール
let profileImageView = cell.viewWithTag(1) as! UIImageView
//ここがstring型ではない可能性があるので注意 SDWebImageを使う
let profileImageUrl = URL(string:self.posts[indexPath.row].pathToImage as String)!
profileImageView.sd_setImage(with: profileImageUrl)
profileImageView.layer.cornerRadius = 8.0
profileImageView.clipsToBounds = true
//ユーザー名
let userNameLabel = cell.viewWithTag(2) as! UILabel
userNameLabel.text = self.posts[indexPath.row].fullName
//投稿画像
let postedImageView = cell.viewWithTag(3) as! UIImageView
let postedImageViewURL = URL(string:self.posts[indexPath.row].postImage as String)!
postedImageView.sd_setImage(with: postedImageViewURL)
//コメント
let commentTextView = cell.viewWithTag(4) as! UITextView
commentTextView.text = self.posts[indexPath.row].comment
return cell
}
func openCamera(){
let sourceType:UIImagePickerControllerSourceType = UIImagePickerControllerSourceType.camera
// カメラが利用可能かチェック
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera){
// インスタンスの作成
let cameraPicker = UIImagePickerController()
cameraPicker.sourceType = sourceType
cameraPicker.delegate = self
self.present(cameraPicker, animated: true, completion: nil)
}
}
func openPhoto(){
let sourceType:UIImagePickerControllerSourceType = UIImagePickerControllerSourceType.photoLibrary
// カメラが利用可能かチェック
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.photoLibrary){
// インスタンスの作成
let cameraPicker = UIImagePickerController()
cameraPicker.sourceType = sourceType
cameraPicker.delegate = self
self.present(cameraPicker, animated: true, completion: nil)
}
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
if let pickedImage = info[UIImagePickerControllerOriginalImage] as? UIImage {
passImage = pickedImage
}
//カメラ画面(アルバム画面)を閉じる処理
picker.dismiss(animated: true, completion: nil)
performSegue(withIdentifier:"next",sender:nil)
}
override func prepare(for segue:UIStoryboardSegue,sender:Any?){
let editVC:EditViewController = segue.destination as! EditViewController
editVC.uid = uid
editVC.profileImage = self.profileImage! as URL
editVC.passImage = passImage
editVC.address = self.address
editVC.fullName = fullName
if CLLocationManager.locationServicesEnabled(){
locationManager.stopUpdatingLocation()
}
}
/*******************************************
//位置情報取得に関するメソッド
********************************************/
func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
switch status {
case .notDetermined:
locationManager.requestWhenInUseAuthorization()
case .restricted, .denied:
break
case .authorizedAlways, .authorizedWhenInUse:
break
}
}
/**********************************
// 位置情報が更新されるたびに呼ばれるメソッド
***********************************/
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
guard let newLocation = locations.last else {
return
}
self.idoLabel.text = "".appendingFormat("%.4f", newLocation.coordinate.latitude)
self.keidoLabel.text = "".appendingFormat("%.4f", newLocation.coordinate.longitude)
nowIdo = newLocation.coordinate.latitude
nowKeido = newLocation.coordinate.latitude
self.reverseGeocode(latitude: Double(idoLabel.text!)!, longitude: Double(keidoLabel.text!)!)
}
// 逆ジオコーディング処理(緯度・経度を住所に変換)
func reverseGeocode(latitude:CLLocationDegrees, longitude:CLLocationDegrees) {
let location = CLLocation(latitude: latitude, longitude: longitude)
let geocoder = CLGeocoder()
geocoder.reverseGeocodeLocation(location, completionHandler: { (placemark, error) -> Void in
let placeMark = placemark?.first
if let country = placeMark?.country {
self.country = country
}
if let administrativeArea = placeMark?.administrativeArea {
self.administrativeArea = administrativeArea
}
if let subAdministrativeArea = placeMark?.subAdministrativeArea {
self.subAdministrativeArea = subAdministrativeArea
}
if let locality = placeMark?.locality {
self.locality = locality
}
if let subLocality = placeMark?.subLocality {
self.subLocality = subLocality
}
if let thoroughfare = placeMark?.thoroughfare {
self.thoroughfare = thoroughfare
}
if let subThoroughfare = placeMark?.subThoroughfare {
self.subThoroughfare = subThoroughfare
}
self.address = self.country + self.administrativeArea + self.subAdministrativeArea
+ self.locality + self.subLocality
})
}
//住所から緯度経度を取得
// ジオコーディング処理(住所を緯度・経度に変換)
func geocode() {
self.sceneLocationView.frame = self.view.bounds
for i in 0..<self.onlyAddress_Array.count {
let address = self.onlyAddress_Array[i]
let geocoder = CLGeocoder()
//ここから非同期
geocoder.geocodeAddressString(address) {
placemarks, error in
let placemark = placemarks?.first
let lat = placemark?.location?.coordinate.latitude
let lon = placemark?.location?.coordinate.longitude
self.lat_Array.append(lat!)
self.long_Array.append(lon!)
//距離に換算
var distance_Array:Array = [Int]()
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
// your code here
//非同期だからiの値は全て入った状態のものになっているからfor文に入った時に配列の中身を超した回数回ってしまう
for q in 0...i {
let nowPlace:CLLocation = CLLocation(latitude: self.nowIdo, longitude: self.nowKeido)
let coordinate = CLLocationCoordinate2D(latitude: self.lat_Array[q], longitude: self.long_Array[q])
let location = CLLocation(coordinate: coordinate, altitude: 300)
self.distance = Int(location.distance(from: nowPlace))
//距離を配列の中に入れて、配列に入れて小さい順に並び替える
distance_Array.append(self.distance)
distance_Array.sort { $0 < $1 }
let image1 = UIImage(named: "\(q)a.png")
//現在地からの距離も出す
let resizeImages = self.resizeUIImageByWidth(image: image1!, width: Double(q*10)+70.0)
let annotationNode1 = LocationAnnotationNode(location: location, image: resizeImages)
self.sceneLocationView.addLocationNodeWithConfirmedLocation(locationNode: annotationNode1)
let closeButton = UIButton()
closeButton.frame = CGRect(x:0, y: self.view.frame.size.height-70, width: 70, height: 70)
closeButton.layer.cornerRadius = 50.0
closeButton.backgroundColor = UIColor.white
closeButton.addTarget(self, action: #selector(self.tap), for: .touchUpInside)
self.sceneLocationView.addSubview(closeButton)
//MapOpenButton
let mapButton = UIButton()
mapButton.frame = CGRect(x:self.view.frame.size.width-70, y: self.view.frame.size.height-70, width: 70, height: 70)
mapButton.layer.cornerRadius = 50.0
mapButton.backgroundColor = UIColor.blue
mapButton.addTarget(self, action: #selector(self.openMap), for: .touchUpInside)
self.sceneLocationView.addSubview(mapButton)
}
self.sceneLocationView.run()
self.view.addSubview(self.sceneLocationView)
}
}
}
}
@objc func refresh(){
posts = [Post]()
fetchPosts()
tableView.reloadData()
refreshControl.endRefreshing()
}
@IBAction func camera(_ sender: Any) {
openCamera()
}
@IBAction func album(_ sender: Any) {
openPhoto()
}
@IBAction func openARCamera(_ sender: Any) {
//Firebaseから全部の住所を取得 ok
addressforPinPost()
//取得した住所を重複なしで緯度経度に変換
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
// your code here
self.geocode()
}
}
@objc func openMap(){
self.sceneLocationView.pause()
self.sceneLocationView.removeFromSuperview()
mapView.frame = self.view.bounds
for i in 0..<lat_Array.count{
lat_Array = lat_Array.sorted { $0 < $1 }
long_Array = long_Array.sorted { $0 < $1 }
/// 以下を追加 ///
let coordinate = CLLocationCoordinate2DMake(lat_Array[i],long_Array[i])
let span = MKCoordinateSpanMake(0.005, 0.005)
let region = MKCoordinateRegionMake(coordinate, span)
mapView.setRegion(region, animated:true)
let annotation = MKPointAnnotation()
annotation.coordinate = CLLocationCoordinate2DMake(lat_Array[i],long_Array[i])
annotation.title = "ここに写真があります。"
annotation.subtitle = "近くに行くとタイムラインから閲覧できます。"
mapView.addAnnotation(annotation)
}
let closeButton = UIButton()
closeButton.frame = CGRect(x:0, y: self.view.frame.size.height-70, width: 70, height: 70)
closeButton.layer.cornerRadius = 50.0
closeButton.backgroundColor = UIColor.white
closeButton.addTarget(self, action: #selector(self.closeMap), for: .touchUpInside)
mapView.addSubview(closeButton)
self.view.addSubview(mapView)
}
@objc func closeMap(){
mapView.removeFromSuperview()
}
@objc func tap(){ // buttonの色を変化させるメソッド
self.sceneLocationView.pause()
self.sceneLocationView.removeFromSuperview()
}
func resizeUIImageByWidth(image: UIImage, width: Double) -> UIImage {
// オリジナル画像のサイズから、アスペクト比を計算
let aspectRate = image.size.height / image.size.width
// リサイズ後のWidthをアスペクト比を元に、リサイズ後のサイズを取得
let resizedSize = CGSize(width: width, height: width * Double(aspectRate))
// リサイズ後のUIImageを生成して返却
UIGraphicsBeginImageContext(resizedSize)
image.draw(in: CGRect(x: 0, y: 0, width: resizedSize.width, height: resizedSize.height))
let resizedImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return resizedImage!
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
-1
] |
8edc74500a71a272096ce8366d52a6fe7edeff2c | a5a98b3cb11cd372a1d9388a7dc6f158bc057900 | /lab3/YuHsuan-Huang_COMP2125-Sec02_Lab03-Exercise01/YuHsuan-Huang_COMP2125-Sec02_Lab03-Exercise01/ViewController/ClientViewController.swift | f6bae8342c792ae2082588c647f859b372af6ebf | [] | no_license | yuhsuanh/MobileDevelopmentUsingSwift | 5b1e0f03ab63ada1227429980fc76c21bf95fd9f | a3a6add4ad5e1bf3e2cc72261658ad5e473a84ad | refs/heads/main | 2023-07-17T04:55:22.600635 | 2021-08-31T01:23:46 | 2021-08-31T01:23:46 | 371,560,898 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,302 | swift | //
// ClientViewController.swift
// YuHsuan-Huang_COMP2125-Sec02_Lab03-Exercise01
//
// Created by Yu-Hsuan Huang on 2021/7/13.
// Copyright © 2021 Georgian College. All rights reserved.
//
import UIKit
class ClientViewController: UIViewController {
var user: String = ""
@IBOutlet weak var projectName: UITextField!
@IBOutlet weak var projectDuration: UITextField!
@IBOutlet weak var projectLocation: UITextField!
@IBOutlet weak var textView: UITextView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func submit(_ sender: UIButton) {
let result:String = "User name: " + user + "\n" + "Project name: " + projectName.text! + "\n" + "Project duration: " + projectDuration.text! + "\n" + "Project Loccation: " + projectLocation.text!
textView.text = result
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
2731d0aa7dd561f2d70c3411740678726baf1ea9 | badb139866febf046a31a8315fd3b73c33a4c3bb | /Week2_1/SwiftFraction2/SwiftFraction2/Fraction2.swift | 9f00895457f24c8abccf5b958eccdbfe59acf05e | [] | no_license | Jaykong/20160229JK | ca1f6f54e877c768725af2d26963aaaf1cf91825 | 4a0df199d0728e4e13a3ef828302050f869fa587 | refs/heads/master | 2016-08-12T20:24:29.971014 | 2016-04-21T02:23:02 | 2016-04-21T02:23:02 | 52,809,334 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 347 | swift | //
// Fraction2.swift
// SwiftFraction2
//
// Created by trainer on 3/7/16.
// Copyright © 2016 traineres. All rights reserved.
//
import Foundation
class Fraction2 {
var numerator = 0
var denominator = 0
func description() {
print("the fraction is \(numerator)/\(denominator)")
}
}
let frac2 = Fraction2()
| [
-1
] |
ca2957b88030ffb51ccc9ccc7584aed57c960ce5 | 3d144a23e67c839a4df1c073c6a2c842508f16b2 | /validation-test/compiler_crashers_fixed/28316-swift-typechecker-checkgenericparamlist.swift | a8ee76cddab1dd47d2b686b91d749329337da46c | [
"Apache-2.0",
"Swift-exception"
] | permissive | apple/swift | c2724e388959f6623cf6e4ad6dc1cdd875fd0592 | 98ada1b200a43d090311b72eb45fe8ecebc97f81 | refs/heads/main | 2023-08-16T10:48:25.985330 | 2023-08-16T09:00:42 | 2023-08-16T09:00:42 | 44,838,949 | 78,897 | 15,074 | Apache-2.0 | 2023-09-14T21:19:23 | 2015-10-23T21:15:07 | C++ | UTF-8 | Swift | false | false | 433 | swift | // This source file is part of the Swift.org open source project
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
// RUN: not %target-swift-frontend %s -typecheck
{class B{init(T)}class T where g:a
| [
74206,
74807,
74941,
74942,
74943,
74945,
74947,
74949,
74950,
74951,
74952,
74953,
74954,
74956,
74958,
74959,
74960,
74961,
74962,
74963,
74964,
74965,
74966,
74967,
74968,
74969,
74970,
74971,
74972,
74973,
74974,
74975,
74976,
74977,
74978,
74979,
74980,
74981,
74982,
74983,
74984,
74985,
74986,
74987,
74988,
74990,
74991,
74992,
74993,
74997,
74999,
75000,
75003,
75004,
75005,
75007,
75008,
75010,
75011,
75012,
75013,
75014,
75015,
75016,
75017,
75018,
75020,
75021,
75022,
75023,
75025,
75026,
75027,
75029,
75030,
75033,
75034,
75035,
75037,
75038,
75039,
75040,
75041,
75042,
75043,
75044,
75045,
75046,
75047,
75049,
75050,
75051,
75052,
75053,
75054,
75055,
75056,
75058,
75063,
75064,
75065,
75066,
75067,
75068,
75069,
75070,
75071,
75072,
75073,
75074,
75075,
75076,
75077,
75078,
75079,
75080,
75081,
75082,
75083,
75084,
75085,
75086,
75087,
75089,
75090,
75092,
75093,
75094,
75095,
75097,
75098,
75100,
75102,
75103,
75104,
75107,
75109,
75110,
75111,
75112,
75113,
75114,
75116,
75117,
75118,
75119,
75120,
75121,
75122,
75123,
75125,
75127,
75128,
75129,
75130,
75131,
75132,
75133,
75134,
75135,
75136,
75137,
75138,
75139,
75140,
75141,
75142,
75143,
75144,
75145,
75147,
75148,
75149,
75150,
75151,
75152,
75153,
75154,
75155,
75157,
75158,
75160,
75163,
75164,
75166,
75167,
75168,
75169,
75170,
75172,
75173,
75174,
75176,
75178,
75179,
75180,
75181,
75182,
75183,
75184,
75185,
75186,
75187,
75188,
75189,
75190,
75191,
75192,
75193,
75194,
75195,
75196,
75198,
75199,
75200,
75201,
75202,
75203,
75204,
75205,
75206,
75207,
75208,
75210,
75211,
75212,
75213,
75214,
75215,
75216,
75217,
75218,
75219,
75220,
75222,
75223,
75224,
75225,
75226,
75227,
75228,
75229,
75230,
75231,
75233,
75235,
75236,
75237,
75238,
75239,
75240,
75241,
75242,
75243,
75245,
75247,
75249,
75250,
75251,
75252,
75253,
75254,
75255,
75256,
75257,
75258,
75259,
75260,
75261,
75262,
75264,
75265,
75266,
75267,
75268,
75269,
75270,
75271,
75273,
75274,
75275,
75276,
75277,
75278,
75279,
75280,
75281,
75282,
75286,
75288,
75289,
75291,
75293,
75294,
75295,
75296,
75297,
75298,
75299,
75301,
75302,
75303,
75304,
75305,
75306,
75307,
75308,
75310,
75312,
75314,
75315,
75316,
75317,
75320,
75321,
75322,
75323,
75324,
75325,
75326,
75327,
75329,
75330,
75331,
75333,
75335,
75337,
75338,
75340,
75341,
75342,
75343,
75346,
75347,
75348,
75349,
75350,
75351,
75352,
75353,
75356,
75357,
75358,
75359,
75360,
75362,
75363,
75364,
75365,
75366,
75367,
75368,
75370,
75371,
75372,
75373,
75375,
75376,
75377,
75378,
75379,
75380,
75382,
75383,
75384,
75385,
75386,
75387,
75388,
75389,
75391,
75392,
75394,
75395,
75396,
75397,
75400,
75401,
75402,
75403,
75404,
75405,
75406,
75407,
75409,
75410,
75411,
75412,
75413,
75414,
75416,
75417,
75418,
75420,
75422,
75424,
75425,
75426,
75427,
75428,
75429,
75430,
75431,
75432,
75435,
75439,
75440,
75441,
75443,
75444,
75445,
75446,
75447,
75448,
75449,
75450,
75454,
75455,
75456,
75457,
75458,
75459,
75461,
75462,
75463,
75464,
75465,
75466,
75467,
75468,
75469,
75470,
75471,
75472,
75473,
75474,
75475,
75476,
75477,
75478,
75479,
75481,
75483,
75484,
75485,
75486,
75487,
75488,
75489,
75491,
75492,
75493,
75494,
75495,
75496,
75497,
75499,
75500,
75502,
75503,
75504,
75505,
75506,
75507,
75508,
75509,
75510,
75513,
75514,
75515,
75516,
75517,
75519,
75520,
75521,
75522,
75523,
75524,
75525,
75526,
75527,
75528,
75529,
75530,
75531,
75532,
75533,
75534,
75535,
75536,
75537,
75538,
75539,
75540,
75541,
75543,
75544,
75545,
75546,
75547,
75548,
75549,
75550,
75553,
75554,
75555,
75556,
75557,
75558,
75559,
75560,
75561,
75562,
75564,
75565,
75566,
75568,
75569,
75570,
75571,
75572,
75573,
75575,
75578,
75579,
75580,
75581,
75582,
75583,
75584,
75585,
75586,
75587,
75589,
75590,
75592,
75593,
75594,
75595,
75596,
75597,
75598,
75599,
75600,
75601,
75602,
75603,
75604,
75605,
75606,
75607,
75608,
75610,
75612,
75613,
75614,
75616,
75618,
75619,
75620,
75621,
75622,
75623,
75625,
75626,
75627,
75628,
75629,
75630,
75631,
75633,
75634,
75635,
75636,
75637,
75638,
75639,
75640,
75641,
75642,
75643,
75645,
75646,
75648,
75649,
75650,
75653,
75655,
75656,
75657,
75658,
75659,
75660,
75661,
75662,
75663,
75664,
75665,
75666,
75670,
75671,
75672,
75674,
75676,
75677,
75678,
75679,
75681,
75682,
75683,
75684,
75685,
75686,
75687,
75688,
75689,
75690,
75691,
75692,
75694,
75696,
75697,
75699,
75700,
75701,
75704,
75705,
75706,
75707,
75708,
75710,
75712,
75713,
75714,
75715,
75716,
75717,
75718,
75719,
75720,
75721,
75722,
75723,
75724,
75726,
75728,
75729,
75731,
75732,
75733,
75734,
75735,
75736,
75737,
75738,
75739,
75740,
75741,
75743,
75744,
75745,
75746,
75747,
75748,
75749,
75751,
75753,
75754,
75755,
75756,
75757,
75758,
75759,
75760,
75761,
75762,
75763,
75764,
75766,
75767,
75768,
75769,
75772,
75773,
75775,
75777,
75778,
75779,
75781,
75782,
75783,
75785,
75786,
75787,
75788,
75789,
75791,
75792,
75793,
75794,
75795,
75796,
75797,
75798,
75800,
75801,
75802,
75803,
75804,
75806,
75810,
75811,
75812,
75813,
75814,
75815,
75816,
75817,
75818,
75819,
75820,
75821,
75822,
75823,
75824,
75825,
75826,
75827,
75828,
75829,
75830,
75831,
75832,
75834,
75835,
75836,
75838,
75839,
75840,
75841,
75842,
75843,
75844,
75845,
75846,
75847,
75848,
75849,
75850,
75851,
75852,
75853,
75854,
75855,
75856,
75857,
75858,
75859,
75860,
75862,
75863,
75864,
75865,
75866,
75867,
75868,
75869,
75872,
75873,
75874,
75875,
75877,
75878,
75879,
75880,
75882,
75884,
75885,
75886,
75887,
75888,
75890,
75892,
75893,
75894,
75895,
75896,
75897,
75898,
75899,
75900,
75901,
75903,
75905,
75906,
75907,
75908,
75909,
75910,
75911,
75912,
75913,
75914,
75915,
75916,
75917,
75918,
75921,
75922,
75923,
75924,
75925,
75926,
75927,
75928,
75929,
75930,
75931,
75932,
75933,
75934,
75935,
75937,
75938,
75939,
75940,
75941,
75943,
75944,
75945,
75946,
75947,
75948,
75949,
75950,
75951,
75952,
75953,
75954,
75955,
75956,
75957,
75958,
75959,
75960,
75961,
75962,
75963,
75964,
75965,
75966,
75967,
75968,
75969,
75970,
75971,
75972,
75973,
75975,
75976,
75977,
75978,
75979,
75980,
75981,
75983,
75985,
75987,
75988,
75989,
75990,
75991,
75993,
75994,
75995,
75996,
75997,
75998,
76001,
76002,
76003,
76004,
76007,
76008,
76009,
76010,
76011,
76012,
76013,
76014,
76015,
76016,
76018,
76019,
76020,
76021,
76022,
76024,
76026,
76027,
76028,
76029,
76030,
76031,
76032,
76035,
76036,
76038,
76039,
76040,
76041,
76042,
76043,
76044,
76045,
76046,
76047,
76048,
76049,
76050,
76051,
76052,
76053,
76054,
76055,
76056,
76058,
76059,
76060,
76061,
76062,
76064,
76065,
76066,
76067,
76068,
76069,
76070,
76071,
76072,
76073,
76075,
76076,
76077,
76078,
76079,
76080,
76081,
76082,
76084,
76085,
76086,
76087,
76089,
76090,
76091,
76092,
76093,
76094,
76095,
76096,
76097,
76098,
76099,
76101,
76102,
76104,
76106,
76107,
76108,
76109,
76110,
76111,
76113,
76116,
76117,
76120,
76121,
76122,
76123,
76124,
76125,
76126,
76127,
76128,
76129,
76130,
76131,
76133,
76134,
76135,
76136,
76137,
76138,
76139,
76140,
76141,
76142,
76143,
76144,
76145,
76146,
76147,
76149,
76150,
76151,
76152,
76153,
76155,
76156,
76157,
76158,
76159,
76160,
76162,
76163,
76165,
76167,
76168,
76169,
76170,
76171,
76172,
76173,
76174,
76175,
76176,
76177,
76179,
76180,
76181,
76182,
76185,
76186,
76187,
76189,
76191,
76192,
76193,
76194,
76195,
76196,
76197,
76198,
76199,
76200,
76201,
76202,
76203,
76204,
76205,
76208,
76209,
76210,
76211,
76213,
76215,
76216,
76217,
76218,
76219,
76220,
76221,
76222,
76223,
76224,
76225,
76226,
76227,
76229,
76232,
76234,
76235,
76236,
76237,
76238,
76239,
76240,
76241,
76242,
76243,
76244,
76247,
76250,
76251,
76252,
76253,
76254,
76255,
76256,
76257,
76259,
76261,
76262,
76263,
76264,
76266,
76267,
76268,
76269,
76270,
76271,
76272,
76273,
76274,
76275,
76276,
76277,
76278,
76279,
76281,
76282,
76283,
76284,
76285,
76286,
76287,
76288,
76290,
76291,
76292,
76293,
76294,
76295,
76296,
76297,
76298,
76299,
76300,
76301,
76303,
76304,
76305,
76306,
76307,
76308,
76309,
76310,
76311,
76313,
76314,
76315,
76316,
76317,
76318,
76319,
76320,
76321,
76322,
76323,
76324,
76327,
76328,
76329,
76330,
76331,
76332,
76333,
76334,
76336,
76337,
76338,
76339,
76341,
76342,
76343,
76344,
76345,
76346,
76347,
76349,
76350,
76351,
76352,
76353,
76354,
76356,
76357,
76358,
76359,
76360,
76362,
76363,
76364,
76365,
76366,
76367,
76368,
76369,
76370,
76371,
76373,
76375,
76376,
76379,
76380,
76381,
76382,
76383,
76384,
76385,
76386,
76388,
76389,
76390,
76391,
76392,
76393,
76395,
76396,
76397,
76398,
76399,
76401,
76402,
76403,
76404,
76405,
76408,
76409,
76410,
76411,
76412,
76413,
76414,
76415,
76417,
76418,
76420,
76422,
76424,
76425,
76426,
76427,
76428,
76429,
76430,
76431,
76433,
76434,
76435,
76436,
76437,
76438,
76439,
76440,
76441,
76442,
76443,
76445,
76446,
76447,
76448,
76449,
76451,
76452,
76453,
76454,
76455,
76456,
76457,
76459,
76460,
76462,
76463,
76464,
76465,
76467,
76468,
76469,
76470,
76471,
76472,
76473,
76475,
76476,
76477,
76479,
76480,
76481,
76482,
76483,
76485,
76486,
76488,
76489,
76490,
76491,
76492,
76494,
76496,
76497,
76498,
76499,
76500,
76501,
76503,
76504,
76505,
76506,
76507,
76508,
76509,
76510,
76511,
76512,
76513,
76514,
76515,
76516,
76517,
76518,
76519,
76521,
76522,
76523,
76524,
76525,
76526,
76527,
76528,
76529,
76530,
76531,
76532,
76533,
76534,
76535,
76536,
76537,
76538,
76539,
76540,
76541,
76542,
76543,
76544,
76545,
76546,
76547,
76548,
76549,
76550,
76552,
76553,
76554,
76555,
76556,
76557,
76558,
76559,
76560,
76561,
76562,
76563,
76564,
76565,
76566,
76567,
76568,
76569,
76572,
76573,
76574,
76575,
76576,
76577,
76578,
76579,
76581,
76582,
76583,
76584,
76585,
76586,
76587,
76588,
76589,
76590,
76591,
76592,
76593,
76594,
76595,
76596,
76597,
76598,
76599,
76600,
76601,
76602,
76604,
76605,
76607,
76608,
76609,
76610,
76611,
76612,
76613,
76614,
76615,
76616,
76618,
76619,
76620,
76621,
76623,
76624,
76625,
76626,
76628,
76630,
76631,
76632,
76633,
76634,
76635,
76636,
76637,
76638,
76640,
76641,
76642,
76643,
76644,
76645,
76646,
76647,
76648,
76649,
76650,
76651,
76653,
76654,
76655,
76657,
76658,
76659,
76660,
76661,
76662,
76663,
76665,
76666,
76667,
76668,
76669,
76670,
76671,
76672,
76673,
76674,
76676,
76678,
76681,
76682,
76683,
76684,
76685,
76687,
76688,
76689,
76690,
76691,
76692,
76693,
76694,
76695,
76696,
76697,
76698,
76699,
76700,
76701,
76702,
76703,
76705,
76706,
76707,
76708,
76709,
76710,
76711,
76712,
76713,
76714,
76715,
76717,
76718,
76719,
76720,
76721,
76722,
76723,
76724,
76725,
76726,
76727,
76728,
76729,
76730,
76731,
76733,
76734,
76735,
76736,
76737,
76738,
76739,
76740,
76741,
76742,
76743,
76744,
76745,
76746,
76748,
76749,
76751,
76752,
76753,
76754,
76755,
76757,
76758,
76759,
76760,
76761,
76762,
76763,
76764,
76765,
76766,
76768,
76770,
76771,
76772,
76773,
76774,
76775,
76776,
76777,
76778,
76780,
76781,
76783,
76784,
76785,
76786,
76787,
76788,
76789,
76790,
76791,
76794,
76795,
76797,
76800,
76801,
76802,
76803,
76804,
76805,
76806,
76807,
76808,
76809,
76810,
76811,
76812,
76813,
76814,
76815,
76816,
76817,
76819,
76820,
76821,
76822,
76823,
76824,
76825,
76826,
76827,
76828,
76829,
76830,
76831,
76832,
76833,
76834,
76835,
76836,
76838,
76841,
76842,
76843,
76844,
76847,
76849,
76851,
76852,
76853,
76854,
76855,
76856,
76857,
76858,
76859,
76862,
76863,
76864,
76865,
76866,
76868,
76871,
76872,
76873,
76874,
76875,
76876,
76877,
76878,
76879,
76880,
76882,
76884,
76885,
76887,
76888,
76889,
76891,
76892,
76895,
76896,
76898,
76899,
76900,
76902,
76903,
76904,
76905,
76906,
76907,
76908,
76909,
76910,
76911,
76912,
76913,
76914,
76915,
76916,
76917,
76918,
76919,
76920,
76921,
76922,
76923,
76924,
76925,
76926,
76927,
76928,
76929,
76930,
76931,
76932,
76933,
76934,
76938,
76940,
76942,
76943,
76944,
76945,
76947,
76948,
76949,
76950,
76951,
76952,
76953,
76954,
76955,
76956,
76957,
76959,
76960,
76961,
76962,
76964,
76965,
76966,
76967,
76968,
76969,
76970,
76971,
76972,
76973,
76974,
76975,
76976,
76979,
76980,
76981,
76983,
76984,
76985,
76986,
76987,
76990,
76991,
76992,
76993,
76994,
76996,
76997,
76999,
77000,
77001,
77003,
77004,
77006,
77007,
77008,
77009,
77010,
77011,
77012,
77013,
77014,
77015,
77017,
77018,
77019,
77020,
77021,
77022,
77023,
77025,
77026,
77028,
77029,
77030,
77031,
77032,
77033,
77034,
77035,
77036,
77037,
77038,
77039,
77040,
77041,
77042,
77043,
77044,
77045,
77046,
77048,
77049,
77050,
77052,
77054,
77055,
77056,
77057,
77058,
77059,
77060,
77061,
77063,
77064,
77065,
77066,
77067,
77068,
77069,
77070,
77071,
77072,
77073,
77074,
77075,
77076,
77077,
77078,
77079,
77082,
77084,
77087,
77088,
77090,
77091,
77093,
77094,
77095,
77096,
77097,
77098,
77100,
77101,
77102,
77103,
77106,
77107,
77108,
77111,
77112,
77113,
77115,
77116,
77117,
77118,
77120,
77121,
77122,
77123,
77124,
77125,
77126,
77127,
77129,
77130,
77131,
77132,
77135,
77136,
77137,
77138,
77139,
77140,
77141,
77143,
77144,
77146,
77147,
77148,
77150,
77151,
77154,
77155,
77156,
77157,
77158,
77159,
77160,
77161,
77162,
77163,
77164,
77165,
77166,
77169,
77170,
77172,
77173,
77175,
77176,
77177,
77179,
77180,
77182,
77183,
77184,
77185,
77186,
77188,
77189,
77190,
77191,
77192,
77193,
77194,
77195,
77196,
77197,
77198,
77200,
77201,
77202,
77203,
77205,
77208,
77209,
77211,
77212,
77213,
77214,
77215,
77216,
77217,
77220,
77221,
77222,
77223,
77225,
77226,
77227,
77228,
77229,
77230,
77231,
77232,
77233,
77234,
77235,
77236,
77237,
77238,
77239,
77240,
77241,
77242,
77243,
77244,
77245,
77246,
77248,
77249,
77252,
77254,
77255,
77256,
77257,
77258,
77259,
77260,
77261,
77262,
77263,
77264,
77265,
77266,
77267,
77268,
77270,
77271,
77272,
77273,
77274,
77275,
77277,
77278,
77280,
77281,
77282,
77284,
77285,
77286,
77287,
77289,
77290,
77291,
77292,
77293,
77294,
77295,
77296,
77297,
77298,
77299,
77300,
77302,
77303,
77305,
77306,
77307,
77310,
77314,
77315,
77317,
77318,
77320,
77321,
77322,
77323,
77325,
77327,
77328,
77329,
77330,
77331,
77332,
77333,
77334,
77335,
77336,
77338,
77339,
77340,
77341,
77342,
77344,
77347,
77348,
77351,
77352,
77355,
77358,
77359,
77360,
77361,
77362,
77363,
77364,
77365,
77366,
77367,
77368,
77369,
77370,
77371,
77373,
77374,
77375,
77377,
77379,
77380,
77381,
77382,
77383,
77384,
77385,
77386,
77387,
77388,
77389,
77390,
77391,
77392,
77393,
77394,
77395,
77396,
77397,
77398,
77399,
77402,
77403,
77404,
77405,
77406,
77408,
77409,
77411,
77412,
77414,
77415,
77416,
77417,
77419,
77420,
77421,
77422,
77423,
77424,
77425,
77426,
77427,
77428,
77429,
77430,
77431,
77432,
77433,
77434,
77435,
77436,
77437,
77439,
77440,
77441,
77442,
77443,
77444,
77445,
77446,
77447,
77448,
77449,
77450,
77451,
77452,
77453,
77454,
77455,
77456,
77457,
77459,
77460,
77461,
77462,
77464,
77465,
77466,
77467,
77468,
77469,
77470,
77471,
77472,
77473,
77474,
77476,
77477,
77478,
77479,
77480,
77483,
77484,
77485,
77486,
77488,
77489,
77490,
77491,
77492,
77493,
77494,
77495,
77496,
77497,
77498,
77499,
77500,
77501,
77502,
77503,
77504,
77505,
77506,
77507,
77508,
77509,
77510,
77511,
77512,
77513,
77514,
77515,
77516,
77517,
77518,
77519,
77520,
77521,
77522,
77523,
77524,
77525,
77526,
77527,
77529,
77530,
77531,
77532,
77534,
77535,
77536,
77537,
77538,
77540,
77542,
77543,
77544,
77545,
77546,
77547,
77548,
77549,
77550,
77551,
77552,
77553,
77554,
77555,
77556,
77557,
77558,
77559,
77560,
77561,
77562,
77563,
77564,
77566,
77567,
77568,
77569,
77570,
77571,
77572,
77573,
77574,
77575,
77576,
77577,
77578,
77579,
77580,
77581,
77582,
77583,
77584,
77585,
77586,
77587,
77588,
77589,
77590,
77591,
77592,
77593,
77594,
77595,
77596,
77597,
77598,
77599,
77601,
77602,
77603,
77606,
77607,
77608,
77609,
77610,
77611,
77612,
77613,
77615,
77616,
77617,
77618,
77619,
77620,
77621,
77622,
77623,
77624,
77626,
77627,
77628,
77629,
77630,
77631,
77632,
77633,
77634,
77635,
77636,
77637,
77638,
77639,
77640,
77642,
77643,
77645,
77646,
77647,
77648,
77649,
77650,
77651,
77653,
77654,
77655,
77656,
77657,
77658,
77659,
77661,
77662,
77663,
77664,
77667,
77668,
77670,
77671,
77672,
77673,
77674,
77675,
77676,
77678,
77679,
77680,
77681,
77682,
77684,
77688,
77689,
77690,
77691,
77692,
77693,
77694,
77695,
77696,
77698,
77699,
77700,
77701,
77702,
77704,
77706,
77707,
77708,
77709,
77710,
77712,
77713,
77714,
77715,
77716,
77717,
77718,
77719,
77720,
77721,
77722,
77723,
77724,
77725,
77727,
77728,
77730,
77731,
77732,
77733,
77734,
77735,
77736,
77737,
77738,
77740,
77741,
77742,
77743,
77744,
77746,
77747,
77749,
77750,
77751,
77752,
77753,
77754,
77755,
77756,
77757,
77758,
77759,
77761,
77763,
77764,
77765,
77766,
77767,
77768,
77769,
77770,
77772,
77773,
77774,
77775,
77777,
77778,
77779,
77780,
77781,
77782,
77783,
77784,
77785,
77786,
77787,
77788,
77789,
77790,
77791,
77792,
77793,
77794,
77795,
77796,
77797,
77798,
77799,
77801,
77803,
77804,
77805,
77806,
77807,
77808,
77809,
77810,
77813,
77814,
77815,
77817,
77818,
77819,
77820,
77822,
77824,
77825,
77826,
77827,
77828,
77829,
77830,
77831,
77832,
77833,
77834,
77835,
77836,
77837,
77838,
77839,
77840,
77841,
77842,
77843,
77844,
77845,
77846,
77847,
77848,
77850,
77851,
77852,
77854,
77855,
77857,
77858,
77859,
77860,
77861,
77862,
77863,
77864,
77865,
77866,
77868,
77869,
77870,
77871,
77872,
77873,
77875,
77876,
77878,
77879,
77880,
77881,
77882,
77883,
77885,
77886,
77887,
77888,
77890,
77891,
77892,
77894,
77895,
77896,
77897,
77898,
77899,
77900,
77903,
77904,
77909,
77910,
77913,
77914,
77915,
77916,
77917,
77918,
77919,
77920,
77921,
77922,
77923,
77925,
77926,
77927,
77929,
77930,
77931,
77932,
77934,
77935,
77936,
77937,
77938,
77939,
77941,
77942,
77943,
77944,
77945,
77949,
77950,
77951,
77952,
77954,
77955,
77956,
77957,
77958,
77959,
77960,
77961,
77962,
77964,
77965,
77966,
77969,
77970,
77971,
77973,
77974,
77975,
77976,
77977,
77978,
77979,
77980,
77982,
77983,
77984,
77986,
77987,
77988,
77989,
77990,
77991,
77992,
77993,
77994,
77995,
77996,
77997,
77998,
77999,
78000,
78001,
78002,
78003,
78004,
78005,
78006,
78007,
78009,
78010,
78011,
78013,
78014,
78015,
78016,
78019,
78021,
78022,
78023,
78024,
78025,
78026,
78028,
78031,
78033,
78034,
78035,
78036,
78037,
78038,
78039,
78040,
78041,
78042,
78045,
78046,
78047,
78048,
78049,
78050,
78051,
78052,
78053,
78054,
78055,
78057,
78058,
78059,
78060,
78061,
78062,
78063,
78065,
78066,
78067,
78068,
78069,
78070,
78071,
78072,
78073,
78074,
78075,
78076,
78077,
78078,
78079,
78080,
78081,
78082,
78083,
78084,
78085,
78086,
78087,
78088,
78089,
78090,
78091,
78092,
78093,
78094,
78095,
78096,
78097,
78098,
78099,
78100,
78101,
78104,
78105,
78106,
78107,
78109,
78110,
78112,
78113,
78114,
78115,
78116,
78118,
78119,
78121,
78122,
78123,
78124,
78126,
78127,
78129,
78130,
78131,
78132,
78133,
78136,
78137,
78138,
78139,
78140,
78141,
78142,
78143,
78144,
78145,
78146,
78147,
78148,
78149,
78150,
78152,
78153,
78154,
78155,
78156,
78157,
78158,
78160,
78161,
78162,
78163,
78164,
78165,
78166,
78169,
78170,
78171,
78172,
78173,
78174,
78176,
78177,
78179,
78181,
78182,
78183,
78184,
78185,
78186,
78187,
78188,
78189,
78190,
78191,
78192,
78193,
78194,
78195,
78197,
78198,
78199,
78200,
78201,
78202,
78203,
78204,
78205,
78206,
78207,
78208,
78209,
78210,
78212,
78213,
78214,
78215,
78216,
78217,
78218,
78219,
78220,
78221,
78222,
78223,
78224,
78226,
78227,
78228,
78230,
78231,
78232,
78234,
78235,
78236,
78237,
78238,
78239,
78240,
78241,
78242,
78243,
78244,
78246,
78247,
78248,
78249,
78250,
78251,
78252,
78253,
78254,
78255,
78256,
78257,
78258,
78259,
78261,
78262,
78263,
78264,
78265,
78266,
78267,
78268,
78269,
78271,
78273,
78275,
78276,
78277,
78278,
78279,
78280,
78281,
78282,
78285,
78286,
78287,
78288,
78289,
78290,
78292,
78293,
78294,
78295,
78296,
78297,
78298,
78299,
78300,
78301,
78304,
78305,
78307,
78308,
78310,
78311,
78312,
78315,
78316,
78317,
78318,
78319,
78320,
78321,
78322,
78323,
78324,
78325,
78326,
78327,
78328,
78330,
78331,
78332,
78333,
78334,
78335,
78336,
78337,
78338,
78339,
78340,
78341,
78342,
78343,
78345,
78346,
78347,
78348,
78349,
78350,
78351,
78352,
78354,
78355,
78356,
78357,
78358,
78359,
78360,
78362,
78363,
78364,
78365,
78366,
78367,
78368,
78369,
78370,
78371,
78372,
78373,
78374,
78375,
78376,
78377,
78378,
78379,
78380,
78381,
78382,
78383,
78386,
78387,
78389,
78390,
78391,
78394,
78395,
78397,
78398,
78399,
78401,
78402,
78404,
78405,
78406,
78407,
78408,
78409,
78410,
78411,
78412,
78413,
78414,
78415,
78416,
78417,
78418,
78419,
78421,
78422,
78423,
78424,
78425,
78426,
78428,
78429,
78430,
78431,
78432,
78434,
78435,
78436,
78437,
78438,
78439,
78440,
78441,
78443,
78444,
78446,
78447,
78448,
78449,
78450,
78451,
78453,
78457,
78458,
78459,
78460,
78462,
78463,
78464,
78465,
78466,
78467,
78468,
78469,
78470,
78471,
78472,
78473,
78476,
78478,
78479,
78480,
78481,
78482,
78484,
78485,
78486,
78487,
78489,
78490,
78491,
78493,
78494,
78495,
78496,
78497,
78498,
78499,
78500,
78501,
78502,
78503,
78504,
78508,
78509,
78510,
78511,
78512,
78513,
78514,
78515,
78516,
78517,
78518,
78519,
78520,
78521,
78522,
78523,
78524,
78525,
78526,
78527,
78528,
78529,
78530,
78531,
78533,
78534,
78536,
78538,
78539,
78540,
78541,
78543,
78544,
78545,
78547,
78548,
78549,
78550,
78551,
78553,
78554,
78555,
78556,
78557,
78558,
78559,
78560,
78561,
78562,
78563,
78564,
78565,
78566,
78567,
78568,
78569,
78570,
78573,
78578,
78579,
78580,
78581,
78582,
78583,
78584,
78587,
78588,
78589,
78591,
78592,
78593,
78594,
78596,
78598,
78600,
78601,
78602,
78603,
78606,
78607,
78608,
78609,
78610,
78611,
78612,
78613,
78614,
78616,
78617,
78619,
78620,
78623,
78624,
78625,
78627,
78628,
78629,
78630,
78632,
78633,
78634,
78635,
78636,
78637,
78638,
78639,
78640,
78641,
78642,
78643,
78644,
78645,
78646,
78647,
78648,
78649,
78650,
78652,
78653,
78655,
78656,
78657,
78658,
78661,
78662,
78663,
78664,
78665,
78667,
78668,
78669,
78670,
78671,
78673,
78675,
78678,
78679,
78681,
78683,
78684,
78685,
78686,
78688,
78689,
78691,
78692,
78694,
78696,
78697,
78698,
78699,
78700,
78701,
78702,
78703,
78704,
78706,
78707,
78708,
78709,
78710,
78711,
78712,
78713,
78714,
78715,
78716,
78717,
78718,
78719,
78720,
78721,
78723,
78724,
78725,
78726,
78727,
78728,
78729,
78730,
78733,
78734,
78735,
78736,
78738,
78739,
78740,
78741,
78743,
78744,
78745,
78746,
78748,
78749,
78750,
78751,
78752,
78753,
78755,
78756,
78757,
78758,
78759,
78760,
78761,
78762,
78763,
78764,
78766,
78767,
78768,
78769,
78770,
78771,
78772,
78773,
78774,
78776,
78777,
78778,
78780,
78781,
78783,
78784,
78785,
78786,
78787,
78788,
78789,
78790,
78791,
78792,
78793,
78794,
78795,
78796,
78797,
78798,
78799,
78800,
78801,
78802,
78803,
78804,
78806,
78807,
78808,
78809,
78811,
78812,
78813,
78814,
78815,
78816,
78817,
78818,
78819,
78820,
78821,
78823,
78824,
78825,
78827,
78828,
78829,
78831,
78832,
78833,
78834,
78835,
78836,
78837,
78838,
78840,
78841,
78842,
78843,
78844,
78845,
78846,
78847,
78848,
78849,
78850,
78851,
78852,
78853,
78854,
78856,
78857,
78858,
78859,
78860,
78861,
78862,
78863,
78864,
78865,
78866,
78868,
78869,
78870,
78871,
78872,
78873,
78874,
78875,
78877,
78878,
78879,
78880,
78881,
78882,
78883,
78884,
78886,
78888,
78889,
78890,
78892,
78893,
78894,
78895,
78896,
78897,
78898,
78899,
78900,
78901,
78903,
78904,
78905,
78906,
78907,
78909,
78910,
78912,
78913,
78914,
78918,
78920,
78921,
78922,
78924,
78925,
78926,
78927,
78928,
78930,
78931,
78933,
78935,
78936,
78937,
78938,
78939,
78941,
78942,
78943,
78944,
78945,
78946,
78947,
78948,
78950,
78952,
78953,
78955,
78956,
78957,
78958,
78959,
78960,
78961,
78962,
78963,
78966,
78967,
78968,
78971,
78972,
78974,
78975,
78976,
78977,
78978,
78979,
78980,
78981,
78982,
78983,
78985,
78986,
78987,
78988,
78989,
78990,
78991,
78992,
78993,
78994,
78995,
78996,
78997,
78999,
79000,
79001,
79002,
79003,
79004,
79005,
79006,
79007,
79008,
79010,
79011,
79012,
79013,
79014,
79015,
79016,
79017,
79018,
79019,
79021,
79022,
79023,
79024,
79025,
79026,
79027,
79028,
79030,
79032,
79033,
79034,
79035,
79036,
79037,
79038,
79039,
79040,
79041,
79042,
79043,
79044,
79045,
79046,
79047,
79048,
79049,
79050,
79051,
79054,
79055,
79057,
79058,
79059,
79060,
79061,
79063,
79064,
79065,
79067,
79068,
79069,
79070,
79071,
79074,
79075,
79076,
79077,
79078,
79080,
79081,
79082,
79083,
79084,
79085,
79086,
79089,
79090,
79091,
79092,
79093,
79094,
79095,
79096,
79097,
79098,
79099,
79100,
79102,
79103,
79104,
79105,
79106,
79107,
79108,
79110,
79111,
79112,
79113,
79114,
79115,
79116,
79117,
79119,
79120,
79121,
79122,
79123,
79125,
79126,
79127,
79128,
79129,
79130,
79131,
79132,
79133,
79134,
79135,
79137,
79138,
79139,
79142,
79143,
79144,
79145,
79146,
79148,
79151,
79152,
79153,
79154,
79155,
79156,
79157,
79158,
79159,
79160,
79161,
79162,
79163,
79164,
79165,
79167,
79169,
79170,
79171,
79172,
79173,
79175,
79176,
79177,
79178,
79179,
79180,
79181,
79182,
79183,
79184,
79185,
79186,
79187,
79188,
79189,
79191,
79192,
79193,
79194,
79196,
79197,
79198,
79201,
79202,
79203,
79204,
79205,
79207,
79208,
79209,
79210,
79212,
79213,
79214,
79215,
79216,
79218,
79219,
79220,
79221,
79222,
79223,
79225,
79226,
79227,
79228,
79229,
79231,
79232,
79233,
79234,
79236,
79237,
79238,
79239,
79240,
79241,
79242,
79243,
79244,
79245,
79246,
79247,
79248,
79249,
79250,
79251,
79252,
79253,
79255,
79256,
79258,
79259,
79260,
79262,
79263,
79264,
79265,
79266,
79267,
79268,
79269,
79270,
79271,
79272,
79274,
79275,
79276,
79277,
79278,
79279,
79281,
79283,
79284,
79285,
79287,
79288,
79289,
79290,
79291,
79292,
79293,
79294,
79295,
79296,
79298,
79299,
79301,
79304,
79305,
79306,
79307,
79308,
79310,
79311,
79312,
79313,
79314,
79315,
79316,
79318,
79319,
79320,
79321,
79322,
79324,
79325,
79327,
79328,
79329,
79330,
79332,
79334,
79336,
79337,
79338,
79339,
79340,
79342,
79344,
79345,
79346,
79347,
79348,
79349,
79350,
79352,
79353,
79354,
79356,
79357,
79358,
79359,
79360,
79361,
79362,
79365,
79366,
79369,
79370,
79371,
79372,
79373,
79374,
79376,
79377,
79381,
79383,
79384,
79385,
79386,
79387,
79388,
79389,
79390,
79391,
79392,
79394,
79395,
79396,
79397,
79398,
79399,
79400,
79401,
79402,
79403,
79404,
79405,
79407,
79408,
79409,
79410,
79411,
79412,
79413,
79414,
79415,
79416,
79417,
79418,
79419,
79420,
79421,
79422,
79423,
79424,
79425,
79426,
79427,
79428,
79429,
79430,
79431,
79432,
79433,
79435,
79438,
79439,
79440,
79441,
79442,
79444,
79445,
79447,
79448,
79449,
79450,
79451,
79452,
79453,
79454,
79455,
79457,
79459,
79460,
79461,
79462,
79464,
79465,
79466,
79467,
79468,
79469,
79470,
79471,
79472,
79473,
79474,
79477,
79478,
79479,
79480,
79481,
79482,
79483,
79484,
79485,
79488,
79489,
79491,
79492,
79493,
79494,
79496,
79497,
79498,
79499,
79500,
79501,
79502,
79505,
79506,
79508,
79509,
79510,
79513,
79514,
79515,
79516,
79517,
79518,
79519,
79520,
79521,
79522,
79523,
79524,
79525,
79526,
79527,
79528,
79529,
79533,
79534,
79535,
79538,
79539,
79540,
79541,
79542,
79543,
79544,
79547,
79548,
79549,
79550,
79551,
79552,
79553,
79555,
79556,
79558,
79560,
79561,
79562,
79563,
79564,
79565,
79566,
79567,
79568,
79569,
79570,
79572,
79573,
79574,
79575,
79576,
79577,
79578,
79579,
79580,
79581,
79582,
79583,
79585,
79587,
79588,
79591,
79592,
79594,
79595,
79596,
79598,
79599,
79600,
79601,
79602,
79603,
79605,
79606,
79608,
79609,
79610,
79611,
79613,
79615,
79616,
79617,
79618,
79619,
79620,
79621,
79622,
79623,
79624,
79625,
79626,
79628,
79629,
79631,
79632,
79633,
79634,
79636,
79637,
79638,
79639,
79640,
79641,
79642,
79643,
79644,
79645,
79646,
79647,
79648,
79649,
79651,
79654,
79655,
79656,
79657,
79658,
79659,
79660,
79661,
79662,
79663,
79665,
79666,
79667,
79668,
79670,
79671,
79672,
79673,
79674,
79675,
79676,
79677,
79678,
79680,
79681,
79682,
79683,
79684,
79685,
79686,
79687,
79688,
79689,
79690,
79692,
79693,
79694,
79697,
79698,
79699,
79700,
79701,
79702,
79704,
79705,
79706,
79707,
79708,
79709,
79710,
79711,
79712,
79713,
79714,
79716,
79717,
79718,
79719,
79720,
79722,
79723,
79724,
79725,
79726,
79727,
79728,
79729,
79730,
79732,
79733,
79734,
79735,
79736,
79738,
79740,
79742,
79743,
79746,
79748,
79749,
79750,
79751,
79752,
79753,
79754,
79755,
79756,
79757,
79758,
79759,
79760,
79761,
79762,
79763,
79764,
79765,
79766,
79767,
79768,
79769,
79770,
79772,
79774,
79775,
79777,
79778,
79779,
79780,
79781,
79782,
79783,
79784,
79785,
79786,
79787,
79788,
79789,
79790,
79791,
79793,
79794,
79795,
79798,
79799,
79800,
79801,
79802,
79803,
79804,
79805,
79808,
79811,
79812,
79813,
79814,
79815,
79816,
79817,
79818,
79819,
79820,
79821,
79822,
79823,
79824,
79825,
79826,
79827,
79828,
79829,
79830,
79831,
79832,
79833,
79835,
79838,
79839,
79840,
79842,
79843,
79844,
79845,
79846,
79847,
79849,
79851,
79855,
79856,
79857,
79858,
79859,
79861,
79862,
79863,
79864,
79865,
79866,
79867,
79869,
79870,
79871,
79872,
79873,
79874,
79875,
79876,
79878,
79879,
79880,
79881,
79882,
79883,
79884,
79885,
79886,
79887,
79888,
79889,
79891,
79892,
79893,
79894,
79895,
79896,
79897,
79898,
79899,
79901,
79903,
79904,
79905,
79907,
79908,
79909,
79910,
79911,
79912,
79913,
79914,
79915,
79916,
79917,
79918,
79919,
79920,
79922,
79923,
79924,
79925,
79926,
79927,
79928,
79929,
79930,
79931,
79932,
79934,
79935,
79936,
79938,
79939,
79940,
79941,
79943,
79944,
79946,
79947,
79948,
79949,
79950,
79951,
79952,
79953,
79955,
79957,
79958,
79959,
79960,
79961,
79962,
79963,
79965,
79966,
79967,
79968,
79969,
79971,
79972,
79973,
79974,
79975,
79976,
79977,
79979,
79981,
79982,
79983,
79984,
79985,
79986,
79987,
79988,
79989,
79990,
79991,
79993,
79994,
79995,
79997,
79998,
79999,
80000,
80002,
80003,
80004,
80005,
80006,
80007,
80008,
80009,
80012,
80013,
80015,
80016,
80017,
80019,
80020,
80021,
80022,
80024,
80026,
80028,
80029,
80030,
80031,
80033,
80034,
80035,
80036,
80037,
80038,
80039,
80040,
80042,
80043,
80044,
80045,
80047,
80048,
80049,
80050,
80051,
80052,
80054,
80055,
80056,
80057,
80058,
80060,
80061,
80062,
80063,
80064,
80065,
80066,
80067,
80069,
80070,
80072,
80073,
80074,
80077,
80078,
80080,
80081,
80082,
80083,
80084,
80085,
80086,
80089,
80090,
80092,
80093,
80094,
80095,
80098,
80099,
80100,
80102,
80103,
80106,
80108,
80109,
80110,
80115,
80116,
80118,
80119,
80120,
80121,
80122,
80124,
80125,
80126,
80127,
80128,
80129,
80130,
80131,
80133,
80134,
80137,
80138,
80139,
80140,
80141,
80142,
80143,
80144,
80146,
80147,
80148,
80149,
80150,
80151,
80152,
80153,
80154,
80155,
80157,
80158,
80159,
80160,
80162,
80163,
80164,
80165,
80166,
80167,
80169,
80170,
80171,
80173,
80174,
80175,
80176,
80178,
80179,
80180,
80181,
80182,
80183,
80184,
80185,
80186,
80189,
80190,
80191,
80192,
80193,
80194,
80195,
80196,
80197,
80198,
80199,
80200,
80201,
80202,
80203,
80205,
80206,
80207,
80208,
80209,
80210,
80211,
80212,
80213,
80214,
80215,
80216,
80217,
80218,
80219,
80220,
80221,
80222,
80223,
80225,
80226,
80227,
80228,
80229,
80230,
80231,
80232,
80233,
80234,
80235,
80237,
80238,
80239,
80242,
80243,
80244,
80245,
80246,
80247,
80248,
80249,
80250,
80252,
80253,
80254,
80255,
80256,
80258,
80259,
80263,
80264,
80266,
80267,
80268,
80270,
80272,
80273,
80275,
80278,
80280,
80281,
80282,
80283,
80284,
80285,
80289,
80290,
80292,
80293,
80294,
80295,
80296,
80297,
80299,
80300,
80301,
80303,
80305,
80306,
80308,
80309,
80311,
80312,
80313,
80314,
80315,
80317,
80318,
80319,
80320,
80321,
80323,
80324,
80325,
80327,
80329,
80330,
80332,
80333,
80335,
80337,
80338,
80339,
80340,
80341,
80342,
80343,
145878,
80344,
80346,
80347,
80348,
80349,
80350,
80351,
80345,
80353,
80354,
80355,
80356,
80357,
80358,
80359,
80362,
80363,
80364,
80365,
80366,
80367,
80368,
80370,
80372,
80374,
80375,
80376,
80377,
80379,
80380,
80381,
80382,
80383,
80384,
80385,
80386,
80388,
80389,
80390,
80391,
80392,
80393,
80394,
80397,
80398,
80399,
80401,
80402,
80403,
80407,
80408,
80409,
80410,
80412,
80413,
80414,
80415,
80417,
80418,
80420,
80421,
80422,
80423,
80424,
80425,
80426,
80427,
80429,
80430,
80431,
80432,
80433,
80434,
80435,
80437,
80438,
80439,
80441,
80443,
80444,
80446,
80447,
80449,
80451,
80452,
80453,
80456,
80457,
80459,
80460,
80461,
80462,
80463,
80464,
80465,
80466,
80467,
80468,
80469,
80470,
80471,
80472,
80473,
80474,
80477,
80478,
80480,
80481,
80483,
80484,
80485,
80487,
80488,
80490,
80491,
80492,
80493,
80495,
80496,
80497,
80498,
80499,
80500,
80501,
80502,
80503,
80504,
80505,
80506,
80507,
80508,
80509,
80510,
80511,
80512,
80513,
80516,
80517,
80519,
80520,
80521,
80522,
80524,
80525,
80526,
80527,
80528,
80529,
80530,
80531,
80532,
80533,
80534,
80535,
80536,
80537,
80538,
80539,
80540,
80541,
80543,
80545,
80548,
80549,
80550,
80551,
80553,
80554,
80555,
80556,
80557,
80558,
80559,
80560,
80561,
80563,
80564,
80565,
80566,
80567,
80568,
80569,
80570,
80571,
80572,
80573,
80574,
80575,
80576,
80577,
80578,
80579,
80580,
80581,
80582,
80583,
80584,
80585,
80586,
80588,
80589,
80590,
80591,
80592,
80593,
80594,
80595,
80597,
80598,
80599,
80600,
80601,
80602,
80603,
80605,
80606,
80607,
88115,
88256,
88631,
88664,
88766,
88776,
88778,
88856,
88858,
88859,
88861,
88862,
88864,
88865,
88866,
88867,
88868,
88870,
88871,
88873,
88874,
88875,
88876,
88877,
88878,
88880,
88881,
88882,
88883,
88886,
88887,
88888,
88889,
88890,
88891,
88892,
88893,
88894,
88895,
88896,
88897,
88898,
88899,
88900,
88901,
88902,
88903,
88904,
88905,
88906,
88907,
88908,
88909,
88911,
88912,
88913,
88914,
88915,
88917,
88918,
88919,
88921,
88922,
88923,
88924,
88925,
91316,
91317,
91351,
91645,
91646,
91647,
91648,
91649,
91650,
91651,
91652,
91653,
91654,
91656,
91657,
91658,
91659,
91660,
91662,
91664,
91665,
91666,
91669,
91670,
91672,
91674,
91675,
91676,
91677,
91678,
91679,
91680,
91681,
91682,
91683,
91684,
91688,
91689,
91690,
91691,
91694,
91695,
91699,
91701,
91702,
91703,
91705,
91706,
91707,
91708,
91711,
91712,
91713,
91715,
91716,
91717,
91721,
91724,
91725,
91726,
91728,
91729,
91730,
91731,
91733,
91734,
91735,
91736,
91738,
91740,
91741,
91742,
91743,
91745,
91746,
91747,
91749,
91753,
91754,
91757,
91758,
91759,
91761,
91762,
91763,
91764,
91765,
91766,
91767,
91768,
91769,
91772,
91774,
91775,
91777,
91779,
91783,
91784,
91785,
91787,
91789,
91792,
91794,
91795,
91796,
91799,
91800,
91802,
91803,
91805,
91806,
91808,
91810,
91811,
91812,
91813,
91815,
91816,
91817,
91818,
91819,
91823,
91824,
91825,
91827,
91828,
91830,
91831,
91832,
91833,
91834,
91835,
91837,
91838,
91840,
91842,
91843,
91844,
91845,
91846,
91847,
91848,
91849,
91850,
91852,
91853,
91854,
91856,
91859,
91860,
91862,
91864,
91865,
91866,
91867,
91868,
91869,
91870,
91871,
91872,
91873,
91874,
91875,
91876,
91879,
91880,
91881,
91882,
91883,
91884,
91885,
91886,
91889,
91890,
91891,
91894,
91895,
91896,
91897,
91898,
91899,
91901,
91902,
91904,
91905,
91906,
91908,
91909,
91914,
91915,
91916,
91917,
91918,
91919,
91920,
91922,
91926,
91927,
91928,
91929,
91930,
91933,
91934,
91935,
91936,
91937,
91939,
91940,
91941,
91943,
91946,
91947,
91949,
91953,
91956,
91957,
91959,
91960,
91962,
91964,
91965,
91966,
91967,
91970,
91972,
91974,
91975,
91976,
91978,
91980,
91981,
91982,
91983,
91987,
91988,
91989,
91995,
91997,
91999,
92000,
92002,
92004,
92005,
92008,
92011,
92012,
92013,
92014,
92016,
92017,
92018,
92019,
92020,
92021,
92023,
92024,
92025,
92028,
92030,
92033,
92035,
92036,
92039,
92040,
92041,
92042,
92043,
92044,
92046,
92047,
92048,
92050,
92051,
92053,
92054,
92055,
92059,
92061,
92062,
92063,
92065,
92066,
92067,
92069,
92071,
92074,
92075,
92077,
92079,
92081,
92082,
92083,
92084,
92085,
92086,
92087,
92088,
92091,
92095,
92096,
92099,
92100,
92101,
92102,
92103,
92104,
92108,
92109,
92111,
92112,
92114,
92115,
92116,
92117,
92119,
92120,
92121,
92123,
92124,
92125,
92126,
92128,
92131,
92136,
92142,
92144,
92146,
92147,
92149,
92150,
92151,
92152,
92153,
92154,
92159,
92160,
92161,
92164,
92165,
92167,
92168,
92169,
92170,
92171,
92172,
92173,
92174,
92175,
92176,
92177,
92178,
92179,
92180,
92181,
92182,
92183,
92184,
92187,
92188,
92189,
92192,
92193,
92194,
92196,
92197,
92198,
92199,
92200,
92201,
92202,
92203,
92204,
92205,
92207,
92208,
92209,
92210,
92211,
92212,
92213,
92214,
92215,
92216,
92217,
92221,
92222,
92223,
92225,
92226,
92227,
92228,
92229,
92231,
92232,
92234,
92235,
92236,
92237,
92238,
92241,
92243,
92244,
92245,
92246,
92247,
92248,
92250,
92252,
92253,
92254,
92256,
92258,
92262,
92264,
92265,
92267,
92268,
92272,
92274,
92275,
92276,
92277,
92278,
92279,
92280,
92281,
92282,
92283,
92285,
92290,
92292,
92293,
92294,
92295,
92296,
92297,
92298,
92299,
92300,
92302,
92303,
92306,
92308,
92311,
92313,
92314,
92315,
92318,
92319,
92320,
92321,
92325,
92326,
92327,
92330,
92332,
92335,
92336,
92339,
92341,
92342,
92346,
92347,
92348,
92349,
92350,
92351,
92352,
92354,
92355,
92357,
92359,
92361,
92362,
92365,
92366,
92367,
92369,
92370,
92371,
92372,
92373,
92376,
92377,
92378,
92379,
92380,
92384,
92385,
92386,
92387,
92388,
92389,
92390,
92391,
92392,
92393,
92394,
92395,
92397,
92398,
92401,
92402,
92403,
92405,
92406,
92408,
92411,
92413,
92414,
92417,
92420,
92421,
92422,
92423,
92425,
92426,
92428,
92429,
92430,
92431,
92434,
92437,
92438,
92439,
92440,
92442,
92443,
92445,
92446,
92447,
92449,
92450,
92451,
92452,
92454,
92455,
92456,
92460,
92461,
92464,
92465,
92466,
92467,
92468,
92469,
92470,
92472,
92473,
92474,
92475,
92476,
92477,
92478,
92479,
92480,
92481,
92482,
92483,
92484,
92485,
92487,
92488,
92490,
92491,
92492,
92493,
92494,
92497,
92498,
92499,
92503,
92504,
92509,
92510,
92511,
92513,
92515,
92517,
92519,
92522,
92524,
92526,
92527,
92528,
92529,
92530,
92533,
92534,
92535,
92536,
92537,
92539,
92542,
92543,
92546,
92548,
92549,
92550,
92551,
92552,
92553,
92554,
92555,
92557,
92558,
92560,
92562,
92563,
92564,
92565,
92566,
92567,
92568,
92569,
92570,
92571,
92572,
92573,
92575,
92576,
92577,
92579,
92580,
92581,
92582,
92583,
92584,
92586,
92587,
92588,
92589,
92590,
92591,
92592,
92593,
92594,
92599,
92600,
92602,
92603,
92604,
92606,
92610,
92611,
92612,
92615,
92617,
92618,
92619,
92620,
92621,
92622,
92626,
92627,
92629,
92630,
92633,
92634,
92635,
92636,
92637,
92638,
92641,
92642,
92644,
92645,
92646,
92647,
92648,
92649,
92650,
92651,
92652,
92653,
92655,
92656,
92657,
92658,
92661,
92663,
92666,
92667,
92668,
92670,
92672,
92675,
92676,
92677,
92678,
92679,
92680,
92681,
92683,
92686,
92687,
92688,
92689,
92691,
92692,
92693,
92694,
92695,
92696,
92698,
92700,
92701,
92702,
92703,
92704,
92705,
92706,
92707,
92709,
92711,
92712,
92715,
92716,
92717,
92719,
92720,
92721,
92722,
92723,
92724,
92726,
92727,
92728,
92729,
92730,
92731,
92732,
92733,
92734,
92735,
92736,
92737,
92739,
92740,
92741,
92742,
92743,
92745,
92746,
92747,
92748,
92753,
92755,
92757,
92759,
92760,
92761,
92762,
92763,
92764,
92765,
92766,
92767,
92770,
92771,
92773,
92774,
92775,
92776,
92778,
92779,
92780,
92781,
92782,
92783,
92784,
92785,
92786,
92787,
92788,
92789,
92790,
92791,
92792,
92795,
92797,
92800,
92802,
92803,
92804,
92805,
92807,
92808,
92809,
92811,
92813,
92818,
92820,
92821,
92822,
92823,
92824,
92825,
92827,
92828,
92830,
92831,
92836,
92837,
92839,
92841,
92843,
92844,
92847,
92848,
92850,
92851,
92852,
92854,
92855,
92856,
92858,
92860,
92863,
92864,
92866,
92868,
92869,
92872,
92873,
92875,
92876,
92877,
92879,
92880,
92881,
92882,
92883,
92884,
92885,
92886,
92888,
92890,
92891,
92892,
92893,
92894,
92897,
92901,
92902,
92903,
92904,
92905,
92906,
92911,
92913,
92914,
92915,
92916,
92918,
92921,
92923,
92925,
92927,
92929,
92930,
92932,
92934,
92935,
92938,
92939,
92941,
92943,
92945,
92946,
92950,
92951,
92952,
92953,
92954,
92955,
92956,
92961,
92962,
92963,
92965,
92966,
92968,
92969,
92971,
92972,
92973,
92975,
92978,
92979,
92980,
92981,
92982,
92983,
92987,
92989,
92991,
92993,
92994,
92995,
92997,
92998,
92999,
93002,
93003,
93006,
93007,
93010,
93013,
93014,
93016,
93017,
93019,
93020,
93021,
93023,
93024,
93025,
93027,
93028,
93030,
93031,
93032,
93035,
93036,
93037,
93039,
93041,
93043,
93044,
93045,
93047,
93048,
93049,
93050,
93052,
93056,
93057,
93058,
93059,
93064,
93065,
93066,
93067,
93069,
93070,
93072,
93074,
93075,
93076,
93077,
93080,
93082,
93086,
93087,
93088,
93089,
93091,
93092,
93093,
93094,
93096,
93097,
93098,
93099,
93100,
93101,
93102,
93103,
93105,
93106,
93107,
93109,
93110,
93112,
93113,
93114,
93115,
93116,
93117,
93118,
93119,
93120,
93121,
93122,
93124,
93126,
93129,
93130,
93134,
93136,
93138,
93139,
93140,
93142,
93143,
93145,
93147,
93148,
93149,
93150,
93151,
93152,
93153,
93154,
93155,
93158,
93160,
93161,
93162,
93164,
93165,
93166,
93167,
93170,
93172,
93173,
93175,
93176,
93178,
93180,
93183,
93185,
93186,
93187,
93189,
93190,
93192,
93193,
93194,
93197,
93198,
93199,
93200,
93205,
93207,
93208,
93210,
93211,
93213,
93214,
93215,
93216,
93217,
93219,
93220,
93221,
93223,
93227,
93228,
93229,
93230,
93232,
93233,
93234,
93235,
93237,
93238,
93239,
93241,
93244,
93246,
93247,
93248,
93249,
93250,
93252,
93254,
93255,
93257,
93258,
93259,
93263,
93265,
93266,
93267,
93268,
93269,
93270,
93271,
93273,
93274,
93275,
93276,
93277,
93278,
93279,
93280,
93281,
93282,
93283,
93284,
93286,
93287,
93289,
93290,
93291,
93292,
93293,
93294,
93295,
93297,
93298,
93301,
93302,
93303,
93305,
93308,
93309,
93310,
93312,
93318,
93319,
93320,
93321,
93322,
93325,
93326,
93328,
93331,
93332,
93333,
93334,
93335,
93336,
93337,
93338,
93339,
93340,
93341,
93342,
93343,
93345,
93346,
93347,
93348,
93350,
93351,
93352,
93353,
93354,
93355,
93356,
93360,
93361,
93362,
93363,
93364,
93365,
93366,
93368,
93372,
93376,
93378,
93380,
93381,
93382,
93383,
93385,
93386,
93387,
93388,
93389,
93390,
93391,
93392,
93394,
93399,
93400,
93401,
93402,
93403,
93404,
93405,
93407,
93411,
93412,
93413,
93415,
93419,
93420,
93422,
93423,
93424,
93428,
93429,
93430,
93431,
93432,
93433,
93434,
93435,
93436,
93437,
93438,
93440,
93441,
93442,
93443,
93444,
93445,
93446,
93447,
93448,
93449,
93450,
93451,
93452,
93453,
93454,
93456,
93458,
93459,
93460,
93464,
93465,
93466,
93468,
93469,
93470,
93471,
93472,
93474,
93475,
93476,
93478,
93479,
93480,
93481,
93483,
93484,
93485,
93486,
93488,
93489,
93490,
93491,
93493,
93494,
93495,
93498,
93499,
93500,
93503,
93504,
93505,
93506,
93509,
93510,
93511,
93513,
93514,
93515,
93518,
93521,
93522,
93524,
93525,
93527,
93530,
93531,
93534,
93537,
93538,
93539,
93541,
93542,
93544,
93546,
93547,
93548,
93549,
93550,
93551,
93552,
93554,
93556,
93557,
93558,
93559,
93560,
93561,
93564,
93565,
93567,
93569,
93570,
93571,
93572,
93573,
93574,
93577,
93578,
93579,
93580,
93582,
93583,
93584,
93585,
93587,
93588,
93590,
93591,
93592,
93595,
93596,
93599,
93600,
93602,
93605,
93606,
93608,
93609,
93610,
93612,
93613,
93614,
93615,
93618,
93623,
93624,
93625,
93627,
93628,
93629,
93630,
93633,
93635,
93636,
93637,
93641,
93642,
93643,
93646,
93648,
93649,
93652,
93654,
93655,
93660,
93661,
93664,
93667,
93668,
93669,
93670,
93671,
93672,
93673,
93675,
93678,
93679,
93681,
93682,
93684,
93685,
93688,
93689,
93691,
93692,
93693,
93694,
93696,
93697,
93698,
93699,
93700,
93701,
93702,
93705,
93707,
93708,
93709,
93714,
93715,
93716,
93718,
93719,
93720,
93721,
93724,
93725,
93727,
93728,
93729,
93730,
93731,
93732,
93735,
93736,
93737,
93738,
93739,
93741,
93742,
93743,
93744,
93745,
93747,
93748,
93750,
93751,
93754,
93756,
93759,
93760,
93762,
93763,
93764,
93765,
93766,
93767,
93768,
93770,
93771,
93772,
93775,
93777,
93778,
93779,
93781,
93782,
93783,
93787,
93788,
93789,
93791,
93792,
93793,
93794,
93796,
93797,
93799,
93800,
93801,
93808,
93809,
93811,
93813,
93814,
93815,
93816,
93818,
93821,
93822,
93823,
93824,
93826,
93827,
93831,
93832,
93833,
93835,
93844,
93846,
93847,
93848,
93849,
93851,
93852,
93854,
93855,
93856,
93857,
93859,
93860,
93861,
93863,
93865,
93866,
93867,
93868,
93870,
93871,
93872,
93874,
93875,
93877,
93878,
93879,
93881,
93882,
93887,
93889,
93890,
93891,
93892,
93894,
93895,
93896,
93899,
93900,
93902,
93903,
93904,
93905,
93907,
93908,
93909,
93911,
93912,
93913,
93914,
93915,
93916,
93917,
93919,
93920,
93921,
93922,
93923,
93925,
93926,
93927,
93928,
93929,
93930,
93931,
93932,
93933,
93934,
93935,
93936,
93937,
93938,
93940,
93941,
93942,
93943,
93944,
93946,
93947,
93948,
93951,
93952,
93953,
93954,
93957,
93958,
93960,
93961,
93962,
93964,
93965,
93966,
93967,
93968,
93970,
93971,
93973,
93974,
93975,
93977,
93978,
93979,
93980,
93982,
93988,
93989,
93991,
93992,
93994,
93995,
94000,
94001,
94004,
94005,
94006,
94007,
94008,
94010,
94012,
94013,
94014,
94015,
94016,
94018,
94019,
94020,
94021,
94022,
94025,
94026,
94027,
94029,
94030,
94031,
94033,
94034,
94035,
94036,
94037,
94038,
94039,
94040,
94041,
94042,
94045,
94046,
94047,
94048,
94049,
94050,
94051,
94053,
94054,
94055,
94056,
94060,
94063,
94064,
94069,
94070,
94071,
94072,
94073,
94074,
94078,
94079,
94080,
94081,
94082,
94083,
94085,
94086,
94088,
94089,
94090,
94092,
94093,
94094,
94095,
94096,
94097,
94099,
94101,
94103,
94104,
94106,
94108,
94109,
94111,
94112,
94114,
94116,
94118,
94122,
94123,
94124,
94127,
94128,
94130,
94133,
94135,
94136,
94138,
94140,
94142,
94146,
94148,
94149,
94150,
94151,
94152,
94154,
94158,
94163,
94164,
94167,
94168,
94170,
94171,
94172,
94173,
94174,
94178,
94179,
94181,
94182,
94183,
94184,
94185,
94186,
94187,
94189,
94190,
94191,
94192,
94195,
94197,
94198,
94199,
94200,
94201,
94202,
94203,
94204,
94205,
94206,
94209,
94211,
94212,
94214,
94215,
94217,
94218,
94220,
94221,
94222,
94224,
94225,
94226,
94228,
94229,
94231,
94232,
94234,
94236,
94237,
94238,
94239,
94241,
94244,
94246,
94250,
94251,
94252,
94253,
94255,
94258,
94260,
94262,
94264,
94265,
94267,
94270,
94271,
94272,
94273,
94274,
94275,
94276,
94277,
94278,
94279,
94281,
94282,
94283,
94284,
94285,
94286,
94287,
94289,
94290,
94292,
94295,
94296,
94298,
94299,
94303,
94304,
94306,
94308,
94309,
94310,
94311,
94315,
94316,
94318,
94319,
94323,
94325,
94326,
94327,
94328,
94330,
94331,
94332,
94334,
94335,
94336,
94337,
94338,
94339,
94340,
94343,
94344,
94349,
94352,
94353,
94354,
94355,
94356,
94358,
94360,
94362,
94363,
94368,
94369,
94372,
94373,
94374,
94375,
94377,
94378,
94379,
94380,
94385,
94386,
94387,
94389,
94390,
94391,
94392,
94393,
94395,
94396,
94397,
94399,
94400,
94401,
94404,
94405,
94406,
94408,
94409,
94410,
94411,
94412,
94413,
94414,
94415,
94416,
94417,
94419,
94420,
94421,
94422,
94424,
94425,
94426,
94430,
94431,
94433,
94434,
94435,
94436,
94437,
94439,
94440,
94441,
94443,
94444,
94445,
94448,
94450,
94451,
94452,
94453,
94455,
94458,
94460,
94461,
94462,
94464,
94466,
94468,
94471,
94472,
94473,
94474,
94475,
94476,
94478,
94480,
94481,
94483,
94484,
94485,
94486,
94488,
94490,
94491,
94492,
94496,
94497,
94498,
94500,
94501,
94502,
94503,
94504,
94506,
94507,
94508,
94509,
94512,
94513,
94514,
94515,
94517,
94518,
94519,
94521,
94524,
94525,
94529,
94531,
94532,
94533,
94534,
94535,
94537,
94539,
94540,
94543,
94544,
94546,
94547,
94548,
94549,
94551,
94552,
94553,
94554,
94556,
94558,
94559,
94560,
94561,
94562,
94563,
94565,
94567,
94568,
94569,
94570,
94572,
94574,
94575,
94578,
94581,
94582,
94583,
94584,
94585,
94589,
94591,
94593,
94596,
94597,
94598,
94601,
94602,
94603,
94604,
94605,
94606,
94607,
94609,
94611,
94613,
94614,
94615,
94616,
94618,
94620,
94622,
94623,
94624,
94625,
94628,
94629,
94630,
94633,
94635,
94636,
94637,
94638,
94640,
94642,
94645,
94646,
94647,
94648,
94649,
94650,
94652,
94653,
94655,
94656,
94657,
94658,
94659,
94660,
94661,
94662,
94663,
94664,
94665,
94666,
94668,
94669,
94670,
94673,
94674,
94676,
94678,
94680,
94682,
94683,
94685,
94686,
94687,
94688,
94691,
94692,
94693,
94695,
94698,
94699,
94700,
94701,
94702,
94703,
94704,
94705,
94708,
94709,
94711,
94712,
94714,
94715,
94716,
94719,
94720,
94721,
94722,
94723,
94725,
94726,
94727,
94729,
94730,
94731,
94733,
94736,
94737,
94738,
94739,
94740,
94741,
94742,
94743,
94744,
94745,
94747,
94748,
94749,
94750,
94753,
94754,
94756,
94757,
94758,
94759,
94760,
94761,
94762,
94764,
94766,
94767,
94768,
94769,
94770,
94771,
94772,
94775,
94776,
94777,
94778,
94779,
94780,
94781,
94785,
94786,
94788,
94789,
94792,
94793,
94795,
94800,
94802,
94804,
94805,
94807,
94808,
94809,
94810,
94811,
94813,
94814,
94815,
94817,
94818,
94819,
94820,
94821,
94822,
94824,
94825,
94826,
94828,
94831,
94832,
94833,
94835,
94836,
94838,
94839,
94840,
94841,
94842,
94843,
94844,
94845,
94846,
94848,
94853,
94855,
94857,
94858,
94859,
94860,
94862,
94863,
94864,
94865,
94866,
94867,
94868,
94870,
94872,
94874,
94877,
94878,
94879,
94880,
94882,
94883,
94884,
94886,
94890,
94891,
94892,
94893,
94894,
94898,
94900,
94901,
94902,
94903,
94904,
94905,
94906,
94907,
94908,
94909,
94910,
94911,
94913,
94914,
94916,
94917,
94918,
94919,
94920,
94921,
94923,
94926,
94927,
94929,
94932,
94933,
94935,
94936,
94937,
94938,
94941,
94942,
94944,
94945,
94946,
94947,
94948,
94949,
94950,
94951,
94952,
94953,
94954,
94955,
94956,
94957,
94960,
94963,
94964,
94965,
94966,
94967,
94968,
94969,
94970,
94971,
94975,
94978,
94980,
94984,
94985,
94986,
94990,
94991,
94992,
94994,
94995,
94996,
94998,
94999,
95001,
95002,
95006,
95007,
95009,
95010,
95011,
95015,
95017,
95019,
95020,
95021,
95022,
95023,
95024,
95025,
95026,
95028,
95030,
95033,
95034,
95035,
95036,
95039,
95041,
95044,
95045,
95046,
95047,
95048,
95049,
95052,
95055,
95056,
95058,
95059,
95061,
95062,
95064,
95067,
95069,
95071,
95072,
95073,
95074,
95076,
95077,
95079,
95080,
95083,
95084,
95086,
95087,
95088,
95091,
95092,
95093,
95095,
95096,
95097,
95099,
95100,
95101,
95102,
95105,
95106,
95107,
95108,
95110,
95111,
95112,
95113,
95115,
95116,
95118,
95120,
95121,
95123,
95124,
95126,
95127,
95128,
95129,
95130,
95131,
95132,
95133,
95134,
95135,
95136,
95137,
95138,
95139,
95142,
95143,
95145,
95146,
95147,
95151,
95152,
95153,
95154,
95155,
95156,
95157,
95159,
95160,
95161,
95162,
95163,
95164,
95165,
95166,
95167,
95168,
95170,
95171,
95172,
95173,
95175,
95176,
95177,
95178,
95179,
95181,
95182,
95183,
95184,
95186,
95187,
95188,
95189,
95191,
95193,
95195,
95196,
95197,
95198,
95199,
95200,
95201,
95203,
95204,
95205,
95206,
95207,
95208,
95209,
95210,
95211,
95212,
95214,
95215,
95216,
95219,
95220,
95221,
95222,
95223,
95224,
95225,
95226,
95227,
95228,
95229,
95231,
95232,
95233,
95234,
95235,
95236,
95238,
95240,
95242,
95244,
95245,
95246,
95248,
95250,
95251,
95252,
95254,
95255,
95256,
95257,
95258,
95260,
95261,
95262,
95264,
95265,
95266,
95267,
95271,
95273,
95278,
95280,
95282,
95284,
95285,
95286,
95287,
95289,
95292,
95294,
95295,
95296,
95297,
95300,
95301,
95302,
95303,
95304,
95308,
95309,
95310,
95312,
95315,
95316,
95318,
95321,
95323,
95326,
95327,
95329,
95331,
95332,
95333,
95334,
95336,
95337,
95338,
95340,
95341,
95343,
95344,
95345,
95346,
95347,
95348,
95349,
95352,
95353,
95354,
95355,
95356,
95357,
95359,
95360,
95361,
95363,
95364,
95365,
95366,
95367,
95368,
95369,
95371,
95372,
95375,
95376,
95377,
95378,
95379,
95380,
95381,
95383,
95386,
95387,
95388,
95390,
95392,
95394,
95395,
95396,
95397,
95400,
95402,
95405,
95406,
95408,
95410,
95411,
95414,
95415,
95417,
95419,
95420,
95421,
95424,
95425,
95426,
95427,
95428,
95431,
95432,
95433,
95434,
95435,
95436,
95438,
95440,
95442,
95443,
95444,
95446,
95448,
95449,
95451,
95452,
95454,
95459,
95461,
95462,
95463,
95464,
95465,
95467,
95468,
95469,
95470,
95473,
95474,
95477,
95478,
95481,
95483,
95486,
95487,
95490,
95494,
95499,
95500,
95501,
95502,
95503,
95504,
95505,
95506,
95507,
95508,
95509,
95510,
95511,
95512,
95514,
95516,
95517,
95519,
95520,
95523,
95524,
95525,
95526,
95528,
95529,
95530,
95531,
95532,
95533,
95535,
95536,
95539,
95540,
95543,
95544,
95545,
95547,
95550,
95552,
95553,
95555,
95559,
95560,
95561,
95563,
95565,
95566,
95567,
95571,
95572,
95574,
95575,
95576,
95577,
95578,
95579,
95580,
95582,
95583,
95584,
95585,
95586,
95587,
95588,
95589,
95590,
95592,
95593,
95595,
95599,
95600,
95601,
95602,
95603,
95604,
95605,
95608,
95609,
95611,
95612,
95614,
95616,
95617,
95618,
95620,
95621,
95622,
95623,
95624,
95625,
95626,
95627,
95629,
95630,
95631,
95632,
95635,
95636,
95637,
95638,
95639,
95642,
95644,
95645,
95646,
95647,
95649,
95653,
95656,
95658,
95660,
95662,
95666,
95667,
95671,
95672,
95673,
95674,
95675,
95676,
95678,
95679,
95681,
95682,
95684,
95685,
95686,
95689,
95693,
95694,
95695,
95696,
95697,
95699,
95704,
95706,
95707,
95709,
95710,
95711,
95712,
95713,
95714,
95715,
95716,
95717,
95718,
95719,
95720,
95721,
95723,
95725,
95726,
95727,
95728,
95732,
95733,
95734,
95735,
95736,
95737,
95739,
95742,
95743,
95744,
95745,
95746,
95747,
95752,
95753,
95754,
95755,
95757,
95762,
95763,
95764,
95766,
95767,
95768,
95770,
95772,
95774,
95775,
95777,
95778,
95779,
95780,
95782,
95783,
95785,
95789,
95790,
95791,
95792,
95793,
95794,
95795,
95797,
95801,
95803,
95804,
95805,
95806,
95808,
95809,
95810,
95811,
95812,
95813,
95816,
95817,
95819,
95820,
95823,
95824,
95825,
95827,
95828,
95829,
95830,
95831,
95832,
95833,
95834,
95835,
95836,
95839,
95841,
95842,
95843,
95844,
95845,
95848,
95849,
95850,
95851,
95852,
95853,
95854,
95857,
95858,
95859,
95860,
95861,
95862,
95864,
95865,
95866,
95867,
95869,
95870,
95871,
95872,
95875,
95877,
95878,
95879,
95880,
95881,
95882,
95884,
95885,
95888,
95889,
95892,
95893,
95897,
95899,
95900,
95902,
95903,
95906,
95907,
95909,
95910,
95912,
95914,
95915,
95917,
95919,
95921,
95922,
95923,
95924,
95925,
95926,
95927,
95928,
95931,
95932,
95934,
95935,
95936,
95938,
95939,
95940,
95942,
95944,
95945,
95946,
95947,
95948,
95949,
95951,
95954,
95955,
95956,
95957,
95958,
95959,
95960,
95962,
95963,
95965,
95966,
95967,
95968,
95970,
95971,
95974,
95975,
95976,
95977,
95979,
95981,
95983,
95985,
95986,
95987,
95988,
95990,
95991,
95992,
95996,
95997,
95998,
95999,
96001,
96002,
96003,
96004,
96005,
96006,
96008,
96009,
96012,
96013,
96014,
96015,
96017,
96018,
96019,
96020,
96021,
96022,
96024,
96027,
96028,
96029,
96030,
96033,
96035,
96036,
96037,
96038,
96041,
96044,
96045,
96046,
96047,
96049,
96050,
96052,
96053,
96054,
96056,
96057,
96058,
96059,
96060,
96062,
96064,
96066,
96067,
96070,
96071,
96072,
96074,
96075,
96077,
96081,
96082,
96084,
96085,
96088,
96089,
96091,
96092,
96093,
96094,
96097,
96100,
96101,
96103,
96106,
96107,
96109,
96110,
96111,
96115,
96116,
96117,
96118,
96119,
96121,
96126,
96128,
96129,
96131,
96132,
96133,
96135,
96137,
96141,
96144,
96145,
96147,
96149,
96150,
96151,
96154,
96155,
96157,
96158,
96159,
96161,
96162,
96163,
96164,
96165,
96166,
96168,
96169,
96170,
96173,
96174,
96175,
96176,
96177,
96178,
96179,
96180,
96183,
96184,
96185,
96187,
96188,
96189,
96190,
96191,
96192,
96193,
96194,
96195,
96196,
96197,
96198,
96201,
96202,
96203,
96205,
96207,
96208,
96209,
96210,
96212,
96213,
96216,
96218,
96220,
96221,
96224,
96225,
96226,
96229,
96231,
96233,
96234,
96235,
96236,
96237,
96238,
96241,
96242,
96243,
96244,
96246,
96247,
96248,
96249,
96251,
96255,
96256,
96257,
96258,
96260,
96261,
96263,
96264,
96269,
96270,
96271,
96273,
96274,
96275,
96276,
96277,
96278,
96279,
96281,
96284,
96285,
96286,
96287,
96288,
96289,
96290,
96292,
96294,
96296,
96297,
96298,
96300,
96302,
96305,
96308,
96312,
96314,
96315,
96317,
96318,
96319,
96324,
96325,
96326,
96327,
96329,
96330,
96332,
96334,
96337,
96338,
96340,
96341,
96342,
96344,
96345,
96348,
96349,
96353,
96354,
96357,
96358,
96359,
96361,
96362,
96368,
96369,
96370,
96371,
96372,
96374,
96376,
96377,
96378,
96380,
96381,
96382,
96383,
96384,
96385,
96386,
96389,
96390,
96393,
96394,
96395,
96396,
96397,
96400,
96403,
96405,
96406,
96407,
96408,
96409,
96410,
96411,
96412,
96413,
96414,
96416,
96417,
96418,
96419,
96420,
96421,
96423,
96424,
96425,
96427,
96428,
96429,
96430,
96432,
96433,
96434,
96435,
96436,
96437,
96438,
96440,
96443,
96444,
96445,
96446,
96449,
96450,
96451,
96452,
96453,
96456,
96457,
96458,
96459,
96461,
96462,
96463,
96464,
96465,
96466,
96467,
96468,
96469,
96470,
96471,
96472,
96473,
96476,
96477,
96478,
96480,
96481,
96483,
96485,
96488,
96489,
96490,
96493,
96494,
96495,
96496,
96498,
96499,
96501,
96504,
96506,
96508,
96510,
96511,
96512,
96514,
96516,
96517,
96518,
96519,
96524,
96525,
96527,
96528,
96533,
96535,
96536,
96537,
96538,
96540,
96542,
96543,
96544,
96546,
96548,
96549,
96551,
96552,
96554,
96555,
96556,
96557,
96559,
96560,
96561,
96562,
96563,
96565,
96566,
96568,
96570,
96571,
96573,
96576,
96578,
96579,
96580,
96581,
96582,
96583,
96584,
96585,
96586,
96587,
96590,
96591,
96592,
96596,
96598,
96601,
96602,
96603,
96604,
96606,
96607,
96608,
96609,
96611,
96612,
96613,
96614,
96615,
96617,
96618,
96620,
96621,
96622,
96625,
96626,
96627,
96628,
96629,
96630,
96631,
96632,
96635,
96636,
96637,
96639,
96641,
96644,
96645,
96646,
96648,
96649,
96650,
96651,
96653,
96654,
96656,
96657,
96660,
96662,
96664,
96665,
96666,
96667,
96668,
96669,
96670,
96672,
96673,
96674,
96676,
96680,
96681,
96682,
96684,
96686,
96687,
96691,
96692,
96695,
96699,
96700,
96701,
96702,
96703,
96704,
96705,
96706,
96707,
96711,
96713,
96714,
96716,
96718,
96720,
96721,
96723,
96724,
96726,
96728,
96729,
96731,
96732,
96733,
96735,
96736,
96737,
96738,
96739,
96740,
96741,
96742,
96744,
96746,
96747,
96749,
96751,
96752,
96754,
96755,
96756,
96757,
96759,
96761,
96762,
96765,
96766,
96770,
96774,
96777,
96778,
96779,
96782,
96783,
96785,
96787,
96788,
96791,
96792,
96793,
96794,
96796,
96797,
96798,
96799,
96800,
96801,
96803,
96805,
96806,
96807,
96809,
96812,
96813,
96815,
96816,
96817,
96818,
96819,
96821,
96822,
96824,
96825,
96826,
96828,
96830,
96831
] |
760eca77fd64c8256c164e8ba5d88f994c52bafb | 21e403aa785692984792b1fea4b20d3a8ee29690 | /My to do list/Data Model/Category.swift | f762ef725ae18c4c88b2b326c686d743454adec2 | [] | no_license | Blackthornn/My-to-do-list | 5e05674053be658b3910ffde7abaef4fba97f36d | 9ed54ba4c5c6fd2b948b8a2fd9ac8285110bfa28 | refs/heads/master | 2020-04-24T17:46:11.185032 | 2019-02-28T22:41:18 | 2019-02-28T22:41:18 | 172,158,238 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 318 | swift | //
// Category.swift
// My to do list
//
// Created by Emeka on 28/02/2019.
// Copyright © 2019 The Blackthorn. All rights reserved.
//
import Foundation
import RealmSwift
class Category: Object {
@objc dynamic var name: String = ""
@objc dynamic var colour: String = ""
let items = List<Item>()
}
| [
303387
] |
07fca09ab194a1481a4a05c498329946d25040bc | aed157aa3458afe840c5274bad486e47d01f91b1 | /source/UI/UIHelper.swift | f4fb5e47ee5623ec826554c5fa5cc8871cd1ef21 | [] | no_license | jovirus/BLEScanner | b2b136070b27d636229ab6cac1b1f80cbfb0ec82 | c068166b0e078a5083ae8e104ea8c45be0ce150d | refs/heads/master | 2022-06-22T01:57:54.597618 | 2018-02-08T10:17:36 | 2018-02-08T10:17:36 | 120,624,876 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,249 | swift | //
// UIHelper.swift
// MasterControlPanel
//
// Created by Jiajun Qiu on 21/03/16.
// Copyright © 2016 Jiajun Qiu. All rights reserved.
//
import Foundation
import UIKit
open class UIHelper
{
static let screenSize = UIScreen.main.bounds.size
static let screenRect = UIScreen.main.bounds
static let screenWidth = screenSize.width
static let screenHeight = screenSize.height
static fileprivate var counter = 0
static fileprivate var colors: [UIColor] = [UIColor.init(hexString: "FF0000"),
UIColor.init(hexString: "2323F1"),
UIColor.init(hexString: "C8841A"),
UIColor.init(hexString: "27C32B"),
UIColor.init(hexString: "45A1FF"),
UIColor.init(hexString: "ACB117"),
UIColor.init(hexString: "B1179D"),
UIColor.init(hexString: "DCE31F"),
UIColor.init(hexString: "47392D"),
UIColor.init(hexString: "1AC8B1"),
UIColor.init(hexString: "A42A2A"),]
static func getRandomDeviceColorTag() -> UIColor {
var color: UIColor!
var colorPointer = 0
colorPointer = Int.random(0, upper: self.colors.count - 1)
color = colors[colorPointer]
return color
}
static func getSequencedDeviceColorTag() -> UIColor {
let colorIndex = counter%colors.count as Int
let color = colors[colorIndex]
self.counter += 1
return color
}
static func resetColorCounter() {
self.counter = 0
}
static func resizeImage(image: UIImage, newWidth: CGFloat) -> UIImage {
let scale = newWidth / image.size.width
let newHeight = image.size.height * scale
UIGraphicsBeginImageContext(CGSize(width: newWidth, height: newHeight))
image.draw(in: CGRect(x: 0, y: 0, width: newWidth, height: newHeight))
let newImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return newImage!
}
}
| [
-1
] |
8971bead18ff1a1ecaaf7029ac2866649110a0f0 | 07e9a1e922c13e6a38dd5aad3fa2ec659976083e | /AddingShortcutsForWindDown/BedtimeKit/SoundLibraryDataManager+Intents.swift | 3329ff07c8b862b01c7f8214b7827dd92c74f99d | [] | no_license | rethrows/wwdc20-samplecode | 77c2fd9e1678ba48aaef071f22bd53956bb92f75 | 8cceefdabad4e0620bbd530ef05ff7b4ecb89cfa | refs/heads/master | 2022-11-05T18:02:12.774323 | 2020-06-23T10:57:36 | 2020-06-23T10:57:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,247 | swift | /*
See LICENSE folder for this sample’s licensing information.
Abstract:
An extension to `SoundLibraryDataManager` to group all functionality related to the Intents framework together.
*/
import Foundation
import Intents
import os.log
extension SoundLibraryDataManager {
/// Provides shortcuts for featured soundscapes the user may want to play.
/// The results of this method are visible in the Health app.
func updateBedtimeShortcutSuggestions() {
let newMediaIntents = soundLibrary.soundscapes.reduce([INShortcut]()) { (partialResult, container) -> [INShortcut] in
let playMediaIntent = INPlayMediaIntent(mediaItems: nil,
mediaContainer: container.mediaItem,
playShuffled: false,
playbackRepeatMode: .none,
resumePlayback: false)
playMediaIntent.shortcutAvailability = .sleepMusic
playMediaIntent.suggestedInvocationPhrase = "Play \(container.containerName)"
guard let mediaShortcut = INShortcut(intent: playMediaIntent) else { return partialResult }
let results = partialResult + [mediaShortcut]
return results
}
INVoiceShortcutCenter.shared.setShortcutSuggestions(newMediaIntents)
}
/// Inform the system of what media the user asked to play.
public func donatePlayRequestToSystem(_ request: PlayRequest) {
let interaction = INInteraction(intent: request.intent, response: nil)
/*
Set the groupIdentifier to be the container's ID so that all interactions can be
deleted with the same ID if the user deletes the container.
*/
interaction.groupIdentifier = request.container.itemID.uuidString
interaction.donate { (error) in
if error != nil {
guard let error = error as NSError? else { return }
os_log("Could not donate interaction %@", error)
} else {
os_log("Play request interaction donation succeeded")
}
}
}
}
| [
-1
] |
8fa08b20fd5af2eeb170b9792b4e93c108d24d5d | 68ccd1c951e2ec045a22b7518ad69f596aa61850 | /Pizza Napples/Model/Calculator Model/CalculatorItem.swift | 58de41550b09bfdfe2822ecf9e0654b872aa4310 | [] | no_license | PawelMP/Pizza-Napples | 0788abb1be310b1a969b67a24a5e1f022e1bd65e | 907d74181cc62ca922c1f3cc33876ee76bce9f2e | refs/heads/main | 2023-03-23T01:59:40.235477 | 2021-03-18T22:55:15 | 2021-03-18T22:55:15 | 336,861,194 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 437 | swift | //
// CalculatorItem.swift
// Pizza Napples
//
// Created by Paweł Pietrzyk on 19/01/2021.
// Copyright © 2021 Paweł Pietrzyk. All rights reserved.
//
import Foundation
//Struct for dough tableView cell data
struct CalculatorItem {
let description: String
let placeholder: String
let error: String
var amount: Int?
let minValue: Int?
var maxValue: Int?
var isValueCorrect: Bool
}
| [
-1
] |
aca94d31ec8c6da982498ef578cedbb8e0a67ed1 | 1ce0a9a6abea52214641b5c5133968b2d1c885b6 | /ListView/ListView/Contact.swift | 28b6c461ec96dd356504d6227bbe75e462abbc92 | [] | no_license | iamEtornam/LearningSwiftUI | 408f09900d213c2f32f4b1f1f9379f654c53f3ab | d0d3ce6dbd5bb6239457a78a2e9b75a7c2e49fb8 | refs/heads/master | 2022-04-07T19:59:25.071984 | 2020-01-14T13:13:25 | 2020-01-14T13:13:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,514 | swift | //
// Contact.swift
// ListView
//
// Created by Etornam Sunu on 13/01/2020.
// Copyright © 2020 Etornam Sunu. All rights reserved.
//
import Foundation
import SwiftUI
struct Contact:Identifiable {
let id = UUID()
let imageName:String
let name:String
let phone:String
let email:String
let address:String
}
let contacts = [
Contact(imageName: "etornam", name: "Bright E. Sunu", phone: "+233(245)-436757", email: "[email protected]", address: "242 Wildrose River 16040 Louisiana"),
Contact(imageName: "person_1", name: "Holly F. Huey", phone: "+1(242)-8110134", email: "[email protected]", address: "242 Wildrose River 16040 Louisiana"),
Contact(imageName: "person_2", name: "Rose Acker", phone: "+1(656)-1881047", email: "[email protected]", address: "249 Modoc Half 75290 Michigan"),
Contact(imageName: "person_3", name: "Leonardo Longnecker", phone: "+1(545)-3442899", email: "[email protected]", address: "952 Baker Haggerty 90562 Missouri"),
Contact(imageName: "person_4", name: "Quentin F. Joplin", phone: "+1(434)-7448466", email: "[email protected]", address: "176 Flanigan Road 49223 Mississippi"),
Contact(imageName: "person_5", name: "Christine Clapper", phone: "+1(141)-5115553", email: "[email protected]", address: "635 Prospect River 58641 Kansas"),
Contact(imageName: "person_3", name: "Joy Cordon", phone: "+1(353)-0663954", email: "[email protected]", address: "763 University Trail 81701 Wisconsin")
]
| [
-1
] |
501819b329fc8c24cd0b2431a7976ce0a1b8baf1 | 4818d123f37331b2bc293830ec7b52bb4b524395 | /player/data/audio/RadioStreamsProviderProtocol.swift | 3837feb06c45f32bf772d7a4eb0ab1ab7d33024b | [] | no_license | abcdeiko/simple_player_mvvm | 28552091c69c86b36ac083ee8398e21eb5865d39 | c91973099e089d87ffda33d06cee908f0bdc80f9 | refs/heads/master | 2020-04-22T23:02:39.773854 | 2019-03-10T16:34:01 | 2019-03-10T16:34:01 | 170,727,461 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 281 | swift | //
// RadioStreamsProviderProtocol.swift
// player
//
// Created by Yuriy on 24/02/2019.
// Copyright © 2019 kbshko. All rights reserved.
//
import Foundation
import RxSwift
protocol RadioStreamsProviderProtocol {
func getAudioList() -> Observable<[RadioStreamModel]>
}
| [
-1
] |
319c8aa7cccbdbd75fc3265f77ddd4579c28abb3 | 988886876ae952274fbc7728a67a04425b499dbb | /Project2/AppDelegate.swift | 4128592c40d34898533a339ed4d99828d99490a5 | [] | no_license | ebotsupreme/randomFlags | 69019e4fc62347f7469ac287f49aaec147261362 | dd2d02ad513cff286f54ad17034913027950ab5b | refs/heads/main | 2023-07-17T18:21:44.752864 | 2021-08-26T22:39:32 | 2021-08-26T22:39:32 | 393,107,961 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,345 | swift | //
// AppDelegate.swift
// Project2
//
// Created by Eddie Jung on 7/30/21.
//
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
| [
393222,
393224,
393230,
393250,
344102,
393261,
393266,
213048,
385081,
376889,
393275,
376905,
327756,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
286831,
368752,
286844,
417924,
262283,
286879,
286888,
377012,
164028,
327871,
180416,
377036,
180431,
377046,
418007,
418010,
377060,
327914,
205036,
393456,
393460,
418043,
336123,
385280,
336128,
262404,
164106,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
393538,
262472,
344403,
213332,
65880,
262496,
418144,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
262566,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
410128,
393747,
254490,
188958,
385570,
33316,
377383,
197159,
352821,
197177,
418363,
188987,
369223,
385609,
385616,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
328378,
164538,
328386,
344776,
352968,
352971,
418507,
352973,
385742,
385748,
361179,
189153,
369381,
361195,
418553,
344831,
344835,
336643,
344841,
361230,
336659,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
361288,
336711,
328522,
336714,
426841,
197468,
254812,
361309,
361315,
361322,
328573,
377729,
369542,
361360,
222128,
345035,
386003,
345043,
386011,
386018,
386022,
435187,
328714,
361489,
386069,
386073,
336921,
336925,
345118,
377887,
345133,
345138,
386101,
361536,
197707,
189520,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
345267,
386258,
328924,
66782,
222437,
386285,
328941,
386291,
345376,
353570,
345379,
410917,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181654,
230809,
181670,
181673,
181678,
181681,
337329,
181684,
181690,
361917,
181696,
337349,
181703,
271839,
329191,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
394853,
345701,
222830,
370297,
403070,
353919,
403075,
345736,
198280,
403091,
345749,
419483,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
419512,
337592,
419517,
337599,
419527,
419530,
419535,
272081,
394966,
419542,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
337659,
141051,
337668,
362247,
395021,
362255,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
345930,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
354150,
354156,
345964,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
337833,
362413,
337844,
346057,
346063,
247759,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
100453,
329832,
329855,
329885,
411805,
346272,
362660,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
321786,
379134,
411903,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
338211,
395566,
248111,
362822,
436555,
190796,
379233,
354673,
248186,
420236,
379278,
272786,
354727,
338352,
338381,
330189,
338386,
256472,
338403,
338409,
248308,
199164,
330252,
199186,
420376,
330267,
354855,
10828,
199249,
346721,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
338660,
338664,
264941,
363251,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
355218,
330642,
412599,
207808,
379848,
396245,
330710,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
347176,
396328,
158761,
199728,
396336,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
412764,
339036,
257120,
265320,
248951,
420984,
330889,
347287,
248985,
339097,
44197,
380070,
339112,
249014,
126144,
330958,
330965,
265432,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
347437,
372015,
347441,
372018,
199988,
44342,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
249214,
175486,
175489,
249218,
249224,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
208311,
388542,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
339420,
249308,
339424,
249312,
339428,
339434,
249328,
69113,
372228,
208398,
380432,
175635,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
372353,
224897,
216707,
421508,
126596,
224904,
224909,
11918,
159374,
224913,
126610,
224916,
224919,
126616,
208538,
224922,
224926,
224929,
224932,
257704,
224936,
224942,
257712,
224947,
257716,
257720,
224953,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
257761,
224993,
257764,
224999,
339695,
225012,
257787,
225020,
257790,
339710,
225025,
257794,
339721,
257801,
257804,
225038,
257807,
225043,
372499,
167700,
225048,
257819,
225053,
184094,
225058,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
225103,
257871,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
339814,
225127,
274280,
257896,
257901,
225137,
339826,
257908,
225141,
257912,
225148,
257916,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
372738,
405533,
430129,
266294,
266297,
421960,
356439,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
225493,
266453,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
397571,
389380,
61722,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
348502,
250199,
250202,
332125,
250210,
348522,
348525,
348527,
332152,
389502,
250238,
332161,
356740,
332172,
373145,
340379,
389550,
324030,
266687,
160234,
127471,
340472,
381436,
324094,
266754,
324099,
324102,
324111,
340500,
324117,
324131,
332324,
381481,
356907,
324139,
324142,
356916,
324149,
324155,
348733,
324164,
356934,
348743,
381512,
324170,
324173,
324176,
389723,
332380,
373343,
381545,
340627,
373398,
184982,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
357069,
332493,
357073,
332511,
332520,
340718,
332533,
348924,
373510,
389926,
348978,
152370,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
430939,
357211,
357214,
201579,
201582,
349040,
340849,
430965,
381813,
324472,
398201,
119674,
324475,
430972,
340858,
340861,
324478,
324481,
373634,
398211,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
422816,
324513,
398245,
201637,
324524,
340909,
324533,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
381946,
349180,
439294,
431106,
209943,
357410,
250914,
185380,
357418,
209965,
209971,
209975,
209979,
209987,
209990,
209995,
341071,
349267,
250967,
210010,
341091,
210025,
210030,
210036,
210039,
349308,
210044,
349311,
160895,
152703,
210052,
210055,
349319,
210067,
210077,
210080,
251044,
210084,
185511,
210095,
210098,
210107,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
218360,
251128,
275706,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
210260,
259421,
365921,
333154,
251235,
374117,
333162,
234866,
390516,
333175,
357755,
251271,
136590,
374160,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
415207,
366056,
366061,
415216,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
153227,
333498,
210631,
333511,
259788,
358099,
153302,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
366387,
210739,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
259938,
399206,
358255,
268143,
399215,
358259,
341876,
333689,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
358371,
350189,
350193,
350202,
333818,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
334011,
260289,
260298,
350410,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
350467,
325891,
350475,
375053,
268559,
350480,
432405,
350486,
325914,
350490,
325917,
350493,
325919,
350498,
194852,
350504,
358700,
391468,
350509,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
416157,
268701,
342430,
375208,
326058,
375216,
334262,
334275,
326084,
358856,
195039,
334304,
334311,
375277,
334321,
350723,
391690,
186897,
342545,
334358,
342550,
342554,
334363,
358941,
350761,
252461,
334384,
358961,
383536,
334394,
252482,
219718,
334407,
334420,
350822,
375400,
334465,
334468,
162445,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
260801,
350917,
154317,
391894,
154328,
416473,
64230,
113388,
342766,
375535,
203506,
342776,
391937,
391948,
375568,
326416,
375571,
375574,
162591,
326441,
383793,
326451,
326454,
260924,
375612,
244540,
326460,
326467,
244551,
326473,
326477,
416597,
326485,
326490,
342874,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
359366,
326598,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
261147,
359451,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
367723,
384107,
187502,
343154,
384114,
212094,
351364,
384135,
384139,
384143,
351381,
384160,
384168,
367794,
384181,
367800,
351423,
384191,
384198,
326855,
244937,
253130,
343244,
146642,
359649,
343270,
351466,
351479,
384249,
343306,
261389,
359694,
384269,
253200,
261393,
384275,
245020,
245029,
171302,
351534,
376110,
245040,
384314,
425276,
212291,
384323,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
253303,
154999,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
179802,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
425649,
155322,
425662,
155327,
155351,
155354,
212699,
155363,
245475,
155371,
245483,
409335,
155393,
155403,
155422,
360223,
155438,
155442,
155447,
417595,
360261,
155461,
376663,
155482,
261981,
425822,
376671,
155487,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
147317,
262005,
425845,
262008,
262011,
155516,
155521,
155525,
360326,
376714,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
393169,
384977,
155611,
155619,
253923,
155621,
253926,
327654,
204784,
393203,
360438,
253943,
393206,
393212,
155646
] |
37873aac56565a027773c0f7e031fb0e8aec18e7 | f1484d4fa079c304326bcc79d0093577035387d7 | /OnboardingTest/NotificationManager.swift | 3a3692cbb81242296b6dd1b1fcff066ce009ccc2 | [] | no_license | TravelAdventureGames/OnboardingMerel | 3ecb1325e1ee70c253fd08a9b596e736f7fc7350 | a805fa4317df75dc69081114fe2e118957b57ee9 | refs/heads/master | 2020-04-05T14:08:52.470574 | 2017-07-16T08:38:10 | 2017-07-16T08:38:10 | 94,789,543 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,251 | swift | //
// NotificationManager.swift
// OnboardingTest
//
// Created by Martijn van Gogh on 05-07-17.
// Copyright © 2017 Martijn van Gogh. All rights reserved.
//
import Foundation
import UserNotifications
//Een enum om de verschillende notifications te kunnen setten. Er wordt periodiek (eens per maand?) een notidicatie gestuurd. De title en body ervan worden bepaald door de verschillende cases die worden gedefinieerd.
enum LocalNotification {
case Regular
case DidNotUseForALongTime
var title: String {
switch self {
case .Regular:
return "Tap-app: Mothly update"
case .DidNotUseForALongTime:
return "Tapp-app"
}
}
var body: String {
switch self {
case .Regular:
return getRegularNotificationText()
case .DidNotUseForALongTime:
return "Je hebt de tap-app al een tijdje niet gebruikt. Probeer het nog eens, tappen helpt echt!"
}
}
// Set deze door de huidige gemiddelde score te delen door de gemiddelde vorige score van alle tapsessies. deze moeten uit coreData worden gehaald. Voor nu zijn tijdelijke vaste scores toegekend. In deze
func getRegularNotificationText() -> String {
let previousAverageScore = 6.1 //todo: set uit coredata
let currentAverageScore = 4.8 //todo: set uit coredata
let percentageImproved = round(((previousAverageScore - currentAverageScore) / previousAverageScore) * 1000) / 10 //geeft het percentage voor-of achteruitgang tov vorige gemiddelde score
print(percentageImproved)
var text = ""
if percentageImproved > 0 {
text = "Je voelt je deze maand \(percentageImproved) % beter dan de vorige maand. Dat moet een heerlijk gevoel zijn. Ga vooral door!"
} else {
text = "Je voelt je deze maand \(percentageImproved) % slechter dan de vorige maand. Maar geef nu niet op, blijf je sessies doen!"
}
return text
}
// Todo: Create a counter (userdefaults?) to count the number of sessions done
func getNumberOfSessionsInMonth() -> Int {
return 3
}
}
struct NotificationFireDate {
static let nextDay: TimeInterval = 85_000
static let nextWeek: TimeInterval = 604_000
static let nextMonth: TimeInterval = 2416_000
}
// MARK: The class schedules and presents local notifications every week / month / etc. (whatever we decide to do). The content of the message is created by the LocalNotifcation enum. The current case is created by the getNotificationCase() function. Tested and worked after authorization.
class NoticationManager: NSObject {
// Provides logic to determine the case which sets the notication, Can be expanded if needed.
func getNotificationCase() -> LocalNotification {
let numberOfSessionInMonth = 1 //get from userdefaults or coredata?
switch numberOfSessionInMonth {
case 0:
return .DidNotUseForALongTime
default:
return .Regular
}
}
func pushLocalNotification() {
UNUserNotificationCenter.current().getNotificationSettings { (notificationSettings) in
switch notificationSettings.authorizationStatus {
case .notDetermined:
self.requestAuthorization(completionHandler: { (success) in
guard success else { return }
self.scheduleLocalNotification(notificationCase: self.getNotificationCase())
})
case .authorized:
self.scheduleLocalNotification(notificationCase: self.getNotificationCase())
case .denied:
print("Application Not Allowed to Display Notifications")
}
}
}
// Asks for authorization the first time the app is used
private func requestAuthorization(completionHandler: @escaping (_ succes: Bool) -> ()) {
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { (succes, error) in
if let error = error {
print("Request Authorization Failed (\(error), \(error.localizedDescription))")
}
completionHandler(succes)
}
}
// Schedules the next notification with a title, subtitle, body and sound
private func scheduleLocalNotification(notificationCase: LocalNotification) {
let notificationContent = UNMutableNotificationContent()
notificationContent.title = notificationCase.title
notificationContent.body = notificationCase.body
let notificationTrigger = UNTimeIntervalNotificationTrigger(timeInterval: NotificationFireDate.nextMonth, repeats: true)
let notificationRequest = UNNotificationRequest(identifier: "Notification_of_the_month", content: notificationContent, trigger: notificationTrigger)
UNUserNotificationCenter.current().add(notificationRequest) { (error) in
if let error = error {
print("Unable to Add Notification Request (\(error), \(error.localizedDescription))")
}
}
}
}
| [
-1
] |
f5c87ba253e76ab25bc4a51b14c69ab487af0992 | 65316db4db26257fec2b3cb94917b5c39ca969e9 | /RsyncOSX/Schedules.swift | 82040bd1ea0d9f3cb0bbc0f871673462e1ed3c43 | [
"MIT"
] | permissive | stefanocutelle/RsyncOSX | 4347036db3e1016319606b40e320af68222ae97a | 803e261d2c52742f46d7ea5e5741475a7b7d71ea | refs/heads/master | 2021-04-04T15:51:49.138544 | 2020-03-17T13:11:44 | 2020-03-17T13:11:44 | 248,469,262 | 0 | 0 | MIT | 2020-03-19T10:06:01 | 2020-03-19T10:06:00 | null | UTF-8 | Swift | false | false | 8,917 | swift | //
// This object stays in memory runtime and holds key data and operations on Schedules.
// The obect is the model for the Schedules but also acts as Controller when
// the ViewControllers reads or updates data.
//
// Created by Thomas Evensen on 09/05/16.
// Copyright © 2016 Thomas Evensen. All rights reserved.
//
// swiftlint:disable trailing_comma
import Cocoa
import Foundation
class Schedules: ScheduleWriteLoggData {
// Return reference to Schedule data
// self.Schedule is privat data
func getSchedule() -> [ConfigurationSchedule] {
return self.schedules ?? []
}
// Function adds new Shcedules (plans). Functions writes
// schedule plans to permanent store.
// - parameter hiddenID: hiddenID for task
// - parameter schedule: schedule
// - parameter start: start date and time
// - parameter stop: stop date and time
func addschedule(hiddenID: Int, schedule: Scheduletype, start: Date) {
var stop: Date?
if schedule == .once {
stop = start
} else {
stop = "01 Jan 2100 00:00".en_us_date_from_string()
}
let dict = NSMutableDictionary()
let offsiteserver = self.configurations?.getResourceConfiguration(hiddenID, resource: .offsiteServer)
dict.setObject(hiddenID, forKey: "hiddenID" as NSCopying)
dict.setObject(start.en_us_string_from_date(), forKey: "dateStart" as NSCopying)
dict.setObject(stop!.en_us_string_from_date(), forKey: "dateStop" as NSCopying)
dict.setObject(offsiteserver as Any, forKey: "offsiteserver" as NSCopying)
switch schedule {
case .once:
dict.setObject("once", forKey: "schedule" as NSCopying)
case .daily:
dict.setObject("daily", forKey: "schedule" as NSCopying)
case .weekly:
dict.setObject("weekly", forKey: "schedule" as NSCopying)
}
let newSchedule = ConfigurationSchedule(dictionary: dict, log: nil, nolog: true)
self.schedules!.append(newSchedule)
_ = PersistentStorageScheduling(profile: self.profile).savescheduleInMemoryToPersistentStore()
self.reloadtable(vcontroller: .vctabschedule)
}
// Function deletes all Schedules by hiddenID. Invoked when Configurations are
// deleted. When a Configuration are deleted all tasks connected to
// Configuration has to be deleted.
// - parameter hiddenID : hiddenID for task
func deletescheduleonetask(hiddenID: Int) {
var delete: Bool = false
for i in 0 ..< self.schedules!.count where self.schedules![i].hiddenID == hiddenID {
// Mark Schedules for delete
// Cannot delete in memory, index out of bound is result
self.schedules![i].delete = true
delete = true
}
if delete {
_ = PersistentStorageScheduling(profile: self.profile).savescheduleInMemoryToPersistentStore()
// Send message about refresh tableView
self.reloadtable(vcontroller: .vctabmain)
}
}
// Function reads all Schedule data for one task by hiddenID
// - parameter hiddenID : hiddenID for task
// - returns : array of Schedules sorted after startDate
func readscheduleonetask(hiddenID: Int?) -> [NSMutableDictionary]? {
guard hiddenID != nil else { return nil }
var row: NSMutableDictionary
var data = [NSMutableDictionary]()
for i in 0 ..< self.schedules!.count {
if self.schedules![i].hiddenID == hiddenID {
row = [
"dateStart": self.schedules![i].dateStart,
"dayinweek": self.schedules![i].dateStart.en_us_date_from_string().dayNameShort(),
"stopCellID": 0,
"deleteCellID": 0,
"dateStop": "",
"schedule": self.schedules![i].schedule,
"hiddenID": schedules![i].hiddenID,
"numberoflogs": String(schedules![i].logrecords.count),
]
if self.schedules![i].dateStop == nil {
row.setValue("no stop date", forKey: "dateStop")
} else {
row.setValue(self.schedules![i].dateStop, forKey: "dateStop")
}
if self.schedules![i].schedule == "stopped" {
row.setValue(1, forKey: "stopCellID")
}
data.append(row)
}
// Sorting schedule after dateStart, last startdate on top
data.sort { (sched1, sched2) -> Bool in
if (sched1.value(forKey: "dateStart") as? String)!.en_us_date_from_string() >
(sched2.value(forKey: "dateStart") as? String)!.en_us_date_from_string() {
return true
} else {
return false
}
}
}
return data
}
// Function either deletes or stops Schedules.
// - parameter data : array of Schedules which some of them are either marked for stop or delete
func deleteorstopschedule(data: [NSMutableDictionary]?) {
guard data != nil else { return }
var update: Bool = false
if (data!.count) > 0 {
let stop = data!.filter { (($0.value(forKey: "stopCellID") as? Int) == 1) }
let delete = data!.filter { (($0.value(forKey: "deleteCellID") as? Int) == 1) }
// Delete Schedules
if delete.count > 0 {
update = true
for i in 0 ..< delete.count {
self.delete(dict: delete[i])
}
}
// Stop Schedules
if stop.count > 0 {
update = true
for i in 0 ..< stop.count {
self.stop(dict: stop[i])
}
}
if update {
// Saving the resulting data file
_ = PersistentStorageScheduling(profile: self.profile).savescheduleInMemoryToPersistentStore()
// Send message about refresh tableView
self.reloadtable(vcontroller: .vctabmain)
self.reloadtable(vcontroller: .vctabschedule)
}
}
}
// Test if Schedule record in memory is set to delete or not
private func delete(dict: NSDictionary) {
for i in 0 ..< self.schedules!.count where
dict.value(forKey: "hiddenID") as? Int == self.schedules![i].hiddenID {
if dict.value(forKey: "dateStop") as? String == self.schedules![i].dateStop ||
self.schedules![i].dateStop == nil &&
dict.value(forKey: "schedule") as? String == self.schedules![i].schedule &&
dict.value(forKey: "dateStart") as? String == self.schedules![i].dateStart {
self.schedules![i].delete = true
}
}
}
// Test if Schedule record in memory is set to stop er not
private func stop(dict: NSDictionary) {
for i in 0 ..< self.schedules!.count where
dict.value(forKey: "hiddenID") as? Int == self.schedules![i].hiddenID {
if dict.value(forKey: "dateStop") as? String == self.schedules![i].dateStop ||
self.schedules![i].dateStop == nil &&
dict.value(forKey: "schedule") as? String == self.schedules![i].schedule &&
dict.value(forKey: "dateStart") as? String == self.schedules![i].dateStart {
self.schedules![i].schedule = "stopped"
self.schedules![i].dateStop = Date().en_us_string_from_date()
}
}
}
// Function for reading all jobs for schedule and all history of past executions.
// Schedules are stored in self.schedules. Schedules are sorted after hiddenID.
private func readschedules() {
var store = PersistentStorageScheduling(profile: self.profile).getScheduleandhistory(nolog: false)
guard store != nil else { return }
var data = [ConfigurationSchedule]()
for i in 0 ..< store!.count where store![i].logrecords.isEmpty == false || store![i].dateStop != nil {
store![i].profilename = self.profile
data.append(store![i])
}
// Sorting schedule after hiddenID
data.sort { (schedule1, schedule2) -> Bool in
if schedule1.hiddenID > schedule2.hiddenID {
return false
} else {
return true
}
}
// Setting self.Schedule as data
self.schedules = data
}
override init(profile: String?) {
super.init(profile: profile)
self.profile = profile
self.readschedules()
if ViewControllerReference.shared.checkinput {
self.schedules = Reorgschedule().mergerecords(data: self.schedules)
}
}
}
| [
-1
] |
b449c5a5d4a037376a31bbef99c4f39b7a79d1d6 | 6ddf32916e0f1fc340e081320ac01e74a827f3c8 | /UberdooX/MyAPIClient.swift | 985fbc004dd12e2a549fa18f87156258d2b819ed | [] | no_license | Free-tek/jobfizzer-user-ios | 76618f2c4a398380a005f7d123a1a79acf89888b | 578edaa361de31944050a4a3d128dde00c84bd20 | refs/heads/master | 2022-11-24T03:47:32.327285 | 2020-07-30T14:26:13 | 2020-07-30T14:26:13 | 283,795,268 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,721 | swift | //
// MyAPIClient.swift
// SwyftX
//
// Created by Karthik Sakthivel on 02/03/18.
// Copyright © 2018 Swyft. All rights reserved.
//
import Foundation
import Stripe
import SwiftyJSON
import Alamofire
class MyAPIClient: NSObject, STPEphemeralKeyProvider {
static let sharedClient = MyAPIClient()
func completeCharge(_ result: STPPaymentResult,
amount: String,
bookingId : String,
completion: @escaping STPErrorBlock) {
let accesstoken = UserDefaults.standard.string(forKey: "access_token") as String!
print(accesstoken!)
let headers: HTTPHeaders = [
"Authorization": accesstoken!,
"Accept": "application/json"
]
let base = URL.init(string: APIList().BASE_URL)!
let url = base.appendingPathComponent("stripe")
print(url)
let params: [String: Any] = [
"token": result.source.stripeID,
"id": bookingId,
"amount": amount
]
print(params)
Alamofire.request(url, method: .post, parameters: params, headers:headers).responseJSON { response in
let jsonResponse = JSON(response)
print(jsonResponse)
switch response.result {
case .success:
completion(nil)
case .failure(let error):
completion(error)
}
}
}
// func createCharge()
func createCustomerKey(withAPIVersion apiVersion: String, completion: @escaping STPJSONResponseCompletionBlock) {
let base = URL.init(string: APIList().BASE_URL)!
let url = base.appendingPathComponent("ephemeral_keys")
print(url)
print(apiVersion)
let accesstoken = UserDefaults.standard.string(forKey: "access_token") as String!
// print(accesstoken!)
let headers: HTTPHeaders = [
"Authorization": accesstoken!,
"Accept": "application/json"
]
let parameters : Parameters = [
"api_version": apiVersion
]
print(parameters)
print(headers)
Alamofire.request(url, method: .post, parameters: parameters, headers:headers)
.validate(statusCode: 200..<300)
.responseJSON { responseJSON in
print(responseJSON)
switch responseJSON.result {
case .success(let json):
completion(json as? [String: AnyObject], nil)
case .failure(let error):
completion(nil, error)
}
}
}
}
| [
-1
] |
b0f37f4491a6a869cf0982b673aaf8ef042c0ff5 | 45d7c9d199aee3b28f66b475a64bd31b5be10891 | /iOS/CoreLocation/CLLocationManager.swift | d5bea7b58fd35519963efd5ae8db6534c24d4ce1 | [] | no_license | DougGregor/swift-concurrency-objc | f8ba0cfa2a4153d1cd129d7d61060d0a47067847 | 5ab47b4f70a675a4298dc00b1526505b964b4061 | refs/heads/xcode-12-2-beta-3 | 2023-01-28T12:41:18.646533 | 2020-10-15T19:42:00 | 2020-10-15T19:42:00 | 304,435,605 | 40 | 8 | null | 2020-10-15T20:05:54 | 2020-10-15T20:02:53 | Swift | UTF-8 | Swift | false | false | 4,907 | swift |
enum CLDeviceOrientation : Int32 {
init?(rawValue: Int32)
var rawValue: Int32 { get }
case unknown
case portrait
case portraitUpsideDown
case landscapeLeft
case landscapeRight
case faceUp
case faceDown
}
enum CLAuthorizationStatus : Int32 {
init?(rawValue: Int32)
var rawValue: Int32 { get }
case notDetermined
case restricted
case denied
@available(iOS 8.0, *)
case authorizedAlways
@available(iOS 8.0, *)
case authorizedWhenInUse
@available(iOS, introduced: 2.0, deprecated: 8.0, message: "Use kCLAuthorizationStatusAuthorizedAlways")
static var authorized: CLAuthorizationStatus { get }
}
enum CLAccuracyAuthorization : Int {
init?(rawValue: Int)
var rawValue: Int { get }
case fullAccuracy
case reducedAccuracy
}
enum CLActivityType : Int {
init?(rawValue: Int)
var rawValue: Int { get }
case other
case automotiveNavigation
case fitness
case otherNavigation
@available(iOS 12.0, *)
case airborne
}
@available(iOS 2.0, *)
class CLLocationManager : NSObject {
@available(iOS 4.0, *)
class func locationServicesEnabled() -> Bool
@available(iOS 4.0, *)
class func headingAvailable() -> Bool
@available(iOS 4.0, *)
class func significantLocationChangeMonitoringAvailable() -> Bool
@available(iOS 7.0, *)
class func isMonitoringAvailable(for regionClass: AnyClass) -> Bool
@available(iOS 7.0, *)
class func isRangingAvailable() -> Bool
@available(iOS 14.0, *)
var authorizationStatus: CLAuthorizationStatus { get }
@available(iOS, introduced: 4.2, deprecated: 14.0)
class func authorizationStatus() -> CLAuthorizationStatus
@available(iOS 14.0, *)
var accuracyAuthorization: CLAccuracyAuthorization { get }
@available(iOS 14.0, *)
var isAuthorizedForWidgetUpdates: Bool { get }
weak var delegate: @sil_weak CLLocationManagerDelegate?
@available(iOS 6.0, *)
var activityType: CLActivityType
var distanceFilter: CLLocationDistance
var desiredAccuracy: CLLocationAccuracy
@available(iOS 6.0, *)
var pausesLocationUpdatesAutomatically: Bool
@available(iOS 9.0, *)
var allowsBackgroundLocationUpdates: Bool
@available(iOS 11.0, *)
var showsBackgroundLocationIndicator: Bool
@NSCopying var location: CLLocation? { get }
@available(iOS 3.0, *)
var headingFilter: CLLocationDegrees
@available(iOS 4.0, *)
var headingOrientation: CLDeviceOrientation
@available(iOS 4.0, *)
@NSCopying var heading: CLHeading? { get }
@available(iOS 4.0, *)
var maximumRegionMonitoringDistance: CLLocationDistance { get }
@available(iOS 4.0, *)
var monitoredRegions: Set<CLRegion> { get }
@available(iOS, introduced: 7.0, deprecated: 13.0, message: "Use -rangedBeaconConstraints")
var rangedRegions: Set<CLRegion> { get }
@available(iOS 13.0, *)
var rangedBeaconConstraints: Set<CLBeaconIdentityConstraint> { get }
@available(iOS 8.0, *)
func requestWhenInUseAuthorization()
@available(iOS 8.0, *)
func requestAlwaysAuthorization()
@available(iOS 14.0, *)
func requestTemporaryFullAccuracyAuthorization(withPurposeKey purposeKey: String, completion: ((Error?) -> Void)? = nil)
@available(iOS 14.0, *)
func requestTemporaryFullAccuracyAuthorization(withPurposeKey purposeKey: String)
func startUpdatingLocation()
func stopUpdatingLocation()
@available(iOS 9.0, *)
func requestLocation()
@available(iOS 3.0, *)
func startUpdatingHeading()
@available(iOS 3.0, *)
func stopUpdatingHeading()
@available(iOS 3.0, *)
func dismissHeadingCalibrationDisplay()
@available(iOS 4.0, *)
func startMonitoringSignificantLocationChanges()
@available(iOS 4.0, *)
func stopMonitoringSignificantLocationChanges()
@available(iOS 4.0, *)
func stopMonitoring(for region: CLRegion)
@available(iOS 5.0, *)
func startMonitoring(for region: CLRegion)
@available(iOS 7.0, *)
func requestState(for region: CLRegion)
@available(iOS, introduced: 7.0, deprecated: 13.0, message: "Use -startRangingBeaconsSatisfyingConstraint:")
func startRangingBeacons(in region: CLBeaconRegion)
@available(iOS, introduced: 7.0, deprecated: 13.0, message: "Use -stopRangingBeaconsSatisfyingConstraint:")
func stopRangingBeacons(in region: CLBeaconRegion)
@available(iOS 13.0, *)
func startRangingBeacons(satisfying constraint: CLBeaconIdentityConstraint)
@available(iOS 13.0, *)
func stopRangingBeacons(satisfying constraint: CLBeaconIdentityConstraint)
@available(iOS, introduced: 6.0, deprecated: 13.0, message: "You can remove calls to this method")
func allowDeferredLocationUpdates(untilTraveled distance: CLLocationDistance, timeout: TimeInterval)
@available(iOS, introduced: 6.0, deprecated: 13.0, message: "You can remove calls to this method")
func disallowDeferredLocationUpdates()
@available(iOS, introduced: 6.0, deprecated: 13.0, message: "You can remove calls to this method")
class func deferredLocationUpdatesAvailable() -> Bool
}
| [
-1
] |
3a003f379816781cf24bcd1ce51884e8f3017fe7 | f0624fa6ed03b42a9fccce657f71929dd3dd2288 | /Planets/SceneDelegate.swift | f68b5b3b0b97189d8babd66d92b88f225bca914c | [] | no_license | artemiyrazov/Planets | da6157f731ad0c3886c1c3ae4aae0946cf7853f6 | b8706a0a68708669007f45e1d2b8d2fb48120601 | refs/heads/master | 2022-06-30T00:10:17.317331 | 2020-05-03T09:30:29 | 2020-05-03T09:30:29 | 260,860,281 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,650 | swift | //
// SceneDelegate.swift
// Planets
//
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 }
let vc = window?.rootViewController as! ViewController
let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
vc.context = context
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
// Save changes in the application's managed object context when the application transitions to the background.
(UIApplication.shared.delegate as? AppDelegate)?.saveContext()
}
}
| [
393221,
163849,
393228,
393231,
393251,
352294,
344103,
393260,
393269,
213049,
376890,
385082,
393277,
376906,
327757,
254032,
368728,
254045,
180322,
376932,
286845,
286851,
417925,
262284,
360598,
377003,
377013,
164029,
327872,
180418,
377037,
377047,
418008,
418012,
377063,
327915,
205037,
393457,
393461,
393466,
418044,
385281,
262405,
180491,
336140,
262417,
368913,
262423,
377118,
377121,
262437,
254253,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
270687,
262497,
418145,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
262551,
262553,
385441,
262567,
262574,
393649,
385460,
262587,
344512,
262593,
360917,
369119,
328180,
328183,
328190,
254463,
328193,
328204,
328207,
410129,
393748,
377372,
188959,
385571,
377384,
197160,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
270922,
352844,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
385671,
148106,
377485,
352919,
98969,
344745,
361130,
336556,
434868,
164535,
164539,
328379,
328387,
352969,
418508,
385749,
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,
361318,
344936,
361323,
361335,
328574,
369544,
361361,
222129,
345036,
386004,
345046,
386023,
435188,
328703,
328710,
418822,
377867,
328715,
386070,
336922,
345119,
377888,
214060,
345134,
345139,
361525,
361537,
377931,
189525,
402523,
361568,
148580,
345200,
361591,
386168,
361594,
410746,
214150,
345224,
386187,
345247,
361645,
345268,
402615,
361657,
402636,
328925,
165086,
165092,
328933,
222438,
328942,
386292,
206084,
328967,
345377,
345380,
353572,
345383,
263464,
337207,
345400,
378170,
369979,
386366,
337230,
337235,
263509,
353634,
337252,
402792,
271731,
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,
214594,
419401,
353868,
419404,
173648,
419408,
214611,
419412,
403040,
345702,
370298,
353920,
403076,
345737,
198282,
403085,
403092,
345750,
419484,
345758,
345763,
419492,
345766,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
403139,
337607,
419528,
419531,
272083,
394967,
419543,
419545,
345819,
419548,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
362274,
378664,
354107,
354112,
370504,
329545,
345932,
370510,
247639,
337751,
370520,
313181,
182110,
354143,
354157,
345965,
345968,
345971,
345975,
403321,
1914,
354173,
395148,
247692,
337809,
247701,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
247760,
346064,
346069,
329699,
354275,
190440,
354314,
346140,
436290,
395340,
378956,
436307,
338005,
329816,
100454,
329833,
329853,
329857,
329868,
411806,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
346317,
411862,
411865,
411869,
411874,
379108,
411877,
387303,
395496,
346344,
338154,
387307,
346350,
338161,
436474,
379135,
411905,
411917,
379154,
395539,
387350,
387353,
338201,
338212,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
321911,
420237,
379279,
272787,
354728,
338353,
338382,
272849,
248279,
256474,
182755,
338404,
248309,
330254,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
338544,
191093,
346743,
346769,
150184,
248505,
363198,
223936,
355025,
273109,
264919,
264942,
363252,
338680,
264965,
338701,
256787,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
355185,
412600,
207809,
379849,
347082,
330711,
248794,
248799,
347106,
437219,
257009,
265208,
199681,
338951,
330761,
330769,
330775,
248863,
396329,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
248915,
183384,
339037,
412765,
257121,
265321,
248952,
420985,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
126148,
330959,
330966,
265433,
265438,
388320,
363757,
339199,
396552,
175376,
175397,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
437576,
437584,
396634,
175451,
437596,
429408,
175458,
175461,
175464,
265581,
175478,
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,
134689,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
224885,
224888,
224891,
224895,
126597,
421509,
224905,
11919,
224911,
224914,
126611,
224917,
224920,
126618,
208539,
224923,
224927,
224930,
224933,
257705,
224939,
224943,
257713,
224949,
257717,
257721,
224954,
257725,
224960,
257733,
224966,
224970,
257740,
224976,
257745,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
225013,
225021,
339711,
257791,
225027,
257796,
339722,
225039,
257808,
249617,
225044,
167701,
372500,
225049,
257820,
225054,
184096,
397089,
257825,
225059,
339748,
225068,
257837,
413485,
225071,
225074,
257843,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225097,
257869,
225105,
397140,
225109,
257881,
225113,
257884,
257887,
225120,
225128,
257897,
225138,
225142,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
372698,
372704,
372707,
356336,
380919,
393215,
372739,
405534,
266295,
266298,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
192640,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
250012,
225439,
135328,
192674,
225442,
438434,
225445,
225448,
438441,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
225476,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
225511,
217319,
225515,
225519,
381177,
397572,
389381,
356638,
356644,
356647,
266537,
389417,
356650,
356656,
332081,
340276,
356662,
397623,
332091,
225599,
348489,
332107,
151884,
430422,
348503,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
348548,
356741,
332175,
160152,
373146,
373149,
70048,
356783,
266688,
324032,
201158,
127473,
217590,
340473,
324095,
324100,
324103,
324112,
340501,
324118,
324122,
340512,
332325,
324134,
381483,
356908,
324141,
324143,
356917,
324150,
324156,
168509,
348734,
324161,
324165,
356935,
348745,
381513,
324171,
324174,
324177,
389724,
332381,
373344,
340580,
348777,
381546,
340628,
184983,
373399,
258723,
332455,
332460,
332464,
332473,
381626,
332484,
332494,
357070,
357074,
332512,
340724,
332534,
348926,
389927,
348979,
398141,
357202,
389971,
357208,
389979,
430940,
357212,
357215,
439138,
349041,
340850,
381815,
430967,
324473,
398202,
119675,
340859,
324476,
430973,
324479,
340863,
324482,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
373672,
324525,
111539,
324534,
324539,
324542,
398280,
349129,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
349173,
381947,
201724,
349181,
431100,
431107,
349203,
209944,
209948,
250917,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
431180,
209996,
349268,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
152704,
349313,
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,
349486,
349492,
415034,
210261,
365912,
259423,
374113,
251236,
374118,
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,
333396,
374359,
333400,
366173,
423529,
423533,
210547,
415354,
333440,
267910,
267929,
259789,
366301,
333535,
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,
341839,
341844,
415574,
358235,
350046,
399200,
399208,
268144,
358256,
358260,
399222,
325494,
333690,
325505,
399244,
333709,
333725,
333737,
382891,
358336,
358340,
358348,
333777,
219094,
399318,
358372,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
333838,
350225,
350232,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
252021,
342134,
374904,
268435,
333998,
334012,
260299,
375027,
358645,
268553,
194829,
268560,
432406,
325920,
358701,
391469,
358705,
358714,
358717,
383307,
358738,
383331,
383334,
391531,
383342,
334204,
268669,
194942,
391564,
366991,
342431,
375209,
334263,
326087,
358857,
195041,
334312,
104940,
375279,
350724,
186898,
342546,
350740,
342551,
342555,
416294,
350762,
252463,
358962,
334397,
252483,
219719,
399957,
334425,
326240,
375401,
334466,
334469,
162446,
342680,
342685,
260767,
342711,
244410,
260798,
334530,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
64231,
113389,
203508,
375541,
342777,
391938,
391949,
375569,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
375613,
244542,
375616,
244552,
342857,
416599,
342875,
244572,
433001,
400238,
211826,
211832,
392061,
351102,
252801,
260993,
400260,
211846,
342921,
342931,
252823,
400279,
392092,
400286,
359335,
211885,
400307,
351169,
359362,
170950,
187335,
326599,
359367,
359383,
359389,
383968,
343018,
261109,
261112,
244728,
383999,
261130,
261148,
359452,
261155,
261160,
261166,
359471,
375868,
384099,
384102,
384108,
367724,
187503,
343155,
384115,
212095,
384136,
384140,
384144,
384152,
384158,
384161,
351399,
384169,
367795,
384182,
384189,
384192,
343232,
351424,
367817,
244938,
384202,
253132,
384209,
146644,
351450,
384225,
359650,
343272,
351467,
359660,
384247,
351480,
384250,
351483,
384270,
359695,
261391,
253202,
261395,
384276,
384284,
245021,
384290,
253218,
245032,
171304,
384299,
351535,
245042,
326970,
384324,
212296,
367966,
367981,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
384398,
245137,
245143,
245146,
245149,
245152,
245155,
155045,
245158,
114093,
327090,
343478,
359867,
384444,
327108,
327112,
384457,
359887,
359891,
368093,
155103,
343535,
343540,
368120,
409092,
359948,
359951,
359984,
400977,
400982,
179803,
155255,
155274,
409237,
368289,
245410,
425639,
425652,
425663,
155328,
245463,
155352,
155356,
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,
262046,
253854,
262049,
262052,
327590,
155560,
155563,
155566,
327613,
393152,
393170,
155604,
155620,
253924,
155622,
253927,
327655,
360432,
393204,
253944,
393209,
155647
] |
bc17d9c852a9377dfb5589e6eeb8118e44248cf7 | 6a3b7fcc4c7a298642784d695a337aa6228ba880 | /HW36/HW36/Pages.swift | 46b0212998c90f53b4af5354fdfce2e8b18822a7 | [] | no_license | Ezukaa/TBCAcademy | 49075777d529edcc2cfd28d7244cab0e64e63052 | da5532e871759afbf4f419808af0b3de79432139 | refs/heads/master | 2022-12-21T04:36:10.845791 | 2020-09-25T09:26:18 | 2020-09-25T09:26:18 | 257,828,249 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 320 | swift | //
// Pages.swift
// HW36
//
// Created by Macintosh HD on 6/8/20.
// Copyright © 2020 TBC. All rights reserved.
//
import Foundation
import UIKit
struct Pages {
let imageNamed: String
let title: String
let text: String
var image: UIImage? {
return UIImage(named: imageNamed)
}
}
| [
-1
] |
a1deb68016bd0be69b9f377311aa89a1aedf3de2 | ac3ff233c00263d6aedc165091ac0ec94e326b80 | /DemoApi/Global/Extenstion.swift | 33182e274585b454d821f1b5d492475645599b83 | [] | no_license | hvpatel0323/demo | 66d71d1ab580e411e276619f50dc965860c48fe5 | 9dc9fa8f51b4ae2685d0c1297c6ee5ee66af12c2 | refs/heads/master | 2020-09-10T08:54:08.836168 | 2019-11-15T08:36:20 | 2019-11-15T08:36:20 | 221,708,306 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,329 | swift |
//
// Extenstion.swift
//Class is defined for extension , it will add some more functions to apple controls
import UIKit
import Alamofire
import AlamofireImage
private let arrayParametersKey = "arrayParametersKey"
extension Date {
public static func convertStringToGiventUTCformate(_ dateinString:String,currntStringForamte:String,convertedtoformate:String)->String{
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = currntStringForamte
let newDate = dateFormatter.date(from: dateinString) ?? Date()
dateFormatter.dateFormat = convertedtoformate
return dateFormatter.string(from: newDate)
}
public static func convertStringToGiventformateInDate(_ dateinString:String,currntStringForamte:String)->Foundation.Date{
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = currntStringForamte
return dateFormatter.date(from: dateinString) ?? Foundation.Date()
}
}
extension Int {
func toString() -> String? {
return String(format:"%d",self)
}
func toAbs() -> Int {
return abs(self)
}
}
extension Int64 {
func toString() -> String? {
return String(format:"%d",self)
}
}
extension String {
var length: Int {
return self.count
}
func index(from: Int) -> Index {
return self.index(startIndex, offsetBy: from)
}
}
extension UIViewController {
func isUIViewControllerPresentedAsModal() -> Bool {
if((self.presentingViewController) != nil) {
return true
}
if(self.presentingViewController?.presentedViewController == self) {
return true
}
if(self.navigationController?.presentingViewController?.presentedViewController == self.navigationController) {
return true
}
if((self.tabBarController?.presentingViewController?.isKind(of: UITabBarController.self)) != nil) {
return true
}
return false
}
}
extension Array {
mutating func removeObjectFromArray<T>(_ obj: T) where T : Equatable {
self = self.filter({$0 as? T != obj})
}
func contains<T>(_ obj: T) -> Bool where T : Equatable {
return self.filter({$0 as? T == obj}).count > 0
}
func containsObject(object: Any) -> Bool
{
for obj in self
{
if (obj as AnyObject) === (object as AnyObject)
{
return true
}
}
return false
}
}
extension UIStoryboard {
static var main: UIStoryboard {
return UIStoryboard(name: "Main", bundle: nil)
}
var identifier: String {
if let name = self.value(forKey: "name") as? String {
return name
}
return ""
}
/// Get view controller from storyboard by its class type
/// Usage: let profileVC = storyboard!.get(ProfileViewController.self) / profileVC is of type ProfileViewController /
/// Warning: identifier should match storyboard ID in storyboard of identifier class
public func get<T:UIViewController>(_ identifier: T.Type) -> T? {
let storyboardID = String(describing: identifier)
guard let viewController = instantiateViewController(withIdentifier: storyboardID) as? T else {
return nil
}
return viewController
}
}
extension UIApplication {
class func topViewController(controller: UIViewController? = UIApplication.shared.keyWindow?.rootViewController) -> UIViewController? {
if let navigationController = controller as? UINavigationController {
return topViewController(controller: navigationController.visibleViewController)
}
if let tabController = controller as? UITabBarController {
if let selected = tabController.selectedViewController {
return topViewController(controller: selected)
}
}
if let presented = controller?.presentedViewController {
return topViewController(controller: presented)
}
return controller
}
}
| [
-1
] |
919d56437b9ff3549fe256571ab0ea4546c80560 | 816cc72c0662da687b9debec1deba6b06a301778 | /cex-graphs/CGExtensions.swift | 55542d2ae0865ed4eecb0bc13f7f6aa0cd03fc95 | [
"Apache-2.0"
] | permissive | AshishKapoor/cex-graphs | a178498f6c6ffe1112857e0ce84cea1caf5bf02f | 9aa6c8d87f87afb8007dd8edda9e74d2ef00ee77 | refs/heads/master | 2021-01-21T20:56:09.156640 | 2017-06-23T11:19:29 | 2017-06-23T11:19:29 | 94,763,009 | 2 | 0 | null | 2017-06-21T11:11:46 | 2017-06-19T10:03:13 | Swift | UTF-8 | Swift | false | false | 1,924 | swift | //
// CGExtensions.swift
// cex-graphs
//
// Created by Ashish Kapoor on 20/06/17.
// Copyright © 2017 Ashish Kapoor. All rights reserved.
//
import Foundation
import UIKit
extension UIColor {
class func barGraphChartColor() -> UIColor {
return UIColor(red: 230/255, green: 126/255, blue: 34/255, alpha: 1)
}
class func barGraphBackColor() -> UIColor {
return UIColor(red: 189/255, green: 195/255, blue: 199/255, alpha: 1)
}
}
extension Date {
static func unixTimestampToString(timeStamp: Date) -> String {
return DateFormatter.localizedString(from: timeStamp as Date, dateStyle: DateFormatter.Style.none, timeStyle: DateFormatter.Style.short)
}
}
extension Double {
static func stringToDouble(stringValue: String) -> Double {
return (stringValue as NSString).doubleValue
}
}
extension UIView {
func layerGradient() {
let layer : CAGradientLayer = CAGradientLayer()
layer.frame.size = self.frame.size
layer.frame.origin = CGPoint(x: 0.0, y: 0.0)
// layer.cornerRadius = CGFloat(frame.width / 20)
let color0 = UIColor(red:250.0/255, green:250.0/255, blue:250.0/255, alpha:0.5).cgColor
let color1 = UIColor(red:200.0/255, green:200.0/255, blue: 200.0/255, alpha:0.1).cgColor
let color2 = UIColor(red:150.0/255, green:150.0/255, blue: 150.0/255, alpha:0.1).cgColor
let color3 = UIColor(red:100.0/255, green:100.0/255, blue: 100.0/255, alpha:0.1).cgColor
let color4 = UIColor(red:50.0/255, green:50.0/255, blue:50.0/255, alpha:0.1).cgColor
let color5 = UIColor(red:0.0/255, green:0.0/255, blue:0.0/255, alpha:0.1).cgColor
let color6 = UIColor(red:150.0/255, green:150.0/255, blue:150.0/255, alpha:0.1).cgColor
layer.colors = [color0,color1,color2,color3,color4,color5,color6]
self.layer.insertSublayer(layer, at: 0)
}
}
| [
-1
] |
8b5bb37c8b921a36e616680972451ecf0fe37106 | 181dd97673dafebdb8c0f08da7084eaaef1a3690 | /hometast1.swift | f19493f3d96ad781b07d64aef19f6cf3b4cb7a40 | [] | no_license | kinitaleino/hometask_1.1 | ba27b0fcb23c98701abb99d555600fdb2af9a3ef | f68821b1d7c1fbe039139679953f4fabc6486ae6 | refs/heads/main | 2023-01-20T04:31:57.784885 | 2020-11-14T16:24:24 | 2020-11-14T16:24:24 | 312,853,303 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 787 | swift | import Foundation
protocol Quadrangle{
var a:Int {get set}
var b:Int {get set}
}
class Figure{
var name:String = "Figure"
var cornerRadius:Int = 90
}
class Triangle:Figure{
override init() {
super.init()
self.name = "Triangle"
self.cornerRadius = 60
}
}
class Rectangle:Figure{
override init() {
super.init()
self.name = "Rectangle"
self.cornerRadius = 90
}
}
class Round:Figure{
override init() {
super.init()
self.name = "Round"
self.cornerRadius = 360
}
}
//Я не понимаю, как задать наследникам свои свойства и методы, независимые от суперкласса.
| [
-1
] |
dd7273e702db2d42c4225ccdaa2c4345adceab2b | 5237b901a624eeaf9beb3d9a32cb5cc45b09e71f | /YourDateUITests/YourDateUITests.swift | d52bd66dfbf06520cbe1a74e73fbd24dfb38d641 | [] | no_license | samuel-esp/YourDate | 1dbf4ac24541474713c4e577ae78d87e05b81e25 | 05a9b9695183fadaf21576893187cc82b9806bff | refs/heads/master | 2021-01-16T11:45:53.431397 | 2020-03-08T17:56:27 | 2020-03-08T17:56:27 | 243,107,376 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,442 | swift | //
// YourDateUITests.swift
// YourDateUITests
//
// Created by Samuel Esposito on /212/20.
// Copyright © 2020 Samuel Esposito. All rights reserved.
//
import XCTest
class YourDateUITests: 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
// 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() {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testLaunchPerformance() {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTOSSignpostMetric.applicationLaunch]) {
XCUIApplication().launch()
}
}
}
}
| [
360463,
155665,
376853,
344106,
253996,
385078,
180279,
319543,
352314,
213051,
376892,
32829,
286787,
352324,
237638,
352327,
385095,
163916,
368717,
311373,
196687,
278607,
311377,
254039,
426074,
368732,
180317,
32871,
352359,
278637,
319599,
385135,
376945,
278642,
131190,
385147,
131199,
426124,
196758,
311447,
327834,
311459,
49317,
377010,
180409,
295099,
139459,
131270,
377033,
164043,
417996,
254157,
368849,
368850,
139478,
229591,
385240,
254171,
147679,
311520,
147680,
205034,
286957,
254189,
254193,
262403,
147716,
368908,
180494,
368915,
319764,
254228,
278805,
262419,
377116,
311582,
254250,
311596,
418095,
336177,
98611,
368949,
180534,
287040,
155968,
319812,
311622,
270663,
319816,
368969,
254285,
180559,
377168,
344402,
229716,
139641,
385407,
385409,
106893,
270733,
385423,
213402,
385437,
156069,
254373,
385449,
311723,
115116,
385463,
319931,
278974,
336319,
278979,
336323,
188870,
278988,
278992,
279000,
377309,
377310,
369121,
369124,
279014,
319976,
279017,
311787,
360945,
319986,
279030,
139766,
279033,
254459,
410108,
410109,
279042,
377346,
287237,
377352,
279053,
410126,
393745,
385554,
303635,
279060,
279061,
254487,
279066,
188957,
385578,
197166,
279092,
352831,
33344,
385603,
377419,
303693,
426575,
369236,
385620,
115287,
189016,
270938,
295518,
287327,
279143,
279150,
287345,
287348,
352885,
352886,
344697,
189054,
287359,
303743,
369285,
164487,
279176,
311944,
344714,
311950,
377487,
311953,
336531,
287379,
180886,
352921,
221853,
344737,
279207,
295591,
352938,
295598,
279215,
418479,
279218,
164532,
287418,
303802,
377531,
377534,
66243,
385737,
287434,
279249,
303826,
385745,
369365,
369366,
385751,
230105,
361178,
352989,
352990,
295649,
418529,
385763,
295653,
369383,
230120,
361194,
312046,
344829,
205566,
279293,
197377,
295688,
312076,
434956,
295698,
418579,
197398,
426777,
221980,
344864,
197412,
336678,
262952,
262953,
279337,
262957,
189229,
164655,
328495,
197424,
197428,
336693,
230198,
377656,
197433,
222017,
295745,
377669,
197451,
279379,
385878,
385880,
295769,
197467,
230238,
435038,
279393,
303973,
279398,
197479,
385895,
385901,
197489,
295799,
164730,
336765,
254851,
369541,
279434,
320394,
189327,
377754,
172971,
140203,
304050,
377778,
189373,
377789,
345030,
279499,
418774,
386007,
386016,
123880,
418793,
320495,
222193,
287730,
271351,
214009,
312313,
435195,
328701,
312317,
328705,
386049,
418819,
410629,
377863,
230411,
320526,
361487,
386068,
254997,
140311,
238617,
336928,
336930,
410665,
189487,
345137,
361522,
312372,
238646,
238650,
320571,
386108,
336962,
238663,
377927,
361547,
205911,
296023,
156763,
361570,
230500,
214116,
214119,
279659,
173168,
230514,
238706,
279666,
312435,
377974,
66684,
279686,
222344,
402568,
140426,
337037,
386191,
222364,
418975,
124073,
238764,
402618,
148674,
279752,
402632,
148687,
189651,
419028,
279766,
189656,
279775,
304352,
304353,
279780,
222441,
279789,
386288,
66802,
271607,
369912,
369913,
386296,
279803,
386304,
320769,
369929,
320795,
115997,
222496,
320802,
304422,
369964,
353581,
116014,
66863,
312628,
345397,
345398,
222523,
386363,
181568,
279874,
304457,
345418,
337226,
337228,
230730,
222542,
296269,
238928,
353617,
296274,
378201,
230757,
296304,
312688,
337280,
296328,
263561,
296330,
304523,
9618,
279955,
370066,
411028,
370072,
148899,
148900,
279980,
173492,
361928,
337359,
329168,
312785,
329170,
222674,
353751,
280025,
239069,
329181,
320997,
361958,
280042,
280043,
271850,
271853,
329198,
337391,
411119,
116209,
296434,
386551,
288252,
312830,
271880,
230922,
198155,
329231,
304655,
230933,
370200,
222754,
157219,
157220,
394793,
312879,
230960,
288305,
239159,
157246,
288319,
288322,
280131,
124486,
288328,
353875,
239192,
99937,
345697,
312937,
206447,
337533,
280193,
419462,
149127,
149128,
288391,
419464,
239251,
345753,
198304,
255651,
337590,
370359,
280252,
280253,
321217,
296649,
239305,
403149,
9935,
313042,
345813,
370390,
280279,
272087,
18139,
280285,
321250,
337638,
181992,
345832,
345835,
288492,
141037,
313082,
288508,
288515,
173828,
280326,
395018,
116491,
395019,
280333,
395026,
124691,
116502,
435993,
345882,
321308,
255781,
378666,
280367,
403248,
378673,
280373,
182070,
182071,
345910,
321338,
280381,
345918,
436029,
337734,
280396,
272207,
272208,
337746,
345942,
362326,
370526,
345950,
362336,
255844,
296807,
214894,
362351,
313200,
214896,
313204,
124795,
182142,
182145,
280451,
67464,
305032,
214936,
337816,
124826,
329627,
239515,
214943,
354210,
436130,
436135,
313257,
10153,
362411,
370604,
362418,
280517,
362442,
346066,
231382,
354268,
403421,
436189,
329696,
354273,
190437,
354279,
436199,
313322,
354283,
329707,
174058,
296942,
247787,
124912,
337899,
436209,
247786,
313338,
239610,
346117,
182277,
354310,
354312,
354311,
43016,
403463,
313356,
436235,
419857,
305173,
436248,
223269,
346153,
354346,
313388,
124974,
272432,
403507,
321589,
378933,
378934,
436283,
288835,
403524,
436293,
313415,
239689,
436304,
329812,
223317,
411738,
272477,
280676,
313446,
215144,
395373,
288878,
215165,
436372,
329884,
362658,
215204,
125108,
280761,
133313,
395458,
338118,
436429,
346319,
321744,
379102,
387299,
18661,
379110,
182503,
338151,
125166,
149743,
379120,
125170,
411892,
395511,
436471,
313595,
125184,
272644,
125192,
338187,
338188,
125197,
125200,
395536,
125204,
272661,
338196,
379157,
125215,
125216,
125225,
338217,
321839,
125236,
362809,
379193,
280903,
289109,
272730,
436570,
215395,
239973,
280938,
321901,
354671,
354672,
362864,
272755,
354678,
199030,
223611,
248188,
313726,
436609,
240003,
436613,
313736,
264591,
420241,
240020,
190870,
190872,
289185,
436644,
289195,
272815,
436659,
338359,
436677,
289229,
281038,
281039,
256476,
420326,
281071,
166403,
322057,
420374,
322077,
289328,
330291,
322119,
191065,
436831,
420461,
313970,
346739,
346741,
420473,
297600,
166533,
363155,
346771,
264855,
289435,
248494,
166581,
314043,
355006,
363212,
158424,
363228,
322269,
436957,
436960,
264929,
338658,
289511,
330473,
346859,
330476,
289517,
215790,
125683,
199415,
289534,
322302,
35584,
133889,
322312,
346889,
264971,
322320,
166677,
207639,
363295,
355117,
191285,
355129,
273209,
273211,
281407,
355136,
355138,
420680,
355147,
355148,
355153,
281426,
363353,
281434,
363354,
322396,
420702,
363361,
363362,
281444,
355173,
355174,
207724,
207728,
420722,
207735,
314240,
158594,
330627,
240517,
355216,
224149,
256918,
256919,
256920,
240543,
256934,
289720,
273336,
289723,
273341,
330688,
281541,
363462,
19398,
379845,
273353,
191445,
183254,
207839,
347104,
314343,
183276,
289773,
412653,
248815,
347122,
240631,
437245,
257023,
125953,
330759,
330766,
347150,
330789,
248871,
281647,
322609,
412725,
314437,
404550,
257093,
207954,
339031,
281698,
281699,
257126,
322664,
265323,
330867,
363643,
150656,
248960,
363658,
224400,
347286,
265366,
339101,
330912,
429216,
339106,
265381,
380069,
249003,
208044,
3243,
322733,
421050,
339131,
265410,
290001,
339167,
298209,
421102,
52473,
363769,
208123,
52476,
412926,
437504,
322826,
380178,
429332,
126229,
412963,
257323,
273713,
298290,
208179,
159033,
347451,
216387,
372039,
257353,
257354,
109899,
224591,
437585,
331091,
314708,
150868,
314711,
372064,
314721,
429410,
437602,
281958,
314727,
134504,
265579,
306541,
314734,
314740,
314742,
421240,
314745,
290170,
224637,
388488,
298378,
306580,
282008,
396697,
314776,
282013,
290206,
314788,
396709,
314790,
282023,
298406,
241067,
314797,
380335,
355761,
134586,
380348,
216510,
216511,
380350,
306630,
200136,
273865,
306634,
339403,
372172,
429540,
3557,
3559,
191980,
282097,
306678,
191991,
216575,
290304,
323083,
208397,
323088,
413202,
282132,
388630,
175640,
372261,
347693,
323120,
396850,
200245,
323126,
290359,
134715,
323132,
421437,
396865,
282182,
265800,
273992,
421452,
224848,
265809,
396885,
290391,
306777,
396889,
396896,
323171,
282214,
388712,
388713,
314997,
290425,
339579,
396927,
323208,
282248,
224907,
405140,
274071,
323226,
208547,
208548,
282279,
364202,
224951,
224952,
306875,
282302,
323262,
323265,
306891,
241360,
282321,
241366,
224985,
282330,
282336,
159462,
12009,
282349,
397040,
12017,
323315,
274170,
200444,
175874,
249606,
282375,
323335,
282379,
216844,
282390,
421657,
282399,
282401,
339746,
216868,
241447,
257831,
167720,
282418,
282424,
274234,
241471,
339782,
315209,
159563,
323405,
307024,
307030,
339799,
241494,
307038,
282471,
274288,
372592,
274296,
339840,
315265,
282503,
184207,
372625,
282517,
298912,
118693,
298921,
438186,
126896,
380874,
282573,
323554,
380910,
380922,
380923,
274432,
372736,
282634,
241695,
315431,
102441,
315433,
282671,
430127,
405552,
241717,
249912,
225347,
307269,
233548,
315468,
176209,
315477,
53334,
381013,
200795,
323678,
356446,
315488,
45154,
438374,
176231,
217194,
233578,
307306,
438378,
422000,
249976,
266361,
422020,
168069,
381061,
168070,
381071,
241809,
323730,
430231,
422044,
299166,
192670,
192671,
233635,
258213,
299176,
323761,
184498,
299202,
176325,
299208,
233678,
266447,
282832,
372943,
356575,
307431,
438512,
372979,
381173,
356603,
184574,
217352,
266504,
61720,
315674,
381210,
282908,
282912,
233761,
438575,
315698,
332084,
438583,
127292,
438592,
332100,
323914,
201037,
282959,
348499,
250196,
348501,
389465,
323934,
332128,
242027,
242028,
160111,
250227,
315768,
315769,
291193,
291200,
266628,
340356,
242059,
225684,
373141,
315798,
291225,
389534,
242079,
397732,
291266,
373196,
283089,
242138,
176602,
184799,
291297,
283138,
324098,
233987,
340489,
397841,
283154,
258584,
291359,
348709,
348710,
397872,
283185,
234037,
340539,
266812,
348741,
381515,
348748,
430681,
332379,
111197,
242274,
184938,
373357,
184942,
176751,
389744,
356983,
356984,
209529,
356990,
291455,
373377,
422529,
152196,
201348,
356998,
348807,
356999,
316044,
316050,
275102,
340645,
176805,
176810,
160441,
422591,
291529,
225996,
135888,
242385,
299737,
234216,
373485,
373486,
348921,
234233,
275193,
242428,
299777,
430853,
430860,
62222,
430880,
234276,
283431,
234290,
152372,
430909,
201534,
160576,
348999,
283466,
234330,
275294,
127840,
357219,
439145,
177002,
308075,
242540,
242542,
381811,
201590,
177018,
398205,
291713,
340865,
349066,
316299,
349068,
234382,
308111,
381840,
308113,
390034,
430999,
209820,
283551,
398244,
422825,
381872,
177074,
349122,
127945,
373705,
340960,
398305,
340967,
324587,
234476,
127990,
349176,
201721,
349179,
234499,
357380,
398370,
357413,
357420,
300087,
21567,
308288,
349254,
250955,
218187,
300109,
234578,
250965,
439391,
250982,
398444,
62574,
357487,
300145,
300147,
119925,
349304,
234626,
349315,
349317,
234635,
373902,
177297,
324761,
234655,
234662,
300200,
373937,
324790,
300215,
283841,
283846,
283849,
259275,
316628,
259285,
357594,
414956,
251124,
316661,
292092,
439550,
242955,
439563,
414989,
349458,
259346,
292145,
382257,
382264,
333114,
333115,
193853,
193858,
251212,
234830,
406862,
259408,
283990,
357720,
300378,
300379,
316764,
374110,
292194,
284015,
234864,
316786,
382329,
243073,
357763,
112019,
398740,
234902,
333224,
374189,
251314,
284086,
259513,
54719,
415170,
292291,
300488,
300490,
300526,
259569,
308722,
251379,
300539,
398844,
210429,
366081,
316951,
374297,
431646,
349727,
431662,
374327,
210489,
235069,
349764,
292424,
292426,
128589,
333389,
333394,
349780,
128600,
235096,
300643,
300645,
415334,
54895,
366198,
210558,
210559,
325246,
415360,
333438,
210569,
415369,
431754,
415376,
259741,
153252,
399014,
210601,
317102,
415419,
333508,
259780,
267978,
333522,
325345,
153318,
333543,
325357,
431861,
284410,
284425,
300810,
300812,
284430,
161553,
366358,
169751,
431901,
341791,
325411,
186148,
186149,
333609,
284460,
399148,
202541,
431918,
153392,
431935,
325444,
153416,
325449,
341837,
415566,
431955,
317268,
325460,
341846,
284508,
300893,
259937,
276326,
415592,
292713,
292719,
325491,
341878,
333687,
350072,
276343,
317305,
112510,
325508,
333700,
243590,
325514,
350091,
350092,
350102,
350108,
333727,
219046,
333734,
284584,
292783,
300983,
128955,
153553,
219102,
292835,
6116,
292838,
317416,
432114,
325620,
415740,
268286,
415744,
333827,
243720,
399372,
358418,
178215,
325675,
243763,
358455,
325695,
399433,
333902,
104534,
194667,
432241,
284789,
374913,
374914,
415883,
333968,
153752,
333990,
284840,
104633,
227517,
260285,
268479,
374984,
301270,
301271,
325857,
334049,
268515,
383208,
317676,
260337,
260338,
375040,
309504,
260355,
375052,
194832,
227601,
325904,
334104,
178459,
334121,
317738,
325930,
358698,
260396,
358707,
268609,
227655,
383309,
383327,
391521,
366948,
285031,
416103,
383338,
227702,
211327,
227721,
285074,
252309,
285083,
293275,
39323,
317851,
285089,
301482,
375211,
334259,
342454,
293309,
317889,
326083,
416201,
129484,
326093,
154061,
285152,
432608,
195044,
432616,
334315,
236020,
293368,
317949,
334345,
309770,
342537,
342549,
342560,
416288,
350758,
350759,
358951,
227881,
358952,
293420,
219694,
219695,
23093,
244279,
309831,
55880,
375373,
301647,
244311,
260705,
416353,
375396,
268901,
244326,
244345,
301702,
334473,
375438,
326288,
285348,
318127,
293552,
342705,
285362,
383668,
342714,
39616,
383708,
342757,
269036,
170735,
432883,
342775,
203511,
383740,
432894,
359166,
375552,
228099,
285443,
285450,
383755,
326413,
285457,
285467,
326428,
318247,
318251,
342827,
285496,
301883,
342846,
416577,
244569,
252766,
301919,
293729,
351078,
342888,
228214,
269179,
211835,
260995,
392071,
416649,
236427,
252812,
400271,
392080,
310166,
400282,
359332,
359333,
293801,
326571,
252848,
326580,
261045,
261046,
326586,
359365,
211913,
326602,
56270,
252878,
342990,
433104,
359380,
433112,
433116,
359391,
343020,
187372,
203758,
383980,
383994,
293894,
433166,
384015,
433173,
293911,
326684,
252959,
384031,
375848,
113710,
318515,
203829,
375902,
375903,
392288,
285795,
253028,
228457,
351343,
187505,
187508,
302202,
285819,
343166,
285823,
384127,
392320,
285833,
318602,
285834,
228492,
253074,
326803,
187539,
359574,
285850,
351389,
302239,
253098,
302251,
367791,
367792,
294069,
367798,
294075,
64699,
228541,
343230,
367809,
253124,
113863,
351445,
310496,
228587,
253168,
351475,
351489,
367897,
245018,
367898,
130342,
130344,
130347,
294210,
359747,
359748,
114022,
253288,
327030,
163190,
384379,
253316,
294278,
384391,
318860,
253339,
318876,
253340,
343457,
245160,
359860,
359861,
343480,
310714,
228796,
228804,
425417,
310731,
327122,
425434,
310747,
310758,
40439,
253431,
359931,
343552,
245249,
228868,
294413,
359949,
253456,
302613,
253462,
146976,
245290,
245291,
343606,
425534,
147011,
310853,
286281,
147020,
196184,
179800,
212574,
204386,
155238,
204394,
138862,
310896,
294517,
188021,
286351,
188049,
425624,
229021,
245413,
212649,
286387,
384693,
286392,
302778,
286400,
319176,
302798,
425682,
286419,
294621,
245471,
294629,
212721,
286457,
286463,
319232,
360194,
409355,
278294,
294699,
319289,
384826,
409404,
237397,
376661,
368471,
188250,
368486,
384871,
409446,
40809,
368489,
425832,
417648,
360315,
253828,
327556,
311183,
425875,
294806,
294808,
253851,
376733,
319393,
294820,
294824,
253868,
188349,
98240,
212947,
212953,
360416,
294887,
253930,
278507,
327666,
278515,
385011
] |
9c6d5bf2008bf41e05cfb54ebed7187a56572b4f | 76dafc5eac9d7738378068aaf76b1e3b1f82fff3 | /YiLinkerOnlineSeller/Source/View/TransactionProductDescriptionTableViewCell.swift | 8e96b70a0a0c5f519210d76070140567aac2711b | [] | no_license | nelsoft-easyshop/yilinker-online-seller-ios | 4421cb77df28111378bed96eb5575233e4a9de39 | bb20275e215cf72fc813e8d837db940b306b2703 | refs/heads/master | 2021-06-01T19:42:54.356865 | 2015-09-06T13:01:23 | 2015-09-06T13:01:23 | 39,870,748 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 652 | swift | //
// TransactionProductDescriptionTableViewCell.swift
// YiLinkerOnlineSeller
//
// Created by John Paul Chan on 9/5/15.
// Copyright (c) 2015 YiLinker. All rights reserved.
//
import UIKit
class TransactionProductDescriptionTableViewCell: UITableViewCell {
@IBOutlet weak var productDescriptionLabel: UILabel!
@IBOutlet weak var seeMoreView: UIView!
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
}
}
| [
393537,
284450,
349123,
379140,
213096,
289226,
249067,
277355,
313389,
277904,
271089,
283152,
307219,
244602,
305659,
278303
] |
18a6043153634e9e58e1a78ebece3966e7912808 | 3b66da0a011cb9c842a456e09e6af262f95eabb8 | /PointsUI/Models/History.swift | 860012c442c2a71466dd5091b24d8859a2b0205f | [] | no_license | GoldenStat/Points | aec75a1319c7fd8cc8a2e9a0f209b5c9beed15d5 | 200e8893bbd3b12410203eb1eceb679264dc5caa | refs/heads/main | 2021-08-18T07:09:51.051801 | 2021-06-22T16:09:47 | 2021-06-22T16:09:47 | 199,463,089 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,489 | swift | //
// History.swift
// PointsUI
//
// Created by Alexander Völz on 01.02.20.
// Copyright © 2020 Alexander Völz. All rights reserved.
//
import SwiftUI
/// a list of game States
/// used to record the progression of the entries
/// every state has the individual score of that round
/// e.g. History.states[0] is the first round, History.state[4] are the scores of round 5
class History : ObservableObject {
/// we need three versions for states and buffer :
/// 1. current scores of every round (e.g. [0,0,0]->[2,1,0]->[3,8,2]
/// 2. score changes of every round (e.g. [0,0,0]->[+2,+1,0]->[+1,+7,+2]
/// 3. sum of scores
/// stack of all game states that happened
@Published private(set) var states : [GameState] = []
/// stack of states we need to store temporary
@Published private(set) var savePendingBuffer : GameState?
var needsSaving : Bool { savePendingBuffer != nil }
@Published private(set) var undoBuffer: [GameState] = []
/// the first state in the undo buffer containts our former total
public var storedTotal : GameState? { undoBuffer.first ?? savePendingBuffer }
/// what scores should our players get if we redo all steps (total scores - current game state)
public var redoScores: [ Score ]? {
// subtracts first undoBuffer or last state pending from current state
if let total = storedTotal?.scores {
if let values = currentGameState?.scores {
return zip(values, total - values).map { Score($0, buffer: $1) }
} else {
return total.map { Score(0,buffer: $0) }
}
} else {
if let values = currentGameState?.scores {
return values.map { Score($0) }
} else {
return nil
}
}
}
/// what scores should our players get if we redo all steps (total scores - current game state)
public var tmpScores: [ Score ]? {
// subtracts first undoBuffer or last state pending from current state
if let total = savePendingBuffer?.scores {
if let values = currentGameState?.scores {
return zip(values, total - values).map { Score($0, buffer: $1) }
} else {
return total.map { Score(0,buffer: $0) }
}
} else {
if let values = currentGameState?.scores {
return values.map { Score($0) }
} else {
return nil
}
}
}
/// the last state in our states stack reflects the current game state
public var currentGameState: GameState? { states.last }
var isEmpty: Bool { states.isEmpty && savePendingBuffer != nil && undoBuffer.isEmpty }
/// clear all memory, begin with a clean state
public func reset() {
states = []
savePendingBuffer = nil
undoBuffer = []
}
/// stores given state in buffer, temporarily, same principle as with score
/// overwrites buffer if not empty
/// call save() to store in states
public func store(state: GameState) {
savePendingBuffer = state
}
/// appends given state to buffer, temporarily, same principle as with score
/// call save() to store in states
public func appendBuffer(state: GameState) {
undoBuffer.append(state)
}
/// adds given state to buffer, temporarily, same principle as with score
/// call save() to store in states
public func add(state newState: GameState) {
if let buffer = savePendingBuffer {
savePendingBuffer = buffer + newState.scores
} else {
savePendingBuffer = newState
}
}
public func mergeBuffer() {
/// sums all buffer entries and merges them into one
/// don't think we need this
fatalError("not yet implemented")
}
/// if the buffer has content, delete it
/// if not, remove last step and append it to redoStack
public var canUndo: Bool { states.count > 0 }
public var canRedo: Bool { undoBuffer.count > 0 }
public var maxUndoSteps: Int { states.count }
public var maxRedoSteps: Int { undoBuffer.count }
/// removes the last state and puts it to the end of the buffer stack
public func undo() {
guard states.count > 0 else { return }
undoBuffer.append(states.removeLast())
}
// erase whatever is in the buffer
public func clearBuffer() {
undoBuffer = []
}
/// append last step from redo Stack
/// if there is no step to 'redo', ignore silently
public func redo() {
guard undoBuffer.count > 0 else { return }
states.append(undoBuffer.removeLast())
}
/// makes current changes permanent:
/// saves the buffer if it's not from an undo operation (we know that from the isBuffered value)
/// deletes buffer - we don't have anything to redo, anymore
public func save() {
if let buffer = savePendingBuffer {
states.append(buffer)
savePendingBuffer = nil
}
}
}
extension History {
static var sample : History {
let h = History()
h.add(state: GameState(buffer: [1,0]))
h.add(state: GameState(buffer: [2,3]))
h.add(state: GameState(buffer: [1,4]))
h.add(state: GameState(buffer: [1,0]))
h.save()
return h
}
}
| [
-1
] |
1e5785f88e690459fff2dfb33eaf3e19959877ba | e58732ae32ccd0992e70b437b6c438e00b7792e5 | /zai/settings/UserAccountSettingView.swift | bd86840952a203bc7903f669a75c36a4239d57f4 | [] | no_license | dylanGao/exchangeEx | 354001896c6549456272c847ce4e09db4e31aa31 | a3defe92cd5a0940de53277f788f7403d2507f84 | refs/heads/master | 2021-01-22T03:17:43.038560 | 2017-04-13T15:05:58 | 2017-04-13T15:05:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,777 | swift | //
// UserIdSettingView.swift
// zai
//
// Created by Kyota Watanabe on 1/12/17.
// Copyright © 2017 Kyota Watanabe. All rights reserved.
//
import Foundation
import UIKit
protocol UserAccountSettingDelegate {
func loggedOut(userId: String)
func changePassword()
func changeExchange(setting: UserAccountSettingView)
}
class UserAccountSettingView : SettingView, ValueActionSettingDelegate, VariableSettingCellDelegate, ChangeExchangeDelegate {
init(account: Account, section: Int, tableView: UITableView) {
self.account = account
super.init(section: section, tableView: tableView)
}
override func getCell(tableView: UITableView, indexPath: IndexPath) -> UITableViewCell {
let row = indexPath.row
switch row {
case 0:
let cell = tableView.dequeueReusableCell(withIdentifier: "valueActionSettingCell", for: indexPath) as! ValueActionSettingCell
cell.valueLabel.text = self.account.userId
cell.actionButton.setTitle("ログアウト", for: UIControlState.normal)
cell.actionButton.setTitleColor(Color.keyColor, for: UIControlState.normal)
cell.actionButton.isEnabled = true
cell.delegate = self
return cell
case 1:
let cell = tableView.dequeueReusableCell(withIdentifier: "variableSettingCell", for: indexPath) as! VariableSettingCell
cell.nameLabel.text = "パスワード"
cell.valueLabel.text = "*****"
cell.id = 0
cell.delegate = self
return cell
case 2:
let cell = tableView.dequeueReusableCell(withIdentifier: "variableSettingCell", for: indexPath) as! VariableSettingCell
cell.nameLabel.text = "現在の取引所"
cell.valueLabel.text = self.account.activeExchange.name
cell.id = 1
cell.delegate = self
return cell
case 3:
let cell = tableView.dequeueReusableCell(withIdentifier: "readOnlySettingCell", for: indexPath) as! ReadOnlySettingCell
cell.nameLabel.text = "取引中の通貨ペア"
cell.valueLabel.text = self.account.activeExchange.displayCurrencyPair
return cell
default:
let cell = tableView.dequeueReusableCell(withIdentifier: "readOnlySettingCell", for: indexPath) as! ReadOnlySettingCell
return cell
}
}
override func shouldHighlightRowAt(row: Int) -> Bool {
switch row {
case 0:
return false
case 1:
return true
case 2:
return false
case 3:
return false
default:
return false
}
}
// ValueActionSettingDelegate
func action(cell: ValueActionSettingCell, actionName: String) {
cell.actionButton.isEnabled = false
let userId = self.account.userId
self.delegate?.loggedOut(userId: userId)
}
// VariableSettingCellDelegate
func touchesEnded(id: Int, name: String, value: String) {
switch id {
case 0: self.delegate?.changePassword()
case 1: self.delegate?.changeExchange(setting: self)
default: break
}
}
// ChangeExchangeDelegate
func saved(exchange: String) {
guard let cell = self.tableView.cellForRow(at: IndexPath(row: 2, section: self.section)) as? VariableSettingCell else {
return
}
cell.valueLabel.text = exchange
}
override var sectionName: String {
return "アカウント情報"
}
override var rowCount: Int {
return 4
}
let account: Account
var delegate: UserAccountSettingDelegate?
}
| [
-1
] |
4c450522ddec76c40f118e6445980adf5c2a2f46 | e85c3b6195fa9cbcd7abef168307b28ecc4d26fa | /SResigner/Main/Models/InjectLinkItem.swift | 175ce96eaf8c8ef2c850161aab895041b47c7109 | [] | no_license | zhangbozhb/SResigner | 6a42eeca29ed8943a309c8013777ebd93ab8e535 | 81ef3a4cbde11f6b3fc3beea8e417c9867486fb5 | refs/heads/master | 2022-12-03T14:23:30.605625 | 2020-08-06T14:48:18 | 2020-08-06T14:48:18 | 283,456,851 | 0 | 0 | null | 2020-07-29T09:32:40 | 2020-07-29T09:32:39 | null | UTF-8 | Swift | false | false | 727 | swift | //
// InjectLinkItem.swift
// SResigner
//
// Created by jerry on 2019/3/13.
// Copyright © 2019 com.sz.jerry. All rights reserved.
//
import Foundation
enum DylibLinkItemType: String{
case originSystem
case originInject
case userInject
}
class DylibLinkItem{
var type: DylibLinkItemType = .originSystem
var link: String = ""
var injectResourcePath: String?
init(type: DylibLinkItemType, link: String) {
self.injectResourcePath = nil
self.type = type
self.link = link
}
init(type: DylibLinkItemType, link: String, injectResourcePath: String) {
self.type = type
self.link = link
self.injectResourcePath = injectResourcePath
}
}
| [
-1
] |
47d1cdb4347d19cb97e2d049b6ddac2078bdf799 | 1e54c72d7d58fb04198691f047b0f77d4414bea3 | /Appetit/Networking/AppetitAPI.swift | 9b1b20be9f5800fecc084752e48daf8cf16c1d92 | [
"MIT"
] | permissive | douglas-bot/appetit | 817bcebf5e54ff1a6d22ba9fa9760a72654bb4a8 | a39780f1a9fc66e74eb785b21558afed7829feed | refs/heads/master | 2021-01-11T20:04:18.057660 | 2017-01-19T13:45:56 | 2017-01-19T13:45:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,284 | swift | //
// AppetitAPI.swift
// Appetit
//
// Created by Sense Infoway on 28/12/16.
// Copyright © 2016 Douglas Taquary. All rights reserved.
//
import Foundation
import Moya
enum AppetitAPI {
case items
case item(String)
}
extension AppetitAPI: TargetType {
var baseURL: URL { return URL(string: "https://gist.githubusercontent.com/douglastaquary/526a148691d2357f9752203ac6d6fc3f/raw/12af12f693f5f52d2505157770591f8cf8c453c2")! }
var path: String {
switch self {
case .items:
return "/items.json"
case .item(let itemId):
return "/v1/items/\(itemId)"
}
}
var method: Moya.Method {
switch self {
case .items, .item:
return .get
}
}
var parameters: [String: Any]? {
switch self {
case .item(let itemId):
return ["itemId": itemId]
default:
return ["":""]
}
}
var validate: Bool {
switch self {
default:
return false
}
}
var task: Task {
return .request
}
var sampleData: Data {
switch self {
default:
return Data()
}
}
}
| [
-1
] |
6b465c148ca0e01a7767de704dbea62c8fb73164 | 8525e3fa09c3c5e8f747aa3d39f6e764d02ef9ba | /MeetUp/SigninAuth.swift | 467760d45cd14e3980fd131c5e56aaf2850ff097 | [] | no_license | chrisduan001/Estimeet_iOS | 5bc8a42d921f50d0d61ceb1d5f8aa318f008fce6 | 809b245de44f49cdbbbce4919dbfad669afe8986 | refs/heads/master | 2021-01-24T03:42:45.872726 | 2016-09-17T06:56:08 | 2016-09-17T06:56:08 | 122,899,517 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 784 | swift | //
// SigninAuth.swift
// MeetUp
//
// Created by Chris Duan on 6/03/16.
// Copyright © 2016 Chris. All rights reserved.
//
import Foundation
import ObjectMapper
class SigninAuth: Mappable {
var authHeader: String?
var authUri: String?
var userUId: String?
var phoneNumber: String?
init(authHeader: String, authUri: String, userUId: String, phoneNumber: String) {
self.authHeader = authHeader
self.authUri = authUri
self.userUId = userUId
self.phoneNumber = phoneNumber
}
required init?(_ map: Map) {
}
func mapping(map: Map) {
authHeader <- map["authHeader"]
authUri <- map["authUri"]
userUId <- map["userId"]
phoneNumber <- map["phoneNumber"]
}
}
| [
-1
] |
d9f11ea2f23183db18a123117d4a3f00a425fc3d | 80876085fbeae2c43b00c4fc69017e8efca2d6eb | /iRead/ViewControllers/NavigationController/RootNavigationController.swift | 756119d09905a1714e2fcc90637416f237ea0026 | [] | no_license | RyanFu/iRead | de9ea16ea2c9d7b5e0cd8b79e9f766dd80281043 | a10d554de60050943234e0061e9035afca5237c9 | refs/heads/master | 2020-12-30T16:14:23.926959 | 2016-08-17T01:39:03 | 2016-08-17T01:39:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,339 | swift | //
// RootNavigationController.swift
// iRead
//
// Created by Simon on 16/3/7.
// Copyright © 2016年 Simon. All rights reserved.
//
import UIKit
class RootNavigationController: UINavigationController {
// MARK: - View Life Cycle ♻️
override func viewDidLoad() {
super.viewDidLoad()
interactivePopGestureRecognizer?.delegate = self
delegate = self
}
override func pushViewController(viewController: UIViewController, animated: Bool) {
if animated {
interactivePopGestureRecognizer?.enabled = false
}
super.pushViewController(viewController, animated: animated)
}
override func popToRootViewControllerAnimated(animated: Bool) -> [UIViewController]? {
if animated {
interactivePopGestureRecognizer?.enabled = false
}
return super.popToRootViewControllerAnimated(animated)
}
override func popViewControllerAnimated(animated: Bool) -> UIViewController? {
return super.popViewControllerAnimated(animated)
}
override func popToViewController(viewController: UIViewController, animated: Bool) -> [UIViewController]? {
if animated {
interactivePopGestureRecognizer?.enabled = false
}
return super.popToViewController(viewController, animated: false)
}
// override func preferredStatusBarStyle() -> UIStatusBarStyle {
// return .LightContent
// }
// override func childViewControllerForStatusBarStyle() -> UIViewController? {
// return ArticleViewController()
// }
}
extension RootNavigationController: UINavigationControllerDelegate, UIGestureRecognizerDelegate {
func navigationController(navigationController: UINavigationController, didShowViewController viewController: UIViewController, animated: Bool) {
interactivePopGestureRecognizer?.enabled = false
}
func gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer) -> Bool {
if gestureRecognizer == interactivePopGestureRecognizer {
if viewControllers.count < 2 || visibleViewController == viewControllers[0] {
return false;
}
}
return true
}
}
| [
-1
] |
bbc95fc4999d463768ef33443b3dd0641dd66acd | a7bcbca05a6ec17479b07197ac6eccd3f22c7c6e | /ChatClient.swift | 70afc15e0167249cf2d25d79f373065a6bc1c746 | [
"MIT"
] | permissive | r1cebank/Proxi | 5001a0a7fbba135e50bdc70cbdbb51c22c438e20 | b12a4d337af11b238dd45fae1f39dec4e655ffff | refs/heads/master | 2021-01-23T17:18:43.970866 | 2015-05-25T17:21:27 | 2015-05-25T17:21:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 329 | swift | //
// ChatClient.swift
// Proxi
//
// Created by Siyuan Gao on 4/22/15.
// Copyright (c) 2015 Siyuan Gao. All rights reserved.
//
import Foundation
import MultipeerConnectivity
class ChatClient: NSObject {
var peer: MCPeerID!
var displayName: String!
override init() {
super.init()
}
} | [
-1
] |
199e5d635276753667ec2e8de0075ad111b4d063 | b6d369aab74593a909627f3e8cd0c154b5a6349b | /RadioUI/ViewController.swift | 065ab150d3b0cb2fa4f53c74e65e22b0e1e95750 | [] | no_license | simorakkaus/radioui | 2fafa141a6aae6153184e5731875489b254077e2 | c4fe7812b8cf59776bd1fb70583ccefa4ce8651c | refs/heads/master | 2021-01-21T11:08:25.100549 | 2018-05-23T10:19:32 | 2018-05-23T10:19:32 | 91,726,692 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 13,321 | swift | //
// ViewController.swift
// RadioUI
//
// Created by Simo on 16.02.17.
// Copyright © 2017 Simo. All rights reserved.
//
import UIKit
import SwiftMessages
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UICollectionViewDelegate, UICollectionViewDataSource {
let genresIds = [11,22,33,44]
let genres = ["ЭТНИЧЕСКАЯ / ФОЛК", "КЛАССИКА", "БЛЮЗ", "КАНТРИ", "РЕГГИ / СКА"]
let stations = [
["ИНДИЙСКАЯ МУЗЫКА","РУССКИЙ ФОЛК","ПРАВОСЛАВНАЯ МУЗЫКА", "ФЛАМЕНКО", "ТАНГО", "СРЕДНИЙ ВОСТОК", "КЕЛЬТСКАЯ МУЗЫКА", "СЕВЕРОАМЕРИКАНСКАЯ МУЗЫКА", "ФОЛК", "ЛАТИНОАМЕРИКАНСКАЯ МУЗЫКА", "ВОСТОЧНОАЗИАТСКАЯ МУЗЫКА"],
["СИМФОНИЯ", "КЛАССИЧЕСКОЕ ФОРТЕПЬЯНО", "СИМФОНИЧЕСКАЯ МУЗЫКА", "КЛАССИЧЕСКИЙ ХОРАЛ / ВОКАЛЬНАЯ МУЗЫКА", "ОРГАН", "БАРОККО", "ОПЕРА", "СТРУННАЯ МУЗЫКА"],
["АКУСТИЧЕСКИЙ БЛЮЗ","СОУЛ / НЕО СОУЛ", "ГОСПЕЛ", "ДЕЛЬТА-БЛЮЗ", "ФАНК", "ХАРП-БЛЮЗ", "КАНТРИ-БЛЮЗ", "БУГИ-ВУГИ", "ЧИКАГО-БЛЮЗ", "ХАРД-БЛЮЗ", "БЛЮЗ", "ЭЛЕКТРИК-БЛЮЗ", "СОУЛ-БЛЮЗ"],
["АЛЬТ-КАНТРИ", "БЛЮГРАСС", "КАНТРИ", "ПОП КАНТРИ"],
["РЕГГИ", "ДЭНСХОЛЛ / РАГГАМАФФИН", "РУТС РЕГГИ", "ДАБ", "СКА", "СКА-ПАНК"]
]
var index = Int()
var userDefaults = UserDefaults.standard
func stationsForSelectedGenre(i: Int) {
index = i
shownIndexes.removeAll()
tableView.reloadData()
}
// UIElements
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var collectionView: UICollectionView!
var collectionViewIndexPath = IndexPath()
var tableViewIndexPath = IndexPath()
var shownIndexes : [IndexPath] = []
func detailViewController() {
let vc = self.storyboard?.instantiateViewController(withIdentifier: "DetailViewController")
self.navigationController?.pushViewController(vc!, animated: true)
self.navigationController?.navigationBar.tintColor = .white
self.navigationItem.title = ""
vc?.title = genres[collectionViewIndexPath.row]
self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white]
SwiftMessages.hide()
}
func buyGenreToast(genreName: String){
let toast = MessageView.viewFromNib(layout: .MessageView)
var config = SwiftMessages.Config()
toast.configureTheme(.info, iconStyle: .light)
toast.configureContent(title: "Время вышло!", body: "Время бесплатного прослушивания \(genreName) истекло. Понравился жанр и хотите продолжить прослушивание?")
toast.button?.setTitle("Да", for: .normal)
toast.tapHandler = { _ in
self.detailViewController()
}
toast.buttonTapHandler = { _ in
self.detailViewController()
}
config.dimMode = .gray(interactive: true)
config.duration = .forever
config.presentationStyle = .top
SwiftMessages.show(config: config, view: toast)
}
// TableView functions
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 80
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 12.0
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let headerView = UIView()
headerView.backgroundColor = UIColor.clear
return headerView
}
func numberOfSections(in tableView: UITableView) -> Int {
return stations[index].count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if (shownIndexes.contains(indexPath) == false) {
shownIndexes.append(indexPath)
cell.transform = CGAffineTransform(translationX: 0, y: 80)
cell.alpha = 0
UIView.animate(withDuration: 0.6, delay: 0.1 + Double(indexPath.section) / 20, usingSpringWithDamping: 2, initialSpringVelocity: 1, options: [.curveEaseInOut, .allowUserInteraction], animations: {
cell.transform = CGAffineTransform(translationX: 0, y: 0)
cell.alpha = 1
}, completion: nil)
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "StationCell") as! StationCell
cell.stationLabel.text = stations[index][indexPath.section]
if cell.stationLabel.text == "ПРАВОСЛАВНАЯ МУЗЫКА" {
cell.backgroundColor = hex_5629F3
} else {
cell.backgroundColor = hex_121135
}
if cell.stationLabel.text == "ДЭНСХОЛЛ / РАГГАМАФФИН" || cell.stationLabel.text == "РУТС РЕГГИ" || cell.stationLabel.text == "РЕГГИ" {
cell.freeStationLockedView.isHidden = false
cell.freeTimeStationView.isHidden = true
cell.addedToFavStationView.isHidden = true
} else if cell.stationLabel.text == "ИНДИЙСКАЯ МУЗЫКА" {
cell.freeStationLockedView.isHidden = false
cell.freeTimeStationView.isHidden = true
cell.addedToFavStationView.isHidden = true
} else if cell.stationLabel.text == "РУССКИЙ ФОЛК" {
cell.freeStationLockedView.isHidden = true
cell.freeTimeStationView.isHidden = true
cell.addedToFavStationView.isHidden = false
} else if cell.stationLabel.text == "ФЛАМЕНКО" {
cell.freeStationLockedView.isHidden = true
cell.freeTimeStationView.isHidden = true
cell.addedToFavStationView.isHidden = true
} else {
cell.freeStationLockedView.isHidden = true
cell.freeTimeStationView.isHidden = false
cell.addedToFavStationView.isHidden = true
}
tableViewIndexPath = indexPath
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableViewIndexPath = indexPath
if indexPath.section == 0 {
let vc = storyboard?.instantiateViewController(withIdentifier: "LockedStationDetailViewController")
self.navigationController?.pushViewController(vc!, animated: true)
self.navigationController?.navigationBar.tintColor = .white
self.navigationItem.title = ""
vc?.title = stations[collectionViewIndexPath.row][tableViewIndexPath.row]
self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white]
} else if indexPath.section == 1 {
let vc = storyboard?.instantiateViewController(withIdentifier: "UnlockedStationDetailViewController")
self.navigationController?.pushViewController(vc!, animated: true)
self.navigationController?.navigationBar.tintColor = .white
self.navigationItem.title = ""
vc?.title = stations[collectionViewIndexPath.row][tableViewIndexPath.row]
self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white]
} else if indexPath.section == 3 {
let vc = storyboard?.instantiateViewController(withIdentifier: "UnlockedStationDetailViewController")
self.navigationController?.pushViewController(vc!, animated: true)
self.navigationController?.navigationBar.tintColor = .white
self.navigationItem.title = ""
vc?.title = stations[collectionViewIndexPath.row][tableViewIndexPath.row]
self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white]
} else {
let vc = storyboard?.instantiateViewController(withIdentifier: "TemporaryUnlockedStationDetailViewController")
self.navigationController?.pushViewController(vc!, animated: true)
self.navigationController?.navigationBar.tintColor = .white
self.navigationItem.title = ""
vc?.title = stations[collectionViewIndexPath.row][tableViewIndexPath.row]
self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white]
}
}
// CollectionView functions
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return genres.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "GenreCell", for: indexPath) as! GenreCell
cell.genreLabel.text = genres[indexPath.row]
cell.numberOfStationsLabel.text = "\(stations[indexPath.row].count) станции"
cell.freeTimeLeftLabel.text = "\(stations[indexPath.row].count * 10) часов осталось"
collectionViewIndexPath = indexPath
if cell.genreLabel.text == "РЕГГИ / СКА" {
cell.freeTimeStatusIcon.image = UIImage(named: "lock_black")
cell.freeTimeLeftLabel.text = "0 часов осталось"
cell.quickBuyButton.isHidden = false
cell.quickBuyButton.center = cell.thumbnailImage.center
cell.quickBuyButton.layer.borderWidth = 1
cell.quickBuyButton.layer.borderColor = UIColor.white.cgColor
cell.quickBuyButton.layer.cornerRadius = 6
var gradientLayer: CAGradientLayer!
func createGradientLayer() {
gradientLayer = CAGradientLayer()
gradientLayer.frame = cell.thumbnailImage.bounds
gradientLayer.colors = [hex_081123_alpha_65.cgColor, hex_081123.cgColor]
cell.thumbnailImage.layer.insertSublayer(gradientLayer, at: 1)
}
createGradientLayer()
} else {
cell.freeTimeStatusIcon.image = UIImage(named: "timer_black")
cell.quickBuyButton.isHidden = true
}
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
stationsForSelectedGenre(i: indexPath.row)
collectionViewIndexPath = indexPath
collectionView.scrollToItem(at: indexPath, at: .centeredHorizontally, animated: true)
if indexPath.row == 4 {
buyGenreToast(genreName: genres[4])
}
print("didSelectItemAt: \(collectionViewIndexPath.row)")
}
func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
// if indexPath.row == 4 {
// DispatchQueue.main.asyncAfter(deadline: .now() + 1.0, execute: {
// self.buyGenreToast(genreName: self.genres[4])
// })
// }
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.topItem?.titleView = createAttributedLabel(firstString: "Радио", secondString: " ЛИСТ")
self.tableView.contentInset = UIEdgeInsetsMake(40, 0, 20, 0)
self.navigationController?.navigationBar.backIndicatorImage = UIImage(named: "back_white_nav_filled")
self.navigationController?.navigationBar.backIndicatorTransitionMaskImage = UIImage(named: "back_white_nav_filled")
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
-1
] |
b67bcde346505a1ca596e3da50b5e91f2d084a5e | ed156c1fcc2c717270282af5c51d54ec61b88260 | /Sources/KKUIDevice/ModelType.swift | c83e2bf2d004e6e91f2a78471af10673f3d0c9cc | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | CrazyFanFan/KKUIDevice | 7d0ceb0ad531e21069ede83305a51a9aebd6bab9 | b8861329a1ba859578c86097cbfc318420b12d0e | refs/heads/master | 2023-04-09T03:04:49.460835 | 2023-03-29T14:23:59 | 2023-03-29T14:23:59 | 109,372,852 | 5 | 1 | MIT | 2023-03-29T14:24:01 | 2017-11-03T08:46:07 | Swift | UTF-8 | Swift | false | false | 3,379 | swift | //
// ModelType.swift
// KKUIDevice
//
// Created by Crazy凡 on 2020/4/25.
//
import Foundation
public enum ModelType: String, CaseIterable {
case unknown = "unknown device"
case mac_32 = "Mac(32bit)"
case mac_64 = "Mac(64bit)"
case arm64 = "Mac(ARM)"
case simulator = "Simulator"
case iPad1 = "iPad (gen 1)"
case iPad2 = "iPad 2"
case iPad3 = "iPad (gen 3)"
case iPad4 = "iPad (gen 4)"
case iPad5 = "iPad (gen 5)"
case iPad6 = "iPad (gen 6)"
case iPad7 = "iPad (gen 7)"
case iPad8 = "iPad (gen 8)"
case iPad9 = "iPad (gen 9)"
case iPadMini1 = "iPad mini (gen 1)"
case iPadMini2 = "iPad mini 2"
case iPadMini3 = "iPad mini 3"
case iPadMini4 = "iPad mini 4"
case iPadMini5 = "iPad mini (gen 5)"
case iPadMini6 = "iPad mini (gen 6)"
case iPadAir1 = "iPad Air (gen 1)"
case iPadAir2 = "iPad Air 2"
case iPadAir3 = "iPad Air (gen 3)"
case iPadAir4 = "iPad Air (gen 4)"
case iPadAir5 = "iPad Air (gen 5)"
case iPadPro__9_7_in = "iPad Pro 9.7-in."
case iPadPro__10_5_in = "iPad Pro 10.5-in."
case iPadPro__11_in1 = "iPad Pro 11-in. (gen 1)"
case iPadPro__11_in2 = "iPad Pro 11-in. (gen 2)"
case iPadPro__11_in3 = "iPad Pro 11-in. (gen 3)"
case iPadPro__12_9_in1 = "iPad Pro 12.9-in. (gen 1)"
case iPadPro__12_9_in2 = "iPad Pro 12.9-in. (gen 2)"
case iPadPro__12_9_in3 = "iPad Pro 12.9-in. (gen 3)"
case iPadPro__12_9_in4 = "iPad Pro 12.9-in. (gen 4)"
case iPadPro__12_9_in5 = "iPad Pro 12.9-in. (gen 5)"
case iPodTouch1 = "iPod Touch 1"
case iPodTouch2 = "iPod Touch 2"
case iPodTouch3 = "iPod Touch 3"
case iPodTouch4 = "iPod Touch 4"
case iPodTouch5 = "iPod Touch 5"
case iPodTouch6 = "iPod Touch 6"
case iPodTouch7 = "iPod Touch 7"
case iPhone = "iPhone"
case iPhone3G = "iPhone (3G)"
case iPhone3GS = "iPhone (3GS)"
case iPhone4 = "iPhone 4"
case iPhone4S = "iPhone 4S"
case iPhone5 = "iPhone 5"
case iPhone5c = "iPhone 5c"
case iPhone5s = "iPhone 5s"
case iPhone6Plus = "iPhone 6 Plus"
case iPhone6 = "iPhone 6"
case iPhone6S = "iPhone 6S"
case iPhone6SPlus = "iPhone 6S Plus"
case iPhoneSE = "iPhone SE"
case iPhone7 = "iPhone 7"
case iPhone7Plus = "iPhone 7 Plus"
case iPhone8 = "iPhone 8"
case iPhone8Plus = "iPhone 8 Plus"
case iPhoneX = "iPhone X"
case iPhoneXS = "iPhone XS"
case iPhoneXSMax = "iPhone XS Max"
case iPhoneXR = "iPhone XR"
case iPhone11 = "iPhone 11"
case iPhone11Pro = "iPhone 11 Pro"
case iPhone11ProMax = "iPhone 11 Pro Max"
case iPhoneSE2 = "iPhone SE (2ND)"
case iPhone12Mini = "iPhone 12 Mini"
case iPhone12 = "iPhone 12"
case iPhone12Pro = "iPhone 12 Pro"
case iPhone12ProMax = "iPhone 12 Pro Max"
case iPhoneSE3 = "iPhone SE (3ND)"
case iPhone13Mini = "iPhone 13 Mini"
case iPhone13 = "iPhone 13"
case iPhone13Pro = "iPhone 13 Pro"
case iPhone13ProMax = "iPhone 13 Pro Max"
case iPhone14 = "iPhone 14"
case iPhone14Plus = "iPhone 14 Plus"
case iPhone14Pro = "iPhone 14 Pro"
case iPhone14ProMax = "iPhone 14 Pro Max"
case appleTV2 = "Apple TV (gen 2)"
case appleTV3 = "Apple TV (gen 3)"
case appleTVHD = "Apple TV HD"
case appleTV4K = "Apple TV 4K (gen 1)"
case appleTV4K2 = "Apple TV 4K (gen 2)"
}
| [
-1
] |
3ef323c6a7b8bdc572a7ea8d47bc591bdab0fd65 | 61e1df30e4d462c52b24d460df55536daae2f4dc | /Spreago/Scenes/MainStoryBoard/CustomSplash/New Group/LoginWithEmailAddressViewController.swift | a2f4ff859298d04fa09e85f9008c94cd7c5d42d2 | [] | no_license | emanShedeed/validationExtensionSpreago | 1ecc935c357af1fe471526a8bc26bef6b4749411 | ecabb444fa84c5393db375e37550ac4cdf684929 | refs/heads/main | 2023-01-08T10:13:06.132563 | 2020-11-05T15:15:04 | 2020-11-05T15:15:04 | 310,335,450 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 9,692 | swift | //
// LoginWithEmailAddressViewController.swift
// Spreago
//
// Created by eman shedeed on 6/29/20.
// Copyright © 2020 eman shedeed. All rights reserved.
//
import UIKit
import GoogleSignIn
import ProgressHUD
class LoginWithEmailAddressViewController: UIViewController,UITextFieldDelegate {
//MARK:- IBOutlet
@IBOutlet var textFields: [UITextField]!
@IBOutlet var textFieldsTitleLabels: [UILabel]!
@IBOutlet var validationLabels: [UILabel]!
@IBOutlet weak var togglePasswordAppearanceBtn: UIButton!
@IBOutlet weak var rememberMeBtn: UIButton!
@IBOutlet weak var loginBtn: UIButton!
@IBOutlet weak var continueWithGoogleBtn: UIButton!
//MARK:- Variables
var presenter:LoginWithEmailAddressPresenter!
var introductionPresenter:IntroductionPresenter!
var placeHolder = ""
var label :UILabel = UILabel()
//socila login
var name:String=""
var email:String=""
var socialProvider:String=""
var googleToken:String=""
var validityTypes : [String.ValidityType]!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
presenter = LoginWithEmailAddressPresenter(view: self)
introductionPresenter = IntroductionPresenter(view: self)
setupView()
}
//MARK:- Functions
func setupView(){
validityTypes = [.email,.required]
//textFields
textFields.forEach { (textField) in
textField.delegate=self
textField.addBorderWith(borderColor: UIColor.ButtonBorder!, borderWith: 1.0, borderCornerRadius: 10)
textField.setLeftPaddingPoints(10.0)
///
textField.keyboardToolbar.nextBarButton.setTarget(self, action: #selector(nextBtnPressed))
textField.keyboardToolbar.doneBarButton.setTarget(self, action: #selector(nextBtnPressed))
}
//Buttons
loginBtn.applyShadowWithCornerRadiusAndGradients(cornerRadius: 10.0, borderColor: UIColor.clear, borderWidth: 0.0, with: [UIColor.buttonGradient1!,UIColor.buttonGradient2!], gradient: .horizontal, shadowOffset: CGSize.zero, shadowColor: UIColor.buttonShadow!, shadowOpacity: 1.0, shadowRadius: 3)
continueWithGoogleBtn.applyShadowWithCornerRadiusAndGradients(cornerRadius: 10.0, borderColor: UIColor.lightGray, borderWidth: 0.5, with: [UIColor.white,UIColor.white], gradient: .horizontal, shadowOffset: CGSize.zero, shadowColor: UIColor.lightGray, shadowOpacity: 0.7, shadowRadius: 3.0)
}
//MARK: - IBActions
@IBAction func backBtnPressed(_ sender: Any) {
self.navigationController?.popViewController(animated: true)
// self.dismiss(animated: true, completion: nil)
}
@IBAction func togglePasswordAppearanceBtnPressed(_ sender: Any) {
textFields[1].isSecureTextEntry = !textFields[1].isSecureTextEntry
togglePasswordAppearanceBtn.setImage(textFields[1] .isSecureTextEntry ? UIImage.showPassword! : UIImage.hidePassword! , for: .normal)
}
@IBAction func rememberMeBtnPressed(_ sender: UIButton) {
sender.isSelected = !sender.isSelected
sender.setImage(UIImage.unCheck, for: .normal)
sender.setImage(UIImage.check, for: .selected)
}
@IBAction func loginBtnPressed(_ sender: Any) {
var isCompleted=true
for (index,textField) in textFields.enumerated(){
let (valid, message) = (textField.text?.IsValid(validityTypes[index]))!
validationLabels[index].isHidden=valid
validationLabels[index].text=message
if(!valid){
isCompleted=false
// break
}
}
if isCompleted{
// self.performSegue(withIdentifier: "goToMovesHomeVC", sender: self)
UserDefaults.standard.set(rememberMeBtn.isSelected ? true : false, forKey: Constants.Defaults.rememberMe)
presenter.login(logindata: attempt(email: textFields[0].text!, password: textFields[1].text!))
}
}
@IBAction func signUpBtnPressed(_ sender: Any) {
let signUpVC = self.storyboard?.instantiateViewController(withIdentifier: "SignUpViewController") as! SignUpViewController
self.show(signUpVC, sender: self)
}
@IBAction func forgotPasswordBtnPressed(_ sender: Any) {
let resetPasswordVC = self.storyboard?.instantiateViewController(withIdentifier: "ResetPasswordViewController") as! ResetPasswordViewController
// self.show(resetPasswordVC, sender: self)
self.navigationController?.pushViewController(resetPasswordVC, animated: true)
}
}
extension LoginWithEmailAddressViewController{
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
switch textField {
case textFields[0]:
let (valid, message) = (textFields[0].text?.IsValid(validityTypes[0]))!
if valid {
textFields[1].becomeFirstResponder()
}
// Update Password Validation Label
validationLabels[0].text = message
// Show/Hide Password Validation Label
UIView.animate(withDuration: 0.25, animations: {
self.validationLabels[0].isHidden = valid
})
default:
let (valid, message) = (textField.text?.IsValid(validityTypes[1]))!
if valid {
textFields[1].resignFirstResponder()
}
// Update Password Validation Label
validationLabels[1].text = message
// Show/Hide Password Validation Label
UIView.animate(withDuration: 0.25, animations: {
self.validationLabels[1].isHidden = valid
})
}
return true
}
@objc func nextBtnPressed(textField:UITextField){
_ = textFieldShouldReturn(textField)
}
func textFieldDidBeginEditing(_ textField: UITextField) {
textField.addBorderWith(borderColor: UIColor.appColor2!, borderWith: 1.0, borderCornerRadius: 10)
placeHolder = textField.placeholder ?? ""
textField.placeholder = ""
textFieldsTitleLabels.forEach { (titleLbl) in
if(titleLbl.tag == textField.tag){
titleLbl.isHidden = false
titleLbl.textColor = UIColor.appColor2
}
}
}
func textFieldDidEndEditing(_ textField: UITextField) {
textField.addBorderWith(borderColor: UIColor.ButtonBorder!, borderWith: 1.0, borderCornerRadius: 10)
if textField.placeholder == ""{
textField.placeholder = placeHolder
}
textFieldsTitleLabels.forEach { (titleLbl) in
if(titleLbl.tag == textField.tag){
if(textField.text != ""){
titleLbl.isHidden = false
titleLbl.textColor = UIColor.ButtonBorder
}else{
titleLbl.isHidden = true
}
}
}
}
// MARK: - Helper Methods
// fileprivate func validate(_ textField: UITextField) -> (Bool, String?) {
// guard let text = textField.text else {
// return (false, nil)
// }
//
// if textField == textFields[0] {
// let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"
// let emailTest = NSPredicate(format:"SELF MATCHES %@", emailRegEx)
// return (text.count == 0 ? ( (text.count > 0, "Required Field") ) : (emailTest.evaluate(with:textField.text), "Invalid Email Address."))
// }
// /* if textField == textFields[1] {
// let passwordRegex="^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d]{6,200}$"
// let passwordTest=NSPredicate(format: "SELF MATCHES %@", passwordRegex)
// return(passwordTest.evaluate(with: textField.text ),"6-200 characters, password must contain capital,small letters and numbers.")
// //return (text.count >= 6, "Your password is too short.")
// }*/
//
//
// return (text.count > 0, "Required Field.")
// }
}
//google signin
extension LoginWithEmailAddressViewController{
@IBAction func googleSignInBtnPressed(_ sender: Any) {
let _=NotificationCenter.default.addObserver(forName: .didReceiveGoogleData, object: nil, queue: nil) { (notification) in
if let data = notification.userInfo as? [String: String]
{
// socialData=data
ProgressHUD.dismiss()
self.view.isUserInteractionEnabled = true
if let namest=data["name"]{
self.name=namest
}
if let tokenst=data["idToken"]{
self.googleToken=tokenst
}
if let emailst=data["email"]{
self.email=emailst
}
// if(!self.segued){
// self.segued=true
self.introductionPresenter.loginWithSocial(socialInput: SocialiteInput(token: self.googleToken, provider: "google"))
// }
// NotificationCenter.default.removeObserver(googleLoginObserver)
}
}
GIDSignIn.sharedInstance()?.presentingViewController = self
// GIDSignIn.sharedInstance()?.restorePreviousSignIn()
GIDSignIn.sharedInstance().signIn()
}
}
| [
-1
] |
412eeaa906e28ddaf99f75dadfff1d138e97bde9 | 5a3c08260a81b0d7cfbb081d61f6eb9c7cc341ea | /SavingFlippingVideos/CameraKit/CameraController/VideoOutputSettings.swift | 6f5eb59e27e4f2b7a8032055c5cf912e0a271e3f | [] | no_license | croigsalvador/SavingFlippingVideos | 4aa806d4f7cddf7879883814a1e16b46f5aa16d0 | d1f3867d02422b30b51f1fd8f056460795d8002b | refs/heads/master | 2020-06-14T06:29:44.463672 | 2019-07-04T12:06:50 | 2019-07-04T12:06:50 | 194,933,983 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,123 | swift | //
// VideoOutputSettings.swift
// Vitcord
//
// Created by Juan Garcia on 17/10/18.
// Copyright © 2018 Vitcord. All rights reserved.
//
import AVFoundation
//import GPUImage
struct VideoOutputSettings {
let videoCodecKey: String
let outputSize: VideoOutputSize
var settings: Dictionary<String, AnyObject> {
return [
AVVideoCodecKey : videoCodecKey as AnyObject,
AVVideoWidthKey : outputSize.width as AnyObject,
AVVideoHeightKey : outputSize.height as AnyObject
]
}
static func vitcordVideoOutputSettings() -> VideoOutputSettings {
return VideoOutputSettings(videoCodecKey: AVVideoCodecType.h264.rawValue,
outputSize: VideoOutputSize.vitcordVideoSize())
}
}
struct VideoOutputSize {
let height: CGFloat
let width: CGFloat
// var gpuImageSize: Size {
// return Size(width: Float(self.width), height: Float(height))
// }
static func vitcordVideoSize() -> VideoOutputSize {
return VideoOutputSize(height: 768.0, width: 432.0)
}
}
| [
-1
] |
8727ffc288b5bf825b4ba3d898f5bf2cbfb2e96b | 58350fdd71df97764493d0763ab44b8115737949 | /Kepri/Kepri/AppDelegate.swift | 82204ea1f273cf647f14c29ee4a8bbe68026dd52 | [] | no_license | djoendhie/Application-36 | 87135608c0b13038405b25375da6e49791b7e701 | 41a36d9d3ac6b4bf044349593dc3d309f5452e3f | refs/heads/master | 2021-08-22T22:47:07.894245 | 2017-12-01T14:13:26 | 2017-12-01T14:13:26 | 112,747,540 | 3 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,167 | swift | //
// AppDelegate.swift
// Kepri
//
// Created by SMK IDN MI on 11/25/17.
// Copyright © 2017 Djoendhie. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
229432,
204856,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
98756,
278980,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172612,
377413,
172614,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
254563,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189040,
172660,
287349,
189044,
189039,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
287371,
279178,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
205479,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
189169,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
304009,
213895,
304011,
230284,
304013,
295822,
189325,
213902,
189329,
295825,
304019,
279438,
189331,
58262,
304023,
304027,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
230334,
304063,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
197645,
295949,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
164973,
205934,
279661,
312432,
279669,
337018,
189562,
304258,
279683,
66690,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
279929,
181631,
148865,
312711,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
279991,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
148946,
370130,
222676,
288210,
288212,
288214,
239064,
329177,
288217,
288218,
280027,
288220,
239070,
288224,
370146,
280034,
288226,
288229,
280036,
280038,
288232,
288230,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
181854,
370272,
239202,
370279,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
419555,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
288499,
419570,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
321336,
296767,
288576,
345921,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
275606,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
280819,
157940,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
305464,
280888,
280891,
289087,
108865,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
354656,
313700,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
436684,
281045,
281047,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
330244,
223752,
150025,
338440,
281095,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
289317,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
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,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
240519,
183184,
142226,
289687,
224151,
240535,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
298365,
290174,
306555,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
282481,
110450,
315251,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
44948,
298901,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
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,
307211,
282639,
290835,
282645,
241693,
282654,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
241813,
307352,
299164,
241821,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
299191,
307385,
176311,
258235,
307388,
176316,
307390,
307386,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
184586,
282893,
291089,
282906,
291104,
233766,
299304,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
282957,
110926,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
291226,
242075,
283033,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
291254,
283062,
127417,
291260,
127421,
127424,
299457,
127429,
127434,
315856,
127440,
315860,
176597,
127447,
283095,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
127494,
283142,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
299655,
373383,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
299706,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
234246,
226056,
291593,
234248,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
201496,
234264,
234266,
234269,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
291711,
234368,
291714,
234370,
291716,
234373,
226182,
234375,
201603,
308105,
226185,
234379,
324490,
234384,
234388,
234390,
226200,
234393,
209818,
308123,
234396,
324508,
291742,
324504,
234398,
234401,
291747,
291748,
234405,
291750,
324518,
324520,
234407,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
226239,
226245,
234437,
234439,
234443,
291788,
193486,
234446,
193488,
234449,
316370,
275406,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
234490,
234493,
316416,
234496,
308226,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
234585,
275545,
242777,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
324757,
234647,
234648,
226453,
234650,
308379,
275608,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
177318,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
349451,
177424,
275725,
283917,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
333178,
275834,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
300448,
144807,
144810,
144812,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
243268,
284231,
226886,
128584,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
284249,
276052,
276053,
300638,
284251,
284253,
243293,
284258,
284255,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
399252,
284564,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
292776,
284585,
276395,
276402,
358326,
161718,
358330,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276452,
292839,
276455,
350186,
292843,
276460,
292845,
178161,
227314,
325624,
350200,
276472,
317435,
276479,
350210,
276482,
178181,
317446,
276485,
350218,
276490,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
178224,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
243779,
325700,
284739,
292934,
243785,
276553,
350293,
350295,
309337,
227418,
350299,
350302,
194654,
350304,
178273,
309346,
227423,
194660,
350308,
309350,
309348,
292968,
309352,
350313,
309354,
350316,
227430,
276583,
301167,
276590,
350321,
284786,
276595,
301163,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
153765,
284837,
350375,
350379,
350381,
350383,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309494,
243960,
227583,
276735,
227587,
276739,
211204,
276742,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
293346,
227810,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
285265,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
342707,
154292,
318132,
277173,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
342749,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
56045,
277232,
228081,
56059,
310015,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
293696,
310080,
277317,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
277368,
15224,
416639,
416640,
113538,
310147,
416648,
277385,
39817,
187274,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
276579,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
244731,
285690,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
277804,
285997,
384302,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
146765,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
277892,
277894,
253320,
310665,
318858,
327046,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
40448,
228864,
286214,
228871,
302603,
302614,
302617,
286233,
302621,
286240,
187936,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
245288,
310831,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
302764,
278188,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
229086,
278238,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
280021,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
360322,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
58149c28c03133fb7a59201c7b2e6534f8e28806 | 5fa28cc3a48db24f222fb7d940202f18d72af8d7 | /tb_fb/unused vcs/AddViewController.swift | b832215055dcac419a37b415f2922091a32824ba | [] | no_license | shvetapuri/tastebank | 51314a5280faf368111e1500c76abaeb4783ecad | 0a460cf68f3fb1f8d2bb83c0389ee3c8eff14ee4 | refs/heads/master | 2021-07-15T13:06:28.818495 | 2021-03-10T17:49:40 | 2021-03-10T17:49:40 | 80,555,776 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,964 | swift | //
// AddViewController.swift
// tb_fb
//
// Created by Shveta Puri on 9/19/19.
// Copyright © 2019 Shveta Puri. All rights reserved.
//
import UIKit
class AddViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource {
@IBOutlet weak var addButton: UIButton!
@IBOutlet weak var pickerView: UIPickerView!
var pickerData: [String] = [String] ()
@IBOutlet weak var addView: addView!
var tastesManager: TastesManager?
var category: String = "Dish"
var imagePicker = UIImagePickerController()
@IBOutlet weak var imageView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
pickerData = ["Dish", "Dessert", "Wine", "Coffee", "Beer", "Chocolate", "Cheese", "Other"]
pickerView.delegate = self
pickerView.dataSource = self
//when first loaded show dish in pickerview
pickerView.selectRow(0, inComponent: 0, animated: true)
let labels = tastesManager?.returnLabels(category: category)
addView.show( labels: labels!)
//tap will dismiss text field keyboard
let tap = UITapGestureRecognizer(target: self.view, action: #selector(UIView.endEditing))
view.addGestureRecognizer(tap)
imageView.isHidden = true
}
//Picker view
//number of columns
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return pickerData.count
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return pickerData[row]
}
// picker view selection
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
// This method is triggered whenever the user makes a change to the picker selection.
category = pickerData[row]
addView.show(labels: (tastesManager?.returnLabels(category: category))!)
}
@IBAction func addImage(_ sender: Any) {
let alert:UIAlertController=UIAlertController(title: "Choose Image", message: nil, preferredStyle: UIAlertController.Style.actionSheet)
let cameraAction = UIAlertAction(title: "Camera", style: UIAlertAction.Style.default) {
UIAlertAction in
self.openCamera(UIImagePickerController.SourceType.camera)
}
let galleryAction = UIAlertAction(title: "Gallery", style: UIAlertAction.Style.default) {
UIAlertAction in
self.openCamera(UIImagePickerController.SourceType.photoLibrary)
}
let cancelAction = UIAlertAction(title: "Cancel", style: UIAlertAction.Style.cancel) {
UIAlertAction in
}
// Add the actions
imagePicker.delegate = self
alert.addAction(cameraAction)
alert.addAction(galleryAction)
alert.addAction(cancelAction)
self.present(alert, animated: true, completion: nil)
}
func openCamera(_ sourceType: UIImagePickerController.SourceType) {
imagePicker.sourceType = sourceType
self.present(imagePicker, animated: true, completion: nil)
}
//add button action
@IBAction func addButtonTapped(_ sender: Any) {
// !!!!check that there is a name and rating otherwise give error
//
//build a dictionary out of all data in text fields
var dictOfTaste: [String: Any] = [:]
for i in 0...addView.usedlabelsArray.count-1 {
dictOfTaste[addView.usedlabelsArray[i].text!] = addView.usedTextFieldArray[i].text
}
dictOfTaste["Category"] = category
var t: Tastes?
if ((imageView.image) != nil) {
//create a taste object
dictOfTaste["image"] = createThumbnail(image:imageView.image!)
t = Tastes(dictionary: dictOfTaste)
imageView.image = nil
} else {
//create a taste object
t = Tastes(dictionary: dictOfTaste)
}
if ((t) != nil) {
let msg = tastesManager?.addTasteToDB(TasteObj: t!, BypassCheckFlag: false)
//save in tastesManager
if(msg == "duplicate") {
//present alert
let alertDup = UIAlertController(title:"Duplicate Taste", message: "You are entering a duplicate taste, would you like to continue to save it or cancel?", preferredStyle: .alert)
alertDup.addAction(UIAlertAction(title: "Continue Saving", style: .default, handler: {(action:UIAlertAction!) in
//self.tastesManager?.addTasteToDB(TasteObj: t!, BypassCheckFlag: true)
self.checkDish()
}))
alertDup.addAction(UIAlertAction(title: "Go Back", style: .cancel , handler: nil))
present(alertDup, animated: true, completion: nil)
} else {
checkDish()
}
} else {
print ("error saving taste")
}
}
func checkDish() {
if (category == "Dish") {
//check to see if user wants to add more dishes to the current restaurant\
let alert = UIAlertController(title:"Add Another Dish?", message: "Would you like to add another dish for this restauran?", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Yes", style: .default, handler: {(action:UIAlertAction!) in self.addView.text1.text = ""
self.addView.text2.text = ""
}));
alert.addAction(UIAlertAction(title: "No", style: .cancel, handler: {(action:UIAlertAction!) in self.dismiss(animated: true, completion: nil)}))
present(alert, animated: true, completion: nil)
} else {
//go back to main controller
dismiss(animated: true, completion: nil)
}
}
func createThumbnail (image: UIImage) -> Data {
let imageData = image.pngData()
let options = [
kCGImageSourceCreateThumbnailWithTransform: true,
kCGImageSourceCreateThumbnailFromImageAlways: true,
kCGImageSourceThumbnailMaxPixelSize: 150] as CFDictionary
let source = CGImageSourceCreateWithData(imageData! as CFData, nil)!
let imageReference = CGImageSourceCreateThumbnailAtIndex(source, 0, options)!
let thumbnail = UIImage(cgImage: imageReference)
return thumbnail.pngData()!
}
@IBAction func cancelTapped(_ sender: Any) {
//go back to main controller
dismiss(animated: true, completion: nil)
}
/*
// 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.
}
*/
}
extension AddViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
//MARK:UIImagePickerControllerDelegate
func imagePickerController(_ picker: UIImagePickerController,
didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
imageView.isHidden = false
imageView.image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage
imagePicker.dismiss(animated: true, completion: nil)
}
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
print("imagePickerController cancel")
}
}
| [
-1
] |
2060df7e49a78c764c0f42a0ef83964f2e76ef8b | 3e7e35ce15686fe3e83d81535763ae2efcaf26c4 | /CineCity/AdminFilmViewController.swift | c78b40909b75b1ce5ea5a91b2ea38e3fa7447427 | [] | no_license | tkaing/CineCity | 2fb5c34ddde62d336d72b6269579c0f19be8c15f | 615552a9436d67876776966278258d9b3851aa97 | refs/heads/master | 2020-11-27T02:10:40.925644 | 2020-02-13T10:14:32 | 2020-02-13T10:14:32 | 229,267,933 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,393 | swift | //
// AdminFilmViewController.swift
// CineCity
//
// Created by Thierry Kg on 11/02/2020.
// Copyright © 2020 Vtd. All rights reserved.
//
import UIKit
class AdminFilmViewController: UIViewController {
@IBOutlet var textTitle: UITextField!
@IBOutlet var textReleaseDate: UITextField!
@IBOutlet var buttonSave: UIButton!
@IBOutlet var imageViewFilm: UIImageView!
@IBOutlet var add_film: UILabel!
@IBOutlet var button_choose_cover: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
buttonSave.setTitle(NSLocalizedString("save", comment: ""), for: .normal)
button_choose_cover.setTitle(NSLocalizedString("choosecover", comment: ""), for: .normal)
add_film.text = NSLocalizedString("addfilm", comment: "")
}
var filmCall: FilmCall {
return FilmCallAPI()
}
func afterSave() {
self.buttonSave.isUserInteractionEnabled = true
}
func beforeSave() {
self.buttonSave.isUserInteractionEnabled = false
}
func formValidation() -> Bool {
return textTitle.text != "" && textReleaseDate.text != ""
}
@IBAction func pressSave(_ sender: UIButton) {
self.beforeSave()
if formValidation() {
guard
let image = imageViewFilm.image,
let imageEncoded = image.toBase64()
else { return }
let item: [String:Any] = [
"id": -1,
"title": textTitle.text as Any,
"releaseDate": textReleaseDate.text as Any,
"image": imageEncoded as Any
]
if let film = FilmUtils.map(item: item) {
filmCall.save(object: film) { (film) in
if film != nil {
self.textTitle.text = ""
self.textReleaseDate.text = ""
self.alertCustom(title: "Succès", message: "Votre film a été ajouté.")
} else {
self.alertCustom(title: "Échec", message: "Votre ajout de film n'a pas pu aboutir.")
}
self.afterSave()
}
} else {
self.alertCustom(title: "Échec", message: "Votre ajout de film n'a pas pu aboutir.")
self.afterSave()
}
} else {
self.alertCustom(title: "Échec", message: "Votre ajout de film n'a pas pu aboutir.")
self.afterSave()
}
}
@IBAction func pressGallery(_ sender: UIButton) {
guard UIImagePickerController.isSourceTypeAvailable(.photoLibrary) else {
return
}
let picker = UIImagePickerController()
picker.sourceType = .photoLibrary
picker.delegate = self
picker.allowsEditing = true
self.present(picker, animated: true)
}
}
extension AdminFilmViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
guard let image = info[.editedImage] as? UIImage else {
return
}
self.imageViewFilm.image = image
picker.dismiss(animated: true)
}
}
| [
-1
] |
5edcdad178833fba870cb4b636714d427f1747c5 | 5f122955c0774f9d5ccea2eddfa0431945574d6c | /Hashtags/Classes/HashtagCollectionViewCell.swift | 7b384c904fa886457a21b264071c89a5d3fd1a7c | [
"MIT"
] | permissive | OsamaMukhtar/Hashtags | e418d1d42f9a22799bc4178056de69370995396c | 58a33e408ea28892db798fab0b9e731675521349 | refs/heads/master | 2020-04-28T04:07:44.723925 | 2020-03-18T15:23:51 | 2020-03-18T15:23:51 | 174,965,869 | 0 | 1 | null | 2019-03-11T09:20:00 | 2019-03-11T09:20:00 | null | UTF-8 | Swift | false | false | 4,107 | swift | //
// HashtagCollectionViewCell.swift
// Hashtags
//
// Created by Oscar Götting on 6/8/18.
// Copyright © 2018 Oscar Götting. All rights reserved.
//
import Foundation
import UIKit
public protocol HashtagDelegate: class {
func onSelectHashtag(hashtag: HashTag)
}
open class HashtagCollectionViewCell: UICollectionViewCell {
static let cellIdentifier = "HashtagCollectionViewCell"
var paddingLeftConstraint: NSLayoutConstraint?
var paddingRightConstraint: NSLayoutConstraint?
var paddingTopConstraint: NSLayoutConstraint?
var paddingBottomConstraint: NSLayoutConstraint?
var index : Int?
lazy var wordLabel : UILabel = {
let lbl = UILabel()
lbl.textColor = UIColor.white
lbl.textAlignment = .center
lbl.translatesAutoresizingMaskIntoConstraints = false
return lbl
}()
open var hashtag: HashTag?
open weak var delegate: HashtagDelegate?
override init(frame: CGRect) {
super.init(frame: frame)
setup()
}
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setup()
}
open func setup() {
self.clipsToBounds = true
self.addSubview(wordLabel)
// Padding left
self.paddingLeftConstraint = self.wordLabel.leadingAnchor.constraint(equalTo: self.leadingAnchor)
self.paddingLeftConstraint!.isActive = true
// Padding top
self.paddingTopConstraint = self.wordLabel.topAnchor.constraint(equalTo: self.topAnchor)
self.paddingTopConstraint!.isActive = true
// Padding bottom
self.paddingBottomConstraint = self.wordLabel.bottomAnchor.constraint(equalTo: self.bottomAnchor)
self.paddingBottomConstraint!.isActive = true
// Padding right
self.paddingRightConstraint = self.wordLabel.rightAnchor.constraint(equalTo: self.rightAnchor)
self.paddingRightConstraint!.isActive = true
}
open override func prepareForInterfaceBuilder() {
self.wordLabel.text = ""
super.prepareForInterfaceBuilder()
}
open func configureWithTag(tag: HashTag, configuration: HashtagConfiguration) {
self.hashtag = tag
wordLabel.text = tag.text
self.paddingLeftConstraint!.constant = configuration.paddingLeft
self.paddingTopConstraint!.constant = configuration.paddingTop
self.paddingBottomConstraint!.constant = -1 * configuration.paddingBottom
self.paddingRightConstraint!.constant = -1 * configuration.paddingRight
self.layer.cornerRadius = configuration.cornerRadius
self.layer.masksToBounds = false
// shadow
self.layer.shadowColor = UIColor.black.cgColor
self.layer.shadowOffset = CGSize(width: 0, height: 2)
self.layer.shadowOpacity = 0.3
self.layer.shadowRadius = 2
var randomColorIndex = index!.remainderReportingOverflow(dividingBy: configuration.backgroundColor.count).partialValue
if randomColorIndex < 0
{
randomColorIndex = 0
}
else if randomColorIndex >= configuration.backgroundColor.count {
randomColorIndex = configuration.backgroundColor.count - 1
}
switch hashtag?.subtype {
case .Others:
self.backgroundColor = configuration.backgroundColor[0]
case .Product:
self.backgroundColor = configuration.backgroundColor[1]
case .Location:
self.backgroundColor = configuration.backgroundColor[2]
case .Person:
self.backgroundColor = configuration.backgroundColor[3]
case .Organization:
self.backgroundColor = configuration.backgroundColor[4]
default:
self.backgroundColor = configuration.backgroundColor[randomColorIndex]
}
self.wordLabel.textColor = configuration.textColor
self.layer.borderWidth = configuration.borderWidth
self.wordLabel.font = UIFont.systemFont(ofSize: configuration.textSize)
}
}
| [
-1
] |
3cfe9c9245d273b386ab6909d9f21006f395d8c9 | e16d3e5e3e5a6fcaf075337c835bb71890618adc | /SwiftUIExamples/SwiftUIExamples/AppDelegate.swift | d02e961d75893af5c229d7962568507765b09315 | [] | no_license | appleiOSdevelopers/letslearnswift | 37388e315bb3ad56f2962bb3fe80e86905f73542 | b4661559a22669931954d685d343e25c752f925b | refs/heads/master | 2023-03-21T07:16:17.233556 | 2021-01-20T23:58:25 | 2021-01-20T23:58:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,415 | swift | //
// AppDelegate.swift
// SwiftUIExamples
//
// Created by MAC on 6.05.2020.
// Copyright © 2020 cagdaseksi. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
| [
393222,
393224,
393230,
393250,
344102,
393261,
393266,
163891,
213048,
376889,
385081,
393275,
376905,
327756,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
286831,
286844,
262283,
286879,
286888,
377012,
327871,
377036,
180431,
377046,
377060,
327914,
205036,
393456,
393460,
418043,
336123,
336128,
385280,
262404,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
262472,
344403,
213332,
65880,
418144,
262496,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
328206,
410128,
393747,
254490,
188958,
385570,
33316,
197159,
377383,
352821,
188987,
418363,
369223,
385609,
385616,
352856,
352864,
369253,
262760,
352874,
352887,
254587,
336512,
377472,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
164538,
328378,
328386,
352968,
344776,
418507,
352971,
385742,
385748,
361179,
139997,
189153,
369381,
361195,
418553,
344831,
336643,
344835,
344841,
361230,
336659,
418580,
418585,
434970,
369435,
418589,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
336711,
328522,
336714,
426841,
254812,
361309,
197468,
361315,
361322,
328573,
377729,
369542,
361360,
222128,
345035,
345043,
386003,
386011,
386018,
386022,
435187,
328702,
328714,
361489,
386069,
336921,
386073,
336925,
345118,
377887,
345133,
345138,
386101,
197707,
189520,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
386258,
328924,
66782,
222437,
328941,
386285,
386291,
345376,
353570,
345379,
410917,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181649,
181654,
230809,
181670,
181673,
181681,
337329,
181684,
181690,
361917,
181696,
337349,
181703,
337365,
271839,
329191,
361960,
329194,
116210,
337398,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
345701,
394853,
222830,
370297,
403070,
403075,
345736,
198280,
345749,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
419512,
337592,
337599,
419527,
419530,
419535,
272081,
419542,
394966,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
337659,
141051,
337668,
362247,
395021,
362255,
321299,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
345930,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
337833,
362413,
337844,
346057,
247759,
346063,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
100453,
329832,
329855,
329867,
329885,
411805,
346272,
362660,
100524,
387249,
379066,
387260,
256191,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
321786,
379134,
411903,
379152,
387349,
338199,
387352,
182558,
338211,
395566,
248111,
362822,
436555,
190796,
321879,
354673,
321910,
248186,
420236,
379278,
354727,
338352,
330189,
338381,
338386,
338403,
338409,
248308,
199164,
330252,
199186,
420376,
330267,
354855,
10828,
199249,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
338660,
338664,
264941,
363251,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
355175,
355179,
330610,
330642,
355218,
412599,
207808,
379848,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
330760,
330768,
248862,
396328,
158761,
199728,
330800,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
183383,
339036,
412764,
257120,
248951,
420984,
330889,
347287,
248985,
339097,
44197,
380070,
339112,
249014,
126144,
330958,
330965,
265432,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
372015,
347441,
372018,
199988,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
175486,
249214,
175489,
249218,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
388542,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
249308,
339420,
339424,
339428,
339434,
249328,
69113,
372228,
339461,
208398,
380432,
175635,
339503,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
224897,
372353,
216707,
126596,
339588,
421508,
224904,
224909,
11918,
159374,
224913,
126610,
339601,
224916,
224919,
126616,
224922,
208538,
224926,
224929,
224932,
224936,
257704,
224942,
257712,
224947,
257716,
257720,
224953,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
257761,
224993,
257764,
224999,
339695,
225012,
257787,
225020,
339710,
257790,
225025,
339721,
257801,
257804,
225038,
257807,
225043,
372499,
167700,
225048,
257819,
225053,
184094,
225058,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
225103,
257871,
397139,
225108,
257883,
257886,
225119,
257890,
339814,
225127,
257896,
274280,
257901,
225137,
339826,
257908,
225141,
257912,
225148,
257916,
257920,
225155,
339844,
225165,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
405533,
430129,
217157,
421960,
356439,
430180,
421990,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
225493,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
389380,
356637,
356640,
356643,
356646,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
348502,
250199,
250202,
332125,
250210,
348525,
332152,
389502,
250238,
332161,
356740,
332172,
373145,
340379,
389550,
324030,
340451,
160234,
127471,
340472,
324094,
266754,
324099,
324102,
324111,
340500,
324117,
324131,
332324,
381481,
324139,
356907,
324142,
356916,
324149,
324155,
348733,
324160,
324164,
356934,
348743,
381512,
324170,
324173,
324176,
389723,
332380,
381545,
340627,
184982,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
332493,
357069,
357073,
332511,
332520,
340718,
332533,
348924,
389892,
373510,
389926,
152370,
348978,
340789,
348982,
398139,
127814,
357206,
389978,
430939,
357211,
357214,
201579,
201582,
349040,
340849,
201588,
430965,
381813,
324472,
398201,
119674,
340858,
324475,
430972,
340861,
324478,
324481,
373634,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
422816,
324513,
201637,
398245,
324524,
340909,
324533,
5046,
324538,
324541,
398279,
340939,
340941,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
381946,
349180,
439294,
431106,
209943,
209946,
250914,
185380,
357418,
209965,
209968,
209971,
209975,
209979,
209987,
209990,
341071,
349267,
250967,
210010,
341091,
210025,
210027,
210030,
210039,
341113,
349308,
210044,
349311,
152703,
160895,
210052,
349319,
210055,
210067,
210071,
210077,
210080,
251044,
210084,
185511,
210088,
210095,
210098,
210107,
210115,
332997,
333009,
210131,
333014,
210138,
218354,
218360,
251128,
275706,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
210260,
365911,
259421,
365921,
333154,
251235,
374117,
333162,
234866,
390516,
333175,
357755,
251271,
136590,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
423392,
333284,
366056,
366061,
210420,
423423,
366117,
144939,
210487,
349761,
415300,
333386,
333399,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
333498,
210631,
333511,
358099,
153302,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
366387,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
259938,
399206,
268143,
358255,
399215,
358259,
341876,
333689,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
358339,
333774,
358371,
350189,
350193,
333818,
350202,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
334011,
260289,
260298,
350410,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
325891,
350467,
350475,
350480,
432405,
350486,
350490,
325914,
325917,
350493,
350498,
350504,
358700,
350509,
391468,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
416157,
342430,
268701,
375208,
326058,
375216,
334262,
334275,
326084,
358856,
334304,
334311,
375277,
334321,
350723,
186897,
342545,
334358,
342550,
342554,
334363,
350761,
252461,
334384,
383536,
358961,
334394,
252482,
219718,
334407,
334420,
350822,
375400,
334465,
334468,
162445,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
334528,
260801,
350917,
154317,
391894,
154328,
416473,
64230,
113388,
342766,
375535,
203506,
342776,
391937,
391948,
375568,
326416,
375571,
162591,
326441,
326451,
326454,
326460,
244540,
260924,
375612,
326467,
244551,
326473,
326477,
326485,
416597,
326490,
342874,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
326598,
359366,
359382,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
359451,
261147,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
384107,
367723,
187502,
343154,
384114,
212094,
351364,
384135,
384139,
384143,
351381,
384151,
384160,
384168,
367794,
244916,
384181,
384188,
384191,
351423,
326855,
244937,
384201,
343244,
384208,
146642,
384224,
359649,
343270,
351466,
384246,
351479,
343306,
261389,
359694,
261393,
384275,
384283,
245020,
384288,
245029,
171302,
351534,
376110,
245040,
425276,
384323,
212291,
343365,
212303,
367965,
343393,
343398,
367980,
343409,
253303,
154999,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
327275,
245357,
138864,
155254,
155273,
245409,
425638,
425649,
155322,
425662,
155327,
245460,
155351,
155354,
212699,
245475,
155363,
245483,
409335,
155393,
155403,
245525,
155422,
360223,
155438,
155442,
155447,
155461,
360261,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
262005,
147317,
425845,
262008,
262011,
155516,
155521,
155525,
360326,
376714,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
384977,
393169,
155611,
155619,
253923,
155621,
253926,
327654,
393203,
360438,
253943,
393206,
393212,
155646
] |
1a4f9872d7ae4f2b52c8e50c93addf37459f5b57 | 0e519f37935268b21a97fca14f6314870b5e4917 | /QuizletCloneNewNewNew/SceneDelegate.swift | 33978f6a1816936505a3d95837a4c7d35572e5a1 | [] | no_license | ansocab/quizlet-clone | fc95965be2e27bc94a192472c3ee583b3ad2a877 | 4f87f18d8d9719e23967901e2defdbb156614604 | refs/heads/master | 2023-02-02T21:39:51.440344 | 2020-12-07T15:35:59 | 2020-12-07T15:35:59 | 319,363,079 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,372 | swift | //
// SceneDelegate.swift
// QuizletCloneNewNewNew
//
// Created by Ana Sofia Caballero on 13/12/2019.
// Copyright © 2019 Ana Caballero. All rights reserved.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
| [
393221,
163849,
393228,
393231,
393251,
352294,
344103,
393260,
393269,
213049,
376890,
385082,
16444,
393277,
376906,
327757,
254032,
286804,
368728,
180314,
254045,
368736,
180322,
376932,
286833,
286845,
286851,
417925,
262284,
360598,
286880,
286889,
377003,
377013,
164029,
327872,
180418,
377030,
377037,
180432,
377047,
418008,
385243,
418012,
377063,
327915,
205037,
393457,
393461,
418044,
336124,
385281,
336129,
262405,
180491,
164107,
336140,
262417,
368913,
262423,
377118,
377121,
262437,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
262497,
418145,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
336326,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
98819,
164362,
328207,
410129,
393748,
377372,
188959,
385571,
377384,
197160,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
385610,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
336517,
344710,
385671,
148106,
377485,
352919,
98969,
336549,
344745,
361130,
336556,
385714,
434868,
164535,
336568,
328379,
164539,
328387,
352969,
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,
271154,
328498,
369464,
361274,
328516,
336709,
328520,
336712,
361289,
328523,
336715,
361300,
213848,
426842,
361307,
197469,
361310,
254813,
361318,
344936,
361323,
361335,
328574,
369544,
222129,
345036,
386004,
345046,
386012,
386019,
328690,
435188,
328703,
328710,
418822,
328715,
377867,
361490,
386070,
336922,
345119,
377888,
328747,
345134,
345139,
361525,
386102,
361537,
377931,
197708,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
386168,
410746,
361594,
214150,
345224,
386187,
337048,
345247,
361645,
345268,
337076,
402615,
361657,
337093,
402636,
328925,
222438,
386286,
328942,
386292,
206084,
115973,
345377,
353572,
345380,
345383,
263464,
337207,
345400,
378170,
369979,
337224,
337230,
337235,
263509,
353634,
337252,
402792,
345449,
99692,
271731,
378232,
337278,
271746,
181639,
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,
419377,
419386,
206397,
214594,
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,
337601,
403139,
337607,
419528,
419531,
272083,
394967,
419545,
345819,
419548,
181982,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
141052,
337661,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
116512,
378664,
354107,
345916,
354112,
247618,
370504,
329545,
345932,
354124,
370510,
354132,
337751,
247639,
370520,
313181,
354143,
354157,
345965,
345968,
345971,
345975,
182136,
403321,
1914,
354173,
247692,
395148,
337809,
247701,
329625,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
346059,
346064,
247760,
346069,
419810,
329699,
354275,
190440,
247790,
354314,
346140,
337980,
436290,
378956,
395340,
436307,
338005,
329816,
100454,
329833,
329853,
329857,
329868,
411806,
329886,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
256214,
411862,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
436474,
321787,
379135,
411905,
411917,
43279,
379154,
395539,
387350,
387353,
338201,
182559,
338212,
395567,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
182642,
321911,
420237,
379279,
354728,
338353,
338363,
338382,
272849,
248279,
256474,
338404,
338411,
330225,
248309,
199165,
248332,
330254,
199182,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
191085,
338544,
191093,
346743,
330384,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
355029,
264919,
338661,
264942,
330479,
363252,
338680,
207620,
264965,
191240,
338701,
256787,
363294,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
355151,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
355185,
330612,
330643,
412600,
207809,
379849,
396246,
330711,
248794,
248799,
437219,
257009,
265208,
330750,
265215,
199681,
338951,
330761,
330769,
330775,
248863,
158759,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
330830,
248915,
183384,
339037,
412765,
257121,
322660,
265321,
330869,
248952,
420985,
330886,
330890,
347288,
248986,
44199,
380071,
339118,
339133,
126148,
322763,
330959,
330966,
265433,
265438,
388320,
363757,
388348,
339199,
396552,
175376,
175397,
208167,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
126279,
437576,
437584,
331089,
437588,
331094,
396634,
175451,
437596,
429408,
175458,
208228,
175461,
175464,
265581,
331124,
175478,
249210,
175484,
249215,
175487,
249219,
175491,
249225,
249228,
249235,
175514,
175517,
396703,
396706,
175523,
355749,
396723,
380353,
339401,
380364,
339406,
372177,
339414,
413143,
249303,
339418,
339421,
249310,
339425,
249313,
339429,
339435,
249329,
69114,
372229,
339464,
249355,
208399,
175637,
405017,
134689,
339504,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
339572,
224885,
224888,
224891,
224895,
372354,
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,
224987,
257762,
224996,
225000,
339696,
225013,
257788,
225021,
339711,
257791,
225027,
257796,
339722,
257802,
257805,
225039,
257808,
249617,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
257825,
225059,
339748,
225068,
257837,
413485,
225071,
225074,
257843,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
323404,
257869,
257872,
225105,
339795,
397140,
225109,
225113,
257881,
257884,
257887,
225120,
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,
372739,
405534,
266295,
266298,
217158,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
225439,
135328,
225442,
438434,
192674,
225445,
438438,
225448,
438441,
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,
356631,
356638,
356641,
356644,
356647,
266537,
356650,
389417,
356656,
332081,
307507,
340276,
356662,
397623,
332091,
225599,
332098,
201030,
348489,
332107,
151884,
430422,
348503,
332118,
250201,
332130,
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,
381513,
348745,
324171,
324174,
324177,
389724,
332381,
373344,
381546,
119432,
340628,
184983,
373399,
340639,
258723,
332460,
389806,
332464,
332473,
381626,
332484,
332487,
332494,
357070,
357074,
332512,
332521,
340724,
332534,
155647,
348926,
389927,
348979,
152371,
340792,
398141,
127815,
357202,
389971,
357208,
136024,
389979,
430940,
357212,
357215,
201580,
201583,
349041,
340850,
201589,
381815,
430967,
324473,
398202,
119675,
324476,
430973,
340859,
340863,
324479,
324482,
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,
431100,
349181,
431107,
209944,
209948,
250915,
250917,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
209996,
431180,
341072,
349268,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
152704,
160896,
349313,
210053,
210056,
373905,
259217,
210068,
210072,
210078,
210081,
210085,
210089,
210096,
210100,
324792,
210108,
210116,
210128,
333010,
210132,
333016,
210139,
210144,
218355,
251123,
218361,
275709,
275713,
242947,
275717,
275723,
333075,
349460,
333079,
251161,
349486,
349492,
415034,
251211,
210261,
365912,
259423,
374113,
251236,
374118,
333164,
234867,
390518,
357756,
374161,
112021,
349591,
333222,
210357,
259516,
415168,
366035,
415187,
366039,
415192,
415194,
415197,
415200,
333285,
415208,
366057,
366064,
415217,
415225,
423424,
415258,
415264,
366118,
415271,
349739,
144940,
415279,
415282,
415286,
210488,
415291,
415295,
333387,
333396,
333400,
333415,
423529,
423533,
333423,
210547,
415354,
333440,
267910,
333472,
333512,
259789,
358100,
366301,
333535,
153311,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
366349,
210707,
399129,
333593,
333595,
210720,
358192,
366384,
210740,
366388,
358201,
399166,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
358235,
341852,
350046,
399200,
399208,
358256,
268144,
358260,
341877,
399222,
325494,
186233,
333690,
243584,
325505,
333699,
399244,
333709,
333725,
333737,
382891,
382898,
333767,
350153,
358348,
333777,
219094,
399318,
358372,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
268299,
333838,
350225,
350232,
333851,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
342113,
252021,
342134,
374904,
268435,
333989,
333998,
334012,
260299,
350411,
350417,
350423,
211161,
350426,
334047,
350449,
358645,
350454,
350459,
350462,
350465,
350469,
325895,
268553,
194829,
350477,
268560,
350481,
432406,
350487,
350491,
325915,
350494,
325918,
325920,
350500,
350505,
358701,
391469,
350510,
358705,
358714,
358717,
383307,
358738,
334162,
383331,
383334,
391531,
383342,
334204,
268669,
194942,
391564,
366991,
334224,
268702,
342431,
375209,
326059,
375220,
342453,
334263,
326087,
358857,
195041,
334312,
104940,
375279,
350724,
186898,
342546,
350740,
342551,
334359,
342555,
334364,
416294,
350762,
252463,
358962,
334386,
334397,
358973,
252483,
219719,
399957,
244309,
334425,
326240,
375401,
334466,
334469,
162446,
326291,
342680,
342685,
260767,
342711,
244410,
260798,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
113389,
342769,
203508,
375541,
342777,
391938,
391949,
375569,
326417,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
326452,
326455,
375613,
244542,
326463,
375616,
326468,
244552,
342857,
326474,
326479,
326486,
416599,
342875,
326494,
326503,
433001,
326508,
400238,
326511,
211826,
211832,
392061,
351102,
359296,
252801,
260993,
351105,
400260,
211846,
342921,
342931,
400279,
252823,
392092,
400286,
252838,
359335,
211885,
400307,
351169,
359362,
351172,
170950,
359367,
326599,
359383,
359389,
383968,
343018,
359411,
261109,
261112,
244728,
383999,
261130,
261148,
359452,
211999,
261155,
261160,
359471,
375868,
343132,
384099,
384102,
384108,
367724,
326764,
187503,
343155,
384115,
212095,
384136,
384140,
384144,
351382,
384152,
384158,
384161,
351399,
384169,
367795,
384182,
367801,
384189,
351424,
384192,
343232,
244934,
367817,
244938,
384202,
253132,
326858,
343246,
384209,
146644,
351450,
384225,
343272,
351467,
384247,
351480,
384250,
351483,
351492,
343307,
384270,
261391,
359695,
253202,
261395,
384276,
384284,
245021,
384290,
253218,
245032,
171304,
384299,
351535,
376111,
245042,
326970,
384324,
343366,
212296,
212304,
367966,
343394,
343399,
367981,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
384398,
245137,
245143,
245146,
245149,
343453,
245152,
245155,
155045,
245158,
40358,
245163,
114093,
327090,
343478,
359867,
384444,
146878,
327108,
327112,
384457,
327118,
359887,
359891,
343509,
368093,
155103,
343535,
343540,
368120,
343545,
409092,
359948,
359951,
245295,
359984,
400977,
400982,
179803,
245358,
138865,
155255,
155274,
368289,
245410,
245415,
425652,
425663,
155328,
245463,
155352,
155356,
212700,
155364,
245477,
155372,
245487,
212723,
245495,
409336,
155394,
155404,
245528,
155423,
360224,
155439,
204592,
155444,
155448,
417596,
384829,
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,
155550,
253854,
262046,
262049,
262052,
327590,
155560,
155563,
155566,
327613,
393152,
311244,
212945,
393170,
155604,
155620,
253924,
155622,
327655,
253927,
360432,
393204,
360439,
253944,
393209,
393215
] |
ea8d6bbee83c829257628be5719d9d1224520bcc | 818da4963fbeca4191ab1ff80d9bbc041202bd25 | /MonsterCards/Views/EditTraits.swift | 7b534ad0adc053a738cd3676564c2bf847d36e8f | [
"MIT"
] | permissive | headhunter45/MonsterCards-iOS | f8fe218852ca129b3a4bd6b797c09af5cc5fd697 | 938f0fb75860d3637b998bdd0c27dcffd9fc9451 | refs/heads/master | 2023-06-04T08:32:56.192082 | 2021-06-27T20:49:51 | 2021-06-27T20:51:03 | 292,414,375 | 0 | 0 | MIT | 2021-04-11T04:38:05 | 2020-09-02T23:13:37 | Swift | UTF-8 | Swift | false | false | 1,880 | swift | //
// EditTraits.swift
// MonsterCards
//
// Created by Tom Hicks on 3/25/21.
//
import SwiftUI
struct EditTraits: View {
@ObservedObject var viewModel: MonsterViewModel
var path: ReferenceWritableKeyPath<MonsterViewModel, [AbilityViewModel]>
var title: String
var body: some View {
List {
ForEach(viewModel[keyPath: path]) { ability in
NavigationLink(
ability.name,
destination: EditTrait(viewModel: ability))
}
.onDelete(perform: { indexSet in
for index in indexSet {
viewModel[keyPath: path].remove(at: index)
}
})
.onMove(perform: { indices, newOffset in
viewModel[keyPath: path].move(fromOffsets: indices, toOffset: newOffset)
})
}
.toolbar(content: {
ToolbarItemGroup(placement: .navigationBarTrailing) {
EditButton()
Button(
action: {
let newAbility = AbilityViewModel()
viewModel[keyPath: path].append(newAbility)
viewModel[keyPath: path] = viewModel[keyPath: path].sorted()
},
label: {
Image(systemName: "plus")
}
)
}
})
.onAppear(perform: {
viewModel[keyPath: path] = viewModel[keyPath: path].sorted()
})
.navigationTitle(title)
}
}
struct EditTraits_Previews: PreviewProvider {
static var previews: some View {
let viewModel = MonsterViewModel()
EditTraits(
viewModel: viewModel,
path: \.abilities,
title: "Abilities")
}
}
| [
-1
] |
48d5784535eb6edec21b399e1633d60a4b27c7fc | cc299718e1c95de36624df10d05119064bc81016 | /ColorPicker/SceneDelegate.swift | 6f4c38ffd46fcfcfe37f7337424fb64c8fbfc801 | [] | no_license | scottharris86/ColorPicker | ee3e93c56262185de82c320a432848418bb425fe | b82a9152e0b323c13cde0366b5e0c6ddfed93138 | refs/heads/master | 2021-01-08T08:18:30.595269 | 2020-02-20T19:13:57 | 2020-02-20T19:13:57 | 241,968,433 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,351 | swift | //
// SceneDelegate.swift
// ColorPicker
//
// Created by scott harris on 2/20/20.
// Copyright © 2020 scott harris. All rights reserved.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
| [
393221,
163849,
393228,
393231,
393251,
352294,
344103,
393260,
393269,
213049,
376890,
385082,
16444,
393277,
376906,
327757,
254032,
286804,
368728,
254045,
368736,
180322,
376932,
286833,
286845,
286851,
417925,
262284,
360598,
286880,
286889,
377003,
377013,
164029,
327872,
180418,
377030,
377037,
180432,
377047,
418008,
385243,
418012,
377063,
327915,
205037,
393457,
393461,
393466,
418044,
336124,
385281,
336129,
262405,
180491,
336140,
164107,
262417,
368913,
262423,
377118,
377121,
262437,
254253,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
270687,
262497,
418145,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
336326,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
98819,
164362,
328207,
410129,
393748,
377372,
188959,
385571,
377384,
197160,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
385610,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
336517,
344710,
385671,
148106,
377485,
352919,
98969,
336549,
344745,
361130,
336556,
385714,
434868,
164535,
336568,
164539,
328379,
328387,
352969,
418508,
385743,
385749,
189154,
369382,
361196,
418555,
344832,
336644,
344837,
344843,
328462,
361231,
394002,
336660,
418581,
418586,
434971,
369436,
262943,
369439,
418591,
418594,
336676,
418600,
418606,
271154,
328498,
369464,
361274,
328516,
336709,
328520,
336712,
361289,
328523,
336715,
361300,
213848,
426842,
361307,
197469,
361310,
254813,
361318,
344936,
361323,
361335,
328574,
369544,
361361,
222129,
345036,
386004,
345046,
386012,
386019,
386023,
328690,
435188,
328703,
328710,
418822,
377867,
328715,
361490,
386070,
336922,
345119,
377888,
328747,
214060,
345134,
345139,
361525,
361537,
377931,
197708,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
386168,
361594,
410746,
214150,
345224,
386187,
337048,
345247,
361645,
337072,
345268,
337076,
402615,
361657,
402636,
328925,
165086,
165092,
328933,
222438,
328942,
386286,
386292,
206084,
115973,
328967,
345377,
345380,
353572,
345383,
263464,
337207,
345400,
378170,
369979,
386366,
337224,
337230,
337235,
263509,
353634,
337252,
402792,
345449,
99692,
271731,
378232,
337278,
271746,
181639,
353674,
181644,
361869,
181650,
181655,
230810,
181671,
181674,
181679,
181682,
337330,
181687,
370105,
181691,
181697,
361922,
337350,
181704,
337366,
271841,
329192,
361961,
329195,
116211,
337399,
402943,
337416,
329227,
419341,
419345,
329234,
419351,
345626,
419357,
345631,
419360,
370208,
394787,
419363,
370214,
419369,
394796,
419377,
419386,
206397,
214594,
419401,
353868,
419404,
173648,
419408,
214611,
419412,
403040,
345702,
222831,
370298,
353920,
403073,
403076,
345737,
198282,
403085,
403092,
345750,
419484,
345758,
345763,
419492,
345766,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
419518,
403139,
337607,
419528,
419531,
419536,
272083,
394967,
419543,
419545,
345819,
419548,
181982,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
141052,
337661,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
116512,
362274,
378664,
354107,
345916,
354112,
247618,
370504,
329545,
345932,
354124,
370510,
247639,
337751,
370520,
313181,
182110,
354143,
354157,
345965,
345968,
345971,
345975,
182136,
403321,
1914,
354173,
395148,
247692,
337809,
247701,
329625,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
247760,
346064,
346069,
329699,
354275,
190440,
247790,
354314,
346140,
337980,
436290,
395340,
378956,
436307,
338005,
329816,
100454,
329833,
329853,
329857,
329868,
411806,
329886,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
346317,
411862,
256214,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
436474,
321787,
379135,
411905,
411917,
43279,
379154,
395539,
387350,
387353,
338201,
182559,
338212,
395567,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
182642,
321911,
420237,
379279,
272787,
354728,
338353,
338363,
338382,
272849,
248279,
256474,
182755,
338404,
338411,
330225,
248309,
199165,
248332,
330254,
199182,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
191085,
338544,
191093,
346743,
330384,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
264919,
338661,
338665,
264942,
330479,
363252,
338680,
207620,
264965,
191240,
338701,
256787,
363294,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
355185,
330612,
330643,
412600,
207809,
379849,
347082,
396246,
330711,
248794,
248799,
347106,
437219,
257009,
265208,
330750,
199681,
338951,
330761,
330769,
330775,
248863,
158759,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
330830,
248915,
183384,
339037,
412765,
257121,
322660,
265321,
330869,
248952,
420985,
330886,
330890,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
126148,
322763,
330959,
330966,
265433,
265438,
388320,
363757,
388348,
339199,
396552,
175376,
175397,
208167,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
437576,
437584,
331089,
437588,
396634,
175451,
437596,
429408,
175458,
208228,
175461,
175464,
265581,
331124,
175478,
249210,
175484,
175487,
249215,
175491,
249219,
249225,
249228,
249235,
175514,
175517,
396703,
396706,
175523,
355749,
396723,
388543,
380353,
216518,
339401,
380364,
339406,
372177,
339414,
249303,
413143,
339418,
339421,
249310,
339425,
249313,
339429,
339435,
249329,
69114,
372229,
339464,
249355,
208399,
175637,
405017,
134689,
339504,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
339572,
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,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
339696,
225013,
257788,
225021,
339711,
257791,
225027,
257796,
339722,
257802,
257805,
225039,
257808,
249617,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
397089,
257825,
225059,
339748,
225068,
257837,
413485,
225071,
225074,
257843,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
323404,
257869,
257872,
225105,
339795,
397140,
225109,
225113,
257881,
257884,
257887,
225120,
257891,
413539,
225128,
257897,
225138,
339827,
257909,
225142,
372598,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
184245,
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,
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,
356631,
356638,
356641,
356644,
356647,
266537,
389417,
356650,
356656,
332081,
307507,
340276,
356662,
397623,
332091,
225599,
332098,
201030,
348489,
332107,
151884,
430422,
348503,
332118,
250201,
332130,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
332162,
389507,
348548,
356741,
250239,
332175,
160152,
373146,
373149,
70048,
356783,
266688,
324032,
201158,
127473,
217590,
340473,
324095,
324100,
324103,
324112,
340501,
324118,
324122,
340512,
332325,
324134,
381483,
356908,
324141,
324143,
356917,
324150,
324156,
168509,
348734,
324161,
324165,
356935,
348745,
381513,
324171,
324174,
324177,
389724,
332381,
373344,
340580,
348777,
381546,
119432,
340628,
184983,
373399,
340639,
258723,
332455,
332460,
389806,
332464,
332473,
381626,
332484,
332487,
332494,
357070,
357074,
332512,
332521,
340724,
332534,
348926,
389927,
348979,
152371,
398141,
127815,
357202,
389971,
357208,
136024,
389979,
430940,
357212,
357215,
439138,
201580,
201583,
349041,
340850,
201589,
381815,
430967,
324473,
398202,
119675,
340859,
324476,
430973,
324479,
340863,
324482,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
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,
250915,
250917,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
431180,
209996,
349268,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
152704,
349313,
160896,
210053,
210056,
349320,
259217,
373905,
210068,
210072,
210078,
210081,
210085,
210089,
210096,
210100,
324792,
210108,
357571,
210116,
210128,
333010,
210132,
333016,
210139,
210144,
218355,
251123,
218361,
275709,
128254,
275713,
242947,
275717,
275723,
333075,
349460,
333079,
251161,
349486,
349492,
415034,
251211,
210261,
365912,
259423,
374113,
251236,
374118,
234867,
390518,
357756,
374161,
112021,
349591,
357793,
333222,
210357,
259516,
415168,
366035,
415187,
366039,
415192,
415194,
415197,
415200,
333285,
415208,
366057,
366064,
415217,
415225,
423424,
415258,
415264,
366118,
415271,
382503,
349739,
144940,
415279,
415282,
415286,
210488,
415291,
415295,
333387,
333396,
333400,
366173,
333415,
423529,
423533,
333423,
210547,
415354,
333440,
267910,
267929,
333472,
333512,
259789,
358100,
366301,
333535,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
366349,
210707,
399129,
333593,
333595,
210720,
366384,
358192,
210740,
366388,
358201,
399166,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
358235,
341852,
350046,
399200,
399208,
268144,
358256,
358260,
399222,
325494,
186233,
333690,
243584,
325505,
333699,
399244,
333709,
333725,
333737,
382891,
382898,
333767,
358348,
333777,
219094,
399318,
358372,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
333838,
350225,
350232,
333851,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
252021,
342134,
374904,
268435,
333989,
333998,
334012,
260299,
350411,
350417,
350423,
211161,
350426,
334047,
350449,
375027,
358645,
350454,
350459,
350462,
350465,
350469,
325895,
268553,
194829,
350477,
268560,
350481,
432406,
350487,
350491,
350494,
325920,
350500,
350505,
358701,
391469,
350510,
358705,
358714,
358717,
383307,
358738,
334162,
383331,
383334,
391531,
383342,
334204,
268669,
194942,
391564,
366991,
334224,
342431,
375209,
326059,
375220,
342453,
334263,
326087,
358857,
195041,
334306,
334312,
104940,
375279,
162289,
350724,
186898,
342546,
350740,
342551,
334359,
342555,
334364,
416294,
350762,
252463,
358962,
334386,
334397,
358973,
252483,
219719,
399957,
244309,
334425,
326240,
375401,
334466,
334469,
391813,
162446,
326291,
342680,
342685,
260767,
342711,
244410,
260798,
334530,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
64231,
113389,
342769,
203508,
375541,
342777,
391938,
391949,
375569,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
326452,
326455,
375613,
244542,
375616,
326468,
244552,
342857,
326474,
326479,
326486,
416599,
342875,
244572,
326494,
326503,
433001,
326508,
400238,
326511,
211826,
211832,
392061,
351102,
252801,
260993,
400260,
211846,
342921,
342931,
252823,
400279,
392092,
400286,
359335,
211885,
400307,
351169,
359362,
351172,
170950,
187335,
326599,
359367,
359383,
359389,
383968,
343018,
359411,
261109,
261112,
244728,
383999,
261130,
261148,
359452,
211999,
261155,
261160,
261166,
359471,
375868,
384099,
384102,
384108,
367724,
326764,
187503,
343155,
384115,
212095,
384136,
384140,
384144,
351382,
384152,
384158,
384161,
351399,
384169,
367795,
384182,
384189,
384192,
351424,
343232,
244934,
367817,
244938,
384202,
253132,
326858,
343246,
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,
245042,
326970,
384324,
343366,
212296,
212304,
367966,
343394,
343399,
367981,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
384398,
245137,
245143,
245146,
245149,
343453,
245152,
245155,
155045,
245158,
40358,
245163,
114093,
327090,
343478,
359867,
384444,
146878,
327108,
327112,
384457,
327118,
359887,
359891,
343509,
368093,
155103,
343535,
343540,
368120,
343545,
409092,
359948,
359951,
359984,
400977,
400982,
179803,
138865,
155255,
155274,
368289,
245410,
425639,
245415,
425652,
425663,
155328,
245463,
155352,
155356,
212700,
155364,
245477,
155372,
245487,
212723,
245495,
409336,
155394,
155404,
245528,
155423,
360224,
155439,
204592,
155444,
155448,
417596,
384829,
360262,
155463,
155477,
376665,
155484,
261982,
425823,
155488,
376672,
155492,
327532,
261997,
376686,
262000,
262003,
425846,
262006,
147319,
262009,
327542,
262012,
155517,
155523,
155526,
360327,
376715,
155532,
262028,
262031,
262034,
262037,
262040,
262043,
155550,
253854,
262046,
262049,
262052,
327590,
155560,
155563,
155566,
327613,
393152,
311244,
212945,
393170,
155604,
155620,
253924,
155622,
253927,
327655,
360432,
393204,
360439,
253944,
393209,
155647
] |
50ffa93d8ecf4be1310b646ec31416925cd0c6a1 | 394776ed0ec175c20ea682ee8d859692f0529bdb | /iRouming/Gallery/GalleryLabel.swift | 570ca0215072dc3cce91af05c0ff9d4a346d2ca5 | [
"MIT"
] | permissive | Lopdo/iRoumingOld | c495259d1afbf60fbe63091f91793d2c6dbb7ddf | 54fbee60e4f3538dcf98f5bf41b9fd5c252e3280 | refs/heads/master | 2021-05-30T07:03:34.503622 | 2015-11-26T20:55:20 | 2015-11-26T20:55:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 707 | swift | //
// GalleryLabel.swift
// iRouming
//
// Created by Lope on 19/11/15.
// Copyright © 2015 Lost Bytes. All rights reserved.
//
import UIKit
class GalleryLabel: UILabel {
func setTitle(text: String) {
var fontSize: CGFloat = 16.0
let oldWidth = self.frame.size.width
let oldHeight = self.frame.size.height
self.numberOfLines = 0
self.text = text
repeat {
fontSize--
self.font = UIFont.systemFontOfSize(fontSize)
self.sizeToFit()
self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, oldWidth, self.frame.size.height)
} while (self.frame.size.height > oldHeight)
self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, oldWidth, oldHeight)
}
}
| [
-1
] |
8d34bd80ad1cd442a2366d23c69b75e2340814f9 | 04ed8bfb426d55f1e39ad927f4d8568e8ba52d9c | /SwiftHelpers/SwiftHelpers/Helpers/Other/KeyboardNotifications.swift | 497af15a8fcabf0ecaac856e0fcffacc8c2f5b4a | [] | no_license | vlaskos/SwiftHelpers | 76b1f21b70d4c08a34ab4b038b3aaf64e791b5bc | b732e52e77394ce7a7c7369712cebae32ace344b | refs/heads/main | 2022-12-31T10:06:54.992681 | 2020-10-22T11:42:16 | 2020-10-22T11:42:16 | 306,309,886 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,458 | swift | //
// KeyboardNotifications.swift
// SwiftHelpers
//
// Created by vlad.kosyi on 22.10.2020.
// Copyright © 2020 com.chisw. All rights reserved.
//
import UIKit
import CoreGraphics
class KeyboardNotifications {
fileprivate var _isEnabled: Bool
fileprivate var notifications: [KeyboardNotificationsType]
fileprivate weak var delegate: KeyboardNotificationsDelegate?
init(notifications: [KeyboardNotificationsType], delegate: KeyboardNotificationsDelegate) {
_isEnabled = false
self.notifications = notifications
self.delegate = delegate
}
deinit {
if isEnabled {
isEnabled = false
}
}
}
// MARK: - enums
extension KeyboardNotifications {
enum KeyboardNotificationsType {
case willShow, willHide, didShow, didHide, didChangeFrame, willChangeFrame
var selector: Selector {
switch self {
case .willShow:
return #selector(KeyboardNotifications.keyboardWillShow(notification:))
case .willHide:
return #selector(KeyboardNotifications.keyboardWillHide(notification:))
case .didShow:
return #selector(KeyboardNotifications.keyboardDidShow(notification:))
case .didHide:
return #selector(KeyboardNotifications.keyboardDidHide(notification:))
case .didChangeFrame:
return #selector(KeyboardNotifications.keyboardDidChangeFrame(notification:))
case .willChangeFrame:
return #selector(KeyboardNotifications.keyboardWillChangeFrame(notification:))
}
}
var notificationName: NSNotification.Name {
switch self {
case .willShow:
return UIResponder.keyboardWillShowNotification
case .willHide:
return UIResponder.keyboardWillHideNotification
case .didShow:
return UIResponder.keyboardDidShowNotification
case .didHide:
return UIResponder.keyboardDidHideNotification
case .didChangeFrame:
return UIResponder.keyboardDidChangeFrameNotification
case .willChangeFrame:
return UIResponder.keyboardWillChangeFrameNotification
}
}
}
}
// MARK: - isEnabled
extension KeyboardNotifications {
private func addObserver(type: KeyboardNotificationsType) {
NotificationCenter.default.addObserver(self, selector: type.selector, name: type.notificationName, object: nil)
}
var isEnabled: Bool {
set {
if newValue {
for notificaton in notifications {
addObserver(type: notificaton)
}
} else {
NotificationCenter.default.removeObserver(self)
}
_isEnabled = newValue
}
get {
return _isEnabled
}
}
}
// MARK: - Notification functions
extension KeyboardNotifications {
@objc
func keyboardWillShow(notification: NSNotification) {
delegate?.keyboardWillShow?(notification: notification)
}
@objc
func keyboardWillHide(notification: NSNotification) {
delegate?.keyboardWillHide?(notification: notification)
}
@objc
func keyboardDidShow(notification: NSNotification) {
delegate?.keyboardDidShow?(notification: notification)
}
@objc
func keyboardDidHide(notification: NSNotification) {
delegate?.keyboardDidHide?(notification: notification)
}
@objc
func keyboardWillChangeFrame(notification: NSNotification) {
delegate?.keyboardWillChangeFrame?(notification: notification)
}
@objc
func keyboardDidChangeFrame(notification: NSNotification) {
delegate?.keyboardDidChangeFrame?(notification: notification)
}
}
@objc
protocol KeyboardNotificationsDelegate {
@objc
optional func keyboardWillShow(notification: NSNotification)
@objc
optional func keyboardWillHide(notification: NSNotification)
@objc
optional func keyboardDidShow(notification: NSNotification)
@objc
optional func keyboardDidHide(notification: NSNotification)
@objc
optional func keyboardWillChangeFrame(notification: NSNotification)
@objc
optional func keyboardDidChangeFrame(notification: NSNotification)
}
/////////
struct KeyboardPayload {
let beginFrame: CGRect
let endFrame: CGRect
let curve: UIView.AnimationCurve
let duration: TimeInterval
let isLocal: Bool
}
extension KeyboardPayload {
init(note: NSNotification) {
let userInfo = note.userInfo
beginFrame = userInfo?[UIResponder.keyboardFrameBeginUserInfoKey] as! CGRect
endFrame = userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as! CGRect
curve = UIView.AnimationCurve(rawValue: userInfo?[UIResponder.keyboardAnimationCurveUserInfoKey] as! Int)!
duration = userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as! TimeInterval
isLocal = userInfo?[UIResponder.keyboardIsLocalUserInfoKey] as! Bool
}
}
| [
-1
] |
ad4008ed9194eb581ac4ad725c8f15f3a6e06551 | 7422f462e88b0baf494d35c0049a1af7dde7e831 | /WalletSwift/WalletSwift/Module/Mine/View/MineTableViewCell.swift | b7d36d95b5780f76df3cb9ac007f0f5f78c81a0b | [] | no_license | zcw46229412/NowWallet-Swift | 3c69b2048b196ac28d750910a86754c3b1469735 | c8ecd45c5c56be810576539fe402582d92444da2 | refs/heads/master | 2022-01-05T14:09:23.346941 | 2019-07-03T02:55:30 | 2019-07-03T02:55:30 | 194,966,541 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,519 | swift | //
// MineTableViewCell.swift
// WalletSwift
//
// Created by 张春伟 on 2019/6/13.
// Copyright © 2019 张春伟. All rights reserved.
//
import UIKit
class MineTableViewCell: UITableViewCell {
var titleImgView: UIImageView!
var titleLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.selectionStyle = .none
self.contentView.backgroundColor = KBgColor()
titleImgView = UIImageView.init()
self.contentView.addSubview(titleImgView)
titleImgView.snp.makeConstraints { (make) in
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(KAdap(20))
}
titleLabel = UILabel.init()
self.contentView.addSubview(titleLabel)
titleLabel.textColor = .white
titleLabel.font = KFontWithMedium(14)
titleLabel.snp.makeConstraints { (make) in
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(KAdap(50))
}
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
| [
-1
] |
16a3844516ff9265b317ec831098f4394657f608 | 360b1ee40f6f927419fe9f6eae9591652d84a2fe | /iOS/swagswap/ExploreCell.swift | 06c3caed6fb145fe60778d77369406a2b74e0167 | [] | no_license | loganisitt/SwagSwap | 0a74b73e45856ccdf9684c5c5d2a021331548464 | 4d9b2e82b7891b194c0f005869b394a26e3a5edd | refs/heads/master | 2021-01-18T02:24:35.309600 | 2015-06-19T15:49:50 | 2015-06-19T15:49:50 | 28,001,241 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,176 | swift | //
// SSExploreCell.swift
// swagswap
//
// Created by Logan Isitt on 3/10/15.
// Copyright (c) 2015 Logan Isitt. All rights reserved.
//
import UIKit
class ExploreCell: UITableViewCell {
@IBOutlet var title: UILabel!
@IBOutlet var icon: UILabel!
var color: String!
var indentationLayer: CALayer!
// MARK: - Initialization
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setup()
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setup()
}
// MARK: - Setup
func setup() {
defaults()
indentationWidth = 10.0
indentationLevel = 1
indentationLayer = CALayer()
indentationLayer.backgroundColor = UIColor.SSColor.Blue.CGColor
layer.addSublayer(indentationLayer)
}
override func layoutSubviews() {
super.layoutSubviews()
// title.text = getTitle(exploreItem).uppercaseString
title.textColor = UIColor.SSColor.Black
title.textAlignment = NSTextAlignment.Left
title.font = UIFont.SSFont.H4
// accessory.text = String.fontAwesomeIconWithName("fa-angle-right")
// accessory.textColor = UIColor.SSColor.Black
// accessory.textAlignment = NSTextAlignment.Right
// accessory.font = UIFont.fontAwesomeOfSize(30)
// icon.text = getIcon(exploreItem)
// icon.textColor = UIColor.SSColor.Black
// icon.textAlignment = NSTextAlignment.Center
// icon.font = UIFont.fontAwesomeOfSize(30)
indentationLayer.backgroundColor = UIColor(rgba: color).CGColor // getColor(exploreItem).CGColor
}
// // MARK: - Menu Item
// private func getTitle(mi: ExploreItem) -> String {
// switch mi {
// case .Furniture: return "Furniture"
// case .Pets: return "Pets"
// case .Tech: return "Tech"
// case .Vehicle: return "Cars & Trucks"
// case .Jewelry: return "Jewelry"
// case .Tickets: return "Tickets"
// default: return ""
// }
// }
//
// private func getIcon(mi: ExploreItem) -> String {
// switch mi {
// case .Furniture: return String.fontAwesomeIconWithName("fa-bed")
// case .Pets: return String.fontAwesomeIconWithName("fa-paw")
// case .Tech: return String.fontAwesomeIconWithName("fa-mobile")
// case .Vehicle: return String.fontAwesomeIconWithName("fa-car")
// case .Jewelry: return String.fontAwesomeIconWithName("fa-diamond")
// case .Tickets: return String.fontAwesomeIconWithName("fa-ticket")
// default: return ""
// }
// }
//
// private func getColor(mi: ExploreItem) -> UIColor {
// switch mi {
// case .Furniture: return UIColor.SSColor.Yellow
// case .Pets: return UIColor.SSColor.Red
// case .Tech: return UIColor.SSColor.Blue
// case .Vehicle: return UIColor.SSColor.LightBlue
// case .Jewelry: return UIColor.SSColor.Aqua
// case .Tickets: return UIColor.SSColor.Black
// default: return UIColor.SSColor.Black
// }
// }
// MARK: - Draw
override func drawRect(rect: CGRect) {
super.drawRect(rect)
indentationLayer.frame = CGRectMake(0, 0, indentationWidth, rect.height)
}
// MARK: - Defaults
func defaults() {
// Remove seperator inset
if respondsToSelector("setSeparatorInset:") {
separatorInset = UIEdgeInsetsZero
}
// Prevent the cell from inheriting the Table View's margin settings
if respondsToSelector("setPreservesSuperviewLayoutMargins:") {
preservesSuperviewLayoutMargins = false
}
// Explictly set your cell's layout margins
if respondsToSelector("setLayoutMargins:") {
layoutMargins = UIEdgeInsetsZero
}
}
}
| [
-1
] |
5bcdc57d20017fa695c266155866de0d8363cd33 | 8de158c39b18ea88b161ebfa6699542ab1cabfdd | /ParseStarterProject/SendInviteTableViewController.swift | a525276b672b1eb5eaf5a21145084d81e9d31dec | [] | no_license | LeLuckyVint/TheGame | e21bb55eb1acf6ceff2c3b8ff9dc628c781a813c | a8b4a078d8ea0048a07f4ecc94f15da13761e118 | refs/heads/master | 2020-04-06T03:41:52.487068 | 2015-10-09T16:23:13 | 2015-10-09T16:23:13 | 40,907,275 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,751 | swift | //
// SendInviteTableViewController.swift
// The Game
//
// Created by demo on 20.08.15.
// Copyright (c) 2015 Parse. All rights reserved.
//
import UIKit
class SendInviteTableViewController: UITableViewController, UISearchBarDelegate {
@IBOutlet weak var searchBar: UISearchBar!
var results: [User] = []
override func viewDidLoad() {
super.viewDidLoad()
searchBar.delegate = self
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return results.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("searchCell", forIndexPath: indexPath) as! SearchTableViewCell
cell.usernameLabel.text = results[indexPath.row].username
return cell
}
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
ServerCommunicator.sendInviteToUserWithId(results[indexPath.row].id)
self.parentViewController!.dismissViewControllerAnimated(true, completion: nil)
}
func searchBarSearchButtonClicked(searchBar: UISearchBar) {
let text = searchBar.text
ServerCommunicator.searchUsers(text){
users, success in
if success{
self.results = users
self.tableView.reloadData()
}
}
searchBar.resignFirstResponder()
}
}
| [
-1
] |
a861f350444d058bd046c46005ea99f3801d99e5 | 906a42dc9249df0f9ee10fa9f42cf3cddde029fe | /MyQuiz/ResultViewController.swift | 3e0a88b9cea4e4a664734a49b887b174e78e3fe3 | [] | no_license | kooooohe/MyQuiz | bec5a379235d43c332dbe8aaa7ac5654e14f38cf | 802b8b051b0063f3f4aa8aeddd80a71773406797 | refs/heads/master | 2021-09-06T13:42:39.237094 | 2018-02-07T03:33:31 | 2018-02-07T03:33:31 | 116,376,295 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,179 | swift | //
// ResultViewController.swift
// MyQuiz
//
// Created by 近藤 康平 on 2018/01/29.
// Copyright © 2018年 kohe. All rights reserved.
//
import UIKit
class ResultViewController: UIViewController {
@IBOutlet weak var correctPercentLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
//問題数を取得
let questionCount = QuestionDataManager.sharedInstance.questionDataArray.count
//正解数を取得する
var correctCount:Int = 0
//正解数を計算する
for questionData in QuestionDataManager.sharedInstance.questionDataArray {
if questionData.isCorrect() {
//正解数を増やす
correctCount += 1
}
}
//正解率を計算する
let correctPersent:Float = (Float(correctCount) / Float(questionCount)) * 100
correctPercentLabel.text = String(format:"%.1f", correctPersent) + "%"
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
-1
] |
e151b3def76f6d125fdda8129b12ad9d316ec192 | da5b60a5b8140c0c5a69d4183d382b4185bfb070 | /codingChallange/NewsModel.swift | d5975311d107689c26e195c4500e01e7b88db4d0 | [] | no_license | GeorgiSwiftDeveloper/CoddingChallange | 9079ca19af831ac5623af3734dc1aecf20f2ddd3 | 10058d6154036f7e189e2d0d9354508ace135114 | refs/heads/main | 2022-12-29T03:02:28.726580 | 2020-10-15T20:10:51 | 2020-10-15T20:10:51 | 304,436,378 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 405 | swift | //
// NewsModel.swift
// codingChallange
//
// Created by Georgi Malkhasyan on 10/14/20.
//
import Foundation
struct DataResponse: Decodable {
var title: String
var thumbnail: String
var score: Int
}
struct DataObject: Decodable {
var data: DataResponse
}
struct Children: Decodable {
var children: [DataObject]
}
struct DataMainResponse: Decodable {
var data: Children
}
| [
-1
] |
f32bbe6d734b7985eae2a73fdce318148f77afcf | 6d49fbb50061a8ac628500350087df0356a0acfd | /SMS/SMS/SMS.swift | 9bf354be867ec72ffc9458b7fbc54694e493c6eb | [] | no_license | srujohnson/SMS | cae332f7b0a2518e558dafbced0266c4db77d404 | 0b64a7dd1a70a817e0fa0160800426180b898970 | refs/heads/master | 2020-03-27T22:53:37.016891 | 2018-09-04T01:16:32 | 2018-09-04T01:16:32 | 147,269,868 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,881 | swift | //
// SMS.swift
// SMS
//
// Created by Susan Johnson on 9/3/18.
// Copyright © 2018 Out There Software. All rights reserved.
//
/*
Given a string S representing the text that needs to be split and an integer K that is equal to the maximum possible message length, returns the number of SMS messages needed.
For instance, given string S="SMS messages are really short" and K = 12, your function should return 3. You could split this text into proper messages as follows:
"SMS"
"messages are"
"really short"
If it's impossible to split text into proper SMS messages, your function should return −1.
Assume that:
K is an integer within the range [1..500];
S is a non-empty string containing at most 500 characters: only letters and spaces, there are no spaces at the beginning and at the end of S; also there can't be two or more consecutive spaces in S.
*/
import Foundation
struct SMS {
public static func solution(_ S:inout String, _ K:Int) -> Int {
let substrings = S.split(separator: " ", maxSplits: Int.max, omittingEmptySubsequences: true)
var messages = 1
var messageLength = 0
for word in substrings {
let wordLength = word.count
if wordLength > K { // if word is longer than message length, can't split properly
messages = -1
break
}
if messageLength > 0 { // account for the space between words
messageLength += 1
}
if wordLength + messageLength <= K {
// adding onto message
messageLength = messageLength + wordLength
} else {
// starting a new message
messageLength = wordLength
messages += 1
}
}
return messages
}
}
| [
-1
] |
304b053c575af602d1f6057bb0b1fc1631cef485 | aa011c9fb993d4f1279e64bd42614c6a24723550 | /src/ios/CDVContacts.swift | 633ceabd9bc0b1be0c995e4a59e5b111eb7f5619 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | wmaikon/cordova-plugin-contacts | 798893b042c7e844ce2421ac6d1740c48a290d62 | eba158a8ea86bc65d2b32d7e2cb8414a7ee8699b | refs/heads/master | 2020-05-04T10:33:03.019320 | 2019-12-03T14:47:06 | 2019-12-03T14:47:06 | 179,089,958 | 0 | 2 | null | 2019-04-02T13:59:19 | 2019-04-02T13:59:19 | null | UTF-8 | Swift | false | false | 31,171 | swift | //
// CDVContacts.swift
// Timothy Holbrook
//
//
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
import Foundation
import Contacts
import ContactsUI
import UIKit
class CDVContactsPicker: CNContactPickerViewController {
var callbackId: String = ""
var allowsEditing: Bool?
var fields: [Any] = ["*"]
var pickedContactDictionary: [AnyHashable: Any] = [AnyHashable: Any]()
}
class CDVNewContactsController: CNContactViewController {
var callbackId: String = ""
}
@objc(CDVContacts) class CDVContacts: CDVPlugin, CNContactViewControllerDelegate, CNContactPickerDelegate {
// var status: CNAuthorizationStatus = CNContactStore.authorizationStatus(for: .contacts)
static let allContactKeys: [CNKeyDescriptor] = [CNContactIdentifierKey as CNKeyDescriptor,
CNContactNicknameKey as CNKeyDescriptor,
CNContactGivenNameKey as CNKeyDescriptor,
CNContactFamilyNameKey as CNKeyDescriptor,
CNContactMiddleNameKey as CNKeyDescriptor,
CNContactNamePrefixKey as CNKeyDescriptor,
CNContactNameSuffixKey as CNKeyDescriptor,
CNContactPhoneNumbersKey as CNKeyDescriptor,
CNContactPostalAddressesKey as CNKeyDescriptor,
CNPostalAddressStreetKey as CNKeyDescriptor,
CNPostalAddressCityKey as CNKeyDescriptor,
CNPostalAddressStateKey as CNKeyDescriptor,
CNPostalAddressPostalCodeKey as CNKeyDescriptor,
CNPostalAddressCountryKey as CNKeyDescriptor,
CNContactEmailAddressesKey as CNKeyDescriptor,
CNContactInstantMessageAddressesKey as CNKeyDescriptor,
CNContactOrganizationNameKey as CNKeyDescriptor,
CNContactJobTitleKey as CNKeyDescriptor,
CNContactDepartmentNameKey as CNKeyDescriptor,
CNContactBirthdayKey as CNKeyDescriptor,
CNContactNoteKey as CNKeyDescriptor,
CNContactUrlAddressesKey as CNKeyDescriptor,
CNContactImageDataKey as CNKeyDescriptor,
CNInstantMessageAddressUsernameKey as CNKeyDescriptor,
CNInstantMessageAddressServiceKey as CNKeyDescriptor,
CNContactTypeKey as CNKeyDescriptor,
CNContactImageDataAvailableKey as CNKeyDescriptor]
// overridden to clean up Contact statics
override func onAppTerminate() {
// NSLog(@"Contacts::onAppTerminate");
}
func checkContactPermission() {
// if no permissions granted try to request them first
let status = CNContactStore.authorizationStatus(for: .contacts)
if status == .notDetermined {
CNContactStore().requestAccess(for: CNEntityType.contacts, completionHandler: {(_ granted: Bool, _ error: Error?) -> Void in
if granted {
print("Access granted.")
}
})
}
}
// iPhone only method to create a new contact through the GUI
func newContact(_ command: CDVInvokedUrlCommand) {
checkContactPermission()
let callbackId: String = command.callbackId
let weakSelf: CDVContacts? = self
if CNContactStore.authorizationStatus(for: .contacts) == .authorized {
let npController = CDVNewContactsController()
npController.contactStore = CNContactStore()
npController.delegate = self
npController.callbackId = callbackId
let navController = UINavigationController(rootViewController: npController as UIViewController)
weakSelf?.viewController.present(navController, animated: true) {() -> Void in }
}
}
func existsValue(_ dict: [AnyHashable: Any], val expectedValue: String, forKey key: String) -> Bool {
checkContactPermission()
let val = dict[key]
var exists = false
if val != nil {
exists = ((val as? String)?.caseInsensitiveCompare(expectedValue) == ComparisonResult.orderedSame)
}
return exists
}
func displayContact(_ command: CDVInvokedUrlCommand) {
checkContactPermission()
let callbackId: String = command.callbackId
let weakSelf: CDVContacts? = self
if CNContactStore.authorizationStatus(for: .contacts) == .authorized {
let recordID = command.argument(at: 0) as? String
var lookupError: Bool = true
if let id = recordID {
if let rec: CNContact = try? CNContactStore().unifiedContact(withIdentifier: id, keysToFetch: CDVContacts.allContactKeys) {
let options = command.argument(at: 1, withDefault: NSNull()) as! [AnyHashable: Any]
let bEdit: Bool = (options.count > 0) ? false : existsValue(options, val: "true", forKey: "allowsEditing")
lookupError = false
let personController = CDVDisplayContactViewController(for: rec)
personController.delegate = self
personController.allowsEditing = false
// create this so DisplayContactViewController will have a "back" button.
let parentController = UIViewController()
let navController = UINavigationController(rootViewController: parentController)
navController.pushViewController(personController, animated: true)
self.viewController.present(navController, animated: true) {() -> Void in }
if bEdit {
// create the editing controller and push it onto the stack
let editPersonController = CNContactViewController(for: rec)
editPersonController.delegate = self
editPersonController.allowsEditing = true
navController.pushViewController(editPersonController, animated: true)
}
}
}
if lookupError {
// no record, return error
let result = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: CDVContactError.UNKNOWN_ERROR.rawValue)
weakSelf?.commandDelegate.send(result, callbackId: callbackId)
}
} else {
// permission was denied or other error - return error
let result = CDVPluginResult(status: CDVCommandStatus_ERROR, messageToErrorObject: CDVContactError.UNKNOWN_ERROR.rawValue)
weakSelf?.commandDelegate.send(result, callbackId: callbackId)
return
}
}
func contactViewController(_ viewController: CNContactViewController, shouldPerformDefaultActionFor property: CNContactProperty) -> Bool {
checkContactPermission()
return true
}
func chooseContact(_ command: CDVInvokedUrlCommand) {
checkContactPermission()
let callbackId: String = command.callbackId
let commandFields = command.argument(at: 0, withDefault: [Any]()) as? [Any]
let commandOptions = command.argument(at: 1, withDefault: [AnyHashable: Any]()) as? [AnyHashable: Any]
let pickerController = CDVContactsPicker()
pickerController.delegate = self
pickerController.callbackId = callbackId
pickerController.pickedContactDictionary = [
kW3ContactId : ""
]
// pickerController.predicateForSelectionOfContact = NSPredicate(value: true)
if let fields = commandFields {
pickerController.fields = fields
for field in fields {
if let string = field as? String {
if string == "emails" {
pickerController.displayedPropertyKeys = [CNContactEmailAddressesKey];
pickerController.predicateForEnablingContact = NSPredicate(format: "emailAddresses.@count > 0")
pickerController.predicateForSelectionOfContact = NSPredicate(format: "emailAddresses.@count == 1")
pickerController.predicateForSelectionOfProperty = NSPredicate(format: "key == 'emailAddresses'")
} else if string == "phoneNumbers" {
pickerController.displayedPropertyKeys = [CNContactPhoneNumbersKey];
pickerController.predicateForEnablingContact = NSPredicate(format: "phoneNumbers.@count > 0")
pickerController.predicateForSelectionOfContact = NSPredicate(format: "phoneNumbers.@count == 1")
pickerController.predicateForSelectionOfProperty = NSPredicate(format: "key == 'phoneNumbers'")
}
}
}
}
if let options = commandOptions {
pickerController.allowsEditing = (options.count > 0) ? false : existsValue(options, val: "true", forKey: "allowsEditing")
} else {
pickerController.allowsEditing = false
}
UISearchBar.appearance().isHidden = true
viewController.present(pickerController, animated: true) {() -> Void in }
}
@objc(pickContact:)
func pickContact(_ command: CDVInvokedUrlCommand) {
checkContactPermission()
let newCommand = CDVInvokedUrlCommand(arguments: command.arguments, callbackId: command.callbackId, className: command.className, methodName: command.methodName)
// First check for Address book permissions
let status = CNContactStore.authorizationStatus(for: .contacts)
if status == .authorized {
if let cmd = newCommand {
chooseContact(cmd)
}
return
}
let errorResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: CDVContactError.PERMISSION_DENIED_ERROR.rawValue)
// if the access is already restricted/denied the only way is to fail
if status == .restricted || status == .denied {
commandDelegate.send(errorResult, callbackId: command.callbackId)
return
}
// if no permissions granted try to request them first
if status == .notDetermined {
CNContactStore().requestAccess(for: .contacts, completionHandler: {(_ granted: Bool, _ error: Error?) -> Void in
if granted {
if let cmd = newCommand {
self.chooseContact(cmd)
}
return
}
self.commandDelegate.send(errorResult, callbackId: command.callbackId)
})
}
}
func contactPickerDidCancel(_ picker: CNContactPickerViewController) {
// return contactId or invalid if none picked
let ctctPicker: CDVContactsPicker = picker as! CDVContactsPicker
if let allowEditing = ctctPicker.allowsEditing {
if allowEditing {
// get the info after possible edit
// if we got this far, user has already approved/ disapproved contactStore access
if let id = ctctPicker.pickedContactDictionary[kW3ContactId] as? String {
if let person: CNContact = try? CNContactStore().unifiedContact(withIdentifier: id, keysToFetch: CDVContacts.allContactKeys) {
let pickedContact = CDVContact(fromCNContact: person)
let returnFields = CDVContact.self.calcReturnFields(ctctPicker.fields)
ctctPicker.pickedContactDictionary = pickedContact.toDictionary(returnFields)
}
}
}
}
let recordId = ctctPicker.pickedContactDictionary[kW3ContactId] as? String
picker.presentingViewController?.dismiss(animated: true, completion: {() -> Void in
var result: CDVPluginResult? = nil
let invalidId = ""
if (recordId == invalidId) {
result = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: CDVContactError.OPERATION_CANCELLED_ERROR.rawValue)
}
else {
result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: ctctPicker.pickedContactDictionary)
}
self.commandDelegate.send(result, callbackId: ctctPicker.callbackId)
})
}
// Called after a person has been selected by the user.
func contactPicker(_ picker: CNContactPickerViewController, didSelect contacts: [CNContact]) {
let ctctPicker = picker as! CDVContactsPicker
if (ctctPicker.allowsEditing == nil || ctctPicker.allowsEditing == true) {
let contact = contacts[0]
let pickedId = contact.identifier
let personController = CNContactViewController(for: contact)
personController.delegate = self
personController.allowsEditing = ctctPicker.allowsEditing ?? false
// store id so can get info in peoplePickerNavigationControllerDidCancel
ctctPicker.pickedContactDictionary = [
kW3ContactId : pickedId
]
picker.navigationController?.pushViewController(personController, animated: true)
} else {
// Retrieve and return pickedContacts information
var returnContacts = [[AnyHashable: Any]]()
var result: [CDVContact] = [CDVContact]()
for contact in contacts {
result.append(CDVContact(fromCNContact: contact))
}
let returnFields = CDVContact.self.calcReturnFields(ctctPicker.fields)
if (result.count > 0) {
// convert to JS Contacts format and return in callback
// - returnFields determines what properties to return
autoreleasepool {
let count = Int(result.count)
for i in 0..<count {
returnContacts.append(result[i].toDictionary(returnFields))
}
}
}
ctctPicker.presentingViewController?.dismiss(animated: true, completion: {() -> Void in
// return found contacts (array is empty if no contacts found)
let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: returnContacts)
self.commandDelegate.send(result, callbackId: ctctPicker.callbackId)
})
}
}
// Called after a property has been selected by the user.
func contactPicker(_ picker: CNContactPickerViewController, didSelect contactProperty: CNContactProperty) {
let ctctPicker = picker as! CDVContactsPicker
let pickedContact = CDVContact(fromCNContact: contactProperty.contact)
let returnFields = CDVContact.self.calcReturnFields(ctctPicker.fields)
ctctPicker.pickedContactDictionary = pickedContact.toDictionary(returnFields)
if contactProperty.key == CNContactEmailAddressesKey {
if let emails = ctctPicker.pickedContactDictionary[kW3ContactEmails] as? NSArray {
for email in emails {
if let e = email as? [AnyHashable:Any] {
if let val = contactProperty.value as? String {
if let emailValue = e[kW3ContactFieldValue] as? String {
if emailValue == val {
ctctPicker.pickedContactDictionary[kW3ContactEmails] = [email]
}
}
}
}
}
}
}
ctctPicker.presentingViewController?.dismiss(animated: true, completion: {() -> Void in
let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: ctctPicker.pickedContactDictionary)
self.commandDelegate.send(result, callbackId: ctctPicker.callbackId)
})
}
@objc(search:)
func search(_ command: CDVInvokedUrlCommand) {
checkContactPermission()
let callbackId: String = command.callbackId
let commandFields = command.argument(at: 0) as? [Any]
let findOptions = command.argument(at: 1, withDefault: [AnyHashable: Any]()) as? [AnyHashable: Any]
if let fields = commandFields {
commandDelegate.run(inBackground: {() -> Void in
let weakSelf: CDVContacts? = self
if CNContactStore.authorizationStatus(for: .contacts) == .authorized {
// get the findOptions values
var multiple = false
// default is false
var filter: String = ""
var desiredFields: [Any] = ["*"]
if let opts = findOptions {
if (opts.count > 0) {
var value: Any? = nil
let filterValue = opts["filter"]
if let f = filterValue as? String {
filter = f
}
value = opts["multiple"]
if (value is NSNumber) {
// multiple is a boolean that will come through as an NSNumber
multiple = (value as? NSNumber) != 0
// NSLog(@"multiple is: %d", multiple);
}
if let dFields = opts["desiredFields"] as? [Any] {
// return all fields if desired fields are not explicitly defined
if dFields.count > 0 {
desiredFields = dFields
}
}
}
}
let searchFields = CDVContact.self.calcReturnFields(fields)
let returnFields = CDVContact.self.calcReturnFields(desiredFields)
var matches: [CDVContact] = [CDVContact]()
if (filter == "") {
// get all records
let fetchRequest = CNContactFetchRequest.init(keysToFetch: CDVContacts.allContactKeys)
fetchRequest.predicate = nil
try? CNContactStore().enumerateContacts(with: fetchRequest, usingBlock: {(contact: CNContact, stop: UnsafeMutablePointer<ObjCBool>) -> Void in
// create Contacts and put into matches array
// doesn't make sense to ask for all records when multiple == NO but better check
if !multiple {
if matches.count == 1 {
return
}
}
matches.append(CDVContact(fromCNContact: contact))
})
} else {
let fetchRequest = CNContactFetchRequest.init(keysToFetch: CDVContacts.allContactKeys)
fetchRequest.predicate = nil
try? CNContactStore().enumerateContacts(with: fetchRequest, usingBlock: {(contact: CNContact, stop: UnsafeMutablePointer<ObjCBool>) -> Void in
let testContact = CDVContact(fromCNContact: contact)
let match = testContact.foundValue(filter, inFields: searchFields)
if match {
matches.append(testContact)
}
})
}
var returnContacts = [[AnyHashable: Any]]()
if (matches.count > 0) {
// convert to JS Contacts format and return in callback
// - returnFields determines what properties to return
autoreleasepool {
let count = multiple == true ? Int(matches.count) : 1
for i in 0..<count {
let contact = matches[i].toDictionary(returnFields)
if contact[NSNull()] == nil {
returnContacts.append(contact)
}
}
}
}
// return found contacts (array is empty if no contacts found)
let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: returnContacts)
weakSelf?.commandDelegate.send(result, callbackId: callbackId)
// NSLog(@"findCallback string: %@", jsString);
} else {
// permission was denied or other error - return error
let result = CDVPluginResult(status: CDVCommandStatus_ERROR, messageToErrorObject: CDVContactError.UNKNOWN_ERROR.rawValue)
weakSelf?.commandDelegate.send(result, callbackId: callbackId)
return
}
})
}
return
}
func save(_ command: CDVInvokedUrlCommand) {
checkContactPermission()
let callbackId: String = command.callbackId
let commandContactDict = command.argument(at: 0) as? [AnyHashable: Any]
if let contactDict = commandContactDict {
commandDelegate.run(inBackground: {() -> Void in
let weakSelf: CDVContacts? = self
var result: CDVPluginResult? = nil
if CNContactStore.authorizationStatus(for: .contacts) == .authorized {
var bIsError = false
var bSuccess = false
var bUpdate = false
var errCode: CDVContactError = CDVContactError.UNKNOWN_ERROR
if let cId = contactDict[kW3ContactId] as? String {
var aContact: CDVContact? = nil
if let rec = try? CNContactStore().unifiedContact(withIdentifier: cId, keysToFetch: CDVContacts.allContactKeys) {
aContact = CDVContact(fromCNContact: rec)
bUpdate = true
}
if aContact == nil {
aContact = CDVContact()
}
bSuccess = aContact?.setFromContactDict(contactDict, asUpdate: bUpdate) ?? false
if bSuccess {
if !bUpdate {
if let record = aContact?.mutableRecord {
let saveRequest = CNSaveRequest()
saveRequest.add(record, toContainerWithIdentifier: nil)
do {
try CNContactStore().execute(saveRequest)
bSuccess = true
} catch {
bSuccess = false
}
} else {
bSuccess = false
}
}
if bSuccess && bUpdate {
if let record = aContact?.mutableRecord {
let saveRequest = CNSaveRequest()
saveRequest.update(record)
do {
try CNContactStore().execute(saveRequest)
bSuccess = true
} catch {
bSuccess = false
}
} else {
bSuccess = false
}
}
if !bSuccess {
// need to provide error codes
bIsError = true
errCode = CDVContactError.IO_ERROR
}
else {
// give original dictionary back? If generate dictionary from saved contact, have no returnFields specified
// so would give back all fields (which W3C spec. indicates is not desired)
// for now (while testing) give back saved, full contact
let newContact = aContact?.toDictionary(CDVContact.defaultFields())
// NSString* contactStr = [newContact JSONRepresentation];
result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: newContact)
}
} else {
bIsError = true
errCode = CDVContactError.IO_ERROR
}
if bIsError {
result = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: (errCode).rawValue)
}
if result != nil {
weakSelf?.commandDelegate.send(result, callbackId: callbackId)
}
}
} else {
// permission was denied or other error - return error
result = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: CDVContactError.UNKNOWN_ERROR.rawValue)
weakSelf?.commandDelegate.send(result, callbackId: callbackId)
return
}
}) // end of queue
}
}
func remove(_ command: CDVInvokedUrlCommand) {
checkContactPermission()
let callbackId: String = command.callbackId
let commandcId = command.argument(at: 0) as? String
let weakSelf: CDVContacts? = self
var result: CDVPluginResult? = nil
if CNContactStore.authorizationStatus(for: .contacts) == .authorized {
var bIsError = false
var errCode: CDVContactError = CDVContactError.UNKNOWN_ERROR
if let cId = commandcId { //TODO: Check for invalid record id
if let rec = try? CNContactStore().unifiedContact(withIdentifier: cId, keysToFetch: CDVContacts.allContactKeys).mutableCopy() as! CNMutableContact {
let saveRequest = CNSaveRequest()
saveRequest.delete(rec)
do {
try CNContactStore().execute(saveRequest)
// set id to null
// [contactDict setObject:[NSNull null] forKey:kW3ContactId];
// result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAs: contactDict];
result = CDVPluginResult(status: CDVCommandStatus_OK)
// NSString* contactStr = [contactDict JSONRepresentation];
} catch {
bIsError = true
errCode = CDVContactError.IO_ERROR
}
} else {
// no record found return error
bIsError = true
errCode = CDVContactError.UNKNOWN_ERROR
}
} else {
// invalid contact id provided
bIsError = true
errCode = CDVContactError.INVALID_ARGUMENT_ERROR
}
if bIsError {
result = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: errCode.rawValue)
}
if result != nil {
weakSelf?.commandDelegate.send(result, callbackId: callbackId)
}
} else {
// permission was denied or other error - return error
result = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: CDVContactError.UNKNOWN_ERROR.rawValue)
weakSelf?.commandDelegate.send(result, callbackId: callbackId)
return
}
return
}
}
/* ABPersonViewController does not have any UI to dismiss. Adding navigationItems to it does not work properly
* The navigationItems are lost when the app goes into the background. The solution was to create an empty
* NavController in front of the ABPersonViewController. This will cause the ABPersonViewController to have a back button. By subclassing the ABPersonViewController, we can override viewDidDisappear and take down the entire NavigationController.
*/
class CDVDisplayContactViewController: CNContactViewController {
var contactsPlugin: CDVPlugin!
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
presentingViewController?.dismiss(animated: true) {() -> Void in }
}
}
| [
-1
] |
8343984c91ac29761bdd6ffbb7748128e0a0c12c | 1111ca1d9e43ff280a1e4e3fc3ff8e9257027e90 | /FLAVR-RECIPE/FLAVR-RECIPE/AppDelegate.swift | ea5e0112cdee14a98c7345986d0cf3fc42f4b3aa | [] | no_license | best19482/FLAVR-RECIPE | dd6e837f21c5f788b1054875f1810353fc35592e | 699e1920fa5f553819c6117dae0a0c5d67cf3e9b | refs/heads/master | 2020-07-23T21:45:47.025170 | 2019-09-11T03:35:28 | 2019-09-11T03:35:28 | 207,714,863 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,167 | swift | //
// AppDelegate.swift
// FLAVR-RECIPE
//
// Created by SD11 on 11/9/2562 BE.
// Copyright © 2562 SD11. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
229394,
278548,
229397,
229399,
229402,
352284,
278556,
229405,
278559,
229408,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
204856,
229432,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
311850,
279082,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189040,
172660,
287349,
189044,
189039,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
287371,
279178,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
205479,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
304009,
304011,
230284,
304013,
295822,
213902,
279438,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
238528,
304065,
189378,
213954,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
197645,
295949,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
132165,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
164973,
205934,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
279929,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
288154,
337306,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
222676,
288212,
288214,
280021,
239064,
329177,
288217,
288218,
280027,
288220,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
337732,
280388,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
275606,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
280819,
157940,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
354653,
313700,
313705,
280937,
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,
330244,
223752,
150025,
338440,
281095,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
182926,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
240519,
183184,
142226,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
148946,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
282481,
110450,
315251,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
290739,
241588,
282547,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
176311,
307385,
307386,
258235,
307388,
176316,
307390,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
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,
291226,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
291254,
283062,
127417,
291260,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
176592,
315860,
176597,
127447,
283095,
299481,
176605,
242143,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
127494,
283142,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
234010,
135707,
242202,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
316294,
226182,
234375,
308105,
226185,
234379,
201603,
324490,
234384,
234388,
234390,
226200,
234393,
209818,
308123,
324504,
234396,
324508,
234398,
291742,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
291754,
226220,
324527,
234414,
234417,
201650,
324531,
291760,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
226239,
234437,
226245,
234439,
324548,
234443,
291788,
234446,
275406,
193486,
234449,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
234585,
275545,
242777,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
234648,
275608,
234650,
308379,
324757,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
275725,
283917,
177424,
349464,
283939,
259367,
283951,
292143,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
300448,
144807,
144810,
144812,
284076,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
243268,
226886,
284231,
128584,
292421,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
276052,
276053,
284249,
300638,
284251,
284253,
284255,
284258,
243293,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
276095,
284288,
292479,
284290,
325250,
284292,
292485,
276098,
292481,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
178006,
317271,
284502,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
317332,
358292,
284564,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
292839,
276455,
292843,
276460,
292845,
178161,
227314,
276466,
325624,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
292876,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
243779,
292934,
243785,
276553,
350293,
350295,
309337,
227418,
350299,
194649,
350302,
194654,
350304,
178273,
309346,
227423,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
227430,
301167,
276583,
350321,
276590,
284786,
276595,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
153765,
284837,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309491,
227571,
309494,
243960,
227583,
276735,
227587,
276739,
211204,
276742,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
285265,
399955,
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,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
318132,
342707,
154292,
277173,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
293696,
310080,
277317,
293706,
277322,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
276579,
293817,
293820,
203715,
326603,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
302614,
302617,
286233,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
196133,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
229086,
278238,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
e0f84a6f678ad0b69a7a4dfc74658a5333012ca7 | 8e4df0b72a5aaccab472c9637c013b74ca6c0e78 | /Quiz App/QuizApp/Quiz App/Controller/AppDelegate.swift | 1c2969f92e8ae07467255299ef5d3cdfa5259ea0 | [] | no_license | EnzoRJ/iOS_Projects | 2ed9fb983457ec62c2f0d6c8acdc9829a6319612 | 565d638ab1f6e5cc0aa2917c867d545c349629b6 | refs/heads/main | 2023-04-13T03:02:16.857327 | 2021-04-18T19:41:20 | 2021-04-18T19:41:20 | 320,103,619 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,352 | swift | //
// AppDelegate.swift
// Quiz App
//
// Created by Enzo Rojas Jarpa on 18-04-21.
//
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
| [
393222,
393224,
393230,
393250,
344102,
393261,
393266,
213048,
385081,
376889,
393275,
376905,
327756,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
286831,
368752,
286844,
417924,
262283,
286879,
286888,
377012,
164028,
327871,
180416,
377036,
180431,
377046,
418010,
377060,
327914,
205036,
393456,
393460,
418043,
336123,
385280,
336128,
262404,
164106,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
393538,
262472,
344403,
213332,
65880,
262496,
418144,
262499,
213352,
262507,
246123,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
410128,
393747,
254490,
188958,
385570,
33316,
377383,
197159,
352821,
197177,
418363,
188987,
369223,
385609,
385616,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
164538,
328378,
328386,
344776,
352968,
352971,
418507,
352973,
385742,
385748,
361179,
369381,
361195,
418553,
344831,
344835,
336643,
344841,
361230,
336659,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
361288,
336711,
328522,
336714,
426841,
197468,
254812,
361309,
361315,
361322,
328573,
377729,
369542,
361360,
222128,
345035,
386003,
345043,
386011,
386018,
386022,
435187,
328714,
361489,
386069,
386073,
336921,
336925,
345118,
377887,
345133,
345138,
386101,
361536,
197707,
189520,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
345267,
386258,
328924,
66782,
222437,
386285,
328941,
386291,
345376,
353570,
345379,
410917,
345382,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181654,
230809,
181670,
181673,
181678,
181681,
337329,
181684,
181690,
361917,
181696,
337349,
181703,
271839,
329191,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
394853,
345701,
222830,
370297,
403070,
353919,
403075,
345736,
198280,
403091,
345749,
419483,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
419512,
337592,
419517,
337599,
419527,
419530,
419535,
272081,
394966,
419542,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
337659,
141051,
337668,
362247,
395021,
362255,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
345930,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
354150,
354156,
345964,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
337833,
362413,
337844,
346057,
346063,
247759,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
100453,
329832,
329855,
329885,
411805,
346272,
362660,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
321786,
379134,
411903,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
338211,
395566,
248111,
362822,
436555,
190796,
379233,
354673,
248186,
420236,
379278,
272786,
354727,
338352,
338381,
330189,
338386,
256472,
338403,
338409,
248308,
199164,
330252,
199186,
420376,
330267,
354855,
10828,
199249,
346721,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
338660,
338664,
264941,
363251,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
355218,
330642,
412599,
207808,
379848,
396245,
330710,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
396328,
158761,
199728,
396336,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
412764,
339036,
257120,
265320,
248951,
420984,
330889,
347287,
339097,
248985,
44197,
380070,
339112,
249014,
330958,
330965,
265432,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
347437,
372015,
347441,
372018,
199988,
44342,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
175486,
249214,
175489,
249218,
249224,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
208311,
388542,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
339420,
249308,
339424,
249312,
339428,
339434,
249328,
69113,
372228,
208398,
380432,
175635,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
372353,
224897,
216707,
421508,
126596,
224904,
224909,
11918,
159374,
224913,
126610,
224916,
224919,
126616,
208538,
224922,
224926,
224929,
224932,
257704,
224936,
224942,
257712,
224947,
257716,
257720,
224953,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
257761,
224993,
257764,
224999,
339695,
225012,
257787,
225020,
257790,
339710,
225025,
257794,
339721,
257801,
257804,
225038,
257807,
225043,
372499,
167700,
225048,
257819,
225053,
184094,
225058,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
225103,
257871,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
339814,
225127,
274280,
257896,
257901,
225137,
339826,
257908,
225141,
257912,
225148,
257916,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
372738,
405533,
430129,
266294,
266297,
421960,
356439,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
266453,
225493,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
397571,
389380,
61722,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332117,
348502,
250199,
250202,
332125,
250210,
348522,
348525,
348527,
332152,
389502,
250238,
332161,
356740,
332172,
373145,
340379,
389550,
324030,
266687,
160234,
127471,
340472,
324094,
266754,
324099,
324102,
324111,
340500,
324117,
324131,
332324,
381481,
356907,
324139,
324142,
356916,
324149,
324155,
348733,
324164,
356934,
348743,
381512,
324170,
324173,
324176,
389723,
332380,
373343,
381545,
340627,
373398,
184982,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
357069,
332493,
357073,
332511,
332520,
340718,
332533,
348924,
373510,
389926,
348978,
152370,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
430939,
357211,
357214,
201579,
201582,
349040,
340849,
430965,
381813,
324472,
398201,
119674,
324475,
430972,
340861,
324478,
340858,
324481,
373634,
398211,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
422816,
324513,
398245,
201637,
324524,
340909,
324533,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
381946,
349180,
439294,
431106,
209943,
357410,
250914,
185380,
357418,
209965,
209971,
209975,
209979,
209987,
209990,
209995,
341071,
349267,
250967,
210010,
341091,
210025,
210030,
210036,
210039,
349308,
210044,
349311,
160895,
152703,
210052,
210055,
349319,
218247,
210067,
210077,
210080,
251044,
210084,
185511,
210095,
210098,
210107,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
218360,
251128,
275706,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
251189,
415033,
357708,
210260,
365911,
259421,
365921,
333154,
251235,
374117,
333162,
234866,
390516,
333175,
357755,
251271,
136590,
374160,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
415207,
366056,
366061,
415216,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
153227,
333498,
210631,
333511,
259788,
358099,
153302,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
210739,
366387,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
259938,
399206,
399215,
358255,
268143,
358259,
341876,
333689,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
358371,
350189,
350193,
350202,
333818,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
334011,
260289,
260298,
350410,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
350467,
325891,
350475,
375053,
268559,
350480,
432405,
350486,
325914,
350490,
325917,
350493,
350498,
194852,
350504,
358700,
391468,
350509,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
416157,
268701,
342430,
375208,
326058,
375216,
334262,
334275,
326084,
358856,
195039,
334304,
334311,
375277,
334321,
350723,
186897,
342545,
334358,
342550,
342554,
334363,
358941,
350761,
252461,
383536,
358961,
334384,
334394,
252482,
219718,
334407,
334420,
350822,
375400,
334465,
334468,
162445,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
260801,
350917,
154317,
391894,
154328,
416473,
64230,
113388,
342766,
375535,
203506,
342776,
391937,
391948,
375568,
326416,
375571,
375574,
162591,
326441,
383793,
326451,
326454,
260924,
375612,
244540,
326460,
326467,
244551,
326473,
326477,
416597,
326485,
342874,
326490,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
359366,
326598,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
261147,
359451,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
367723,
384107,
187502,
343154,
384114,
212094,
351364,
384135,
384139,
384143,
351381,
384160,
384168,
367794,
384181,
367800,
351423,
384191,
384198,
326855,
244937,
253130,
343244,
146642,
359649,
343270,
351466,
351479,
384249,
343306,
261389,
359694,
253200,
261393,
384275,
245020,
245029,
171302,
351534,
376110,
245040,
384314,
425276,
212291,
384323,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
253303,
154999,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
179802,
155239,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
425649,
155322,
425662,
155327,
155351,
155354,
212699,
155363,
245475,
155371,
245483,
409335,
155393,
155403,
155422,
360223,
155438,
155442,
155447,
417595,
360261,
155461,
376663,
155482,
261981,
425822,
376671,
155487,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
147317,
262005,
425845,
262008,
262011,
155516,
155521,
155525,
360326,
376714,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
393169,
384977,
155611,
155619,
253923,
155621,
253926,
327654,
204784,
393203,
360438,
253943,
393206,
393212,
155646
] |
e3cea3ff24a65537b145d812102ff972c3cb8766 | 49f369694a26b2ee1b3260821c29dddd0bfdec5a | /MagicSquares/main.swift | 052dc74d0e0efe522b7663c0e4d7c3b525a11ce9 | [] | no_license | LCS-BCHOI/IncompletePuzzles | 6ee2b87c92a91b13adc83deb84607e2d715cd25a | 05be989827a60f9ddb88522aa01fd6f188fc2f68 | refs/heads/main | 2022-12-31T11:33:56.848973 | 2020-10-23T15:05:28 | 2020-10-23T15:05:28 | 301,832,128 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,346 | swift | //
// main.swift
// MagicSquares
//
// Puzzle description available at:
//
// https://www.russellgordon.ca/incomplete-puzzles/magic-squares.pdf
//
// NOTE: Puzzle adapted from material provided by the University of Waterloo.
import Foundation
print("Magic Squares")
print("=============")
// INPUT
// Create an empty array to store each row of numbers
// NOTE: Each row will itself be an array, effectively creating a two-dimensional array.
var numbers: [[String]] = []
var ismagicsquare:Bool = false
// Ask for the first row of numbers
// NOTE: This is provided as a String
// Asking for user input really cool and interesting
for _ in 0...3{
let line1 = readLine()!
numbers.append(line1.components(separatedBy: " "))
}
// This would print hte row and stuff maakeing sure everthing works
// This is for the look of thing
for i in 0...3{
var count:Int = 0
for x in 0...3{
count += Int(numbers[i][x]) ?? 0
}
if count != 34{
ismagicsquare = false
}
}
// This would make things look nice really cool and all
// This is the function of things.
for j in 0...3{
var av:Int = 0
for x in 0...3{
av += Int(numbers[x][j]) ?? 0
}
if av != 34{
ismagicsquare = false
}
}
if ismagicsquare{
print("Magic Square")
}else{
print("Not Magic Square")
}
| [
-1
] |
8e4a53dfa71fcef32693bd87f2fd9c7e422f6572 | e78664360bf999cd7e16419ad8f76f98034420e1 | /calcules.swift | b78042c4fa07af16ab8d8290a62dcf67b72967eb | [] | no_license | havocked/Graph | 36f48049b39cdc567d993f52c759ad5eccf5f9d6 | 802b6d497ebd74d377a69be77c6e0f04b1d9c831 | refs/heads/master | 2021-01-10T11:36:13.425093 | 2015-12-29T07:49:49 | 2015-12-29T07:49:49 | 48,698,196 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,210 | swift |
//Calculate new availableDSCR when adding or removing a Product in the graph
extension Graph: SimulatorDelegate {
func didAddProduct(product: Product?) {
let pmt = tmpAvailableDSCR * Float(product!.weight) / Float(simulation!.productList.allWeights())
product?.pmt = Double(pmt)
product?.updatePV()
if product?.amount.observable.value < product?.amount.maximum {
product?.amount.maximum = product!.amount.observable.value
}
addViewForProduct(product)
update(animation: true)
}
func didRemoveProduct(product: Product?) {
deleteViewForProduct(product)
tmpAvailableDSCR = simulation!.applicant!.maximumDSCR - simulation!.sumPMT()
self.availableDSCRLabel.text = "Available DSCR: \(self.tmpAvailableDSCR.formatToCurrency()) Rs"
update(animation: true)
}
}
//When user slides the value of slider for specific product
func didValueChanged(slider: CustomSlider) {
//Every slider is linked with a specified product
if let productChanged = slider.product {
/****************/
/** Begin calc **/
/****************/
productChanged.updatePMT()
updateAvailableDSCR(productChanged)
if tmpAvailableDSCR <= 0 {
tmpAvailableDSCR = 0
//Previous go previous pv and then stop
productChanged.amount.observable.next(Double(slider.previousValue))
//Should stop here !
return
} else {
slider.previousValue = Float(productChanged.amount.observable.value)
}
self.availableDSCRLabel.text = "Available DSCR: \(self.tmpAvailableDSCR.formatToCurrency()) Rs"
updateOtherProducts(except: productChanged)
/****************/
/*** End calc ***/
/****************/
updateSliderShape()
}
}
func updateAvailableDSCR(productChanged: Product) {
let allPMT = Float(simulation!.productList.totalPMT(except: productChanged))
tmpAvailableDSCR = simulation!.applicant!.maximumDSCR - Float(allPMT) - Float(productChanged.pmt)
}
func updateOtherProducts(except productChanged: Product) {
//Create a new array of product filtering the one that is just being modified (productChanged)
if let filteredArray = simulation?.productList.filter({ $0 != productChanged }) {
let weights = filteredArray.allWeights()
for (_, product) in filteredArray.enumerate() {
if !product.locked {
//Update new PMT for each products
product.pmt = (Double(product.weight) * Double(tmpAvailableDSCR)) / Double(weights)
//Then update the PV -> which is the value of slider
product.updatePV()
}
}
}
}
//Those methods are extension of Array of Product objects
extension CollectionType where Generator.Element == Product {
func allWeights() -> Int {
var sum = 0
for element in self {
sum += element.weight
}
return sum
}
func totalPMT(except except: Product) -> Double {
var sum: Double = 0
for element in self.filter({ $0 != except }) {
sum += element.pmt
print("pmt: \(element.pmt)")
}
return sum
}
func totalPV() -> Double {
var sum: Double = 0
for element in self {
sum += element.amount.observable.value
}
return sum
}
}
/* NOTE: Extreme Type is like this:
*
* class Extreme<T: NumericType> {
* var observable: Observable<T> // Consider Observable like a regular type such as Int or Float/Double
* var minimum: T
* var maximum: T
* }
*/
class Product {
var id: String?
var name: String?
var amount:Extreme<Double>
var interestRate: Extreme<Double>
var duration: Extreme<Int>
var weight: Int
var locked: Bool
var pmt: Double
func updatePMT() {
self.pmt = -1 * calcPMT(self.interestRate.observable.value / 12, n: Double(self.duration.observable.value * 12), p: self.amount.observable.value, f: 0, t: false)
}
func calcPMT(r: Double, n: Double, p: Double, f: Double, t: Bool) -> Double {
var retval: Double = 0;
if (r == 0) {
retval = -1 * (f + p) / n;
} else {
let r1 = r + 1;
retval = (f + p * pow(r1, n)) * r / ((t ? r1 : 1) * (1 - pow(r1, n)));
}
return retval;
}
func updatePV() {
let newPV = calcPV((self.interestRate.observable.value / 100) / 12, n: Double(self.duration.observable.value * 12), y: self.pmt, f: 0, t: false)
if newPV < self.amount.minimum {
self.amount.observable.next(self.amount.minimum)
}
}
func calcPV(r: Double, n: Double, y: Double, f: Double, t: Bool) -> Double {
var retval = 0.0;
let r1 = r + 1;
retval = (((1 - pow(r1, -n)) / r) * y)
return retval;
}
}
| [
-1
] |
c8aec1a8966b157d395c49697a5f289d0572f795 | e26874791508a3cb350c11467e5841bc6dfe99b6 | /Ruler/ViewController.swift | 7e17ebca8c10124003e6477430bc0c6d23ab2557 | [] | no_license | tylerhuff/Ruler | f7961e910f9e8846abc777a0216702690ee37d9e | dc15a892f7290426a6b1fa44b9997a897a6e50c1 | refs/heads/main | 2023-01-12T21:07:35.141591 | 2020-11-10T05:14:16 | 2020-11-10T05:14:16 | 311,552,960 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,277 | swift | //
// ViewController.swift
// Ruler
//
// Created by Tyler Huff on 10/30/20.
//
import UIKit
import SceneKit
import ARKit
class ViewController: UIViewController, ARSCNViewDelegate {
@IBOutlet var sceneView: ARSCNView!
var textNode = SCNNode()
var dotNodes = [SCNNode]()
override func viewDidLoad() {
super.viewDidLoad()
// Set the view's delegate
sceneView.delegate = self
sceneView.autoenablesDefaultLighting = true
// sceneView .debugOptions = [ARSCNDebugOptions.showFeaturePoints]
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Create a session configuration
let configuration = ARWorldTrackingConfiguration()
// Run the view's session
sceneView.session.run(configuration)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
// Pause the view's session
sceneView.session.pause()
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
if dotNodes.count >= 2 {
for dot in dotNodes {
dot.removeFromParentNode()
}
dotNodes = [SCNNode]()
}
if let touchLocation = touches.first?.location(in: sceneView) {
let hitTestResults = sceneView.hitTest(touchLocation, types: .featurePoint )
if let hitResult = hitTestResults.first {
addDot(at: hitResult)
}
}
}
func addDot(at hitResult: ARHitTestResult) {
let dot = SCNSphere(radius: 0.007)
let material = SCNMaterial()
material.diffuse.contents = UIColor.red
dot.materials = [material]
let dotNode = SCNNode(geometry: dot)
dotNode.position = SCNVector3(
hitResult.worldTransform.columns.3.x,
hitResult.worldTransform.columns.3.y,
hitResult.worldTransform.columns.3.z
)
sceneView.scene.rootNode.addChildNode(dotNode)
dotNodes.append(dotNode)
if dotNodes.count >= 2 {
calculate()
}
}
func calculate() {
let start = dotNodes[0]
let end = dotNodes[1]
let distance = sqrt(
pow((end.position.x - start.position.x), 2.0) +
pow(end.position.y - start.position.y, 2.0) +
pow(end.position.z - start.position.z, 2.0)
)
updateText(text: String(format:"%.2f", distance), atPosition: end.position)
}
func updateText(text: String, atPosition: SCNVector3) {
textNode.removeFromParentNode()
let textGeometry = SCNText(string: text + "m", extrusionDepth: 1.0)
textGeometry.firstMaterial?.diffuse.contents = UIColor.blue
textNode = SCNNode(geometry: textGeometry)
textNode.position = atPosition
textNode.scale = SCNVector3(0.005, 0.005, 0.005)
sceneView.scene.rootNode.addChildNode(textNode)
}
}
| [
-1
] |
c5203404157ae159cc9d41283f25a40f50429899 | df2e2aea701e5a627c4a666bb90fe406a1f9f6d7 | /Experiences/View Controllers/AddViewController.swift | 9c4ac4fac4c4399c0d799fca3d70fbeb8118edbc | [] | no_license | drudolpho/ios-sprint-challenge-experiences | f549710cfc21816b2bfc9fe178a1b8bdab508a76 | 460621f35cc047366d0c918e88b6be0d47ed9be7 | refs/heads/master | 2020-12-14T00:54:22.306712 | 2020-01-17T19:06:13 | 2020-01-17T19:06:13 | 234,584,462 | 0 | 0 | null | 2020-01-17T16:05:42 | 2020-01-17T16:05:41 | null | UTF-8 | Swift | false | false | 6,624 | swift | //
// AddViewController.swift
// Experiences
//
// Created by Dennis Rudolph on 1/17/20.
// Copyright © 2020 Lambda School. All rights reserved.
//
import UIKit
import ImageIO
import AVFoundation
class AddViewController: UIViewController {
@IBOutlet weak var nameTF: UITextField!
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var chooseImageButton: UIButton!
@IBOutlet weak var recordAudioButton: UIButton!
var expController: ExpController?
// Image Stuff
private var filter = CIFilter(name: "CIColorControls")!
private var context = CIContext(options: nil)
private var imagePosition = CGPoint.zero
var finishedImage: UIImage?
var chosenImage: UIImage? {
didSet {
guard let chosenImage = chosenImage else { return }
var scaledSize = imageView.bounds.size
let scale = UIScreen.main.scale
scaledSize = CGSize(width: scaledSize.width * scale, height: scaledSize.height * scale)
scaledImage = chosenImage.imageByScaling(toSize: scaledSize)
}
}
var scaledImage: UIImage? {
didSet {
guard let image = scaledImage else { return }
filterAndSetImage(image: image)
}
}
// Audio Stuff
var audioRecorder: AVAudioRecorder?
var recordURL: URL?
var finishedAudioURL: URL?
var isRecording: Bool {
return audioRecorder?.isRecording ?? false
}
func record() {
let documents = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
let name = ISO8601DateFormatter.string(from: Date(), timeZone: .current, formatOptions: [.withInternetDateTime])
let file = documents.appendingPathComponent(name).appendingPathExtension("caf")
recordURL = file
let format = AVAudioFormat(standardFormatWithSampleRate: 44_100, channels: 1)!
audioRecorder = try! AVAudioRecorder(url: file, format: format)
audioRecorder?.delegate = self
audioRecorder?.record()
updateRecordViews()
}
func stop() {
audioRecorder?.stop()
finishedAudioURL = audioRecorder?.url
audioRecorder = nil
updateRecordViews()
}
func recordToggle() {
if isRecording {
stop()
} else {
record()
}
}
func updateRecordViews() {
let recordButtonTitle = isRecording ? "Stop" : "Record Audio"
recordAudioButton.setTitle(recordButtonTitle, for: .normal)
}
func filterAndSetImage(image: UIImage) {
guard let cgImage = image.cgImage else { return }
let ciImage = CIImage(cgImage: cgImage)
filter.setValue(ciImage, forKey: kCIInputImageKey)
filter.setValue(2, forKey: kCIInputContrastKey)
guard let outputCIImage = filter.outputImage else { return }
guard let outputCGImage = context.createCGImage(outputCIImage, from: CGRect(origin: CGPoint.zero, size: image.size)) else { return }
self.imageView.image = UIImage(cgImage: outputCGImage)
self.finishedImage = UIImage(cgImage: outputCGImage)
}
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(true)
print("Latitude: \(expController?.usersLatitude ?? 0)\nLongitude: \(expController?.usersLongitude ?? 0)")
}
private func presentImagePickerController() {
guard UIImagePickerController.isSourceTypeAvailable(.photoLibrary) else {
print("The photo library is not available")
return
}
let imagePicker = UIImagePickerController()
imagePicker.sourceType = .photoLibrary
imagePicker.delegate = self
present(imagePicker, animated: true, completion: nil)
}
@IBAction func chooseImageTapped(_ sender: UIButton) {
presentImagePickerController()
}
@IBAction func recordAudioTapped(_ sender: UIButton) {
recordToggle()
}
// MARK: - Navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "RecordSegue" {
let destinationVC = segue.destination as? RecordViewController
destinationVC?.expController = expController
destinationVC?.expName = nameTF.text
destinationVC?.expImage = finishedImage
destinationVC?.expAudioURL = finishedAudioURL
}
}
}
extension AddViewController: UIImagePickerControllerDelegate {
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let image = info[.editedImage] as? UIImage {
chosenImage = image
} else if let image = info[.originalImage] as? UIImage {
chosenImage = image
}
picker.dismiss(animated: true, completion: nil)
}
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
picker.dismiss(animated: true, completion: nil)
}
}
extension AddViewController: UINavigationControllerDelegate {
}
extension UIImage {
func imageByScaling(toSize size: CGSize) -> UIImage? {
guard let data = flattened.pngData(),
let imageSource = CGImageSourceCreateWithData(data as CFData, nil) else {
return nil
}
let options: [CFString: Any] = [
kCGImageSourceThumbnailMaxPixelSize: max(size.width, size.height),
kCGImageSourceCreateThumbnailFromImageAlways: true
]
return CGImageSourceCreateThumbnailAtIndex(imageSource, 0, options as CFDictionary).flatMap { UIImage(cgImage: $0) }
}
var flattened: UIImage {
if imageOrientation == .up { return self }
return UIGraphicsImageRenderer(size: size, format: imageRendererFormat).image { context in
draw(at: .zero)
}
}
}
extension AddViewController: AVAudioRecorderDelegate {
func audioRecorderEncodeErrorDidOccur(_ recorder: AVAudioRecorder, error: Error?) {
if let error = error {
print("Audio recorder error: \(error)")
}
}
func audioRecorderDidFinishRecording(_ recorder: AVAudioRecorder, successfully flag: Bool) {
print("Finished Recording")
updateRecordViews()
}
}
| [
-1
] |
8670a923308f9ac656b52d1e3eafa0e106a5f4b7 | b5ffea745a0f6ec0abfe69bdab17887b769cdbd8 | /PassengerApp/Screens/AddDestinationUV.swift | b5ef02398dfff41e53ecef3549abbfa72fa6bdd2 | [] | no_license | kumailrizvi/RiderAppiOS | 40c0f5eb52a2858e13dd20071b16e208549d304d | 6ebbbb875ed4703f48ec3738d422b731fa3a9333 | refs/heads/master | 2021-10-08T00:17:27.392359 | 2018-12-06T08:47:49 | 2018-12-06T08:47:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 16,176 | swift | //
// AddDestinationUV.swift
// PassengerApp
//
// Created by ADMIN on 31/05/17.
// Copyright © 2017 V3Cube. All rights reserved.
//
import UIKit
import GoogleMaps
import CoreLocation
class AddDestinationUV: UIViewController, GMSMapViewDelegate, OnLocationUpdateDelegate, AddressFoundDelegate, MyBtnClickDelegate {
@IBOutlet weak var contentView: UIView!
@IBOutlet weak var googleMapContainerView: UIView!
@IBOutlet weak var addLocationBtn: MyButton!
@IBOutlet weak var locAreaView: UIView!
@IBOutlet weak var locLbl: MyLabel!
@IBOutlet weak var selectLocImgView: UIImageView!
var centerLocation:CLLocation!
var SCREEN_TYPE = "DESTINATION"
let generalFunc = GeneralFunctions()
var isFirstLocationUpdate = true
var isPageLoaded = false
var gMapView:GMSMapView!
var isFromRecentLocView = false
var isFromSearchPlaces = false
var isFromSelectLoc = false
var isFromMainScreen = false
var getLocation:GetLocation!
var getAddressFrmLocation:GetAddressFromLocation!
var selectedLocation:CLLocation!
var selectedAddress = ""
let placeMarker: GMSMarker = GMSMarker()
// var isSkipCurrentChange = false
var isSelectingLocation = false
var isSkipMapLocSelectOnChangeCamera = false
var isSkipCurrentMoveOnAddress = false
var iUserFavAddressId = ""
var userProfileJson:NSDictionary!
override func viewWillAppear(_ animated: Bool) {
self.configureRTLView()
}
override func viewDidLoad() {
super.viewDidLoad()
self.contentView.addSubview(self.generalFunc.loadView(nibName: "AddDestinationScreenDesign", uv: self, contentView: contentView))
self.addBackBarBtn()
userProfileJson = (GeneralFunctions.getValue(key: Utils.USER_PROFILE_DICT_KEY) as! String).getJsonDataDict().getObj(Utils.message_str)
let userFavouriteAddressArr = userProfileJson.getArrObj("UserFavouriteAddress")
if(userFavouriteAddressArr.count > 0){
for i in 0..<userFavouriteAddressArr.count {
let dataItem = userFavouriteAddressArr[i] as! NSDictionary
if(dataItem.get("eType").uppercased() == self.SCREEN_TYPE.uppercased()){
self.iUserFavAddressId = dataItem.get("iUserFavAddressId")
}
}
}
}
override func viewDidAppear(_ animated: Bool) {
if(isPageLoaded == false){
isPageLoaded = true
let camera = GMSCameraPosition.camera(withLatitude: 0.0, longitude: 0.0, zoom: 0.0)
// gMapView = GMSMapView.map(withFrame: self.googleMapContainerView.frame, camera: camera)
gMapView = GMSMapView.map(withFrame: CGRect(x: 0, y:0, width: self.googleMapContainerView.frame.size.width, height: self.googleMapContainerView.frame.size.height), camera: camera)
// googleMapContainerView = gMapView
// gMapView = GMSMapView()
// gMapView.isMyLocationEnabled = true
gMapView.delegate = self
self.googleMapContainerView.addSubview(gMapView)
setData()
}
}
func setData(){
if(SCREEN_TYPE == "DESTINATION"){
self.navigationItem.title = self.generalFunc.getLanguageLabel(origValue: "", key: "LBL_SELECT_DESTINATION_HEADER_TXT")
self.title = self.generalFunc.getLanguageLabel(origValue: "", key: "LBL_SELECT_DESTINATION_HEADER_TXT")
}else if(SCREEN_TYPE == "PICKUP"){
self.navigationItem.title = self.generalFunc.getLanguageLabel(origValue: "", key: "LBL_SET_PICK_UP_LOCATION_TXT")
self.title = self.generalFunc.getLanguageLabel(origValue: "", key: "LBL_SET_PICK_UP_LOCATION_TXT")
}else if(SCREEN_TYPE == "HOME"){
self.navigationItem.title = self.generalFunc.getLanguageLabel(origValue: "", key: "LBL_ADD_HOME_BIG_TXT")
self.title = self.generalFunc.getLanguageLabel(origValue: "", key: "LBL_ADD_HOME_BIG_TXT")
}else if(SCREEN_TYPE == "WORK"){
self.navigationItem.title = self.generalFunc.getLanguageLabel(origValue: "", key: "LBL_ADD_WORK_HEADER_TXT")
self.title = self.generalFunc.getLanguageLabel(origValue: "", key: "LBL_ADD_WORK_HEADER_TXT")
}else{
self.navigationItem.title = self.generalFunc.getLanguageLabel(origValue: "", key: "LBL_ADD_LOC")
self.title = self.generalFunc.getLanguageLabel(origValue: "", key: "LBL_ADD_LOC")
}
self.locLbl.text = self.generalFunc.getLanguageLabel(origValue: "", key: "LBL_SEARCH_PLACE_HINT_TXT")
self.addLocationBtn.setButtonTitle(buttonTitle: self.generalFunc.getLanguageLabel(origValue: "", key: "LBL_ADD_LOC"))
self.addLocationBtn.clickDelegate = self
// self.addLocationBtn.unwindToActiveTrip
getAddressFrmLocation = GetAddressFromLocation(uv: self, addressFoundDelegate: self)
if(centerLocation == nil){
self.getLocation = GetLocation(uv: self, isContinuous: true)
self.getLocation.buildLocManager(locationUpdateDelegate: self)
}else{
isSkipCurrentMoveOnAddress = true
self.locLbl.text = self.generalFunc.getLanguageLabel(origValue: "", key: "LBL_SELECTING_LOCATION_TXT")
getAddressFrmLocation.setLocation(latitude: centerLocation!.coordinate.latitude, longitude: centerLocation!.coordinate.longitude)
getAddressFrmLocation.executeProcess(isOpenLoader: true, isAlertShow: true)
isSkipMapLocSelectOnChangeCamera = true
self.animateGmapCamera(location: centerLocation!, zoomLevel: Utils.defaultZoomLevel)
}
// Utils.showSnakeBar(msg: self.generalFunc.getLanguageLabel(origValue: "", key: "LBL_LONG_TOUCH_CHANGE_LOC_TXT"), uv: self)
let placeTapGue = UITapGestureRecognizer()
placeTapGue.addTarget(self, action: #selector(self.launchPlaceFinder))
locAreaView.isUserInteractionEnabled = true
locAreaView.addGestureRecognizer(placeTapGue)
GeneralFunctions.setImgTintColor(imgView: selectLocImgView, color: UIColor.UCAColor.AppThemeColor_1)
self.selectLocImgView.isHidden = false
}
func launchPlaceFinder(){
let launchPlaceFinder = LaunchPlaceFinder(viewControllerUV: self)
launchPlaceFinder.currInst = launchPlaceFinder
launchPlaceFinder.isFromSelectLoc = true
if(centerLocation != nil){
launchPlaceFinder.setBiasLocation(sourceLocationPlaceLatitude: centerLocation!.coordinate.latitude, sourceLocationPlaceLongitude: centerLocation!.coordinate.longitude)
}
launchPlaceFinder.initializeFinder { (address, latitude, longitude) in
self.locLbl.text = address
self.selectedAddress = address
self.selectedLocation = CLLocation(latitude: latitude, longitude: longitude)
self.isSelectingLocation = false
self.isSkipMapLocSelectOnChangeCamera = true
self.changeMarkerPosition(location: self.selectedLocation, zoomLevel: Utils.defaultZoomLevel)
}
}
override func closeCurrentScreen() {
releaseAllTask()
super.closeCurrentScreen()
}
deinit {
releaseAllTask()
}
func releaseAllTask(isDismiss:Bool = true){
if(gMapView != nil){
gMapView!.stopRendering()
gMapView!.removeFromSuperview()
gMapView!.clear()
gMapView!.delegate = nil
gMapView = nil
}
if(self.getLocation != nil){
self.getLocation!.locationUpdateDelegate = nil
self.getLocation!.releaseLocationTask()
self.getLocation = nil
}
if(getAddressFrmLocation != nil){
getAddressFrmLocation!.addressFoundDelegate = nil
getAddressFrmLocation = nil
}
GeneralFunctions.removeObserver(obj: self)
if(isDismiss){
// self.dismiss(animated: false, completion: nil)
// self.navigationController?.dismiss(animated: false, completion: nil)
}
}
func mapView(_ mapView: GMSMapView, didLongPressAt coordinate: CLLocationCoordinate2D) {
// getAddressFrmLocation.setLocation(latitude: coordinate.latitude, longitude: coordinate.longitude)
// getAddressFrmLocation.executeProcess(isOpenLoader: true, isAlertShow: true)
// self.animateGmapCamera(location: CLLocation(latitude: coordinate.latitude, longitude: coordinate.longitude))
}
func onLocationUpdate(location: CLLocation) {
if(gMapView == nil){
releaseAllTask()
return
}
if(isFirstLocationUpdate == true){
isSkipCurrentMoveOnAddress = true
isSkipMapLocSelectOnChangeCamera = true
self.animateGmapCamera(location: location, zoomLevel: Utils.defaultZoomLevel)
getAddressFrmLocation.setLocation(latitude: location.coordinate.latitude, longitude: location.coordinate.longitude)
getAddressFrmLocation.executeProcess(isOpenLoader: true, isAlertShow: true)
self.locLbl.text = self.generalFunc.getLanguageLabel(origValue: "", key: "LBL_SELECTING_LOCATION_TXT")
}
isFirstLocationUpdate = false
}
func onAddressFound(address: String, location:CLLocation, isPickUpMode:Bool, dataResult:String) {
if(address == ""){
return
}
self.locLbl.text = address
self.selectedAddress = address
self.selectedLocation = location
self.isSelectingLocation = false
if(isSkipCurrentMoveOnAddress == true){
isSkipCurrentMoveOnAddress = false
return
}
if(getCenterLocation().coordinate.latitude != location.coordinate.latitude || getCenterLocation().coordinate.longitude != location.coordinate.longitude){
isSkipMapLocSelectOnChangeCamera = true
}
changeMarkerPosition(location: location, zoomLevel: self.gMapView.camera.zoom)
}
func mapView(_ mapView: GMSMapView, idleAt position: GMSCameraPosition) {
if(isSkipMapLocSelectOnChangeCamera == true){
isSkipMapLocSelectOnChangeCamera = false
return
}
self.locLbl.text = self.generalFunc.getLanguageLabel(origValue: "", key: "LBL_SELECTING_LOCATION_TXT")
self.isSelectingLocation = true
getAddressFrmLocation.setLocation(latitude: getCenterLocation().coordinate.latitude, longitude: getCenterLocation().coordinate.longitude)
getAddressFrmLocation.executeProcess(isOpenLoader: true, isAlertShow: false)
}
func getCenterLocation() -> CLLocation{
return CLLocation(latitude: self.gMapView.camera.target.latitude, longitude: self.gMapView.camera.target.longitude)
}
func changeMarkerPosition(location:CLLocation, zoomLevel:Float){
placeMarker.position = location.coordinate
placeMarker.icon = UIImage(named: "ic_destination_place_image")
// placeMarker.map = self.gMapView
placeMarker.infoWindowAnchor = CGPoint(x: 0.5, y: 0.5)
self.animateGmapCamera(location: location, zoomLevel: zoomLevel)
}
func animateGmapCamera(location:CLLocation, zoomLevel:Float){
if(self.gMapView == nil){
return
}
var currentZoomLevel:Float = zoomLevel
if(isFirstLocationUpdate == true){
currentZoomLevel = Utils.defaultZoomLevel
isFirstLocationUpdate = false
}
let camera = GMSCameraPosition.camera(withLatitude: location.coordinate.latitude,
longitude: location.coordinate.longitude, zoom: currentZoomLevel)
// if(isSkipCurrentChange == false){
self.gMapView.moveCamera(GMSCameraUpdate.setCamera(camera))
// }else{
// isSkipCurrentChange = false
// }
// self.gMapView.animate(to: camera)
}
func addToServer(vAddress:String, vLatitude:String, vLongitude:String, eType:String){
let parameters = ["type":"UpdateUserFavouriteAddress","iUserId": GeneralFunctions.getMemberd(), "eUserType": Utils.appUserType, "vAddress": vAddress, "vLatitude": vLatitude, "vLongitude": vLongitude, "eType": eType, "iUserFavAddressId": iUserFavAddressId]
let exeWebServerUrl = ExeServerUrl(dict_data: parameters, currentView: self.view, isOpenLoader: true)
exeWebServerUrl.setDeviceTokenGenerate(isDeviceTokenGenerate: true)
exeWebServerUrl.currInstance = exeWebServerUrl
exeWebServerUrl.executePostProcess(completionHandler: { (response) -> Void in
if(response != ""){
let dataDict = response.getJsonDataDict()
if(dataDict.get("Action") == "1"){
_ = SetUserData(uv: self, userProfileJson: dataDict, isStoreUserId: false)
self.releaseAllTask()
if(self.isFromMainScreen == true){
self.performSegue(withIdentifier: "unwindToMainScreen", sender: self)
return
}
if(self.isFromSearchPlaces == true){
self.performSegue(withIdentifier: "unwindToSearchPlaceScreen", sender: self)
}else if(self.isFromRecentLocView == false && (self.SCREEN_TYPE == "HOME" || self.SCREEN_TYPE == "WORK")){
self.performSegue(withIdentifier: "unwindToViewProfileScreen", sender: self)
}else{
self.performSegue(withIdentifier: "unwindToMainScreen", sender: self)
}
}else{
self.generalFunc.setError(uv: self, title: "", content: self.generalFunc.getLanguageLabel(origValue: "", key: dataDict.get("message")))
}
}else{
self.generalFunc.setError(uv: self)
}
})
}
func myBtnTapped(sender: MyButton) {
if(sender == self.addLocationBtn){
if(self.selectedLocation == nil || self.isSelectingLocation == true){
Utils.showSnakeBar(msg: self.generalFunc.getLanguageLabel(origValue: "", key: "LBL_SET_LOCATION"), uv: self)
}else{
if(self.SCREEN_TYPE == "HOME" || self.SCREEN_TYPE == "WORK"){
self.addToServer(vAddress: "\(selectedAddress)", vLatitude: "\(selectedLocation.coordinate.latitude)", vLongitude: "\(selectedLocation.coordinate.longitude)", eType: self.SCREEN_TYPE == "HOME" ? "Home" : "Work")
return
}
releaseAllTask()
if(self.isFromMainScreen == true){
self.performSegue(withIdentifier: "unwindToMainScreen", sender: self)
return
}
if(self.isFromSearchPlaces == true){
self.performSegue(withIdentifier: "unwindToSearchPlaceScreen", sender: self)
}else if(self.isFromRecentLocView == false && (self.SCREEN_TYPE == "HOME" || self.SCREEN_TYPE == "WORK")){
self.performSegue(withIdentifier: "unwindToViewProfileScreen", sender: self)
}else{
self.performSegue(withIdentifier: "unwindToMainScreen", sender: self)
}
}
}
}
}
| [
-1
] |
0d3a0d767e311dde91aaa1476c2ccc83bcad8d9b | fbf2e63668439fe3f8cf3ae3d883cdf89815a17a | /AVFoundationSampleUITests/AVFoundationSampleUITests.swift | 00ed80d6c17b586e51e95be59fbc14c32e4be369 | [] | no_license | KapKr21/AVFoundation | c0a3e438217f3840902f7d07366b62b07b42b6db | dff714c7d6a40d554ddf6e6275008250c5b0d195 | refs/heads/master | 2022-11-14T17:03:49.534583 | 2020-07-08T14:59:13 | 2020-07-08T14:59:13 | 278,117,677 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,440 | swift | //
// AVFoundationSampleUITests.swift
// AVFoundationSampleUITests
//
// Created by Kap's on 08/07/20.
//
import XCTest
class AVFoundationSampleUITests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testLaunchPerformance() throws {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
}
}
| [
360463,
155665,
376853,
344106,
253996,
163894,
385078,
180279,
319543,
352314,
213051,
376892,
32829,
286787,
352324,
237638,
352327,
385095,
163916,
368717,
311373,
196687,
278607,
311377,
254039,
426074,
368732,
180317,
32871,
352359,
221292,
278637,
385135,
319599,
376945,
131190,
385147,
131199,
426124,
196758,
49308,
65698,
311459,
49317,
377008,
377010,
180409,
295099,
377025,
377033,
164043,
417996,
254157,
368849,
368850,
139478,
229591,
385240,
254171,
147679,
147680,
311520,
205034,
254189,
286957,
254193,
344312,
336121,
262403,
147716,
385291,
368908,
180494,
262419,
254228,
368915,
319764,
278805,
377116,
254250,
311596,
131374,
418095,
336177,
368949,
180534,
155968,
287040,
311622,
270663,
319816,
368969,
254285,
180559,
377168,
344402,
229716,
368982,
270703,
139641,
385407,
385409,
106893,
270733,
385423,
385433,
213402,
385437,
254373,
156069,
385448,
385449,
311723,
115116,
385463,
319931,
278974,
336319,
336323,
188870,
278988,
278992,
262619,
377309,
377310,
369121,
369124,
279014,
270823,
279017,
311787,
213486,
360945,
139766,
393719,
279030,
377337,
279033,
254459,
410108,
410109,
262657,
377346,
279042,
279053,
410126,
393745,
385554,
303635,
279060,
279061,
262673,
254487,
410138,
279066,
188957,
377374,
385569,
385578,
377388,
197166,
393775,
418352,
33339,
352831,
33344,
385603,
377419,
385612,
303693,
426575,
385620,
369236,
115287,
189016,
270938,
287327,
279143,
279150,
287345,
352885,
352886,
344697,
189054,
287359,
369285,
385669,
311944,
344714,
311950,
377487,
311953,
287379,
336531,
426646,
180886,
352921,
377499,
221853,
344737,
295591,
352938,
295598,
418479,
279215,
279218,
164532,
336565,
287418,
377531,
303802,
377534,
377536,
66243,
385737,
287434,
385745,
279249,
303826,
369365,
369366,
385751,
230105,
361178,
352989,
352990,
418529,
295649,
385763,
295653,
369383,
230120,
361194,
312046,
418550,
344829,
279293,
205566,
197377,
434956,
312076,
295698,
418579,
426772,
197398,
426777,
221980,
344864,
197412,
336678,
262952,
189229,
262957,
164655,
197424,
328495,
197428,
336693,
230198,
377656,
426809,
197433,
222017,
295745,
377669,
197451,
369488,
279379,
385878,
385880,
295769,
197467,
435038,
230238,
279393,
303973,
279398,
385895,
197479,
385901,
197489,
295799,
164730,
336765,
254851,
369541,
172936,
320394,
426894,
189327,
377754,
140203,
172971,
377778,
304050,
189362,
189365,
377789,
189373,
345030,
345034,
279499,
418774,
386007,
418781,
386016,
123880,
418793,
320495,
435185,
222193,
271351,
214009,
312313,
435195,
328701,
312317,
386049,
328705,
418819,
410629,
377863,
189448,
230411,
320526,
361487,
435216,
386068,
254997,
336928,
336930,
410665,
345137,
361522,
312372,
238646,
238650,
320571,
386108,
410687,
336962,
238663,
377927,
361547,
205911,
156763,
361570,
214116,
230500,
214119,
402538,
279659,
173168,
230514,
238706,
279666,
312435,
377974,
66684,
377986,
279686,
402568,
222344,
140426,
337037,
386191,
410772,
222364,
418975,
124073,
402618,
148674,
402632,
148687,
402641,
189651,
419028,
279766,
189656,
304353,
279780,
222441,
279789,
386288,
66802,
271607,
386296,
369913,
419066,
369912,
386300,
279803,
386304,
320769,
369929,
419097,
320795,
115997,
222496,
320802,
304422,
369964,
353581,
116014,
66863,
312628,
345397,
345398,
386363,
222523,
345418,
337226,
337228,
353612,
353611,
230730,
296269,
353617,
222542,
238928,
296274,
378201,
230757,
296304,
312688,
337280,
296328,
263561,
296330,
304523,
353672,
370066,
9618,
411028,
279955,
370072,
148899,
148900,
361928,
337359,
329168,
312785,
329170,
222674,
353751,
280025,
239069,
329181,
320997,
361958,
271850,
280042,
280043,
271853,
329198,
411119,
337391,
116209,
296434,
386551,
288252,
312830,
271880,
198155,
329231,
304655,
370200,
222754,
157219,
157220,
394793,
312879,
288305,
288319,
288322,
280131,
288328,
353875,
99937,
345697,
312937,
271980,
206447,
403057,
42616,
337533,
280193,
370307,
419462,
149127,
149128,
419464,
288391,
214667,
411275,
239251,
345753,
198304,
255651,
337590,
370359,
280252,
280253,
321217,
239305,
296649,
403149,
313042,
345813,
370390,
272087,
345817,
337638,
181992,
345832,
345835,
288492,
141037,
313082,
288508,
288515,
173828,
395018,
395019,
116491,
395026,
124691,
116502,
435993,
345882,
411417,
321308,
255781,
362281,
378666,
403248,
378673,
345910,
182070,
182071,
436029,
345918,
337734,
280396,
272207,
272208,
337746,
395092,
345942,
362326,
345950,
370526,
362336,
255844,
296807,
214894,
362351,
214896,
313200,
313204,
124795,
182145,
280451,
67464,
305032,
337816,
124826,
329627,
239515,
354210,
436130,
436135,
10153,
313257,
362411,
370604,
362418,
411587,
280517,
362442,
346066,
231382,
354268,
436189,
403421,
329696,
354273,
403425,
190437,
354279,
436199,
174058,
354283,
247787,
329707,
337899,
296942,
247786,
436209,
313322,
124912,
239610,
346117,
182277,
354311,
403463,
354312,
43016,
354310,
313356,
436235,
419857,
305173,
436248,
223269,
346153,
354346,
313388,
124974,
272432,
403507,
378933,
378934,
436283,
288835,
403524,
436293,
313415,
239689,
436304,
329812,
223317,
411738,
272477,
280676,
313446,
395373,
288878,
346237,
215165,
436372,
329884,
378186,
362658,
436388,
215204,
125108,
133313,
395458,
338118,
436429,
346319,
321744,
379102,
387299,
18661,
379110,
338151,
125166,
149743,
379120,
436466,
125170,
411892,
395511,
436471,
313595,
436480,
125184,
272644,
125192,
338187,
338188,
125197,
395536,
125200,
338196,
272661,
379157,
125204,
157973,
125215,
125216,
338217,
125225,
321839,
125236,
362809,
379193,
395591,
289109,
272730,
436570,
215395,
239973,
280938,
321901,
354671,
362864,
354672,
272755,
354678,
199030,
223611,
248188,
313726,
436609,
240003,
395653,
436613,
395660,
264591,
272784,
420241,
240020,
190870,
190872,
289185,
436644,
289195,
272815,
436659,
338359,
436677,
289229,
281038,
281039,
256476,
420326,
166403,
322057,
420374,
322077,
289328,
330291,
322119,
191065,
436831,
420461,
313970,
346739,
346741,
420473,
297600,
166533,
346771,
363155,
264855,
363161,
289435,
436897,
248494,
166581,
355006,
363212,
363228,
436957,
322269,
436960,
264929,
338658,
289511,
330473,
346859,
330476,
289517,
215790,
199415,
289534,
322302,
35584,
133889,
322312,
346889,
264971,
322320,
166677,
207639,
363295,
355117,
191285,
355129,
273209,
273211,
355136,
355138,
420680,
355147,
355148,
355153,
281426,
387927,
363353,
363354,
281434,
322396,
420702,
363361,
363362,
412516,
355173,
355174,
281444,
207724,
355182,
207728,
420722,
314240,
158594,
330627,
240517,
265094,
387977,
396171,
355216,
224146,
224149,
256918,
256919,
256920,
240543,
256934,
289720,
273336,
289723,
273341,
330688,
379845,
363462,
19398,
273353,
191445,
207839,
347104,
314343,
134124,
412653,
257007,
248815,
347122,
437245,
257023,
125953,
396292,
330759,
347150,
330766,
412692,
330789,
248871,
281647,
412725,
257093,
404550,
314437,
207954,
339031,
257126,
404582,
265318,
322664,
396395,
265323,
404589,
273523,
363643,
248960,
150656,
363658,
404622,
224400,
347286,
265366,
429209,
339101,
429216,
339106,
265381,
380069,
3243,
208044,
322733,
421050,
339131,
265410,
183492,
273616,
339167,
298209,
421102,
363769,
52473,
208123,
52476,
412926,
437504,
322826,
388369,
380178,
429332,
126229,
412963,
257323,
273713,
298290,
208179,
159033,
347451,
216387,
372039,
257353,
257354,
109899,
437585,
331091,
150868,
314708,
372064,
429410,
437602,
281958,
388458,
265579,
306541,
314734,
314740,
314742,
421240,
314745,
224637,
388488,
298378,
306580,
282008,
396697,
314776,
282013,
290206,
396709,
298406,
241067,
314797,
380335,
355761,
421302,
134586,
380348,
380350,
216511,
216510,
306630,
200136,
273865,
306634,
339403,
372172,
413138,
437726,
429540,
3557,
3559,
191980,
282097,
191991,
265720,
216575,
290304,
372226,
437766,
323083,
208397,
323088,
413202,
388630,
413206,
175640,
216610,
372261,
347693,
323120,
396850,
200245,
323126,
290359,
134715,
323132,
421437,
396865,
282182,
413255,
265800,
273992,
421452,
265809,
396885,
290391,
265816,
396889,
306777,
388699,
396896,
323171,
388712,
388713,
314997,
290425,
339579,
396927,
282248,
224907,
396942,
405140,
274071,
323226,
208547,
208548,
405157,
388775,
282279,
364202,
421556,
224951,
224952,
306875,
282302,
323262,
323265,
241360,
241366,
224985,
282330,
159462,
372458,
397040,
12017,
323315,
274170,
200444,
175874,
249606,
323335,
282379,
216844,
372497,
397076,
421657,
339746,
216868,
257831,
167720,
241447,
421680,
282418,
421686,
274234,
241471,
339782,
315209,
159563,
241494,
339799,
307038,
274276,
282471,
274288,
372592,
274296,
339840,
315265,
372625,
282517,
298912,
118693,
438186,
126896,
151492,
380874,
372699,
323554,
380910,
380922,
380923,
274432,
372736,
241695,
315431,
430120,
102441,
315433,
430127,
405552,
282671,
241717,
249912,
225347,
307269,
421958,
233548,
176209,
315477,
53334,
381013,
200795,
356446,
323678,
438374,
176231,
438378,
233578,
217194,
422000,
249976,
266361,
422020,
381061,
168070,
168069,
381071,
241809,
323730,
430231,
200856,
422044,
192670,
192671,
299166,
258213,
299176,
323761,
184498,
430263,
266427,
356550,
299208,
372943,
266447,
258263,
356575,
307431,
438512,
372979,
389364,
381173,
135416,
356603,
184574,
266504,
217352,
61720,
381210,
315674,
282908,
389406,
282912,
233761,
438575,
315698,
266547,
332084,
397620,
438583,
127292,
438592,
332100,
323914,
201037,
397650,
348499,
250196,
348501,
389465,
332128,
110955,
242027,
242028,
160111,
250227,
315768,
291193,
438653,
291200,
266628,
340356,
242059,
225684,
373141,
373144,
291225,
389534,
397732,
373196,
176602,
242138,
184799,
291297,
201195,
324098,
233987,
340489,
397841,
283154,
258584,
397855,
291359,
348709,
348710,
397872,
283185,
234037,
340539,
266812,
438850,
348741,
381515,
348748,
430681,
332379,
242274,
184938,
373357,
184942,
176751,
389744,
356983,
356984,
209529,
356990,
291455,
422529,
373377,
152196,
201348,
356998,
348807,
356999,
316044,
316050,
275102,
340645,
176805,
422567,
176810,
160441,
422591,
291529,
225996,
135888,
242385,
234216,
373485,
373486,
21239,
275193,
348921,
234233,
242428,
299777,
430853,
430860,
62222,
430880,
234276,
234290,
152372,
160569,
430909,
160576,
348999,
283466,
439118,
234330,
275294,
381791,
127840,
357219,
439145,
177002,
308075,
242540,
242542,
381811,
201590,
177018,
398205,
340865,
291713,
349066,
316299,
349068,
234382,
308111,
381840,
308113,
390034,
373653,
430999,
209820,
381856,
185252,
398244,
422825,
381872,
177074,
398268,
349122,
398275,
373705,
127945,
340960,
398305,
340967,
398313,
234476,
127990,
349176,
201721,
349179,
234499,
357380,
398370,
357413,
357420,
300087,
21567,
308288,
398405,
349254,
218187,
250955,
300109,
234578,
250965,
439391,
250982,
398444,
62574,
357487,
300147,
119925,
349304,
234626,
349315,
349317,
234635,
373902,
177297,
324761,
234655,
234662,
373937,
373939,
324790,
300215,
218301,
283841,
283846,
259275,
316628,
259285,
357594,
414956,
251124,
316661,
292092,
439550,
439563,
242955,
414989,
349458,
259346,
259347,
382243,
382246,
382257,
292145,
382264,
333115,
193853,
193858,
251212,
406862,
234830,
259408,
283990,
357720,
300378,
300379,
316764,
374110,
234864,
382329,
259449,
357758,
243073,
357763,
112019,
398740,
234902,
374189,
251314,
284086,
259513,
54719,
292291,
300490,
300526,
259569,
251379,
300539,
398844,
210429,
366081,
316951,
374297,
153115,
431646,
349727,
431662,
374327,
210489,
235069,
349764,
292424,
292426,
128589,
333389,
333394,
349780,
128600,
235096,
300643,
300645,
415334,
54895,
366198,
210558,
210559,
415360,
325246,
333438,
415369,
431754,
210569,
267916,
415376,
259741,
153252,
399014,
210601,
202413,
317102,
415419,
259780,
333508,
267978,
333522,
325345,
333543,
431861,
284410,
161539,
284425,
300812,
284430,
366358,
169751,
431901,
341791,
325411,
186148,
186149,
333609,
284460,
399148,
431918,
202541,
153392,
431935,
415555,
325444,
153416,
325449,
341837,
415566,
431955,
325460,
317268,
341846,
300893,
259937,
382820,
276326,
415592,
292713,
292719,
325491,
341878,
276343,
333687,
350072,
317305,
112510,
325508,
333700,
243590,
325514,
350091,
350092,
350102,
350108,
333727,
219046,
284584,
292783,
300983,
128955,
219102,
292835,
6116,
317416,
432114,
325620,
415740,
268286,
415744,
333827,
243720,
399372,
153618,
358418,
178215,
325675,
243763,
358455,
325695,
399433,
333902,
104534,
194667,
260206,
432241,
284789,
374913,
374914,
415883,
333968,
153752,
333990,
104633,
260285,
227517,
268479,
374984,
301270,
301271,
334049,
325857,
268515,
383208,
317676,
260337,
260338,
432373,
375040,
309504,
432387,
260355,
375052,
194832,
325904,
391448,
334104,
268570,
178459,
186660,
268581,
334121,
358698,
317738,
260396,
325930,
358707,
432435,
178485,
358710,
14654,
268609,
227655,
383309,
383327,
391521,
366948,
416101,
416103,
383338,
432503,
432511,
211327,
227721,
285074,
252309,
39323,
285083,
317851,
285089,
375211,
334259,
129461,
342454,
358844,
293309,
317889,
326083,
416201,
129484,
154061,
416206,
326093,
432608,
285152,
195044,
391654,
432616,
334315,
375281,
293368,
317949,
334345,
432650,
309770,
342537,
342549,
416288,
342560,
350758,
350759,
358951,
358952,
293420,
219694,
219695,
432694,
244279,
309831,
375369,
375373,
416334,
301647,
416340,
244311,
416353,
260705,
375396,
268901,
244326,
244345,
334473,
375438,
326288,
285348,
293552,
342705,
285362,
383668,
342714,
39616,
383708,
342757,
269036,
432883,
342775,
203511,
383740,
416509,
359166,
162559,
375552,
432894,
228099,
285443,
285450,
383755,
326413,
285467,
326428,
318247,
342827,
391980,
318251,
375610,
301883,
342846,
416577,
416591,
244569,
375644,
252766,
293729,
351078,
342888,
392057,
211835,
269179,
392065,
260995,
400262,
392071,
424842,
236427,
252812,
400271,
392080,
400282,
7070,
211871,
359332,
359333,
293801,
326571,
252848,
326580,
261045,
261046,
326586,
359365,
211913,
326602,
342990,
252878,
433104,
56270,
359380,
433112,
433116,
359391,
187372,
343020,
383980,
203758,
383994,
171009,
384004,
433166,
384015,
433173,
293911,
326684,
252959,
384031,
375848,
318515,
203829,
261191,
375902,
375903,
392288,
253028,
351343,
187505,
138354,
187508,
384120,
302202,
285819,
392317,
343166,
384127,
392320,
285823,
285833,
285834,
318602,
228492,
253074,
326803,
187539,
359574,
285850,
351389,
302239,
253098,
302251,
367791,
367792,
367798,
64699,
294075,
228541,
343230,
367809,
253124,
113863,
351445,
310496,
195809,
253168,
351475,
351489,
367897,
367898,
245018,
130342,
130344,
130347,
261426,
212282,
294210,
359747,
359748,
146763,
114022,
253288,
425327,
425331,
163190,
327030,
384379,
253316,
294278,
384391,
318860,
253339,
253340,
318876,
343457,
245160,
359860,
359861,
343480,
310714,
228796,
228804,
425417,
310731,
327122,
425434,
310747,
310758,
253431,
359931,
187900,
343552,
245249,
228868,
409095,
359949,
294413,
253456,
302613,
253462,
146976,
245290,
245291,
343606,
163385,
425534,
138817,
147011,
147020,
196184,
179800,
343646,
212574,
204386,
155238,
204394,
138862,
310896,
188021,
294517,
286351,
188049,
425624,
229021,
245413,
286387,
384693,
376502,
286392,
302778,
409277,
286400,
319176,
409289,
425682,
286419,
294621,
245471,
155360,
294629,
212721,
163575,
286457,
286463,
319232,
360194,
409355,
155408,
417556,
294699,
204600,
319289,
384826,
409404,
360253,
409416,
376661,
237397,
368471,
425820,
368486,
384871,
409446,
40809,
368489,
425832,
417648,
417658,
360315,
253828,
327556,
311183,
425875,
294806,
294808,
253851,
376733,
319393,
294820,
253868,
188349,
98240,
212947,
212953,
360416,
294887,
253930,
327666,
385011
] |
542d582d1696419448c4612da89617fa423eb988 | 2b58aa1d97d78d6815cec0dfd4651cedec52fb16 | /V-Test/V-Test/AppDelegate.swift | 35ffc16d114646e020556f0d55f332db64befce9 | [] | no_license | lucchettan/v-labs | de6e9944c5652cf5de3d1015505da230a438eb57 | 5c42bd82c213f8546d154d8c33c27707441ad180 | refs/heads/main | 2023-03-31T06:56:28.157514 | 2021-04-06T08:33:34 | 2021-04-06T08:33:34 | 354,795,573 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,339 | swift | //
// AppDelegate.swift
// V-Test
//
// Created by mac on 03/04/2021.
//
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
| [
393222,
393224,
393230,
393250,
344102,
393261,
393266,
213048,
385081,
376889,
393275,
376905,
327756,
254030,
368727,
180313,
368735,
180320,
376931,
368752,
417924,
262283,
377012,
164028,
327871,
180416,
377036,
180431,
377046,
418007,
418010,
377060,
327914,
205036,
393456,
393460,
418043,
336123,
385280,
336128,
262404,
180490,
164106,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
393538,
262472,
344403,
213332,
65880,
262496,
418144,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
262566,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
410128,
393747,
254490,
188958,
385570,
33316,
377383,
197159,
352821,
197177,
418363,
188987,
369223,
385609,
385616,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
328378,
164538,
328386,
352968,
344776,
352971,
418507,
352973,
385742,
385748,
361179,
189153,
369381,
361195,
418553,
344831,
336643,
344835,
344841,
361230,
336659,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
361288,
336711,
328522,
336714,
426841,
254812,
361309,
197468,
361315,
361322,
328573,
377729,
369542,
361360,
222128,
345035,
386003,
345043,
386011,
386018,
386022,
435187,
328714,
361489,
386069,
386073,
336921,
336925,
345118,
377887,
345133,
345138,
386101,
361536,
197707,
189520,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
345267,
386258,
328924,
66782,
222437,
386285,
328941,
386291,
345376,
353570,
345379,
410917,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181654,
230809,
181673,
181681,
337329,
181684,
361917,
181696,
337349,
337365,
271839,
329191,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
394853,
345701,
222830,
370297,
403070,
353919,
403075,
345736,
198280,
403091,
345749,
419483,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
419512,
337592,
419517,
337599,
419527,
419530,
419535,
272081,
419542,
394966,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
337659,
141051,
337668,
362247,
395021,
362255,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
345930,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
354150,
354156,
345964,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
337833,
362413,
337844,
346057,
247759,
346063,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
100453,
329832,
329855,
329867,
329885,
411805,
346272,
362660,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
379134,
411903,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
395566,
248111,
362822,
436555,
190796,
379233,
354673,
248186,
420236,
379278,
272786,
354727,
338352,
330189,
338381,
338386,
256472,
338403,
338409,
248308,
199164,
330252,
199186,
420376,
330267,
354855,
10828,
199249,
346721,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
338660,
338664,
264941,
363251,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
330642,
355218,
412599,
207808,
379848,
396245,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
396328,
347176,
158761,
199728,
396336,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
412764,
339036,
257120,
265320,
248951,
420984,
330889,
347287,
248985,
339097,
44197,
380070,
339112,
249014,
126144,
330958,
330965,
265432,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
347437,
372015,
347441,
372018,
199988,
44342,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
175486,
249214,
175489,
249218,
249227,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
208311,
388542,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
339420,
249308,
339424,
339428,
339434,
249328,
69113,
372228,
208398,
380432,
175635,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
224897,
372353,
216707,
126596,
421508,
224904,
224909,
11918,
159374,
224913,
126610,
339601,
224916,
224919,
126616,
224922,
208538,
224926,
224929,
224932,
224936,
257704,
224942,
257712,
224947,
257716,
257720,
224953,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
257761,
224993,
257764,
224999,
339695,
225012,
257787,
225020,
339710,
257790,
225025,
257794,
339721,
257801,
257804,
225038,
257807,
225043,
372499,
167700,
225048,
257819,
225053,
225058,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
225103,
257871,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
339814,
225127,
274280,
257896,
257901,
225137,
339826,
257908,
225141,
257912,
225148,
257916,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
372738,
405533,
430129,
266294,
266297,
421960,
356439,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
225493,
266453,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
397571,
389380,
61722,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
348502,
250199,
250202,
332125,
250210,
332152,
389502,
250238,
332161,
356740,
332172,
373145,
340379,
373148,
389550,
324030,
266687,
160234,
127471,
340472,
381436,
324094,
266754,
324099,
324102,
324111,
340500,
324117,
324131,
332324,
381481,
356907,
324139,
324142,
356916,
324149,
324155,
348733,
324164,
348743,
381512,
324170,
324173,
324176,
389723,
332380,
381545,
340627,
373398,
184982,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
332493,
357069,
357073,
332511,
332520,
340718,
332533,
348924,
389892,
373510,
389926,
348978,
152370,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
430939,
357211,
357214,
201579,
201582,
349040,
340849,
430965,
381813,
324472,
398201,
340858,
324475,
430972,
340861,
324478,
119674,
324481,
373634,
398211,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
422816,
324513,
398245,
201637,
324524,
340909,
324533,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
381946,
349180,
439294,
431106,
209943,
357410,
250914,
185380,
357418,
209965,
209971,
209975,
209979,
209987,
209990,
209995,
341071,
349267,
250967,
210010,
341091,
210025,
210030,
210036,
210039,
349308,
210044,
349311,
160895,
152703,
210052,
349319,
210055,
210067,
210077,
210080,
251044,
210084,
185511,
210095,
210098,
210107,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
218360,
251128,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
210260,
259421,
365921,
333154,
333162,
234866,
390516,
333175,
357755,
251271,
374160,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
415207,
366056,
366061,
415216,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
153227,
333498,
210631,
333511,
259788,
358099,
153302,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
366387,
210739,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
341851,
350045,
399199,
259938,
399206,
268143,
358255,
399215,
358259,
341876,
333689,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
358371,
350189,
350193,
350202,
333818,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
334011,
260289,
260298,
350410,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
325891,
350467,
350475,
375053,
268559,
350480,
432405,
350486,
325914,
350490,
325917,
350493,
325919,
350498,
194852,
350504,
358700,
391468,
350509,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
416157,
342430,
268701,
375208,
326058,
375216,
334262,
334275,
326084,
358856,
195039,
334304,
334311,
375277,
334321,
350723,
186897,
342545,
334358,
342550,
342554,
334363,
358941,
350761,
252461,
334384,
383536,
358961,
334394,
252482,
219718,
334407,
334420,
350822,
375400,
334465,
334468,
162445,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
260801,
350917,
154317,
391894,
154328,
416473,
64230,
113388,
342766,
375535,
203506,
342776,
391937,
391948,
375568,
326416,
375571,
375574,
162591,
326441,
383793,
326451,
326454,
326460,
260924,
375612,
244540,
326467,
244551,
326473,
326477,
326485,
416597,
326490,
342874,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
326598,
359366,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
359451,
261147,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
384107,
367723,
187502,
343154,
384114,
212094,
351364,
384135,
384139,
384143,
351381,
384160,
384168,
367794,
384181,
367800,
384191,
351423,
384198,
326855,
244937,
253130,
343244,
146642,
359649,
343270,
351466,
351479,
384249,
343306,
261389,
359694,
384269,
253200,
261393,
384275,
245020,
245029,
171302,
351534,
376110,
245040,
384314,
425276,
384323,
212291,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
253303,
154999,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
179802,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
425649,
155322,
425662,
155327,
155351,
155354,
212699,
155363,
245475,
155371,
245483,
409335,
155393,
155403,
155422,
360223,
155438,
155442,
155447,
417595,
155461,
360261,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
262005,
147317,
425845,
262008,
262011,
155516,
155521,
155525,
360326,
376714,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
393169,
384977,
155611,
155619,
253923,
155621,
253926,
327654,
204784,
393203,
360438,
253943,
393206,
393212,
155646
] |
9df0ee1faccfbb1a6afd312f5fa666677a8c3a45 | 8b2d43932bf1b47f810b72ecb9f35a4218102382 | /Pod/Classes/KolodaView/KolodaView.swift | 72d9698f80977ef9f6886dcc8bd83964c2031b28 | [
"MIT"
] | permissive | N1k1tung/Koloda | e056565618b8cfc35598ae55729aac1bb0c2d2d0 | 52428d248bba05cc6ea0a3b4e424aa53fb2fc0b9 | refs/heads/master | 2021-05-15T05:06:43.568749 | 2017-11-28T12:09:08 | 2017-11-28T12:09:08 | 103,647,149 | 0 | 1 | null | 2017-11-28T11:56:32 | 2017-09-15T10:55:33 | Swift | UTF-8 | Swift | false | false | 27,378 | swift | //
// KolodaView.swift
// Koloda
//
// Created by Eugene Andreyev on 4/24/15.
// Copyright (c) 2015 Eugene Andreyev. All rights reserved.
//
import UIKit
import pop
//Default values
private let defaultCountOfVisibleCards = 3
private let defaultBackgroundCardsTopMargin: CGFloat = 14.2
private let defaultBackgroundCardsScalePercent: CGFloat = 0.954
private let defaultBackgroundCardsLeftMargin: CGFloat = 8.0
private let defaultBackgroundCardFrameAnimationDuration: TimeInterval = 0.2
private let defaultAppearanceAnimationDuration: TimeInterval = 0.8
//Opacity values
private let defaultAlphaValueOpaque: CGFloat = 1.0
private let defaultAlphaValueTransparent: CGFloat = 0.0
private let defaultAlphaValueSemiTransparent: CGFloat = 0.7
public protocol KolodaViewDataSource: class {
func kolodaNumberOfCards(_ koloda: KolodaView) -> Int
func kolodaSpeedThatCardShouldDrag(_ koloda: KolodaView) -> DragSpeed
func koloda(_ koloda: KolodaView, viewForCardAt index: Int) -> UIView
func koloda(_ koloda: KolodaView, viewForCardOverlayAt index: Int) -> OverlayView?
}
public extension KolodaViewDataSource {
func koloda(_ koloda: KolodaView, viewForCardOverlayAt index: Int) -> OverlayView? {
return nil
}
}
public protocol KolodaViewDelegate: class {
func koloda(_ koloda: KolodaView, allowedDirectionsForIndex index: Int) -> [SwipeResultDirection]
func koloda(_ koloda: KolodaView, shouldSwipeCardAt index: Int, in direction: SwipeResultDirection) -> Bool
func koloda(_ koloda: KolodaView, didSwipeCardAt index: Int, in direction: SwipeResultDirection)
func kolodaDidRunOutOfCards(_ koloda: KolodaView)
func koloda(_ koloda: KolodaView, didSelectCardAt index: Int)
func kolodaShouldApplyAppearAnimation(_ koloda: KolodaView) -> Bool
func kolodaShouldMoveBackgroundCard(_ koloda: KolodaView) -> Bool
func kolodaShouldTransparentizeNextCard(_ koloda: KolodaView) -> Bool
func koloda(_ koloda: KolodaView, draggedCardWithPercentage finishPercentage: CGFloat, in direction: SwipeResultDirection)
func kolodaDidResetCard(_ koloda: KolodaView)
func kolodaSwipeThresholdRatioMargin(_ koloda: KolodaView) -> CGFloat?
func koloda(_ koloda: KolodaView, didShowCardAt index: Int)
func koloda(_ koloda: KolodaView, shouldDragCardAt index: Int ) -> Bool
}
public extension KolodaViewDelegate {
func koloda(_ koloda: KolodaView, shouldSwipeCardAt index: Int, in direction: SwipeResultDirection) -> Bool { return true }
func koloda(_ koloda: KolodaView, allowedDirectionsForIndex index: Int) -> [SwipeResultDirection] { return [.left, .right] }
func koloda(_ koloda: KolodaView, didSwipeCardAt index: Int, in direction: SwipeResultDirection) {}
func kolodaDidRunOutOfCards(_ koloda: KolodaView) {}
func koloda(_ koloda: KolodaView, didSelectCardAt index: Int) {}
func kolodaShouldApplyAppearAnimation(_ koloda: KolodaView) -> Bool { return true }
func kolodaShouldMoveBackgroundCard(_ koloda: KolodaView) -> Bool { return true }
func kolodaShouldTransparentizeNextCard(_ koloda: KolodaView) -> Bool { return true }
func koloda(_ koloda: KolodaView, draggedCardWithPercentage finishPercentage: CGFloat, in direction: SwipeResultDirection) {}
func kolodaDidResetCard(_ koloda: KolodaView) {}
func kolodaSwipeThresholdRatioMargin(_ koloda: KolodaView) -> CGFloat? { return nil}
func koloda(_ koloda: KolodaView, didShowCardAt index: Int) {}
func koloda(_ koloda: KolodaView, shouldDragCardAt index: Int ) -> Bool { return true }
}
open class KolodaView: UIView, DraggableCardDelegate {
//Opacity values
public var alphaValueOpaque = defaultAlphaValueOpaque
public var alphaValueTransparent = defaultAlphaValueTransparent
public var alphaValueSemiTransparent = defaultAlphaValueSemiTransparent
public var shouldPassthroughTapsWhenNoVisibleCards = false
//Drag animation constants
public var rotationMax: CGFloat?
public var rotationAngle: CGFloat?
public var scaleMin: CGFloat?
public var appearanceAnimationDuration = defaultAppearanceAnimationDuration
public weak var dataSource: KolodaViewDataSource? {
didSet {
setupDeck()
}
}
public weak var delegate: KolodaViewDelegate?
public var animator: KolodaViewAnimator {
set {
self._animator = newValue
}
get {
return self._animator
}
}
private lazy var _animator: KolodaViewAnimator = {
return KolodaViewAnimator(koloda: self)
}()
open var animating = false
internal var shouldTransparentizeNextCard: Bool {
return delegate?.kolodaShouldTransparentizeNextCard(self) ?? true
}
public var isRunOutOfCards: Bool {
return visibleCards.isEmpty
}
private(set) public var currentCardIndex = 0
private(set) public var countOfCards = 0
public var countOfVisibleCards = defaultCountOfVisibleCards
private var visibleCards = [DraggableCardView]()
override open func layoutSubviews() {
super.layoutSubviews()
if !animating {
layoutDeck()
}
}
// MARK: Configurations
private func setupDeck() {
if let dataSource = dataSource {
countOfCards = dataSource.kolodaNumberOfCards(self)
if countOfCards - currentCardIndex > 0 {
let countOfNeededCards = min(countOfVisibleCards, countOfCards - currentCardIndex)
for index in 0..<countOfNeededCards {
let actualIndex = index + currentCardIndex
let nextCardView = createCard(at: actualIndex)
let isTop = index == 0
nextCardView.isUserInteractionEnabled = isTop
nextCardView.alpha = alphaValueOpaque
if shouldTransparentizeNextCard && !isTop {
nextCardView.alpha = alphaValueSemiTransparent
}
visibleCards.append(nextCardView)
isTop ? addSubview(nextCardView) : insertSubview(nextCardView, belowSubview: visibleCards[index - 1])
}
self.delegate?.koloda(self, didShowCardAt: currentCardIndex)
}
}
}
public func layoutDeck() {
for (index, card) in visibleCards.enumerated() {
layoutCard(card, at: index)
}
}
private func layoutCard(_ card: DraggableCardView, at index: Int) {
if index == 0 {
card.layer.transform = CATransform3DIdentity
card.frame = frameForTopCard()
} else {
let cardParameters = backgroundCardParametersForFrame(frameForCard(at: index))
let scale = cardParameters.scale
card.layer.transform = CATransform3DScale(CATransform3DIdentity, scale.width, scale.height, 1.0)
card.frame = cardParameters.frame
}
}
// MARK: Frames
open func frameForCard(at index: Int) -> CGRect {
let bottomOffset: CGFloat = 0
let topOffset = defaultBackgroundCardsTopMargin * CGFloat(countOfVisibleCards - 1)
let scalePercent = defaultBackgroundCardsScalePercent
let width = self.frame.width * pow(scalePercent, CGFloat(index))
let xOffset = (self.frame.width - width) / 2
let height = (self.frame.height - bottomOffset - topOffset) * pow(scalePercent, CGFloat(index))
let multiplier: CGFloat = index > 0 ? 1.0 : 0.0
let prevCardFrame = index > 0 ? frameForCard(at: max(index - 1, 0)) : .zero
let yOffset = topOffset - CGFloat(index) * defaultBackgroundCardsTopMargin * multiplier
let frame = CGRect(x: xOffset, y: yOffset, width: width, height: height)
return frame
}
internal func frameForTopCard() -> CGRect {
return frameForCard(at: 0)
}
internal func backgroundCardParametersForFrame(_ initialFrame: CGRect) -> (frame: CGRect, scale: CGSize) {
var finalFrame = frameForTopCard()
finalFrame.origin = initialFrame.origin
var scale = CGSize.zero
scale.width = initialFrame.width / finalFrame.width
scale.height = initialFrame.height / finalFrame.height
if #available(iOS 11, *) {
return (initialFrame, scale)
} else {
return (finalFrame, scale)
}
}
internal func moveOtherCardsWithPercentage(_ percentage: CGFloat) {
guard visibleCards.count > 1 else {
return
}
for index in 1..<visibleCards.count {
let previousCardFrame = frameForCard(at: index - 1)
var frame = frameForCard(at: index)
let fraction = percentage / 100
let distanceToMoveY: CGFloat = (frame.origin.y - previousCardFrame.origin.y) * fraction
frame.origin.y -= distanceToMoveY
let distanceToMoveX: CGFloat = (previousCardFrame.origin.x - frame.origin.x) * fraction
frame.origin.x += distanceToMoveX
let widthDelta = (previousCardFrame.size.width - frame.size.width) * fraction
let heightDelta = (previousCardFrame.size.height - frame.size.height) * fraction
frame.size.width += widthDelta
frame.size.height += heightDelta
let cardParameters = backgroundCardParametersForFrame(frame)
let scale = cardParameters.scale
let card = visibleCards[index]
card.layer.transform = CATransform3DScale(CATransform3DIdentity, scale.width, scale.height, 1.0)
card.frame = cardParameters.frame
//For fully visible next card, when moving top card
if shouldTransparentizeNextCard {
if index == 1 {
card.alpha = alphaValueSemiTransparent + (alphaValueOpaque - alphaValueSemiTransparent) * fraction
}
}
}
}
// MARK: Animations
private func applyAppearAnimation() {
alpha = 0
isUserInteractionEnabled = false
animating = true
animator.animateAppearance(appearanceAnimationDuration) { [weak self] _ in
self?.isUserInteractionEnabled = true
self?.animating = false
}
}
public func applyAppearAnimationIfNeeded() {
if let shouldApply = delegate?.kolodaShouldApplyAppearAnimation(self), shouldApply == true {
applyAppearAnimation()
}
}
// MARK: DraggableCardDelegate
func card(_ card: DraggableCardView, wasDraggedWithFinishPercentage percentage: CGFloat, inDirection direction: SwipeResultDirection) {
animating = true
if let shouldMove = delegate?.kolodaShouldMoveBackgroundCard(self), shouldMove {
self.moveOtherCardsWithPercentage(percentage)
}
delegate?.koloda(self, draggedCardWithPercentage: percentage, in: direction)
}
func card(_ card: DraggableCardView, shouldSwipeIn direction: SwipeResultDirection) -> Bool {
return delegate?.koloda(self, shouldSwipeCardAt: self.currentCardIndex, in: direction) ?? true
}
func card(cardAllowedDirections card: DraggableCardView) -> [SwipeResultDirection] {
let index = currentCardIndex + visibleCards.index(of: card)!
return delegate?.koloda(self, allowedDirectionsForIndex: index) ?? [.left, .right]
}
func card(_ card: DraggableCardView, wasSwipedIn direction: SwipeResultDirection) {
swipedAction(direction)
}
func card(cardWasReset card: DraggableCardView) {
if visibleCards.count > 1 {
animating = true
animator.resetBackgroundCardsWithCompletion { [weak self] _ in
guard let _self = self else {
return
}
_self.animating = false
for index in 1..<_self.visibleCards.count {
let card = _self.visibleCards[index]
if _self.shouldTransparentizeNextCard {
card.alpha = index == 0 ? _self.alphaValueOpaque : _self.alphaValueSemiTransparent
}
}
}
} else {
animating = false
}
delegate?.kolodaDidResetCard(self)
}
func card(cardWasTapped card: DraggableCardView) {
guard let visibleIndex = visibleCards.index(of: card) else { return }
let index = currentCardIndex + visibleIndex
delegate?.koloda(self, didSelectCardAt: index)
}
func card(cardSwipeThresholdRatioMargin card: DraggableCardView) -> CGFloat? {
return delegate?.kolodaSwipeThresholdRatioMargin(self)
}
func card(cardShouldDrag card: DraggableCardView) -> Bool {
guard let visibleIndex = visibleCards.index(of: card) else { return true}
let index = currentCardIndex + visibleIndex
return delegate?.koloda(self, shouldDragCardAt: index) ?? true
}
func card(cardSwipeSpeed card: DraggableCardView) -> DragSpeed {
return dataSource?.kolodaSpeedThatCardShouldDrag(self) ?? DragSpeed.default
}
// MARK: Private
private func clear() {
currentCardIndex = 0
for card in visibleCards {
card.removeFromSuperview()
}
visibleCards.removeAll(keepingCapacity: true)
}
// MARK: Actions
private func swipedAction(_ direction: SwipeResultDirection) {
animating = true
visibleCards.removeFirst()
currentCardIndex += 1
let shownCardsCount = currentCardIndex + countOfVisibleCards
if shownCardsCount - 1 < countOfCards {
loadNextCard()
}
if !visibleCards.isEmpty {
animateCardsAfterLoadingWithCompletion { [weak self] in
guard let _self = self else {
return
}
_self.visibleCards.last?.isHidden = false
_self.animating = false
_self.delegate?.koloda(_self, didSwipeCardAt: _self.currentCardIndex - 1, in: direction)
_self.delegate?.koloda(_self, didShowCardAt: _self.currentCardIndex)
}
} else {
animating = false
delegate?.koloda(self, didSwipeCardAt: self.currentCardIndex - 1, in: direction)
delegate?.kolodaDidRunOutOfCards(self)
}
}
private func loadNextCard() {
guard dataSource != nil else {
return
}
let cardParameters = backgroundCardParametersForFrame(frameForCard(at: visibleCards.count))
let lastCard = createCard(at: currentCardIndex + countOfVisibleCards - 1, frame: cardParameters.frame)
let scale = cardParameters.scale
lastCard.layer.transform = CATransform3DScale(CATransform3DIdentity, scale.width, scale.height, 1)
lastCard.isHidden = true
lastCard.isUserInteractionEnabled = true
if let card = visibleCards.last {
insertSubview(lastCard, belowSubview: card)
} else {
addSubview(lastCard)
}
visibleCards.append(lastCard)
}
private func animateCardsAfterLoadingWithCompletion(_ completion: (() -> Void)? = nil) {
for (index, currentCard) in visibleCards.enumerated() {
currentCard.removeAnimations()
currentCard.isUserInteractionEnabled = index == 0
let cardParameters = backgroundCardParametersForFrame(frameForCard(at: index))
var animationCompletion: ((Bool) -> Void)? = nil
if index != 0 {
if shouldTransparentizeNextCard {
currentCard.alpha = alphaValueSemiTransparent
}
} else {
animationCompletion = { finished in
completion?()
}
if shouldTransparentizeNextCard {
animator.applyAlphaAnimation(currentCard, alpha: alphaValueOpaque)
} else {
currentCard.alpha = alphaValueOpaque
}
}
animator.applyScaleAnimation(
currentCard,
scale: cardParameters.scale,
frame: cardParameters.frame,
duration: defaultBackgroundCardFrameAnimationDuration,
completion: animationCompletion
)
}
}
public func revertAction() {
guard currentCardIndex > 0 && !animating else {
return
}
if countOfCards - currentCardIndex >= countOfVisibleCards {
if let lastCard = visibleCards.last {
lastCard.removeFromSuperview()
visibleCards.removeLast()
}
}
currentCardIndex -= 1
if dataSource != nil {
let firstCardView = createCard(at: currentCardIndex, frame: frameForTopCard())
if shouldTransparentizeNextCard {
firstCardView.alpha = alphaValueTransparent
}
firstCardView.delegate = self
addSubview(firstCardView)
visibleCards.insert(firstCardView, at: 0)
animating = true
animator.applyReverseAnimation(firstCardView, completion: { [weak self] _ in
guard let _self = self else {
return
}
_self.animating = false
_self.delegate?.koloda(_self, didShowCardAt: _self.currentCardIndex)
})
}
for (index, card) in visibleCards.dropFirst().enumerated() {
if shouldTransparentizeNextCard {
card.alpha = alphaValueSemiTransparent
}
card.isUserInteractionEnabled = false
let cardParameters = backgroundCardParametersForFrame(frameForCard(at: index + 1))
animator.applyScaleAnimation(
card,
scale: cardParameters.scale,
frame: cardParameters.frame,
duration: defaultBackgroundCardFrameAnimationDuration,
completion: nil
)
}
}
private func loadMissingCards(_ missingCardsCount: Int) {
guard missingCardsCount > 0 else { return }
let cardsToAdd = min(missingCardsCount, countOfCards - currentCardIndex)
let startIndex = visibleCards.count
let endIndex = startIndex + cardsToAdd - 1
for index in startIndex...endIndex {
let nextCardView = generateCard(frameForTopCard())
layoutCard(nextCardView, at: index)
nextCardView.alpha = shouldTransparentizeNextCard ? alphaValueSemiTransparent : alphaValueOpaque
visibleCards.append(nextCardView)
configureCard(nextCardView, at: currentCardIndex + index)
if index > 0 {
insertSubview(nextCardView, belowSubview: visibleCards[index - 1])
} else {
insertSubview(nextCardView, at: 0)
}
}
}
private func reconfigureCards() {
if dataSource != nil {
for (index, card) in visibleCards.enumerated() {
let actualIndex = currentCardIndex + index
configureCard(card, at: actualIndex)
}
}
}
private func missingCardsCount() -> Int {
return min(countOfVisibleCards - visibleCards.count, countOfCards - (currentCardIndex + visibleCards.count))
}
// MARK: Public
public func reloadData() {
guard let numberOfCards = dataSource?.kolodaNumberOfCards(self), numberOfCards > 0 else {
clear()
return
}
if currentCardIndex == 0 {
clear()
}
countOfCards = Int(numberOfCards)
if countOfCards - (currentCardIndex + visibleCards.count) > 0 {
if !visibleCards.isEmpty {
let missingCards = missingCardsCount()
loadMissingCards(missingCards)
} else {
setupDeck()
layoutDeck()
applyAppearAnimationIfNeeded()
}
} else {
reconfigureCards()
}
}
public func swipe(_ direction: SwipeResultDirection, force: Bool = false) {
let shouldSwipe = delegate?.koloda(self, shouldSwipeCardAt: currentCardIndex, in: direction) ?? true
guard force || shouldSwipe else {
return
}
let validDirection = delegate?.koloda(self, allowedDirectionsForIndex: currentCardIndex).contains(direction) ?? true
guard validDirection else { return }
if !animating {
if let frontCard = visibleCards.first {
animating = true
if visibleCards.count > 1 {
let nextCard = visibleCards[1]
nextCard.alpha = shouldTransparentizeNextCard ? alphaValueSemiTransparent : alphaValueOpaque
}
frontCard.swipe(direction)
frontCard.delegate = nil
}
}
}
public func resetCurrentCardIndex() {
clear()
reloadData()
}
public func viewForCard(at index: Int) -> UIView? {
if visibleCards.count + currentCardIndex > index && index >= currentCardIndex {
return visibleCards[index - currentCardIndex].contentView
} else {
return nil
}
}
override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
if !shouldPassthroughTapsWhenNoVisibleCards {
return super.point(inside: point, with: event)
}
if super.point(inside: point, with: event) {
return visibleCards.count > 0
}
else {
return false
}
}
// MARK: Cards managing - Insertion
private func insertVisibleCardsWithIndexes(_ visibleIndexes: [Int]) -> [DraggableCardView] {
var insertedCards: [DraggableCardView] = []
visibleIndexes.forEach { insertionIndex in
let card = createCard(at: insertionIndex)
let visibleCardIndex = insertionIndex - currentCardIndex
visibleCards.insert(card, at: visibleCardIndex)
if visibleCardIndex == 0 {
card.isUserInteractionEnabled = true
card.alpha = alphaValueOpaque
insertSubview(card, at: visibleCards.count - 1)
} else {
card.isUserInteractionEnabled = false
card.alpha = shouldTransparentizeNextCard ? alphaValueSemiTransparent : alphaValueOpaque
insertSubview(card, belowSubview: visibleCards[visibleCardIndex - 1])
}
layoutCard(card, at: visibleCardIndex)
insertedCards.append(card)
}
return insertedCards
}
private func removeCards(_ cards: [DraggableCardView]) {
cards.forEach { card in
card.delegate = nil
card.removeFromSuperview()
}
}
private func removeCards(_ cards: [DraggableCardView], animated: Bool) {
visibleCards.removeLast(cards.count)
if animated {
animator.applyRemovalAnimation(
cards,
completion: { _ in
self.removeCards(cards)
}
)
} else {
self.removeCards(cards)
}
}
public func insertCardAtIndexRange(_ indexRange: CountableRange<Int>, animated: Bool = true) {
guard let dataSource = dataSource else {
return
}
let currentItemsCount = countOfCards
countOfCards = dataSource.kolodaNumberOfCards(self)
let visibleIndexes = [Int](indexRange).filter { $0 >= currentCardIndex && $0 < currentCardIndex + countOfVisibleCards }
let insertedCards = insertVisibleCardsWithIndexes(visibleIndexes.sorted())
let cardsToRemove = visibleCards.dropFirst(countOfVisibleCards).map { $0 }
removeCards(cardsToRemove, animated: animated)
animator.resetBackgroundCardsWithCompletion()
if animated {
animating = true
animator.applyInsertionAnimation(
insertedCards,
completion: { _ in
self.animating = false
}
)
}
assert(
currentItemsCount + indexRange.count == countOfCards,
"Cards count after update is not equal to data source count"
)
}
// MARK: Cards managing - Deletion
private func proceedDeletionInRange(_ range: CountableClosedRange<Int>) {
let deletionIndexes = [Int](range)
deletionIndexes.sorted { $0 > $1 }.forEach { deletionIndex in
let visibleCardIndex = deletionIndex - currentCardIndex
let card = visibleCards[visibleCardIndex]
card.delegate = nil
card.swipe(.right)
visibleCards.remove(at: visibleCardIndex)
}
}
public func removeCardInIndexRange(_ indexRange: CountableRange<Int>, animated: Bool) {
guard let dataSource = dataSource else {
return
}
animating = true
let currentItemsCount = countOfCards
countOfCards = dataSource.kolodaNumberOfCards(self)
let visibleIndexes = [Int](indexRange).filter { $0 >= currentCardIndex && $0 < currentCardIndex + countOfVisibleCards }
if !visibleIndexes.isEmpty {
proceedDeletionInRange(visibleIndexes[0]...visibleIndexes[visibleIndexes.count - 1])
}
currentCardIndex -= Array(indexRange).filter { $0 < currentCardIndex }.count
loadMissingCards(missingCardsCount())
layoutDeck()
for (index, card) in visibleCards.enumerated() {
card.alpha = shouldTransparentizeNextCard && index != 0 ? alphaValueSemiTransparent : alphaValueOpaque
card.isUserInteractionEnabled = index == 0
}
animating = false
assert(
currentItemsCount - indexRange.count == countOfCards,
"Cards count after update is not equal to data source count"
)
}
// MARK: Cards managing - Reloading
public func reloadCardsInIndexRange(_ indexRange: CountableRange<Int>) {
guard dataSource != nil else {
return
}
let visibleIndexes = [Int](indexRange).filter { $0 >= currentCardIndex && $0 < currentCardIndex + countOfVisibleCards }
visibleIndexes.forEach { index in
let visibleCardIndex = index - currentCardIndex
if visibleCards.count > visibleCardIndex {
let card = visibleCards[visibleCardIndex]
configureCard(card, at: index)
}
}
}
}
| [
228312,
233921,
205541
] |
7e7badf41c98c3bca42ab70f08ab48cda45ee363 | b950ca85bdab795661154e8014103f6674feb310 | /GRDB/Core/Statement.swift | a5f8ff4971afa4cecdebdcec93e0bc9ba3013b35 | [
"MIT"
] | permissive | openbitapp/GRDB.swift | 5ced4c6fb30c2292e5f3d06f68a74a76fe579f06 | bbc7473cd314f9680470a9b5055af02f3a49dc6b | refs/heads/master | 2020-06-01T18:57:42.359298 | 2020-04-16T12:34:48 | 2020-04-16T12:34:48 | 190,891,478 | 0 | 0 | MIT | 2020-04-16T12:34:50 | 2019-06-08T13:32:37 | Swift | UTF-8 | Swift | false | false | 39,346 | swift | import Foundation
#if canImport(CSQLite) && SWIFT_PACKAGE
import CSQLite
#elseif GRDBCIPHER
import SQLCipher
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
import SQLite3
#endif
/// A raw SQLite statement, suitable for the SQLite C API.
public typealias SQLiteStatement = OpaquePointer
extension CharacterSet {
/// Statements are separated by semicolons and white spaces
static let sqlStatementSeparators = CharacterSet(charactersIn: ";").union(.whitespacesAndNewlines)
}
/// A statement represents an SQL query.
///
/// It is the base class of UpdateStatement that executes *update statements*,
/// and SelectStatement that fetches rows.
public class Statement {
/// The raw SQLite statement, suitable for the SQLite C API.
public let sqliteStatement: SQLiteStatement
/// The SQL query
public var sql: String {
// trim white space and semicolumn for homogeneous output
return String(cString: sqlite3_sql(sqliteStatement))
.trimmingCharacters(in: .sqlStatementSeparators)
}
var isReadonly: Bool {
return sqlite3_stmt_readonly(sqliteStatement) != 0
}
unowned let database: Database
/// Creates a prepared statement. Returns nil if the compiled string is
/// blank or empty.
///
/// - parameter database: A database connection.
/// - parameter statementStart: A pointer to a UTF-8 encoded C string
/// containing SQL.
/// - parameter statementEnd: Upon success, the pointer to the next
/// statement in the C string.
/// - parameter prepFlags: Flags for sqlite3_prepare_v3 (available from
/// SQLite 3.20.0, see http://www.sqlite.org/c3ref/prepare.html)
/// - parameter authorizer: A StatementCompilationAuthorizer
/// - throws: DatabaseError in case of compilation error.
required init?(
database: Database,
statementStart: UnsafePointer<Int8>,
statementEnd: UnsafeMutablePointer<UnsafePointer<Int8>?>,
prepFlags: Int32,
authorizer: StatementCompilationAuthorizer) throws
{
SchedulingWatchdog.preconditionValidQueue(database)
var sqliteStatement: SQLiteStatement? = nil
// sqlite3_prepare_v3 was introduced in SQLite 3.20.0 http://www.sqlite.org/changes.html#version_3_20
#if GRDBCUSTOMSQLITE || GRDBCIPHER
let code = sqlite3_prepare_v3(
database.sqliteConnection, statementStart, -1, UInt32(bitPattern: prepFlags),
&sqliteStatement, statementEnd)
#else
let code: Int32
if #available(iOS 12.0, OSX 10.14, tvOS 12.0, watchOS 5.0, *) {
code = sqlite3_prepare_v3(
database.sqliteConnection, statementStart, -1, UInt32(bitPattern: prepFlags),
&sqliteStatement, statementEnd)
} else {
code = sqlite3_prepare_v2(database.sqliteConnection, statementStart, -1, &sqliteStatement, statementEnd)
}
#endif
guard code == SQLITE_OK else {
throw DatabaseError(
resultCode: code,
message: database.lastErrorMessage,
sql: String(cString: statementStart))
}
guard let statement = sqliteStatement else {
return nil
}
self.database = database
self.sqliteStatement = statement
}
deinit {
sqlite3_finalize(sqliteStatement)
}
final func reset() throws {
SchedulingWatchdog.preconditionValidQueue(database)
let code = sqlite3_reset(sqliteStatement)
guard code == SQLITE_OK else {
throw DatabaseError(resultCode: code, message: database.lastErrorMessage, sql: sql)
}
}
// MARK: Arguments
var argumentsNeedValidation = true
var _arguments = StatementArguments()
lazy var sqliteArgumentCount: Int = {
Int(sqlite3_bind_parameter_count(self.sqliteStatement))
}()
// Returns ["id", nil", "name"] for "INSERT INTO table VALUES (:id, ?, :name)"
fileprivate lazy var sqliteArgumentNames: [String?] = {
(0..<self.sqliteArgumentCount).map {
guard let cString = sqlite3_bind_parameter_name(self.sqliteStatement, Int32($0 + 1)) else {
return nil
}
return String(String(cString: cString).dropFirst()) // Drop initial ":", "@", "$"
}
}()
/// The statement arguments.
public var arguments: StatementArguments {
get { return _arguments }
set {
// Force arguments validity: it is a programmer error to provide
// arguments that do not match the statement.
try! setArguments(newValue)
}
}
/// Throws a DatabaseError of code SQLITE_ERROR if arguments don't fill all
/// statement arguments.
///
/// For example:
///
/// let statement = try db.makeUpdateArgument(sql: """
/// INSERT INTO player (id, name) VALUES (?, ?)
/// """)
///
/// // OK
/// statement.validateArguments([1, "Arthur"])
///
/// // Throws
/// statement.validateArguments([1])
///
/// See also setArguments(_:)
public func validateArguments(_ arguments: StatementArguments) throws {
var arguments = arguments
_ = try arguments.extractBindings(forStatement: self, allowingRemainingValues: false)
}
/// Throws a DatabaseError of code SQLITE_ERROR if arguments don't fill all
/// statement arguments.
///
/// For example:
///
/// let statement = try db.makeUpdateArgument(sql: """
/// INSERT INTO player (id, name) VALUES (?, ?)
/// """)
///
/// // OK
/// statement.validate([1, "Arthur"])
///
/// // Throws
/// statement.validate([1])
///
/// See also setArguments(_:)
@available(*, deprecated, renamed: "validateArguments(_:)")
public func validate(arguments: StatementArguments) throws {
try validateArguments(arguments)
}
/// Set arguments without any validation. Trades safety for performance.
///
/// Only call this method if you are sure input arguments match all expected
/// arguments of the statement.
///
/// For example:
///
/// let statement = try db.makeUpdateArgument(sql: """
/// INSERT INTO player (id, name) VALUES (?, ?)
/// """)
///
/// // OK
/// statement.setUncheckedArguments([1, "Arthur"])
///
/// // OK
/// let arguments: StatementArguments = ... // some untrusted arguments
/// try statement.validateArguments(arguments)
/// statement.setUncheckedArguments(arguments)
///
/// // NOT OK
/// statement.setUncheckedArguments([1])
public func setUncheckedArguments(_ arguments: StatementArguments) {
_arguments = arguments
argumentsNeedValidation = false
try! reset()
clearBindings()
var valuesIterator = arguments.values.makeIterator()
for (index, argumentName) in zip(Int32(1)..., sqliteArgumentNames) {
if let argumentName = argumentName, let value = arguments.namedValues[argumentName] {
bind(value, at: index)
} else if let value = valuesIterator.next() {
bind(value, at: index)
} else {
bind(.null, at: index)
}
}
}
/// Set arguments without any validation. Trades safety for performance.
///
/// Only call this method if you are sure input arguments match all expected
/// arguments of the statement.
///
/// For example:
///
/// let statement = try db.makeUpdateArgument(sql: """
/// INSERT INTO player (id, name) VALUES (?, ?)
/// """)
///
/// // OK
/// statement.unsafeSetArguments([1, "Arthur"])
///
/// // OK
/// let arguments: StatementArguments = ... // some untrusted arguments
/// try statement.validateArguments(arguments)
/// statement.unsafeSetArguments(arguments)
///
/// // NOT OK
/// statement.unsafeSetArguments([1])
///
/// See also setArguments(_:)
@available(*, deprecated, renamed: "setUncheckedArguments(_:)")
public func unsafeSetArguments(_ arguments: StatementArguments) {
setUncheckedArguments(arguments)
}
/// Set the statement arguments, or throws a DatabaseError of code
/// SQLITE_ERROR if arguments don't fill all statement arguments.
///
/// For example:
///
/// let statement = try db.makeUpdateArgument(sql: """
/// INSERT INTO player (id, name) VALUES (?, ?)
/// """)
///
/// // OK
/// try statement.setArguments([1, "Arthur"])
///
/// // Throws an error
/// try statement.setArguments([1])
public func setArguments(_ arguments: StatementArguments) throws {
// Validate
var consumedArguments = arguments
let bindings = try consumedArguments.extractBindings(forStatement: self, allowingRemainingValues: false)
// Apply
_arguments = arguments
argumentsNeedValidation = false
try reset()
clearBindings()
for (index, dbValue) in zip(Int32(1)..., bindings) {
bind(dbValue, at: index)
}
}
// 1-based index
private func bind(_ dbValue: DatabaseValue, at index: Int32) {
let code: Int32
switch dbValue.storage {
case .null:
code = sqlite3_bind_null(sqliteStatement, index)
case .int64(let int64):
code = sqlite3_bind_int64(sqliteStatement, index, int64)
case .double(let double):
code = sqlite3_bind_double(sqliteStatement, index, double)
case .string(let string):
code = sqlite3_bind_text(sqliteStatement, index, string, -1, SQLITE_TRANSIENT)
case .blob(let data):
#if swift(>=5.0)
code = data.withUnsafeBytes {
sqlite3_bind_blob(sqliteStatement, index, $0.baseAddress, Int32($0.count), SQLITE_TRANSIENT)
}
#else
code = data.withUnsafeBytes {
sqlite3_bind_blob(sqliteStatement, index, $0, Int32(data.count), SQLITE_TRANSIENT)
}
#endif
}
// It looks like sqlite3_bind_xxx() functions do not access the file system.
// They should thus succeed, unless a GRDB bug: there is no point throwing any error.
guard code == SQLITE_OK else {
fatalError(DatabaseError(resultCode: code, message: database.lastErrorMessage, sql: sql).description)
}
}
// Don't make this one public unless we keep the arguments property in sync.
private func clearBindings() {
// It looks like sqlite3_clear_bindings() does not access the file system.
// This function call should thus succeed, unless a GRDB bug: there is
// no point throwing any error.
let code = sqlite3_clear_bindings(sqliteStatement)
guard code == SQLITE_OK else {
fatalError(DatabaseError(resultCode: code, message: database.lastErrorMessage, sql: sql).description)
}
}
fileprivate func prepare(withArguments arguments: StatementArguments?) {
// Force arguments validity: it is a programmer error to provide
// arguments that do not match the statement.
if let arguments = arguments {
try! setArguments(arguments)
} else if argumentsNeedValidation {
try! validateArguments(self.arguments)
}
}
}
// MARK: - Statement Preparation
extension Statement {
// Static method instead of an initializer because initializer can't run
// inside `sqlCodeUnits.withUnsafeBufferPointer`.
static func prepare(_ db: Database, sql: String, prepFlags: Int32) throws -> Self {
let authorizer = StatementCompilationAuthorizer()
return try db.withAuthorizer(authorizer) {
try sql.utf8CString.withUnsafeBufferPointer { buffer in
let statementStart = buffer.baseAddress!
var statementEnd: UnsafePointer<Int8>? = nil
guard let statement = try self.init(
database: db,
statementStart: statementStart,
statementEnd: &statementEnd,
prepFlags: prepFlags,
authorizer: authorizer) else
{
throw DatabaseError(
resultCode: .SQLITE_ERROR,
message: "empty statement",
sql: sql)
}
let remainingSQL = String(cString: statementEnd!).trimmingCharacters(in: .sqlStatementSeparators)
guard remainingSQL.isEmpty else {
throw DatabaseError(
resultCode: .SQLITE_MISUSE,
message: """
Multiple statements found. To execute multiple statements, \
use Database.execute(sql:) instead.
""",
sql: sql)
}
return statement
}
}
}
}
// MARK: - SelectStatement
/// A subclass of Statement that fetches database rows.
///
/// You create SelectStatement with the Database.makeSelectStatement() method:
///
/// try dbQueue.read { db in
/// let statement = try db.makeSelectStatement(sql: "SELECT COUNT(*) FROM player WHERE score > ?")
/// let moreThanTwentyCount = try Int.fetchOne(statement, arguments: [20])!
/// let moreThanThirtyCount = try Int.fetchOne(statement, arguments: [30])!
/// }
public final class SelectStatement: Statement {
// Database region is computed during statement compilation, and maybe
// optimized when statement is compiled for a QueryInterfaceRequest, in
// order to perform focused database observation. See
// SQLQueryGenerator.optimizedDatabaseRegion(_:_:)
/// The database region that the statement looks into.
public internal(set) var databaseRegion = DatabaseRegion()
/// Creates a prepared statement. Returns nil if the compiled string is
/// blank or empty.
///
/// - parameter database: A database connection.
/// - parameter statementStart: A pointer to a UTF-8 encoded C string
/// containing SQL.
/// - parameter statementEnd: Upon success, the pointer to the next
/// statement in the C string.
/// - parameter prepFlags: Flags for sqlite3_prepare_v3 (available from
/// SQLite 3.20.0, see http://www.sqlite.org/c3ref/prepare.html)
/// - parameter authorizer: A StatementCompilationAuthorizer
/// - throws: DatabaseError in case of compilation error.
required init?(
database: Database,
statementStart: UnsafePointer<Int8>,
statementEnd: UnsafeMutablePointer<UnsafePointer<Int8>?>,
prepFlags: Int32,
authorizer: StatementCompilationAuthorizer) throws
{
try super.init(
database: database,
statementStart: statementStart,
statementEnd: statementEnd,
prepFlags: prepFlags,
authorizer: authorizer)
GRDBPrecondition(
authorizer.invalidatesDatabaseSchemaCache == false,
"Invalid statement type for query \(String(reflecting: sql)): use UpdateStatement instead.")
GRDBPrecondition(
authorizer.transactionEffect == nil,
"Invalid statement type for query \(String(reflecting: sql)): use UpdateStatement instead.")
self.databaseRegion = authorizer.databaseRegion
}
/// The number of columns in the resulting rows.
public var columnCount: Int {
return Int(sqlite3_column_count(self.sqliteStatement))
}
/// The column names, ordered from left to right.
public lazy var columnNames: [String] = {
let sqliteStatement = self.sqliteStatement
return (0..<Int32(self.columnCount)).map { String(cString: sqlite3_column_name(sqliteStatement, $0)) }
}()
/// Cache for index(ofColumn:). Keys are lowercase.
private lazy var columnIndexes: [String: Int] = {
Dictionary(
self.columnNames.enumerated().map { ($0.element.lowercased(), $0.offset) },
uniquingKeysWith: { (left, _) in left }) // keep leftmost indexes
}()
/// Returns the index of the leftmost column named `name`, in a
/// case-insensitive way.
public func index(ofColumn name: String) -> Int? {
return columnIndexes[name.lowercased()]
}
/// Creates a cursor over the statement which does not produce any
/// value. Each call to the next() cursor method calls the sqlite3_step()
/// C function.
func makeCursor(arguments: StatementArguments? = nil) throws -> StatementCursor {
return try StatementCursor(statement: self, arguments: arguments)
}
/// Utility function for cursors
func reset(withArguments arguments: StatementArguments? = nil) {
prepare(withArguments: arguments)
try! reset()
}
/// Utility function for cursors
@usableFromInline
func didFail(withResultCode resultCode: Int32) throws -> Never {
database.selectStatementDidFail(self)
throw DatabaseError(
resultCode: resultCode,
message: database.lastErrorMessage,
sql: sql,
arguments: arguments)
}
}
/// A cursor that iterates a database statement without producing any value.
/// Each call to the next() cursor method calls the sqlite3_step() C function.
///
/// For example:
///
/// try dbQueue.read { db in
/// let statement = db.makeSelectStatement(sql: "SELECT performSideEffect()")
/// let cursor = statement.makeCursor()
/// try cursor.next()
/// }
final class StatementCursor: Cursor {
let _statement: SelectStatement
let _sqliteStatement: SQLiteStatement
var _done = false
// Use SelectStatement.makeCursor() instead
init(statement: SelectStatement, arguments: StatementArguments? = nil) throws {
_statement = statement
_sqliteStatement = statement.sqliteStatement
_statement.reset(withArguments: arguments)
// Assume cursor is created for iteration
try statement.database.selectStatementWillExecute(statement)
}
deinit {
// Statement reset fails when sqlite3_step has previously failed.
// Just ignore reset error.
try? _statement.reset()
}
/// :nodoc:
@inlinable
func next() throws -> Void? {
if _done {
// make sure this instance never yields a value again, even if the
// statement is reset by another cursor.
return nil
}
switch sqlite3_step(_sqliteStatement) {
case SQLITE_DONE:
_done = true
return nil
case SQLITE_ROW:
return .some(())
case let code:
try _statement.didFail(withResultCode: code)
}
}
}
// MARK: - UpdateStatement
/// A subclass of Statement that executes SQL queries.
///
/// You create UpdateStatement with the Database.makeUpdateStatement() method:
///
/// try dbQueue.inTransaction { db in
/// let statement = try db.makeUpdateStatement(sql: "INSERT INTO player (name) VALUES (?)")
/// try statement.execute(arguments: ["Arthur"])
/// try statement.execute(arguments: ["Barbara"])
/// return .commit
/// }
public final class UpdateStatement: Statement {
enum TransactionEffect {
case beginTransaction
case commitTransaction
case rollbackTransaction
case beginSavepoint(String)
case releaseSavepoint(String)
case rollbackSavepoint(String)
}
/// If true, the database schema cache gets invalidated after this statement
/// is executed.
private(set) var invalidatesDatabaseSchemaCache: Bool = false
private(set) var transactionEffect: TransactionEffect?
private(set) var databaseEventKinds: [DatabaseEventKind] = []
var releasesDatabaseLock: Bool {
guard let transactionEffect = transactionEffect else {
return false
}
switch transactionEffect {
case .commitTransaction, .rollbackTransaction,
.releaseSavepoint, .rollbackSavepoint:
// Not technically correct:
// - ROLLBACK TRANSACTION TO SAVEPOINT does not release any lock
// - RELEASE SAVEPOINT does not always release lock
//
// But both move in the direction of releasing locks :-)
return true
default:
return false
}
}
/// Creates a prepared statement. Returns nil if the compiled string is
/// blank or empty.
///
/// - parameter database: A database connection.
/// - parameter statementStart: A pointer to a UTF-8 encoded C string
/// containing SQL.
/// - parameter statementEnd: Upon success, the pointer to the next
/// statement in the C string.
/// - parameter prepFlags: Flags for sqlite3_prepare_v3 (available from
/// SQLite 3.20.0, see http://www.sqlite.org/c3ref/prepare.html)
/// - parameter authorizer: A StatementCompilationAuthorizer
/// - throws: DatabaseError in case of compilation error.
required init?(
database: Database,
statementStart: UnsafePointer<Int8>,
statementEnd: UnsafeMutablePointer<UnsafePointer<Int8>?>,
prepFlags: Int32,
authorizer: StatementCompilationAuthorizer) throws
{
try super.init(
database: database,
statementStart: statementStart,
statementEnd: statementEnd,
prepFlags: prepFlags,
authorizer: authorizer)
self.invalidatesDatabaseSchemaCache = authorizer.invalidatesDatabaseSchemaCache
self.transactionEffect = authorizer.transactionEffect
self.databaseEventKinds = authorizer.databaseEventKinds
}
/// Executes the SQL query.
///
/// - parameter arguments: Optional statement arguments.
/// - throws: A DatabaseError whenever an SQLite error occurs.
public func execute(arguments: StatementArguments? = nil) throws {
SchedulingWatchdog.preconditionValidQueue(database)
prepare(withArguments: arguments)
try reset()
// Statement does not know how to execute itself, because it does not
// know how to handle its errors, or if truncate optimisation should be
// prevented or not. Database knows.
try database.executeUpdateStatement(self)
}
}
// MARK: - StatementArguments
/// StatementArguments provide values to argument placeholders in raw
/// SQL queries.
///
/// Placeholders can take several forms (see https://www.sqlite.org/lang_expr.html#varparam
/// for more information):
///
/// - `?NNN` (e.g. `?2`): the NNN-th argument (starts at 1)
/// - `?`: the N-th argument, where N is one greater than the largest argument
/// number already assigned
/// - `:AAAA` (e.g. `:name`): named argument
/// - `@AAAA` (e.g. `@name`): named argument
/// - `$AAAA` (e.g. `$name`): named argument
///
/// ## Positional Arguments
///
/// To fill question marks placeholders, feed StatementArguments with an array:
///
/// db.execute(
/// sql: "INSERT ... (?, ?)",
/// arguments: StatementArguments(["Arthur", 41]))
///
/// // Array literals are automatically converted:
/// db.execute(
/// sql: "INSERT ... (?, ?)",
/// arguments: ["Arthur", 41])
///
/// ## Named Arguments
///
/// To fill named arguments, feed StatementArguments with a dictionary:
///
/// db.execute(
/// sql: "INSERT ... (:name, :score)",
/// arguments: StatementArguments(["name": "Arthur", "score": 41]))
///
/// // Dictionary literals are automatically converted:
/// db.execute(
/// sql: "INSERT ... (:name, :score)",
/// arguments: ["name": "Arthur", "score": 41])
///
/// ## Concatenating Arguments
///
/// Several arguments can be concatenated and mixed with the
/// `append(contentsOf:)` method and the `+`, `&+`, `+=` operators:
///
/// var arguments: StatementArguments = ["Arthur"]
/// arguments += [41]
/// db.execute(sql: "INSERT ... (?, ?)", arguments: arguments)
///
/// `+` and `+=` operators consider that overriding named arguments is a
/// programmer error:
///
/// var arguments: StatementArguments = ["name": "Arthur"]
/// arguments += ["name": "Barbara"]
/// // fatal error: already defined statement argument: name
///
/// `&+` and `append(contentsOf:)` allow overriding named arguments:
///
/// var arguments: StatementArguments = ["name": "Arthur"]
/// arguments = arguments &+ ["name": "Barbara"]
/// print(arguments)
/// // Prints ["name": "Barbara"]
///
/// ## Mixed Arguments
///
/// It is possible to mix named and positional arguments. Yet this is usually
/// confusing, and it is best to avoid this practice:
///
/// let sql = "SELECT ?2 AS two, :foo AS foo, ?1 AS one, :foo AS foo2, :bar AS bar"
/// var arguments: StatementArguments = [1, 2, "bar"] + ["foo": "foo"]
/// let row = try Row.fetchOne(db, sql: sql, arguments: arguments)!
/// print(row)
/// // Prints [two:2 foo:"foo" one:1 foo2:"foo" bar:"bar"]
///
/// Mixed arguments exist as a support for requests like the following:
///
/// let players = try Player
/// .filter(sql: "team = :team", arguments: ["team": "Blue"])
/// .filter(sql: "score > ?", arguments: [1000])
/// .fetchAll(db)
public struct StatementArguments: CustomStringConvertible, Equatable,
ExpressibleByArrayLiteral, ExpressibleByDictionaryLiteral
{
private(set) var values: [DatabaseValue] = []
private(set) var namedValues: [String: DatabaseValue] = [:]
public var isEmpty: Bool {
return values.isEmpty && namedValues.isEmpty
}
// MARK: Empty Arguments
/// Creates empty StatementArguments.
public init() {
}
// MARK: Positional Arguments
/// Creates statement arguments from a sequence of optional values.
///
/// let values: [DatabaseValueConvertible?] = ["foo", 1, nil]
/// db.execute(sql: "INSERT ... (?,?,?)", arguments: StatementArguments(values))
///
/// - parameter sequence: A sequence of DatabaseValueConvertible values.
/// - returns: A StatementArguments.
public init<Sequence: Swift.Sequence>(_ sequence: Sequence) where Sequence.Element == DatabaseValueConvertible? {
values = sequence.map { $0?.databaseValue ?? .null }
}
/// Creates statement arguments from a sequence of optional values.
///
/// let values: [String] = ["foo", "bar"]
/// db.execute(sql: "INSERT ... (?,?)", arguments: StatementArguments(values))
///
/// - parameter sequence: A sequence of DatabaseValueConvertible values.
/// - returns: A StatementArguments.
public init<Sequence: Swift.Sequence>(_ sequence: Sequence) where Sequence.Element: DatabaseValueConvertible {
values = sequence.map { $0.databaseValue }
}
/// Creates statement arguments from any array. The result is nil unless all
/// array elements adopt DatabaseValueConvertible.
///
/// - parameter array: An array
/// - returns: A StatementArguments.
public init?(_ array: [Any]) {
var values = [DatabaseValueConvertible?]()
for value in array {
guard let dbValue = DatabaseValue(value: value) else {
return nil
}
values.append(dbValue)
}
self.init(values)
}
// MARK: Named Arguments
/// Creates statement arguments from a sequence of (key, value) dictionary,
/// such as a dictionary.
///
/// let values: [String: DatabaseValueConvertible?] = ["firstName": nil, "lastName": "Miller"]
/// db.execute(sql: "INSERT ... (:firstName, :lastName)", arguments: StatementArguments(values))
///
/// - parameter sequence: A sequence of (key, value) pairs
/// - returns: A StatementArguments.
public init(_ dictionary: [String: DatabaseValueConvertible?]) {
namedValues = dictionary.mapValues { $0?.databaseValue ?? .null }
}
/// Creates statement arguments from a sequence of (key, value) pairs, such
/// as a dictionary.
///
/// let values: [String: DatabaseValueConvertible?] = ["firstName": nil, "lastName": "Miller"]
/// db.execute(sql: "INSERT ... (:firstName, :lastName)", arguments: StatementArguments(values))
///
/// - parameter sequence: A sequence of (key, value) pairs
/// - returns: A StatementArguments.
public init<Sequence>(_ sequence: Sequence)
where Sequence: Swift.Sequence, Sequence.Element == (String, DatabaseValueConvertible?)
{
namedValues = Dictionary(uniqueKeysWithValues: sequence.map { ($0.0, $0.1?.databaseValue ?? .null) })
}
/// Creates statement arguments from [AnyHashable: Any].
///
/// The result is nil unless all dictionary keys are strings, and values
/// adopt DatabaseValueConvertible.
///
/// - parameter dictionary: A dictionary.
/// - returns: A StatementArguments.
public init?(_ dictionary: [AnyHashable: Any]) {
var initDictionary = [String: DatabaseValueConvertible?]()
for (key, value) in dictionary {
guard let columnName = key as? String else {
return nil
}
guard let dbValue = DatabaseValue(value: value) else {
return nil
}
initDictionary[columnName] = dbValue
}
self.init(initDictionary)
}
// MARK: Adding arguments
/// Extends statement arguments with other arguments.
///
/// Positional arguments (provided as arrays) are concatenated:
///
/// var arguments: StatementArguments = [1]
/// arguments.append(contentsOf: [2, 3])
/// print(arguments)
/// // Prints [1, 2, 3]
///
/// Named arguments (provided as dictionaries) are updated:
///
/// var arguments: StatementArguments = ["foo": 1]
/// arguments.append(contentsOf: ["bar": 2])
/// print(arguments)
/// // Prints ["foo": 1, "bar": 2]
///
/// Arguments that were replaced, if any, are returned:
///
/// var arguments: StatementArguments = ["foo": 1, "bar": 2]
/// let replacedValues = arguments.append(contentsOf: ["foo": 3])
/// print(arguments)
/// // Prints ["foo": 3, "bar": 2]
/// print(replacedValues)
/// // Prints ["foo": 1]
///
/// You can mix named and positional arguments (see documentation of
/// the StatementArguments type for more information about mixed arguments):
///
/// var arguments: StatementArguments = ["foo": 1]
/// arguments.append(contentsOf: [2, 3])
/// print(arguments)
/// // Prints ["foo": 1, 2, 3]
public mutating func append(contentsOf arguments: StatementArguments) -> [String: DatabaseValue] {
var replacedValues: [String: DatabaseValue] = [:]
values.append(contentsOf: arguments.values)
for (name, value) in arguments.namedValues {
if let replacedValue = namedValues.updateValue(value, forKey: name) {
replacedValues[name] = replacedValue
}
}
return replacedValues
}
/// Creates a new StatementArguments by extending the left-hand size
/// arguments with the right-hand side arguments.
///
/// Positional arguments (provided as arrays) are concatenated:
///
/// let arguments: StatementArguments = [1] + [2, 3]
/// print(arguments)
/// // Prints [1, 2, 3]
///
/// Named arguments (provided as dictionaries) are updated:
///
/// let arguments: StatementArguments = ["foo": 1] + ["bar": 2]
/// print(arguments)
/// // Prints ["foo": 1, "bar": 2]
///
/// You can mix named and positional arguments (see documentation of
/// the StatementArguments type for more information about mixed arguments):
///
/// let arguments: StatementArguments = ["foo": 1] + [2, 3]
/// print(arguments)
/// // Prints ["foo": 1, 2, 3]
///
/// If the arguments on the right-hand side has named parameters that are
/// already defined on the left, a fatal error is raised:
///
/// let arguments: StatementArguments = ["foo": 1] + ["foo": 2]
/// // fatal error: already defined statement argument: foo
///
/// This fatal error can be avoided with the &+ operator, or the
/// append(contentsOf:) method.
public static func + (lhs: StatementArguments, rhs: StatementArguments) -> StatementArguments {
var lhs = lhs
lhs += rhs
return lhs
}
/// Creates a new StatementArguments by extending the left-hand size
/// arguments with the right-hand side arguments.
///
/// Positional arguments (provided as arrays) are concatenated:
///
/// let arguments: StatementArguments = [1] &+ [2, 3]
/// print(arguments)
/// // Prints [1, 2, 3]
///
/// Named arguments (provided as dictionaries) are updated:
///
/// let arguments: StatementArguments = ["foo": 1] &+ ["bar": 2]
/// print(arguments)
/// // Prints ["foo": 1, "bar": 2]
///
/// You can mix named and positional arguments (see documentation of
/// the StatementArguments type for more information about mixed arguments):
///
/// let arguments: StatementArguments = ["foo": 1] &+ [2, 3]
/// print(arguments)
/// // Prints ["foo": 1, 2, 3]
///
/// If a named arguments is defined in both arguments, the right-hand
/// side wins:
///
/// let arguments: StatementArguments = ["foo": 1] &+ ["foo": 2]
/// print(arguments)
/// // Prints ["foo": 2]
public static func &+ (lhs: StatementArguments, rhs: StatementArguments) -> StatementArguments {
var lhs = lhs
_ = lhs.append(contentsOf: rhs)
return lhs
}
/// Extends the left-hand size arguments with the right-hand side arguments.
///
/// Positional arguments (provided as arrays) are concatenated:
///
/// var arguments: StatementArguments = [1]
/// arguments += [2, 3]
/// print(arguments)
/// // Prints [1, 2, 3]
///
/// Named arguments (provided as dictionaries) are updated:
///
/// var arguments: StatementArguments = ["foo": 1]
/// arguments += ["bar": 2]
/// print(arguments)
/// // Prints ["foo": 1, "bar": 2]
///
/// You can mix named and positional arguments (see documentation of
/// the StatementArguments type for more information about mixed arguments):
///
/// var arguments: StatementArguments = ["foo": 1]
/// arguments.append(contentsOf: [2, 3])
/// print(arguments)
/// // Prints ["foo": 1, 2, 3]
///
/// If the arguments on the right-hand side has named parameters that are
/// already defined on the left, a fatal error is raised:
///
/// var arguments: StatementArguments = ["foo": 1]
/// arguments += ["foo": 2]
/// // fatal error: already defined statement argument: foo
///
/// This fatal error can be avoided with the &+ operator, or the
/// append(contentsOf:) method.
public static func += (lhs: inout StatementArguments, rhs: StatementArguments) {
let replacedValues = lhs.append(contentsOf: rhs)
GRDBPrecondition(
replacedValues.isEmpty,
"already defined statement argument: \(replacedValues.keys.joined(separator: ", "))")
}
// MARK: Not Public
mutating func extractBindings(
forStatement statement: Statement,
allowingRemainingValues: Bool)
throws -> [DatabaseValue]
{
let initialValuesCount = values.count
let bindings = try statement.sqliteArgumentNames.map { argumentName -> DatabaseValue in
if let argumentName = argumentName {
if let dbValue = namedValues[argumentName] {
return dbValue
} else if values.isEmpty {
throw DatabaseError(
resultCode: .SQLITE_MISUSE,
message: "missing statement argument: \(argumentName)",
sql: statement.sql)
} else {
return values.removeFirst()
}
} else {
if values.isEmpty {
throw DatabaseError(
resultCode: .SQLITE_MISUSE,
message: "wrong number of statement arguments: \(initialValuesCount)",
sql: statement.sql)
} else {
return values.removeFirst()
}
}
}
if !allowingRemainingValues && !values.isEmpty {
throw DatabaseError(
resultCode: .SQLITE_MISUSE,
message: "wrong number of statement arguments: \(initialValuesCount)",
sql: statement.sql)
}
return bindings
}
}
// ExpressibleByArrayLiteral
extension StatementArguments {
/// Returns a StatementArguments from an array literal:
///
/// let arguments: StatementArguments = ["Arthur", 41]
/// try db.execute(
/// sql: "INSERT INTO player (name, score) VALUES (?, ?)"
/// arguments: arguments)
public init(arrayLiteral elements: DatabaseValueConvertible?...) {
self.init(elements)
}
}
// ExpressibleByDictionaryLiteral
extension StatementArguments {
/// Returns a StatementArguments from a dictionary literal:
///
/// let arguments: StatementArguments = ["name": "Arthur", "score": 41]
/// try db.execute(
/// sql: "INSERT INTO player (name, score) VALUES (:name, :score)"
/// arguments: arguments)
public init(dictionaryLiteral elements: (String, DatabaseValueConvertible?)...) {
self.init(elements)
}
}
// CustomStringConvertible
extension StatementArguments {
/// :nodoc:
public var description: String {
let valuesDescriptions = values.map { $0.description }
let namedValuesDescriptions = namedValues.map { (key, value) -> String in
"\(String(reflecting: key)): \(value)"
}
return "[" + (namedValuesDescriptions + valuesDescriptions).joined(separator: ", ") + "]"
}
}
| [
198017,
125350,
251728,
240179,
213595
] |
f083a08ed3fd30b56b64f6727463e9a476be7542 | 42cae476ae2455174db87ee71f096226560b2c95 | /gameInputRPG.playground/Pages/firstObject.xcplaygroundpage/Contents.swift | ad1e8c03bb127111a891fc1721a3a8ad7c206cc7 | [] | no_license | kamontat/Swift-Playground | d03b6e859366876b7db4398b83cae2b82cfa03ba | d6b2e36d2aad2992051397e2400f91f8e5aa8f70 | refs/heads/master | 2021-08-14T08:58:38.583307 | 2017-11-15T06:49:36 | 2017-11-15T06:49:36 | 110,795,326 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,209 | swift | //: the known issue
//: * LUCK CAN't more than 100
//: * change some condition of random
//: * change some condition about special weapon/wearable
//: * take damage back if the defense more than attack
import UIKit
public class Player {
/**
* tuple of status
* - **name**: name of this player
* - **HP**: health point of this player
* - **Attack**: attack point
* - **Defense**: defense point
* - **Luck**: the luck that effect the drop item *(MAX: 100)*
* - **weapon**: the weapon that player wear *(MAX: HP / 2)*
* - **wearable**: the wearable that player wear *(MAX: HP / 2)*
* - **statusLive**: 0 is mean alive; otherwise, dead
*/
var status: (name: String, HP: Int, Attack: Int, Defense: Int, Luck: Int, weapon: Int, wearable: Int, statusLive: Int);
var stockWeapons: [Int];
var stockWearables: [Int];
init(name: String, HP: Int, percent: Int) {
self.status = (name: name, HP: HP, Attack: randomPercent(percent), Defense: randomPercent(percent), Luck: randomPercent(100), weapon: 1, wearable: 1, statusLive: 0);
// wear weapon/wearable
self.status.Attack += self.status.weapon;
self.status.Defense += self.status.wearable;
// create emply array of int
self.stockWeapons = [Int]();
self.stockWearables = [Int]();
}
/**
* when player attack other is valid
* defect and decrease this.HP
*/
func attack(otherStatus: Player) -> Bool {
let damage = status.Attack - otherStatus.status.Defense;
if (damage > 0) {
otherStatus.status.HP -= damage;
if (otherStatus.status.HP < 0) {
otherStatus.status.HP = 0;
otherStatus.status.statusLive = 1;
print("\nNo More HP\n");
return false;
}
return true;
} else {
print("Attack Fail");
return false;
}
}
/**
* when player pick some of **weapon**
*/
func pickWeapon() {
var weaponsList = assignWeaponsList(Double(status.HP) * (Double(status.Luck) / 100.0));
let index = randomPercent(weaponsList.count) - 1;
if (weaponsList[index] == 1) {
status.Luck += Int(Double(status.Luck) * 1.0 / 15.0);
if (status.Luck > 100) {
status.Luck = 100;
}
print("----------------------");
print("\(status.name) Special WEAPON BE PICK");
print("----------------------");
} else {
stockWeapons.append(weaponsList[index]);
}
}
/**
* when player pick some of **wearable**
*/
func pickWearable() {
var wearablesList = assignWearablesList(Double(status.HP) * (Double(status.Luck) / 100.0));
let index = randomPercent(wearablesList.count) - 1;
if (wearablesList[index] == 1) {
status.Luck += Int(Double(status.Luck) * 1.0 / 10.0);
if (status.Luck > 100) {
status.Luck = 100;
}
print("------------------------");
print("\(status.name) Special WEARABLE BE PICK");
print("------------------------");
} else {
stockWearables.append(wearablesList[index]);
}
}
/**
* when player want to wear some **weapon**
*/
func wearWeapon(index: Int) -> Bool {
// check weapon valid or not
if (status.weapon == 0) {
status.weapon = stockWeapons[index];
status.Attack += stockWeapons.removeAtIndex(index);
return true;
} else {
print("-----------------------------------");
print("It's only have some weapon in there");
print("-----------------------------------");
return false;
}
}
/**
* when player want to wear some **wearable**
*/
func wearWearable(index: Int) -> Bool {
// check weapon valid or not
if (status.wearable == 0) {
status.wearable = stockWearables[index];
status.Defense += stockWearables.removeAtIndex(index);
return true;
} else {
print("-------------------------------------");
print("It's only have some wearable in there");
print("-------------------------------------");
return false;
}
}
func unWearWeapon() {
// check weapon available or not
if (status.weapon != 0) {
status.Attack -= status.weapon;
stockWeapons.append(status.weapon);
status.weapon = 0;
} else {
print("---------");
print("No weapon");
print("---------");
}
}
func unWearWearable() {
// check weapon available or not
if (status.wearable != 0) {
status.Defense -= status.wearable;
stockWearables.append(status.wearable);
status.wearable = 0;
} else {
print("-----------");
print("No wearable");
print("-----------");
}
}
/**
* **Debug** function that will print out all of information in this player
*/
func printStatus() {
if (status.statusLive == 0) {
print("\n\n\"LIVE!\"");
} else {
print("\n\n\"DEAD!\"");
}
print("\"\(status.name)\" HP: \(status.HP), Attack: \(status.Attack), defense: \(status.Defense). LUCK: \(status.Luck)");
print("WEAR: 1) weapon: \(status.weapon)\n 2) wearable: \(status.wearable)");
print("List: 1) weapon:");
for num in stockWeapons {
print(" \(num)");
}
print(" 2) wearable:");
for num in stockWearables {
print(" \(num)");
}
}
}
/**
* random number by using percent that input **(Double)**
*/
public func randomPercent(percent: Double) -> Int {
return Int(ceil(drand48() * percent));
}
/**
* random number by using percent that input **(Int)**
*/
public func randomPercent(percent: Int) -> Int {
return Int(ceil(drand48() * Double(percent)));
}
/**
* random number by using argument with in length
*/
public func randomNearly(num: Int, length: Double) -> Int {
var newNum = num - Int(length / 2);
newNum = num + randomPercent(length);
return newNum;
}
/**
* assign weapon to get pick
*/
public func assignWeaponsList(hpLeft: Double) -> [Int] {
var weaponsList = [Int]();
for (var i = 1; i <= Int(round(hpLeft)); i += randomPercent(5)) {
weaponsList.append(i);
}
return weaponsList;
}
/**
* assign weapon to get pick
*/
public func assignWearablesList(hpLeft: Double) -> [Int] {
var wearablesList = [Int]();
for (var i = 1; i <= Int(round(hpLeft)); i += randomPercent(5)) {
wearablesList.append(i);
}
return wearablesList;
}
var kamontat = Player(name: "Kamontat", HP: 1000, percent: 200);
var Bitoey = Player(name: "Soraya", HP: 2500 , percent: 250);
kamontat.printStatus();
Bitoey.printStatus();
| [
-1
] |
6762a6e2afe4d9893670ff31161ffe049ac68980 | 20c82700f33091b40c8facebd7c46739dce34d82 | /FoodMate/Meals/NewMealView.swift | 1fe2ad856ee2fe5e550cfb362700685f0db8306f | [
"MIT"
] | permissive | nanothread/FoodMate | c352fedb82bb160964a9c050dc560461b8ca2480 | 7125baff4cc87cc9b75592bdac9076fa446d9826 | refs/heads/main | 2023-01-07T10:06:58.893203 | 2020-10-26T17:30:27 | 2020-10-26T17:32:39 | 303,095,892 | 0 | 0 | MIT | 2020-10-17T16:25:37 | 2020-10-11T10:33:37 | Swift | UTF-8 | Swift | false | false | 6,120 | swift | //
// NewMealView.swift
// FoodMate
//
// Created by Andrew Glen on 03/10/2020.
//
import SwiftUI
import CoreData
/// An interface for the user to create and add ingredients to a new meal.
struct NewMealView: View {
var space: MealSpace
@EnvironmentObject private var searchProvider: SearchProvider
@State private var name: String = ""
@State private var ingredient: String = ""
@State private var ingredientSearchResults = [AbstractIngredient]()
@State private var mealSearchResults = [Meal]()
@State private var ingredients = [AbstractIngredient]()
@Environment(\.presentationMode) private var presentation
@Environment(\.managedObjectContext) private var context
@StateObject private var notificationManager = NotificationManager()
@StateObject private var store = CancellableStore()
func saveMeal() {
let meal = Meal(context: context, name: name, space: space, ingredients: Set(ingredients))
do {
try context.save()
attemptToScheduleNotificationsFor(meal: meal) {
presentation.wrappedValue.dismiss()
}
} catch {
Logger.coreData.error("NewMealView failed to save meal: \(error.localizedDescription)")
}
}
func saveDuplicateOf(meal: Meal) {
_ = Meal(context: context, name: meal.name, space: space, ingredients: meal.ingredients)
do {
try context.save()
attemptToScheduleNotificationsFor(meal: meal) {
presentation.wrappedValue.dismiss()
}
} catch {
Logger.coreData.error("NewMealView failed to save meal: \(error.localizedDescription)")
}
}
func attemptToScheduleNotificationsFor(meal: Meal, completion: @escaping () -> Void) {
if let publisher = notificationManager.considerSettingNotification(for: meal) {
publisher
.receive(on: DispatchQueue.main)
.sink { result in
if case .failure(let error) = result {
Logger.notifications.error("Failed to schedule notifications: \(error.localizedDescription)")
} else {
Logger.notifications.info("Scheduled notifications successfully")
}
completion()
} receiveValue: { _ in }
.store(in: &store.cancellables)
} else {
completion()
}
}
func addIngredient(named name: Binding<String>) {
defer {
name.wrappedValue = ""
}
let trimmedName = name.wrappedValue.trimmingCharacters(in: .whitespaces)
guard !trimmedName.isEmpty else {
return
}
ingredients.append(searchProvider.findOrMakeAbstractIngredient(named: trimmedName))
}
var body: some View {
NavigationView {
Form {
Section {
TextField("Name", text: $name)
.onChange(of: name) { name in
mealSearchResults = searchProvider.getMealsWithDistinctNames(matching: name)
}
ForEach(mealSearchResults) { meal in
Button {
saveDuplicateOf(meal: meal)
} label: {
Label(meal.name, systemImage: "magnifyingglass")
}
}
NavigationLink(destination: MealSuggestionsView(context: context, addMeal: saveDuplicateOf)) {
Text("Suggestions")
}
.foregroundColor(.accentColor)
}
Section(header: Text("Ingredients")) {
TextField("Search", text: $ingredient)
.onChange(of: ingredient) { ingredient in
ingredientSearchResults = searchProvider.getAbstractIngredients(matching: ingredient)
}
ForEach(ingredientSearchResults) { ingredient in
Button {
ingredients.insert(ingredient, at: 0)
self.ingredient = ""
} label: {
Label(ingredient.name, systemImage: "magnifyingglass")
}
}
if !ingredient.trimmingCharacters(in: .whitespaces).isEmpty {
Button {
addIngredient(named: $ingredient)
} label: {
Label("Add \(ingredient.trimmingCharacters(in: .whitespaces).firstUppercased)", systemImage: "plus")
}
}
ForEach(ingredients) { ingredient in
Text(ingredient.name)
}
.onDelete { ingredients.remove(atOffsets: $0) }
}
}
.navigationTitle("New Meal")
.navigationBarTitleDisplayMode(.inline)
.navigationBarItems(
leading:
Button {
presentation.wrappedValue.dismiss()
} label: {
Text("Cancel")
},
trailing:
Button {
saveMeal()
} label: {
Text("Done")
}
.disabled(
ingredients.isEmpty || name.trimmingCharacters(in: .whitespaces).isEmpty
)
)
}
}
}
struct NewMealView_Previews: PreviewProvider {
static var previews: some View {
NewMealView(space: MealSpace(day: Date(), slot: .lunch))
}
}
| [
-1
] |
82b933ff89675468ec9a8349a7cd37dea8ad7f80 | 930c4d8dc3c026c9ba9d1ab354bde7c4d2f3f4b4 | /Tarea1/Tarea1/SceneDelegate.swift | b88f07944d6ee821e639ef615d6ff8fba0f77523 | [] | no_license | Loptt/ios-projects | 2eab038dfbd9d827c156d230199db2b73c802a12 | 6196c894e2e420228dcc1f7a02c4cf7bcd6d9e57 | refs/heads/master | 2021-02-13T23:35:02.417226 | 2020-04-30T16:13:47 | 2020-04-30T16:13:47 | 244,745,799 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,335 | swift | //
// SceneDelegate.swift
// Tarea1
//
// Created by Alumno on 18/02/20.
// Copyright © 2020 alumno. All rights reserved.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
| [
393221,
163849,
393228,
393231,
393251,
344103,
393260,
393269,
213049,
376890,
385082,
16444,
393277,
376906,
327757,
254032,
286804,
368728,
254045,
368736,
180322,
376932,
286833,
286845,
286851,
417925,
262284,
360598,
286880,
286889,
377003,
377013,
164029,
327872,
180418,
377030,
377037,
180432,
377047,
418008,
385243,
418012,
377063,
327915,
205037,
393457,
393461,
393466,
418044,
336124,
385281,
336129,
262405,
180491,
164107,
336140,
368913,
262417,
262423,
377118,
377121,
262437,
336181,
262455,
393539,
262473,
344404,
213333,
262497,
418145,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
336326,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
98819,
164362,
328204,
328207,
410129,
393748,
377372,
188959,
385571,
197160,
377384,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
385610,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
377473,
336513,
336517,
344710,
385671,
148106,
377485,
352919,
98969,
336549,
344745,
361130,
336556,
385714,
434868,
164535,
336568,
164539,
328379,
328387,
352969,
385743,
385749,
189154,
369382,
361196,
344832,
336644,
344837,
344843,
328462,
361231,
394002,
336660,
418581,
418586,
434971,
369436,
262943,
369439,
418591,
418594,
336676,
418600,
418606,
271154,
328498,
369464,
361274,
328516,
336709,
328520,
361289,
336712,
328523,
336715,
361300,
213848,
426842,
361307,
197469,
361310,
254813,
361318,
344936,
361323,
361335,
328574,
369544,
222129,
345036,
115661,
386004,
345046,
386012,
386019,
328690,
435188,
328703,
418822,
328710,
328715,
377867,
361490,
386070,
271382,
336922,
345119,
377888,
328747,
345134,
345139,
361525,
361537,
377931,
197708,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
410746,
361594,
214150,
345224,
386187,
337048,
345247,
361645,
337072,
345268,
337076,
402615,
361657,
402636,
328925,
165086,
222438,
328942,
386286,
386292,
206084,
115973,
345377,
353572,
345380,
345383,
337207,
345400,
378170,
369979,
337224,
337230,
337235,
263509,
353634,
337252,
402792,
345449,
99692,
271731,
378232,
337278,
271746,
181639,
181644,
181650,
181655,
230810,
181671,
181674,
181679,
181682,
337330,
181687,
370105,
181691,
181697,
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,
353868,
419404,
419408,
214611,
419412,
403040,
345702,
222831,
370298,
353920,
403076,
345737,
198282,
403085,
403092,
345750,
419484,
345758,
345763,
419492,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
419518,
403139,
337607,
419528,
419531,
419536,
272083,
394967,
419545,
345819,
419548,
181982,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
141052,
337661,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
116512,
378664,
354107,
354112,
247618,
370504,
329545,
345932,
354124,
370510,
247639,
337751,
370520,
313181,
354143,
345965,
354157,
345968,
345971,
345975,
182136,
403321,
1914,
354173,
247692,
395148,
337809,
247701,
329625,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
247760,
346064,
346069,
329699,
354275,
190440,
247790,
354314,
346140,
337980,
436290,
378956,
395340,
436307,
338005,
329816,
100454,
329833,
329853,
329857,
329868,
329886,
411806,
346273,
362661,
100525,
379067,
387261,
256193,
395467,
411862,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
436474,
321787,
379135,
411905,
411917,
43279,
379154,
395539,
387350,
338201,
387353,
182559,
338212,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
182642,
321911,
420237,
379279,
354728,
338353,
338363,
338382,
272849,
248279,
256474,
182755,
338404,
338411,
330225,
248309,
199165,
248332,
330254,
199182,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
191085,
338544,
191093,
346743,
330384,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
264919,
256735,
338661,
338665,
264942,
330479,
363252,
338680,
207620,
264965,
191240,
338701,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
330612,
330643,
412600,
207809,
379849,
396246,
330711,
248794,
248799,
437219,
257009,
265208,
330750,
199681,
338951,
330761,
330769,
330775,
248863,
158759,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
248905,
330827,
330830,
248915,
183384,
412765,
339037,
257121,
322660,
265321,
330869,
248952,
420985,
330886,
330890,
347288,
248986,
44199,
380071,
339118,
339133,
126148,
322763,
330959,
330966,
265433,
265438,
388320,
363757,
339199,
175376,
175397,
208167,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
437576,
437584,
331089,
396634,
175451,
437596,
429408,
175458,
208228,
175461,
175464,
265581,
331124,
175478,
249210,
175484,
249215,
175487,
249219,
175491,
249225,
249228,
249235,
175514,
175517,
396703,
175523,
355749,
396723,
380353,
216518,
339401,
380364,
339406,
339414,
413143,
249303,
339418,
339421,
249310,
249313,
339425,
339429,
339435,
249329,
69114,
372229,
339464,
249355,
208399,
380433,
175637,
134689,
339504,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
339572,
224885,
224888,
224891,
224895,
372354,
421509,
126597,
224905,
11919,
224911,
224914,
126611,
224917,
224920,
126618,
208539,
224923,
224927,
224930,
224933,
257705,
224939,
224943,
257713,
257717,
224949,
257721,
224954,
257725,
224960,
257733,
224966,
224970,
257740,
224976,
257745,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
339696,
225013,
257788,
225021,
339711,
257791,
225027,
257796,
257802,
339722,
257805,
225039,
257808,
249617,
372500,
167701,
225044,
257815,
225049,
257820,
225054,
184096,
257825,
225059,
339748,
225068,
257837,
413485,
225071,
225074,
257843,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
323404,
257869,
257872,
225105,
339795,
397140,
225109,
257881,
225113,
257884,
257887,
225120,
257891,
413539,
225128,
257897,
225138,
339827,
257909,
372598,
225142,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
184245,
372698,
372704,
372707,
356336,
380919,
393215,
372739,
405534,
266295,
266298,
217158,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
225439,
135328,
192674,
225442,
438434,
225445,
438438,
225448,
438441,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
430275,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
356580,
217319,
225511,
225515,
225519,
381177,
389381,
356631,
356638,
356641,
356644,
356647,
266537,
356650,
389417,
356656,
332081,
307507,
340276,
356662,
397623,
332091,
225599,
332098,
201030,
348489,
332107,
151884,
332118,
430422,
348503,
250201,
250203,
332130,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
250239,
332162,
348548,
356741,
332175,
160152,
373146,
373149,
70048,
356783,
324032,
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,
348745,
381513,
324171,
324174,
324177,
389724,
332381,
373344,
340580,
348777,
381546,
119432,
340628,
184983,
373399,
340639,
258723,
332460,
389806,
332464,
332473,
381626,
332484,
332487,
373450,
357070,
332494,
357074,
332512,
332521,
340724,
332534,
373499,
348926,
389927,
348979,
152371,
398141,
127815,
357202,
389971,
357208,
136024,
389979,
357212,
430940,
357215,
201580,
201583,
349041,
340850,
201589,
381815,
430967,
324473,
398202,
119675,
324476,
340859,
430973,
324479,
340863,
324482,
324485,
324488,
381834,
185226,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
373672,
324525,
5040,
111539,
324534,
5047,
324539,
324542,
398280,
349129,
340940,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
381947,
201724,
349181,
431100,
431107,
209944,
209948,
250915,
250917,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
209996,
431180,
349268,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
160896,
152704,
349313,
210053,
210056,
349320,
259217,
373905,
210068,
210072,
210078,
210081,
210085,
210089,
210096,
210100,
324792,
210108,
210116,
210128,
333010,
210132,
333016,
210139,
210144,
218355,
251123,
218361,
275709,
275713,
242947,
275717,
275723,
333075,
349460,
333079,
251161,
349486,
349492,
415034,
251211,
210261,
365912,
259423,
374113,
251236,
374118,
234867,
390518,
357756,
374161,
112021,
349591,
333222,
210357,
259516,
415168,
366035,
415187,
366039,
415192,
415194,
415197,
415200,
333285,
415208,
366057,
366064,
415217,
415225,
423424,
415258,
415264,
366118,
415271,
349739,
144940,
415279,
415282,
349748,
415286,
210488,
415291,
415295,
333387,
333396,
333400,
333415,
423529,
423533,
333423,
210547,
415354,
333440,
267910,
333472,
333512,
259789,
358100,
366301,
333535,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
210707,
399129,
333593,
333595,
358192,
366384,
210740,
366388,
358201,
399166,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
358235,
341852,
350046,
399200,
399208,
358256,
268144,
358260,
325494,
186233,
333690,
243584,
325505,
333699,
399244,
333709,
333725,
333737,
382891,
382898,
333767,
358348,
333777,
219094,
358372,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
268299,
333838,
350225,
350232,
333851,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
252021,
342134,
374904,
333989,
333998,
334012,
260299,
350411,
350417,
350423,
350426,
334047,
350449,
358645,
350454,
350459,
350462,
350465,
350469,
325895,
268553,
194829,
350477,
268560,
350481,
432406,
350487,
350491,
350494,
325920,
350500,
350505,
358701,
391469,
350510,
358705,
358714,
358717,
383307,
358738,
334162,
383331,
383334,
391531,
383342,
334204,
391564,
366991,
334224,
342431,
375209,
326059,
375220,
342453,
334263,
326087,
358857,
195041,
334306,
334312,
104940,
375279,
162289,
350724,
186898,
342546,
350740,
342551,
334359,
342555,
334364,
416294,
350762,
252463,
358962,
334386,
334397,
252483,
219719,
399957,
244309,
334425,
326240,
334466,
334469,
391813,
162446,
326291,
342680,
342685,
260767,
342711,
244410,
260798,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
64231,
113389,
342769,
203508,
375541,
342777,
391938,
391949,
375569,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
326452,
326455,
375613,
244542,
260925,
375616,
326468,
244552,
342857,
326474,
326479,
326486,
416599,
342875,
244572,
326494,
326503,
433001,
326508,
400238,
326511,
211826,
211832,
392061,
351102,
260993,
400260,
342921,
342931,
400279,
252823,
392092,
400286,
359335,
211885,
400307,
351169,
359362,
351172,
170950,
326599,
359367,
359383,
359389,
383968,
359411,
261109,
261112,
244728,
383999,
261130,
326669,
261148,
359452,
211999,
261155,
261160,
359471,
375868,
384099,
384102,
367724,
384108,
326764,
384115,
343155,
212095,
384136,
384140,
384144,
384152,
384158,
384161,
351399,
384169,
367795,
244917,
384182,
384189,
351424,
384192,
343232,
244934,
367817,
244938,
384202,
253132,
326858,
343246,
384209,
146644,
351450,
384225,
343272,
351467,
384247,
351480,
384250,
351483,
351492,
343307,
384270,
261391,
359695,
253202,
261395,
384276,
384284,
245021,
384290,
253218,
171304,
245032,
384299,
351535,
245042,
326970,
384324,
343366,
212296,
212304,
367966,
343394,
343399,
367981,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
384398,
245137,
245143,
245146,
245149,
343453,
245152,
245155,
155045,
245158,
40358,
245163,
114093,
327090,
343478,
359867,
384444,
146878,
327108,
327112,
384457,
327118,
359887,
359891,
343509,
368093,
155103,
343535,
343540,
368120,
343545,
409092,
359948,
359951,
359984,
400977,
400982,
179803,
155241,
138865,
155255,
155274,
368289,
245410,
245415,
425652,
425663,
155328,
245463,
155352,
155356,
212700,
155364,
245477,
155372,
245487,
245495,
409336,
155394,
155404,
245528,
155423,
360224,
155439,
204592,
155444,
155448,
417596,
384829,
360262,
155463,
155477,
376665,
155484,
261982,
425823,
155488,
376672,
155492,
327532,
261997,
376686,
262000,
262003,
262006,
327542,
425846,
262009,
147319,
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,
212945,
393170,
155604,
155620,
253924,
155622,
253927,
327655,
360432,
393204,
360439,
253944,
393209,
155647
] |
09b9b5c3dc0b3349c8181e480e8eb2761daf98db | f121c0fb26574bf04aacbe9a28eea51352fd6bd6 | /Example/Example/Model/Models.swift | 785a39949ada6db81662ccd3cce8d665d5c6bcb1 | [
"MIT"
] | permissive | maokaiqian/KeyframePicker | 515506f362b565ed030fa15c009b6a530137a468 | 6a8f9dea23de8e27fd810f603dafdb010974fa3b | refs/heads/master | 2021-01-24T06:44:36.317695 | 2016-11-18T05:55:40 | 2016-11-18T05:55:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 275 | swift | //
// Models.swift
// Example
//
// Created by zhangzhilong on 2016/11/11.
// Copyright © 2016年 zhangzhilong. All rights reserved.
//
import Foundation
import Photos
struct VideoModel {
var asset: PHAsset?
var videoPath: String?
var videoName: String?
}
| [
-1
] |
fd258e7225c4bd74b4c6d8d014637c55b601a33e | 9414b2241a908f86a604e0f46aa1aad3a46e3d0e | /Sources/InfiniteLayout/InfiniteCollectionViewProxy.swift | 3e71ce0f0ee536594f8e15112f9076c8071a0eb4 | [
"MIT"
] | permissive | icerockdev/InfiniteLayout | 7fffc52d256c0a2017f79957006aad20377fdbc0 | f73c116eb54dc7beddef8397acdff0edee8d182a | refs/heads/master | 2023-04-04T10:59:17.540582 | 2021-04-22T06:49:06 | 2021-04-22T06:49:06 | 360,413,336 | 0 | 0 | MIT | 2021-04-22T06:49:07 | 2021-04-22T06:21:44 | null | UTF-8 | Swift | false | false | 3,177 | swift | //
// Proxy.swift
// InfiniteLayout
//
// Created by Arnaud Dorgans on 20/12/2017.
//
import UIKit
class InfiniteCollectionViewProxy<T: NSObjectProtocol>: CocoaProxy {
var collectionView: InfiniteCollectionView! {
get { return self.proxies.first as? InfiniteCollectionView }
set {
if !self.proxies.isEmpty {
self.proxies.removeFirst()
}
self.proxies.insert(newValue, at: 0)
}
}
var delegate: T? {
get {
guard self.proxies.count > 1 else {
return nil
}
return self.proxies.last as? T
} set {
while self.proxies.count > 1 {
self.proxies.removeLast()
}
guard let delegate = newValue else {
return
}
self.proxies.append(delegate)
}
}
override func proxies(for aSelector: Selector) -> [NSObjectProtocol] {
return super.proxies(for: aSelector).reversed()
}
init(collectionView: InfiniteCollectionView) {
super.init(proxies: [])
self.collectionView = collectionView
}
deinit {
self.proxies.removeAll()
}
}
class InfiniteCollectionViewDelegateProxy: InfiniteCollectionViewProxy<UICollectionViewDelegate>, UICollectionViewDelegate {
override func proxies(for aSelector: Selector) -> [NSObjectProtocol] {
return super.proxies(for: aSelector)
.first { proxy in
guard !(aSelector == #selector(UIScrollViewDelegate.scrollViewDidScroll(_:)) ||
aSelector == #selector(UIScrollViewDelegate.scrollViewWillEndDragging(_:withVelocity:targetContentOffset:))) else {
return proxy is InfiniteCollectionView
}
return true
}.flatMap { [$0] } ?? []
}
}
class InfiniteCollectionViewDataSourceProxy: InfiniteCollectionViewProxy<UICollectionViewDataSource>, UICollectionViewDataSource {
override func proxies(for aSelector: Selector) -> [NSObjectProtocol] {
return super.proxies(for: aSelector)
.first { proxy in
guard !(aSelector == #selector(UICollectionViewDataSource.numberOfSections(in:)) ||
aSelector == #selector(UICollectionViewDataSource.collectionView(_:numberOfItemsInSection:))) else {
return proxy is InfiniteCollectionView
}
return true
}.flatMap { [$0] } ?? []
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return self.collectionView.collectionView(collectionView, numberOfItemsInSection: section)
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
return self.delegate?.collectionView(collectionView, cellForItemAt: self.collectionView.indexPath(from: indexPath)) ??
self.collectionView.collectionView(collectionView, cellForItemAt: self.collectionView.indexPath(from: indexPath))
}
}
| [
-1
] |
4477a8666127d4ae6dc283036195cb6d52d39d87 | 28c4fe5e2da88772a95135d5a9b74a10f14ba994 | /viewFinderApp/TableViewController.swift | 7de473ac4281cdc18a53453c76f87b68c60fd084 | [] | no_license | kamiemueller27/KWK-2019-day-1 | b79fe7ee9455ec61abfb60f9b6c46b409f01a804 | eb5f7af3756d4ec0ffed7de2d7f4ac0e0d822611 | refs/heads/master | 2020-06-30T14:58:46.291890 | 2019-08-16T14:32:50 | 2019-08-16T14:32:50 | 200,864,515 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 3,670 | swift | //
// TableViewController.swift
// viewFinderApp
//
// Created by Apple on 8/13/19.
// Copyright © 2019 Apple. All rights reserved.
//
import UIKit
class TableViewController: UITableViewController {
var photos : [Photos] = []
override func viewDidLoad() {
super.viewDidLoad()
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem
}
// MARK: - Table view data source
// override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
// return 0
// }
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return photos.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell()
let cellPhoto = photos[indexPath.row]
cell.textLabel?.text = "this is a label!"
cell.textLabel?.text = cellPhoto.caption
if cellPhotoImageData = cellPhoto.Photos {
if let cellPhotoImage = UIImage(data: cellPhotoImageData) {
cell.imageView?.image = cellPhotoImage
}
return cell
}
func getPhotos() {
if let context = (UIApplication.shared.delegate as? AppDelegate)?.persistentContainer.viewContext {
if let coreDataPhotos = try? context.fetch(Photos.fetchRequest()) as? [Photos] {
photos = coreDataPhotos
tableView.reloadData()
}
}
}
func viewWillAppear(_ animated: Bool) {
getPhotos()
}
}
/*
// Override to support conditional editing of the table view.
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
*/
/*
// Override to support editing the table view.
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
// Delete the row from the data source
tableView.deleteRows(at: [indexPath], with: .fade)
} else if editingStyle == .insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) {
}
*/
/*
// Override to support conditional rearranging of the table view.
override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the item to be re-orderable.
return true
}
*/
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
4d36efaaa1c42e0d11e5775028ae25f04153b143 | bac8c0ee9693c1141ac5ca01296a117207ff6bdf | /MyCalender-firebase/View/EventView.swift | 1c279eb8107dabf139268d5cbacf9730429a41e9 | [] | no_license | KSDeng/My-Calendar2 | 777cb6589553f98811da87c08d629a9b8838d3f0 | 6d0c581876dc0fe0f0bc7780e4fbf6c440bc18ee | refs/heads/master | 2020-11-25T08:40:13.596983 | 2019-12-18T10:52:41 | 2019-12-18T10:52:41 | 228,576,757 | 4 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,381 | swift |
import UIKit
// https://medium.com/better-programming/swift-3-creating-a-custom-view-from-a-xib-ecdfe5b3a960
// https://stackoverflow.com/questions/24857986/load-a-uiview-from-nib-in-swift
// 添加在每个单元格的事件视图
class EventView: UIView {
@IBOutlet var view: UIView!
@IBOutlet weak var lineView: UIView!
@IBOutlet weak var infoBoardView: UIView!
@IBOutlet weak var weekDayLabel: UILabel!
@IBOutlet weak var dateNumberBackView: UIView!
@IBOutlet weak var dateNumberLabel: UILabel!
@IBOutlet weak var eventTitleLabel: UILabel!
@IBOutlet weak var dateTimeLabel: UILabel!
@IBOutlet weak var processLabel: UILabel!
var event: Event? // 非Task(不持久化)使用
var task: TaskDB? // Task(持久化)使用
var dateIndex: String?
// 序列号(用于排序), 开始时间 + 类型 + 加入列表的时间
// 类型(0: 今天, 1: 节假日, 2: 调休日, 3: 各种事务,包括全天事务、非全天事务或跨越多天事务的每一天)
// 开始时间: startDate(yyyyMMdd) + startTime(HHmm),0、1、2、3类型的startTime设为0000,跨越多天事务的中间天和最后一天的startTime也设为0000
// 加入列表的时间:Date()(yyyyMMddHHmmss)
// 序列号较小的排前面
var sequenceNumber: String?
// for using custom view in code
init() {
super.init(frame: CGRect.zero)
fromNib()
}
override init(frame: CGRect) {
super.init(frame: frame)
fromNib()
}
// for using custom view in IB
required init?(coder: NSCoder) {
super.init(coder: coder)
fromNib()
}
}
// load UIView from nib file programmatically
extension UIView {
@discardableResult // 1
func fromNib<T : UIView>() -> T? { // 2
guard let contentView = Bundle(for: type(of: self)).loadNibNamed(String(describing: type(of: self)), owner: self, options: nil)?.first as? T else { // 3
// xib not loaded, or its top view is of the wrong type
return nil
}
self.addSubview(contentView) // 4
// contentView.translatesAutoresizingMaskIntoConstraints = false // 5
contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
return contentView // 7
}
}
| [
-1
] |
8fbcc923c29cf820c5eb6953b3325e9d8fc329f5 | 240d4dc9f7df0268d03d53a8dd0d2525af37029f | /Device 9/Device9Kit/Device9.swift | 3ca40768d13d691c29a159b717f142cf813a3f15 | [
"Apache-2.0"
] | permissive | yuByte/Device-9 | 6a66c952f594721f5f84ba56e61a99ebc2de87a4 | 0dafc39cfa8dcbf58462ddee0f001f92c093b109 | refs/heads/master | 2021-01-15T12:22:13.684172 | 2015-12-10T08:52:12 | 2015-12-10T08:52:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,482 | swift | //
// DeviceData.swift
// Device 9
//
// Created by Eular on 9/19/15.
// Copyright © 2015 Eular. All rights reserved.
//
import UIKit
import Foundation
import CoreTelephony
import SystemConfiguration.CaptiveNetwork
public class Device9 {
public enum NetworkState {
case None
case WIFI
case Cellular
case Connected
}
public struct DataFlow {
private let defaults = NSUserDefaults(suiteName: "group.device9SharedDefaults")!
public var upGPRS: Double = 0.0
public var upWiFi: Double = 0.0
public var downGPRS: Double = 0.0
public var downWiFi: Double = 0.0
public var upSpeed: Double = 0.0
public var downSpeed: Double = 0.0
public var dt = 1.0
public var cellularUsed: Double {
set {
defaults.setDouble(newValue, forKey: "CellularUsed")
defaults.synchronize()
}
get {
return defaults.doubleForKey("CellularUsed")
}
}
public var wifiUsed: Double {
set {
defaults.setDouble(newValue, forKey: "WiFiUsed")
defaults.synchronize()
}
get {
return defaults.doubleForKey("WiFiUsed")
}
}
init() {
let data = Network().getDataFlowBytes()
upWiFi = data["WiFiSent"] as! Double
downWiFi = data["WiFiReceived"] as! Double
upGPRS = data["WWANSent"] as! Double
downGPRS = data["WWANReceived"] as! Double
}
public mutating func update() {
let up1 = upGPRS + upWiFi
let down1 = downGPRS + downWiFi
let cell1 = upGPRS + downGPRS
let wifi1 = upWiFi + downWiFi
let data = Network().getDataFlowBytes()
upWiFi = data["WiFiSent"] as! Double
downWiFi = data["WiFiReceived"] as! Double
upGPRS = data["WWANSent"] as! Double
downGPRS = data["WWANReceived"] as! Double
let up2 = upGPRS + upWiFi
let down2 = downGPRS + downWiFi
let cell2 = upGPRS + downGPRS
let wifi2 = upWiFi + downWiFi
upSpeed = (up2 - up1) / dt
downSpeed = (down2 - down1) / dt
cellularUsed += cell2 - cell1
wifiUsed += wifi2 - wifi1
}
}
let device = UIDevice.currentDevice()
public var dataFlow = DataFlow()
public var systemFreeSize: Double {
let fm = NSFileManager.defaultManager()
let fattributes = try! fm.attributesOfFileSystemForPath(NSHomeDirectory())
return fattributes["NSFileSystemFreeSize"] as! Double
}
public var batteryLevel: Float {
return device.batteryLevel
}
public var batteryState: UIDeviceBatteryState{
return device.batteryState
}
public var ip: String? {
let ipAddr = Network().getIPAddress()
return ipAddr != "error" ? ipAddr : nil
}
public var wan: [String: String]? {
let url = NSURL(string: "http://1111.ip138.com/ic.asp")
let gb2312 = CFStringConvertEncodingToNSStringEncoding(0x0632)
do {
let html = try NSString(contentsOfURL: url!, encoding: gb2312) as String
let tmp = html.split("[")[1].split("]")
let wan = tmp[0]
let pos = tmp[1].split("<")[0].split(":")[1]
return ["ip":wan, "pos":pos]
} catch {
return nil
}
}
// Network
public var network: NetworkState {
if self.ip != nil {
return .Connected
}
return .None
}
// WIFI
public var SSID: String {
return Network().SSID()
}
public var BSSID: String {
return Network().BSSID()
}
public var cellularUsedData: Double {
return dataFlow.cellularUsed
}
public var cellularTotalData: Double {
return NSUserDefaults(suiteName: "group.device9SharedDefaults")!.doubleForKey("CellularTotal")
}
public var wifiUsedData: Double {
return dataFlow.wifiUsed
}
public var mobileTemperature: Double {
return 30.0
}
public var UUID: String {
return device.identifierForVendor!.UUIDString
}
public var name: String {
return device.name
}
public var systemVersion: String {
return device.systemVersion
}
public var app: Array<String> {
var appList = [String]()
for app in Network().getAppList() {
let BundleID = String(app).split(" ")[2]
if !BundleID.hasPrefix("com.apple") {
appList.append(BundleID)
}
}
return appList
}
public var appNum: Int {
return app.count
}
public init() {
device.batteryMonitoringEnabled = true
}
/*
// iOS 9 以下
func fetchSSIDInfo() -> String? {
if let
ifs = CNCopySupportedInterfaces() as? [String],
ifName = ifs.first,
info = CNCopyCurrentNetworkInfo((ifName as CFStringRef))
{
if let
ssidInfo = info as? [String:AnyObject],
ssid = ssidInfo["SSID"] as? String
{
return ssid
}
}
return nil
}
*/
}
/*
// add to swift bridge #include <ifaddrs.h>
func getIFAddresses() -> [String] {
var addresses = [String]()
// Get list of all interfaces on the local machine:
var ifaddr : UnsafeMutablePointer<ifaddrs> = nil
if getifaddrs(&ifaddr) == 0 {
// For each interface ...
for (var ptr = ifaddr; ptr != nil; ptr = ptr.memory.ifa_next) {
let flags = Int32(ptr.memory.ifa_flags)
var addr = ptr.memory.ifa_addr.memory
// Check for running IPv4, IPv6 interfaces. Skip the loopback interface.
if (flags & (IFF_UP|IFF_RUNNING|IFF_LOOPBACK)) == (IFF_UP|IFF_RUNNING) {
if addr.sa_family == UInt8(AF_INET) || addr.sa_family == UInt8(AF_INET6) {
// Convert interface address to a human readable string:
var hostname = [CChar](count: Int(NI_MAXHOST), repeatedValue: 0)
if (getnameinfo(&addr, socklen_t(addr.sa_len), &hostname, socklen_t(hostname.count),
nil, socklen_t(0), NI_NUMERICHOST) == 0) {
if let address = String.fromCString(hostname) {
addresses.append(address)
}
}
}
}
}
freeifaddrs(ifaddr)
}
return addresses
}
*/
// Some Useful extensions
public extension Double {
var KB: Double {
return self / 1024
}
var MB: Double {
return self.KB / 1024
}
var GB: Double {
return self.MB / 1024
}
func afterPoint(n: Int) -> Double {
let s = String(format: "%.\(n)f", self)
return Double(s)!
}
}
public extension String {
func split(separator: String) -> [String] {
return self.componentsSeparatedByString(separator)
}
}
| [
-1
] |
5d331274e78267585feeefd83451a5d61481b47d | 88f0b0817c66bdf1dd451bcd835e555eaafb2722 | /AlertizenFirstPhase/AlertizenSwift/Alertizen/Alertizen/ViewController/TermsNConditionsVC.swift | 979a475bcd2550ce52941e9f92fbe779d51237e3 | [] | no_license | manavsharma123/Alertizen | 2f10ec0bdb23c369eac5f93bc2a6f7ef0a0e3415 | 3c87402d568d60dc5dd32b6393377094e7a1a3fa | refs/heads/master | 2021-04-29T13:30:04.564543 | 2018-08-14T13:39:07 | 2018-08-14T13:39:07 | 121,752,907 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,345 | swift | //
// TermsNConditionsVC.swift
// Alertizen
//
// Created by Mind Roots Technologies on 18/11/16.
// Copyright © 2016 Mind Roots Technologies. All rights reserved.
//
import UIKit
class TermsNConditionsVC: UIViewController, UIWebViewDelegate {
var phone:String! = nil
@IBOutlet var btnAccept: UIButton!
@IBOutlet var webView: UIWebView!
@IBOutlet var btnDecline: UIButton!
@IBOutlet var mainScrollView: UIScrollView!
override func viewDidLoad()
{
super.viewDidLoad()
webView.isOpaque = false
webView.backgroundColor = UIColor.clear
webView.scrollView.bounces = false
webView.scrollView.isScrollEnabled = false
loadData()
}
override func didReceiveMemoryWarning()
{
super.didReceiveMemoryWarning()
}
func loadData() -> Void
{
let rechability = Reachability.forInternetConnection()
let remoteHostStatus = rechability?.currentReachabilityStatus()
if (remoteHostStatus == NotReachable)
{
UIAlertController.Alert(title: "Network Unavailable", msg: "Please connect to the internet in order to proceed.", vc: self)
}
else
{
hud.show(true)
hud.frame = self.view.frame
hud.backgroundColor = UIColor(red: 0/255.0, green: 0/255.0, blue: 0/255.0, alpha: 0.50)
hud.color = UIColor.clear
self.view.addSubview(hud)
self.view.isUserInteractionEnabled = false
let dictUserInfo = ["secure_token":"CMPS-RTms889E"] as [String : String]
WebService.sharedInstance.postMethodWithParams(strURL: "terms.php", dict: dictUserInfo as NSDictionary, completionHandler:
{ (dictReponse) in
print(dictReponse)
if (dictReponse.object(forKey: "success") != nil)
{
OperationQueue.main.addOperation
{
let htmlCode = dictReponse.object(forKey: "terms")
self.webView.loadHTMLString(htmlCode as! String, baseURL: nil)
}
}
}, failure:{ (errorMsg) in
UIAlertController.Alert(title: "API Error", msg: "There seems to be a problem in fetching the data at the moment. Please try again.", vc: self)
})
}
}
@IBAction func btnAcceptClick(_ sender: AnyObject)
{
let obj = self.storyboard?.instantiateViewController(withIdentifier: "createProfile") as! CreateProfileVC
obj.phoneStr = self.phone
self.navigationController?.pushViewController(obj, animated: true)
}
@IBAction func btnDeclineClick(_ sender: AnyObject)
{
let rechability = Reachability.forInternetConnection()
let remoteHostStatus = rechability?.currentReachabilityStatus()
if (remoteHostStatus == NotReachable)
{
UIAlertController.Alert(title: "Network Unavailable", msg: "Please connect to the internet in order to proceed.", vc: self)
}
else
{
let dictUserInfo = ["phone":phone,"secure_token":"CMPS-DleETeenDy007"] as [String : String]
WebService.sharedInstance.postMethodWithParams(strURL: "delete_deny.php", dict: dictUserInfo as NSDictionary, completionHandler:
{ (dictReponse) in
print(dictReponse)
if (dictReponse.object(forKey: "success") != nil)
{
OperationQueue.main.addOperation
{
let _ = self.navigationController?.popToRootViewController(animated: false)
}
}
}, failure:{ (errorMsg) in
UIAlertController.Alert(title: "API Error", msg: "There seems to be a problem in fetching the data at the moment. Please try again.", vc: self)
})
}
}
@IBAction func btnBackAction(_ sender: UIButton) -> Void
{
let _ = self.navigationController?.popViewController(animated: true)
}
func webViewDidFinishLoad(_ webView : UIWebView)
{
self.webView.frame = CGRect(x: self.webView.frame.origin.x , y: self.webView.frame.origin.y, width: self.webView.frame.size.width, height: self.webView.scrollView.contentSize.height)
self.btnAccept.frame = CGRect(x: self.btnAccept.frame.origin.x , y: self.webView.frame.size.height+100, width: self.btnAccept.frame.size.width, height: self.btnAccept.frame.size.height)
self.btnDecline.frame = CGRect(x: self.btnDecline.frame.origin.x , y: self.webView.frame.size.height+100, width: self.btnDecline.frame.size.width, height: self.btnDecline.frame.size.height)
self.mainScrollView.contentSize = CGSize(width:0, height: self.btnDecline.frame.origin.y+self.btnDecline.frame.size.height)
self.view.isUserInteractionEnabled = true
hud.removeFromSuperview()
mainScrollView.addSubview(self.btnAccept)
mainScrollView.addSubview(self.btnDecline)
}
}
| [
-1
] |
85aa57052b246e5d9632061f0fdb30edfccf522a | c270f48ff15de5569fdeb6c7b9f141bce5794cdf | /Lab1Task2/Lab1Task2/main.swift | 5a2a408af402567fc005e4b2c78f96e8a214d312 | [] | no_license | mash1negun/SwiftLabs | 73f1a2db40a6a3c91fb50c3cd8b8cdc87e4a4e5f | cb5ad5d671f0911b062a868dbc2f6a712d86d2f2 | refs/heads/main | 2023-08-15T01:39:04.050154 | 2021-10-03T16:38:46 | 2021-10-03T16:38:46 | 406,361,925 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 667 | swift | //
// main.swift
// Lab1Task2
//
// Created by Завур Мамашев on 15.09.2021.
//
import Foundation
print("Введите число от 0 до 9:")
var numb = readLine()
switch numb {
case "0":
print("ноль")
case "1":
print("один")
case "2":
print("два")
case "3":
print("три")
case "4":
print("четыре")
case "5":
print("пять")
case "6":
print("шесть")
case "7":
print("семь")
case "8":
print("восемь")
case "9":
print("девять")
default:
print("Значение не является числом или не входит в интервал от 0 до 9")
}
| [
-1
] |
559af39570a68493f4c07c3b30c63f001b45362e | a30a99c88d9dee93248423ac75c3ccabf17b13e1 | /Capstone/Firebase-Services/AnsweredQuestionDatabaseServices.swift | 27f67730cf9aa2481f79f82a2c76d6e381bf2a9e | [] | no_license | GregKeeley/Capstone | 734110cb69e2b00fc37d4202264b020d0195de70 | 3fec0d3731e953e8e8d1039daf383c54f9f63259 | refs/heads/master | 2023-03-16T09:28:13.992536 | 2020-07-28T04:20:34 | 2020-07-28T04:20:34 | 272,468,132 | 0 | 0 | null | 2020-06-15T14:57:33 | 2020-06-15T14:57:32 | null | UTF-8 | Swift | false | false | 5,799 | swift | //
// AnsweredQuestionDatabaseServices.swift
// Capstone
//
// Created by Amy Alsaydi on 6/9/20.
// Copyright © 2020 Amy Alsaydi. All rights reserved.
//
import Foundation
import FirebaseFirestore
import FirebaseAuth
extension DatabaseService {
// to get interview question answers we will filter answeredQuestions collection using the question string
public func addToAnsweredQuestions(answeredQuestion: AnsweredQuestion, completion: @escaping (Result<Bool, Error>) -> ()) {
guard let user = Auth.auth().currentUser else {return}
let userID = user.uid
db.collection(DatabaseService.userCollection).document(userID).collection(DatabaseService.answeredQuestionsCollection).document(answeredQuestion.id).setData(["id": answeredQuestion.id, "question": answeredQuestion.question, "answers": answeredQuestion.answers, "starSituationIDs": answeredQuestion.starSituationIDs ]) { (error) in
if let error = error {
completion(.failure(error))
} else {
completion(.success(true))
}
}
}
// FIXME: the following returns an array of AnsweredQuestion, do we want to return just one (the first) ?
public func fetchAnsweredQuestions(questionString: String, completion: @escaping (Result<[AnsweredQuestion], Error>)->()) {
guard let user = Auth.auth().currentUser else {return}
let userID = user.uid
db.collection(DatabaseService.userCollection).document(userID).collection(DatabaseService.answeredQuestionsCollection).whereField("question", isEqualTo: questionString).getDocuments { (snapShot, error) in
if let error = error {
completion(.failure(error))
} else if let snapShot = snapShot {
let answeredQuestions = snapShot.documents.map { AnsweredQuestion($0.data())}
completion(.success(answeredQuestions))
}
}
}
//MARK:- Remove/Add STAR Story to answer
public func removeStarSituationFromAnswer(answerID: String, starSolutionID: String, completion: @escaping (Result<Bool, Error>) -> ()) {
guard let user = Auth.auth().currentUser else {return}
let userID = user.uid
db.collection(DatabaseService.userCollection).document(userID).collection(DatabaseService.answeredQuestionsCollection).document(answerID).updateData(["starSituationIDs" : FieldValue.arrayRemove(["\(starSolutionID)"])]) { (error) in
if let error = error {
completion(.failure(error))
} else {
completion(.success(true))
}
}
}
public func addStarSituationToAnswer(answerID: String, starSolutionID: String, completion: @escaping (Result<Bool, Error>) -> ()) {
guard let user = Auth.auth().currentUser else {return}
let userID = user.uid
db.collection(DatabaseService.userCollection).document(userID).collection(DatabaseService.answeredQuestionsCollection).document(answerID).updateData(["starSituationIDs" : FieldValue.arrayUnion(["\(starSolutionID)"])]) { (error) in
if let error = error {
completion(.failure(error))
} else {
completion(.success(true))
}
}
}
public func addAnswerIDToSTARSituation(answerID: String, starSituationID: String, completion: @escaping (Result<Bool, Error>) -> ()) {
guard let user = Auth.auth().currentUser else {return}
let userID = user.uid
db.collection(DatabaseService.userCollection).document(userID).collection(DatabaseService.starSituationsCollection).document(starSituationID).updateData(["interviewQuestionsIDs": FieldValue.arrayUnion(["\(answerID)"])]) { (error) in
if let error = error {
completion(.failure(error))
} else {
completion(.success(true))
}
}
}
//MARK:- Adding/Updating/Removing answers
public func addAnswerToAnswersArray(answerID: String, answerString: String, completion: @escaping (Result<Bool, Error>) -> ()) {
guard let user = Auth.auth().currentUser else {return}
let userID = user.uid
db.collection(DatabaseService.userCollection).document(userID).collection(DatabaseService.answeredQuestionsCollection).document(answerID).updateData(["answers" : FieldValue.arrayUnion(["\(answerString)"])]) { (error) in
if let error = error {
completion(.failure(error))
} else {
completion(.success(true))
}
}
}
public func removeAnswerFromAnswersArray(answerID: String, answerString: String, completion: @escaping (Result<Bool, Error>) -> ()) {
guard let user = Auth.auth().currentUser else {return}
let userID = user.uid
db.collection(DatabaseService.userCollection).document(userID).collection(DatabaseService.answeredQuestionsCollection).document(answerID).updateData(["answers" : FieldValue.arrayRemove(["\(answerString)"])]) { (error) in
if let error = error {
completion(.failure(error))
} else {
completion(.success(true))
}
}
}
public func deleteAnsweredQuestionObject(answerID: String, question: String, completion: @escaping (Result<Bool, Error>) -> ()){
guard let user = Auth.auth().currentUser else {return}
let userID = user.uid
db.collection(DatabaseService.userCollection).document(userID).collection(DatabaseService.answeredQuestionsCollection).document(answerID).delete { (error) in
if let error = error {
completion(.failure(error))
} else {
completion(.success(true))
}
}
}
}
| [
-1
] |
2fb205d964292b59502dff4699e584ae92806c7f | 7576a40a8cc7af047b0bef16eb6299ba8b377dbb | /SourceCode/4. 2D Games with the SpriteKit Framework/7.1 ColorSwitch7.zip/ColorSwitch/ColorSwitch/Scenes/GameScene.swift | 5a0f7c100a82e2aec2d954c50c5262f0c3eb9cc0 | [
"MIT"
] | permissive | CoderDream/Angry-Birds-in-Swift-4 | b55129189097d151d5ea768a32d4a789f5eb1dd3 | 75a14252e23323d94bbd090431f0cc5a1e81b229 | refs/heads/master | 2020-05-25T19:11:52.526877 | 2019-05-27T09:50:24 | 2019-05-27T09:50:24 | 187,945,122 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,188 | swift | //
// GameScene.swift
// ColorSwitch
//
// Created by Johannes Ruof on 07.07.17.
// Copyright © 2017 Rume Academy. All rights reserved.
//
import SpriteKit
enum PlayColors {
static let colors = [
UIColor(red: 231/255, green: 76/255, blue: 60/255, alpha: 1.0),
UIColor(red: 241/255, green: 196/255, blue: 15/255, alpha: 1.0),
UIColor(red: 46/255, green: 204/255, blue: 113/255, alpha: 1.0),
UIColor(red: 52/255, green: 152/255, blue: 219/255, alpha: 1.0)
]
}
enum SwitchState: Int {
case red, yellow, green, blue
}
class GameScene: SKScene {
var colorSwitch: SKSpriteNode!
var switchState = SwitchState.red
var currentColorIndex: Int?
let scoreLabel = SKLabelNode(text: "0")
var score = 0
override func didMove(to view: SKView) {
setupPhysics()
layoutScene()
}
func setupPhysics() {
physicsWorld.gravity = CGVector(dx: 0.0, dy: -1.0)
physicsWorld.contactDelegate = self
}
func layoutScene() {
backgroundColor = UIColor(red: 44/255, green: 62/255, blue: 80/255, alpha: 1.0)
colorSwitch = SKSpriteNode(imageNamed: "ColorCircle")
colorSwitch.size = CGSize(width: frame.size.width/3, height: frame.size.width/3)
colorSwitch.position = CGPoint(x: frame.midX, y: frame.minY + colorSwitch.size.height)
colorSwitch.zPosition = ZPositions.colorSwitch
colorSwitch.physicsBody = SKPhysicsBody(circleOfRadius: colorSwitch.size.width/2)
colorSwitch.physicsBody?.categoryBitMask = PhysicsCategories.switchCategory
colorSwitch.physicsBody?.isDynamic = false
addChild(colorSwitch)
scoreLabel.fontName = "AvenirNext-Bold"
scoreLabel.fontSize = 60.0
scoreLabel.fontColor = UIColor.white
scoreLabel.position = CGPoint(x: frame.midX, y: frame.midY)
scoreLabel.zPosition = ZPositions.label
addChild(scoreLabel)
spawnBall()
}
func updateScoreLabel() {
scoreLabel.text = "\(score)"
}
func spawnBall() {
currentColorIndex = Int(arc4random_uniform(UInt32(4)))
let ball = SKSpriteNode(texture: SKTexture(imageNamed: "ball"), color: PlayColors.colors[currentColorIndex!], size: CGSize(width: 30.0, height: 30.0))
ball.colorBlendFactor = 1.0
ball.name = "Ball"
ball.position = CGPoint(x: frame.midX, y: frame.maxY)
ball.zPosition = ZPositions.ball
ball.physicsBody = SKPhysicsBody(circleOfRadius: ball.size.width/2)
ball.physicsBody?.categoryBitMask = PhysicsCategories.ballCategory
ball.physicsBody?.contactTestBitMask = PhysicsCategories.switchCategory
ball.physicsBody?.collisionBitMask = PhysicsCategories.none
addChild(ball)
}
func turnWheel() {
if let newState = SwitchState(rawValue: switchState.rawValue + 1) {
switchState = newState
} else {
switchState = .red
}
colorSwitch.run(SKAction.rotate(byAngle: .pi/2, duration: 0.25))
}
func gameOver() {
print("GameOver!")
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
turnWheel()
}
}
extension GameScene: SKPhysicsContactDelegate {
func didBegin(_ contact: SKPhysicsContact) {
let contactMask = contact.bodyA.categoryBitMask | contact.bodyB.categoryBitMask
if contactMask == PhysicsCategories.ballCategory | PhysicsCategories.switchCategory {
if let ball = contact.bodyA.node?.name == "Ball" ? contact.bodyA.node as? SKSpriteNode : contact.bodyB.node as? SKSpriteNode {
if currentColorIndex == switchState.rawValue {
score += 1
updateScoreLabel()
ball.run(SKAction.fadeOut(withDuration: 0.25), completion: {
ball.removeFromParent()
self.spawnBall()
})
} else {
gameOver()
}
}
}
}
}
| [
-1
] |
096dd9ffaa098273109d73509a60ef1d5b4834b5 | 2ef5f6c5a3afa09d72cf0c62710dc6cd229709ef | /Toutiao/Dolphin/Dolphin/Module/Info/controller/Trash/InfoViewController_old.swift | 5f78e7c0cd262552d89821db39482abe8d911676 | [] | no_license | Coastchb/ios | 324db7c073458f79763d2fdb4a8825c3a6131101 | 9e0b77177f2f3b64a714879e7c8bc38c2079847a | refs/heads/master | 2022-10-27T17:37:28.158901 | 2021-07-19T02:08:36 | 2021-07-19T02:08:36 | 190,006,428 | 2 | 1 | null | 2022-10-06T22:40:28 | 2019-06-03T13:02:12 | Swift | UTF-8 | Swift | false | false | 3,931 | swift | import UIKit
//import Parchment
class InfoViewController_old: UIViewController {
@IBOutlet weak var bt: UIButton!
var selected_index = 0 {
didSet {
//viewWillAppear(true)
self.pagingViewController.select(index: selected_index)
}
}
// Let's start by creating an array of citites that we
// will use to generate some view controllers.
fileprivate let cities = [
"Oslo",
"Stockholm",
"Tokyo",
"Barcelona",
"Vancouver",
"Berlin",
"Shanghai",
"London",
"Paris",
"Chicago",
"Madrid",
"Munich",
"Toronto",
"Sydney",
"Melbourne"
]
let pagingViewController = PagingViewController<PagingIndexItem>()
override func viewDidLoad() {
super.viewDidLoad()
pagingViewController.dataSource = self
pagingViewController.delegate = self
// Add the paging view controller as a child view controller and
// contrain it to all edges.
addChild(pagingViewController)
view.addSubview(pagingViewController.view)
view.constrainToEdges(pagingViewController.view)
pagingViewController.didMove(toParent: self)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
print("To show page:\(selected_index)")
print("\(self.pagingViewController.selectedScrollPosition)")
//self.pagingViewController.selected
//self.reloadInputViews()
//self.pagingViewController.pageViewController.
print("\(self.pagingViewController.children)")
print("\(self.pagingViewController.tabBarItem)")
print("\(self.pagingViewController.pageViewController.children)")
print("\(self.pagingViewController.pageViewController.selectedViewController)")
}
}
extension InfoViewController_old: PagingViewControllerDataSource {
func pagingViewController<T>(_ pagingViewController: PagingViewController<T>, pagingItemForIndex index: Int) -> T {
return PagingIndexItem(index: index, title: cities[index]) as! T
}
func pagingViewController<T>(_ pagingViewController: PagingViewController<T>, viewControllerForIndex index: Int) -> UIViewController {
return UIViewController() // CityViewController(title: cities[index])
}
func numberOfViewControllers<T>(in: PagingViewController<T>) -> Int {
return cities.count
}
}
extension InfoViewController_old: PagingViewControllerDelegate {
// We want the size of our paging items to equal the width of the
// city title. Parchment does not support self-sizing cells at
// the moment, so we have to handle the calculation ourself. We
// can access the title string by casting the paging item to a
// PagingTitleItem, which is the PagingItem type used by
// FixedPagingViewController.
func pagingViewController<T>(_ pagingViewController: PagingViewController<T>, widthForPagingItem pagingItem: T, isSelected: Bool) -> CGFloat? {
guard let item = pagingItem as? PagingIndexItem else { return 0 }
let insets = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20)
let size = CGSize(width: CGFloat.greatestFiniteMagnitude, height: pagingViewController.menuItemSize.height)
let attributes = [NSAttributedString.Key.font: pagingViewController.font]
let rect = item.title.boundingRect(with: size,
options: .usesLineFragmentOrigin,
attributes: attributes,
context: nil)
let width = ceil(rect.width) + insets.left + insets.right
if isSelected {
return width * 1.5
} else {
return width
}
}
func pagingViewController<T>(_ pagingViewController: PagingViewController<T>, didScrollToItem pagingItem: T, startingViewController: UIViewController?, destinationViewController: UIViewController, transitionSuccessful: Bool) {
pagingViewController.select(pagingItem: pagingItem, animated: true)
}
}
| [
-1
] |
a771fbaf66ebd20e39e9ba64c390b4d11756985a | f64eca493cdff173f52c1b13c20fbef6a3f89b63 | /FTPageController/FTPCTitleModel.swift | 421d922cfec6423847176d4e048c3b840ca65c3c | [
"MIT"
] | permissive | mohsinalimat/FTPageController | b5a85f4e227612abbd2eeaef2a859b3787f287a1 | 77472f0fab7828f303a017ca1c1c12b7f2ff984c | refs/heads/master | 2020-04-07T15:34:04.372626 | 2018-11-21T04:06:12 | 2018-11-21T04:06:12 | 158,491,139 | 1 | 0 | MIT | 2018-11-21T04:33:34 | 2018-11-21T04:33:33 | null | UTF-8 | Swift | false | false | 1,672 | swift | //
// FTPCTitleModel.swift
// FTPageController
//
// Created by liufengting on 2018/8/27.
//
import UIKit
@objc open class FTPCTitleModel: NSObject {
@objc public var title: String = ""
@objc public var defaultFont: UIFont = UIFont.systemFont(ofSize: 12.0)
@objc public var selectedFont: UIFont = UIFont.systemFont(ofSize: 15.0)
@objc public var defaultColor: UIColor = UIColor.lightGray
@objc public var selectedColor: UIColor = UIColor.black
@objc public var indicatorColor: UIColor = UIColor.red
@objc private(set) var titleWidth: CGFloat = 20.0
@objc public convenience init(title: String?, defaultFont: UIFont? = nil, selectedFont: UIFont? = nil, defaultColor: UIColor? = nil, selectedColor: UIColor? = nil, indicatorColor: UIColor? = nil) {
self.init()
self.title = (title != nil && (title?.count)! > 0) ? title! : "Title"
self.defaultFont = defaultFont ?? UIFont.systemFont(ofSize: 12.0)
self.selectedFont = selectedFont ?? UIFont.systemFont(ofSize: 15.0)
self.defaultColor = defaultColor ?? UIColor.darkGray
self.selectedColor = selectedColor ?? UIColor.black
self.indicatorColor = indicatorColor ?? UIColor.red
self.calculateTitleWidth()
}
@objc private func calculateTitleWidth() {
if self.title.count <= 0 || self.defaultFont.pointSize < 0 {
return
}
let size = self.title.boundingRect(with: CGSize(width: CGFloat(MAXFLOAT), height: 100.0), options: .usesLineFragmentOrigin, attributes:[NSAttributedString.Key.font : self.defaultFont] , context: nil)
self.titleWidth = size.width
}
}
| [
-1
] |
41c9330f6e0bcd4d36eeac019675b9ad121e3d56 | 864d96233b61026b94e4ed3d7d2eca5424616727 | /Landmarks/Supporting Views/MapView.swift | 40dd9b3e8424f4a79f34a40d3c3636d9137f7f6a | [] | no_license | jthmiranda/Landmarks | 7722a96577fabc7314824f52752a55912f926cb4 | 211cb2110a46a20b07c4c263fece2f677d6b79ab | refs/heads/master | 2022-12-04T02:06:00.476906 | 2020-08-27T04:07:51 | 2020-08-27T04:07:51 | 284,148,542 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,303 | swift | //
// MapView.swift
// Landmarks
//
// Created by Jonathan Miranda on 8/1/20.
// Copyright © 2020 Jonathan Miranda. All rights reserved.
//
import SwiftUI
import MapKit
struct MapView {
var coordinate: CLLocationCoordinate2D
func makeMapView() -> MKMapView {
MKMapView(frame: .zero)
}
func updateMapView(_ uiView: MKMapView, context: Context) {
let span = MKCoordinateSpan(latitudeDelta: 2.0, longitudeDelta: 2.0)
let region = MKCoordinateRegion(center: coordinate, span: span)
uiView.setRegion(region, animated: true)
}
}
#if os(macOS)
extension MapView: NSViewRepresentable {
func makeNSView(context: Context) -> MKMapView {
makeMapView()
}
func updateNSView(_ nsView: MKMapView, context: Context) {
updateMapView(nsView, context: context)
}
}
#else
extension MapView: UIViewRepresentable {
func makeUIView(context: Context) -> MKMapView {
makeMapView()
}
func updateUIView(_ uiView: MKMapView, context: Context) {
updateMapView(uiView, context: context)
}
}
#endif
struct MapView_Previews: PreviewProvider {
static var previews: some View {
MapView(coordinate: landmarkData[0].locationCoordinates)
}
}
| [
286814
] |
36662b35c05feac34a22defe3f4d4252cb1ec6a3 | cae18c916951b6df77386ef42fffc5e52144d92e | /Foundation/NSLocale.swift | be9d14aae1871ffbb2b38eb7b7945bf49ec4a803 | [
"Apache-2.0",
"Swift-exception"
] | permissive | mikeash/swift-corelibs-foundation | ade94165277eb95c8f4f78fcdc94fa6bf4f91aa1 | f0135163775f8d9852d1c96e2342a40a8a2a9d4f | refs/heads/master | 2020-03-21T20:51:40.221732 | 2018-06-27T15:37:12 | 2018-06-27T15:37:12 | 139,033,029 | 1 | 0 | Apache-2.0 | 2018-06-28T14:57:47 | 2018-06-28T14:57:47 | null | UTF-8 | Swift | false | false | 9,687 | swift | // This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
import CoreFoundation
open class NSLocale: NSObject, NSCopying, NSSecureCoding {
typealias CFType = CFLocale
private var _base = _CFInfo(typeID: CFLocaleGetTypeID())
private var _identifier: UnsafeMutableRawPointer? = nil
private var _cache: UnsafeMutableRawPointer? = nil
private var _prefs: UnsafeMutableRawPointer? = nil
#if os(macOS) || os(iOS)
private var _lock = pthread_mutex_t()
#elseif os(Linux) || os(Android) || CYGWIN
private var _lock = Int32(0)
#endif
private var _nullLocale = false
internal var _cfObject: CFType {
return unsafeBitCast(self, to: CFType.self)
}
open func object(forKey key: NSLocale.Key) -> Any? {
return _SwiftValue.fetch(CFLocaleGetValue(_cfObject, key.rawValue._cfObject))
}
open func displayName(forKey key: Key, value: String) -> String? {
return CFLocaleCopyDisplayNameForPropertyValue(_cfObject, key.rawValue._cfObject, value._cfObject)?._swiftObject
}
public init(localeIdentifier string: String) {
super.init()
_CFLocaleInit(_cfObject, string._cfObject)
}
public required convenience init?(coder aDecoder: NSCoder) {
guard aDecoder.allowsKeyedCoding else {
preconditionFailure("Unkeyed coding is unsupported.")
}
guard let identifier = aDecoder.decodeObject(of: NSString.self, forKey: "NS.identifier") else {
return nil
}
self.init(localeIdentifier: String._unconditionallyBridgeFromObjectiveC(identifier))
}
deinit {
_CFDeinit(self)
}
open override func copy() -> Any {
return copy(with: nil)
}
open func copy(with zone: NSZone? = nil) -> Any {
return self
}
override open func isEqual(_ object: Any?) -> Bool {
guard let locale = object as? NSLocale else {
return false
}
return locale.localeIdentifier == localeIdentifier
}
open func encode(with aCoder: NSCoder) {
guard aCoder.allowsKeyedCoding else {
preconditionFailure("Unkeyed coding is unsupported.")
}
let identifier = CFLocaleGetIdentifier(self._cfObject)._nsObject
aCoder.encode(identifier, forKey: "NS.identifier")
}
public static var supportsSecureCoding: Bool {
return true
}
}
extension NSLocale {
open class var current: Locale {
return CFLocaleCopyCurrent()._swiftObject
}
open class var system: Locale {
return CFLocaleGetSystem()._swiftObject
}
}
extension NSLocale {
public var localeIdentifier: String {
return object(forKey: .identifier) as! String
}
open class var availableLocaleIdentifiers: [String] {
return _SwiftValue.fetch(CFLocaleCopyAvailableLocaleIdentifiers()) as? [String] ?? []
}
open class var isoLanguageCodes: [String] {
return _SwiftValue.fetch(CFLocaleCopyISOLanguageCodes()) as? [String] ?? []
}
open class var isoCountryCodes: [String] {
return _SwiftValue.fetch(CFLocaleCopyISOCountryCodes()) as? [String] ?? []
}
open class var isoCurrencyCodes: [String] {
return _SwiftValue.fetch(CFLocaleCopyISOCurrencyCodes()) as? [String] ?? []
}
open class var commonISOCurrencyCodes: [String] {
return _SwiftValue.fetch(CFLocaleCopyCommonISOCurrencyCodes()) as? [String] ?? []
}
open class var preferredLanguages: [String] {
return _SwiftValue.fetch(CFLocaleCopyPreferredLanguages()) as? [String] ?? []
}
open class func components(fromLocaleIdentifier string: String) -> [String : String] {
return _SwiftValue.fetch(CFLocaleCreateComponentsFromLocaleIdentifier(kCFAllocatorSystemDefault, string._cfObject)) as? [String : String] ?? [:]
}
open class func localeIdentifier(fromComponents dict: [String : String]) -> String {
return CFLocaleCreateLocaleIdentifierFromComponents(kCFAllocatorSystemDefault, dict._cfObject)._swiftObject
}
open class func canonicalLocaleIdentifier(from string: String) -> String {
return CFLocaleCreateCanonicalLocaleIdentifierFromString(kCFAllocatorSystemDefault, string._cfObject)._swiftObject
}
open class func canonicalLanguageIdentifier(from string: String) -> String {
return CFLocaleCreateCanonicalLanguageIdentifierFromString(kCFAllocatorSystemDefault, string._cfObject)._swiftObject
}
open class func localeIdentifier(fromWindowsLocaleCode lcid: UInt32) -> String? {
return CFLocaleCreateLocaleIdentifierFromWindowsLocaleCode(kCFAllocatorSystemDefault, lcid)._swiftObject
}
open class func windowsLocaleCode(fromLocaleIdentifier localeIdentifier: String) -> UInt32 {
return CFLocaleGetWindowsLocaleCodeFromLocaleIdentifier(localeIdentifier._cfObject)
}
open class func characterDirection(forLanguage isoLangCode: String) -> NSLocale.LanguageDirection {
let dir = CFLocaleGetLanguageCharacterDirection(isoLangCode._cfObject)
#if os(macOS) || os(iOS)
return NSLocale.LanguageDirection(rawValue: UInt(dir.rawValue))!
#else
return NSLocale.LanguageDirection(rawValue: UInt(dir))!
#endif
}
open class func lineDirection(forLanguage isoLangCode: String) -> NSLocale.LanguageDirection {
let dir = CFLocaleGetLanguageLineDirection(isoLangCode._cfObject)
#if os(macOS) || os(iOS)
return NSLocale.LanguageDirection(rawValue: UInt(dir.rawValue))!
#else
return NSLocale.LanguageDirection(rawValue: UInt(dir))!
#endif
}
}
extension NSLocale {
public struct Key : RawRepresentable, Equatable, Hashable {
public private(set) var rawValue: String
public init(rawValue: String) {
self.rawValue = rawValue
}
public var hashValue: Int {
return rawValue.hashValue
}
public static let identifier = NSLocale.Key(rawValue: "kCFLocaleIdentifierKey")
public static let languageCode = NSLocale.Key(rawValue: "kCFLocaleLanguageCodeKey")
public static let countryCode = NSLocale.Key(rawValue: "kCFLocaleCountryCodeKey")
public static let scriptCode = NSLocale.Key(rawValue: "kCFLocaleScriptCodeKey")
public static let variantCode = NSLocale.Key(rawValue: "kCFLocaleVariantCodeKey")
public static let exemplarCharacterSet = NSLocale.Key(rawValue: "kCFLocaleExemplarCharacterSetKey")
public static let calendar = NSLocale.Key(rawValue: "kCFLocaleCalendarKey")
public static let collationIdentifier = NSLocale.Key(rawValue: "collation")
public static let usesMetricSystem = NSLocale.Key(rawValue: "kCFLocaleUsesMetricSystemKey")
public static let measurementSystem = NSLocale.Key(rawValue: "kCFLocaleMeasurementSystemKey")
public static let decimalSeparator = NSLocale.Key(rawValue: "kCFLocaleDecimalSeparatorKey")
public static let groupingSeparator = NSLocale.Key(rawValue: "kCFLocaleGroupingSeparatorKey")
public static let currencySymbol = NSLocale.Key(rawValue: "kCFLocaleCurrencySymbolKey")
public static let currencyCode = NSLocale.Key(rawValue: "currency")
public static let collatorIdentifier = NSLocale.Key(rawValue: "kCFLocaleCollatorIdentifierKey")
public static let quotationBeginDelimiterKey = NSLocale.Key(rawValue: "kCFLocaleQuotationBeginDelimiterKey")
public static let quotationEndDelimiterKey = NSLocale.Key(rawValue: "kCFLocaleQuotationEndDelimiterKey")
public static let calendarIdentifier = NSLocale.Key(rawValue: "kCFLocaleCalendarIdentifierKey")
public static let alternateQuotationBeginDelimiterKey = NSLocale.Key(rawValue: "kCFLocaleAlternateQuotationBeginDelimiterKey")
public static let alternateQuotationEndDelimiterKey = NSLocale.Key(rawValue: "kCFLocaleAlternateQuotationEndDelimiterKey")
}
public enum LanguageDirection : UInt {
case unknown
case leftToRight
case rightToLeft
case topToBottom
case bottomToTop
}
}
extension NSLocale.Key {
public static func ==(_ lhs: NSLocale.Key, _ rhs: NSLocale.Key) -> Bool {
return lhs.rawValue == rhs.rawValue
}
}
public extension NSLocale {
public static let currentLocaleDidChangeNotification = NSNotification.Name(rawValue: "kCFLocaleCurrentLocaleDidChangeNotification")
}
extension CFLocale : _NSBridgeable, _SwiftBridgeable {
typealias NSType = NSLocale
typealias SwiftType = Locale
internal var _nsObject: NSLocale {
return unsafeBitCast(self, to: NSType.self)
}
internal var _swiftObject: Locale {
return _nsObject._swiftObject
}
}
extension NSLocale : _SwiftBridgeable {
typealias SwiftType = Locale
internal var _swiftObject: Locale {
return Locale(reference: self)
}
}
extension Locale : _CFBridgeable {
typealias CFType = CFLocale
internal var _cfObject: CFLocale {
return _bridgeToObjectiveC()._cfObject
}
}
extension NSLocale : _StructTypeBridgeable {
public typealias _StructType = Locale
public func _bridgeToSwift() -> Locale {
return Locale._unconditionallyBridgeFromObjectiveC(self)
}
}
| [
-1
] |
a259646bdc2aee47a27e01b7c4f7a03526aafd8c | 9fa56474469955b45bf49d9266900cc4ebd4e065 | /projects/Enroute L12/Enroute/FlightsEnrouteView.swift | 3d28a33c3a57bfbd24e83caeaac347fe1d0c38c1 | [
"MIT"
] | permissive | wesmatlock/cs193p | ff04e648f8ea28a279ce44dec99f0db3041dab68 | 7dd9f9493f8ee5f7880a897ed8f1e67c501894e5 | refs/heads/main | 2023-02-08T10:45:40.185763 | 2020-12-23T20:26:18 | 2020-12-23T20:26:18 | 323,633,486 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,264 | swift | import SwiftUI
import CoreData
struct FlightSearch {
var destination: Airport
var origin: Airport?
var airline: Airline?
var inTheAir: Bool = true
}
extension FlightSearch {
var predicate: NSPredicate {
var format = "destination_ = %@"
var args: [NSManagedObject] = [destination] // args could be [Any] if needed
if origin != nil {
format += " and origin_ = %@"
args.append(origin!)
}
if airline != nil {
format += " and airline_ = %@"
args.append(airline!)
}
if inTheAir { format += " and departure != nil" }
return NSPredicate(format: format, argumentArray: args)
}
}
struct FlightsEnrouteView: View {
@Environment(\.managedObjectContext) var context
@State var flightSearch: FlightSearch
var body: some View {
NavigationView {
FlightList(flightSearch)
.navigationBarItems(leading: simulation, trailing: filter)
}
}
@State private var showFilter = false
var filter: some View {
Button("Filter") {
self.showFilter = true
}
.sheet(isPresented: $showFilter) {
FilterFlights(flightSearch: self.$flightSearch, isPresented: self.$showFilter)
.environment(\.managedObjectContext, self.context)
}
}
// if no FlightAware credentials exist in Info.plist
// then we simulate data from KSFO and KLAS (Las Vegas, NV)
// the simulation time must match the times in the simulation data
// so, to orient the UI, this simulation View shows the time we are simulating
var simulation: some View {
let isSimulating = Date.currentFlightTime.timeIntervalSince(Date()) < -1
return Text(isSimulating ? DateFormatter.shortTime.string(from: Date.currentFlightTime) : "")
}
}
struct FlightList: View {
@FetchRequest var flights: FetchedResults<Flight>
init(_ flightSearch: FlightSearch) {
let request = Flight.fetchRequest(flightSearch.predicate)
_flights = FetchRequest(fetchRequest: request)
}
var body: some View {
List {
ForEach(flights, id: \.ident) { flight in
FlightListEntry(flight: flight)
}
}
.navigationBarTitle(title)
}
private var title: String {
let title = "Flights"
if let destination = flights.first?.destination.icao {
return title + " to \(destination)"
} else {
return title
}
}
}
struct FlightListEntry: View {
@ObservedObject var flight: Flight
var body: some View {
VStack(alignment: .leading) {
Text(name)
Text(arrives).font(.caption)
Text(origin).font(.caption)
}
.lineLimit(1)
}
var name: String {
return "\(flight.airline.friendlyName) \(flight.number)"
}
var arrives: String {
let time = DateFormatter.stringRelativeToToday(Date.currentFlightTime, from: flight.arrival)
if flight.departure == nil {
return "scheduled to arrive \(time) (not departed)"
} else if flight.arrival < Date.currentFlightTime {
return "arrived \(time)"
} else {
return "arrives \(time)"
}
}
var origin: String {
return "from " + (flight.origin.friendlyName)
}
}
//struct ContentView_Previews: PreviewProvider {
// static var previews: some View {
// FlightsEnrouteView(flightSearch: FlightSearch(destination: "KSFO"))
// }
//}
| [
377065,
377107
] |
09086505b82ff7bc4aeaea8a1057faf6bcc5327f | ca660d5ef708cf51d03e96402673575867224300 | /DontForget/Controllers/CategoryTableViewController.swift | c0ab8f884fed04779d7be33ff2fdd0e980bad97b | [] | no_license | BaghbanSalehi/DontForget | de8616270101c7b8edf6f05cd31d17ccc2027d89 | ddd41e0ccd2c1a3d77374ec46f374077815b9c76 | refs/heads/master | 2020-04-22T10:07:02.633894 | 2019-02-26T13:59:26 | 2019-02-26T13:59:26 | 170,294,163 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,015 | swift | //
// CategoryTableViewController.swift
// DontForget
//
// Created by Shayan on 2/20/19.
// Copyright © 2019 Game4Life. All rights reserved.
//
import UIKit
import RealmSwift
class CategoryTableViewController: SwipeViewController {
let realm = try! Realm()
var categories : Results<Category>?
override func viewDidLoad() {
super.viewDidLoad()
loadCategories()
tableView.rowHeight = 80
}
//MARK: - TableView
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return categories?.count ?? 1
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
//sakht cell az superclass
let cell = super.tableView(tableView, cellForRowAt: indexPath)
cell.textLabel?.text = categories?[indexPath.row].name ?? "No Categories Added Yet"
return cell
}
//MARK: - Tb Delegate
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
performSegue(withIdentifier: "goToItems", sender: self)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let destinationVC = segue.destination as! MainTableViewController
// be dast avordan row ke click shode , momkene nil bashe...
if let indexpath = tableView.indexPathForSelectedRow {
destinationVC.selectedCategory = categories?[indexpath.row]
}
}
//MARK: - Data Manipulation
func save(category : Category)
{
do{
try realm.write {
realm.add(category)
}
}catch{
print("error saving categories : \(error)")
}
tableView.reloadData()
}
func loadCategories()
{
categories = realm.objects(Category.self)
}
// Delete Items inja por mishe dakhel superclass emun anjam mishe
override func updateModel(at indexPath: IndexPath) {
if let categoryDeletion = self.categories?[indexPath.row]{
do{
try self.realm.write {
self.realm.delete(categoryDeletion)
}
}catch{
print("error deleting")
}
}
}
//MARK: - Add new category
@IBAction func addButtonPressed(_ sender: UIBarButtonItem) {
var textField = UITextField()
let alert = UIAlertController(title: "Add New Category", message: "", preferredStyle: .alert)
let action = UIAlertAction(title: "Add", style: .default) { (action) in
let newCategory = Category()
newCategory.name = textField.text!
self.save(category: newCategory)
}
alert.addAction(action)
alert.addTextField { (field) in
textField = field
textField.placeholder = "Add a new category"
}
present(alert,animated: true,completion: nil)
}
}
| [
-1
] |
0f89fb502c7d24b1d4acc3c1aaab2b472c9f5742 | 8b3f26ca40b8ba54f1750e3446162885a301f9e8 | /OPS/Services/PartyStateService.swift | ab350a186731e5ca5de4b0804d1a6a267ca1dcaf | [] | no_license | ProjectsHTinc/HSTiOS6 | 34de04efbf5626eea2d9b44dc26257a2d38058c3 | 2d42c9ba3da6f2c57a6a4e3692b17b53870e4a98 | refs/heads/main | 2023-07-10T22:03:39.209975 | 2021-08-16T08:45:42 | 2021-08-16T08:45:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 609 | swift | //
// PartyStateService.swift
// OPS
//
// Created by Happy Sanz Tech on 05/01/21.
//
import Foundation
class PartyStateService: NSObject {
public func callAPIPartyState (user_id:String, onSuccess successCallback: ((_ resp: [PartyStateModel]) -> Void)?,onFailure failureCallback: ((_ errorMessage: String) -> Void)?) {
APIManager.instance.callAPIPartyState(
user_id:user_id, onSuccess: { (resp) in
successCallback?(resp)
},
onFailure: { (errorMessage) in
failureCallback?(errorMessage)
}
)
}
}
| [
-1
] |
276e81500c9c8d8ec7f626fed923e350fb5e186a | cd731c64ec82c4d526c370b72c6810425d86a876 | /FaceTimeDemo/AppDelegate.swift | 2373b7db2cdc16e1c8e604f3688bea5239fd418a | [] | no_license | bearcanyon/FaceTimeDemo | 6e3ad720e4dba05f367a8de680282780cb0f588d | 35233d7929714bf1fb316c496907d67ccf327761 | refs/heads/master | 2021-01-17T18:32:18.081454 | 2016-04-23T13:53:01 | 2016-04-23T13:53:01 | 56,921,652 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,155 | swift | //
// AppDelegate.swift
// FaceTimeDemo
//
// Created by KumagaiNaoki on 2016/04/21.
// Copyright © 2016年 KumagaiNaoki. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
229388,
294924,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
278556,
229405,
352284,
278559,
229408,
278564,
294950,
229415,
229417,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
204856,
229432,
286776,
319544,
286791,
237640,
278605,
286797,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
327814,
131209,
417930,
303241,
311436,
303244,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
278760,
237807,
303345,
286962,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
287032,
155966,
278849,
319809,
319810,
319814,
311623,
319818,
311628,
229709,
287054,
319822,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
279010,
287202,
279015,
172520,
319978,
279020,
172526,
279023,
311791,
172529,
279027,
319989,
164343,
180727,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
287238,
320007,
172550,
172552,
303623,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
172618,
303690,
33357,
287309,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
189039,
189040,
352880,
295538,
172655,
189044,
287349,
172656,
172660,
287355,
287360,
295553,
287365,
311942,
303751,
295557,
352905,
279178,
287371,
311946,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
303773,
164509,
287390,
295583,
172702,
230045,
172705,
303780,
287394,
172707,
287398,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
279231,
287423,
328384,
287427,
312006,
107208,
279241,
107212,
172748,
287436,
172751,
287440,
295633,
303827,
172755,
279255,
172760,
279258,
287450,
213724,
303835,
189149,
303838,
279267,
312035,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
295685,
230154,
33548,
312077,
295695,
295701,
369433,
230169,
295707,
328476,
295710,
230175,
303914,
279340,
205613,
279353,
230202,
312124,
222018,
295755,
377676,
148302,
287569,
303959,
279383,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
304005,
295813,
320391,
213895,
304007,
304009,
304011,
230284,
304013,
213902,
279438,
295822,
189329,
295825,
304019,
189331,
279445,
58262,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
304063,
238528,
304065,
189378,
213954,
156612,
295873,
213963,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
197645,
295949,
230413,
320528,
140312,
295961,
238620,
197663,
304164,
189479,
304170,
238641,
312374,
238652,
238655,
230465,
238658,
296004,
336964,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
164973,
205934,
279661,
312432,
279669,
337018,
189562,
279679,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
165038,
238766,
230576,
304311,
230592,
279750,
312518,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
279788,
320748,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
222525,
296253,
296255,
312639,
230718,
296259,
378181,
238919,
296264,
320840,
230727,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
410987,
230763,
230768,
296305,
312692,
230773,
279929,
181626,
304505,
304506,
181631,
312711,
296331,
288140,
230800,
288144,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
288176,
279985,
173488,
312755,
296373,
279991,
312759,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
280021,
288214,
222676,
239064,
288217,
288218,
280027,
288220,
329177,
239070,
288224,
288226,
370146,
280036,
288229,
280038,
288230,
288232,
280034,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
296439,
288250,
148990,
296446,
402942,
206336,
296450,
321022,
230916,
230919,
214535,
370187,
304651,
304653,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
312938,
280183,
280185,
280188,
280191,
280194,
116354,
280208,
280211,
288408,
280218,
280222,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
280260,
280264,
206536,
206539,
206541,
206543,
280276,
313044,
321239,
280283,
288478,
313055,
321252,
313066,
280302,
288494,
280304,
313073,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
321316,
304932,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
304968,
280393,
280402,
313176,
42842,
280419,
321381,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280458,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
280515,
190403,
296900,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
313340,
288764,
239612,
239617,
313347,
288773,
313358,
305176,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
223303,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
280671,
223327,
149599,
149601,
149603,
321634,
329830,
280681,
313451,
223341,
280687,
313458,
280691,
215154,
313464,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
288936,
100520,
280747,
288940,
280755,
288947,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
280819,
157940,
182517,
125171,
280823,
280825,
280827,
280830,
280831,
280833,
280835,
125187,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
354653,
313700,
280937,
313705,
280940,
190832,
280946,
223606,
313720,
280956,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
297365,
240021,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
305594,
289210,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
281084,
240124,
305662,
305664,
240129,
305666,
240132,
223749,
305668,
281095,
223752,
150025,
338440,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
199262,
338528,
338532,
281190,
199273,
281196,
158317,
19053,
313973,
281210,
297594,
158347,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
199367,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
207661,
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,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
281581,
183277,
322550,
134142,
322563,
175134,
322599,
322610,
314421,
281654,
314427,
207937,
314433,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
298306,
380226,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
306555,
314747,
290174,
298365,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
224657,
306581,
314779,
314785,
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,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282261,
298651,
323229,
282269,
298655,
323231,
61092,
282277,
306856,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
282410,
241450,
306988,
306991,
315184,
323376,
315190,
241464,
282425,
159545,
298811,
307009,
413506,
241475,
307012,
148946,
315211,
282446,
307027,
315221,
282454,
315223,
241496,
323414,
241498,
307035,
307040,
282465,
110433,
241509,
110438,
298860,
110445,
282478,
282481,
110450,
315251,
315249,
315253,
315255,
339838,
282499,
315267,
315269,
241544,
282505,
241546,
241548,
298896,
282514,
298898,
241556,
44948,
298901,
282520,
241560,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
178273,
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,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
315482,
315483,
217179,
192605,
233567,
200801,
299105,
217188,
299109,
307303,
315495,
356457,
307307,
45163,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
241813,
307352,
299164,
184479,
299167,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
323763,
176311,
184503,
307385,
307386,
258235,
176316,
307388,
307390,
299200,
184512,
307394,
307396,
299204,
184518,
307399,
323784,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
291089,
282906,
291104,
233766,
282931,
307508,
315701,
307510,
332086,
151864,
307512,
176435,
307515,
168245,
282942,
307518,
151874,
282947,
282957,
323917,
110926,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
283033,
291226,
242075,
291231,
61855,
283042,
291238,
291241,
127403,
127405,
291247,
127407,
299440,
299444,
127413,
283062,
291254,
194660,
127417,
291260,
283069,
127421,
127424,
127429,
127431,
283080,
176592,
315856,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
291299,
127463,
242152,
291305,
127466,
176620,
291314,
291317,
135672,
233979,
291323,
291330,
283142,
127497,
135689,
233994,
291341,
233998,
234003,
234006,
127511,
152087,
283161,
234010,
135707,
242202,
135710,
242206,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
70213,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
299655,
373383,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
225998,
299726,
226002,
226005,
119509,
226008,
242396,
299740,
201444,
299750,
283368,
234219,
283372,
381677,
226037,
283382,
234231,
316151,
234236,
226045,
234239,
242431,
209665,
234242,
242436,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
234264,
201496,
234266,
283421,
234269,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
283452,
160572,
234302,
234307,
242499,
234309,
292433,
234313,
316233,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
201557,
234329,
234333,
308063,
234336,
234338,
242530,
349027,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
234370,
291714,
291716,
234373,
226182,
234375,
226185,
308105,
234379,
234384,
234388,
234390,
226200,
234393,
209818,
324504,
234396,
324508,
234398,
291742,
308123,
234401,
291747,
291748,
234405,
291750,
234407,
324518,
324520,
234410,
291754,
226220,
324522,
234414,
324527,
291760,
234417,
201650,
324531,
291756,
226230,
234422,
275384,
324536,
234428,
291773,
226239,
234431,
242623,
234434,
324544,
324546,
226245,
234437,
234439,
324548,
234443,
291788,
193486,
275406,
193488,
234446,
234449,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
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,
234563,
316483,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
275545,
234585,
242777,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
234607,
160879,
275569,
234610,
300148,
234614,
398455,
234618,
275579,
144506,
234620,
234623,
226433,
234627,
275588,
234629,
234634,
234636,
177293,
234640,
275602,
234643,
226453,
275606,
308373,
275608,
234647,
234648,
234650,
308379,
283805,
324757,
234653,
300189,
234657,
324766,
324768,
119967,
283813,
234661,
300197,
234664,
242852,
275626,
234667,
316596,
308414,
234687,
316610,
300226,
234692,
283844,
300229,
308420,
308418,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
161003,
300267,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
283904,
292097,
300289,
300292,
300294,
275719,
300299,
177419,
283917,
242957,
275725,
177424,
300301,
349464,
283939,
259367,
283951,
292143,
300344,
226617,
283963,
243003,
226628,
283973,
300357,
177482,
283983,
316758,
357722,
316766,
316768,
218464,
292192,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
284076,
144812,
144814,
284084,
144820,
284087,
292279,
144826,
144828,
144830,
144832,
284099,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
259567,
300527,
308720,
226802,
316917,
308727,
292343,
300537,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
194101,
284215,
194103,
284218,
226877,
284223,
284226,
243268,
284228,
226886,
284231,
128584,
292421,
284234,
366155,
276043,
317004,
284238,
226895,
284241,
194130,
284243,
276052,
276053,
284245,
284247,
300628,
235097,
243290,
284251,
284249,
284253,
317015,
284255,
300638,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
276086,
292470,
284278,
292473,
284283,
276093,
284286,
276095,
292479,
284288,
276098,
325250,
284290,
292485,
284292,
292481,
284297,
317066,
284299,
317068,
276109,
284301,
284303,
276114,
284306,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
276137,
284329,
284331,
317098,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
276160,
358080,
284354,
358083,
276166,
284358,
358089,
276170,
284362,
276175,
284368,
276177,
317138,
358098,
284370,
284372,
284377,
276187,
284379,
284381,
284384,
284386,
358116,
276197,
317158,
284392,
325353,
284394,
358122,
284397,
276206,
284399,
358128,
358126,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
284418,
317187,
358146,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
186139,
300828,
300830,
276255,
300832,
284449,
300834,
325408,
227109,
317221,
358183,
186151,
276268,
300845,
194351,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
153417,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
284511,
227175,
292715,
300912,
284529,
292721,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
284564,
358292,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
317353,
276395,
292776,
292784,
276402,
358326,
161718,
276410,
358330,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
301015,
301017,
358360,
292828,
276446,
153568,
276448,
276452,
276455,
292839,
292843,
276460,
276464,
178161,
276466,
227314,
276472,
325624,
317435,
276476,
276479,
276482,
276485,
276490,
292876,
276496,
317456,
317458,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
276539,
235579,
235581,
325692,
178238,
276544,
284739,
292934,
276553,
243785,
350293,
350295,
194649,
227418,
309337,
194654,
227423,
350302,
194657,
227426,
276579,
309346,
309348,
227430,
276583,
350308,
309350,
276586,
309352,
350313,
350316,
276590,
301167,
227440,
350321,
284786,
276595,
301163,
350325,
350328,
292985,
301178,
292989,
301185,
317570,
350339,
292993,
317573,
350342,
227463,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
276638,
350366,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
276689,
309462,
301272,
276699,
309468,
194780,
309471,
301283,
317672,
276713,
317674,
325867,
243948,
194801,
227571,
309491,
276725,
309494,
243960,
227583,
276735,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
276766,
211232,
317729,
276775,
211241,
325937,
276789,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
276843,
293227,
276848,
293232,
186744,
285051,
211324,
227709,
285061,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
317951,
309764,
301575,
121352,
236043,
317963,
342541,
55822,
113167,
277011,
309779,
317971,
309781,
55837,
227877,
227879,
293417,
227882,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
277106,
121458,
170618,
170619,
309885,
309888,
277122,
227975,
285320,
277128,
301706,
334476,
326285,
318094,
318092,
277136,
277139,
227992,
285340,
318108,
227998,
318110,
137889,
383658,
285357,
318128,
277170,
342707,
154292,
277173,
293555,
318132,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
285453,
228113,
285459,
277273,
293659,
326430,
228128,
293666,
285474,
228135,
318248,
277291,
293677,
318253,
285489,
293685,
285494,
301880,
285499,
301884,
293696,
310080,
277314,
277317,
277322,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
277368,
236408,
15224,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
293817,
293820,
203715,
326603,
293849,
293861,
228327,
228328,
228330,
318442,
228332,
277486,
326638,
318450,
293876,
293877,
285686,
302073,
285690,
244731,
121850,
302075,
293882,
293887,
277504,
277507,
277511,
277519,
293908,
293917,
293939,
318516,
277561,
277564,
7232,
310336,
293956,
277573,
228422,
310344,
277577,
293960,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
285792,
203872,
277601,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
285821,
302205,
285824,
392326,
285831,
253064,
302218,
285835,
294026,
384148,
162964,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
285862,
277671,
302248,
64682,
277678,
228526,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
204023,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
228617,
138505,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
277807,
285999,
113969,
277811,
318773,
277816,
318776,
286010,
277819,
294204,
417086,
277822,
286016,
294211,
302403,
384328,
277832,
277836,
294221,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
310659,
294276,
351619,
277892,
327046,
253320,
310665,
318858,
277898,
277894,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
277923,
130468,
228776,
277928,
277932,
310703,
277937,
130486,
310710,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
64966,
245191,
163272,
302534,
310727,
277959,
292968,
302541,
277966,
302543,
277963,
310737,
277971,
277975,
286169,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
286188,
310764,
278000,
278003,
310772,
228851,
278006,
40440,
278009,
212472,
286203,
40443,
228864,
40448,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
302621,
286240,
146977,
187939,
294435,
40484,
40486,
294439,
286248,
294440,
40488,
294443,
286246,
294445,
278057,
40491,
310831,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
228944,
400976,
212560,
40533,
147032,
40537,
278109,
40541,
40544,
40548,
40550,
286312,
286313,
40552,
40554,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
310925,
286354,
278163,
302740,
122517,
278168,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
278227,
229076,
286420,
319187,
286425,
319194,
278235,
229086,
278238,
286432,
294625,
294634,
302838,
319226,
286460,
171774,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
237409,
294776,
360317,
294785,
327554,
40840,
40851,
294803,
188312,
294811,
319390,
294817,
40865,
319394,
294821,
180142,
294831,
188340,
40886,
319419,
294844,
294847,
309354,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
7860398bc498f90e3522cabb0a2d8babc7676002 | 60d13d85f9ccc9629b3635f59062535b86843177 | /Strands/ViewController.swift | a4d40c86e69e54e61cf304e03ee4958693502712 | [] | no_license | cyrke/Astral | 87bb68991e10dd9594102d7f2b808a2d93fdcc0b | b5c425caf23df2195fa099a50cc4b2c469f83177 | refs/heads/master | 2021-01-20T08:14:35.055777 | 2017-05-01T17:25:57 | 2017-05-01T17:25:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 17,362 | swift | //
// ViewController.swift
// testSwift
//
// Created by Caspar Wylie on 02/08/2016.
// Copyright © 2016 Caspar Wylie. All rights reserved.
//
import UIKit
import CoreLocation
import Darwin
import CoreMotion
import MapKit
import Starscream
import SwiftyJSON
class ViewController: UIViewController, LocationDelegate, UIActionDelegate, mapActionDelegate, NetworkResponseDelegate{
//MARK: Component allocation
var misc = Misc();
var camera = Camera();
var scene = Scene();
var location = Location();
var userInterface = UserInterface1();
var motionManager = CMMotionManager();
var map = Map();
var networkSocket = NetworkSocketHandler();
var networkRequest = NetworkRequestHandler();
//MARK: general data
var loggedinUserData = (id: 0, username: "Unknown", fullname: "Unknown", email: "Unknown", password: "");
var firstRender = true;
var thresholdDistRerender = 25.0;
var oldRenderPosition: CLLocation!;
var networkWebSocket: WebSocket!;
var currentLocation: CLLocation!;
var currMapPoint: MKMapPoint!;
var currentHeading: CLHeading!;
var tempStrandMapPoint: MKMapPoint = MKMapPoint();
var mapPoints: [MKMapPoint] = [];
var coordPoints: [CLLocation] = [];
var realStrandIDs: [Int] = [];
var strandFirstComments = JSON("");
var strandDistAndBearingsFromUser: [(distance: Int, bearing: Int)] = [];
func toggleMap(_ isAddingStrand: Bool) {
map.tapMapToPost = isAddingStrand;
if self.view.viewWithTag(3)?.isHidden == false && isAddingStrand == false {
self.view.viewWithTag(3)?.isHidden = true;
}else{
self.view.viewWithTag(3)?.isHidden = false;
}
}
//MARK: network request and response middleware functionality
func renderRelStrands(_ newRender: Bool){
let pxVals = self.map.collectPXfromMapPoints(mapPoints, currMapPoint: currMapPoint);
var currPointPX = pxVals.currPointPX;
var strandValsPX = pxVals.strandValsPX;
self.map.getMapAsIMG({(image) in
let toHideAsSTR = OpenCVWrapper.buildingDetect( &strandValsPX, image: image, currPoint: &currPointPX, pxLength: Int32(pxVals.pxLength),forTapLimit: false);
self.scene.renderStrands(self.mapPoints, currMapPoint: self.currMapPoint,
render: newRender, currentHeading: self.currentHeading, toHide: toHideAsSTR!, comments: self.strandFirstComments, tempStrandMapPoint: self.tempStrandMapPoint);
});
}
//MARK: region data updating requests and response middleware process
func regionDataUpdate(_ currentLocation: CLLocation, currentHeading: CLHeading){
self.currentLocation = currentLocation;
self.currMapPoint = MKMapPointForCoordinate(currentLocation.coordinate);
self.currentHeading = currentHeading;
if(firstRender==true){
self.oldRenderPosition = self.currentLocation;
}
self.strandDistAndBearingsFromUser = [];
var count = 0;
for _ in self.mapPoints{
let distAndBearing = self.location.collectStrandToUserData(currMapPoint.x, point1Y: currMapPoint.y, point2X: mapPoints[count].x, point2Y: mapPoints[count].y);
self.strandDistAndBearingsFromUser.append(distAndBearing);
count += 1;
}
let coordinateRegion: MKCoordinateRegion = self.map.centerToLocationRegion(currentLocation);
self.map.mapView.setRegion(coordinateRegion, animated: false);
let distFromPrevPos = currentLocation.distance(from: self.oldRenderPosition);
if((distFromPrevPos>thresholdDistRerender)||firstRender==true){
self.networkRequest.getRegionData(self.networkWebSocket, currLocation: currentLocation);
}else if(self.scene.strands.count>0){
renderRelStrands(false);
}
}
func regionDataResponse(_ responseStr: String) {
let responseJSON = networkSocket.processResponseAsJSON(responseStr);
var coordsAsCLLocation: [CLLocation] = [];
var realStrandIDs: [Int] = [];
let responseStrandDataKey = "regionStrandData";
let strandFirstCommentsKey = "fComments";
if(responseJSON[responseStrandDataKey].count != 0){
for coordRowCount in 0...responseJSON[responseStrandDataKey].count-1{
let rowLatitude = Double(responseJSON[responseStrandDataKey][coordRowCount]["s_coord_lat"].rawString()!);
let rowLongitude = Double(responseJSON[responseStrandDataKey][coordRowCount]["s_coord_lon"].rawString()!);
let rowAsCLLocation = CLLocation(latitude: CLLocationDegrees(rowLatitude!), longitude: CLLocationDegrees(rowLongitude!));
coordsAsCLLocation.append(rowAsCLLocation);
realStrandIDs.append(responseJSON[responseStrandDataKey][coordRowCount]["s_id"].int!);
}
}
self.mapPoints = self.map.getCoordsAsMapPoints(coordsAsCLLocation);
self.map.updatePins(coordsAsCLLocation);
self.coordPoints = coordsAsCLLocation;
self.oldRenderPosition = self.currentLocation;
self.strandFirstComments = responseJSON[strandFirstCommentsKey];
self.realStrandIDs = realStrandIDs;
self.renderRelStrands(true);
if(firstRender == true){
firstRender = false;
}
}
//MARK: new strand request and response middleware process
var addTempFirst = true;
var phonePitch = 0;
var latestDesiredStrandLocation: CLLocation!;
func renderTempStrandFromMap(_ mapTapCoord: CLLocationCoordinate2D){
let strandLocation = CLLocation(latitude: mapTapCoord.latitude, longitude: mapTapCoord.longitude);
addStrandTemp(strandLocation);
}
func renderTempStrandFromUI(_ tapX: Int, tapY: Int){
var newStrandDistMetres: Double = 0.0;
var bearingDegreesTap: Double = 0.0;
newStrandDistMetres = self.location.getDistFromVerticalTap(Double(tapX), tapY: Double(tapY), phonePitch: Double(self.phonePitch));
if(newStrandDistMetres < 0){
newStrandDistMetres = 3;
}
bearingDegreesTap = self.location.getBearingFromHorizontalTap(Double(tapX));
var strandLocation = location.getPolarCoords(newStrandDistMetres, bearingDegrees: bearingDegreesTap);
let pxVals = self.map.collectPXfromMapPoints([MKMapPointForCoordinate(strandLocation.coordinate)], currMapPoint: MKMapPointForCoordinate(currentLocation.coordinate));
var currentPointPX = pxVals.currPointPX;
var strandDesValPX = pxVals.strandValsPX;
self.map.getMapAsIMG({(image) in
let distLimitPX = Int(OpenCVWrapper.buildingDetect(&strandDesValPX, image: image, currPoint: ¤tPointPX, pxLength: Int32(pxVals.pxLength), forTapLimit: true)!)!;
if(distLimitPX > -1){
let distLimitMetres = (distLimitPX / 2)-2;
strandLocation = self.location.getPolarCoords(Double(distLimitMetres), bearingDegrees: bearingDegreesTap);
}
self.addStrandTemp(strandLocation);
});
}
func addStrandTemp(_ strandLocation: CLLocation){
self.latestDesiredStrandLocation = strandLocation;
self.userInterface.showTapFinishedOptions();
tempStrandMapPoint = MKMapPointForCoordinate(strandLocation.coordinate);
let currentMapPoint = MKMapPointForCoordinate(currentLocation.coordinate);
map.updateSinglePin(strandLocation, temp: true);
self.scene.renderSingleStrand(0, mapPoint: tempStrandMapPoint, currMapPoint: currentMapPoint, strandDisplayInfo: (" ", " "), render: self.addTempFirst, tempStrand: true);
self.addTempFirst = false;
}
func addStrandReady(_ comment: String){
self.addTempFirst = true;
tempStrandMapPoint = MKMapPoint();
self.scene.removeTempStrand();
CLGeocoder().reverseGeocodeLocation(self.latestDesiredStrandLocation, completionHandler: {(placemarks,err) in
var areaName = "N/A";
if((placemarks?.count)!>0){
let placemark = (placemarks?[0])! as CLPlacemark;
areaName = placemark.thoroughfare! + ", " + placemark.locality!;
}
let strandInfo = (comment: comment, author: self.loggedinUserData.username, userID: self.loggedinUserData.id, areaName: areaName);
self.networkRequest.addStrand(self.networkWebSocket, strandLocation: self.latestDesiredStrandLocation,strandDisplayInfo: strandInfo);
});
}
func addedStrandResponse(_ responseStr: String) {
let responseJSON = networkSocket.processResponseAsJSON(responseStr);
let success: Bool = (responseJSON["success"]=="true" ? true: false);
var responseMessage = "Unknown Error. Please try again later.";
if(success == true){
responseMessage = "Successfully posted new strand!";
}
self.networkRequest.getRegionData(self.networkWebSocket, currLocation: currentLocation);
self.userInterface.updateInfoLabel(responseMessage, show: true, hideAfter: 4);
}
func cancelNewStrand() {
self.scene.removeTempStrand();
self.map.cancelTempStrand();
self.addTempFirst = true;
}
//MARK: retrieve user owned strands request and response middleware process
func requestUserStrands() {
networkRequest.getUserStrands(self.networkWebSocket, userID: self.loggedinUserData.id);
}
func userStrandsResponse(_ responseStr: String) {
let responseJSON = networkSocket.processResponseAsJSON(responseStr);
self.userInterface.populateUserStrands(responseJSON["strands"], firstComments: responseJSON["fComments"]);
}
//MARK: new user sign up / profile edit request and response middleware process
func updateUserDataRequest(_ username: String, password: String, fullname: String, email: String) {
networkRequest.updateUserDataRequest(self.networkWebSocket, username: username, password: password, fullname: fullname, email: email, userID: loggedinUserData.id);
}
func updatedUserDataResponse(_ responseStr: String) {
let responseJSON = networkSocket.processResponseAsJSON(responseStr);
let success: Bool = (responseJSON["success"]=="true" ? true: false);
if(success==true){
userInterface.hideAnyViews();
if(loggedinUserData.id > 0){
loggedinUserData.username = responseJSON["dataUsed"]["username"].string!;
loggedinUserData.fullname = responseJSON["dataUsed"]["fullname"].string!;
loggedinUserData.email = responseJSON["dataUsed"]["email"].string!;
loggedinUserData.password = responseJSON["dataUsed"]["password"].string!;
userInterface.loggedinUserData = self.loggedinUserData;
}
}
self.userInterface.updateInfoLabel(responseJSON["errorMsg"].string!, show: true, hideAfter: 5);
}
//MARK: User login request and response middleware process
func loginRequest(_ username: String, password: String) {
networkRequest.loginUserRequest(self.networkWebSocket, username: username, password: password);
}
func userLoggedinResponse(_ responseStr: String) {
let responseJSON = networkSocket.processResponseAsJSON(responseStr);
var responseMessage = "Incorrect username or password.";
if(responseJSON["success"].rawString()! == "true"){
userInterface.hideAnyViews();
userInterface.renderMenu(true);
loggedinUserData.id = Int(responseJSON["result"]["u_id"].rawString()!)!;
loggedinUserData.username = responseJSON["result"]["u_uname"].string!;
loggedinUserData.fullname = responseJSON["result"]["u_fullname"].string!;
loggedinUserData.email = responseJSON["result"]["u_email"].string!;
loggedinUserData.password = responseJSON["result"]["u_password"].string!;
userInterface.loggedinUserData = self.loggedinUserData;
responseMessage = "Welcome " + loggedinUserData.fullname.components(separatedBy: " ")[0] + "!";
}
userInterface.updateInfoLabel(responseMessage, show: true, hideAfter: 5);
}
func logoutUser() {
loggedinUserData = (id: 0, username: "Unknown", fullname: "Unknown", email: "Unknown", password: "");
self.userInterface.loggedinUserData = self.loggedinUserData;
self.userInterface.updateInfoLabel("You are logged out!", show: true, hideAfter: 2);
}
//MARK: Retrieve strand comments request and response middleware process
func getStrandComments(_ strandID: Int){
networkRequest.getStrandComments(self.networkWebSocket, strandID: realStrandIDs[strandID]);
}
var viewingStrandID = -1;
func chooseStrandComments(_ tapX: Int, tapY: Int){
let locationOfTap = CGPoint(x: tapX, y: tapY);
var strandTapID = -1;
let possStrandsFound = scene.sceneView.hitTest(locationOfTap, options: nil);
if let tappedStrand = possStrandsFound.first?.node.parent?.parent?.parent{
print(tappedStrand.name!)
let startIndex = tappedStrand.name?.index((tappedStrand.name?.startIndex)!, offsetBy: 2);
strandTapID = Int((tappedStrand.name?.substring(from: startIndex!))!)!;
viewingStrandID = strandTapID;
}
if(strandTapID != -1){
getStrandComments(strandTapID);
strandTapID = -1;
}
}
func strandCommentsResponse(_ responseStr: String) {
let responseJSON = networkSocket.processResponseAsJSON(responseStr);
self.userInterface.populateStrandCommentsView(responseJSON["strandComments"]);
}
//MARK: Post new strand comment request and response middleware process
func postNewComment(_ commentText: String) {
if(viewingStrandID
!= -1){
networkRequest.postComment(self.networkWebSocket, strandID: realStrandIDs[viewingStrandID], username: loggedinUserData.username, commentText: commentText);
}
}
func postedCommentResponse(_ responseStr: String) {
let responseJSON = networkSocket.processResponseAsJSON(responseStr);
self.userInterface.updateInfoLabel("Successfully Posted!", show: true, hideAfter: 2);
self.getStrandComments(self.viewingStrandID);
}
//MARK: Delete strand request and response middleware process
func deleteStrandRequest(_ realID: Int){
networkRequest.deleteStrand(self.networkWebSocket, strandID: realID);
}
func deletedStrandResponse(_ responseStr: String) {
let responseJSON = networkSocket.processResponseAsJSON(responseStr);
let success: Bool = (responseJSON["success"]=="true" ? true: false);
self.userInterface.updateInfoLabel("Successfully Deleted!", show: true, hideAfter: 2);
self.userInterface.closeSingleStrandInfoViewWrap();
self.requestUserStrands();
self.networkRequest.getRegionData(self.networkWebSocket, currLocation: currentLocation);
}
//MARK: Main stem
override func viewDidLoad() {
//Initilize location component
location.delegateLoc = self;
location.initLocation();
//Initilize camera component
let capDevice = camera.initilizeCamera();
camera.startCameraFeed(capDevice, view: self.view);
//Initilize scene component
scene.renderSceneLayer(self.view);
scene.renderSceneEssentials();
//Initilize Map component
map.renderMap(self.view);
map.mapActionDelegate = self;
self.view.viewWithTag(3)?.isHidden = true;
//Initilize UI component
userInterface.renderAll(self.view);
userInterface.actionDelegate = self;
userInterface.updateInfoLabel("Please calibrate your phone by twisting it around", show: true, hideAfter: 4);
//Initilize Motion Handler
motionManager.deviceMotionUpdateInterval = 1.0 / 60.0;
motionManager.startDeviceMotionUpdates(
using: CMAttitudeReferenceFrame.xMagneticNorthZVertical,
to: OperationQueue.current!,
withHandler: {
(gyroData: CMDeviceMotion?, NSError) ->Void in
let mData: CMAttitude = gyroData!.attitude;
self.phonePitch = 90 - Int(mData.pitch * (180 / M_PI));
self.scene.rotateCamera(mData);
if(NSError != nil){
print("\(NSError)");
}
});
//Initilize Network socket component
networkWebSocket = networkSocket.connectWebSocket();
networkSocket.networkResponseDelegate = self;
networkSocket.ui = userInterface;
super.viewDidLoad();
}
}
| [
-1
] |
01bb07fe564bfeaa4d4006c0f453a1512ef59f1c | 028cf4ac0075ee53628cc9808c40c1f26be95ddf | /Sources/Crypto/Keys/EC/BoringSSL/EllipticCurve_boring.swift | 19716c669e78d09f17cd7d9eef3ba55375b09753 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Fonta1n3/K1 | 6c7ae82ac47a23d15480380cf8004faf64e1e9d8 | 6cba2efead2df44f5b3150ace34d9b829823103f | refs/heads/main | 2023-04-10T09:50:40.239071 | 2021-04-11T15:08:28 | 2021-04-11T15:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,413 | swift | //===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftCrypto open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftCrypto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
@_implementationOnly import CCryptoBoringSSL
/// A wrapper around BoringSSL's EC_GROUP object that handles reference counting and
/// liveness.
@usableFromInline
class BoringSSLEllipticCurveGroup: EllipticCurveGroup {
/* private but usableFromInline */ @usableFromInline var _group: OpaquePointer
@usableFromInline
init(_ curve: CurveName) throws {
guard let group = CCryptoBoringSSL_EC_GROUP_new_by_curve_name(curve.baseNID) else {
throw CryptoKitError.internalBoringSSLError()
}
self._group = group
}
deinit {
CCryptoBoringSSL_EC_GROUP_free(self._group)
}
}
// MARK: - Helpers
extension BoringSSLEllipticCurveGroup {
@usableFromInline
var coordinateByteCount: Int {
return (Int(CCryptoBoringSSL_EC_GROUP_get_degree(self._group)) + 7) / 8
}
@usableFromInline
func makeUnsafeOwnedECKey() throws -> OpaquePointer {
guard let key = CCryptoBoringSSL_EC_KEY_new(),
CCryptoBoringSSL_EC_KEY_set_group(key, self._group) == 1 else {
throw CryptoKitError.internalBoringSSLError()
}
return key
}
@inlinable
func withUnsafeGroupPointer<T>(_ body: (OpaquePointer) throws -> T) rethrows -> T {
return try body(self._group)
}
@usableFromInline
var order: ArbitraryPrecisionInteger {
// Groups must have an order.
let baseOrder = CCryptoBoringSSL_EC_GROUP_get0_order(self._group)!
return try! ArbitraryPrecisionInteger(copying: baseOrder)
}
/// An elliptic curve can be represented in a Weierstrass form: `y² = x³ + ax + b`. This
/// property provides the values of a and b on the curve.
@usableFromInline
var weierstrassCoefficients: (field: ArbitraryPrecisionInteger, a: ArbitraryPrecisionInteger, b: ArbitraryPrecisionInteger) {
var field = ArbitraryPrecisionInteger()
var a = ArbitraryPrecisionInteger()
var b = ArbitraryPrecisionInteger()
let rc = field.withUnsafeMutableBignumPointer { fieldPtr in
a.withUnsafeMutableBignumPointer { aPtr in
b.withUnsafeMutableBignumPointer { bPtr in
CCryptoBoringSSL_EC_GROUP_get_curve_GFp(self._group, fieldPtr, aPtr, bPtr, nil)
}
}
}
precondition(rc == 1, "Unable to extract curve weierstrass parameters")
return (field: field, a: a, b: b)
}
}
// MARK: - CurveName
extension BoringSSLEllipticCurveGroup {
@usableFromInline
enum CurveName {
case p256
case p384
case p521
}
}
extension BoringSSLEllipticCurveGroup.CurveName {
@usableFromInline
var baseNID: CInt {
switch self {
case .p256:
return NID_X9_62_prime256v1
case .p384:
return NID_secp384r1
case .p521:
return NID_secp521r1
}
}
}
| [
-1
] |
201e895e156379630de143d2a0785c9664fc52a2 | 037d32b1cd0cb7e646ecb585c0276c0f2e1b7c5f | /Sources/FLV/FLVFrameType.swift | 0aeeb1a6501f1e6b9716e905b4f98544371db818 | [
"BSD-3-Clause"
] | permissive | matsuokah/HaishinKit.swift | a32a42c87efe7dd85cc353671b56f148f0978609 | 52989f33cd4bc51cc2589f0092ad45cb64a81db0 | refs/heads/master | 2021-04-06T00:36:14.097885 | 2018-03-11T10:37:51 | 2018-03-11T10:37:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 175 | swift | import Foundation
public enum FLVFrameType: UInt8 {
case key = 1
case inter = 2
case disposable = 3
case generated = 4
case command = 5
}
| [
-1
] |
d42ba100b1e8cd6938f0805518bdc9068327f770 | 74466a23c5da51f275221ce7c01056067669f99b | /CoreNavigation/Core/Class/Navigator/Navigator.swift | b61107776464ccd1a13c786a0e25a11c384291a9 | [
"MIT"
] | permissive | aronbalog/CoreNavigation | 7f80a2f4819223254105596ebae994d8c6030400 | 280e6fa53ffe7c3132a79e8383818ea1bc4b26de | refs/heads/master | 2022-03-21T05:55:05.689906 | 2019-06-03T14:16:40 | 2019-06-03T14:16:40 | 114,574,435 | 84 | 5 | MIT | 2018-09-24T13:30:18 | 2017-12-17T22:48:42 | Swift | UTF-8 | Swift | false | false | 7,128 | swift | import Foundation
import UIKit
class Navigator {
static var queue: OperationQueue = {
let queue = OperationQueue()
queue.maxConcurrentOperationCount = 1
return queue
}()
static func getViewController<T>(configuration: Configuration<T>, completion: @escaping ((T.ToViewController) -> Void), failure: ((Error) -> Void)? = nil) {
switch configuration.request {
case .viewController(let _viewController):
guard let viewController = _viewController as? T.ToViewController else { break }
completion(viewController)
case .viewControllerBlock(let block):
block { result in
switch result {
case .success(let viewController):
completion(viewController)
case .failure(let error):
failure?(error)
}
}
case .viewControllerClassBlock(let block):
block { result in
switch result {
case .success(let viewControllerClass):
let viewController = viewControllerClass.init()
completion(viewController)
case .failure(let error):
failure?(error)
}
}
}
}
static func navigate<T>(with type: NavigationType, configuration: Configuration<T>, completion: (() -> Void)? = nil) {
var operation: NavigationOperation?
func main(handler: @escaping () -> Void) {
func navigation() {
// check if cached
if
let cacheIdentifier = configuration.caching.configuration?.cacheIdentifier,
let viewController = Cache.shared.viewController(for: cacheIdentifier)
{
action(type: type, viewController: viewController, configuration: configuration, handler: handler)
} else {
switch configuration.request {
case .viewController(let viewController):
action(type: type, viewController: viewController, configuration: configuration, handler: handler)
case .viewControllerBlock(let block):
block { result in
switch result {
case .success(let viewController):
action(type: type, viewController: viewController, configuration: configuration, handler: handler)
case .failure(let error):
failure(error: error, configuration: configuration, handler: handler)
}
}
case .viewControllerClassBlock(let block):
block { result in
switch result {
case .success(let viewControllerClass):
let viewController = viewControllerClass.init()
action(type: type, viewController: viewController, configuration: configuration, handler: handler)
case .failure(let error):
failure(error: error, configuration: configuration, handler: handler)
}
}
}
}
completion?()
}
if
let protectionSpace = configuration.protection.protectionSpace,
protectionSpace.shouldProtect() == true
{
let protectionHandler = ProtectionHandler()
protectionHandler.onUnprotect {
navigation()
}
protectionHandler.onCancel { error in
if let error = error {
failure(error: error, configuration: configuration, handler: handler)
}
operation?.finish(true)
}
protectionSpace.protect(protectionHandler)
} else {
navigation()
}
}
if configuration.safeNavigation.isSafe {
let _operation = NavigationOperation(block: main)
operation = _operation
queue.addOperation(_operation)
} else {
main(handler: {})
}
}
static func action<T>(type: NavigationType, viewController: UIViewController, configuration: Configuration<T>, handler: @escaping () -> Void) {
bindViewControllerEvents(to: viewController, with: configuration)
cacheViewControllerIfNeeded(viewController: viewController, with: configuration)
prepareForStateRestorationIfNeeded(viewController: viewController, with: configuration)
if let viewController = viewController as? AbstractDataReceivable {
let dataPromise = DataPromise(dataPassing: configuration.dataPassing)
func passData(_ data: T.DataType?) {
viewController.didReceiveAbstractData(data)
let result = T.init(toViewController: viewController as! T.ToViewController, data: data)
configuration.successBlocks.forEach { $0(result) }
}
switch dataPromise {
case .sync(let data):
passData(data)
case .async(let dataBlock):
dataBlock(passData)
case .none:
()
}
} else {
let result = T.init(toViewController: viewController as! T.ToViewController, data: nil)
configuration.successBlocks.forEach { $0(result) }
}
switch type {
case .push:
push(viewController, with: configuration, completion: handler)
case .present:
present(viewController, with: configuration, completion: handler)
}
}
static func failure<T>(error: Error, configuration: Configuration<T>, handler: @escaping () -> Void) {
configuration.failureBlocks.forEach { $0(error) }
handler()
}
static func viewControllerToNavigate<T>(_ viewController: UIViewController, with configuration: Configuration<T>) -> UIViewController {
return configuration.queue.sync(execute: { () -> UIViewController in
guard let embeddingType = configuration.embedding.embeddingType else {
return viewController
}
let viewControllerToNavigate: UIViewController = {
switch embeddingType {
case .embeddingProtocol(let aProtocol):
return aProtocol.embed(viewController)
case .navigationController:
return UINavigationController(rootViewController: viewController)
}
}()
prepareForStateRestorationIfNeeded(viewController: viewControllerToNavigate, with: configuration)
return viewControllerToNavigate
})
}
}
| [
-1
] |
1039674868ada80dac50e34075d2ae295c4802dc | a4e0fb90ea6bd3804ff074f142ace1f86fc7d7f2 | /proyecto/addonpayments/ViewController.swift | 03721c2171d2e411ec064158c8b8be13cde3650b | [
"MIT"
] | permissive | AddonPayments/ios-sdk | 8d54f0108eec09d618e92558a1d02eb423593323 | b78f1dbef13ad5e0af31f3e1348fdd5f8c8733b5 | refs/heads/master | 2020-12-20T04:46:58.553676 | 2020-01-24T12:11:00 | 2020-01-24T12:11:00 | 235,966,391 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 333 | swift | //
// ViewController.swift
// addonpayments
//
// Created by Comercia on 2020.
// Copyright © 2020 Addon Payments. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
| [
262528,
385282,
398203,
327555,
330770,
158612,
393749,
188950,
319899,
155424,
262561,
324512,
345378,
396707,
436128,
245024,
333223,
354729,
242346,
125227,
273710,
380334,
372017,
262453,
354108,
397117,
262471,
323016,
326600,
349130,
340943,
330960,
324564,
146645,
257750,
377048,
354654,
362847,
354144,
398308,
247652,
247653,
247655,
253928,
124914,
349174,
381179
] |
4e0fa5a7a0dbecf7006b029988b72f822ee82038 | 2f2fc6405c7914203dd7f9920378d0c26c54a54a | /Shared/Source/FloatingTextField.swift | 3b6aa309215eb3821f8746390467b841d378f9e9 | [] | no_license | nitanta/FloatingTextField | 25f321f828fc20adc628527f0d2bf7e1510f060a | 6126df0618f1038ec18e8d0e7151dad07098d657 | refs/heads/main | 2023-04-05T22:24:17.510914 | 2021-04-21T12:36:21 | 2021-04-21T12:36:21 | 360,150,117 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,827 | swift | //
// FloatingTextField.swift
// FloatingTextField-Swiftui (iOS)
//
// Created by ebpearls on 4/21/21.
//
import SwiftUI
typealias SeparatorStringFormat = (separator: String, chunk: Int, limit: Int)
struct FloatingTextField: View {
let title: String
@State var isSecureField = false
@Binding var text: String
@Binding var displayError: Error?
var isPassworder: Bool = false
var isPicker: Bool = false
var formatting: SeparatorStringFormat? = nil
var normalTextFont: Font = Font(UIFont.systemFont(ofSize: 14))
var floatingTextFont: Font = Font(UIFont.systemFont(ofSize: 12))
var errorColor: Color = Color.red
var normalTextColor: Color = Color.black
var floatingTextColor: Color = Color.gray
var dividerColor: Color = Color.black
var body: some View {
VStack(alignment: .leading, spacing: 10) {
ZStack(alignment: .leading) {
Text(title)
.font($text.wrappedValue.isEmpty ? normalTextFont : floatingTextFont)
.foregroundColor(displayError != nil ? errorColor : ($text.wrappedValue.isEmpty ? normalTextColor : floatingTextColor))
.offset(y: $text.wrappedValue.isEmpty ? 0 : -30)
.scaleEffect($text.wrappedValue.isEmpty ? 1 : 0.94, anchor: .leading)
HStack {
if !isSecureField {
if #available(iOS 14.0, *) {
TextField("", text: $text)
.font(normalTextFont)
.foregroundColor(displayError != nil ? errorColor : normalTextColor)
.disabled(isPicker)
.onChange(of: text) { (value) in
guard formatting != nil else { return }
self.text = value.creditCardFormatting(separator: formatting!.separator, chunkSize: formatting!.chunk, limit: formatting!.limit)
}
} else {
TextField("", text: $text)
.font(normalTextFont)
.foregroundColor(displayError != nil ? errorColor : normalTextColor)
.disabled(isPicker)
}
} else {
SecureField("", text: $text)
.font(normalTextFont)
.foregroundColor(displayError != nil ? errorColor :normalTextColor)
}
if isPassworder {
Button(action: {
self.isSecureField.toggle()
}) {
Text(isSecureField ? Constants.show : Constants.hide)
.font(normalTextFont)
.foregroundColor(displayError != nil ? errorColor :floatingTextColor)
}
}
if isPicker {
Button(action: {}) {
Image(systemName: "chevron.down")
.resizable()
.aspectRatio(contentMode: .fit)
.clipped()
.frame(width: 20, height: 10, alignment: .center)
.foregroundColor(normalTextColor)
}
.disabled(isPicker)
}
}
}
.padding(.top, 15)
.animation(nil)
Divider()
.frame(height: 2.0, alignment: .center)
.background(displayError != nil ? errorColor : dividerColor)
if displayError != nil {
Text(verbatim: displayError!.localizedDescription)
.font(floatingTextFont)
.foregroundColor(errorColor)
}
}
}
}
extension FloatingTextField {
struct Constants {
static let show = "SHOW"
static let hide = "HIDE"
}
}
#if DEBUG
struct FloatingTextField_Previews: PreviewProvider {
static var previews: some View {
FloatingTextField(title: "Email", isSecureField: false, text: .constant(""), displayError: .constant(nil), isPassworder: false)
}
}
#endif
| [
-1
] |
441c7627fc76cdf73fb38a85e8c392ee3ac02c8d | 5a7db0533c05a912d50cf9372cbdb264d1960fc3 | /Westeros/Controllers/HousesViewController.swift | c303d22a395e667266375b2141230c7d00ef599d | [] | no_license | otgerpeidro/westerosOtger | 7759ec3b8471b4e95d72ff187788c0b1af984cd2 | 9a1cebf1066b40ac2340d80299e222f4f0c7b077 | refs/heads/master | 2019-08-29T11:53:40.620058 | 2017-12-23T12:21:06 | 2017-12-23T12:21:06 | 97,586,795 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,903 | swift | //
// HousesViewController.swift
// Westeros
//
// Created by Otger Peidro on 15/10/2017.
// Copyright © 2017 OtgerPeidro. All rights reserved.
//
import UIKit
class HousesViewController: UITableViewController {
let model : [House]
init(model: [House]){
self.model = model
super.init(nibName: nil, bundle: nil)
title = "Westeros"
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView,
numberOfRowsInSection section: Int) -> Int {
return model.count
}
override func tableView(_ tableView: UITableView,
cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cellID = "HouseCell"
// Descubrir cuala es la casa que tenemos que mostrar
let house = model[indexPath.row]
// Crear una celda
var cell = tableView.dequeueReusableCell(withIdentifier: cellID)
if cell == nil{
// La creo a pelo
cell = UITableViewCell(style: .default, reuseIdentifier: cellID)
}
// Sincronizar House -> Cell
cell?.imageView?.image = house.sigil.image
cell?.textLabel?.text = house.name
return cell!
}
// MARK: - Table view delegate
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
// Averiguamos cuala es la casa
let house = model[indexPath.row]
// la mostramos
let houseVC = HouseViewController(model: house)
navigationController?.pushViewController(houseVC, animated: true)
}
}
| [
-1
] |
fe1572a685dd748447bd6e92ff5a55e3e395ee3e | fa67801410a63180e03790e3a44e8653b68df86a | /SimpleCalc/main.swift | 67d3288c497a31e41bfce67eb22028555c37f2ff | [] | no_license | ardenkim/simple-calc | 81eb7f6f489a243a5bf5d55b42909eaf0ec7deeb | 4e3cdf6bfad6989c6ff031fab017b2551d82fb8d | refs/heads/master | 2021-07-11T00:44:28.904676 | 2017-10-10T17:40:37 | 2017-10-10T17:40:37 | 106,333,065 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,676 | swift | //
// main.swift
// SimpleCalc
//
// Created by Arden Kim on 10/9/17.
//
import Foundation
print("Enter an expression separated by returns: ")
let response = readLine(strippingNewline: true)!
var inputArray = response.split(separator: " ")
if (inputArray.count == 1) {
let num1 = Double(UInt.init(response)!)
let operand = readLine(strippingNewline: true)!
let num2 = Double(UInt.init(readLine(strippingNewline: true)!)!)
var result = 0.0
var valid = true
switch operand {
case "+":
result = num1 + num2
case "-":
result = num1 - num2
case "*":
result = num1 * num2
case "/":
result = num1 / num2
case "%":
result = num1.truncatingRemainder(dividingBy: num2)
default:
valid = false
print("invalid operation")
}
if (valid) {
print("Result: \(result)")
}
} else {
let numCount = inputArray.count - 1
let operand = inputArray[numCount]
switch operand {
case "count":
print(numCount)
case "avg":
var total = 0.0
for i in 0 ..< numCount {
total += Double(UInt.init(inputArray[i])!)
}
let avg = total / Double(numCount)
print(avg)
case "fact":
if (numCount != 1) {
print("Invalid operation")
} else {
let numInt = Int.init(inputArray[0])!
var fact = 1
for i in 1 ... numInt {
fact *= i
}
print(fact)
}
default:
print("Invalid operation")
}
}
| [
-1
] |
13822ad69837cc5e236d93af54af88a3904065d9 | edea877e53a86b720d93241eba593bb91f0e5bdf | /SwaggerClient/Classes/Swaggers/Models/SFInlineResponse2001Model.swift | dc4247447b550cea2357f4800f7e0190779cd537 | [] | no_license | mavieth/SalesforceSwiftClient | cc68c94344a1a28dae7daa049bd50a94bb2c0282 | 271404d988b9915866b516d4c5690c873a035770 | refs/heads/master | 2020-11-26T17:38:16.110675 | 2019-12-20T00:47:29 | 2019-12-20T00:47:29 | 229,161,243 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,373 | swift | //
// SFInlineResponse2001Model.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
public struct SFInlineResponse2001Model: Codable {
public var _id: Int
public var affectsAll: Bool?
public var isCore: Bool?
public var serviceKeys: [String]?
public var instanceKeys: [String]?
public var incidentImpacts: [SFIncidentsIncidentImpactsModel]?
public var incidentEvents: [SFIncidentsIncidentEventsModel]?
public var createdAt: String?
public var updatedAt: String?
public init(_id: Int, affectsAll: Bool?, isCore: Bool?, serviceKeys: [String]?, instanceKeys: [String]?, incidentImpacts: [SFIncidentsIncidentImpactsModel]?, incidentEvents: [SFIncidentsIncidentEventsModel]?, createdAt: String?, updatedAt: String?) {
self._id = _id
self.affectsAll = affectsAll
self.isCore = isCore
self.serviceKeys = serviceKeys
self.instanceKeys = instanceKeys
self.incidentImpacts = incidentImpacts
self.incidentEvents = incidentEvents
self.createdAt = createdAt
self.updatedAt = updatedAt
}
public enum CodingKeys: String, CodingKey {
case _id = "id"
case affectsAll
case isCore
case serviceKeys
case instanceKeys
case incidentImpacts = "IncidentImpacts"
case incidentEvents = "IncidentEvents"
case createdAt
case updatedAt
}
}
| [
-1
] |
26ec76c7c1952dd6e16758a23794424e8a12f8b7 | d03e78b1b8d509a30a7208926030f9f3bba78ad7 | /GoogleClient/YouTube/YoutubeLiveStreamListResponse.swift | 0c46cb07206f563dab296865db0ddaeb7668d9fa | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | mitchellporter/GoogleAPISwiftClient | 1a0a343a178d260a6b811d739ca7a06c3a36e81a | a5673572ffacdae2d9396b596ee9271f3aaf048f | refs/heads/master | 2021-01-18T20:26:23.205203 | 2016-02-28T14:40:54 | 2016-02-28T14:40:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,877 | swift | //
// YoutubeLiveStreamListResponse.swift
// GoogleAPISwiftClient
//
// Created by Matthew Wyskiel on 2/27/16.
// Copyright © 2016 Matthew Wyskiel. All rights reserved.
//
import Foundation
import ObjectMapper
public class YoutubeLiveStreamListResponse: GoogleObjectList {
public typealias Type = YoutubeLiveStream
/// A list of live streams that match the request criteria.
public var items: [Type]!
public var tokenPagination: YoutubeTokenPagination!
/// Identifies what kind of resource this is. Value: the fixed string "youtube#liveStreamListResponse".
public var kind: String = "youtube#liveStreamListResponse"
/// The token that can be used as the value of the pageToken parameter to retrieve the next page in the result set.
public var nextPageToken: String!
public var pageInfo: YoutubePageInfo!
/// The visitorId identifies the visitor.
public var visitorId: String!
/// Etag of this resource.
public var etag: String!
/// Serialized EventId of the request which produced this response.
public var eventId: String!
/// The token that can be used as the value of the pageToken parameter to retrieve the previous page in the result set.
public var prevPageToken: String!
public required init?(_ map: Map) {
}
public func mapping(map: Map) {
items <- map["items"]
tokenPagination <- map["tokenPagination"]
kind <- map["kind"]
nextPageToken <- map["nextPageToken"]
pageInfo <- map["pageInfo"]
visitorId <- map["visitorId"]
etag <- map["etag"]
eventId <- map["eventId"]
prevPageToken <- map["prevPageToken"]
}
public required init(arrayLiteral elements: Type...) {
items = elements
}
public typealias Generator = IndexingGenerator<[Type]>
public func generate() -> Generator {
let objects = items as [Type]
return objects.generate()
}
public subscript(position: Int) -> Type {
return items[position]
}
}
| [
-1
] |
bef8db8512af0a3b57a81094b624f42c965422cd | 5575ec731b2ee0f8a9ceae1ae423d632216370b4 | /adaptive-arp-rt/AdaptiveArpRtiOS/BaseViewController.swift | e8f62ef11c87b741623a629ce211ccad6038271c | [
"Apache-2.0"
] | permissive | AdaptiveMe/adaptive-arp-darwin | b8b5be2a9bbb148d831f04d24880d980bef1f023 | 17f4135d30c7a70352c1764a110be5983c363d8f | refs/heads/master | 2020-05-17T13:03:55.513530 | 2015-11-06T12:07:13 | 2015-11-06T12:07:13 | 22,501,158 | 2 | 1 | null | 2016-02-10T22:45:19 | 2014-08-01T08:19:33 | Swift | UTF-8 | Swift | false | false | 6,377 | swift | /*
* =| ADAPTIVE RUNTIME PLATFORM |=======================================================================================
*
* (C) Copyright 2013-2014 Carlos Lozano Diez t/a Adaptive.me <http://adaptive.me>.
*
* 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.
*
* Original author:
*
* * Carlos Lozano Diez
* <http://github.com/carloslozano>
* <http://twitter.com/adaptivecoder>
* <mailto:[email protected]>
*
* Contributors:
*
* * Ferran Vila Conesa
* <http://github.com/fnva>
* <http://twitter.com/ferran_vila>
* <mailto:[email protected]>
*
* =====================================================================================================================
*/
import UIKit
import AVKit
import AdaptiveArpApi
public class BaseViewController : UIViewController {
/// Maintain a static reference to current and previous views
public struct ViewCurrent {
private static var instance : UIViewController?
public static func getView() -> UIViewController? {
return instance
}
static func setView(view : UIViewController) {
instance = view
}
}
public struct ViewPrevious {
private static var instance : UIViewController?
public static func getView() -> UIViewController? {
return instance
}
static func setView(view : UIViewController) {
instance = view
}
}
public override func viewDidLoad() {
super.viewDidLoad()
}
override public func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
if ViewPrevious.getView()==nil && ViewCurrent.getView()==nil {
ViewCurrent.setView(self)
} else if (ViewCurrent.getView() != nil) {
ViewPrevious.setView(ViewCurrent.getView()!)
ViewCurrent.setView(self)
}
}
public override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
/// TODO - delegate to HTML app
return UIInterfaceOrientationMask.Portrait
}
override public func shouldAutorotate() -> Bool {
/// TODO - delegate to HTML app
return false
}
public func showInternalBrowser(titleLabel:String, backLabel:String, url : NSURL, showNavBar : Bool, showAnimated : Bool = true, modal : Bool = false) -> Bool {
objc_sync_enter(self)
let properties = NavigationProperties(navigationBarHidden: showNavBar, navigationBarTitle: titleLabel, navigationBarBackLabel: backLabel, navigationUrl: url)
dispatch_async(dispatch_get_main_queue()) {
//var browserView : BrowserViewController = BrowserViewController(navigationBarHidden: !properties.navigationBarHidden, navigationBarTitle: properties.navigationBarTitle, navigationBarBackLabel: properties.navigationBarBackLabel, navigationUrl: properties.navigationUrl!, nibName: self.nibName, bundle: self.nibBundle)
let browserView : BrowserViewController = BrowserViewController()
browserView.navigationBarHidden = !properties.navigationBarHidden
browserView.navigationBarTitle = properties.navigationBarTitle
browserView.navigationBarBackLabel = properties.navigationBarBackLabel
browserView.navigationUrl = properties.navigationUrl
browserView.configureNavigation()
if modal {
// TODO: present the top bar when presenting modal view controllers
self.navigationController!.presentViewController(browserView, animated: true, completion: nil)
} else {
self.navigationController!.pushViewController(browserView, animated: showAnimated)
}
}
if showAnimated {
NSThread.sleepForTimeInterval(0.750)
}
objc_sync_exit(self)
return true
}
public func showInternalMedia(url : NSURL, showAnimated : Bool = true) -> Bool {
objc_sync_enter(self)
dispatch_async(dispatch_get_main_queue()) {
//var mediaView : MediaViewController = MediaViewController(url: url, nibName: self.nibName, bundle: self.nibBundle)
let mediaView : MediaViewController = MediaViewController()
mediaView.setAVPlayer(url)
self.navigationController!.presentViewController(mediaView, animated: showAnimated, completion: nil)
}
if showAnimated {
NSThread.sleepForTimeInterval(0.750)
}
objc_sync_exit(self)
return true
}
public override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if (segue.identifier == "showBrowser" && segue.destinationViewController is BrowserViewController) {
let browserView : BrowserViewController = segue.destinationViewController as! BrowserViewController
let properties : NavigationProperties = sender as! NavigationProperties
browserView.navigationBarBackLabel = properties.navigationBarBackLabel
browserView.navigationBarHidden = !properties.navigationBarHidden
browserView.navigationBarTitle = properties.navigationBarTitle
browserView.navigationUrl = properties.navigationUrl
//browserView.configureNavigation()
ViewCurrent.setView(browserView)
} else if (segue.identifier == "showMedia" && segue.destinationViewController is MediaViewController) {
let mediaView : MediaViewController = segue.destinationViewController as! MediaViewController
ViewCurrent.setView(mediaView)
}
}
} | [
-1
] |
c49381bb4e38b087837b78786ae5aeeb6ed5dee4 | 35f3f5311883a6bcce5b9ed2aa593631db64ffe5 | /Avengers/Avengers/Models/Avenger.swift | e933c427c464266a1ec8de8628e829c3114874d0 | [] | no_license | iMartin111/Avengers | 8310bc4fce7522b091fdd20e35d4de5a95868f35 | 30f67517c34b2c2fd75a8416a55bef7e85983a07 | refs/heads/master | 2023-07-31T09:07:48.188007 | 2021-10-05T01:25:05 | 2021-10-05T01:25:05 | 413,491,055 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 355 | swift | //
// Avenger.swift
// Avengers
//
// Created by Yan Akhrameev on 04/10/21.
//
import Foundation
// testing only:
class Avenger: Identifiable {
let id: String
let name: String
let image: String
init(id: String, name: String, image: String) {
self.id = id
self.name = name
self.image = image
}
}
| [
-1
] |
ebda4c6f966cdd80a33035b6a43d0a72cedc1169 | 6173052219d7ded50039d73d462b0a0c42310b35 | /CloverConnector/Classes/cloverconnector/ICloverConnectorListener.swift | f96d20bc33f4c1a3356a26924acc5ba8669ab1bf | [] | no_license | CloverGoSDK/remote-pay-ios | 7203da88976eba9f583b082beafaa98fec3706ab | 8bcb61446debc7e62eac81f55e8f002429d1027d | refs/heads/1.2.0.b | 2021-01-23T05:14:32.039139 | 2017-06-06T04:54:52 | 2017-06-06T04:54:52 | 92,961,620 | 0 | 0 | null | 2017-05-31T15:37:11 | 2017-05-31T15:37:11 | null | UTF-8 | Swift | false | false | 5,509 | swift | /**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
import Foundation
//import CloverSDKRemotepay
/*
* Interface to the Clover remote-pay API.
*
* Defines the interface used to interact with remote pay
* adapters.
*/
@objc
public protocol ICloverConnectorListener : AnyObject {
/*
* Response to a sale request.
*/
func onSaleResponse ( _ response:SaleResponse ) -> Void
/*
* Response to an authorization operation.
*/
func onAuthResponse ( _ authResponse:AuthResponse ) -> Void
/*
* Response to a preauth operation.
*/
func onPreAuthResponse ( _ preAuthResponse:PreAuthResponse ) -> Void
/*
* Response to a preauth being captured.
*/
func onCapturePreAuthResponse ( _ capturePreAuthResponse:CapturePreAuthResponse ) -> Void
/*
* Response to a tip adjustment for an auth.
*/
func onTipAdjustAuthResponse ( _ tipAdjustAuthResponse:TipAdjustAuthResponse ) -> Void
/*
* Response to a payment be voided.
*/
func onVoidPaymentResponse ( _ voidPaymentResponse:VoidPaymentResponse ) -> Void
/*
* Response to a payment being refunded.
*/
func onRefundPaymentResponse ( _ refundPaymentResponse:RefundPaymentResponse ) -> Void
/*
* Response to an amount being refunded.
*/
func onManualRefundResponse ( _ manualRefundResponse:ManualRefundResponse ) -> Void
/*
* Response to a closeout.
*/
func onCloseoutResponse ( _ closeoutResponse:CloseoutResponse ) -> Void
/*
* Receives signature verification requests.
*/
func onVerifySignatureRequest ( _ signatureVerifyRequest:VerifySignatureRequest ) -> Void
/*
* Response to vault a card.
*/
func onVaultCardResponse ( _ vaultCardResponse:VaultCardResponse ) -> Void
/*
*
*/
func onDeviceActivityStart( _ deviceEvent: CloverDeviceEvent ) -> Void
func onDeviceActivityEnd( _ deviceEvent: CloverDeviceEvent ) -> Void
func onDeviceError( _ deviceErrorEvent: CloverDeviceErrorEvent ) -> Void
/*
* called when the device is initially connected
*/
func onDeviceConnected () -> Void
/*
* called when the device is ready to communicate
*/
func onDeviceReady (_ merchantInfo: MerchantInfo) -> Void
/*
* called when the device is disconnected, or not responding
*/
func onDeviceDisconnected () -> Void
/**
* Called when the Clover device requires confirmation for a payment
* e.g. Duplicates or Offline
* @param request
*/
func onConfirmPaymentRequest(_ request:ConfirmPaymentRequest) -> Void
/**
* Called when a customer selects a tip amount on the Clover device screen
* @param message
*/
func onTipAdded(_ message:TipAddedMessage) -> Void;
/**
* Will only be called if disablePrinting = true on the Sale, Auth, PreAuth or ManualRefund Request
* Called when a user requests to print a receipt for a ManualRefund
* @param printManualRefundReceiptMessage
*/
func onPrintManualRefundReceipt(_ printManualRefundReceiptMessage:PrintManualRefundReceiptMessage) -> Void
/**
* Will only be called if disablePrinting = true on the Sale, Auth, PreAuth or ManualRefund Request
* Called when a user requests to print a receipt for a declined ManualRefund
* @param printManualRefundDeclineReceiptMessage
*/
func onPrintManualRefundDeclineReceipt(_ printManualRefundDeclineReceiptMessage:PrintManualRefundDeclineReceiptMessage) -> Void
/**
* Will only be called if disablePrinting = true on the Sale, Auth, PreAuth or ManualRefund Request
* Called when a user requests to print a receipt for a payment
* @param printPaymentReceiptMessage
*/
func onPrintPaymentReceipt(_ printPaymentReceiptMessage:PrintPaymentReceiptMessage)
/**
* Will only be called if disablePrinting = true on the Sale, Auth, PreAuth or ManualRefund Request
* Called when a user requests to print a receipt for a declined payment
* @param printPaymentDeclineReceiptMessage
*/
func onPrintPaymentDeclineReceipt(_ printPaymentDeclineReceiptMessage:PrintPaymentDeclineReceiptMessage)
/**
* Will only be called if disablePrinting = true on the Sale, Auth, PreAuth or ManualRefund Request
* Called when a user requests to print a merchant copy of a payment receipt
* @param printPaymentMerchantCopyReceiptMessage
*/
func onPrintPaymentMerchantCopyReceipt(_ printPaymentMerchantCopyReceiptMessage:PrintPaymentMerchantCopyReceiptMessage) -> Void
/**
* Will only be called if disablePrinting = true on the Sale, Auth, PreAuth or ManualRefund Request
* Called when a user requests to print a receipt for a payment refund
* @param printRefundPaymentReceiptMessage
*/
func onPrintRefundPaymentReceipt(_ printRefundPaymentReceiptMessage:PrintRefundPaymentReceiptMessage) -> Void
/**
* Called in response to a retrievePendingPayment(...) request.
* @param retrievePendingPaymentResponse
*/
func onRetrievePendingPaymentsResponse(_ retrievePendingPaymentResponse:RetrievePendingPaymentsResponse) -> Void
func onReadCardDataResponse(_ readCardDataResponse:ReadCardDataResponse) -> Void
}
| [
-1
] |
abd2616cc8a6b9231c2aebcbab3a428dbd6b94e6 | 745f0b569fb539f169e7891ab0bc07b225c213fe | /StoreDataOfCoreDataOne/StoreDataOfCoreDataOne/ViewController.swift | 0d650525b1ee7b7614d850f2c023c0a3f0b95c89 | [] | no_license | cg229836277/IOS_Develop_Project | 984d203510bcfa3841909dccc1bce26280b46cd9 | da382e0833d2e58611e99d3fece698e3546c22a9 | refs/heads/master | 2021-06-01T17:25:01.155822 | 2021-05-08T02:42:44 | 2021-05-08T02:42:44 | 46,211,775 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,975 | swift | //
// ViewController.swift
// StoreDataOfCoreDataOne
//
// Created by chuck chan on 16/1/23.
// Copyright © 2016年 chuck chan. All rights reserved.
//
import UIKit
import CoreData
class ViewController: UIViewController {
var myDeledate = UIApplication.sharedApplication().delegate as! AppDelegate
var context:NSManagedObjectContext?
override func viewDidLoad() {
super.viewDidLoad()
context = myDeledate.managedObjectContext
var schoolRequest = NSFetchRequest(entityName: "School")
schoolRequest.fetchBatchSize = 10 //分块查询
schoolRequest.fetchLimit = 10
var predicaet = NSPredicate(format: "name = %@" , "Yangtze University")
schoolRequest.predicate = predicaet
var schoolObject = try! context!.executeFetchRequest(schoolRequest) as! [NSManagedObject]
var studentRequest = NSFetchRequest(entityName: "Student")
var studentObject = try! context!.executeFetchRequest(studentRequest) as! [NSManagedObject]
for objectOfSchool in schoolObject{
var name = objectOfSchool.valueForKey("name")
var address = objectOfSchool.valueForKey("address")
print("school name is \(name!)");
print("school address is \(address!)")
}
for objectOfStudent in studentObject{
var name = objectOfStudent.valueForKey("name")
var number = objectOfStudent.valueForKey("number")
var sex = objectOfStudent.valueForKey("sex")
var year = objectOfStudent.valueForKey("year")
print("student name is \(name)");
print("student number is \(number)")
print("student sex is \(sex)");
print("student year is \(year)")
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
-1
] |
5b66fb4cc7e74678adccf6028c927e3e4c273ca4 | 67defaa8d6435861e34c5174d18c42cf917f2624 | /Climate/Model/WeatherData.swift | 73721fe00ea9983e8bc17dacd653fb1bf07802bf | [] | no_license | Durgarao581/Climate_IOS | 3cdd53297ce3d56f6c79858dce8a187f336b422c | 9ade74685abb5a488714000716017fdbd6ea9109 | refs/heads/master | 2023-03-16T22:35:19.145207 | 2021-03-05T11:57:06 | 2021-03-05T11:57:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 318 | swift |
import Foundation
struct WeatherData: Codable{
var message: String
var list: [WeatherList]
}
struct WeatherList: Codable {
var name: String
var main: WeatherMain
var weather: [WeatherNum]
}
struct WeatherMain:Codable {
var temp: Double
}
struct WeatherNum:Codable {
var id: Int
}
| [
-1
] |
102eede499cf8c20fc05f08ab14fe6526a40f20e | 496d2b54a1da6733f8a69defb875b77bbf6d61f6 | /Changliao/Main/ShakeViewController.swift | 14ccd036e0037e6adf664a9c7d064f9b5a8dd72e | [] | no_license | DaChengTechnology/IMiOS | ac57569b8128bb0e0642dd24f50d6b842484b71c | 5fb988883e5f4b3cb699cb29792ddb7093503a29 | refs/heads/master | 2023-01-27T20:20:17.459604 | 2020-11-30T15:06:16 | 2020-11-30T15:06:16 | 317,253,145 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 11,036 | swift | //
// ShakeViewController.swift
// boxin
//
// Created by guduzhonglao on 6/20/19.
// Copyright © 2019 guduzhonglao. All rights reserved.
//
import UIKit
@objc class ShakeViewController: UIViewController {
@IBOutlet weak var goToGroupBtn: UIButton!
@IBOutlet weak var DismissBtn: UIButton!
@IBOutlet weak var infoLabel: UILabel!
@IBOutlet weak var headTittleLabel: UILabel!
@IBOutlet weak var groupOwnerLabel: UILabel!
@IBOutlet weak var logo: UIImageView!
@IBOutlet weak var animationImageView: UIImageView!
@IBOutlet weak var LabelBg: UIView!
let timer = DispatchSource.makeTimerSource(flags: [], queue: DispatchQueue.main)
var groupId:String?
var groupName:String?
var groupOwnerName:String?
var ringPlayer:AVAudioPlayer?
var grade:String?
override func viewDidLoad() {
super.viewDidLoad()
let app = UIApplication.shared.delegate as! AppDelegate
if app.player != nil {
if app.player!.isPlaying {
app.player?.stop()
}
}
ringPlayer?.stop()
if groupId != nil
{
let group = QueryFriend.shared.queryGroup(id: groupId!)
if group != nil
{
headTittleLabel.text = "\"\(group!.groupName!)\" 的\(grade ?? "群主")"
groupOwnerLabel.text = groupOwnerName
groupName = group?.groupName
if group?.is_pingbi == 2 {
if UserDefaults.standard.string(forKey: "newMessage") == "1" {
if UserDefaults.standard.string(forKey: "sound") == "1" {
do{
ringPlayer = try AVAudioPlayer(contentsOf: Bundle.main.url(forResource: "shake", withExtension: "mp3")!)
}catch(let e){
print(e.localizedDescription)
}
ringPlayer?.setVolume(1, fadeDuration: 0.3)
ringPlayer?.numberOfLoops = -1
if ringPlayer!.prepareToPlay() {
app.player = ringPlayer
ringPlayer?.play()
}
}
}
}
}
}
// Do any additional setup after loading the view.
DismissBtn.layer.masksToBounds = true
DismissBtn.layer.cornerRadius = 48
goToGroupBtn.layer.masksToBounds = true
goToGroupBtn.layer.cornerRadius = 48
LabelBg.layer.borderWidth = 1
LabelBg.layer.borderColor = UIColor.hexadecimalColor(hexadecimal: "cbcbcb").cgColor
LabelBg.layer.masksToBounds = true
LabelBg.layer.cornerRadius = 15
timer.schedule(deadline: .now(), repeating: 2)
timer.setEventHandler {
DispatchQueue.main.async {
if UserDefaults.standard.string(forKey: "newMessage") == "1" {
if UserDefaults.standard.string(forKey: "shake") == "1" {
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate)
}
}
UIView.animate(withDuration: 2, animations: {
let offset = (UIScreen.main.bounds.width - self.animationImageView.frame.width)/2
self.animationImageView.frame = CGRect(x: self.animationImageView.frame.minX - offset, y: self.animationImageView.frame.minY - offset, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.width)
}, completion: { (b) in
if b {
self.animationImageView.frame = self.logo.frame
}
})
}
}
if app.timer != nil {
app.timer?.cancel()
}
app.timer = timer
timer.resume()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
animationImageView.frame = logo.frame
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
ringPlayer?.stop()
timer.cancel()
}
@IBAction func onDismiss(_ sender: Any) {
self.dismiss(animated: false) {
let app = UIApplication.shared.delegate as? AppDelegate
DispatchQueue.main.async {
if let person = app?.person {
let sb = UIStoryboard(name: "Main", bundle: nil)
let vc = sb.instantiateViewController(withIdentifier: "PersonalShake") as! PersonalShakeViewController
vc.model = person
vc.modalPresentationStyle = .overFullScreen
UIViewController.currentViewController()?.present(vc, animated: false, completion: nil)
app?.person = nil
}
if let apns = app?.apnsData {
if let group = apns.g {
if let chat = UIViewController.currentViewController() as? ChatViewController {
if chat.conversation.conversationId == group {
return
}
UIViewController.currentViewController()?.navigationController?.popToRootViewController(animated: false)
}
UIViewController.currentViewController()?.navigationController?.navigationBar.topItem?.backBarButtonItem = UIBarButtonItem(title: " ", style: .plain, target: nil, action: nil)
let vc = ChatViewController(conversationChatter: group, conversationType: EMConversationTypeGroupChat)
if let data = QueryFriend.shared.queryGroup(id: group) {
vc?.title = data.groupName
}else{
if let da = QueryFriend.shared.getGroupName(id: group){
vc?.title = da
}
}
UIViewController.currentViewController()?.navigationController?.pushViewController(vc!, animated: true)
app?.apnsData = nil
}else{
if let chat = UIViewController.currentViewController() as? ChatViewController {
if chat.conversation.conversationId == apns.f {
return
}
UIViewController.currentViewController()?.navigationController?.popToRootViewController(animated: false)
}
UIViewController.currentViewController()?.navigationController?.navigationBar.topItem?.backBarButtonItem = UIBarButtonItem(title: " ", style: .plain, target: nil, action: nil)
let vc = ChatViewController(conversationChatter: apns.f, conversationType: EMConversationTypeChat)
if apns.f != nil {
if let data = QueryFriend.shared.queryFriend(id: apns.f!) {
vc?.title = data.name
}else{
if let da = QueryFriend.shared.queryStronger(id: apns.f!) {
vc?.title = da.name
}
}
}
UIViewController.currentViewController()?.navigationController?.pushViewController(vc!, animated: true)
app?.apnsData = nil
}
}
}
}
}
@IBAction func onGoToGroup(_ sender: Any) {
let groupid = groupId!
if let name = groupName {
self.dismiss(animated: false) {
if let chat = UIViewController.currentViewController() as? ChatViewController {
if chat.conversation.conversationId == groupid && chat.conversation.type == EMConversationTypeGroupChat {
return
}
chat.navigationController?.navigationController?.popToRootViewController(animated: true)
}
let vc = ChatViewController(conversationChatter: groupid, conversationType: EMConversationTypeGroupChat)
UIViewController.currentViewController()?.navigationController?.navigationBar.topItem?.backBarButtonItem = UIBarButtonItem(title: " ", style: .plain, target: nil, action: nil)
vc?.title = name
UIViewController.currentViewController()?.navigationController?.pushViewController(vc!, animated: true)
}
}else{
BoXinUtil.getGroupOnlyInfo(groupId: groupid) { (b) in
if b {
let group = QueryFriend.shared.queryGroup(id: groupid)
self.dismiss(animated: false) {
if let chat = UIViewController.currentViewController() as? ChatViewController {
if chat.conversation.conversationId == groupid && chat.conversation.type == EMConversationTypeGroupChat {
return
}
chat.navigationController?.navigationController?.popToRootViewController(animated: true)
}
let vc = ChatViewController(conversationChatter: groupid, conversationType: EMConversationTypeGroupChat)
UIViewController.currentViewController()?.navigationController?.navigationBar.topItem?.backBarButtonItem = UIBarButtonItem(title: " ", style: .plain, target: nil, action: nil)
vc?.title = group?.groupName
UIViewController.currentViewController()?.navigationController?.pushViewController(vc!, animated: true)
}
}else{
self.dismiss(animated: false, completion: {
let alert = UIAlertController(title: "没有查到该群信息", message: nil, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: "OK"), style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)
})
}
}
}
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
e1d183e7a4f7697608ac305b48181a1c7581817e | a2ddee89fb2b945af3efe104d846326f9e7bf945 | /Laparodome/iOS App/_MACOSX/Laparadome/Laparadome/Models/EvaulationQuestion.swift | 7998d51158a81f9976ef0cf4f7038f350c778a7e | [] | no_license | EddieYao8/Medical-Device-Projects | 749858730be0ab419e25109b272d17fd39ebb4ac | 9be12d264fdc6628367c1c8ef29ca37736b4a359 | refs/heads/master | 2022-06-21T11:32:50.812685 | 2020-05-04T15:11:29 | 2020-05-04T15:11:29 | 255,958,303 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 261 | swift | //
// EvaulationQuestion.swift
// Laparodome
//
// Created by Sam Wu on 3/14/20.
// Copyright © 2020 Sam Wu. All rights reserved.
//
import Foundation
struct EvalutationQuestion: Hashable, Codable {
let question: String
let expectedValue: Bool
}
| [
-1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.