blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 2
625
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
47
| license_type
stringclasses 2
values | repo_name
stringlengths 5
116
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 643
values | visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 80.4k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 16
values | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_language
stringclasses 85
values | src_encoding
stringclasses 7
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 1
class | length_bytes
int64 4
6.44M
| extension
stringclasses 17
values | content
stringlengths 4
6.44M
| duplicates
sequencelengths 1
9.02k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2de39e3718d9ec2abe5b720d9efc56e77e6d2ccd | 1891828555aaa99ad0fd1794f1ddb53adf124e10 | /hw9/NewsViewController.swift | 8e9725bee8fa2c3f4a0b6f08a6df61f9fdfc653a | [] | no_license | LaroLuo/StockSearchIOS | b0e0fac7cef9f891a2dedb4a92160d56f8908807 | af41b06313c7687c5cbe8e47c2927c91e9b8feb0 | refs/heads/master | 2021-08-31T00:12:48.592190 | 2017-12-19T23:20:05 | 2017-12-19T23:20:05 | 114,820,759 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,217 | swift | //
// NewsViewController.swift
// hw9
//
// Created by Rui Luo on 11/26/17.
// Copyright © 2017 Rui Luo. All rights reserved.
//
import UIKit
class NewsViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
let defaults = UserDefaults.standard
var reaList : [News] = []
var newsFeeds : [News] = []
@IBOutlet weak var newsTable: UITableView!
func numberOfSections(in tableView: UITableView) -> Int {
print ("numberOfSection")
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
print(self.reaList.count)
return self.reaList.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cellNews", for: indexPath) as! NewsCell
cell.newsTitle.text = reaList[indexPath.row].newsTitle
cell.newsAuthor.text = reaList[indexPath.row].newsAuthor
cell.newsPubDate.text = reaList[indexPath.row].newsPubDate
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print("select \(indexPath.row) row")
let url = reaList[indexPath.row].newsLink
UIApplication.shared.open(URL(string: url)!, options: [:], completionHandler: nil)
}
override func viewDidLoad() {
print("NewsViewController load")
self.reaList = self.newsFeeds
print(self.reaList.count)
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
7393fca0e46570e35eaea44efd6c23ee7a504a33 | 9db3c3d6e608836507fa5f52b28aff14942585da | /Driver/BusinessLogic/Application/Configurator/ApplicationConfigurator.swift | c5d8942ccbb9b1ac4ebfa6ba85df1c758dc5c7cf | [] | no_license | tyh94/Driver | ce1b2dbe4e14a6b76c99ed4f5d396b71928f6eec | 7231c76ec5c66fb0741de81e6eb818910513b1a9 | refs/heads/master | 2020-07-10T10:33:11.898227 | 2019-08-26T14:00:29 | 2019-08-26T14:00:29 | 204,242,289 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 640 | swift | //
// ApplicationConfigurator.swift
// Driver
//
// Created by Татьяна Хохлова on 22/08/2019.
// Copyright © 2019 Iway. All rights reserved.
//
import UIKit
class ApplicationConfigurator {
let appearanceConfigurator: AppearanceConfigurator
let appCoordinator: AppCoordinator
required init(appearanceConfigurator: AppearanceConfigurator,
appCoordinator: AppCoordinator) {
self.appearanceConfigurator = appearanceConfigurator
self.appCoordinator = appCoordinator
}
func start() {
appearanceConfigurator.configure()
appCoordinator.start()
}
}
| [
-1
] |
ef43ec0c286e6e70f2ccfbc646d3238541da9253 | d8aaed9e5f59fade6252df1e2fa00b6218d3cbe1 | /GARAGE SALE/UITableViewCell/PostDetailInfoCell.swift | 948816d53976dbf60010f1f2857ca4915d774933 | [] | no_license | AhmadDurrani579/GARAGE-SALE | cc8514a53dd5d6041568a1229d799d58b0cc10c0 | 69903f5b97a91102e3dafd66a3efde162591399d | refs/heads/master | 2020-04-18T23:51:24.577710 | 2019-01-27T16:41:14 | 2019-01-27T16:41:14 | 167,831,896 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 735 | swift | //
// PostDetailInfoCell.swift
// GARAGE SALE
//
// Created by Ahmed Durrani on 25/01/2019.
// Copyright © 2019 TeachEase Solution. All rights reserved.
//
import UIKit
class PostDetailInfoCell: UITableViewCell {
@IBOutlet var lblDescription: UILabel!
@IBOutlet weak var lblAddress: UILabel!
@IBOutlet weak var lblTime: UILabel!
@IBOutlet weak var lblProdductName: UILabel!
@IBOutlet weak var lblPrice: 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
}
}
| [
355170,
379235,
278567,
382280,
358868,
278583,
358876
] |
68859d011958095b679d9d299339c97d1c3837da | 7ba9056a331d3db8e561963564928702d849dda1 | /Landmarks/Views/Landmarks/LandmarkRow.swift | 74dd6c31e05683871562af43bf3c4c2c2eab4cc9 | [] | no_license | ianchen0419/Landmarks | 4e089a549f8dbb817d55c10b370c2a7808ea68d4 | 0b592c2f0ef03d084e3b26db868a9f29ec444e87 | refs/heads/main | 2023-07-17T21:44:39.600213 | 2021-08-24T08:30:56 | 2021-08-24T08:30:56 | 399,389,129 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 876 | swift | //
// LandmarkRow.swift
// Landmarks
//
// Created by Yi An Chen on 2021/8/22.
//
import SwiftUI
struct LandmarkRow: View {
var landmark: Landmark
var body: some View {
HStack {
landmark.image
.resizable()
.frame(width: 50, height: 50)
Text(landmark.name)
Spacer()
if landmark.isFavorite {
Image(systemName: "star.fill")
.foregroundColor(.yellow)
}
}
}
}
struct LandmarkRow_Previews: PreviewProvider {
static var landmarks = ModelData().landmarks
static var previews: some View {
Group {
LandmarkRow(landmark: landmarks[0])
LandmarkRow(landmark: landmarks[1])
}
.previewLayout(.fixed(width: 300, height: 70))
}
}
| [
385089,
386638,
372911,
372786,
380343,
372058,
398302,
345183
] |
601e4611e715812b1048db662943c62bd7a49a1c | f77748e211a510c9227423d63a15ad05f5f6b018 | /JournalCoreData/Model Controllers/EntryController.swift | be1f5689f92c500e988908ce1ccae2dffd07aaca | [] | no_license | matt-martindale/ios-debugging | a3562552629d39c614568fba379933839290f904 | c3bf5303bb02de1228d3917963d165948377583f | refs/heads/master | 2022-07-17T22:43:45.863205 | 2020-05-21T02:42:26 | 2020-05-21T02:42:26 | 265,439,482 | 0 | 0 | null | 2020-05-20T03:27:36 | 2020-05-20T03:27:35 | null | UTF-8 | Swift | false | false | 5,922 | swift | //
// EntryController.swift
// JournalCoreData
//
// Created by Spencer Curtis on 8/12/18.
// Copyright © 2018 Lambda School. All rights reserved.
//
import Foundation
import CoreData
let baseURL = URL(string: "https://lambdajournal-2718e.firebaseio.com/")!
class EntryController {
func createEntry(with title: String, bodyText: String, mood: String) {
let entry = Entry(title: title, bodyText: bodyText, mood: mood)
put(entry: entry)
saveToPersistentStore()
}
func update(entry: Entry, title: String, bodyText: String, mood: String) {
entry.title = title
entry.bodyText = bodyText
entry.timestamp = Date()
entry.mood = mood
put(entry: entry)
saveToPersistentStore()
}
func delete(entry: Entry) {
CoreDataStack.shared.mainContext.delete(entry)
deleteEntryFromServer(entry: entry)
saveToPersistentStore()
}
private func put(entry: Entry, completion: @escaping ((Error?) -> Void) = { _ in }) {
let identifier = entry.identifier ?? UUID().uuidString
let requestURL = baseURL.appendingPathComponent(identifier).appendingPathExtension("json")
var request = URLRequest(url: requestURL)
request.httpMethod = "PUT"
do {
request.httpBody = try JSONEncoder().encode(entry)
} catch {
NSLog("Error encoding Entry: \(error)")
completion(error)
return
}
URLSession.shared.dataTask(with: request) { (data, _, error) in
if let error = error {
NSLog("Error PUTting Entry to server: \(error)")
completion(error)
return
}
completion(nil)
}.resume()
}
func deleteEntryFromServer(entry: Entry, completion: @escaping ((Error?) -> Void) = { _ in }) {
guard let identifier = entry.identifier else {
NSLog("Entry identifier is nil")
completion(NSError())
return
}
let requestURL = baseURL.appendingPathComponent(identifier).appendingPathExtension("json")
var request = URLRequest(url: requestURL)
request.httpMethod = "DELETE"
URLSession.shared.dataTask(with: request) { (data, _, error) in
if let error = error {
NSLog("Error deleting entry from server: \(error)")
completion(error)
return
}
completion(nil)
}.resume()
}
func fetchEntriesFromServer(completion: @escaping ((Error?) -> Void) = { _ in }) {
let requestURL = baseURL.appendingPathExtension("json")
var request = URLRequest(url: requestURL)
request.httpMethod = "GET"
URLSession.shared.dataTask(with: requestURL) { (data, _, error) in
if let error = error {
NSLog("Error fetching entries from server: \(error)")
completion(error)
return
}
guard let data = data else {
NSLog("No data returned from data task")
completion(NSError())
return
}
let moc = CoreDataStack.shared.mainContext
do {
let entryReps = try JSONDecoder().decode([String: EntryRepresentation].self, from: data).map({$0.value})
self.updateEntries(with: entryReps, in: moc)
} catch {
NSLog("Error decoding JSON data: \(error)")
completion(error)
return
}
moc.perform {
do {
try moc.save()
completion(nil)
} catch {
NSLog("Error saving context: \(error)")
completion(error)
}
}
}.resume()
}
private func fetchSingleEntryFromPersistentStore(with identifier: String?, in context: NSManagedObjectContext) -> Entry? {
guard let identifier = identifier else { return nil }
let fetchRequest: NSFetchRequest<Entry> = Entry.fetchRequest()
fetchRequest.predicate = NSPredicate(format: "identifier == %@", identifier)
var result: Entry? = nil
do {
result = try context.fetch(fetchRequest).first
} catch {
NSLog("Error fetching single entry: \(error)")
}
return result
}
private func updateEntries(with representations: [EntryRepresentation], in context: NSManagedObjectContext) {
context.performAndWait {
for entryRep in representations {
guard let identifier = entryRep.identifier else { continue }
let entry = self.fetchSingleEntryFromPersistentStore(with: identifier, in: context)
if let entry = entry, entry != entryRep {
self.update(entry: entry, with: entryRep)
} else if entry == nil {
_ = Entry(entryRepresentation: entryRep, context: context)
}
}
}
}
private func update(entry: Entry, with entryRep: EntryRepresentation) {
entry.title = entryRep.title
entry.bodyText = entryRep.bodyText
entry.mood = entryRep.mood
entry.timestamp = entryRep.timestamp
entry.identifier = entryRep.identifier
}
func saveToPersistentStore() {
do {
try CoreDataStack.shared.mainContext.save()
} catch {
NSLog("Error saving managed object context: \(error)")
}
}
}
| [
-1
] |
7947cb42245caeca91e629b169ce28e4c0f60b12 | cd7821dbf93289917441aedb662980780452694d | /SampleApp/AppDelegate.swift | 32cb94515878d4a2b38986540fa2ff6d1c8c8882 | [] | no_license | mohaitheen1986/SampleApp-MVVM | b1c98aef9a46e3bc4b449f8a686df9e5a3d54242 | 34d84a6c2511bc11d7daf68f47d58544aedcc9b9 | refs/heads/master | 2021-01-02T05:04:23.765410 | 2020-02-16T18:50:30 | 2020-02-16T18:50:30 | 239,500,486 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,493 | swift | //
// AppDelegate.swift
// SampleApp
//
// Created by Mohaitheen on 10/02/20.
// Copyright © 2020 Mohaitheen. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
//Init Injection
SwinInjector.setup()
let nav = UINavigationController.init(rootViewController: (SwinInjector.defaultContainer.resolve(UserListViewable.self) as? UIViewController)!)
window?.rootViewController = nav
window?.makeKeyAndVisible()
// 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,
294924,
229388,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
278556,
229405,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
286776,
319544,
286778,
229432,
204856,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
286922,
286924,
286926,
319694,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
311746,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
287238,
320007,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
254563,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
287365,
311942,
303751,
352905,
279178,
287371,
311946,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
164509,
303773,
172705,
287394,
172707,
303780,
287390,
287398,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312006,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
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,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
213895,
304007,
304009,
304011,
230284,
304013,
295822,
279438,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
234648,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
279661,
205934,
164973,
312432,
279669,
337018,
279679,
66690,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
230689,
173350,
312622,
279857,
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,
181631,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
312755,
296373,
312759,
279991,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
288214,
148946,
239064,
288217,
329177,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
320998,
288234,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
280152,
288344,
239194,
280158,
403039,
181854,
370272,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
313044,
280276,
321239,
280283,
313052,
288478,
313055,
419555,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
288499,
419570,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
313093,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
304968,
280393,
280402,
173907,
313171,
313176,
280419,
321381,
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,
305168,
305176,
321560,
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,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
354653,
313700,
280937,
313705,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
150025,
338440,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
256716,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
240519,
322440,
314249,
338823,
183184,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
322630,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
306427,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
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,
306608,
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,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
282499,
315267,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
44948,
298901,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
241821,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
176311,
299191,
307385,
307386,
307388,
258235,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
176435,
307508,
315701,
332086,
307510,
307512,
151864,
168245,
307515,
307518,
282942,
151874,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
291269,
127429,
127434,
315856,
176592,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
291299,
127463,
242152,
291305,
127466,
176620,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
283142,
135689,
233994,
127497,
127500,
291341,
233998,
127506,
234003,
234006,
127511,
152087,
242202,
234010,
135707,
242206,
135710,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
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,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
201603,
226182,
234375,
226185,
308105,
234379,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
226200,
234396,
234398,
291742,
234401,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
226220,
291754,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
275384,
324536,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
226245,
234437,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
308226,
234501,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
324757,
308379,
300189,
324766,
119967,
234653,
234657,
324768,
283805,
242852,
300197,
234661,
283813,
234664,
177318,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
226500,
283844,
300234,
283850,
234695,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
275725,
349451,
349464,
415009,
283939,
259367,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
144814,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
227440,
316917,
308727,
292343,
300537,
316933,
316947,
308757,
308762,
284191,
316959,
284194,
284196,
235045,
284199,
235047,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
276053,
284247,
317015,
284249,
243290,
284251,
235097,
284253,
300638,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
284290,
325250,
284292,
292485,
292479,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
284337,
284339,
300726,
284343,
284346,
284350,
276160,
358080,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
276206,
358128,
284399,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
284566,
399252,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276452,
292839,
276455,
292843,
276460,
276464,
178161,
227314,
325624,
276472,
317435,
276479,
276482,
276485,
317446,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
243779,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
227426,
276579,
227430,
276583,
309354,
301167,
276590,
350321,
350313,
350316,
284786,
350325,
252022,
276595,
350328,
292985,
301178,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309491,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
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,
178575,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
236056,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
277071,
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,
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,
56041,
285417,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
293706,
277329,
162643,
310100,
301911,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
56313,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
285792,
277601,
203872,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
294026,
285835,
302218,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
204023,
204026,
228606,
204031,
64768,
310531,
285958,
228617,
138505,
318742,
204067,
277798,
130345,
277801,
113964,
277804,
285997,
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,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
64966,
245191,
163272,
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,
302603,
65038,
302614,
286233,
302617,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286313,
40554,
286312,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
278227,
286420,
229076,
286425,
319194,
278235,
301163,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
280021,
188252,
237409,
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,
278516,
311283,
278519,
237562
] |
b83219c2169caebda24e433a4517806baca54761 | c5a97f04cf3b3cf88b2d132640b8571f4320a179 | /Swifty Companion/ProjectsTableView.swift | 5ffb81cac6439adeed857d09501a364412785e75 | [] | no_license | kondie011/Swifty_Companion | 56a73d51a2933636a526ba642c7bc97663cf0ec5 | c68b0f896636bfbda4d968e549429c04228e3a5b | refs/heads/master | 2020-08-31T16:10:06.136940 | 2019-10-31T09:33:42 | 2019-10-31T09:33:42 | 218,729,744 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 459 | swift | //
// ProjectsTableView.swift
// Swifty Companion
//
// Created by Kondelelani NEDZINGAHE on 2019/10/22.
// Copyright © 2019 Kondelelani NEDZINGAHE. All rights reserved.
//
import UIKit
class ProjectsTableView: UITableView {
/*
// Only override draw() if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func draw(_ rect: CGRect) {
// Drawing code
}
*/
}
| [
-1
] |
3ebaa24143f632b29a960dbe3e1c61c23837b413 | d43775ba6ad07484af4520c3f66fee319490e7fa | /TonyburgersApp/Models/Location.swift | 03dbccbebd4e8642e029eb347e0e3fecea3bc183 | [] | no_license | carvjust/TonyburgersApp | 8789f29236a11889c3240bc02d36a74daa0f13ef | f13ca2223b48d1c01cda0fc1e7b3ba371b6ff56b | refs/heads/master | 2021-09-18T08:06:51.071830 | 2018-07-11T20:46:47 | 2018-07-11T20:46:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,324 | swift | //
// Location.swift
// Tonyburgers
//
// Created by Justin Carver on 6/1/18.
// Copyright © 2018 Justin Carver. All rights reserved.
//
import Foundation
class Location {
private var orders: [Order]
private let name: String
private var hours: String
private var takingNewOrders: Bool
private let address: String
init(orders: [Order], name: String, hours: String, takingNewOrders: Bool, address: String) {
self.orders = orders
self.name = name
self.hours = hours
self.takingNewOrders = takingNewOrders
self.address = address
}
// get functions \\
func getName() -> String {
return self.name
}
func getHours() -> String {
return self.hours
}
func getTakingNewOrders() -> Bool {
return self.takingNewOrders
}
func getAddress() -> String {
return self.address
}
// set functions \\
func addOrder(order: Order) {
self.orders.append(order)
}
func setTakingNewOrders(takingNewOrders: Bool) {
self.takingNewOrders = takingNewOrders
}
func changeTakingNewOrders() {
self.takingNewOrders = !self.takingNewOrders
}
func setHours(hours: String) {
self.hours = hours
}
}
| [
-1
] |
b54d0242fa3a642d307fced5d389ecc0d993e849 | 15596151c72fb468cf8712fabcb8b12959f72744 | /SourceryTests/Models/TypedSpec.generated.swift | 4135feb9ba60d8ac6afbcd6837b719a0d614e928 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | sathishvjd/Sourcery | 1b7a603d93f61d2776fca4d14a82457853947dfc | dd3faf8c1b7b404fc18d639052a1374439e3b6aa | refs/heads/master | 2023-07-24T12:45:51.842144 | 2021-03-03T12:37:07 | 2021-03-03T12:37:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 13,021 | swift | // Generated using Sourcery 1.3.0 — https://github.com/krzysztofzablocki/Sourcery
// DO NOT EDIT
import Quick
import Nimble
@testable import Sourcery
@testable import SourceryRuntime
class TypedSpec: QuickSpec {
override func spec() {
describe("AssociatedValue") {
it("can report optional via KVC") {
expect(AssociatedValue(typeName: TypeName("Int?")).value(forKeyPath: "isOptional") as? Bool).to(equal(true))
expect(AssociatedValue(typeName: TypeName("Int!")).value(forKeyPath: "isOptional") as? Bool).to(equal(true))
expect(AssociatedValue(typeName: TypeName("Int?")).value(forKeyPath: "isImplicitlyUnwrappedOptional") as? Bool).to(equal(false))
expect(AssociatedValue(typeName: TypeName("Int!")).value(forKeyPath: "isImplicitlyUnwrappedOptional") as? Bool).to(equal(true))
expect(AssociatedValue(typeName: TypeName("Int?")).value(forKeyPath: "unwrappedTypeName") as? String).to(equal("Int"))
}
it("can report tuple type via KVC") {
let sut = AssociatedValue(typeName: TypeName("(Int, Int)", tuple: TupleType(name: "(Int, Int)", elements: [])))
expect(sut.value(forKeyPath: "isTuple") as? Bool).to(equal(true))
}
it("can report closure type via KVC") {
let sut = AssociatedValue(typeName: TypeName("(Int) -> (Int)"))
expect(sut.value(forKeyPath: "isClosure") as? Bool).to(equal(true))
}
it("can report array type via KVC") {
let sut = AssociatedValue(typeName: TypeName("[Int]"))
expect(sut.value(forKeyPath: "isArray") as? Bool).to(equal(true))
}
it("can report dictionary type via KVC") {
let sut = AssociatedValue(typeName: TypeName("[Int: Int]"))
expect(sut.value(forKeyPath: "isDictionary") as? Bool).to(equal(true))
}
it("can report actual type name via KVC") {
let sut = AssociatedValue(typeName: TypeName("Alias"))
expect(sut.value(forKeyPath: "actualTypeName") as? TypeName).to(equal(TypeName("Alias")))
sut.typeName.actualTypeName = TypeName("Int")
expect(sut.value(forKeyPath: "actualTypeName") as? TypeName).to(equal(TypeName("Int")))
}
}
describe("ClosureParameter") {
it("can report optional via KVC") {
expect(ClosureParameter(typeName: TypeName("Int?")).value(forKeyPath: "isOptional") as? Bool).to(equal(true))
expect(ClosureParameter(typeName: TypeName("Int!")).value(forKeyPath: "isOptional") as? Bool).to(equal(true))
expect(ClosureParameter(typeName: TypeName("Int?")).value(forKeyPath: "isImplicitlyUnwrappedOptional") as? Bool).to(equal(false))
expect(ClosureParameter(typeName: TypeName("Int!")).value(forKeyPath: "isImplicitlyUnwrappedOptional") as? Bool).to(equal(true))
expect(ClosureParameter(typeName: TypeName("Int?")).value(forKeyPath: "unwrappedTypeName") as? String).to(equal("Int"))
}
it("can report tuple type via KVC") {
let sut = ClosureParameter(typeName: TypeName("(Int, Int)", tuple: TupleType(name: "(Int, Int)", elements: [])))
expect(sut.value(forKeyPath: "isTuple") as? Bool).to(equal(true))
}
it("can report closure type via KVC") {
let sut = ClosureParameter(typeName: TypeName("(Int) -> (Int)"))
expect(sut.value(forKeyPath: "isClosure") as? Bool).to(equal(true))
}
it("can report array type via KVC") {
let sut = ClosureParameter(typeName: TypeName("[Int]"))
expect(sut.value(forKeyPath: "isArray") as? Bool).to(equal(true))
}
it("can report dictionary type via KVC") {
let sut = ClosureParameter(typeName: TypeName("[Int: Int]"))
expect(sut.value(forKeyPath: "isDictionary") as? Bool).to(equal(true))
}
it("can report actual type name via KVC") {
let sut = ClosureParameter(typeName: TypeName("Alias"))
expect(sut.value(forKeyPath: "actualTypeName") as? TypeName).to(equal(TypeName("Alias")))
sut.typeName.actualTypeName = TypeName("Int")
expect(sut.value(forKeyPath: "actualTypeName") as? TypeName).to(equal(TypeName("Int")))
}
}
describe("MethodParameter") {
it("can report optional via KVC") {
expect(MethodParameter(typeName: TypeName("Int?")).value(forKeyPath: "isOptional") as? Bool).to(equal(true))
expect(MethodParameter(typeName: TypeName("Int!")).value(forKeyPath: "isOptional") as? Bool).to(equal(true))
expect(MethodParameter(typeName: TypeName("Int?")).value(forKeyPath: "isImplicitlyUnwrappedOptional") as? Bool).to(equal(false))
expect(MethodParameter(typeName: TypeName("Int!")).value(forKeyPath: "isImplicitlyUnwrappedOptional") as? Bool).to(equal(true))
expect(MethodParameter(typeName: TypeName("Int?")).value(forKeyPath: "unwrappedTypeName") as? String).to(equal("Int"))
}
it("can report tuple type via KVC") {
let sut = MethodParameter(typeName: TypeName("(Int, Int)", tuple: TupleType(name: "(Int, Int)", elements: [])))
expect(sut.value(forKeyPath: "isTuple") as? Bool).to(equal(true))
}
it("can report closure type via KVC") {
let sut = MethodParameter(typeName: TypeName("(Int) -> (Int)"))
expect(sut.value(forKeyPath: "isClosure") as? Bool).to(equal(true))
}
it("can report array type via KVC") {
let sut = MethodParameter(typeName: TypeName("[Int]"))
expect(sut.value(forKeyPath: "isArray") as? Bool).to(equal(true))
}
it("can report dictionary type via KVC") {
let sut = MethodParameter(typeName: TypeName("[Int: Int]"))
expect(sut.value(forKeyPath: "isDictionary") as? Bool).to(equal(true))
}
it("can report actual type name via KVC") {
let sut = MethodParameter(typeName: TypeName("Alias"))
expect(sut.value(forKeyPath: "actualTypeName") as? TypeName).to(equal(TypeName("Alias")))
sut.typeName.actualTypeName = TypeName("Int")
expect(sut.value(forKeyPath: "actualTypeName") as? TypeName).to(equal(TypeName("Int")))
}
}
describe("TupleElement") {
it("can report optional via KVC") {
expect(TupleElement(typeName: TypeName("Int?")).value(forKeyPath: "isOptional") as? Bool).to(equal(true))
expect(TupleElement(typeName: TypeName("Int!")).value(forKeyPath: "isOptional") as? Bool).to(equal(true))
expect(TupleElement(typeName: TypeName("Int?")).value(forKeyPath: "isImplicitlyUnwrappedOptional") as? Bool).to(equal(false))
expect(TupleElement(typeName: TypeName("Int!")).value(forKeyPath: "isImplicitlyUnwrappedOptional") as? Bool).to(equal(true))
expect(TupleElement(typeName: TypeName("Int?")).value(forKeyPath: "unwrappedTypeName") as? String).to(equal("Int"))
}
it("can report tuple type via KVC") {
let sut = TupleElement(typeName: TypeName("(Int, Int)", tuple: TupleType(name: "(Int, Int)", elements: [])))
expect(sut.value(forKeyPath: "isTuple") as? Bool).to(equal(true))
}
it("can report closure type via KVC") {
let sut = TupleElement(typeName: TypeName("(Int) -> (Int)"))
expect(sut.value(forKeyPath: "isClosure") as? Bool).to(equal(true))
}
it("can report array type via KVC") {
let sut = TupleElement(typeName: TypeName("[Int]"))
expect(sut.value(forKeyPath: "isArray") as? Bool).to(equal(true))
}
it("can report dictionary type via KVC") {
let sut = TupleElement(typeName: TypeName("[Int: Int]"))
expect(sut.value(forKeyPath: "isDictionary") as? Bool).to(equal(true))
}
it("can report actual type name via KVC") {
let sut = TupleElement(typeName: TypeName("Alias"))
expect(sut.value(forKeyPath: "actualTypeName") as? TypeName).to(equal(TypeName("Alias")))
sut.typeName.actualTypeName = TypeName("Int")
expect(sut.value(forKeyPath: "actualTypeName") as? TypeName).to(equal(TypeName("Int")))
}
}
describe("Typealias") {
it("can report optional via KVC") {
expect(Typealias(typeName: TypeName("Int?")).value(forKeyPath: "isOptional") as? Bool).to(equal(true))
expect(Typealias(typeName: TypeName("Int!")).value(forKeyPath: "isOptional") as? Bool).to(equal(true))
expect(Typealias(typeName: TypeName("Int?")).value(forKeyPath: "isImplicitlyUnwrappedOptional") as? Bool).to(equal(false))
expect(Typealias(typeName: TypeName("Int!")).value(forKeyPath: "isImplicitlyUnwrappedOptional") as? Bool).to(equal(true))
expect(Typealias(typeName: TypeName("Int?")).value(forKeyPath: "unwrappedTypeName") as? String).to(equal("Int"))
}
it("can report tuple type via KVC") {
let sut = Typealias(typeName: TypeName("(Int, Int)", tuple: TupleType(name: "(Int, Int)", elements: [])))
expect(sut.value(forKeyPath: "isTuple") as? Bool).to(equal(true))
}
it("can report closure type via KVC") {
let sut = Typealias(typeName: TypeName("(Int) -> (Int)"))
expect(sut.value(forKeyPath: "isClosure") as? Bool).to(equal(true))
}
it("can report array type via KVC") {
let sut = Typealias(typeName: TypeName("[Int]"))
expect(sut.value(forKeyPath: "isArray") as? Bool).to(equal(true))
}
it("can report dictionary type via KVC") {
let sut = Typealias(typeName: TypeName("[Int: Int]"))
expect(sut.value(forKeyPath: "isDictionary") as? Bool).to(equal(true))
}
it("can report actual type name via KVC") {
let sut = Typealias(typeName: TypeName("Alias"))
expect(sut.value(forKeyPath: "actualTypeName") as? TypeName).to(equal(TypeName("Alias")))
sut.typeName.actualTypeName = TypeName("Int")
expect(sut.value(forKeyPath: "actualTypeName") as? TypeName).to(equal(TypeName("Int")))
}
}
describe("Variable") {
it("can report optional via KVC") {
expect(Variable(typeName: TypeName("Int?")).value(forKeyPath: "isOptional") as? Bool).to(equal(true))
expect(Variable(typeName: TypeName("Int!")).value(forKeyPath: "isOptional") as? Bool).to(equal(true))
expect(Variable(typeName: TypeName("Int?")).value(forKeyPath: "isImplicitlyUnwrappedOptional") as? Bool).to(equal(false))
expect(Variable(typeName: TypeName("Int!")).value(forKeyPath: "isImplicitlyUnwrappedOptional") as? Bool).to(equal(true))
expect(Variable(typeName: TypeName("Int?")).value(forKeyPath: "unwrappedTypeName") as? String).to(equal("Int"))
}
it("can report tuple type via KVC") {
let sut = Variable(typeName: TypeName("(Int, Int)", tuple: TupleType(name: "(Int, Int)", elements: [])))
expect(sut.value(forKeyPath: "isTuple") as? Bool).to(equal(true))
}
it("can report closure type via KVC") {
let sut = Variable(typeName: TypeName("(Int) -> (Int)"))
expect(sut.value(forKeyPath: "isClosure") as? Bool).to(equal(true))
}
it("can report array type via KVC") {
let sut = Variable(typeName: TypeName("[Int]"))
expect(sut.value(forKeyPath: "isArray") as? Bool).to(equal(true))
}
it("can report dictionary type via KVC") {
let sut = Variable(typeName: TypeName("[Int: Int]"))
expect(sut.value(forKeyPath: "isDictionary") as? Bool).to(equal(true))
}
it("can report actual type name via KVC") {
let sut = Variable(typeName: TypeName("Alias"))
expect(sut.value(forKeyPath: "actualTypeName") as? TypeName).to(equal(TypeName("Alias")))
sut.typeName.actualTypeName = TypeName("Int")
expect(sut.value(forKeyPath: "actualTypeName") as? TypeName).to(equal(TypeName("Int")))
}
}
}
}
| [
-1
] |
dde8a789f7e58aa80d07bc56ec55f82403103c3d | 3de4d911493ad371d26d882dfa6ed9f953505649 | /Sources/ActivityIndicators/Animations/ActivityIndicatorAnimationBallTrianglePath.swift | 3cf70e692e1296f571eeed4b93a1e4929fda5acb | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | silvrwolfboy/IBAnimatable | 9446abdbb8fe1d6f9f1ac4ee236e7a72014811c5 | f1104ae78e0307e58ac96ace5ead9156afa4cef6 | refs/heads/master | 2021-02-21T08:14:09.216464 | 2020-02-29T11:06:12 | 2020-02-29T11:06:12 | 245,354,405 | 0 | 1 | MIT | 2020-03-06T07:18:50 | 2020-03-06T07:18:50 | null | UTF-8 | Swift | false | false | 4,041 | swift | //
// Created by Tom Baranes on 23/08/16.
// Copyright (c) 2016 IBAnimatable. All rights reserved.
//
import UIKit
public class ActivityIndicatorAnimationBallTrianglePath: ActivityIndicatorAnimating {
// MARK: Properties
fileprivate let duration: CFTimeInterval = 2
fileprivate let timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
// MARK: ActivityIndicatorAnimating
public func configureAnimation(in layer: CALayer, size: CGSize, color: UIColor) {
let circleSize = size.width / 5
let deltaX = size.width / 2 - circleSize / 2
let deltaY = size.height / 2 - circleSize / 2
let x = (layer.bounds.size.width - size.width) / 2
let y = (layer.bounds.size.height - size.height) / 2
let animation = defaultAnimation
let topCenterCircle = ActivityIndicatorShape.ring.makeLayer(size: CGSize(width: circleSize, height: circleSize), color: color)
change(animation: animation, values: ["{0,0}", "{hx,fy}", "{-hx,fy}", "{0,0}"], deltaX: deltaX, deltaY: deltaY)
topCenterCircle.frame = CGRect(x: x + size.width / 2 - circleSize / 2, y: y, width: circleSize, height: circleSize)
topCenterCircle.add(animation, forKey: "animation")
layer.addSublayer(topCenterCircle)
let bottomLeftCircle = ActivityIndicatorShape.ring.makeLayer(size: CGSize(width: circleSize, height: circleSize), color: color)
change(animation: animation, values: ["{0,0}", "{hx,-fy}", "{fx,0}", "{0,0}"], deltaX: deltaX, deltaY: deltaY)
bottomLeftCircle.frame = CGRect(x: x, y: y + size.height - circleSize, width: circleSize, height: circleSize)
bottomLeftCircle.add(animation, forKey: "animation")
layer.addSublayer(bottomLeftCircle)
let bottomRightCircle = ActivityIndicatorShape.ring.makeLayer(size: CGSize(width: circleSize, height: circleSize), color: color)
change(animation: animation, values: ["{0,0}", "{-fx,0}", "{-hx,-fy}", "{0,0}"], deltaX: deltaX, deltaY: deltaY)
bottomRightCircle.frame = CGRect(x: x + size.width - circleSize, y: y + size.height - circleSize, width: circleSize, height: circleSize)
bottomRightCircle.add(animation, forKey: "animation")
layer.addSublayer(bottomRightCircle)
}
}
// MARK: - Setup
private extension ActivityIndicatorAnimationBallTrianglePath {
var defaultAnimation: CAKeyframeAnimation {
let animation = CAKeyframeAnimation(keyPath: .transform)
animation.keyTimes = [0, 0.33, 0.66, 1]
animation.timingFunctions = [timingFunction, timingFunction, timingFunction]
animation.duration = duration
animation.repeatCount = .infinity
animation.isRemovedOnCompletion = false
return animation
}
func change(animation: CAKeyframeAnimation, values rawValues: [String], deltaX: CGFloat, deltaY: CGFloat) {
let values = NSMutableArray(capacity: 5)
for rawValue in rawValues {
let point = NSCoder.cgPoint(for: translateString(valueString: rawValue, deltaX: deltaX, deltaY: deltaY))
values.add(NSValue(caTransform3D: CATransform3DMakeTranslation(point.x, point.y, 0)))
}
animation.values = values as [AnyObject]
}
func translateString(valueString: String, deltaX: CGFloat, deltaY: CGFloat) -> String {
let valueMutableString = NSMutableString(string: valueString)
let fullDeltaX = 2 * deltaX
let fullDeltaY = 2 * deltaY
var range = NSRange(location: 0, length: valueMutableString.length)
valueMutableString.replaceOccurrences(of: "hx", with: "\(deltaX)", options: .caseInsensitive, range: range)
range.length = valueMutableString.length
valueMutableString.replaceOccurrences(of: "fx", with: "\(fullDeltaX)", options: .caseInsensitive, range: range)
range.length = valueMutableString.length
valueMutableString.replaceOccurrences(of: "hy", with: "\(deltaY)", options: .caseInsensitive, range: range)
range.length = valueMutableString.length
valueMutableString.replaceOccurrences(of: "fy", with: "\(fullDeltaY)", options: .caseInsensitive, range: range)
return valueMutableString as String
}
}
| [
289816,
370043,
331011,
239364
] |
fd748a30733c44a09fe716cf6ac0875d1312ddaa | 56bedf9b1707840c268800c7fbb636ad54872aeb | /Control Flow - Control Transfer Statements.swift | 3db303bd27f919f46c6b6c83371e18734a7408b6 | [] | no_license | iosdevted/Swift5-Xcode10 | c45e079a2f700adbe3286b97b553f11af27cc564 | e1f9c13f004ccfef4feb98d7bf6a9f5f4f2f6565 | refs/heads/master | 2022-02-07T01:36:33.494262 | 2019-07-31T13:45:47 | 2019-07-31T13:45:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 988 | swift | import Foundation
//Control Flow
//Control Transfer Statements
//fallthrough
let integerToDescribe = 5
var description = "The number \(integerToDescribe) is"
switch integerToDescribe {
case 2, 3, 5, 7, 11, 13, 17, 19:
description += " a prime number, and also"
fallthrough
default:
description += " an integer."
}
print(description)
// Prints "The number 5 is a prime number, and also an integer."
//Early Exit
func greet(person: [String: String]) {
guard let name = person["name"] else {
return
}
print("Hello \(name)!")
guard let location = person["location"] else {
print("I hope the weather is nice near you.")
return
}
print("I hope the weather is nice in \(location).")
}
greet(person: ["name": "John"])
// Prints "Hello John!"
// Prints "I hope the weather is nice near you."
greet(person: ["name": "Jane", "location": "Cupertino"])
// Prints "Hello Jane!"
// Prints "I hope the weather is nice in Cupertino."
| [
-1
] |
9e419a616dbf7a077a7e7739c0d0aaf9a56c2242 | a1c3d3fb58c508687dd4148b63a18fcd2bc541b4 | /Sources/SwiftyXBee/Models/APIFrameData/ATCommandData.swift | 4e80294e76a8d5c1d2c56105dc732d3dd4fbcb85 | [
"MIT"
] | permissive | shifu201/SwiftyXBee | 4e9a9160e1a33252ba2d4f24736d2813ee6020d3 | 665712020b93340b973084e45118775ba19d1518 | refs/heads/master | 2022-04-19T12:17:02.144658 | 2019-10-02T09:08:52 | 2019-10-02T09:12:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,199 | swift | //
// ATCommandData.swift
// SwiftyXBee
//
// Created by Samuel Cornejo on 9/11/19.
//
import Foundation
public struct ATCommandData: BaseFrameData, EscapedSerialWritable {
// MARK: Variables Declaration
/// The packet's frame type
public var frameType: FrameType
/// The packet's frame id
public var frameId: FrameId
/// The AT Command itself
public var command: ATCommand
/// The data to be written to the Serial port
public var serialData: [CChar] {
return getWritableSerialData().map({ CChar(bitPattern: $0) })
}
/// The escaped data to be written to the Serial port
public var escapedSerialData: [CChar] {
return getWritableSerialData().escapeDataIfNeeded()
}
// MARK: Initializer
public init(frameType: FrameType = .atCommand,
frameId: FrameId = .sendACK,
command: ATCommand) {
self.frameType = frameType
self.frameId = frameId
self.command = command
}
// MARK: Private Methods
private func getWritableSerialData() -> [UInt8] {
return [frameType.rawValue, frameId.rawValue] + command.rawValue
}
}
| [
-1
] |
dfcf73a036d147ae31e1814c13d2d932c28e53ff | ab5c2207f94820a2a1cfffb07ac3ee81ff55e998 | /GitHubTest1UITests/GitHubTest1UITests.swift | 03e38f75dce2951801a1646c3ce17ef336ef16a3 | [] | no_license | amohapatra16/Okonomisk | 72d52e7a1e0a3e81f5496c18a9de3e5873a847e7 | 38deae5a3da99883f0c1903ffac94a73a97efa59 | refs/heads/main | 2023-06-13T06:40:53.257928 | 2021-07-02T17:14:34 | 2021-07-02T17:14:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,436 | swift | //
// GitHubTest1UITests.swift
// GitHubTest1UITests
//
// Created by Esha Patel on 6/29/21.
//
import XCTest
class GitHubTest1UITests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testLaunchPerformance() throws {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
}
}
| [
360463,
376853,
344106,
253996,
385078,
163894,
352314,
376892,
32829,
352324,
352327,
385095,
393291,
163916,
368717,
254039,
426074,
368732,
32871,
352359,
221292,
385135,
376945,
385147,
426124,
196758,
49308,
65698,
49317,
377008,
377010,
377025,
377033,
164043,
417996,
254157,
368849,
368850,
139478,
385240,
254171,
147679,
147680,
205034,
254189,
254193,
344312,
336121,
147716,
368908,
180494,
262419,
254228,
368915,
377116,
254250,
131374,
418095,
336177,
368949,
180534,
155968,
270663,
319816,
368969,
254285,
180559,
377168,
344402,
368982,
270703,
385407,
385409,
106893,
270733,
385423,
385433,
213402,
385437,
254373,
385448,
385449,
115116,
385463,
336319,
336323,
188870,
262619,
377309,
377310,
369121,
369124,
270823,
213486,
360945,
139766,
393719,
377337,
254459,
410108,
410109,
262657,
377346,
410126,
262673,
393745,
385554,
254487,
410138,
188957,
377374,
385569,
385578,
377388,
197166,
393775,
418352,
33339,
352831,
33344,
385603,
385612,
426575,
385620,
369236,
270938,
352885,
352886,
344697,
369285,
311944,
344714,
311950,
377487,
180886,
426646,
352921,
377499,
344737,
352938,
418479,
164532,
336565,
377531,
377534,
377536,
385737,
385745,
369365,
369366,
385751,
361178,
352989,
352990,
295649,
418529,
385763,
369383,
361194,
418550,
344829,
197377,
434956,
418579,
426772,
197398,
426777,
344864,
197412,
336678,
189229,
197424,
197428,
336693,
377656,
197433,
426809,
377669,
197451,
369488,
385878,
385880,
197467,
435038,
197479,
385895,
385901,
197489,
164730,
254851,
369541,
172936,
320394,
426894,
377754,
172971,
140203,
377778,
189362,
189365,
377789,
213961,
345034,
418774,
386007,
386009,
418781,
386016,
123880,
418793,
435185,
222193,
271351,
435195,
328701,
386049,
328705,
418819,
410629,
377863,
189448,
361487,
435216,
386068,
254997,
336928,
336930,
410665,
345137,
361522,
386108,
410687,
377927,
361547,
361570,
214116,
214119,
402538,
173168,
377974,
66684,
402568,
140426,
386191,
410772,
296091,
222364,
418975,
124073,
402618,
402632,
402641,
419028,
222441,
386288,
66802,
271607,
386296,
369912,
369913,
419066,
386300,
386304,
369929,
419097,
115997,
222496,
369964,
353581,
116014,
66863,
345397,
386363,
337226,
378186,
353611,
353612,
353617,
378201,
230772,
337280,
353672,
263561,
370066,
9618,
411028,
370072,
148900,
361928,
337359,
329168,
353751,
320997,
361958,
271850,
271853,
411119,
116209,
386551,
271880,
198155,
329231,
370200,
157219,
157220,
394793,
353875,
345697,
271980,
206447,
403057,
42616,
337533,
370307,
419462,
149127,
419464,
149128,
214667,
411275,
345753,
255651,
337590,
403149,
345813,
370390,
272087,
345817,
181992,
345832,
345835,
141037,
34547,
173828,
395018,
395019,
395026,
435993,
345882,
411417,
255781,
362281,
378666,
403248,
378673,
345910,
182070,
182071,
436029,
337734,
272207,
272208,
337746,
395092,
345942,
345950,
370526,
362336,
255844,
214894,
362351,
214896,
182145,
337816,
329627,
436130,
354210,
436135,
10153,
362411,
370604,
362418,
411587,
362442,
346066,
354268,
403421,
436189,
329696,
354273,
403425,
436199,
354279,
174058,
329707,
337899,
247787,
354283,
436209,
182277,
354310,
403463,
354311,
43016,
354312,
436235,
346117,
419857,
436248,
346153,
272432,
403507,
378933,
378934,
436283,
403524,
436293,
436304,
411738,
272477,
321632,
395373,
346237,
436372,
362658,
436388,
133313,
395458,
338118,
436429,
346319,
379102,
387299,
18661,
379110,
149743,
379120,
436466,
411892,
436471,
395511,
436480,
272644,
338187,
338188,
395536,
338196,
379157,
272661,
157973,
338217,
362809,
379193,
395591,
436570,
272730,
215395,
362864,
272755,
354678,
436609,
436613,
395653,
395660,
264591,
272784,
420241,
436644,
272815,
436659,
338359,
436677,
256476,
420326,
166403,
420374,
330291,
281165,
191065,
436831,
117350,
420461,
346739,
346741,
420473,
166533,
363155,
346771,
264855,
363161,
436897,
355006,
363228,
436957,
436960,
264929,
338658,
346859,
330476,
35584,
133889,
207639,
363295,
281378,
355117,
191285,
273209,
355129,
273211,
355136,
355138,
420680,
355147,
355148,
355153,
387927,
363353,
363354,
420702,
363361,
363362,
281444,
412516,
355173,
355174,
207724,
355182,
207728,
420722,
330627,
265094,
387977,
396171,
355216,
224146,
224149,
256918,
256919,
256920,
256934,
273336,
273341,
330688,
379845,
363462,
420808,
273353,
207839,
347104,
134124,
412653,
257007,
248815,
347122,
183291,
437245,
257023,
125953,
396292,
330759,
330766,
347150,
412692,
330789,
248871,
412725,
257093,
404550,
339031,
257126,
265318,
404582,
396395,
265323,
404589,
273523,
363643,
248960,
363658,
404622,
224400,
265366,
347286,
429209,
339101,
429216,
265381,
380069,
421050,
265410,
183492,
273616,
421081,
339167,
421102,
290030,
52473,
363769,
52476,
412926,
437504,
388369,
380178,
429332,
412963,
257323,
437550,
273713,
347451,
257353,
257354,
109899,
437585,
331091,
150868,
372064,
429410,
437602,
388458,
265579,
421240,
388488,
396697,
396709,
380335,
355761,
421302,
134586,
380348,
380350,
216510,
216511,
200136,
273865,
339403,
372172,
413138,
437726,
429540,
3557,
3559,
265720,
216575,
372226,
437766,
208397,
413202,
413206,
388630,
175640,
216610,
372261,
347693,
323120,
396850,
200245,
323126,
134715,
421437,
396865,
413255,
265800,
273992,
421452,
265809,
396885,
265816,
396889,
388699,
396896,
388712,
388713,
339579,
396927,
224907,
396942,
405140,
274071,
208547,
208548,
405157,
388775,
364202,
421556,
224951,
224952,
224985,
159462,
372458,
397040,
12017,
274170,
175874,
249606,
323335,
372497,
397076,
421657,
339746,
257831,
167720,
421680,
421686,
274234,
241471,
339782,
339799,
274276,
274288,
372592,
274296,
372625,
118693,
438186,
151492,
380874,
372699,
380910,
380922,
380923,
274432,
372736,
315431,
430120,
430127,
405552,
249912,
225347,
421958,
176209,
381013,
53334,
356446,
438374,
176231,
438378,
422000,
249976,
266361,
422020,
381061,
168069,
168070,
381071,
430231,
200856,
422044,
192670,
192671,
258213,
430263,
266427,
356550,
266447,
372943,
258263,
356575,
438512,
372979,
389364,
381173,
135416,
356603,
266504,
61720,
381210,
389406,
438575,
266547,
332084,
397620,
438583,
127292,
438592,
397650,
348499,
348501,
389465,
110955,
160111,
250227,
438653,
266628,
340356,
225684,
373141,
373144,
389534,
397732,
373196,
184799,
201195,
324098,
340489,
397841,
258584,
397855,
348709,
348710,
397872,
340539,
266812,
438850,
348741,
381515,
348748,
430681,
332379,
184938,
373357,
184942,
176751,
389744,
356983,
356984,
209529,
356990,
422529,
373377,
201348,
152196,
356998,
356999,
348807,
275102,
176805,
340645,
422567,
176810,
160441,
422591,
225996,
135888,
398039,
373485,
373486,
21239,
275193,
348921,
430853,
430860,
62222,
430880,
283431,
152372,
160569,
430909,
160576,
348999,
439118,
381791,
127840,
357219,
439145,
381811,
201590,
398205,
340865,
349066,
349068,
381840,
390034,
373653,
430999,
381856,
185252,
398244,
422825,
381872,
398268,
349122,
398275,
373705,
127945,
340960,
398305,
398313,
127990,
349176,
201721,
349179,
357380,
398370,
357413,
357420,
398405,
218187,
250955,
250965,
439391,
250982,
398444,
62574,
357487,
119925,
349304,
349315,
349317,
373902,
324761,
373937,
373939,
218301,
259275,
259285,
357594,
414956,
251124,
439550,
439563,
414989,
259346,
349458,
259347,
382243,
382246,
382257,
382264,
333115,
193853,
251212,
406862,
259408,
374110,
259449,
382329,
357758,
357763,
112019,
398740,
374189,
251314,
259513,
259569,
251379,
398844,
210429,
366081,
153115,
431646,
349727,
431662,
374327,
210489,
128589,
333394,
349780,
300643,
415334,
54895,
366198,
210558,
210559,
415360,
415369,
431754,
210569,
267916,
415376,
259741,
153252,
399014,
210601,
202413,
415419,
259780,
267978,
333522,
325345,
431861,
161539,
366358,
169751,
431901,
341791,
284460,
399148,
202541,
431918,
153392,
431935,
415555,
325444,
325449,
341837,
415566,
431955,
325460,
341846,
259937,
382820,
415592,
325491,
341878,
276343,
333687,
350072,
112510,
325508,
333700,
243590,
350091,
350092,
350102,
350108,
333727,
128955,
219102,
6116,
432114,
415740,
268286,
415744,
399372,
358418,
153618,
292901,
178215,
358455,
399433,
104534,
260206,
432241,
374913,
374914,
415883,
333968,
284827,
333990,
104633,
260285,
268479,
374984,
334049,
268515,
383208,
260337,
260338,
432373,
375040,
260355,
432387,
375052,
325904,
391448,
268570,
178459,
186660,
268581,
325930,
358698,
260396,
432435,
358707,
178485,
358710,
14654,
268609,
383309,
383327,
366948,
416101,
383338,
432503,
432511,
252309,
39323,
375211,
129461,
342454,
358844,
326083,
416201,
129484,
154061,
416206,
432608,
391654,
432616,
334315,
375281,
334345,
432650,
342549,
416288,
342560,
350758,
350759,
358951,
358952,
219694,
219695,
375369,
375373,
416334,
416340,
244311,
260705,
416353,
375396,
268901,
244345,
375438,
326288,
383668,
342714,
39616,
383708,
269036,
432883,
203511,
342775,
383740,
416509,
432894,
162559,
375552,
359166,
383755,
326413,
342827,
391980,
375610,
416577,
293702,
416591,
244569,
375644,
252766,
342888,
392057,
211835,
392065,
260995,
400262,
392071,
424842,
400271,
392080,
400282,
7070,
211871,
359332,
359333,
326571,
252848,
326580,
261045,
261046,
326586,
359365,
211913,
252878,
342990,
433104,
359380,
433112,
433116,
359391,
187372,
383980,
343020,
383994,
171009,
384004,
433166,
384015,
433173,
384031,
252959,
375848,
261191,
375902,
375903,
392288,
253028,
318571,
351343,
187505,
138354,
384120,
392317,
343166,
384127,
392320,
359574,
351389,
253098,
367791,
367792,
367798,
343230,
367809,
253124,
113863,
351445,
195809,
228587,
253168,
351475,
351489,
367897,
367898,
130347,
261426,
212282,
359747,
359748,
146760,
146763,
114022,
253288,
425327,
425331,
163190,
384379,
253316,
384391,
253339,
253340,
343457,
245160,
359860,
359861,
343480,
228804,
425417,
425434,
253431,
359931,
187900,
343552,
409095,
359949,
253456,
253462,
146976,
245290,
245291,
343606,
163385,
425534,
138817,
147011,
147020,
179800,
343646,
155238,
204394,
138862,
188021,
425624,
245413,
384693,
376502,
409277,
409289,
425682,
245471,
155360,
212721,
163575,
360194,
409355,
155408,
417556,
204600,
384826,
409404,
360253,
409416,
376661,
368471,
425820,
368486,
384871,
425832,
409446,
40809,
368489,
417648,
417658,
360315,
253828,
425875,
253851,
376733,
204702,
253868,
204722,
343993,
188349,
212947,
212953,
360416,
294887,
253930,
385011
] |
2e115d1f968e16c742ce356321eb98626bde1204 | 52f507d4bd84e05a415df2856558a7de4568f5b5 | /0918PinPlist/AppDelegate.swift | 9e1e437f66fa4379e1a97240bfa54a8a141d0fd8 | [] | no_license | kangseonwon/20170221-1 | 09b0934962208ab128a432e9246fa122d6aa354d | 1e0f09bc6b54a835cd8ee3d19256999d27375703 | refs/heads/master | 2021-07-01T14:37:56.850294 | 2017-09-21T02:09:39 | 2017-09-21T02:09:39 | 104,289,907 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,178 | swift | //
// AppDelegate.swift
// 0918PinPlist
//
// Created by D7702_10 on 2017. 9. 18..
// Copyright © 2017년 D7702_10. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
229388,
294924,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
319544,
204856,
229432,
286776,
286778,
286791,
237640,
278605,
286797,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
131209,
303241,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
320007,
287238,
172552,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
189039,
295538,
172660,
189040,
189044,
287349,
287355,
287360,
295553,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
287390,
303773,
164509,
172705,
287394,
172702,
303780,
172707,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
279231,
287427,
312005,
312006,
107208,
107212,
172748,
287436,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
279267,
312035,
295654,
279272,
312048,
230128,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
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,
304005,
295813,
304007,
320391,
213895,
304009,
304011,
230284,
304013,
279438,
295822,
213902,
189329,
295825,
189331,
304019,
58262,
304023,
279452,
410526,
279461,
279462,
304042,
213931,
304055,
230327,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
295949,
230413,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
296004,
132165,
336964,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
361576,
296040,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
165038,
238766,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
296264,
238919,
320840,
296267,
296271,
222545,
230739,
312663,
337244,
222556,
230752,
312676,
230760,
173418,
410987,
230763,
148843,
230768,
296305,
312692,
230773,
304505,
181626,
304506,
279929,
181631,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
148946,
288214,
239064,
329177,
288217,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
148990,
321022,
206336,
402942,
296450,
296446,
230916,
230919,
214535,
304651,
370187,
304653,
230923,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
280276,
313044,
321239,
280283,
18140,
313052,
288478,
313055,
321252,
313066,
280302,
288494,
280304,
313073,
419570,
288499,
321266,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
10170,
296890,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
313340,
239612,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
215154,
313458,
280691,
149618,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
280755,
288947,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
321740,
313548,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
379218,
280919,
354653,
354656,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
240011,
199051,
289166,
240017,
297363,
190868,
297365,
240021,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
305594,
289210,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
338440,
150025,
330244,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
158317,
19053,
313973,
297594,
281210,
158347,
182926,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
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,
183172,
158596,
338823,
322440,
314249,
240519,
183184,
142226,
240535,
289687,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
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,
298306,
380226,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
306555,
314747,
298365,
290171,
290174,
224641,
281987,
314756,
298372,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
282133,
290325,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
324757,
282261,
175770,
298651,
323229,
282269,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
307009,
413506,
241475,
307012,
298822,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
315482,
217179,
315483,
192605,
233567,
200801,
299105,
217188,
299109,
307303,
315495,
356457,
307307,
45163,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
184479,
299167,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
176311,
299191,
307385,
307386,
258235,
307388,
176316,
307390,
184503,
299200,
184512,
307394,
307396,
299204,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
276052,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
291231,
61855,
283042,
291238,
291241,
127403,
127405,
127407,
291247,
299440,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
315856,
176592,
127440,
315860,
176597,
283095,
127447,
299481,
127449,
176605,
242143,
127455,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
135672,
127480,
233979,
291323,
127485,
291330,
283142,
127494,
135689,
233994,
127497,
127500,
291341,
233998,
127506,
234003,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
135844,
299684,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
242396,
299740,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
242450,
234258,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
242511,
234319,
234321,
234324,
201557,
185173,
234329,
234333,
308063,
234336,
234338,
349027,
242530,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
234370,
201603,
291714,
234373,
316294,
226182,
234375,
308105,
291716,
226185,
234379,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
234410,
291754,
291756,
324522,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
234431,
242623,
324544,
324546,
234434,
324548,
234437,
226245,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
324599,
234487,
234490,
234493,
234496,
316416,
308226,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
234519,
316439,
234520,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
234549,
300085,
300088,
234553,
234556,
234558,
316479,
234561,
308291,
316483,
160835,
234563,
234568,
234570,
316491,
300108,
234572,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
300133,
234597,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
300148,
234614,
398455,
144506,
234618,
275579,
234620,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
234648,
234653,
300189,
119967,
324766,
324768,
283805,
234657,
242852,
234661,
283813,
300197,
234664,
275626,
234667,
316596,
308414,
300223,
234687,
300226,
308418,
283844,
300229,
308420,
308422,
226500,
234692,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
316663,
275703,
300284,
275710,
300287,
300289,
292097,
161027,
300292,
300294,
275719,
234760,
300299,
177419,
242957,
283917,
300301,
177424,
275725,
349464,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
283973,
300357,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
324978,
136562,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
284084,
284087,
292279,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
226802,
292338,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
308790,
284215,
316983,
194103,
284218,
194101,
226877,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
292433,
284243,
300628,
284245,
194130,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
276086,
284278,
292470,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
276109,
284301,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
276166,
284358,
358089,
284362,
276170,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
325408,
300832,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
153417,
292681,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
284511,
317279,
227175,
292715,
300912,
284529,
292721,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
358292,
284564,
317332,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
317353,
276395,
292776,
292784,
276402,
358326,
161718,
276410,
276411,
358330,
276418,
276425,
301009,
301011,
301013,
292823,
301015,
301017,
358360,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
292843,
276460,
292845,
276464,
178161,
227314,
276466,
325624,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
292876,
317456,
276496,
317458,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
243779,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
194654,
178273,
309346,
194657,
309348,
350308,
309350,
227426,
309352,
350313,
309354,
301163,
350316,
194660,
227430,
276583,
276590,
350321,
284786,
276595,
301167,
350325,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
309450,
301258,
276685,
309455,
276689,
309462,
301272,
276699,
309468,
194780,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309491,
227571,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
276843,
293227,
276848,
293232,
186744,
211324,
227709,
285061,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
317951,
309764,
301575,
121352,
236043,
317963,
342541,
55822,
113167,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
318020,
301636,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
342707,
318132,
154292,
293555,
277173,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
293666,
285474,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
293706,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
15224,
236408,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
276579,
293811,
293817,
293820,
203715,
326603,
276586,
293849,
293861,
228327,
228328,
228330,
318442,
228332,
326638,
277486,
318450,
293876,
293877,
285686,
302073,
285690,
293882,
302075,
244731,
121850,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
310344,
277577,
293960,
277583,
203857,
310355,
293971,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
302205,
285821,
392326,
285831,
253064,
302218,
294026,
285835,
384148,
162964,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
326991,
294223,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
310659,
351619,
294276,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
245191,
310727,
64966,
163272,
277959,
292968,
302541,
277963,
302543,
277966,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
302617,
286233,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
40488,
278057,
294439,
40491,
294440,
294443,
294445,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
400976,
212560,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
302793,
294601,
343757,
212690,
278227,
286420,
319187,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
311048,
294664,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
280021,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
40840,
40851,
294803,
188312,
294811,
319390,
237470,
40865,
319394,
294817,
294821,
311209,
180142,
294831,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
f251f619d70d20d5fa06b07364935f9560507f07 | f24f694eb4e736a485cb8b7ce3e23d7ece03a36c | /Playgrounds/Playgrounds2-Mixed/TheBasics.playground/contents.swift | a4e2823092db4849f5b69d5a3bebc2cb1955c640 | [] | no_license | roporter/Swift-Examples | 7520ce455326c224e7a497482f30f33842edc694 | aad2af07e58fc95937a758d7809e41045b613d95 | refs/heads/master | 2021-01-01T04:20:26.155476 | 2016-05-20T11:25:32 | 2016-05-20T11:25:32 | 58,922,512 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 8,330 | swift | // The Basics Chapter of “The Swift Programming Language.” iBooks. https://itun.es/au/jEUH0.l
//: # The Basics
//: ## Constants and Variables
//: ### Declaring Constants and Variables
let maximumNumberOfLoginAttempts = 10
var currentLoginAttempt = 0
var x = 0.0, y = 0.0, z = 0.0
//: ### Type Annotations
var welcomeMessage: String
welcomeMessage = "Hello"
//: ### Naming Constants and Variables
let π = 3.14159
let 你好 = "你好世界"
let 🐶🐮 = "dogcow"
var friendlyWelcome = "Hello!"
friendlyWelcome = "Bonjour!"
let languageName = "Swift"
//languageName = "Swift++" // Compile time error
//: Printing Constants and Variables
print(friendlyWelcome)
print(π, 你好, 🐶🐮, separator: ", ", terminator: "")
print("The current value of friendlyWelcome is \(friendlyWelcome)")
//: ## Comments
// this is a comment
/* this is also a comment,
but written over multiple lines*/
/* this is the start of the first multiline comment
/* this is the second, nested multiline comment */
this is the end of the first multiline comment */
//: ## Semicolons
let cat = "🐱"; print(cat)
//: ## Integers
//: ### Integer Bounds
let minValue = UInt8.min
let maxValue = UInt8.max
//: ## Floating-Point Numbers
var w = [1, 1.2]
//: ## Type Safety and Type Inference
var meaningOfLife = 42
// inferred to be of type Int
// meaningOfLife = 35.0 //Type Error
let pi = 3.14159
let anotherPi = 3 + 0.14159
//: ## Numeric Literals
let descimalInteger = 17
let binaryInteger = 0b10001
let octalInteger = 0o21
let hexadecimalInteger = 0x11
//let hexFloat = 0x1234.0x5678
1.25e2
1.25e-2
0xFp2
0x8p4
let decimalDouble = 12.1875
let exponentDouble = 1.21875e1
let hexadecialDouble = 0xC.3p0
let paddedDouble = 000123.456
let oneMillion = 1_000_000
let justOverOneMillion = 1_000_000.000_000_1
//: ## Numeric Conversion
//: ### Integer Conversion
//let cannotBeNegative: UInt8 = -1
//let tooBig: Int8 = Int8.max + 1
let twoThousand: UInt16 = 2_000
let one: UInt8 = 1
let twoThousandAndOne = twoThousand + UInt16(one)
//: ### Integer and Floating Point Conversion
let three = 3
let pointOneFourOneFiveNine = 0.14159
let pi2 = Double(three) + pointOneFourOneFiveNine
let integerPi = Int(pi)
// Floats are always truncated when cast to Integers
let integerFourPointSeven = Int(4.75)
let integerNegativeThreePointNine = Int(-3.9)
// Literals can be cross type combined because they have no type until they are evaluated
3 + 0.14159
//: ## Type Aliases
// Type aliases are useful when you want to refer to an existing type by a name that is contextually more appropriate, such as when working with data of a specific size from an external source:
typealias AudioSample = UInt16
var macAmplitudeFound = AudioSample.min
//: ## Booleans
let orangesAreOrange = true
let turnipsAreDelicious = false
if turnipsAreDelicious {
print("Mmm, tasty turnips!")
} else {
print("Eww, turnips are horrible.")
}
// Non-Bool types can't be used for flow control
let i = 1
/*
if i {
}
*/
if i == 1 {
}
//: ## Tuples
let http404Error = (404, "Not Found")
let (statusCode, statusMessage) = http404Error
print("The status code is \(statusCode)")
print("The status message is \(statusMessage)")
// use _ if you don't want to decompose one of the values of a tuple
let (justTheStatusCode, _) = http404Error
print("The status code is \(justTheStatusCode)")
// You can access the values of the tuple using index numbers
print("The status code is \(http404Error.0)")
print("The status message is \(http404Error.1)")
// You can name the elements of a tuple when it is defined
let http200Status = (statusCode: 200, description: "OK")
print("The status code is \(http200Status.statusCode)")
print("The status message is \(http200Status.description)")
// “Tuples are useful for temporary groups of related values. They are not suited to the creation of complex data structures. If your data structure is likely to persist beyond a temporary scope, model it as a class or structure, rather than as a tuple. For more information”
//: ## Optionals
let possibleNumber = "123"
let convertedNumber = Int(possibleNumber)
// convertedNumber is inferred to be ot type "Int?" (optional Int)
// If statements and forced Unwrapping
if (convertedNumber != nil) {
print("\(possibleNumber) has an integer value of \(convertedNumber!)")
} else {
print("\(possibleNumber) could not be converted to an integer")
}
// Using ! on a non-existent value triggers a runtime error
if let actualNumber = Int(possibleNumber) {
print("\(possibleNumber) has an integer value of \(actualNumber)")
} else {
print("\(possibleNumber) could not be converted to an integer")
}
//actualNumber // This brings up an error as the unwrapped value is only available within the if statement
if let firstNumber = Int("4"), secondNumber = Int("42") where firstNumber < secondNumber {
print("\(firstNumber) < \(secondNumber)")
}
//: ### nil
var serverResponseCode: Int? = 404
serverResponseCode = nil
var surveyAnswer: String?
//: ### If statements and Forced Unwrapping
if convertedNumber != nil {
print("converted number contains some integer value")
}
if convertedNumber != nil {
print("converted number contains \(convertedNumber!)")
}
//: ### Optional Binding
if let actualNumber = Int(possibleNumber) {
print("\'\(possibleNumber)\' has a value of \(actualNumber)")
} else {
print("\'\(possibleNumber)\' could not be converted to an Int")
}
//: You can use both contants and variables with optional binding
if var actualNumber = Int(possibleNumber) {
actualNumber++
print("\'\(possibleNumber)\'s has been retreived and then incremented to give a value of \(actualNumber)")
}
//: Multiple optional bindings can be unwrapped in a single if statement by separating them with commas
let a: Int? = 4
let b: Int? = nil
let c: Int? = 8
if let A = a, B = b, C = c {
print(A, B, C)
} else {
print("One of the optionals was nil so none of the optionals were unwrapped")
}
if let A = a, C = c {
print(A, C)
}
//: ### Implicitly Unwrapped Optionals
//: Implicitly unwrapped optionals are useful when an optional’s value is confirmed to exist immediately after the optional is first defined and can definitely be assumed to exist at every point thereafter. The primary use of implicitly unwrapped optionals in Swift is during class initialization
let possibleString: String? = "An optional string."
let forcedString: String = possibleString!
let assumedString: String! = "An implicitly unwrapped optional string"
let implicitString: String = assumedString
if assumedString != nil {
print(assumedString)
}
if let definiteString = assumedString {
print(definiteString)
}
//: Implicitly unwrapped optionals should not be used when there is a possibility of a variable becoming nil at a later point. Always use a normal optional type if you need to check for a nil value during the lifetime of a variable.
//: ## Error Handling
//: In contrast to optionals, which can use the presence or absence of a value to signify success or failure of a function, error handling allows you to determine the underlying cause of failure and if necessary propagate the error to another part of your program.
func canThrowError() throws {
// This function may or may not throw an error.
}
do {
try canThrowError()
// no error was thrown
} catch {
// an error was thrown
}
enum Error: ErrorType {
case OutOfCleanDishes
case MissingIngredients([String])
}
func makeASandwich() throws { throw Error.MissingIngredients(["butter","ham","bread"]) }
func eatASandwich() {print("yum yum yum") }
func washDishes() { print("Wash the dishes") }
func buyGroceries(ingredients: [String]) { ingredients.forEach{ i in print(i) }}
do {
try makeASandwich()
eatASandwich()
} catch Error.OutOfCleanDishes {
washDishes()
} catch Error.MissingIngredients(let ingredients) {
buyGroceries(ingredients)
} catch {
print("Why did I fail")
}
//: ## Assertions
//: ### Debugging with Assertions
//: Use an assertion whenever a condition has the potential to be false, but must definitely be true in order for your code to continue execution.
let age = -3
//assert(age >= 0, "A person's age cannot be less than zero")
// Left this out as it stops the REPL from continuing
| [
319681
] |
0fa321487fd9eaa221cf87be2e4b223287c4e275 | 04264d49a5dddc6f28cc884b132290a337e710d7 | /appdb/Tabs/Featured/Details/Cells/Details/Screenshots/Screenshots/Details+Screenshots.swift | 0552d0c61e88c4101b1356d26c4994d57c9f2651 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | sharklatan/appdb | 23557d4a3f327c40b0192d8fe9e48ec6bd4dfb1f | 50411adf1578eaef56d67c2397f2cd7f52beb462 | refs/heads/master | 2021-06-20T23:15:33.630473 | 2021-03-05T22:19:04 | 2021-03-05T22:19:04 | 344,989,794 | 1 | 1 | MIT | 2021-03-18T06:11:31 | 2021-03-06T02:48:56 | null | UTF-8 | Swift | false | false | 4,984 | swift | //
// Details+Screenshots.swift
// appdb
//
// Created by ned on 22/02/2017.
// Copyright © 2017 ned. All rights reserved.
//
import Cartography
import AlamofireImage
protocol ScreenshotRedirectionDelegate: class {
func screenshotImageSelected(with index: Int, _ allLandscape: Bool, _ mixedClasses: Bool, _ magic: CGFloat)
}
extension DetailsScreenshots: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "screenshot", for: indexPath) as? DetailsScreenshotCell else { return UICollectionViewCell() }
if let url = URL(string: screenshots[indexPath.row].image) {
cell.image.af.setImage(withURL: url, filter: filterAtIndex(indexPath.row), imageTransition: .crossDissolve(0.2))
}
return cell
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
screenshots.count
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
sizeAtIndex(indexPath.row)
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
delegate?.screenshotImageSelected(with: indexPath.row, allLandscape, mixedClasses, magic)
}
}
class DetailsScreenshots: DetailsCell {
override var identifier: String { "screenshots" }
override var height: CGFloat {
if screenshots.isEmpty { return 0 }
return allLandscape ? (230 ~~ 176) : (314 ~~ 280)
}
weak var delegate: ScreenshotRedirectionDelegate?
var collectionView: UICollectionView!
var screenshots: [Screenshot] = []
var magic: CGFloat {
if screenshots.filter({$0.type == "ipad"}).isEmpty { return 1.775 }
if screenshots.filter({$0.type == "iphone"}).isEmpty { return 1.333 }
return 0
}
var widthIfPortrait: CGFloat { round(((314 ~~ 280) - (Global.Size.margin.value * 2)) / magic) }
var widthIfLandscape: CGFloat { round(((230 ~~ 176) - (Global.Size.margin.value * 2)) * magic) }
var allLandscape: Bool { (screenshots.filter({$0.class_ == "portrait"}).isEmpty && screenshots.filter({$0.class_.isEmpty}).isEmpty) }
var mixedClasses: Bool { !screenshots.filter({$0.class_ == "portrait"}).isEmpty && !screenshots.filter({$0.class_ == "landscape"}).isEmpty }
var spacing: CGFloat = 15
func sizeAtIndex(_ index: Int) -> CGSize {
if screenshots[index].class_ == "landscape" {
return CGSize(width: widthIfLandscape, height: (230 ~~ 176) - (Global.Size.margin.value * 2) - 1)
} else {
return CGSize(width: widthIfPortrait, height: height - (Global.Size.margin.value * 2) - 1)
}
}
func filterAtIndex(_ index: Int) -> ImageFilter {
Global.screenshotRoundedFilter(size: sizeAtIndex(index), radius: 7)
}
convenience init(type: ItemType, screenshots: [Screenshot], delegate: ScreenshotRedirectionDelegate) {
self.init(style: .default, reuseIdentifier: "screenshots")
self.type = type
self.screenshots = screenshots
self.delegate = delegate
selectionStyle = .none
preservesSuperviewLayoutMargins = false
addSeparator()
if !height.isZero {
let proposedWidth = allLandscape ? widthIfLandscape : widthIfPortrait
let layout = SnappableFlowLayout(width: mixedClasses ? 0 : proposedWidth, spacing: spacing)
layout.sectionInset = UIEdgeInsets(top: Global.Size.margin.value, left: Global.Size.margin.value,
bottom: Global.Size.margin.value, right: Global.Size.margin.value)
layout.minimumLineSpacing = spacing
layout.scrollDirection = .horizontal
collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
collectionView.register(DetailsScreenshotCell.self, forCellWithReuseIdentifier: "screenshot")
collectionView.delegate = self
collectionView.dataSource = self
collectionView.showsHorizontalScrollIndicator = false
collectionView.scrollsToTop = false
if !mixedClasses { collectionView.decelerationRate = UIScrollView.DecelerationRate.fast }
collectionView.theme_backgroundColor = Color.veryVeryLightGray
theme_backgroundColor = Color.veryVeryLightGray
setBackgroundColor(Color.veryVeryLightGray)
contentView.addSubview(collectionView)
setConstraints()
}
}
override func setConstraints() {
constrain(collectionView) { collection in
collection.edges ~== collection.superview!.edges
}
}
}
| [
-1
] |
2fbe3bc4c6c4b64d5eaac0103fbdeb3076493eec | 38616360596062fc23e43839d58704c7fdf5365c | /Modules/Time.swift | f5783809b8fb63e2d3a38be8a2e301e15419a002 | [] | no_license | timonFuss/CookAssist | c1fa9f720d38ea1a0224ec675496a0e68b09b84a | 851c7b617617e5311e777ccd9aff5c297efa8654 | refs/heads/master | 2020-06-14T03:21:46.812345 | 2019-07-02T14:50:34 | 2019-07-02T14:50:34 | 194,880,978 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 548 | swift | //
// Timer.swift
// Flavr
//
// Created by Timon Fuß on 23.03.19.
// Copyright © 2019 Timon Fuß. All rights reserved.
//
import Foundation
class Time: TimeModule {
override init(name: String, time: Int, finish : String, index : Int?=nil) {
super.init(name: name, time: time, finish: finish, index: index)
self.time = time
}
/**
Setting time of Timer
*/
func setTimeTo(time: Int) {
self.time = time
self.timer.invalidate()
self.start(withTime: self.time)
}
}
| [
-1
] |
3377948c39be984c64e940b474acff5015cc91b8 | 8b8fa4e409ad8e48483bbb99519584904786157a | /Break Reminder by Spikard/Extensions/NSStoryboardExtension.swift | c411e058cf806295746b8a3efd07718fadc01d3c | [
"MIT"
] | permissive | maspikard/BreakReminder | 9f9978b7520b9a67c59ae06601b05b9c7f4c1cf2 | 572744c5216eecd18fac58ce9a959ba4bdc9f0a1 | refs/heads/master | 2020-06-17T03:32:34.217181 | 2019-09-01T13:36:02 | 2019-09-01T13:36:02 | 195,781,795 | 0 | 0 | MIT | 2019-08-25T09:45:43 | 2019-07-08T09:37:48 | Swift | UTF-8 | Swift | false | false | 782 | swift | //
// NSStoryboardExtension.swift
// Spikard - Break Reminder
//
// Created by maxial on 26/05/2019.
// Copyright © 2019 Spikard. All rights reserved.
//
import Cocoa
private let kFirstWindowStoryboard = "FirstWindow"
private let kPopoverStoryboard = "Popover"
private let kShortBreakStoryboard = "ShortBreak"
private let kLongBreakStoryboard = "LongBreak"
private let kSettingsStoryboard = "Settings"
extension NSStoryboard.Name {
static let firstWindow = NSStoryboard.Name(kFirstWindowStoryboard)
static let popover = NSStoryboard.Name(kPopoverStoryboard)
static let shortBreak = NSStoryboard.Name(kShortBreakStoryboard)
static let longBreak = NSStoryboard.Name(kLongBreakStoryboard)
static let settings = NSStoryboard.Name(kSettingsStoryboard)
}
| [
-1
] |
3eb55e708506a6d61ae7616f9c13aa57a49c4905 | 2970c9474bcfffcf5b1fb4882740cca0ae06fd44 | /VoterApp/External/QuickCheckHelpers.swift | 15225b1d74da5be889a073d9f4517b0eef77ae69 | [
"Apache-2.0"
] | permissive | mbuka/2015.01_swift | 7c5dc3f18457ab7ec1683041e10670d37dbe9f6f | 1fd0ab438849b7e68de8909c5473f973e8eed8be | refs/heads/master | 2021-01-15T15:16:04.124293 | 2015-02-04T17:51:46 | 2015-02-04T17:51:46 | 29,976,153 | 0 | 0 | null | 2015-01-28T16:18:06 | 2015-01-28T16:18:06 | null | UTF-8 | Swift | false | false | 505 | swift | //
// QuickCheckHelpers.swift
// Voter
//
// Created by Krzysztof Profic on 27/01/15.
// Copyright (c) 2015 Lambda Academy. All rights reserved.
//
import Foundation
func iterateWhile<A>(condition: A -> Bool, initialValue: A, next: A -> A?) -> A {
if let x = next(initialValue) {
if condition(x) {
return iterateWhile(condition, x, next)
}
}
return initialValue
}
func random(#from: Int, #to: Int) -> Int {
return from + (Int(arc4random()) % (to-from))
} | [
-1
] |
ff8eb0e6aaff914928048a38987697c83ff6fcf1 | 80523fc91514736e74b9b23a75c052545f45a134 | /gbshop/App/Entity/Review/GetAllReviewResponse.swift | ba03fbdc42235890b2e98456e210103fc3b4ca3e | [] | no_license | dyanov/gbshop | 900c929d5a5a8a97bb122bb74ea7847df9e6b812 | d998044976c10a48b507cdc42f5b63bf0b3c4d95 | refs/heads/master | 2023-07-08T05:15:45.880925 | 2021-08-17T20:10:43 | 2021-08-17T20:10:43 | 382,052,519 | 0 | 0 | null | 2021-08-17T20:53:07 | 2021-07-01T14:03:27 | Swift | UTF-8 | Swift | false | false | 448 | swift | //
// GetAllReviewResponse.swift
// gbshop
//
// Created by Илья on 12.07.2021.
//
import Foundation
struct GetAllReviewResponse: Codable {
let result: Int
let pageNumber: Int
var errorMessage: String?
let reviews: [Review]
enum CodingKeys: String, CodingKey {
case result = "result"
case pageNumber = "page_number"
case reviews = "reviews"
case errorMessage = "error_message"
}
}
| [
-1
] |
a61e064720628ed416f7c862f751400757577873 | be7bc2e30701fcd60693892ea7ff959c0030523e | /KOFA/KOFA/Common/Utils.swift | 0030cd1107104b6c1d6eeb5c6ebf9bb6bb6021a4 | [] | no_license | Mrdptit/chatanonymoous | cdef69d4bca40d496c1c40e3e76ab88f2b9aa2dd | ddeea2e775b407f41fae629247c1453255d23f04 | refs/heads/master | 2021-08-22T11:10:41.093243 | 2017-11-30T02:44:12 | 2017-11-30T02:44:12 | 112,555,484 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 10,780 | swift | //
// Utils.swift
// KOFA
//
// Created by may1 on 11/15/17.
// Copyright © 2017 smartconnect. All rights reserved.
//
import UIKit
import Alamofire
import SwiftyJSON
import Material
import RNNotificationView
open class Utils: NSObject {
static func checkGenner(value : Int) -> String{
switch value {
case 0:
return "Unknown"
case 1:
return "Male"
case 2:
return "Female"
default:
return "Unknown"
}
}
static func birthdayToAge(value : String) -> Int{
let dateFormat = DateFormatter()
dateFormat.dateFormat = "MM/dd/yyyy"
let birthday = dateFormat.date(from: value)
let date = Date()
let calendar = Calendar.current
let currentYear = calendar.component(.year, from: date)
let birthdayYear = calendar.component(.year, from: birthday ?? date)
return currentYear - birthdayYear
}
open static func UploadImage(image: UIImage, for username: String) {
let imageData = UIImagePNGRepresentation(image)
let base64Image = imageData?.base64EncodedString(options: .lineLength64Characters)
let url = "https://api.imgur.com/3/upload"
let parameters = [
"image": base64Image
]
Alamofire.upload(multipartFormData: { multipartFormData in
if let imageData = UIImageJPEGRepresentation(image, 1) {
multipartFormData.append(imageData, withName: username, fileName: "\(username).png", mimeType: "image/png")
}
for (key, value) in parameters {
multipartFormData.append((value?.data(using: .utf8))!, withName: key)
}}, to: url, method: .post, headers: ["Authorization": "Client-ID " + IMGUR_CLIENT_ID],
encodingCompletion: { encodingResult in
switch encodingResult {
case .success(let upload, _, _):
upload.response { response in
//This is what you have been missing
print(response)
let json1 = JSON(response.data!)
print (json1 as Any)
// let json = try? JSONSerialization.jsonObject(with: response.data!, options: .allowFragments) as! [String:Any]
// print(json as Any)
// let imageDic = json?["data"] as? [String:Any]
// print(imageDic?["link"] as Any)
}
case .failure(let encodingError):
print("error:\(encodingError)")
}
})
}
static func timeAgoFromNow(time: Double) -> String {
let numericDates = true
let date = NSDate(timeIntervalSince1970: time/1000)
let calendar = NSCalendar.current
let unitFlags: Set<Calendar.Component> = [.minute, .hour, .day, .weekOfYear, .month, .year, .second]
let now = NSDate()
let earliest = now.earlierDate(date as Date)
let latest = (earliest == now as Date) ? date : now
let components = calendar.dateComponents(unitFlags, from: earliest as Date, to: latest as Date)
if (components.year! >= 2) {
return "\(components.year!) years ago"
} else if (components.year! >= 1){
if (numericDates){
return "1 year ago"
} else {
return "Last year"
}
} else if (components.month! >= 2) {
return "\(components.month!) months ago"
} else if (components.month! >= 1){
if (numericDates){
return "1 month ago"
} else {
return "Last month"
}
} else if (components.weekOfYear! >= 2) {
return "\(components.weekOfYear!) weeks ago"
} else if (components.weekOfYear! >= 1){
if (numericDates){
return "1 week ago"
} else {
return "Last week"
}
} else if (components.day! >= 2) {
return "\(components.day!) days ago"
} else if (components.day! >= 1){
if (numericDates){
return "1 day ago"
} else {
return "Yesterday"
}
} else if (components.hour! >= 2) {
return "\(components.hour!) hours ago"
} else if (components.hour! >= 1){
if (numericDates){
return "1 hour ago"
} else {
return "An hour ago"
}
} else if (components.minute! >= 2) {
return "\(components.minute!) minutes ago"
} else if (components.minute! >= 1){
if (numericDates){
return "1 minute ago"
} else {
return "A minute ago"
}
} else if (components.second! >= 3) {
return "\(components.second!) seconds ago"
} else {
return "Just now"
}
}
static func animationLoading(view : UIView) -> UIImageView {
let button = UIImageView()
button.frame = CGRect(x: 0, y: 0, width: 80, height: 80)
button.center = view.center;
let c = UIView.init(frame: button.bounds)
c.backgroundColor = AppBaseColor;
c.layer.cornerRadius = 40;
let img = UIImageView.init(image: UIImage.init(named: "btn-searching"))
img.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
img.layer.cornerRadius = 20;
img.center = c.center;
img.contentMode = .scaleAspectFit;
c.addSubview(img)
button.addSubview(c)
button.sendSubview(toBack: c)
let f = UIView.init(frame: button.bounds)
f.backgroundColor = AppBaseColor.withAlphaComponent(0.5)
f.layer.cornerRadius = 40;
button.addSubview(f)
button.sendSubview(toBack: f)
let pulseAnimation = CABasicAnimation.init(keyPath: "transform.scale")
pulseAnimation.duration = 0.75
;
pulseAnimation.toValue = 1.1
pulseAnimation.timingFunction = CAMediaTimingFunction.init(name: kCAMediaTimingFunctionEaseInEaseOut)
pulseAnimation.autoreverses = true;
pulseAnimation.repeatCount = MAXFLOAT;
c.layer.add(pulseAnimation, forKey: "a")
let fade = CABasicAnimation.init(keyPath: "opacity")
fade.toValue = 0;
let pulse = CABasicAnimation.init(keyPath: "transform.scale")
pulse.toValue = 3;
let group = CAAnimationGroup()
// [CAAnimationGroup animation];
group.animations = [fade,pulse];
group.duration = 1.65;
group.repeatCount = MAXFLOAT;
f.layer.add(group, forKey: "g")
// [f.layer addAnimation:group forKey:@"g"];
return button;
}
static func resizeImage(image: UIImage, targetSize: CGSize) -> UIImage {
let size = image.size
let widthRatio = targetSize.width / size.width
let heightRatio = targetSize.height / size.height
// Figure out what our orientation is, and use that to form the rectangle
var newSize: CGSize
if(widthRatio > heightRatio) {
newSize = CGSize(width: size.width * heightRatio, height: size.height * heightRatio)
} else {
newSize = CGSize(width: size.width * widthRatio, height: size.height * widthRatio)
}
// This is the rect that we've calculated out and this is what is actually used below
let rect = CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height)
// Actually do the resizing to the rect using the ImageContext stuff
UIGraphicsBeginImageContextWithOptions(newSize, false, 1.0)
image.draw(in: rect)
let newImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return newImage!
}
// Storyboard
static func MainStoryboard() -> UIStoryboard {
let srb = UIStoryboard.init(name: "Main", bundle: nil)
return srb
}
static func InAppStoryboard() -> UIStoryboard {
let srb = UIStoryboard.init(name: "InApp", bundle: nil)
return srb
}
static func showBuyPoint(vc : UIViewController){
let v : InAppPurchaseVC! = self.InAppStoryboard().instantiateViewController(withIdentifier: "InAppPurchaseVC") as! InAppPurchaseVC
vc.present(v, animated: true) {
}
}
static func showProfileView(vc : UIViewController) {
let vctest : ProfileVC! = self.MainStoryboard().instantiateViewController(withIdentifier: "ProfileVC") as! ProfileVC
vctest.modalPresentationStyle = .overCurrentContext
vctest.motionTransitionType = .zoom
vctest.user = AppManager.shared.user
vc.present(vctest, animated: true)
}
static func showProfile(forUser user: User, from viewcontroller:UIViewController) {
let vc : ProfileVC! = self.MainStoryboard().instantiateViewController(withIdentifier: "ProfileVC") as! ProfileVC
// vc.motionp = .overCurrentContext
vc.motionTransitionType = .zoom
// vc.modalTransitionStyle = .crossDissolve
// vc.modalPresentationStyle = .overCurrentContext
vc.user = user
viewcontroller.present(vc, animated: true)
}
static func checkStatus (type: Int) -> String{
switch type {
case 0:
return "Sent"
case 1:
return "Reciver"
case 2:
return "Seen"
default:
return "Loading"
}
}
}
extension Bundle {
static func loadView<T>(fromNib name: String, withType type: T.Type) -> T {
if let view = Bundle.main.loadNibNamed(name, owner: nil, options: nil)?.first as? T {
return view
}
fatalError("Could not load view with type " + String(describing: type))
}
var releaseVersionNumber: String? {
return self.infoDictionary?["CFBundleShortVersionString"] as? String
}
var buildVersionNumber: String? {
return self.infoDictionary?["CFBundleVersion"] as? String
}
}
extension UIView {
class func loadFromNibNamed(nibNamed: String, bundle : Bundle? = nil) -> UIView? {
return UINib(
nibName: nibNamed,
bundle: bundle
).instantiate(withOwner: nil, options: nil)[0] as? UIView
}
}
| [
-1
] |
6b602d3e0e4e0d3c850d1001b52f1957138a5035 | dfcecbca38ef6dee139e7cd3ad33ab7418fc05e8 | /Timer2/Task.swift | a3b6ac7c1e89f4403b78dad259bdf01e908157d8 | [] | no_license | alfredwu2/Timer2 | ad7f4337907be78761633d9de3dcf95e26c8f5da | 40b915f097615a24810c432d622e1061d46109c2 | refs/heads/master | 2021-01-01T15:56:01.862437 | 2017-07-22T20:00:09 | 2017-07-22T20:00:09 | 97,731,861 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,140 | swift | //
// Task.swift
// Timer2
//
// Created by Alfred Wu on 7/15/17.
// Copyright © 2017 Alfred Wu. All rights reserved.
//
import UIKit
class Task: Equatable {
var viewController: TimerListTableViewController
var detailViewController: TimerDetailViewController?
var title: String
var elapsed: Int {
if let startDate = startDate {
if let pauseDate = pauseDate {
return Int(pauseDate.timeIntervalSince1970 - startDate.timeIntervalSince1970) + adjustment
} else {
return Int(-startDate.timeIntervalSinceNow) + adjustment
}
} else {
return adjustment
}
}
var max: Int
var adjustment: Int = 0
var timer: Timer = Timer()
var timerIsRunning = false
var color: UIColor
var startDate: Date?
var pauseDate: Date?
init(title: String, max: Int, color: UIColor, _ viewController: TimerListTableViewController) {
self.title = title
self.max = max * 60
self.color = color
self.viewController = viewController
}
var startButtonText: String {
if timerIsRunning {
return "Pause"
} else {
if elapsed == 0 {
return "Start"
} else {
return "Resume"
}
}
}
var elapsedFormatted: String {
return format(elapsed)
}
var maxFormatted: String {
return format(max)
}
func start() {
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(Task.tick), userInfo: self, repeats: true)
if let _ = pauseDate {
startDate = Date() - TimeInterval(elapsed - adjustment)
} else {
startDate = Date()
}
}
@objc func tick() {
viewController.tick(timer: timer)
if let detailViewController = detailViewController {
detailViewController.tick()
}
}
// implements Equatable protocol
static func ==(a: Task, b: Task) -> Bool {
return a === b
}
}
| [
-1
] |
0f03879782a967b21708bad0b739a567422b4d40 | 8b02b9174e0a2ca761aa468155ada8f4b4f07ad4 | /09.BrickBreakerGame/BrickBreakerGame/Pavers/Pavers/Sources/UI/ReactiveCocoa/UIKit/UILabel+Reactive.swift | 7af67b890b3f78ae1790ab9a952d0ac0d0d44e94 | [
"MIT",
"LicenseRef-scancode-other-permissive"
] | permissive | newpolaris/LearningOpenGLES2 | 1590a5d828d2c4828e6607673e118b1e1fb48e47 | 8fdf880f27c971984096b0fc1dc549c461fedb0c | refs/heads/master | 2020-04-22T01:13:48.497049 | 2019-02-09T12:49:11 | 2019-02-09T12:49:11 | 170,007,826 | 0 | 0 | NOASSERTION | 2019-02-10T17:54:47 | 2019-02-10T17:54:47 | null | UTF-8 | Swift | false | false | 511 | swift | import PaversFRP
import UIKit
extension Reactive where Base: UILabel {
/// Sets the text of the label.
public var text: BindingTarget<String?> {
return makeBindingTarget { $0.text = $1 }
}
/// Sets the attributed text of the label.
public var attributedText: BindingTarget<NSAttributedString?> {
return makeBindingTarget { $0.attributedText = $1 }
}
/// Sets the color of the text of the label.
public var textColor: BindingTarget<UIColor> {
return makeBindingTarget { $0.textColor = $1 }
}
}
| [
116712,
336903
] |
f373a986ba5d78acad15e2db1a873911e4334bde | 99f9e49cdfc162218656582ac92a100c8d8daa68 | /RoutRTests/RoutRTests.swift | d871acd0ffb00697fa7ae3df104f0d777ec2175a | [] | no_license | kofi/routr | ddb0e227955b00063dace8ddd825c2949c488038 | e86d0102a539e9b60e726be72461c2ff4171284e | refs/heads/master | 2021-01-10T08:32:07.083318 | 2015-10-03T04:30:30 | 2015-10-03T04:30:30 | 43,428,680 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 956 | swift | //
// RoutRTests.swift
// RoutRTests
//
// Created by Kofi on 9/30/15.
// Copyright © 2015 38atkins. All rights reserved.
//
import XCTest
@testable import RoutR
class RoutRTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock {
// Put the code you want to measure the time of here.
}
}
}
| [
333828,
282633,
313357,
145435,
317467,
241692,
239650,
329765,
292902,
354343,
204840,
229413,
227370,
278570,
223274,
233517,
155694,
315434,
229424,
325674,
282672,
241716,
229430,
288828,
288833,
288834,
286788,
315465,
254027,
311372,
311374,
354385,
196691,
223316,
280661,
315476,
278615,
329814,
307289,
354393,
200794,
180311,
180312,
237663,
315487,
309345,
280675,
227428,
280677,
43110,
313447,
321637,
329829,
278634,
131178,
307299,
278638,
288879,
319598,
284788,
204916,
223350,
233590,
280694,
131191,
288889,
215164,
215166,
131198,
292992,
278655,
194691,
227460,
280712,
215178,
319629,
235662,
311438,
278670,
325776,
317587,
278677,
278685,
278691,
233636,
284841,
233642,
284842,
278704,
239793,
323762,
299187,
180408,
227513,
278714,
223419,
280762,
295098,
299198,
258239,
280768,
301251,
227524,
309444,
280778,
282831,
321745,
280795,
227548,
229597,
194782,
301279,
356576,
317664,
346346,
321772,
286958,
125169,
327929,
194820,
321800,
278797,
319763,
338197,
309529,
299293,
278816,
227616,
305440,
211235,
217380,
233762,
211238,
282919,
151847,
98610,
332083,
332085,
332089,
278842,
315706,
282939,
307517,
287041,
139589,
280902,
319813,
227654,
182597,
282960,
6481,
325968,
366929,
278869,
289110,
6489,
168281,
332123,
334171,
323935,
106847,
332127,
354655,
391520,
321894,
285040,
313713,
242033,
291192,
315773,
211326,
291198,
311681,
332167,
242058,
311691,
227725,
108944,
178582,
291224,
293274,
285084,
317852,
242078,
141728,
61857,
285090,
61859,
315810,
289189,
315811,
381347,
246178,
289194,
108972,
377264,
299441,
283064,
278970,
311738,
319930,
293310,
291265,
278978,
127427,
127428,
283075,
291267,
311745,
324039,
278989,
281037,
317901,
281040,
278993,
289232,
373197,
326100,
278999,
176601,
369116,
188894,
287198,
279008,
160225,
285150,
279013,
127465,
279018,
311786,
330218,
291311,
281072,
109042,
319987,
279029,
279032,
233978,
279039,
301571,
291333,
342536,
287241,
279050,
283153,
279057,
279062,
289304,
279065,
291358,
182817,
180771,
293419,
244269,
283182,
283184,
236081,
234036,
23092,
279094,
338490,
115270,
55881,
377418,
281166,
281171,
295519,
66150,
244327,
111208,
279144,
279146,
281199,
295536,
287346,
287352,
301689,
244347,
279164,
291454,
152203,
330379,
311949,
316049,
330387,
330388,
111253,
227990,
117397,
295576,
111258,
303771,
221852,
279206,
295599,
205487,
285361,
303793,
299699,
342706,
279217,
166582,
299700,
314040,
164533,
158394,
289462,
109241,
285373,
287422,
248517,
363211,
154316,
287439,
242386,
279252,
96984,
287452,
289502,
299746,
295652,
279269,
285415,
342762,
330474,
289518,
299759,
279280,
199414,
154359,
230134,
299770,
221948,
279294,
205568,
242433,
295682,
299776,
285444,
291585,
291592,
322313,
326414,
312079,
322319,
295697,
285458,
291604,
207640,
285466,
283419,
291612,
293664,
281377,
326433,
234277,
283430,
279336,
289576,
262954,
295724,
312108,
152365,
301871,
164656,
303920,
262962,
285487,
318252,
234294,
230199,
285497,
293693,
281408,
295746,
318278,
201549,
201551,
281427,
353109,
281433,
230234,
234331,
322395,
301918,
295776,
279392,
293730,
109409,
242529,
230248,
177001,
201577,
308076,
242541,
400239,
330609,
246641,
174963,
207732,
109428,
310131,
209783,
228215,
209785,
279417,
246648,
269178,
177019,
291712,
113542,
287622,
109447,
228233,
228234,
416646,
316298,
236428,
56208,
308112,
234386,
293781,
209817,
289690,
324507,
277403,
127902,
310176,
310178,
289698,
283558,
289703,
279464,
293800,
310182,
240552,
353195,
236461,
293806,
316333,
304051,
316343,
289722,
230332,
189374,
353215,
353216,
213960,
279498,
316364,
50143,
340961,
234472,
52200,
324586,
203757,
289774,
183279,
287731,
277492,
316405,
240630,
304122,
312314,
314362,
328700,
293886,
328706,
234500,
277509,
293893,
134150,
322570,
330763,
320527,
324625,
234514,
238610,
277524,
308243,
140310,
316437,
320536,
197657,
281626,
175132,
326685,
189474,
300068,
300084,
322612,
238651,
302139,
308287,
21569,
214086,
234577,
296019,
339030,
353367,
234587,
304222,
281697,
230499,
281700,
314467,
300135,
228458,
207979,
279660,
281706,
318572,
15471,
316526,
144496,
312434,
353397,
285814,
300151,
300150,
337017,
291959,
160891,
285820,
300158,
150657,
187521,
285828,
279685,
285830,
222343,
302216,
302213,
330888,
228491,
228493,
177296,
162961,
326804,
185493,
296086,
238743,
119962,
283802,
296092,
285851,
300188,
339102,
330913,
306338,
234663,
300202,
281771,
306346,
279728,
238769,
208058,
228540,
230588,
228542,
322749,
283840,
279747,
353479,
283847,
353481,
279760,
290000,
228563,
189652,
279765,
189653,
316627,
148696,
279774,
304351,
333022,
298212,
304356,
290022,
279785,
228588,
234733,
279792,
353523,
298228,
302325,
234742,
228600,
216315,
292091,
208124,
228609,
320770,
234755,
322824,
292107,
328971,
251153,
177428,
173334,
245019,
126237,
115998,
339234,
333090,
279854,
298291,
171317,
318775,
286013,
333117,
279875,
193859,
300359,
312648,
294218,
234827,
372043,
296270,
234831,
238927,
296273,
331090,
120148,
314709,
314710,
357719,
318805,
134491,
316765,
222559,
234850,
292195,
294243,
163175,
333160,
134506,
284014,
306542,
296303,
327025,
243056,
296307,
249204,
249205,
327024,
181625,
111993,
290169,
290173,
306559,
224640,
306560,
294275,
179587,
298374,
142729,
368011,
304524,
296335,
112017,
112018,
306579,
234898,
224661,
9619,
282007,
357786,
318875,
290207,
310692,
333220,
279974,
282024,
241066,
316842,
314798,
286129,
279989,
284089,
228795,
292283,
280004,
300487,
306631,
296392,
280010,
284107,
310732,
280013,
302540,
64975,
312782,
310736,
327121,
329173,
212442,
228827,
286172,
280032,
144867,
103909,
187878,
316902,
245223,
280041,
191981,
282096,
306673,
321009,
329200,
333300,
306677,
191990,
300535,
280055,
288249,
286202,
300536,
290300,
286205,
302590,
290301,
294400,
300542,
282114,
230913,
306692,
306693,
292356,
329225,
296461,
323087,
282129,
323089,
308756,
282136,
282141,
333343,
230943,
187938,
286244,
245292,
286254,
230959,
288309,
290358,
288318,
194110,
280130,
349763,
56902,
282183,
218696,
288327,
292423,
243274,
333388,
228943,
286288,
224847,
118353,
280147,
290390,
300630,
128599,
235095,
306776,
44635,
239198,
333408,
157281,
286306,
282213,
317032,
312940,
204397,
222832,
224883,
314998,
333430,
175741,
325245,
337535,
294529,
333303,
239237,
282246,
286343,
312965,
229001,
290443,
188048,
282259,
302739,
229020,
282271,
282273,
257699,
282276,
40613,
40614,
40615,
282280,
290471,
298661,
298667,
323236,
61101,
229029,
321199,
286388,
286391,
337591,
296632,
280251,
327358,
282303,
286399,
280257,
323264,
321219,
333509,
282312,
280267,
333517,
282318,
9936,
9937,
302802,
245457,
241361,
241365,
333521,
286423,
278233,
278234,
18138,
67292,
278240,
229088,
298720,
321249,
282339,
153319,
12010,
280300,
239341,
282348,
284401,
282358,
313081,
325371,
194303,
194304,
288512,
278272,
323331,
323332,
280327,
216839,
280329,
300811,
284431,
243472,
321295,
161554,
278291,
323346,
278293,
294678,
116505,
284442,
286494,
313120,
241441,
282400,
315171,
333610,
284459,
294700,
282417,
200498,
296755,
280372,
321337,
319292,
282434,
315202,
307011,
325445,
282438,
153415,
280392,
323406,
304977,
307025,
413521,
325457,
317269,
18262,
216918,
307031,
280410,
284507,
300894,
245599,
237408,
284512,
284514,
302946,
276327,
282474,
288620,
325484,
280430,
296814,
282480,
292720,
313203,
325492,
300918,
241528,
317304,
194429,
325503,
315264,
188292,
241540,
327557,
67463,
282504,
243591,
315273,
315274,
325515,
243597,
110480,
184208,
329622,
282519,
294807,
214937,
214938,
294809,
294814,
311199,
300963,
292771,
313254,
294823,
298920,
284587,
292782,
317360,
282549,
288697,
290746,
294843,
98239,
214977,
280514,
280519,
214984,
284619,
344013,
231375,
301008,
194515,
24532,
280541,
329695,
298980,
292837,
294886,
317415,
247785,
296941,
278512,
311281,
311282,
223218,
282612,
333817,
292858
] |
e01cda81341ad692c97f74a873db673d0afb0770 | 33e5deb9bf69d8d7627829e1777801e497bc6412 | /d01/ex00/main.swift | 544190a42fd87a9e442a2ea9a7889d12e08e2fbd | [] | no_license | aputzolu/Piscine-Swift-iOS | 4a9d41238b95078276f4cde6d0c5df99c569f752 | ad65e152ec688cc44fc70a2809dd0b82e557dc6a | refs/heads/master | 2021-01-01T15:10:04.426121 | 2017-07-18T11:18:55 | 2017-07-18T11:18:55 | 97,588,752 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 272 | swift | import Foundation
var tabValue : [Value] = Value.allValues
var tabColor : [Color] = Color.allColors
print("Values : ")
for elem in tabValue {
print("\(elem) = \(elem.rawValue)")
}
print("\nColors : ")
for elem in tabColor {
print("\(elem) = \(elem.rawValue)")
} | [
-1
] |
5b5762b563168fdb67105d9765e9c2305bd0f5d7 | a169561197da5fb4ad6ac5784db36a4f9862f163 | /PitchPerfect/RecordSoundsViewController.swift | 77b889fbcc533c271baff07dcc4ae0fc0829c2e1 | [] | no_license | marcboanas/PitchPerfect | dc40c976e41bda7b90238cad4cbab2c593279eb5 | 75194572662d4969b06041159ad5ca6eb15ddd1e | refs/heads/master | 2021-01-20T01:42:53.741717 | 2017-03-03T18:43:31 | 2017-03-03T18:43:31 | 83,809,617 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,922 | swift | //
// RecordSoundsViewController.swift
// PitchPerfect
//
// Created by Marc Boanas on 02/03/2017.
// Copyright © 2017 Marc Boanas. All rights reserved.
//
import UIKit
import AVFoundation
class RecordSoundsViewController: UIViewController, AVAudioRecorderDelegate {
// MARK: IBOutlets
@IBOutlet weak var recordButton: UIButton!
@IBOutlet weak var recordingLabel: UILabel!
@IBOutlet weak var stopRecordingButton: UIButton!
// MARK: Properties
var audioRecorder: AVAudioRecorder!
override func viewDidLoad() {
super.viewDidLoad()
stopRecordingButton.isEnabled = false
}
// MARK: IBActions
@IBAction func recordButtonPressed(_ sender: Any) {
print("Record button pressed")
setUIButtons(isRecording: true)
let dirPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] as String
let recordingName = "recordedVoice.wav"
let pathArray = [dirPath, recordingName]
let filePath = URL(string: pathArray.joined(separator: "/"))
let session = AVAudioSession.sharedInstance()
try! session.setCategory(AVAudioSessionCategoryPlayAndRecord, with: AVAudioSessionCategoryOptions.defaultToSpeaker)
try! audioRecorder = AVAudioRecorder(url: filePath!, settings: [:])
audioRecorder.delegate = self
audioRecorder.isMeteringEnabled = true
audioRecorder.prepareToRecord()
audioRecorder.record()
}
@IBAction func stopRecordingButtonPressed(_ sender: Any) {
print("Stop recording button pressed")
setUIButtons(isRecording: false)
audioRecorder.stop()
let audioSession = AVAudioSession.sharedInstance()
try! audioSession.setActive(false)
}
func setUIButtons(isRecording: Bool) {
if isRecording {
recordingLabel.text = "Recording in Progress"
recordButton.isEnabled = false
stopRecordingButton.isEnabled = true
} else {
recordButton.isEnabled = true
stopRecordingButton.isEnabled = false
recordingLabel.text = "Tap to Record"
}
}
func audioRecorderDidFinishRecording(_ recorder: AVAudioRecorder, successfully flag: Bool) {
if flag {
performSegue(withIdentifier: "stopRecordingSegue", sender: audioRecorder.url)
print(audioRecorder.url)
} else {
print("recording was not successful")
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "stopRecordingSegue" {
let playSoundsViewController = segue.destination as! PlaySoundsViewController
let recordedAudioURL = sender as! URL
playSoundsViewController.recordedAudioURL = recordedAudioURL
}
}
}
| [
289216,
237691,
283845
] |
00b1868515b8c4fe7010b42753bfdbb3235bdbfc | d2ec1431a5eb107c606300f8f189df66843db512 | /Collections/AppDelegate.swift | 1077256e1007aa2faa599ea016f2ab23520d481f | [] | no_license | Sam-Meech-Ward/Collection-View-With-Compositional-Layout | 6eeae88ed040d003d834f1d0790786ce4db1e661 | e096c2b82eace4f51393271243e9f163a807141e | refs/heads/master | 2023-02-25T05:04:15.470979 | 2021-02-05T21:11:37 | 2021-02-05T21:11:37 | 336,390,066 | 6 | 2 | null | null | null | null | UTF-8 | Swift | false | false | 1,377 | swift | //
// AppDelegate.swift
// Collections
//
// Created by Sam Meech-Ward on 2020-05-18.
// Copyright © 2020 meech-ward. 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,
368752,
262283,
327871,
180416,
180431,
377046,
377060,
327914,
393456,
393460,
336123,
418043,
336128,
385280,
262404,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
262472,
344403,
213332,
65880,
418144,
262496,
262499,
213352,
246123,
262507,
262510,
213372,
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,
148105,
377484,
352918,
98968,
344744,
336555,
385713,
434867,
164534,
336567,
328378,
164538,
328386,
344776,
418507,
385742,
385748,
361179,
189153,
369381,
418553,
344831,
336643,
344835,
344841,
336659,
418580,
418585,
434970,
418589,
262942,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
336711,
361288,
328522,
336714,
426841,
197468,
361309,
361315,
361322,
328573,
377729,
222128,
345035,
345043,
386003,
386011,
386018,
386022,
435187,
328702,
328714,
361489,
386069,
336921,
386073,
336925,
345118,
377887,
345138,
386101,
197707,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
386258,
328924,
66782,
222437,
328941,
386285,
386291,
345376,
353570,
345379,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181654,
230809,
181670,
181673,
337329,
181681,
181684,
181690,
361917,
181696,
337349,
181703,
337365,
271839,
329191,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
214610,
419410,
345701,
394853,
222830,
370297,
403075,
198280,
345736,
345749,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
337592,
419512,
419517,
337599,
419527,
419530,
419535,
272081,
394966,
419542,
419544,
181977,
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,
345964,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436132,
337833,
362413,
337844,
346057,
247759,
346063,
329697,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
329832,
329855,
329867,
329885,
411805,
346272,
100524,
379066,
387260,
256191,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
321786,
379134,
379152,
395538,
387349,
338199,
387352,
182558,
338211,
395566,
248111,
362822,
436555,
190796,
321879,
379233,
354673,
321910,
248186,
420236,
379278,
354727,
338352,
330189,
338381,
338386,
338403,
338409,
248308,
199164,
330252,
199186,
330267,
354855,
10828,
199249,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
355028,
273108,
264918,
183005,
436962,
338660,
338664,
264941,
207619,
264964,
338700,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
355175,
387944,
355179,
330610,
330642,
355218,
207808,
379848,
396245,
330710,
248792,
248798,
347105,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
396328,
158761,
199728,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
339036,
412764,
257120,
265320,
248951,
420984,
330889,
347287,
248985,
339097,
44197,
380070,
339112,
249014,
330958,
330965,
265432,
388319,
388347,
159005,
208166,
273708,
372015,
347441,
372018,
199988,
175415,
396600,
437566,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
249214,
249218,
249227,
249234,
175513,
396705,
355748,
396722,
372163,
216517,
380360,
216522,
339404,
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,
224887,
224890,
224894,
372353,
224897,
216707,
339588,
126596,
421508,
224904,
224909,
159374,
11918,
339601,
126610,
224913,
224916,
224919,
126616,
208538,
224922,
224926,
224932,
224936,
224942,
257712,
224947,
257716,
224953,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
224993,
257761,
257764,
224999,
339695,
225012,
257787,
225020,
339710,
257790,
225025,
257794,
339721,
257801,
257804,
225038,
257807,
225043,
167700,
225048,
257819,
225053,
225058,
339747,
339749,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
225103,
257871,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
339814,
225127,
257896,
274280,
257901,
225137,
339826,
257908,
225141,
257912,
225148,
257916,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
405533,
430129,
217157,
421960,
356439,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
225475,
389320,
225484,
225487,
225490,
266453,
225493,
225496,
225499,
225502,
225505,
356578,
217318,
225510,
225514,
225518,
372976,
381176,
389380,
356640,
356643,
356646,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
250199,
250202,
332125,
250210,
348525,
332152,
250238,
389502,
332161,
332172,
373145,
340379,
389550,
324030,
266687,
340451,
160234,
127471,
340472,
324094,
266754,
324099,
324102,
324111,
340500,
324117,
324131,
332324,
381481,
324139,
356907,
324142,
356916,
324149,
324155,
348733,
324160,
324164,
348743,
381512,
324170,
324173,
324176,
389723,
332380,
381545,
340627,
184982,
373398,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
332493,
357069,
357073,
332511,
332520,
340718,
332533,
348924,
389926,
152370,
348978,
340789,
348982,
398139,
127814,
357206,
389978,
357211,
357214,
201579,
201582,
349040,
340849,
201588,
430965,
324472,
398201,
119674,
324475,
430972,
340861,
324478,
340858,
324481,
373634,
398211,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
324513,
201637,
398245,
324524,
340909,
324533,
5046,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
349180,
439294,
209943,
250914,
357410,
185380,
357418,
209965,
209968,
209971,
209975,
209979,
209987,
209990,
341071,
349267,
250967,
210010,
341091,
210025,
210027,
210030,
210036,
210039,
341113,
210044,
349308,
152703,
160895,
349311,
210052,
349319,
210055,
210067,
210071,
210077,
210080,
210084,
251044,
185511,
210088,
210095,
210098,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
251128,
275706,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
210260,
365921,
333154,
251235,
333162,
234866,
390516,
333175,
357755,
251271,
136590,
112020,
349590,
357792,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
366056,
366061,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
415278,
415281,
415285,
415290,
415293,
349761,
415300,
333386,
333399,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
333498,
333511,
358099,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
210695,
268041,
366348,
399128,
333594,
358191,
366387,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
259938,
399206,
358255,
399215,
268143,
358259,
341876,
333689,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
358339,
333774,
358371,
350189,
350193,
350202,
333818,
350206,
350213,
268298,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
334011,
260289,
350410,
350416,
350422,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
325891,
350467,
350475,
375053,
268559,
350480,
432405,
350486,
350490,
325914,
325917,
350493,
350498,
350504,
358700,
350509,
391468,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
334203,
268668,
194941,
391563,
366990,
416157,
342430,
375208,
326058,
375216,
334262,
334275,
326084,
358856,
195039,
334304,
334311,
375277,
334321,
350723,
186897,
342545,
334358,
342550,
342554,
334363,
350761,
252461,
334384,
358961,
334394,
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,
203506,
342776,
391937,
391948,
326416,
375568,
326441,
326451,
326454,
244540,
326460,
260924,
326467,
244551,
326473,
326477,
326485,
326490,
342874,
326502,
375656,
433000,
326507,
326510,
211825,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
326598,
359366,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
261147,
359451,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
367723,
384107,
187502,
343154,
384114,
212094,
351364,
384135,
384139,
384143,
351381,
384151,
384160,
384168,
244916,
384181,
367800,
384188,
351423,
326855,
244937,
384201,
253130,
343244,
384208,
146642,
384224,
359649,
343270,
351466,
384246,
351479,
343306,
261389,
359694,
384275,
384283,
245020,
384288,
245029,
171302,
351534,
376110,
245040,
212291,
384323,
343365,
212303,
367965,
343393,
343398,
367980,
343409,
154999,
253303,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
425649,
155322,
425662,
155327,
245460,
155351,
155354,
212699,
245475,
155363,
245483,
409335,
155393,
155403,
245525,
155422,
360223,
155442,
155447,
155461,
360261,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
147317,
262005,
262008,
262011,
155516,
155521,
155525,
360326,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
262045,
155549,
262048,
262051,
327589,
155562,
155565,
393150,
384977,
393169,
155611,
155619,
253923,
155621,
327654,
253926,
393203,
360438,
393206,
393212,
155646
] |
a40e520f0768909113b9fac435154ddebeec40e7 | dbfb39561ce304f9808f6b0d252228299e3fc1b3 | /OtherCode/traveling-salesman-problem-master/traveling-salesman-problem/Route.swift | 5de40227fdac9a797d1d60ff41834a373ddb1374 | [
"MIT"
] | permissive | hanjian0331/RoutePlan | e56e61b2bd9ba88a234f930f6aeb3a6f17dbc017 | 30a45bc779a8dba91137bc499dc528b3b55e487c | refs/heads/master | 2022-11-30T09:26:21.313939 | 2020-08-08T14:17:36 | 2020-08-08T14:17:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,903 | swift | //
// Route.swift
// traveling-salesman-problem
//
// Created by David Nadoba on 08/02/2017.
// Copyright © 2017 David Nadoba. All rights reserved.
//
import Foundation
import MapKit
enum RouteWeight {
case distance
case time
}
/// A Route describes a possible path from a `Waypoint` to another `Waypoint`.
/// It has a weight which is either the distance or the expected travel time between the two `Waypoint`s determined by the weightedBy property.
/// It can be used as WeightedEdge.
class Route {
let source: Waypoint
let destination: Waypoint
fileprivate let mkRoute: MKRoute
var weightedBy: RouteWeight
var weight: Double {
switch weightedBy{
case .distance: return mkRoute.distance
case .time: return mkRoute.expectedTravelTime
}
}
init(source: Waypoint, destination: Waypoint, mkRoute: MKRoute, weightedBy: RouteWeight) {
self.source = source
self.destination = destination
self.mkRoute = mkRoute
self.weightedBy = weightedBy
}
var polyline: MKPolyline {
return mkRoute.polyline
}
var transportType: MKDirectionsTransportType {
return mkRoute.transportType
}
var expectedTravelTime: TimeInterval {
return mkRoute.expectedTravelTime
}
var distance: CLLocationDistance {
return mkRoute.distance
}
}
extension Double: EdgeWeight {
static var zero: Double {
return 0
}
}
// MARK: - Equatable
extension Route : Equatable {
static func ==(lhs: Route, rhs: Route) -> Bool {
return lhs.mkRoute == rhs.mkRoute
}
static func !=(lhs: Route, rhs: Route) -> Bool {
return lhs.mkRoute != rhs.mkRoute
}
}
// MARK: - Hashable
extension Route: Hashable {
var hashValue: Int {
return mkRoute.hashValue
}
}
// MARK: - WeightedEdge
extension Route: WeightedEdge {}
| [
-1
] |
636cba3d711078f7ab4eea9c0e648294d03f8571 | 062e6cd5272f045271af9e124f398fe188b930a9 | /CoreDataSample/User+CoreDataProperties.swift | 049a14afc1847ddd7aeff31f5f77c2f73ccc8063 | [] | no_license | muraliy/CoreData | 549550f01a34017393d9d19f8e0a98c9ce67683b | 98df909a030635485b73ee887ebd2643af71cd90 | refs/heads/master | 2022-12-13T16:34:01.661784 | 2020-09-13T13:43:41 | 2020-09-13T13:43:41 | 284,244,195 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 449 | swift | //
// User+CoreDataProperties.swift
// CoreDataSample
//
// Created by Murali Yarramsetti on 08/08/20.
// Copyright © 2020 Murali Yarramsetti. All rights reserved.
//
//
import Foundation
import CoreData
extension User {
@nonobjc public class func fetchRequest() -> NSFetchRequest<User> {
return NSFetchRequest<User>(entityName: "User")
}
@NSManaged public var name: String?
@NSManaged public var email: String?
}
| [
-1
] |
71f6e42d8249424ed873cc11944e44d11ae99070 | e439583e80d1c2363fb4e3db061f1ec518fc090c | /samples/ORKCatalog/ORKCatalog/TaskListViewController.swift | ffec8e4b86895620a36ae60ed9a0ed0a90a98e90 | [
"LicenseRef-scancode-bsd-3-clause-no-trademark",
"BSD-3-Clause"
] | permissive | jwe-apple/ResearchKit | 28fb2ee7a82f6e4b97e9a223777d98d8c3e15e74 | 1e67f88a7f4f50fcdefea6a1c5201c5eb0e83479 | refs/heads/master | 2020-12-11T03:19:38.068302 | 2015-06-09T01:10:07 | 2015-06-09T01:10:07 | 34,407,169 | 5 | 3 | null | 2015-04-22T18:09:35 | 2015-04-22T18:09:35 | null | UTF-8 | Swift | false | false | 5,278 | swift | /*
Copyright (c) 2015, Apple Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
import ResearchKit
/**
This example displays a catalog of tasks, each consisting of one or two steps,
built using the ResearchKit framework. The `TaskListViewController` displays the
available tasks in this catalog.
When you tap a task, it is presented like a participant in a study might
see it. After completing the task, you can see the results generated by
the task by switching to the results tab.
*/
class TaskListViewController: UITableViewController, ORKTaskViewControllerDelegate {
// MARK: Types
enum TableViewCellIdentifier: String {
case Default = "Default"
}
// MARK: Properties
/**
When a task is completed, the `TaskListViewController` calls this closure
with the created task.
*/
var taskResultFinishedCompletionHandler: (ORKResult -> Void)?
let taskListRows = TaskListRow.allCases
// MARK: UITableViewDataSource
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return taskListRows.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier(TableViewCellIdentifier.Default.rawValue, forIndexPath: indexPath) as! UITableViewCell
let taskListRow = taskListRows[indexPath.row]
cell.textLabel!.text = "\(taskListRow)"
return cell
}
// MARK: UITableViewDelegate
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
tableView.deselectRowAtIndexPath(indexPath, animated: true)
// Present the task view controller that the user asked for.
let taskListRow = taskListRows[indexPath.row]
// Create a task from the `TaskListRow` to present in the `ORKTaskViewController`.
let task = taskListRow.representedTask
/*
Passing `nil` for the `taskRunUUID` lets the task view controller
generate an identifier for this run of the task.
*/
let taskViewController = ORKTaskViewController(task: task, taskRunUUID: nil)
// Make sure we receive events from `taskViewController`.
taskViewController.delegate = self
// Assign a directory to store `taskViewController` output.
taskViewController.outputDirectory = NSURL(fileURLWithPath: NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as! String, isDirectory: true)
/*
We present the task directly, but it is also possible to use segues.
The task property of the task view controller can be set any time before
the task view controller is presented.
*/
presentViewController(taskViewController, animated: true, completion: nil)
}
// MARK: ORKTaskViewControllerDelegate
func taskViewController(taskViewController: ORKTaskViewController, didFinishWithReason reason: ORKTaskViewControllerFinishReason, error: NSError?) {
/*
The `reason` passed to this method indicates why the task view
controller finished: Did the user cancel, save, or actually complete
the task; or was there an error?
The actual result of the task is on the `result` property of the task
view controller.
*/
taskResultFinishedCompletionHandler?(taskViewController.result)
taskViewController.dismissViewControllerAnimated(true, completion: nil)
}
}
| [
-1
] |
d5db3af30c61a78cf6e71e73e47129c4fac4d0e4 | 493bc53ad29bde6d4d7039f2a5f012f03cf2eb18 | /Concentration/StartupViewController.swift | a9bc56246aa94eb8a2ab208f93d6347d16704811 | [] | no_license | d-panchuk/Concentration | e47cccd8ee25cc28ae023a145633307406500ef6 | 8f5d9922ce0abf4c376936f48ae7c02b67e2ae0e | refs/heads/master | 2020-04-28T04:44:47.385839 | 2019-03-11T12:19:39 | 2019-03-11T12:19:39 | 174,992,045 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,455 | swift | //
// StartupViewController.swift
// Concentration
//
// Created by Dima Panchuk on 3/5/19.
// Copyright © 2019 dpanchuk. All rights reserved.
//
import UIKit
class StartupViewController: UIViewController, UISplitViewControllerDelegate {
let themes = [
"Sport": ["🏀", "⚽️", "🏐", "🏈", "⚾️", "🎱"],
"Faces": ["😀", "😊", "😂", "😉", "😎", "🤪"],
"Cats": ["😺", "😸", "😹", "😻", "🙀", "😿"]
]
var themeButtons: UIStackView?
override func awakeFromNib() {
splitViewController?.delegate = self
initThemeButtons()
drawThemeButtons()
setDefaultTheme()
}
func splitViewController(
_ splitViewController: UISplitViewController,
collapseSecondary secondaryViewController: UIViewController,
onto primaryViewController: UIViewController
) -> Bool {
return true
}
private func initThemeButtons() {
let buttonsStackView = UIStackView(arrangedSubviews: initButtons(themes: Array(themes.keys.sorted())))
buttonsStackView.translatesAutoresizingMaskIntoConstraints = false
buttonsStackView.axis = .vertical
buttonsStackView.spacing = 20
buttonsStackView.alignment = .fill
buttonsStackView.distribution = .equalSpacing
view.addSubview(buttonsStackView)
buttonsStackView.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
buttonsStackView.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
themeButtons = buttonsStackView
}
private func drawThemeButtons() {
for button in themeButtons!.subviews {
UIView.animate(
withDuration: 2,
animations: { button.alpha = 1 }
)
}
}
private func setDefaultTheme() {
if let detail = splitViewController?.viewControllers.last as? ConcentrationViewController {
let theme = themes.keys.sorted().first!
detail.emojies = themes[theme]!
}
}
private func initButtons(themes: [String]) -> [UIButton] {
return themes.map { theme in
let button = UIButton()
button.setTitle(theme, for: .normal)
button.setTitleColor(#colorLiteral(red: 1, green: 1, blue: 1, alpha: 1), for: .normal)
button.titleLabel?.font = .systemFont(ofSize: 40)
button.backgroundColor = #colorLiteral(red: 0.2392156869, green: 0.6745098233, blue: 0.9686274529, alpha: 1)
button.layer.cornerRadius = 5
button.contentEdgeInsets = UIEdgeInsets(top: 10, left: 15, bottom: 10, right: 15)
button.translatesAutoresizingMaskIntoConstraints = false
button.addTarget(self, action: #selector(StartupViewController.touchThemeButton(sender:)), for: .touchUpInside)
button.alpha = 0
return button
}
}
@objc func touchThemeButton(sender: UIButton) {
performSegue(withIdentifier: "Choose theme", sender: sender)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
guard let button = sender as? UIButton,
let theme = button.titleLabel?.text,
let dest = segue.destination as? ConcentrationViewController
else { return }
dest.emojies = themes[theme]!
}
}
| [
-1
] |
498dc220ff6b214d93775c80f08127470e391a77 | 74288f19295cd5782ee94e454df2e8e7259a0549 | /AdvancedMap.Swift/Feature Demo/Package.swift | 039d833e1c2e5b50c6c12423f4eff3e122ce16d6 | [
"BSD-2-Clause"
] | permissive | CartoDB/mobile-ios-samples | 8c8f8b2e82d152390ff190737635f5416495370f | 96d4bd3b05282d83d7d9028f002efeb6d06d33a9 | refs/heads/master | 2021-11-26T04:01:59.426270 | 2021-11-11T15:16:10 | 2021-11-11T15:16:10 | 60,267,686 | 30 | 14 | BSD-2-Clause | 2023-09-04T05:33:48 | 2016-06-02T13:47:05 | Swift | UTF-8 | Swift | false | false | 4,019 | swift | //
// Country.swift
// AdvancedMap.Swift
//
// Created by Aare Undo on 27/06/2017.
// Copyright © 2017 CARTO. All rights reserved.
//
import Foundation
import CartoMobileSDK
class Package : NSObject {
var id: String!
var name: String!
var status: NTPackageStatus!
var info: NTPackageInfo!
static let BBOX_IDENTIFIER = "bbox("
var isCustomRegionPackage: Bool {
get {
if (id == nil) {
return false;
}
return id.contains(Package.BBOX_IDENTIFIER)
}
}
static let CUSTOM_REGION_FOLDER_NAME = "CUSTOM REGIONS"
var isCustomRegionFolder: Bool {
get { return name == Package.CUSTOM_REGION_FOLDER_NAME }
}
func isGroup() -> Bool {
// Custom region packages will have status & info == nil, but they're not groups
return status == nil && info == nil && !isCustomRegionPackage
}
func isSmallerThan1MB() -> Bool {
return info.getSize() < (1024 * 1024);
}
func getStatusText() -> String {
var status = "Available";
status += getVersionAndSize()
// Check if the package is downloaded/is being downloaded (so that status is not null)
if (self.status != nil) {
if (self.status.getCurrentAction() == NTPackageAction.PACKAGE_ACTION_READY) {
status = "Ready";
status += getVersionAndSize()
} else if (self.status.getCurrentAction() == NTPackageAction.PACKAGE_ACTION_WAITING) {
status = "Queued";
} else {
if (self.status.getCurrentAction() == NTPackageAction.PACKAGE_ACTION_COPYING) {
status = "Copying";
} else if (self.status.getCurrentAction() == NTPackageAction.PACKAGE_ACTION_DOWNLOADING) {
status = "Downloading";
} else if (self.status.getCurrentAction() == NTPackageAction.PACKAGE_ACTION_REMOVING) {
status = "Removing";
}
status += " " + String(describing: self.status.getProgress()) + "%";
}
}
return status;
}
func getVersionAndSize() -> String {
if (isCustomRegionPackage) {
return "";
}
let version = String(info.getVersion())
let size = String(describing: info.getSizeInMB())
if (isSmallerThan1MB()) {
return " v." + version + " (<1MB)";
}
return " v." + version + " (" + size + " MB)";
}
static let READY = "READY"
static let QUEUED = "QUEUED"
static let ACTION_PAUSE = "PAUSE"
static let ACTION_RESUME = "RESUME"
static let ACTION_CANCEL = "CANCEL"
static let ACTION_DOWNLOAD = "DOWNLOAD"
static let ACTION_REMOVE = "REMOVE"
var isDownloading: Bool {
if (status == nil) {
return false
}
return status.getCurrentAction() == NTPackageAction.PACKAGE_ACTION_DOWNLOADING && !status.isPaused()
}
var isQueued: Bool {
if (status == nil) {
return false
}
return status.getCurrentAction() == NTPackageAction.PACKAGE_ACTION_WAITING && !status.isPaused()
}
func getActionText() -> String {
if (self.status == nil) {
return Package.ACTION_DOWNLOAD
}
if (self.status.getCurrentAction() == NTPackageAction.PACKAGE_ACTION_READY) {
return Package.ACTION_REMOVE
} else if (self.status.getCurrentAction() == NTPackageAction.PACKAGE_ACTION_WAITING) {
return Package.ACTION_CANCEL
}
if (status.isPaused()) {
return Package.ACTION_RESUME
} else {
return Package.ACTION_PAUSE
}
}
}
| [
-1
] |
921e3208cd9ae019d863c2ba881cb13b723612c3 | 25b4775de8d08ade1146f8ab82f04913b25e44eb | /OmnieCommerceAdmin/Scenes/RepetitionPasswordShow/RepetitionPasswordShowViewController.swift | a711fc1bf94884d2dfdc16879ec4ce9892a69890 | [] | no_license | Monserg/OmnieCommerceAdmin-iOS-App | 4b11caa98ebf8dfe5266d1c60c9ba5089a75477e | 1c8fcc2b81a7a706be53592f5ca85e46084e1e86 | refs/heads/master | 2021-01-18T13:06:34.262647 | 2017-02-17T05:00:19 | 2017-02-17T05:00:19 | 80,724,769 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,918 | swift | //
// RepetitionPasswordShowViewController.swift
// OmnieCommerceAdmin
//
// Created by msm72 on 08.02.17.
// Copyright (c) 2017 Omniesoft. All rights reserved.
//
// This file was generated by the Clean Swift Xcode Templates so you can apply
// clean architecture to your iOS and Mac projects, see http://clean-swift.com
//
import UIKit
// MARK: - Input protocols for current ViewController component VIP-cicle
protocol RepetitionPasswordShowViewControllerInput {
func displaySomething(viewModel: RepetitionPasswordShowModels.Something.ViewModel)
}
// MARK: - Output protocols for Interactor component VIP-cicle
protocol RepetitionPasswordShowViewControllerOutput {
func doSomething(requestModel: RepetitionPasswordShowModels.Something.RequestModel)
}
class RepetitionPasswordShowViewController: BaseViewController {
// MARK: - Properties
var interactor: RepetitionPasswordShowViewControllerOutput!
var router: RepetitionPasswordShowRouter!
var handlerSendButtonCompletion: HandlerSendButtonCompletion?
var handlerCancelButtonCompletion: HandlerCancelButtonCompletion?
@IBOutlet weak var scrollView: UIScrollView!
@IBOutlet var textFieldsCollection: [CustomTextField]!
@IBOutlet weak var passwordStrengthView: PasswordStrengthLevelView!
@IBOutlet weak var repeatPasswordErrorMessageView: ErrorMessageView!
@IBOutlet weak var repeatPasswordErrorMessageViewHeightConstraint: NSLayoutConstraint!
@IBOutlet weak var repeatPasswordErrorMessageViewTopConstraint: NSLayoutConstraint!
// MARK: - Class initialization
override func awakeFromNib() {
super.awakeFromNib()
RepetitionPasswordShowConfigurator.sharedInstance.configure(viewController: self)
}
// MARK: - Class Functions
override func viewDidLoad() {
super.viewDidLoad()
doInitialSetupOnLoad()
}
// MARK: - Custom Functions
func doInitialSetupOnLoad() {
// UITextFields
textFieldsArray = textFieldsCollection
// Apply keyboard handler
scrollViewBase = scrollView
// Hide email error message view
repeatPasswordErrorMessageViewHeightConstraint.constant = Config.Constants.errorMessageViewHeight
repeatPasswordErrorMessageViewTopConstraint.constant = -Config.Constants.errorMessageViewHeight
}
// MARK: - Actions
@IBAction func handlerSendButtonTap(_ sender: CustomButton) {
if (textFieldsCollection.first?.text == textFieldsCollection.last?.text) {
handlerSendButtonCompletion!()
} else {
repeatPasswordErrorMessageView.didShow(true, withConstraint: repeatPasswordErrorMessageViewTopConstraint)
}
}
@IBAction func handlerCancelButtonTap(_ sender: CustomButton) {
handlerCancelButtonCompletion!()
}
}
// MARK: - ForgotPasswordShowViewControllerInput
extension RepetitionPasswordShowViewController: RepetitionPasswordShowViewControllerInput {
func displaySomething(viewModel: RepetitionPasswordShowModels.Something.ViewModel) {
// NOTE: Display the result from the Presenter
// nameTextField.text = viewModel.name
}
}
// MARK: - UITextFieldDelegate
extension RepetitionPasswordShowViewController {
override func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
repeatPasswordErrorMessageView.didShow(false, withConstraint: repeatPasswordErrorMessageViewTopConstraint)
if (textField.tag != 99) {
passwordStrengthView.passwordStrengthLevel = (string.isEmpty && textField.text?.characters.count == 1) ? .None : (textField as! CustomTextField).checkPasswordStrength(textField.text! + string)
passwordStrengthView.setNeedsDisplay()
}
return true
}
override func textFieldShouldReturn(_ textField: UITextField) -> Bool {
if (textField.tag == 99) {
if (textFieldsCollection.first?.text == textFieldsCollection.last?.text) {
textField.resignFirstResponder()
return true
} else {
repeatPasswordErrorMessageView.didShow(true, withConstraint: repeatPasswordErrorMessageViewTopConstraint)
return false
}
} else {
let indexCurrent = textFieldsArray.index(of: textField as! CustomTextField)!
let indexNext = textFieldsArray.index(after: indexCurrent)
textFieldsArray[indexNext].becomeFirstResponder()
}
return true
}
func textFieldShouldClear(_ textField: UITextField) -> Bool {
repeatPasswordErrorMessageView.didShow(false, withConstraint: repeatPasswordErrorMessageViewTopConstraint)
return true
}
}
| [
-1
] |
90cbdd9aa977b6dc45ccacec9d0ef4258266166e | 223d06866b174c3034c0f0b041940397da0b4000 | /Extensions/TimeIntervalExtension.swift | f0658ecf9fbb96955d249d34ee3eda4a30c6c21c | [] | no_license | trymlintzen/HackerNews | d528ae9069722c150e21d2b2b41c6eedbbc7240a | e6c26863edee2e4ead9ad66f0109450b7e7ee9e3 | refs/heads/master | 2021-05-15T03:34:41.417119 | 2017-10-31T17:09:49 | 2017-10-31T17:09:49 | 108,832,785 | 0 | 0 | null | 2017-11-02T09:06:20 | 2017-10-30T10:02:17 | Swift | UTF-8 | Swift | false | false | 923 | swift | //
// TimeIntervalExtension.swift
// HackerNews
//
// Created by Trym Lintzen on 30-10-17.
// Copyright © 2017 Trym. All rights reserved.
//
import Foundation
import UIKit
extension TimeInterval {
func convertToDate() -> String{
let currentSince1970 = Date().timeIntervalSince1970
// let currentSince1970 = currentDate.timeIntervalSince1970
let differenceDate = ((currentSince1970 - self) / 60)
var result = ""
if differenceDate > 60 {
let minutes = differenceDate.truncatingRemainder(dividingBy: 60)
let hours = String(format: "%.0f", (differenceDate / 60))
let mins = String(format: "%.0f", minutes)
result.append("\(hours)h \(mins)m")
} else {
let mins = String(format: "%.0f", differenceDate)
result.append("\(mins)m")
}
return String(result)
}
}
| [
-1
] |
3fccd4b6a517b1cca65293df9a96143b534a335d | 6847ab4231ba1929e300abdb3c285ce103bcaac7 | /Arisan/TransparentTextField.swift | 5d780f7b77e76c9f703171532c13836515fb72fd | [] | no_license | codermu/arisanapp | 8fd5971cf036930f7d5798ab5834a1ce8215c027 | e08786bc25ab9117eba65793cf1b5389808ca189 | refs/heads/master | 2021-01-11T19:43:39.418466 | 2016-11-10T08:18:05 | 2016-11-10T08:18:05 | 72,729,588 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 921 | swift | //
// TransparentTextField.swift
// Arisan
//
// Created by ibrahim on 11/3/16.
// Copyright © 2016 Indosytem. All rights reserved.
//
import UIKit
class TransparentTextField: UITextField {
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)!
self.backgroundColor = UIColor.clear
//self.tintColor = UIColor.clear
self.textColor = UIColor.white
//self.layer.borderColor = UIColor.clear.cgColor
self.borderStyle = UITextBorderStyle.none
//self.layer.borderWidth = 0
//self.attributedPlaceholder = NSAttributedString(string: "", attributes: [NSForegroundColorAttributeName: UIColor.white])
}
/*
// Only override draw() if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func draw(_ rect: CGRect) {
// Drawing code
}
*/
}
| [
-1
] |
b36090cdf540fe98e3a196269edf90f85c453ae9 | 78a4e62b4248ce3829e81c342ac705862f82073c | /Blog Reader/MasterViewController.swift | bbbe5906e323afdb93addb28b1c3b53acc1d6047 | [] | no_license | Koceto1973/Blog-Reader | 8cc0919ffe24e6f22e19425e24a1d30164e43c53 | e1e9fa1e15b92158bb744103eaa2565a48b8cd54 | refs/heads/master | 2020-03-31T03:08:20.336215 | 2018-10-06T22:35:45 | 2018-10-06T22:35:45 | 151,854,428 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 10,366 | swift | //
// MasterViewController.swift
// Blog Reader
//
// Created by К.К. on 6.10.18.
// Copyright © 2018 TeamK. All rights reserved.
//
import UIKit
import CoreData
class MasterViewController: UITableViewController, NSFetchedResultsControllerDelegate {
var detailViewController: DetailViewController? = nil
var managedObjectContext: NSManagedObjectContext? = nil
override func viewDidLoad() {
super.viewDidLoad()
let url = URL(string: "https://www.googleapis.com/blogger/v3/blogs/2329352809327213022/posts?key=AIzaSyCZ-rQsZYV2qOWHerjRO-6lYYiVigRmpLk")!
let task = URLSession.shared.dataTask(with: url) { (data, response, error) in
if error != nil { print(error!) } else {
if let urlContent = data {
do {
let jsonResult = try JSONSerialization.jsonObject(with: urlContent, options: JSONSerialization.ReadingOptions.mutableContainers) as AnyObject
if let items = jsonResult["items"] as? NSArray {
let context = self.fetchedResultsController.managedObjectContext
// deletion of database each time on reload ...
let request = NSFetchRequest<NSFetchRequestResult>(entityName: "Event")
request.returnsObjectsAsFaults = false
do {
let results = try context.fetch(request)
if results.count > 0 {
for result in results as! [NSManagedObject] {
context.delete(result)
do {
try context.save()
} catch { print("Particular post deletion failed") }
}
} else { print("No results") }
} catch { print("Couldn't fetch posts for deletion") }
for item in items {
let newEvent = Event(context: context)
// If appropriate, configure the new managed object in the core data
newEvent.timestamp = Date()
newEvent.setValue((item as! NSDictionary)["published"] as? String, forKey: "published")
newEvent.setValue((item as! NSDictionary)["title"] as? String, forKey: "title")
newEvent.setValue((item as! NSDictionary)["content"] as? String, forKey: "content")
// Save the context.
do {
try context.save()
} catch {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
}
DispatchQueue.main.sync(execute: { self.tableView.reloadData() } )
}
} catch { print("JSON Processing Failed") }
}
}
}
task.resume()
}
@objc
func insertNewObject(_ sender: Any) {
let context = self.fetchedResultsController.managedObjectContext
let newEvent = Event(context: context)
// If appropriate, configure the new managed object.
newEvent.timestamp = Date()
// Save the context.
do {
try context.save()
} catch {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
}
// MARK: - Segues
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "showDetail" {
if let indexPath = tableView.indexPathForSelectedRow {
let object = fetchedResultsController.object(at: indexPath)
let controller = (segue.destination as! UINavigationController).topViewController as! DetailViewController
controller.detailItem = object
controller.navigationItem.leftBarButtonItem = splitViewController?.displayModeButtonItem
controller.navigationItem.leftItemsSupplementBackButton = true
}
}
}
// MARK: - Table View
override func numberOfSections(in tableView: UITableView) -> Int {
return fetchedResultsController.sections?.count ?? 0
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
let sectionInfo = fetchedResultsController.sections![section]
return sectionInfo.numberOfObjects
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
let event = fetchedResultsController.object(at: indexPath)
configureCell(cell, withEvent: event)
return cell
}
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return false
}
func configureCell(_ cell: UITableViewCell, withEvent event: Event) {
cell.textLabel!.text = event.value(forKey: "title") as? String
}
// MARK: - Fetched results controller
var fetchedResultsController: NSFetchedResultsController<Event> {
if _fetchedResultsController != nil {
return _fetchedResultsController!
}
let fetchRequest: NSFetchRequest<Event> = Event.fetchRequest()
// Set the batch size to a suitable number.
fetchRequest.fetchBatchSize = 20
// Edit the sort key as appropriate.
let sortDescriptor = NSSortDescriptor(key: "published", ascending: false)
fetchRequest.sortDescriptors = [sortDescriptor]
// Edit the section name key path and cache name if appropriate.
// nil for section name key path means "no sections".
let aFetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.managedObjectContext!, sectionNameKeyPath: nil, cacheName: "Master")
aFetchedResultsController.delegate = self
_fetchedResultsController = aFetchedResultsController
do {
try _fetchedResultsController!.performFetch()
} catch {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
return _fetchedResultsController!
}
var _fetchedResultsController: NSFetchedResultsController<Event>? = nil
func controllerWillChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
tableView.beginUpdates()
}
func controller(_ controller: NSFetchedResultsController<NSFetchRequestResult>, didChange sectionInfo: NSFetchedResultsSectionInfo, atSectionIndex sectionIndex: Int, for type: NSFetchedResultsChangeType) {
switch type {
case .insert:
tableView.insertSections(IndexSet(integer: sectionIndex), with: .fade)
case .delete:
tableView.deleteSections(IndexSet(integer: sectionIndex), with: .fade)
default:
return
}
}
func controller(_ controller: NSFetchedResultsController<NSFetchRequestResult>, didChange anObject: Any, at indexPath: IndexPath?, for type: NSFetchedResultsChangeType, newIndexPath: IndexPath?) {
switch type {
case .insert:
tableView.insertRows(at: [newIndexPath!], with: .fade)
case .delete:
tableView.deleteRows(at: [indexPath!], with: .fade)
case .update:
configureCell(tableView.cellForRow(at: indexPath!)!, withEvent: anObject as! Event)
case .move:
configureCell(tableView.cellForRow(at: indexPath!)!, withEvent: anObject as! Event)
tableView.moveRow(at: indexPath!, to: newIndexPath!)
}
}
func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
tableView.endUpdates()
}
/*
// Implementing the above methods to update the table view in response to individual changes may have performance implications if a large number of changes are made simultaneously. If this proves to be an issue, you can instead just implement controllerDidChangeContent: which notifies the delegate that all section and object changes have been processed.
func controllerDidChangeContent(controller: NSFetchedResultsController) {
// In the simplest, most efficient, case, reload the table view.
tableView.reloadData()
}
*/
}
| [
-1
] |
54ae2710368b7b356fd691e2c0fefc05840a55aa | 66688a188270531a5f4b875a82944bdeda4ab04e | /Landmarks/Views/Landmarks/LandmarkList.swift | 5fe47fb7529fd23ca84e06984492084dc6217ab6 | [] | no_license | ruaidhri13/landmarks | 38586a67ac634a082676e410fcd0c9e152fc1728 | e46f0247aa99eb5a6c97a1590968c54b97ac6b67 | refs/heads/main | 2023-07-01T17:47:44.029457 | 2021-07-30T17:56:36 | 2021-07-30T17:56:36 | 384,550,058 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,154 | swift | //
// LandmarkList.swift
// Landmarks
//
// Created by Ruaidhrí O'Neill on 09/07/2021.
//
import SwiftUI
struct LandmarkList: View {
@EnvironmentObject var modelData: ModelData
@State private var showFavoritesOnly = false
var filteredLandmarks : [Landmark] {
modelData.landmarks.filter { landmark in
(!showFavoritesOnly || landmark.isFavorite)
}
}
var body: some View {
NavigationView {
List {
Toggle(isOn: $showFavoritesOnly) {
Text("Favourites only")
}
ForEach(filteredLandmarks) { landmark in
NavigationLink(destination: LandmarkDetail(landmark: landmark)) {
LandmarkRow(landmark: landmark)
}
}
}
.navigationTitle("Landmarks")
}
}
}
struct LandmarkList_Previews: PreviewProvider {
static var previews: some View {
ForEach(["iPhone SE (2nd generation)", "iPhone XS Max"], id: \.self) { deviceName in
LandmarkList()
}
}
}
| [
377515
] |
a4f9ff6e8c34b006cd89f95687c9be3bba22da4c | 6076e995ab10184e230583b3822bef89e37311b7 | /CabanaUITests/CabanaUITests.swift | 241a9fde78f780896c558febca289e04759a196b | [] | no_license | gerrior/Cabana | b65f313afdb37568bbd89206020e98d0035ea392 | 8b1f82a69fdf68e67200dedf4676d8a532fc2848 | refs/heads/master | 2021-01-17T17:18:02.529532 | 2017-03-07T00:08:24 | 2017-03-07T00:08:24 | 84,129,513 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,237 | swift | //
// CabanaUITests.swift
// CabanaUITests
//
// Created by Mark Gerrior on 3/6/17.
// Copyright © 2017 Gerrior. All rights reserved.
//
import XCTest
class CabanaUITests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
| [
155665,
237599,
229414,
278571,
229425,
180279,
229431,
319543,
213051,
286787,
237638,
311373,
278607,
196687,
311377,
368732,
180317,
278637,
319599,
278642,
131190,
131199,
278669,
278676,
311447,
327834,
278684,
278690,
311459,
278698,
278703,
278707,
278713,
180409,
295099,
139459,
131270,
229591,
147679,
311520,
147680,
319719,
295147,
286957,
319764,
278805,
311582,
278817,
311596,
336177,
98611,
278843,
287040,
319812,
311622,
319816,
229716,
278895,
287089,
139641,
311679,
311692,
106893,
156069,
311723,
377265,
311739,
319931,
278974,
336319,
311744,
278979,
336323,
278988,
278992,
279000,
279009,
369121,
188899,
279014,
319976,
279017,
311787,
319986,
279030,
311800,
279033,
279042,
287237,
377352,
279053,
303634,
303635,
279060,
279061,
188954,
279066,
279092,
377419,
303693,
115287,
189016,
295518,
287327,
279143,
279150,
287345,
287348,
189054,
287359,
303743,
164487,
311944,
279176,
344714,
311948,
311950,
311953,
287379,
336531,
295575,
303772,
205469,
221853,
279207,
295591,
295598,
279215,
279218,
287412,
164532,
303802,
287418,
66243,
287434,
287438,
279249,
303826,
279253,
369365,
369366,
230105,
295653,
230120,
312046,
279278,
230133,
279293,
205566,
295688,
312076,
295698,
221980,
336678,
262952,
262953,
279337,
262957,
164655,
328495,
303921,
230198,
295745,
222017,
279379,
295769,
230238,
230239,
279393,
303973,
279398,
295797,
295799,
279418,
336765,
287623,
279434,
320394,
189327,
189349,
279465,
304050,
189373,
213956,
345030,
213961,
279499,
304086,
304104,
123880,
320492,
320495,
287730,
320504,
312313,
214009,
312315,
312317,
328701,
328705,
418819,
320520,
230411,
320526,
238611,
140311,
238617,
197658,
336930,
132140,
189487,
312372,
238646,
238650,
320571,
336962,
238663,
296023,
205911,
156763,
214116,
230500,
279659,
238706,
279666,
312435,
230514,
279686,
222344,
337037,
296091,
238764,
148674,
312519,
148687,
189651,
279766,
189656,
279775,
304352,
304353,
279780,
279789,
279803,
320769,
312588,
320795,
320802,
304422,
312628,
345398,
222523,
279872,
181568,
279874,
304457,
230730,
345418,
337228,
296269,
222542,
238928,
296274,
230757,
296304,
312688,
230772,
337280,
296328,
296330,
304523,
9618,
279955,
148899,
279979,
279980,
279988,
173492,
280003,
370122,
280011,
337359,
329168,
312785,
222674,
329170,
280020,
280025,
239069,
320997,
280042,
280043,
329198,
337391,
296434,
288248,
288252,
312830,
230922,
304655,
329231,
230933,
222754,
312879,
230960,
288305,
239159,
157246,
288319,
288322,
280131,
124486,
288328,
230999,
239192,
345697,
312937,
312941,
206447,
288377,
337533,
280193,
239238,
288391,
239251,
280217,
198304,
337590,
296636,
280253,
280252,
321217,
280259,
321220,
296649,
239305,
280266,
9935,
313042,
280279,
18139,
280285,
321250,
337638,
181992,
288492,
34547,
67316,
313082,
288508,
288515,
280326,
116491,
280333,
124691,
116502,
321308,
321309,
280367,
280373,
280377,
321338,
280381,
345918,
280386,
280391,
280396,
18263,
370526,
296807,
296815,
313200,
313204,
280451,
305032,
67464,
214936,
337816,
239515,
214943,
313257,
288698,
214978,
280517,
280518,
214983,
231382,
329696,
190437,
313322,
329707,
174058,
296942,
124912,
239610,
313338,
182277,
313356,
305173,
223269,
354342,
354346,
313388,
124974,
321589,
215095,
288829,
288835,
313415,
239689,
354386,
280660,
223317,
329812,
321632,
280674,
280676,
313446,
215144,
288878,
288890,
215165,
280708,
329884,
215204,
280761,
223418,
280767,
338118,
280779,
321744,
280792,
280803,
338151,
182503,
125166,
125170,
395511,
313595,
125184,
125192,
125197,
125200,
338196,
125204,
125215,
338217,
125225,
321839,
125236,
280903,
289109,
379224,
239973,
313703,
280938,
321901,
354671,
199030,
223611,
248188,
313726,
240003,
158087,
313736,
240020,
190870,
190872,
289185,
305572,
289195,
338359,
289229,
281038,
281039,
281071,
322057,
182802,
322077,
289328,
338491,
322119,
281165,
281170,
281200,
313970,
297600,
289435,
314020,
248494,
166581,
314043,
363212,
158424,
322269,
338658,
289511,
330473,
330476,
289517,
215790,
125683,
199415,
289534,
322302,
35584,
322312,
346889,
264971,
322320,
166677,
207639,
281378,
289580,
281407,
289599,
281426,
281434,
322396,
281444,
207735,
314240,
158594,
330627,
240517,
289691,
240543,
289699,
289704,
289720,
289723,
281541,
19398,
191445,
183254,
207839,
142309,
314343,
183276,
289773,
248815,
240631,
330759,
330766,
281647,
322609,
314437,
207954,
339031,
314458,
281698,
281699,
322664,
314493,
150656,
347286,
339106,
306339,
249003,
208044,
322733,
3243,
339131,
290001,
339167,
298209,
290030,
208123,
322826,
126229,
298290,
208179,
159033,
216387,
372039,
224591,
331091,
314708,
150868,
314711,
314721,
281958,
314727,
134504,
306541,
314740,
314742,
290170,
224637,
306558,
290176,
314752,
306561,
314759,
298378,
314765,
314771,
306580,
224662,
282008,
314776,
282013,
290206,
314788,
298406,
282023,
314790,
241067,
314797,
306630,
306634,
339403,
191980,
282097,
306678,
191991,
290304,
323079,
323083,
323088,
282132,
282135,
175640,
306730,
290359,
323132,
282182,
224848,
224852,
290391,
306777,
282214,
224874,
314997,
290425,
339579,
282244,
282248,
323208,
323226,
282272,
282279,
298664,
298666,
306875,
282302,
323262,
323265,
282309,
306891,
241360,
282321,
241366,
282330,
282336,
12009,
282347,
282349,
323315,
200444,
282366,
249606,
282375,
323335,
282379,
216844,
118549,
282390,
282399,
241440,
282401,
339746,
315172,
216868,
241447,
282418,
282424,
282428,
413500,
241471,
315209,
159563,
307024,
307030,
241494,
307038,
282471,
282476,
339840,
315265,
282503,
315272,
315275,
184207,
282517,
298912,
118693,
298921,
126896,
200628,
282572,
282573,
323554,
298987,
282634,
241695,
315431,
102441,
315433,
102446,
282671,
241717,
307269,
233548,
315468,
315477,
200795,
323678,
315488,
315489,
45154,
233578,
307306,
241809,
323730,
299166,
233635,
299176,
184489,
323761,
184498,
258233,
299197,
299202,
176325,
299208,
233678,
282832,
356575,
307431,
184574,
217352,
315674,
282908,
299294,
282912,
233761,
282920,
315698,
332084,
307514,
282938,
127292,
168251,
323914,
201037,
282959,
250196,
168280,
323934,
381286,
242027,
242028,
250227,
315768,
315769,
291194,
291193,
291200,
242059,
315798,
291225,
242079,
283039,
299449,
291266,
283088,
283089,
176602,
242138,
160224,
291297,
283138,
233987,
324098,
340489,
283154,
291359,
283185,
234037,
340539,
234044,
332379,
111197,
242274,
291455,
316044,
184974,
316048,
316050,
340645,
176810,
299698,
291529,
225996,
135888,
242385,
299737,
234216,
234233,
242428,
291584,
299777,
291591,
291605,
283418,
234276,
283431,
242481,
234290,
201534,
283466,
201562,
234330,
275294,
349025,
357219,
177002,
308075,
242540,
201590,
177018,
308093,
291713,
340865,
299912,
316299,
234382,
308111,
308113,
209820,
283551,
177074,
127945,
340960,
234469,
340967,
324587,
234476,
201721,
234499,
234513,
316441,
300087,
21567,
308288,
160834,
349254,
300109,
234578,
250965,
234588,
250982,
234606,
300145,
300147,
234626,
234635,
177297,
308375,
324761,
119965,
234655,
300192,
234662,
300200,
324790,
300215,
283841,
283846,
283849,
316628,
251124,
234741,
316661,
283894,
292092,
234756,
242955,
177420,
292145,
300342,
333114,
333115,
193858,
300355,
300354,
234830,
283990,
357720,
300378,
300379,
316764,
292194,
284015,
234864,
316786,
243073,
292242,
112019,
234902,
333224,
284086,
259513,
284090,
54719,
415170,
292291,
300488,
300490,
234957,
144862,
300526,
308722,
300539,
210429,
292359,
218632,
316951,
374297,
235069,
349764,
194118,
292424,
292426,
333389,
349780,
128600,
235096,
300643,
300645,
243306,
325246,
333438,
235136,
317102,
300725,
300729,
333508,
333522,
325345,
153318,
333543,
284410,
284425,
300810,
300812,
284430,
161553,
284436,
325403,
341791,
325411,
186148,
186149,
333609,
284460,
300849,
325444,
153416,
325449,
317268,
325460,
341846,
284508,
300893,
284515,
276326,
292713,
292719,
325491,
333687,
317305,
317308,
333700,
325508,
243590,
243592,
325514,
350091,
350092,
350102,
333727,
219046,
333734,
284584,
292783,
300983,
153553,
292835,
6116,
292838,
317416,
325620,
333827,
243720,
292901,
325675,
243763,
325695,
333902,
227432,
194667,
284789,
284790,
292987,
227459,
194692,
235661,
333968,
153752,
284827,
333990,
284840,
284843,
227517,
309443,
227525,
301255,
227536,
301270,
301271,
325857,
334049,
317676,
309504,
194832,
227601,
325904,
334104,
211239,
334121,
317738,
325930,
227655,
383309,
391521,
285031,
416103,
227702,
211327,
227721,
285074,
227730,
285083,
293275,
317851,
227743,
293281,
285089,
301482,
375211,
334259,
293309,
317889,
326083,
129484,
326093,
285152,
195044,
334315,
236020,
293368,
317949,
342537,
309770,
334345,
342560,
227881,
293420,
236080,
23093,
244279,
244280,
301635,
309831,
55880,
301647,
326229,
309847,
244311,
244326,
277095,
301688,
244345,
301702,
334473,
326288,
227991,
285348,
318127,
285360,
293552,
285362,
342705,
154295,
342757,
285419,
170735,
342775,
375552,
228099,
285443,
285450,
326413,
285457,
285467,
326428,
318247,
293673,
318251,
301872,
285493,
285496,
301883,
342846,
293702,
318279,
244569,
301919,
293729,
351078,
310132,
228214,
269179,
228232,
416649,
252812,
293780,
310166,
310177,
293801,
326571,
326580,
326586,
359365,
211913,
56270,
203758,
293894,
293911,
326684,
113710,
318515,
203829,
285795,
228457,
318571,
187508,
302202,
285819,
285823,
285833,
285834,
318602,
228492,
162962,
187539,
326803,
285850,
302239,
302251,
294069,
294075,
64699,
228541,
343230,
310496,
228587,
302319,
228608,
318732,
245018,
318746,
130342,
130344,
130347,
286012,
294210,
294220,
318804,
294236,
327023,
327030,
310650,
179586,
294278,
368012,
318860,
318876,
343457,
245160,
286128,
286133,
310714,
302523,
228796,
302530,
228804,
310725,
310731,
302539,
310735,
327122,
310747,
286176,
187877,
310758,
40439,
286201,
359931,
245249,
228868,
302602,
294413,
359949,
302613,
302620,
245291,
130622,
310853,
286281,
196184,
212574,
204386,
204394,
138862,
310896,
294517,
286344,
179853,
286351,
188049,
229011,
179868,
229021,
302751,
245413,
212649,
286387,
286392,
302778,
286400,
212684,
302798,
286419,
278232,
294621,
278237,
278241,
294629,
286457,
286463,
319232,
278292,
278294,
294699,
286507,
319289,
237397,
188250,
237411,
327556,
188293,
311183,
294806,
294808,
319393,
294820,
294824,
343993,
98240,
294849,
24531,
294887,
278507,
311277,
327666,
278515
] |
de1a0cc82c6fb130b9351c68d650bc324d0557bc | 8a391cfbc42da947e9fa0754f0dec7d32276546e | /MYPandaTV/Classes/Entertainment/View/PageContentView.swift | 6389f96b3c7a00ba0e829a43436fa382a69ef728 | [] | no_license | loveAct/-TV | 2317247d5f6de7c7417708ae2597881e62627f6c | cfa472aff9511fe24be1a4ddf0d342092d42f381 | refs/heads/master | 2021-06-13T00:45:06.071127 | 2017-03-19T05:37:11 | 2017-03-19T05:37:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,505 | swift | //
// PageContentView.swift
// MYPandaTV
//
// Created by apple on 2017/3/19.
// Copyright © 2017年 apple. All rights reserved.
//
import UIKit
//MARK:- 定义代理1
protocol PageContentViewDelegate :class {
func pageContentView(_ contentView : PageContentView, progress : CGFloat,sourceIndex :Int , targetIndex :Int)
}
private let ContentCellID = "ContentCellID"
class PageContentView: UIView {
// 默认控子制器
let defaultVcsCount = UserDefaults.standard.object(forKey: DEFAULT_CHILDVCS) as! Int
fileprivate var isForbidScrollDelegate : Bool = false
fileprivate var startOffsetX : CGFloat = 0
fileprivate var childVcs :[UIViewController]
//需要改成弱引用,否则有循环引用
fileprivate weak var parentVc : UIViewController?
//MARK:- 定义代理2
weak var delegate : PageContentViewDelegate?
// MARK:- 懒加载
fileprivate lazy var collectionView : UICollectionView = {[weak self] in
let layout = UICollectionViewFlowLayout()
//布局属性 大小 滚动方向 间距
layout.itemSize = (self?.bounds.size)!//使用[weak self] in 后: self.bounds.size => (self?.bounds.size)!
layout.minimumLineSpacing = 0
layout.minimumInteritemSpacing = 0
layout.scrollDirection = .horizontal
let collectionView = UICollectionView(frame: CGRect.zero, collectionViewLayout: layout)
collectionView.showsHorizontalScrollIndicator = false
collectionView.bounces = false
collectionView.isPagingEnabled = true
collectionView.dataSource = self
collectionView.delegate = self
collectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: ContentCellID)
return collectionView
}()
init(frame: CGRect,childVcs : [UIViewController],parentVc:UIViewController?) {
self.childVcs = childVcs
self.parentVc = parentVc //可选类型赋值给可选类型
super.init(frame: frame)
setupUI()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
extension PageContentView {
fileprivate func setupUI(){
for childVc in childVcs {
parentVc?.addChildViewController(childVc)
}
addSubview(collectionView)
collectionView.frame = bounds
}
}
// MARK:- 遵守UICollectionViewDataSource数据源协议
extension PageContentView : UICollectionViewDataSource{
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return self.childVcs.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: ContentCellID, for: indexPath)
//
for view in cell.contentView.subviews{
view.removeFromSuperview()
}
let childVc = childVcs[indexPath.item]
childVc.view.frame = cell.contentView.bounds
cell.contentView.addSubview(childVc.view)
return cell
}
}
//MARK:- 遵守UICollectionViewDelegate代理
extension PageContentView : UICollectionViewDelegate{
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
isForbidScrollDelegate = false
startOffsetX = scrollView.contentOffset.x
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
//是点击传导过来的,则不处理
if isForbidScrollDelegate { return }
//滚动处理
var progress : CGFloat = 0
var sourceIndex :Int = 0
var targetIndex :Int = 0
let currentOffsetX = scrollView.contentOffset.x
let scrollViewW = scrollView.bounds.width
if currentOffsetX > startOffsetX {
progress = currentOffsetX/scrollViewW - floor(currentOffsetX/scrollViewW)
sourceIndex = Int(currentOffsetX/scrollViewW)
targetIndex = sourceIndex + 1
if targetIndex >= childVcs.count {
targetIndex = childVcs.count - 1
}
//完全滑过去
if currentOffsetX - startOffsetX == scrollViewW{
progress = 1
targetIndex = sourceIndex
}
}else{
progress = 1 - (currentOffsetX/scrollViewW - floor(currentOffsetX/scrollViewW))
targetIndex = Int(currentOffsetX/scrollViewW)
sourceIndex = targetIndex + 1
if sourceIndex >= childVcs.count{
sourceIndex = childVcs.count - 1
}
//完全划过去
if startOffsetX - currentOffsetX == scrollViewW {
sourceIndex = targetIndex
}
// print(">right>progress[\(progress)] sourceIndex[\(sourceIndex)] targetIndex[\(targetIndex)]")
}
//MARK:- 定义代理3
delegate?.pageContentView(self, progress: progress, sourceIndex: sourceIndex, targetIndex: targetIndex)
}
}
//MARK: - homevc作为Pageview的代理,再由homevc调用到这里
extension PageContentView {
func setCurrentIndex(currentIndex : Int){
isForbidScrollDelegate = true
let offsetX = CGFloat( currentIndex) * collectionView.frame.width
collectionView.setContentOffset(CGPoint(x:offsetX,y:0), animated: false)
}
}
//MARK: - 公共方法,当添加或移除分类后,需要同步刷新PageContentView
extension PageContentView {
//MARK: - 刷新子控制器
public func reloadChildVcs(newChildVcs: [UIViewController]) {
print("newChildVcs-", newChildVcs)
if self.childVcs.count < (defaultVcsCount + newChildVcs.count) {
for childVc in newChildVcs {
self.childVcs.append(childVc)
parentVc?.addChildViewController(childVc)
}
} else {
let count = self.childVcs.count - (defaultVcsCount + newChildVcs.count)
updateChildVcs(count: count)
}
UserDefaults.standard.set(self.childVcs.count, forKey: HOME_CHILDVCS)
collectionView.reloadData()
}
//MARK: - 没有添加频道或者移除了所有的频道,回到默认状态
public func setDefaultChildVcs() {
// 移除 "精彩推荐"和"全部直播"两个频道之外的所有频道控制器
// 当前子控制器个数 - 默认子控制个数 = 需要移除控制器的个数
let counts = self.childVcs.count - defaultVcsCount
updateChildVcs(count: counts)
UserDefaults.standard.set(self.childVcs.count, forKey: HOME_CHILDVCS)
collectionView.reloadData()
}
//MARK: - 更新控制器
func updateChildVcs(count: Int) {
var i = 0
let lastChildVcsCount = UserDefaults.standard.object(forKey: HOME_CHILDVCS) as! Int
print("removecount-",count)
for _ in 0..<count {
self.childVcs.removeLast()
}
for childvc in (self.parentVc?.childViewControllers)! {
print("unremoveChildVC-",childvc)
print("i=", i)
if i > (lastChildVcsCount - count - 1) {
print("removechildVC",childvc)
childvc.removeFromParentViewController()
}
i += 1
}
for childs in self.childVcs {
parentVc?.addChildViewController(childs)
}
}
}
| [
-1
] |
9dd5f12b1b09fdf0be3206b63724f6e2c9c67a3e | de1d7d2d53b61e06340c6570e583af3bfd2a6561 | /Player1ImageViewButton.swift | f9fd5f39bd12fcb1bf640a144230887069511aa6 | [] | no_license | Geoza/Scr0re-it-pro | 1ce23436cae8e5c99baaa36ba14131e1e8149ac2 | 77d207ff66a088beb61344033cb980400cfa4dcc | refs/heads/master | 2021-01-11T21:10:08.602786 | 2017-01-17T19:30:58 | 2017-01-17T19:30:58 | 79,263,376 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,376 | swift | //
// Player1ImageViewButton.swift
// Sc0re it Pro
//
// Created by George on 12/07/16.
// Copyright © 2016 George Zaimis. All rights reserved.
//
import UIKit
class Player1ImageViewButton: UIView {
override func draw(_ rect: CGRect) {
PaintCode.imageOfCanvas1()
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
testTouches(touches as NSSet!)
}
func testTouches(_ touches: NSSet!) {
// Get the first touch and its location in this view controller's view coordinate system
let touch = touches.allObjects[0] as! UITouch
let touchLocation = touch.location(in: self)
// Convert the location of the obstacle view to this view controller's view coordinate system
let obstacleViewFrame = self.convert(frame, from: superview)
// Check if the touch is inside the obstacle view
if obstacleViewFrame.contains(touchLocation) {
let prefs:UserDefaults = UserDefaults.standard
prefs.set(1, forKey: "Pass?")
prefs.synchronize()
}
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func drawRect(rect: CGRect) {
// Drawing code
}
*/
}
| [
-1
] |
df171bfb341bb9b9a298cab9a8f10d57b388f08f | 6f896dd6af6ed2d9d3424bb7f9af0a884b9db76c | /iOSPruebaCeibaTests/UserPosts/Interactor/UserPostsInteractorTests.swift | f0c473932c156743068496c1030d9084457d5999 | [
"MIT"
] | permissive | xkiRox/iOSPruebaCeiba | 8978332e80ba570d5df42eb53c054a5259a63f7a | f85320f8c81fe0e3531a01ae60b09adf42b171c3 | refs/heads/main | 2023-07-15T17:06:57.167628 | 2021-08-29T21:24:00 | 2021-08-29T21:24:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 822 | swift | //
// UserPostsInteractorTests.swift
// iOSPruebaCeibaTests
//
// Created by Hector Satizabal on 28/08/21.
//
import XCTest
@testable import iOSPruebaCeiba
class UserPostsInteractorTests: XCTestCase {
func testUserPostsInteractor_ShouldSuccessResponseReturnNotNil() throws {
let postsUserService = MockUserPostsServiceFactory.createService()
let interactor = UserPostsInteractor(postService: postsUserService)
interactor.fetchPostUsers(id: 0)
}
func testUserPostsInteractor_ShouldFailureResponseReturnNotNil() throws {
MockUserPostsServiceFactory.success = false
let postsUserService = MockUserPostsServiceFactory.createService()
let interactor = UserPostsInteractor(postService: postsUserService)
interactor.fetchPostUsers(id: 0)
}
}
| [
-1
] |
4dae913319f8fb0c2bd8281ddb58147bbc282c1c | 7f3b98267654f0ca4dca719619c052fa7005a165 | /wondersoftheworld/WOWListingsPageViewController.swift | 8e15430e79a0da01bbe961a47a6bba80da5b6262 | [] | no_license | andyshephard/wondersoftheworld_ios | eac66afb50b7d48a9cef541636c0b967f21bfad7 | 6e416a0115c994f03d12e947021b9accf287cc13 | refs/heads/master | 2021-01-20T11:19:18.312767 | 2019-05-14T10:11:03 | 2019-05-14T10:11:03 | 82,490,314 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,980 | swift | //
// WOWListingsPageViewController.swift
// wondersoftheworld
//
// Created by Andy Shephard on 14/02/2017.
// Copyright © 2017 Andy Shephard. All rights reserved.
//
import UIKit
class WOWListingsPageViewController: UIPageViewController, WOWListingsPageContentViewControllerDelegate {
weak var pageDelegate: WOWListingsPageViewControllerDelegate?
// Public accessor.
public var selectedCategory: WOWCategory?
// Internal variables.
var wonders: Array<WOWWonder> = []
var pages: Array<WOWListingsPageContentViewController> = []
var currentIndex: Int?
//MARK: Loading
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)
// Populate the |wonders| array.
populateWonders()
// And create the PageViewControllers based on these.
setupPages()
// Setup the initial view controller.
if let initialViewController = pages.first {
scrollToViewController(viewController: initialViewController)
}
// Notify the delegate of the number of views to scroll through.
pageDelegate?.pageViewController(pageViewController: self, didUpdatePageCount: pages.count)
}
func populateWonders() {
wonders = WOWDataModel.sharedModel.wondersForCategory(category: selectedCategory!)
}
func setupPages() {
for index in 0...wonders.count-1 {
let entry: WOWWonder = wonders[index]
let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "WOWListingsPageContentViewController") as! WOWListingsPageContentViewController
_ = vc.view
vc.tag = index
vc.delegate = self
vc.contentTitleLabel.text = entry.title
vc.contentImageView.image = UIImage.init(named: entry.pageImage!)
vc.contentSubtitleLabel.text = entry.desc
pages.append(vc)
}
}
/**
Scrolls to the next vc.
*/
func scrollToNextViewController() {
if let visibleViewController = viewControllers?.first,
let nextViewController = pageViewController(self, viewControllerAfter: visibleViewController as! WOWListingsPageContentViewController) {
scrollToViewController(viewController: nextViewController)
}
}
func scrollToViewController(index newIndex: Int) {
if let firstViewController = viewControllers?.first,
let currentIndex = pages.firstIndex(of: firstViewController as! WOWListingsPageContentViewController) {
let direction: UIPageViewController.NavigationDirection = newIndex >= currentIndex ? .forward : .reverse
let nextViewController = pages[newIndex]
scrollToViewController(viewController: nextViewController, direction: direction)
}
}
private func scrollToViewController(viewController: UIViewController, direction: UIPageViewController.NavigationDirection = .forward) {
setViewControllers([viewController], direction: direction, animated: true) { (finished) in
self.notifyContainerDelegateOfNewIndex()
}
}
//MARK: WOWListingsPageContentViewControllerDelegate
func didTapPageContentViewControllerWithTag(tag: Int) {
pageDelegate?.pageViewController(pageViewController: self, didSelectWonder: wonders[tag])
}
func didSwipePreviousPage() {
let newIndex = currentIndex! - 1
// Ensure that we won't scroll to non-existing location and crash.
guard newIndex >= 0 else {
return
}
// Scroll to previous index.
scrollToViewController(index: newIndex)
}
func didSwipeNextPage() {
let newIndex = currentIndex! + 1
// Ensure that we won't scroll to non-existing location and crash.
guard newIndex <= pages.count - 1 else {
return
}
// Scroll to next index.
scrollToViewController(index: newIndex)
}
func notifyContainerDelegateOfNewIndex() {
if let firstViewController = viewControllers?.first,
let index = pages.firstIndex(of: firstViewController as! WOWListingsPageContentViewController) {
// Update the current index.
currentIndex = index
// Then notify the pageDelegate.
pageDelegate?.pageViewController(pageViewController: self, didUpdatePageIndex: index)
}
}
}
extension WOWListingsPageViewController: UIPageViewControllerDataSource {
func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController? {
guard let viewControllerIndex = pages.firstIndex(of: viewController as! WOWListingsPageContentViewController) else {
return nil
}
let previousIndex = viewControllerIndex - 1
guard previousIndex >= 0 else {
return pages.last
}
guard pages.count > previousIndex else {
return nil
}
return pages[previousIndex]
}
func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? {
guard let viewControllerIndex = pages.firstIndex(of: viewController as! WOWListingsPageContentViewController) else {
return nil
}
let nextIndex = viewControllerIndex + 1
let orderedViewControllersCount = pages.count
guard orderedViewControllersCount != nextIndex else {
return pages.first
}
guard orderedViewControllersCount > nextIndex else {
return nil
}
return pages[nextIndex]
}
}
extension WOWListingsPageViewController: UIPageViewControllerDelegate {
func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {
notifyContainerDelegateOfNewIndex()
}
}
protocol WOWListingsPageViewControllerDelegate: class {
func pageViewController(pageViewController: WOWListingsPageViewController, didUpdatePageCount count: Int)
func pageViewController(pageViewController: WOWListingsPageViewController, didUpdatePageIndex index: Int)
func pageViewController(pageViewController: WOWListingsPageViewController, didSelectWonder wonder: WOWWonder)
}
| [
-1
] |
4cdbbe79707fa3a90ca61c4f2254002ec6934787 | 1ba55c25e84530395710ad761902e952e95966e8 | /Twitter/API/AuthService.swift | c1b742975249f8ae1cb1e0b716682d744b1e97a6 | [] | no_license | roostique/Twitter-Clone | f387eb0d6f522fe021ab1eeb1e6f186d9e773e90 | ca857069e00780642429f809b0dd8ea5ffa0dcae | refs/heads/master | 2022-11-06T13:35:14.846862 | 2020-06-23T19:01:58 | 2020-06-23T19:01:58 | 261,470,586 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,190 | swift | //
// AuthService.swift
// Twitter
//
// Created by Rustem Supayev on 07/05/2020.
// Copyright © 2020 Rustem Supayev. All rights reserved.
//
import UIKit
import Firebase
struct AuthService {
static let shared = AuthService()
func logInUser(withEmail email: String, password: String, completion: AuthDataResultCallback?) {
Auth.auth().signIn(withEmail: email, password: password, completion: completion)
}
func signUpUser(credentials: AuthData, completion: @escaping(Error?, DatabaseReference) -> Void) {
let email = credentials.email
let password = credentials.password
let fullname = credentials.fullname
let username = credentials.username
// Выгрузка фотографии профиля в базу данных
guard let imageData = credentials.profileImage.jpegData(compressionQuality: 0.3) else { return }
let filename = NSUUID().uuidString
let storageRef = STORAGE_PROFILE_IMAGES.child(filename)
storageRef.putData(imageData, metadata: nil) { (meta, error) in
storageRef.downloadURL { (url, error) in
guard let profileImageUrl = url?.absoluteString else { return }
// Аутентификация пользователя
Auth.auth().createUser(withEmail: email, password: password) { (result, error) in
if let error = error {
print("DEBUG: error is \(error.localizedDescription)")
return
}
guard let uid = result?.user.uid else { return }
let values = ["email": email,
"fullname": fullname,
"username": username,
"profileImageUrl": profileImageUrl]
REF_USERS.child(uid).updateChildValues(values, withCompletionBlock: completion)
}
}
}
}
}
| [
-1
] |
34706cd8294b086af3176ae2e08eddded228e88f | 3814c9ced69a6f5beedb2bd28670b54bbe07dc38 | /SASpinner/ViewController.swift | aa79d73ff533ad3c796f1acfeee8efdf11cb59f9 | [] | no_license | BluePick/SASpinner | c4a4dc76fdd2fe4bdf398ad91975a9a935488ffb | aaf015ec7b305a4ec920cbc523bf78fdca75eb95 | refs/heads/master | 2021-01-25T11:20:43.526426 | 2017-08-17T00:10:33 | 2017-08-17T00:10:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,459 | swift | //
// ViewController.swift
// SASpinner
//
// Created by Sulabh Agarwal on 6/29/17.
// Copyright © 2017 Sulabh Agarwal. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var spinValueLabel: UILabel!
var spinnerView = SpinnerView(frame: CGRect.zero)
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
addSpinnerView()
spinnerView.addOval()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func spinBuutonAction(_ sender: UIButton) {
spinnerView.callSpinTimer()
}
func addSpinnerView() {
let boxSize: CGFloat = 100.0
spinnerView.frame = CGRect(x: view.bounds.width / 2 - boxSize / 2,
y: view.bounds.height / 2 - boxSize / 2,
width: boxSize,
height: boxSize)
spinnerView.parentFrame = view.frame
spinnerView.delegate = self
view.addSubview(spinnerView)
}
}
extension ViewController: spinnerProtocol {
func spinValueAfterCompleteRoatation(value: Float) {
let radianToDegree = Int(value * 180 / .pi)
spinValueLabel.text = "\(radianToDegree)"
}
}
| [
-1
] |
55e40b6c39d36b25e8b99e414ff6c22d4ced8e93 | baee8e5b68e864d2ec47a9b6645df48a17331d6f | /NewYorkTimes/View/Home/HomeViewController.swift | c18c0a9258c1d0921bc9feee6e33bc1d52cb2646 | [] | no_license | bhavilad/NewYorkTimes | a8edda2498c24fb8afcc35b68710a8dedd1aa3e0 | 5f05fd6569febcebf79f4115553d512f80d22c12 | refs/heads/master | 2022-01-05T22:43:52.663474 | 2018-05-13T18:37:17 | 2018-05-13T18:37:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,624 | swift | //
// HomeViewController.swift
// NewYorkTimes
//
// Created by levantAJ on 12/5/18.
// Copyright © 2018 levantAJ. All rights reserved.
//
import UIKit
final class HomeViewController: UIViewController {
@IBOutlet weak var collectionView: UICollectionView!
@IBOutlet weak var loadingView: UIActivityIndicatorView!
var viewModel: HomeViewModelProtocol!
fileprivate var refreshControl: UIRefreshControl!
fileprivate var searchArticlesVC: SearchArticlesResultsViewController!
fileprivate var searchController: UISearchController!
override func viewDidLoad() {
super.viewDidLoad()
setupViews()
setupViewModel()
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == Constant.HomeViewController.ToArticlesIdentifier {
let articlesVC = segue.destination as! ArticlesViewController
let index = sender as! Int
let contents = viewModel.contentViewModels.map { $0.content }
articlesVC.viewModel = ArticlesViewModel(contents: contents, currentIndex: index)
}
}
}
// MARK: - UICollectionViewDataSource
extension HomeViewController: UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return viewModel.contentViewModels.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(type: ContentCollectionViewCell.self, for: indexPath)
if let content = viewModel.contentViewModel(at: indexPath.item) {
cell.set(viewModel: content)
}
return cell
}
}
// MARK: - UICollectionViewDelegate, UICollectionViewDelegateFlowLayout
extension HomeViewController: UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: view.bounds.width, height: 500)
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
if scrollView.contentOffset.y >= (scrollView.contentSize.height - scrollView.frame.size.height) {
viewModel.loadMore()
}
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
performSegue(withIdentifier: Constant.HomeViewController.ToArticlesIdentifier, sender: indexPath.item)
}
}
// MARK: - Users Interactions
extension HomeViewController {
@objc func refreshControlValueChanged() {
viewModel.refresh()
}
}
// MARK: - Privates
extension HomeViewController {
fileprivate func setupViews() {
title = NSLocalizedString("The New York Times", comment: "")
collectionView.register(type: ContentCollectionViewCell.self)
collectionView.dataSource = self
collectionView.delegate = self
refreshControl = UIRefreshControl(frame: CGRect(x: 0, y: 0, width: 20, height: 20))
refreshControl.addTarget(self, action: #selector(refreshControlValueChanged), for: .valueChanged)
collectionView.addSubview(refreshControl)
searchArticlesVC = UIStoryboard.viewController(screenName: String(describing: SearchArticlesResultsViewController.self), storyboardName: "SearchArticles") as! SearchArticlesResultsViewController
searchController = UISearchController(searchResultsController: searchArticlesVC)
searchController.searchResultsUpdater = searchArticlesVC
searchController.obscuresBackgroundDuringPresentation = false
searchController.searchBar.placeholder = NSLocalizedString("Search Articles", comment: "")
searchController.searchBar.delegate = searchArticlesVC
searchArticlesVC.searchBar = searchController.searchBar
navigationItem.searchController = searchController
definesPresentationContext = true
}
fileprivate func setupViewModel() {
viewModel.onReloadData = { [weak self] in
guard let strongSelf = self else { return }
strongSelf.refreshControl.endRefreshing()
strongSelf.loadingView.stopAnimating()
strongSelf.collectionView.reloadData()
}
viewModel.onMoreData = { [weak self] contents in
guard let strongSelf = self else { return }
strongSelf.collectionView.performBatchUpdates({
for content in contents {
strongSelf.viewModel.append(contentViewModel: content)
let indexPath = IndexPath(item: strongSelf.viewModel.contentViewModels.count - 1, section: 0)
strongSelf.collectionView.insertItems(at: [indexPath])
}
})
}
viewModel.onError = { [weak self] errorMessage in
guard let strongSelf = self else { return }
let alertController = UIAlertController(title: NSLocalizedString("Error", comment: ""), message: errorMessage, preferredStyle: .alert)
let cancelAction = UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .cancel, handler: nil)
alertController.addAction(cancelAction)
strongSelf.present(alertController, animated: true, completion: nil)
}
viewModel.refresh()
}
}
extension Constant {
struct HomeViewController {
static let ToArticlesIdentifier = "ToArticles"
}
}
| [
-1
] |
2c9562ea1ebc2b5c83d3844c941127c65b1abf15 | 917bef23256ddde219fc23382dd318f4bcadd98f | /NeoConnect/Brands/Connected/ProfilePage/B_ParametersTableViewController 2.swift | 9baa76b0f0cbe1b8430646ae7b3109550982ab33 | [] | no_license | neoconnect-EIP/neoconnect-iOS | fc700089ba9abbb79ccef403745ccb2599894e7c | 7d9d0688c684015b741d47d1cd71cfaa618be2ac | refs/heads/master | 2021-07-10T04:49:00.172418 | 2020-11-27T19:38:02 | 2020-11-27T19:38:02 | 220,458,202 | 0 | 0 | null | 2020-11-27T19:38:03 | 2019-11-08T12:01:12 | Swift | UTF-8 | Swift | false | false | 3,868 | swift | //
// B_ParametersTableViewController.swift
// NeoConnect
//
// Created by EIP on 02/02/2020.
// Copyright © 2020 EIP. All rights reserved.
//
import UIKit
class B_ParametersTableViewController: UITableViewController {
@IBAction func logoutButtonTapped(_ sender: Any) {
DispatchQueue.main.async {
let alertView = UIAlertController(title: "Are you sure ?", message: "You are going to disconnect, are you sure ?", preferredStyle: .alert)
alertView.addAction(UIAlertAction(title: "No", style: .cancel) { action in
})
alertView.addAction(UIAlertAction(title: "Yes", style: .default) { action in
let storyBoard: UIStoryboard = UIStoryboard(name: "B_Register_and_Connection", bundle: nil)
let loginVC = storyBoard.instantiateViewController(withIdentifier: "B_NavController")
loginVC.modalPresentationStyle = .fullScreen
self.present(loginVC, animated: true, completion: nil) })
self.present(alertView, animated: true, completion: nil)
}
}
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 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return 4
}
/*
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
// Configure the cell...
return cell
}
*/
/*
// Override to support conditional editing of the table view.
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
*/
/*
// Override to support editing the table view.
override func tableView(_ tableView: UITableView, commit editingStyle: 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
] |
908d6904019968b80c8ed3cc8c26b628207efeed | a7432b8c73db37cb12da53ab80deb995dc5bbc5c | /pinsoftcase/TableViewCells/DetailTableVCell.swift | 7633fab2062d43e25ca2730f0d61a76734f17e7c | [] | no_license | xcanozmen/Pinsoft_Case | f25fc8809d0108e15132cf44091bb467139388b9 | b9921bc818448d1bf5d4f5c23c1b93bb7fb87aed | refs/heads/main | 2023-06-08T11:22:31.088134 | 2021-06-22T09:55:46 | 2021-06-22T09:55:46 | 378,127,294 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 838 | swift | //
// DetailTableVCell.swift
// pinsoftcase
//
// Created by Can on 16.06.2021.
//
import UIKit
class DetailTableVCell: UITableViewCell {
@IBOutlet weak var starImgView: UIImageView!
@IBOutlet weak var typeLabel: UILabel!
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var labelOne: UILabel!
@IBOutlet weak var labelTwo: UILabel!
@IBOutlet weak var labelThree: UILabel!
@IBOutlet weak var labelFour: UILabel!
@IBOutlet weak var labelFive: UILabel!
@IBOutlet weak var imgView: UIImageView!
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
}
}
| [
320001,
337412,
227845,
333831,
227849,
227852,
333837,
372750,
196108,
372753,
196114,
372754,
327190,
328214,
287258,
370207,
243746,
287266,
281636,
327224,
327225,
307277,
327248,
235604,
235611,
213095,
213097,
310894,
213109,
148600,
403068,
410751,
300672,
373913,
148637,
148638,
276639,
148648,
300206,
361651,
327360,
223437,
291544,
306907,
337627,
176358,
271087,
325874,
338682,
276746,
276756,
203542,
261406,
349470,
396065,
111912,
369458,
369461,
282934,
342850,
342851,
151881,
430412,
283471,
283472,
270679,
287067,
350050,
270691,
257898,
330602,
179568,
317296,
317302,
244600,
179578,
179580,
211843,
213891,
36743,
209803,
211370,
288690,
281014,
323532,
430546,
430547,
180695,
180696,
284131,
344039,
196076,
310778,
305661
] |
2ed35712ddf4f1f8eb377daeb0baa7d2df7d84ed | 374f5f9358bbec38e3c539a067d4c8ebf60d7b82 | /YahooUIClone/TwitterLBTA/AppDelegate.swift | ae595614c6538cc5fbd9de0e76053432a60340bb | [] | no_license | AviPogrow/YahooWeatherUIClone | ac55b163611f24e66ccbf4d76540f729d8a5fd99 | 2c8cd78713df8d15aba51efd7cd6d51c2e782986 | refs/heads/master | 2020-05-29T15:05:03.196690 | 2019-05-29T11:37:59 | 2019-05-29T11:37:59 | 189,212,310 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,553 | swift | //
// AppDelegate.swift
// TwitterLBTA
//
// Created by Brian Voong on 12/14/16.
// Copyright © 2016 Lets Build That App. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let storyboard = UIStoryboard(name: "Main", bundle: .main)
let containerVC = storyboard.instantiateViewController(withIdentifier: "ContainerViewController")
window = UIWindow(frame: UIScreen.main.bounds)
window?.backgroundColor = UIColor.white
window?.rootViewController = containerVC
window?.rootViewController = containerVC
window?.makeKeyAndVisible()
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:.
}
}
| [
294924,
327722,
237613,
286774,
286776,
319544,
286778,
286791,
237640,
286797,
311375,
196692,
319573,
311383,
303212,
131192,
303230,
327814,
303241,
303244,
319633,
286876,
311469,
327862,
286906,
327866,
286910,
286924,
286926,
131281,
229622,
327930,
237826,
319751,
319757,
311569,
286999,
319770,
287003,
287006,
287012,
287014,
287016,
287019,
311598,
287023,
319809,
319810,
319814,
311623,
311628,
319822,
229717,
139638,
213367,
311683,
311693,
311719,
139689,
311728,
311741,
319938,
319945,
319947,
188895,
172512,
287202,
172520,
319978,
172526,
311791,
172529,
319989,
172534,
180727,
287230,
303617,
172550,
303623,
172552,
172558,
303632,
303637,
172572,
172577,
295459,
172581,
172591,
172598,
172607,
172609,
172612,
172614,
213575,
172618,
303690,
33357,
303696,
172634,
311911,
172655,
172656,
352880,
295538,
172660,
287349,
172675,
295557,
352905,
287377,
172691,
287381,
221850,
287386,
230045,
172702,
172705,
287394,
172707,
303780,
287398,
295595,
189102,
172721,
287409,
66227,
287419,
328381,
328384,
172737,
312006,
172748,
287436,
172751,
287440,
295633,
172755,
303827,
287450,
303835,
189149,
303838,
312035,
295654,
230128,
312048,
312050,
230146,
328453,
312077,
295695,
230169,
295707,
295710,
295720,
303914,
230202,
312124,
328508,
222018,
287569,
230237,
230241,
312163,
303976,
336744,
295806,
295808,
295813,
320391,
304013,
295822,
189329,
295825,
304019,
304027,
213931,
230327,
304055,
287675,
230334,
304063,
304065,
295873,
156612,
197580,
312272,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
312321,
295945,
230413,
320528,
140312,
295961,
304164,
304170,
238641,
238652,
238655,
238658,
336964,
320584,
238666,
296021,
402518,
336987,
230497,
296040,
361576,
205931,
205968,
296084,
238745,
304285,
238756,
238766,
230576,
238770,
304311,
230592,
312518,
230600,
230607,
148690,
320727,
304354,
296163,
320740,
320748,
304370,
320771,
312585,
296202,
230674,
320786,
230677,
320792,
230681,
230689,
320803,
173350,
312622,
296253,
296255,
312639,
230727,
238919,
296264,
320840,
296267,
296271,
312663,
222556,
337244,
312676,
230760,
148843,
230768,
312692,
230773,
304505,
304506,
312711,
296331,
288140,
288144,
304533,
304555,
173488,
288176,
312759,
288185,
222652,
312766,
173507,
230860,
312783,
239070,
296435,
288250,
296446,
321022,
402942,
296450,
312837,
230919,
230923,
304651,
304653,
222752,
296486,
157229,
230961,
157236,
288320,
288325,
124489,
288338,
239194,
312938,
116354,
321195,
296622,
321200,
337585,
296637,
313044,
313052,
288478,
313055,
321252,
288494,
321266,
288502,
288510,
124671,
198405,
313093,
198416,
313121,
313123,
304932,
321316,
321336,
296767,
288576,
345921,
304968,
173907,
313171,
313176,
296812,
313201,
305028,
239510,
124827,
214944,
313258,
124853,
214966,
296890,
288700,
296894,
190403,
296900,
337862,
165831,
296921,
239586,
124913,
165876,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
313371,
305191,
223273,
124978,
215090,
124980,
288824,
288826,
321595,
313406,
288831,
288836,
215123,
288859,
149599,
149601,
321634,
149603,
149618,
215154,
313464,
329850,
288895,
215175,
313498,
100520,
288947,
321717,
313548,
313557,
338147,
125171,
125187,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
289087,
305480,
305485,
305489,
354653,
313700,
313705,
280940,
190832,
313720,
313731,
199051,
240011,
289166,
240017,
240021,
297365,
297372,
297377,
289186,
240052,
289207,
289210,
305594,
281045,
166378,
305647,
174580,
240124,
305662,
305664,
240129,
305666,
305668,
223749,
223752,
150025,
338440,
322074,
150066,
289342,
338528,
199273,
19053,
158317,
313973,
297594,
158347,
314003,
117398,
289436,
174754,
330404,
174764,
314029,
314033,
240309,
314045,
314047,
314051,
297671,
158409,
289493,
289513,
289522,
289532,
322303,
322310,
322314,
322318,
322341,
215850,
289601,
240458,
240468,
322393,
207733,
207737,
158596,
183172,
240519,
314249,
183184,
289687,
289694,
289700,
289724,
289762,
183277,
322550,
322599,
322610,
314421,
314433,
314441,
322642,
314456,
314461,
248995,
306341,
306344,
306347,
322734,
306354,
289997,
363742,
330988,
216303,
257302,
363802,
199976,
199978,
298292,
298294,
216376,
380226,
224587,
216404,
306517,
150870,
314714,
314718,
314723,
150890,
306539,
314732,
314736,
314743,
306552,
290171,
314747,
298372,
314756,
224647,
314763,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
241068,
241070,
150966,
306618,
323015,
306635,
306640,
290263,
290270,
339431,
191985,
290291,
241142,
191992,
290298,
290302,
290305,
175621,
306694,
323084,
323090,
290325,
241175,
290332,
241181,
290344,
306731,
290349,
290356,
224849,
306778,
314979,
323176,
224875,
241260,
323181,
298651,
282269,
323229,
298655,
323231,
306856,
323266,
306904,
52959,
241380,
323318,
241412,
323345,
323349,
315167,
315169,
315174,
323367,
241448,
315176,
241450,
306991,
315184,
323376,
315190,
241464,
159545,
298811,
118593,
307009,
413506,
307012,
315211,
307027,
315223,
241496,
241498,
307035,
110433,
241509,
110438,
315249,
315253,
315255,
241544,
241546,
241548,
241556,
241560,
241563,
241565,
241567,
241569,
241574,
241581,
241583,
241586,
241588,
241590,
241592,
241598,
290751,
241605,
241610,
298975,
241632,
298984,
241643,
298988,
241646,
241649,
241652,
299003,
241661,
299006,
315396,
241669,
315397,
290835,
241693,
102438,
290877,
315466,
192596,
307290,
217179,
315482,
192605,
233567,
299105,
217188,
299109,
307303,
356457,
45163,
307307,
315502,
192624,
307314,
299126,
233591,
299136,
307338,
241813,
307352,
299164,
299167,
315552,
315557,
184486,
307370,
307372,
307374,
307376,
184503,
307388,
307390,
307394,
299204,
184518,
307399,
323784,
233679,
307409,
307411,
299225,
233701,
307432,
291104,
315701,
332086,
307518,
323917,
233808,
323921,
315733,
323926,
315739,
299357,
242024,
299373,
250231,
242043,
315771,
299391,
291202,
242057,
291212,
299405,
315801,
242075,
61855,
291231,
291241,
291247,
299440,
291260,
127424,
299457,
127434,
315856,
315860,
299481,
176605,
242143,
127460,
127463,
127474,
291314,
291317,
127480,
291323,
127485,
291330,
233994,
127500,
233998,
127506,
234006,
127511,
152087,
291361,
242220,
291378,
70213,
242250,
111193,
242275,
299620,
242279,
316051,
316054,
373404,
299684,
242343,
242345,
373421,
299720,
299723,
299726,
299740,
201444,
234219,
316151,
242431,
234258,
242452,
201496,
234264,
234266,
234272,
152355,
299814,
185138,
234296,
160572,
316233,
316235,
234319,
185173,
201557,
308063,
234336,
242530,
349027,
234344,
152435,
177011,
234356,
291714,
291716,
234373,
308123,
291748,
234405,
291750,
324520,
324522,
291756,
324527,
324531,
291773,
242623,
324544,
234434,
324546,
291788,
316370,
234464,
168935,
324585,
316400,
234481,
316403,
234485,
234487,
316416,
308231,
300054,
316439,
234520,
234526,
300066,
300069,
234540,
234546,
300085,
234553,
316479,
316483,
160835,
234563,
308291,
316491,
234572,
300108,
234574,
300115,
242777,
234593,
234597,
300133,
300139,
234610,
234620,
275594,
234640,
308373,
234647,
234650,
300189,
324766,
119967,
300197,
234667,
308414,
234687,
300226,
308418,
234692,
300229,
308420,
308422,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
300270,
300272,
300278,
275703,
316663,
300284,
275710,
292097,
300292,
234760,
177419,
300299,
242957,
300301,
349464,
300344,
243003,
300357,
316758,
357722,
316766,
292197,
316774,
243046,
218473,
136562,
316803,
316806,
316811,
316814,
300433,
234899,
300436,
357783,
316824,
316826,
300448,
144810,
144814,
144820,
374196,
292279,
144826,
144830,
144832,
284099,
144837,
144839,
144847,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
300527,
308720,
292338,
316917,
300537,
316933,
316947,
308757,
308762,
316959,
284194,
284199,
235047,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284223,
284226,
284228,
284231,
284234,
317004,
284238,
284241,
194130,
284243,
300628,
284245,
284247,
292452,
292454,
292458,
292461,
284272,
284274,
284278,
292470,
292473,
284283,
284286,
284290,
325250,
284292,
292485,
284297,
317066,
284299,
284301,
284306,
284308,
284312,
284320,
284327,
284329,
317098,
284331,
300726,
284343,
284346,
284350,
284354,
358083,
284358,
284362,
284365,
284368,
284370,
358098,
284372,
358114,
358119,
325353,
358122,
358126,
358128,
358133,
358138,
300795,
358142,
358146,
317189,
317191,
300819,
317207,
300830,
300832,
325408,
317221,
243504,
300850,
325436,
358206,
366406,
292681,
358224,
317279,
292715,
300912,
292721,
300915,
292729,
292734,
325512,
317332,
358292,
358312,
317353,
292784,
358326,
358330,
301011,
301013,
358360,
301017,
292828,
292839,
292843,
178161,
325624,
317435,
317446,
317456,
178195,
243733,
243740,
317472,
325666,
243751,
243762,
309298,
325685,
325689,
235579,
325692,
178238,
325700,
292934,
350293,
350295,
309337,
350304,
178273,
309346,
194660,
350308,
309350,
309348,
292968,
309352,
301167,
350321,
350325,
252022,
350328,
292985,
292989,
301185,
350339,
317573,
350342,
350345,
350349,
317584,
325777,
350357,
350362,
350366,
153765,
350375,
350379,
350381,
350383,
350385,
350387,
350389,
350395,
350397,
350399,
350402,
350406,
301258,
309455,
301272,
194780,
309468,
309471,
317672,
317674,
325867,
309494,
325910,
309530,
342298,
276766,
317729,
211241,
325937,
325943,
211260,
235853,
235858,
293227,
293232,
186744,
211324,
317833,
317853,
317858,
342434,
317864,
235955,
293304,
293314,
309707,
317910,
293336,
235996,
317917,
293343,
358880,
293364,
301562,
317951,
301575,
293387,
113167,
309779,
317971,
309781,
227882,
309804,
236082,
23094,
301636,
318020,
301643,
309844,
309849,
318055,
121458,
309885,
309888,
318092,
326285,
334476,
318108,
318110,
137889,
383658,
318128,
293555,
137946,
113378,
342760,
56043,
310015,
310029,
293659,
326430,
285474,
318248,
318253,
301876,
293685,
301884,
293706,
301911,
301921,
236397,
162671,
326514,
236408,
416639,
113538,
310147,
416648,
293798,
293802,
293817,
293820,
203715,
326603,
318442,
326638,
318450,
293876,
302073,
121850,
293882,
302075,
293899,
293908,
293917,
293939,
318516,
310336,
236609,
293956,
293960,
293971,
310355,
310359,
236632,
138332,
310376,
277608,
318573,
367737,
302205,
294026,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
302248,
294063,
318651,
318657,
244930,
130244,
302282,
310476,
302285,
302288,
310481,
302290,
302292,
302294,
310486,
302296,
310498,
302315,
294132,
138485,
204026,
64768,
285999,
318773,
318776,
286010,
417086,
302403,
294221,
294223,
326991,
294246,
310632,
327017,
351594,
310648,
351619,
294276,
318858,
130468,
310710,
302526,
302534,
310727,
302541,
302543,
310737,
310749,
310755,
310764,
310772,
40440,
212472,
40443,
40448,
286214,
302603,
302614,
302621,
286240,
187939,
40484,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
310831,
40499,
40502,
212538,
40507,
40511,
40513,
40521,
40525,
40527,
212560,
400976,
40533,
40537,
40539,
40541,
40544,
40548,
40550,
40552,
40554,
40557,
40560,
294521,
343679,
302740,
179870,
327333,
319153,
302781,
294601,
302793,
343757,
212690,
319187,
286425,
294625,
294634,
302838,
319226,
286460,
171774,
302852,
302854,
294664,
311048,
319243,
311053,
302862,
319251,
294682,
188199,
294701,
319290,
229192,
302925,
188247,
237409,
360317,
294785,
237470,
319390,
40865,
319394,
294821,
311209,
343983,
294844,
294847,
294876,
294879,
237555,
237562
] |
bbb936ea517af50acf55891343c5d73019e4ccab | 8b247bd2f25613888bee10c4a352a4b6e7a82157 | /NewTestDemo/NewTestDemo/AppDelegate.swift | 028f0cd76f72279cfd26a8d54f9515b386b2c21f | [
"MIT"
] | permissive | shitaldalavi/LeadFramework | 4fa57ca7d14972dfab12e296412874c6fcbf096e | db8cfa9ec5793c6f3c53dbc302ad79e814db6e51 | refs/heads/main | 2023-07-04T06:23:32.926348 | 2021-08-06T12:19:36 | 2021-08-06T12:19:36 | 392,945,838 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,458 | swift | //
// AppDelegate.swift
// NewTestDemo
//
// Created by admin on 05/08/21.
//
import UIKit
import LeadFramework
@available(iOS 13, *)
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
let data = DemoClass.PrintData()
print("Data is",data)
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,
376931,
368752,
417924,
262283,
377012,
327871,
180431,
377046,
418007,
418010,
327914,
205036,
393456,
393460,
418043,
336123,
385280,
262404,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
393538,
262472,
344403,
213332,
65880,
262496,
418144,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
262566,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328182,
328189,
328192,
164361,
410128,
393747,
254490,
188958,
385570,
33316,
197159,
377383,
352821,
418363,
188987,
369223,
385609,
385616,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
148105,
377484,
352918,
98968,
344744,
336555,
385713,
434867,
164534,
336567,
328378,
164538,
328386,
344776,
352968,
418507,
352971,
385742,
385748,
361179,
189153,
369381,
418553,
344835,
336643,
344841,
361230,
336659,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
328484,
418598,
418605,
361273,
328515,
336711,
328519,
361288,
328522,
336714,
426841,
197468,
254812,
361309,
361315,
361322,
377729,
369542,
361360,
222128,
345035,
345043,
386003,
386011,
386018,
386022,
435187,
328714,
361489,
386069,
386073,
336921,
336925,
345118,
377887,
345133,
345138,
386101,
361536,
197707,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
386258,
328924,
66782,
222437,
328941,
386285,
386291,
345376,
353570,
345379,
410917,
263462,
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,
271839,
329191,
361960,
116210,
337398,
329226,
419339,
419343,
419349,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
345701,
394853,
222830,
370297,
403075,
198280,
345736,
345749,
419483,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
419512,
337592,
419517,
419527,
419530,
419535,
272081,
394966,
419542,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
141051,
337659,
337668,
362247,
395021,
362255,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
370509,
354130,
247637,
337750,
370519,
354142,
354150,
354156,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
337833,
362413,
337844,
247759,
346063,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
338004,
329832,
329855,
329885,
411805,
346272,
362660,
100524,
387249,
379066,
387260,
256191,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
379134,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
395566,
248111,
362822,
436555,
190796,
379233,
354673,
420236,
379278,
354727,
338352,
338381,
330189,
338386,
338403,
338409,
248308,
199164,
330252,
199186,
330267,
354855,
10828,
199249,
174695,
191084,
191092,
346742,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
338660,
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,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
347176,
158761,
396328,
199728,
330800,
396339,
339001,
388154,
388161,
347205,
330826,
412764,
257120,
265320,
248951,
420984,
330889,
347287,
248985,
44197,
380070,
339112,
126144,
330958,
330965,
265432,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
347437,
372015,
347441,
372018,
199988,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
175460,
175463,
265580,
437620,
175477,
175483,
249214,
175486,
175489,
249218,
249227,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
208311,
388542,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
249308,
339420,
339424,
339428,
249328,
69113,
372228,
208398,
380432,
175635,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
372337,
224887,
224890,
224894,
372353,
216707,
421508,
126596,
224904,
224909,
159374,
11918,
224913,
126610,
224916,
224919,
126616,
208538,
224922,
224926,
224932,
224936,
224942,
257712,
224947,
257716,
257720,
224953,
257724,
224959,
257732,
224965,
224969,
224975,
257747,
224981,
224986,
224993,
257761,
257764,
224999,
339695,
225012,
257787,
225020,
257790,
225025,
257794,
257801,
339721,
257804,
225038,
257807,
225043,
167700,
372499,
225048,
257819,
225053,
225058,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
257871,
225103,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
339814,
225127,
257896,
274280,
257901,
225137,
339826,
257908,
225141,
257912,
257916,
225148,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
372664,
372702,
372706,
356335,
380918,
405533,
430129,
266294,
266297,
421960,
356439,
430180,
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,
217318,
225510,
225514,
225518,
372976,
381176,
389380,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
348502,
250199,
332125,
332152,
389502,
332161,
356740,
332172,
373145,
340379,
389550,
324030,
266687,
160234,
127471,
340472,
381436,
324094,
266754,
324099,
324102,
324111,
340500,
324117,
324131,
332324,
324139,
356907,
324142,
356916,
324149,
324155,
348733,
324164,
356934,
348743,
381512,
324170,
324173,
324176,
389723,
332380,
381545,
340627,
184982,
373398,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
357069,
332511,
332520,
340718,
332533,
348924,
373510,
152370,
348978,
340789,
348982,
127814,
357201,
357206,
389978,
357211,
430939,
357214,
201579,
201582,
349040,
340849,
381813,
430965,
324472,
398201,
119674,
324475,
340858,
340861,
324478,
430972,
373634,
398211,
324484,
324487,
381833,
324492,
324495,
430995,
324501,
324510,
422816,
324513,
398245,
201637,
324524,
340909,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
209895,
201711,
349172,
349180,
431106,
250914,
185380,
357418,
209979,
341071,
349267,
250967,
210010,
341091,
210025,
210030,
210036,
349308,
160895,
152703,
349311,
210052,
210055,
218247,
349319,
210067,
251044,
185511,
210107,
332997,
333009,
210131,
333014,
210143,
251128,
275712,
275715,
275721,
349459,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
210260,
365911,
259421,
365921,
333162,
234866,
390516,
333175,
357755,
251271,
112020,
349590,
357792,
415166,
415185,
366038,
415191,
415193,
415196,
415199,
423392,
415207,
366056,
366061,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
366172,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
333498,
210631,
333511,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
366348,
210706,
399128,
333594,
358191,
366387,
210739,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
415573,
341851,
350045,
399199,
259938,
399206,
358255,
399215,
268143,
358259,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
358371,
350189,
350193,
333818,
350202,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
334011,
260289,
260298,
350416,
350422,
350425,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
350467,
325891,
350475,
375053,
268559,
350480,
432405,
350486,
325914,
350490,
350493,
325917,
325919,
350498,
350504,
358700,
350509,
391468,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
383341,
334203,
268668,
194941,
391563,
366990,
416157,
342430,
326058,
375216,
334262,
326084,
358856,
195039,
334311,
375277,
350723,
186897,
342545,
334358,
342554,
334363,
350761,
383536,
334384,
358961,
334394,
252482,
219718,
334407,
334420,
350822,
375400,
334468,
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,
383793,
326451,
326454,
375612,
260924,
244540,
326460,
326467,
244551,
326473,
326477,
416597,
326485,
342874,
326490,
326502,
375656,
326507,
326510,
211825,
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,
261147,
359451,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
367723,
187502,
343154,
384114,
212094,
384135,
384139,
384143,
351381,
384160,
384168,
367794,
384181,
367800,
351423,
244937,
253130,
343244,
146642,
359649,
343270,
351466,
351479,
343306,
261389,
384269,
359694,
253200,
384275,
245029,
171302,
376110,
351534,
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,
368122,
409091,
359947,
359955,
359983,
155239,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
425649,
155322,
425662,
155327,
155351,
155354,
155363,
155371,
245483,
409335,
155393,
155403,
155422,
360223,
155438,
155442,
155447,
417595,
360261,
155461,
376663,
155482,
261981,
425822,
376671,
155487,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
425845,
147317,
262005,
262008,
262011,
155516,
155521,
155525,
360326,
376714,
262027,
155531,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
384977,
393169,
155611,
253923,
155619,
155621,
253926,
327654,
204784,
393203,
360438,
393206,
393212,
155646
] |
bb37ff49604d53f819e9ac22035e579723e4a6a4 | 4da9fdcaab2884edba52743f7b046d992974c62d | /Kalm/AppDelegate.swift | 80bf8b20306ab69af1e6951f4e198b9dc7f518af | [] | no_license | kennyzi/fantastic-Kalm | 574af82fcfa2852e4f9bdab36654275882953170 | 1f40225ab4e3561ef647388c1b153f8e746dae67 | refs/heads/master | 2020-04-02T12:53:36.665460 | 2018-11-14T13:30:08 | 2018-11-14T13:30:08 | 154,457,042 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,773 | swift | //
// AppDelegate.swift
// Kalm
//
// Created by Marvin Randy on 04/06/18.
// Copyright © 2018 Marvin Randy. All rights reserved.
//
import UIKit
import Intents
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var listStartSessionName = ["I feel stressed","I am stressed","Start my breath session","start breathing session","breath","session","start session"]
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
// Check first time launched
let launchedBefore = UserDefaults.standard.bool(forKey: "launchedBefore")
if !launchedBefore {
let mainStoryboard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let initialViewController : UIViewController = mainStoryboard.instantiateViewController(withIdentifier: "swipingVC") as UIViewController
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = initialViewController
self.window?.makeKeyAndVisible()
} else {
sleep(1)
let mainStoryboard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let initialViewController : UIViewController = mainStoryboard.instantiateViewController(withIdentifier: "mainVC") as UIViewController
let navigationController = UINavigationController(rootViewController: initialViewController)
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = navigationController
self.window?.makeKeyAndVisible()
}
return true
}
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
guard let intent = userActivity.interaction?.intent as? StartBreathingSessionIntent else {
print("AppDelegate: Start Workout Intent - FALSE")
return false
}
print(intent)
print("AppDelegate: Start Workout Intent - TRUE")
// guard let name = intent.name else {return false}
// for sessionName in listStartSessionName{
if intent != nil{
print("namanya bener")
var navigationController2 = window?.rootViewController as? UINavigationController
var workoutVC2 = navigationController2?.viewControllers
print(navigationController2)
print(workoutVC2)
// guard let navigationController = window?.rootViewController as? UINavigationController,
// let workoutVC = navigationController.viewControllers.last as? BreathingViewController else{
// print("salaahhh")
// return false
// }
// workoutVC2?.append(BreathingViewController())
// navigationController2?.performSegue(withIdentifier: "homeToBreathing", sender: nil)
// navigationController2?.present(BreathingViewController(), animated: true, completion: {
//
// })
let mainStoryboard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let initialViewController : UIViewController = mainStoryboard.instantiateViewController(withIdentifier: "breathing") as UIViewController
navigationController2?.present(initialViewController, animated: true, completion: {
})
print("ngebalikin halaman breath")
restorationHandler([workoutVC2])
return true
}else{
return false
}
// }
// return false
}
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:.
}
}
| [
-1
] |
a2313cce92eb73843fee2b2cd1a2a2fa19540e60 | 18f6555d115b63b68753621cda051909e2ac800e | /shanglvjia/shanglvjia/Classes/Train/View/CoTrainOrderTableViewCell.swift | 40270dd2d66d95a7eb10786789e311708756cdc8 | [] | no_license | manmanking/shanglvjia | b018c4e637c2730b5ac1b8f42073fa99d0bd694b | 2f259bee50470fefc8b6bda3ebc925e51b564b5a | refs/heads/master | 2020-03-31T09:08:32.288889 | 2019-04-22T23:15:29 | 2019-04-22T23:15:29 | 152,084,307 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 26,087 | swift | //
// CoTrainOrderTableViewCell.swift
// shop
//
// Created by TBI on 2017/12/29.
// Copyright © 2017年 TBI. All rights reserved.
//
import UIKit
import SwiftDate
/// 车次详情信息
class CoTrainOrderTableViewCell: UITableViewCell {
let bgView = UIView()
let type: UILabel = UILabel(text: "去", color: TBIThemeWhite, size: 11)
let startDate: UILabel = UILabel(text: "12月28日", color: TBIThemePrimaryTextColor, size: 12)
let price: UILabel = UILabel(text: "¥175", color: TBIThemeOrangeColor, size: 12)
let seat: UILabel = UILabel(text: "二等座", color: TBIThemePrimaryTextColor, size: 12)
let startTime: UILabel = UILabel(text: "06:05", color: TBIThemePrimaryTextColor, size: 24)
let endTime: UILabel = UILabel(text: "06:40", color: TBIThemePrimaryTextColor, size: 24)
let startCity: UILabel = UILabel(text: "北京", color: TBIThemePrimaryTextColor, size: 12)
let endCity: UILabel = UILabel(text: "天津", color: TBIThemePrimaryTextColor, size: 12)
let startImg:UIImageView = UIImageView(imageName:"ic_station_originating")
let endImg:UIImageView = UIImageView(imageName:"ic_station_terminal")
let line = UILabel(color: TBIThemePlaceholderTextColor)
let runTime: UILabel = UILabel(text: "0小时30分", color: TBIThemePrimaryTextColor, size: 12)
let isStop: UILabel = UILabel(text: "经停站", color: TBIThemePrimaryTextColor, size: 12)
let tripDayLabel: UILabel = UILabel(text: "", color: TBIThemeMinorTextColor, size: 10)
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
initView()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func initView () {
self.backgroundColor = TBIThemeMinorColor
self.addSubview(bgView)
bgView.layer.cornerRadius = 5
// bgView.layer.borderWidth = 1
// bgView.layer.borderColor = TBIThemeGrayLineColor.cgColor
bgView.backgroundColor = TBIThemeWhite
bgView.snp.makeConstraints { (make) in
make.left.right.equalToSuperview().inset(5)
make.top.equalTo(10)
make.height.equalTo(112)
}
type.backgroundColor = TBIThemeBlueColor
type.layer.cornerRadius = 4
type.clipsToBounds = true
type.textAlignment = .center
bgView.addSubview(type)
type.snp.makeConstraints { (make) in
make.width.height.equalTo(16)
make.top.left.equalToSuperview().inset(15)
}
bgView.addSubview(startDate)
startDate.snp.makeConstraints { (make) in
make.top.equalTo(16)
make.left.equalTo(type.snp.right).offset(15)
}
bgView.addSubview(price)
price.snp.makeConstraints { (make) in
make.right.equalTo(-15)
make.centerY.equalTo(startDate.snp.centerY)
}
bgView.addSubview(seat)
seat.snp.makeConstraints { (make) in
make.right.equalTo(price.snp.left).offset(-2)
make.centerY.equalTo(startDate.snp.centerY)
}
bgView.addSubview(startTime)
startTime.snp.makeConstraints { (make) in
make.top.equalTo(51)
make.left.equalTo(15)
}
bgView.addSubview(endTime)
endTime.snp.makeConstraints { (make) in
make.top.equalTo(51)
make.right.equalTo(-25)
}
// add by manman on 2018-04-18
// start of line 行程 天数
bgView.addSubview(tripDayLabel)
tripDayLabel.snp.makeConstraints { (make) in
make.centerY.equalTo(endTime.snp.top)
make.left.equalTo(endTime.snp.right)
make.height.equalTo(13)
make.width.equalTo(30)
}
// end of line
bgView.addSubview(startCity)
startCity.snp.makeConstraints { (make) in
make.left.equalTo(15)
make.top.equalTo(startTime.snp.bottom).offset(6)
}
bgView.addSubview(endCity)
endCity.snp.makeConstraints { (make) in
make.right.equalTo(-25)
make.top.equalTo(endTime.snp.bottom).offset(6)
}
bgView.addSubview(line)
line.snp.makeConstraints { (make) in
make.top.equalTo(76)
make.height.equalTo(1)
make.width.equalTo(52)
make.centerX.equalToSuperview()
}
bgView.addSubview(startImg)
startImg.snp.makeConstraints { (make) in
make.centerY.equalTo(line.snp.centerY)
make.right.equalTo(line.snp.left).offset(-2)
make.height.width.equalTo(12)
}
bgView.addSubview(endImg)
endImg.snp.makeConstraints { (make) in
make.centerY.equalTo(line.snp.centerY)
make.left.equalTo(line.snp.right).offset(2)
make.height.width.equalTo(12)
}
bgView.addSubview(runTime)
runTime.snp.makeConstraints { (make) in
make.top.equalTo(line.snp.bottom).offset(4)
make.centerX.equalTo(line.snp.centerX)
}
bgView.addSubview(isStop)
isStop.snp.makeConstraints { (make) in
make.bottom.equalTo(line.snp.top).offset(-4)
make.centerX.equalTo(line.snp.centerX)
}
}
func fillDataSources(model:(price:Double,type:Int,seat:SeatTrain,model:QueryTrainResponse.TrainAvailInfo)) {
seat.text = model.seat.rawValue
startTime.text = model.model.startTime
endTime.text = model.model.arriveTime
startCity.text = model.model.fromStationName
endCity.text = model.model.toStationName
let time = model.model.runTime.components(separatedBy: ":")
let hour = Int(time[0]) ?? 0
let minutes = Int(time[1]) ?? 0
runTime.text = hour == 0 ? "\(minutes)分" : "\(hour)时\(minutes)分"
isStop.text = model.model.trainCode
let tripDay:NSInteger = NSInteger(model.model.arriveDay) ?? 0
if tripDay == 0 {
tripDayLabel.isHidden = true
}else
{
tripDayLabel.isHidden = false
tripDayLabel.text = "+" + model.model.arriveDay + "天"
}
if model.price.truncatingRemainder(dividingBy: 1) == 0 {
price.text = "¥\(Int(model.price))"
}else {
price.text = "¥\(model.price)"
}
if model.model.isStart == "1" {
startImg.image = UIImage.init(named: "ic_station_originating")
}else {
startImg.image = UIImage.init(named: "ic_station_intermediate")
}
if model.model.isEnd == "1" {
endImg.image = UIImage.init(named: "ic_station_terminal")
}else {
endImg.image = UIImage.init(named: "ic_station_intermediate")
}
let formatter = DateFormatter()
formatter.timeZone = NSTimeZone.init(forSecondsFromGMT: 0) as TimeZone?
formatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
if model.type == 0 {
type.isHidden = true
startDate.snp.remakeConstraints { (make) in
make.top.equalTo(16)
make.left.equalTo(15)
make.left.equalTo(type.snp.right).offset(15)
}
bgView.snp.updateConstraints { (make) in
make.top.equalTo(10)
}
let date:Date = formatter.date(from: TrainManager.shareInstance.trainSearchConditionDraw().departureDateFormat)!
startDate.text = date.string(custom: "MM月dd日")
}
if model.type == 1 {
type.isHidden = false
type.text = "去"
startDate.snp.remakeConstraints { (make) in
make.top.equalTo(16)
make.left.equalTo(type.snp.right).offset(15)
}
bgView.snp.updateConstraints { (make) in
make.top.equalTo(10)
}
let date:Date = formatter.date(from: TrainManager.shareInstance.trainSearchConditionDraw().departureDateFormat)!
startDate.text = date.string(custom: "MM月dd日")
}
if model.type == 2 {
type.isHidden = false
type.text = "返"
startDate.snp.remakeConstraints { (make) in
make.top.equalTo(16)
make.left.equalTo(type.snp.right).offset(15)
}
bgView.snp.updateConstraints { (make) in
make.top.equalTo(5)
}
let date:Date = formatter.date(from: TrainManager.shareInstance.trainSearchConditionDraw().returnDateFormat)!
startDate.text = date.string(custom: "MM月dd日")
}
}
}
/// 乘车人headerCell
class CoTrainOrderPassengerHeaderTableViewCell: UITableViewCell {
let passengerLabel: UILabel = UILabel(text: "", color: TBIThemePrimaryTextColor, size: 12)
let line = UILabel(color: TBIThemeGrayLineColor)
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
initView()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func initView() {
self.addSubview(passengerLabel)
passengerLabel.snp.makeConstraints { (make) in
make.left.equalTo(23)
make.centerY.equalToSuperview()
}
self.addSubview(line)
line.snp.makeConstraints { (make) in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(0.5)
}
}
func fillCell(count:Int) {
let passengerCount = NSMutableAttributedString()
if count > 1
{
let textOne = NSAttributedString.init(string: "乘车人 (共", attributes: [NSForegroundColorAttributeName : TBIThemePrimaryTextColor, NSFontAttributeName : UIFont.systemFont(ofSize: 13)])
passengerCount.append(textOne)
let textTwo = NSAttributedString.init(string: "\(count)", attributes: [NSForegroundColorAttributeName : TBIThemeOrangeColor, NSFontAttributeName : UIFont.systemFont(ofSize: 13)])
passengerCount.append(textTwo)
let textThree = NSAttributedString.init(string: "人)", attributes: [NSForegroundColorAttributeName : TBIThemePrimaryTextColor, NSFontAttributeName : UIFont.systemFont(ofSize: 13)])
passengerCount.append(textThree)
}else{
passengerCount.append(NSAttributedString.init(string:"乘车人"))
}
passengerLabel.attributedText = passengerCount
}
}
/// 乘车人cell
class CoTrainOrderPassengerTableViewCell: UITableViewCell {
// 是否选中
var flag:Bool = false
let bgView = UIView()
let deleteBgView = UIView()
let deleteImg:UIImageView = UIImageView(imageName:"HotelDeleteHollow")
let nameLabel: UILabel = UILabel(text: "", color: TBIThemePrimaryTextColor, size: 13)
let cardTypeLabel: UILabel = UILabel(text: "", color: TBIThemePrimaryTextColor, size: 13)
let cardNoLabel: UILabel = UILabel(text: "", color: TBIThemePrimaryTextColor, size: 13)
let line = UILabel(color: TBIThemeGrayLineColor)
let rightImg:UIImageView = UIImageView(imageName:"ic_right_gray")
let deleteButton:UIButton = UIButton(title: "删除",titleColor: TBIThemeWhite,titleSize: 20)
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
initView()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func initView() {
self.contentView.addSubview(bgView)
bgView.snp.makeConstraints { (make) in
make.top.bottom.equalToSuperview()
make.left.equalTo(50)
make.width.equalToSuperview()
}
bgView.addSubview(rightImg)
rightImg.snp.makeConstraints { (make) in
make.right.equalTo(-65)
make.centerY.equalToSuperview()
}
bgView.addSubview(nameLabel)
nameLabel.snp.makeConstraints { (make) in
make.left.equalToSuperview()
make.centerY.equalToSuperview()
}
bgView.addSubview(cardTypeLabel)
cardTypeLabel.snp.makeConstraints { (make) in
make.left.equalTo(50)
make.centerY.equalToSuperview()
}
bgView.addSubview(cardNoLabel)
cardNoLabel.snp.makeConstraints { (make) in
make.left.equalTo(cardTypeLabel.snp.right).offset(10)
make.centerY.equalToSuperview()
}
deleteButton.backgroundColor = UIColor.red
bgView.addSubview(deleteButton)
deleteButton.snp.makeConstraints { (make) in
make.right.top.bottom.equalToSuperview()
make.width.equalTo(50)
}
deleteBgView.backgroundColor = TBIThemeWhite
self.contentView.addSubview(deleteBgView)
deleteBgView.snp.makeConstraints { (make) in
make.top.left.bottom.equalToSuperview()
make.width.equalTo(50)
}
deleteBgView.addSubview(deleteImg)
deleteImg.snp.makeConstraints { (make) in
make.left.equalTo(23)
make.width.height.equalTo(16)
make.centerY.equalToSuperview()
}
self.contentView.addSubview(line)
line.snp.makeConstraints { (make) in
make.left.equalTo(23)
make.right.top.equalToSuperview()
make.height.equalTo(0.5)
}
}
func carFillCell(model:CoCarForm.CarPassenger,row:Int,count:Int,updateFlag:[String]) {
flag = false
if 1 == row {
line.isHidden = true
}else {
line.isHidden = false
}
if count == 1 {
deleteImg.image = UIImage.init(named: "ic_delete_grey")
}else {
deleteImg.image = UIImage.init(named: "HotelDeleteHollow")
}
nameLabel.text = model.name
cardTypeLabel.text = model.phone.value
// cardNoLabel.text = model.passportNo.value
if updateFlag.contains(model.parId) {
rightImg.isHidden = false
}else {
rightImg.isHidden = true
}
}
func fillCell (model:CoTrainCommitForm.SubmitTrainInfo.PassengerInfo,row:Int,count:Int,updateFlag:[String]) {
flag = false
if 1 == row {
line.isHidden = true
}else {
line.isHidden = false
}
if count == 1 {
deleteImg.image = UIImage.init(named: "ic_delete_grey")
}else {
deleteImg.image = UIImage.init(named: "HotelDeleteHollow")
}
nameLabel.text = model.passengerName
cardTypeLabel.text = model.passportTypeseId == "1" ? "身份证":"护照"
cardNoLabel.text = model.passportNo.value
if updateFlag.contains(model.parId) {
rightImg.isHidden = false
}else {
rightImg.isHidden = true
}
}
func fillCells(model:Traveller,row:Int) {
if 1 == row {
line.isHidden = true
}else {
line.isHidden = false
}
nameLabel.text = model.name
if !model.certificates.isEmpty {
rightImg.isHidden = true
let data = model.certificates.filter{$0.type == 1}
if !data.isEmpty {
cardTypeLabel.text = data.first?.name
cardNoLabel.text = data.first?.number
}else {
cardTypeLabel.text = model.certificates.first?.name
cardNoLabel.text = model.certificates.first?.number
}
}else {
rightImg.isHidden = false
}
}
}
/// 乘车人headerCell
class CoTrainOrderContactPersonTableViewCell: UITableViewCell {
let titleLabel: UILabel = UILabel(text: "联系人", color: TBIThemePrimaryTextColor, size: 13)
let nameLabel: UILabel = UILabel(text: "刘博博", color: TBIThemePrimaryTextColor, size: 13)
let rightImg:UIImageView = UIImageView(imageName:"ic_right_gray")
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
initView()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func initView() {
self.contentView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { (make) in
make.left.equalTo(23)
make.centerY.equalToSuperview()
}
self.contentView.addSubview(nameLabel)
nameLabel.snp.makeConstraints { (make) in
make.left.equalTo(100)
make.centerY.equalToSuperview()
}
self.contentView.addSubview(rightImg)
rightImg.snp.makeConstraints { (make) in
make.right.equalTo(-23)
make.centerY.equalToSuperview()
}
}
func fillCell(name:String?) {
titleLabel.text = "联系人"
nameLabel.text = name
}
func carFillCell(name:String?) {
titleLabel.text = "报销人"
nameLabel.text = name
}
}
class CoTrainOrderFooterView: UIView {
let priceCountLabel = UILabel(text: "", color: TBIThemePrimaryWarningColor, size: 20)
let priceButton = UIButton()
lazy var leftView:UIView = {
let vi = UIView()
vi.backgroundColor = TBIThemeWhite
let line = UILabel(color: TBIThemeGrayLineColor)
let titleLabel = UILabel(text: "总价", color: TBIThemePrimaryTextColor, size: 13)
let yLabel = UILabel(text: "¥", color: TBIThemePrimaryWarningColor, size: 13)
vi.addSubview(line)
vi.addSubview(titleLabel)
vi.addSubview(self.priceCountLabel)
vi.addSubview(yLabel)
line.snp.makeConstraints { (make) in
make.top.equalToSuperview()
make.left.right.equalTo(0)
make.height.equalTo(0.5)
}
titleLabel.snp.makeConstraints { (make) in
make.left.equalTo(15)
make.centerY.equalToSuperview()
}
self.priceCountLabel.snp.makeConstraints { (make) in
make.right.equalTo(-44)
make.centerY.equalToSuperview()
}
yLabel.snp.makeConstraints { (make) in
make.bottom.equalTo(self.priceCountLabel.snp.bottom).offset(-3)
make.right.equalTo(self.priceCountLabel.snp.left)
}
return vi
}()
let submitButton:UIButton = UIButton(title: "立即预订",titleColor: TBIThemeWhite,titleSize: 20)
override init(frame: CGRect) {
super.init(frame: frame)
initView()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func initView(){
priceCountLabel.font = UIFont.boldSystemFont(ofSize: 20)
submitButton.titleLabel?.font = UIFont.boldSystemFont(ofSize: 20)
addSubview(leftView)
addSubview(submitButton)
addSubview(priceButton)
priceButton.setImage(UIImage(named: "ic_up_gray"), for: UIControlState.normal)
priceButton.setImage(UIImage(named: "ic_down_gray"), for: UIControlState.selected)
submitButton.backgroundColor = TBIThemeDarkBlueColor
priceButton.setEnlargeEdgeWithTop(20 ,left: 400, bottom: 20, right: 0)
leftView.snp.makeConstraints { (make) in
make.left.equalToSuperview()
make.height.equalToSuperview()
make.bottom.equalToSuperview()
make.width.equalToSuperview().dividedBy(2)
}
submitButton.snp.makeConstraints { (make) in
make.right.equalToSuperview()
make.height.equalToSuperview()
make.bottom.equalToSuperview()
make.width.equalToSuperview().dividedBy(2)
}
priceButton.snp.makeConstraints { (make) in
make.right.equalTo(submitButton.snp.left).offset(-15)
make.centerY.equalToSuperview()
}
}
}
class CoTrainPriceInfoView: UIView {
let priceTitleLabel = UILabel(text: "费用明细", color: TBIThemePrimaryTextColor, size: 16)
let priceLine = UILabel(color: TBIThemeGrayLineColor)
let line = UILabel(color: TBIThemeGrayLineColor)
override init(frame: CGRect) {
super.init(frame: frame)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func initView(personCount:Int,formPrice:Double,toPrice:Double){
self.backgroundColor = TBIThemeWhite
addSubview(priceTitleLabel)
addSubview(priceLine)
priceTitleLabel.snp.makeConstraints { (make) in
make.centerX.equalToSuperview()
make.centerY.equalTo(22)
}
priceLine.snp.makeConstraints { (make) in
make.left.equalTo(15)
make.right.equalTo(-15)
make.height.equalTo(0.5)
make.top.equalTo(44)
}
if TrainManager.shareInstance.trainSearchConditionDraw().type == 2 { //往返
let takeOffTitleLabel = UILabel(text: "去程票价", color: TBIThemePrimaryTextColor, size: 13)
let takeOffPersonLabel = UILabel(text: "X\(personCount)人", color: TBIThemeMinorTextColor, size: 13)
let formPrice = formPrice * Double(personCount)
var takeOffPriceLabel:UILabel
if formPrice.truncatingRemainder(dividingBy: 1) == 0 {
takeOffPriceLabel = UILabel(text: "¥\(Int(formPrice))", color: TBIThemeOrangeColor, size: 13)
}else {
takeOffPriceLabel = UILabel(text: "¥\(formPrice)", color: TBIThemeOrangeColor, size: 13)
}
let arriveTitleLabel = UILabel(text: "返程票价", color: TBIThemePrimaryTextColor, size: 13)
let toPrice = toPrice * Double(personCount)
var arrivePriceLabel:UILabel
let arrivePersonLabel = UILabel(text: "X\(personCount)人", color: TBIThemeMinorTextColor, size: 13)
if toPrice.truncatingRemainder(dividingBy: 1) == 0 {
arrivePriceLabel = UILabel(text: "¥\(Int(toPrice))", color: TBIThemeOrangeColor, size: 13)
}else {
arrivePriceLabel = UILabel(text: "¥\(toPrice)", color: TBIThemeOrangeColor, size: 13)
}
addSubview(takeOffTitleLabel)
takeOffTitleLabel.snp.makeConstraints({ (make) in
make.left.equalTo(15)
make.top.equalTo(priceLine.snp.bottom).offset(15)
})
addSubview(takeOffPersonLabel)
takeOffPersonLabel.snp.makeConstraints({ (make) in
make.centerX.equalToSuperview()
make.top.equalTo(takeOffTitleLabel.snp.top)
})
addSubview(takeOffPriceLabel)
takeOffPriceLabel.snp.makeConstraints({ (make) in
make.right.equalTo(-15)
make.top.equalTo(takeOffTitleLabel.snp.top)
})
addSubview(arriveTitleLabel)
arriveTitleLabel.snp.makeConstraints({ (make) in
make.left.equalTo(15)
make.top.equalTo(takeOffTitleLabel.snp.bottom).offset(10)
})
addSubview(arrivePersonLabel)
arrivePersonLabel.snp.makeConstraints({ (make) in
make.centerX.equalToSuperview()
make.top.equalTo(arriveTitleLabel.snp.top)
})
addSubview(arrivePriceLabel)
arrivePriceLabel.snp.makeConstraints({ (make) in
make.right.equalTo(-15)
make.top.equalTo(arriveTitleLabel.snp.top)
})
}else { //单程
let takeOffTitleLabel = UILabel(text: "票价", color: TBIThemePrimaryTextColor, size: 13)
let takeOffPersonLabel = UILabel(text: "X\(personCount)人", color: TBIThemeMinorTextColor, size: 13)
// let takeOffPriceLabel = UILabel(text: "¥\(formPrice * Double(personCount))", color: TBIThemeOrangeColor, size: 13)
let formPrice = formPrice * Double(personCount)
var takeOffPriceLabel:UILabel
if formPrice.truncatingRemainder(dividingBy: 1) == 0 {
takeOffPriceLabel = UILabel(text: "¥\(Int(formPrice))", color: TBIThemeOrangeColor, size: 13)
}else {
takeOffPriceLabel = UILabel(text: "¥\(formPrice)", color: TBIThemeOrangeColor, size: 13)
}
addSubview(takeOffTitleLabel)
takeOffTitleLabel.snp.makeConstraints({ (make) in
make.left.equalTo(15)
make.top.equalTo(priceLine.snp.bottom).offset(15)
make.height.equalTo(13)
})
addSubview(takeOffPersonLabel)
takeOffPersonLabel.snp.makeConstraints({ (make) in
make.centerX.equalToSuperview()
make.top.equalTo(takeOffTitleLabel.snp.top)
make.height.equalTo(13)
})
addSubview(takeOffPriceLabel)
takeOffPriceLabel.snp.makeConstraints({ (make) in
make.right.equalTo(-15)
make.top.equalTo(takeOffTitleLabel.snp.top)
make.height.equalTo(13)
})
}
}
}
| [
-1
] |
f5fdd831f84ac324136ff01351fd01e51d2dbb8f | 188578c0d26c30973ef36c6b0b834e9d36a3301a | /SwiftyStoreKit/CompleteTransactionsController.swift | 70c9345b392e32ef7651035c2ac46e530153303a | [
"MIT"
] | permissive | moshiwu/SwiftyStoreKit | e07849de0cbf7edf726aebc6fe89b40242f7df0d | 3ab82861ad689111d62250901943fe2d8d617dc5 | refs/heads/master | 2023-08-07T13:45:19.597872 | 2019-05-17T09:52:21 | 2019-05-17T09:52:21 | 187,190,913 | 0 | 0 | null | 2019-05-17T09:47:41 | 2019-05-17T09:47:41 | null | UTF-8 | Swift | false | false | 3,155 | swift | //
// CompleteTransactionsController.swift
// SwiftyStoreKit
//
// Copyright (c) 2017 Andrea Bizzotto ([email protected])
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
import Foundation
import StoreKit
struct CompleteTransactions {
let atomically: Bool
let callback: ([Purchase]) -> Void
init(atomically: Bool, callback: @escaping ([Purchase]) -> Void) {
self.atomically = atomically
self.callback = callback
}
}
class CompleteTransactionsController: TransactionController {
var completeTransactions: CompleteTransactions?
func processTransactions(_ transactions: [SKPaymentTransaction], on paymentQueue: PaymentQueue) -> [SKPaymentTransaction] {
guard let completeTransactions = completeTransactions else {
print("SwiftyStoreKit.completeTransactions() should be called once when the app launches.")
return transactions
}
var unhandledTransactions: [SKPaymentTransaction] = []
var purchases: [Purchase] = []
for transaction in transactions {
let transactionState = transaction.transactionState
if transactionState != .purchasing {
let willFinishTransaction = completeTransactions.atomically || transactionState == .failed
let purchase = Purchase(productId: transaction.payment.productIdentifier, quantity: transaction.payment.quantity, transaction: transaction, originalTransaction: transaction.original, needsFinishTransaction: !willFinishTransaction, payment: transaction.payment)
purchases.append(purchase)
if willFinishTransaction {
print("Finishing transaction for payment \"\(transaction.payment.productIdentifier)\" with state: \(transactionState.debugDescription)")
paymentQueue.finishTransaction(transaction)
}
} else {
unhandledTransactions.append(transaction)
}
}
if purchases.count > 0 {
completeTransactions.callback(purchases)
}
return unhandledTransactions
}
}
| [
181552,
158246
] |
5df5838447f0c04af9ecff70028da7cd8b9f8968 | f43fdf358a6fb003fedea78b8ce16596c3e4dc70 | /0034/FindFirstAndLastPositionOfElementInSortedArray.swift | 24b140ba0da164110ba97d469612dfd135debd62 | [
"MIT"
] | permissive | kkpan11/LeetCode | 4c4c8dc00851ebf03e77443fc7ea701bdad1fc02 | 080b1133df082afce1bfdb74d1dd8e55a4468153 | refs/heads/master | 2022-10-26T10:15:25.724807 | 2022-10-14T11:52:00 | 2022-10-14T11:52:00 | 140,527,926 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,184 | swift | class Solution {
func searchRange(_ nums: [Int], _ target: Int) -> [Int] {
var first = -1, last = -1
var left = 0
var right = nums.count - 1
while left <= right {
var middle = left + (right - left) / 2
if target == nums[middle] {
first = middle
right = middle - 1
} else if target > nums[middle] {
// target is on the right side
left = middle + 1
} else if target < nums[middle] {
// target is on the left side
right = middle - 1
}
}
left = 0
right = nums.count - 1
while left <= right {
var middle = left + (right - left) / 2
if target == nums[middle] {
last = middle
left = middle + 1
} else if target > nums[middle] {
// target is on the right side
left = middle + 1
} else if target < nums[middle] {
// target is on the left side
right = middle - 1
}
}
return [first, last]
}
}
| [
-1
] |
89f3db63e1c1e1d74350899fbacf3eebe4a06454 | ae7fcb14a42338d9a556bf526a6b655a6e36f607 | /Source/Definitions/AccountInfo.swift | c6fc531e1d201528b86b0cd6374a6bed4ffab5bd | [
"MIT"
] | permissive | PacoVu/ringcentral-swift | 07ecab52ea86e8e74180b393ead52fd447fbc50e | 2b3658d5446eb9542abcc15eb530d9d8648a0a55 | refs/heads/master | 2021-01-01T18:26:24.448435 | 2018-07-11T21:51:13 | 2018-07-11T21:51:13 | 98,340,830 | 0 | 0 | null | 2017-07-25T19:07:20 | 2017-07-25T19:07:20 | null | UTF-8 | Swift | false | false | 2,240 | swift | import Foundation
import ObjectMapper
open class AccountInfo: Mappable {
/*
Internal identifier of an account
*/
open var `id`: String?
/*
Canonical URI of an account
*/
open var `uri`: String?
/*
Main phone number of the current account
*/
open var `mainNumber`: String?
/*
Operator's extension information. This extension will receive all calls and messages intended for the operator
*/
open var `operator`: ExtensionInfo?
/*
Additional account identifier, developed and applied by the client
*/
open var `partnerId`: String?
/*
Account service information, including brand, service plan and billing plan
*/
open var `serviceInfo`: Account_ServiceInfo?
/*
Specifies account configuration wizard state (web service setup). The default value is 'NotStarted'
*/
open var `setupWizardState`: String?
/*
Status of the current account
*/
open var `status`: String?
/*
Status information (reason, comment, lifetime). Returned for 'Disabled' status only
*/
open var `statusInfo`: StatusInfo?
public init() {
}
required public init?(map: Map) {
}
convenience public init(id: String? = nil, uri: String? = nil, mainNumber: String? = nil, operator: ExtensionInfo? = nil, partnerId: String? = nil, serviceInfo: Account_ServiceInfo? = nil, setupWizardState: String? = nil, status: String? = nil, statusInfo: StatusInfo? = nil) {
self.init()
self.id = `id`
self.uri = `uri`
self.mainNumber = `mainNumber`
self.operator = `operator`
self.partnerId = `partnerId`
self.serviceInfo = `serviceInfo`
self.setupWizardState = `setupWizardState`
self.status = `status`
self.statusInfo = `statusInfo`
}
open func mapping(map: Map) {
`id` <- (map["id"], StringTransform())
`uri` <- map["uri"]
`mainNumber` <- map["mainNumber"]
`operator` <- map["operator"]
`partnerId` <- map["partnerId"]
`serviceInfo` <- map["serviceInfo"]
`setupWizardState` <- map["setupWizardState"]
`status` <- map["status"]
`statusInfo` <- map["statusInfo"]
}
}
| [
-1
] |
863dbee7e44e722ff88bac73d7ac68f3b27eabcb | d235302f630ff5debd63ef9a6ba8418f3eb6b04e | /KeyboardNotifierTests/KeyboardNotifierTests.swift | 266686ea7f9a135515e61eeff2efa7a3f1b47af1 | [
"MIT",
"Apache-2.0"
] | permissive | levantAJ/KeyboardNotifier | 47f40f5989c6070ada0e28d31e280f62b380dd63 | a4dd37292f96f7241f20eac4a4012618d0515d65 | refs/heads/master | 2023-01-02T17:50:03.995476 | 2020-10-18T04:31:25 | 2020-10-18T04:31:25 | 190,864,942 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 931 | swift | //
// KeyboardNotifierTests.swift
// KeyboardNotifierTests
//
// Created by levantAJ on 6/8/19.
// Copyright © 2019 levantAJ. All rights reserved.
//
import XCTest
@testable import KeyboardNotifier
class KeyboardNotifierTests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
360462,
98333,
16419,
229413,
204840,
278570,
344107,
155694,
253999,
229424,
319542,
229430,
163896,
180280,
376894,
352326,
254027,
311372,
196691,
278615,
180311,
180312,
385116,
237663,
254048,
319591,
221290,
278634,
319598,
352368,
204916,
131191,
237689,
278655,
278677,
196760,
426138,
278685,
311458,
278691,
49316,
32941,
278704,
377009,
278708,
131256,
295098,
139479,
254170,
229597,
311519,
205035,
286958,
327929,
344313,
147717,
368905,
180493,
254226,
319763,
368916,
262421,
377114,
237856,
237857,
278816,
311597,
98610,
180535,
336183,
278842,
287041,
319821,
254286,
344401,
377169,
368981,
155990,
368984,
106847,
98657,
270701,
246127,
270706,
139640,
246136,
246137,
311685,
106888,
385417,
311691,
385422,
213403,
246178,
385454,
311727,
377264,
311738,
33211,
278970,
319930,
336317,
336320,
311745,
278978,
254406,
188871,
278993,
278999,
328152,
369116,
287198,
279008,
279013,
279018,
319981,
279029,
254456,
279032,
377338,
377343,
279039,
254465,
287241,
279050,
139792,
303636,
393751,
279065,
377376,
377386,
197167,
385588,
352829,
115270,
385615,
426576,
369235,
295519,
139872,
66150,
344680,
279146,
287346,
139892,
287352,
344696,
279164,
189057,
311941,
336518,
311945,
369289,
344715,
279177,
311949,
287374,
377489,
311954,
352917,
230040,
271000,
377497,
303771,
377500,
295576,
221852,
205471,
344738,
139939,
279206,
295590,
287404,
205487,
295599,
303793,
336564,
164533,
287417,
287422,
66242,
377539,
164560,
385747,
279252,
361176,
418520,
287452,
295652,
369385,
312052,
312053,
172792,
344827,
221948,
205568,
295682,
197386,
434957,
312079,
295697,
426774,
197399,
426775,
336671,
344865,
197411,
279336,
295724,
353069,
197422,
353070,
164656,
295729,
312108,
328499,
353078,
197431,
230199,
353079,
336702,
353094,
353095,
353109,
377686,
230234,
189275,
435039,
295776,
303972,
385893,
230248,
246641,
246643,
295798,
246648,
361337,
279417,
254850,
369538,
287622,
58253,
295824,
189348,
353195,
140204,
377772,
353197,
304051,
230332,
377790,
353215,
353216,
189374,
213957,
213960,
345033,
279498,
386006,
418776,
50143,
123881,
304110,
320494,
271350,
295927,
304122,
320507,
328700,
328706,
410627,
320516,
295942,
386056,
353290,
230410,
377869,
320527,
238610,
418837,
140310,
320536,
197657,
336929,
189474,
369701,
345132,
238639,
312373,
238651,
214086,
377926,
238664,
353367,
156764,
156765,
304222,
173166,
377972,
353397,
377983,
402565,
279685,
222343,
386189,
296086,
238743,
296092,
238765,
279728,
238769,
402613,
337077,
353479,
353480,
353481,
402634,
353482,
189653,
419029,
279765,
148696,
296153,
279774,
304351,
304356,
222440,
328940,
279792,
353523,
353524,
386294,
386301,
320770,
386306,
279814,
328971,
312587,
353551,
320796,
222494,
353584,
345396,
386359,
116026,
378172,
222524,
279875,
345415,
312648,
337225,
304456,
230729,
238927,
353616,
296273,
222559,
378209,
230756,
386412,
230765,
296303,
279920,
312689,
296307,
116084,
337281,
148867,
378244,
296329,
304524,
296335,
9619,
370071,
279974,
173491,
304564,
353719,
361927,
296392,
370123,
148940,
280013,
312782,
222675,
329173,
353750,
271843,
280041,
361963,
296433,
321009,
280055,
288249,
329225,
230921,
296461,
304656,
329232,
370197,
230943,
402985,
394794,
230959,
312880,
288309,
312889,
288318,
280130,
124485,
288326,
288327,
280147,
239198,
99938,
345700,
312940,
222832,
247416,
337534,
337535,
263809,
312965,
288392,
239250,
419478,
345752,
255649,
206504,
321199,
337591,
321207,
296632,
280251,
280257,
321219,
280267,
403148,
9936,
313041,
9937,
370388,
272085,
345814,
280278,
280280,
18138,
345821,
321247,
321249,
345833,
345834,
280300,
67315,
173814,
313081,
124669,
288512,
288516,
280329,
321302,
345879,
116505,
321310,
255776,
247590,
362283,
378668,
296755,
321337,
345919,
436031,
403267,
345929,
18262,
362327,
370522,
280410,
345951,
362337,
345955,
296806,
288619,
280430,
313199,
214895,
362352,
296814,
313203,
124798,
182144,
305026,
67463,
329622,
337815,
124824,
214937,
436131,
354212,
313254,
436137,
362417,
124852,
288697,
362431,
214977,
214984,
362443,
247757,
231375,
280541,
329695,
436191,
313319,
337895,
247785,
436205,
329712,
362480,
313339,
43014,
354316,
313357,
182296,
354345,
223274,
124975,
346162,
124984,
288828,
436285,
288833,
288834,
436292,
403525,
313416,
436301,
338001,
354385,
338003,
280661,
329814,
338007,
354393,
280675,
321637,
329829,
280677,
43110,
436329,
313447,
288879,
280694,
288889,
215164,
313469,
215166,
280712,
215178,
346271,
436383,
362659,
239793,
125109,
182456,
280762,
379071,
149703,
338119,
346314,
321745,
387296,
280802,
379106,
338150,
346346,
321772,
125169,
338164,
436470,
125183,
149760,
411906,
125188,
313608,
321800,
125193,
125198,
272658,
125203,
338197,
125208,
305440,
125217,
338218,
321840,
379186,
125235,
280887,
125240,
321860,
182598,
289110,
215385,
272729,
379225,
354655,
321894,
280939,
354676,
313727,
436608,
362881,
240002,
436611,
248194,
395659,
395661,
108944,
240016,
190871,
149916,
420253,
141728,
289189,
289194,
108972,
272813,
338356,
436661,
289232,
281040,
256477,
281072,
109042,
174593,
420369,
289304,
322078,
207393,
182817,
289332,
174648,
338489,
338490,
322120,
281166,
281171,
297560,
354911,
436832,
436834,
191082,
313966,
420463,
281199,
346737,
313971,
346740,
420471,
330379,
330387,
117396,
346772,
330388,
117397,
264856,
289434,
346779,
338613,
314040,
109241,
158394,
248517,
363211,
363230,
289502,
264928,
338662,
330474,
346858,
289518,
322291,
199414,
35583,
363263,
191235,
264968,
322316,
117517,
322319,
166676,
207640,
289576,
191283,
273207,
289598,
420677,
281427,
281433,
109409,
330609,
207732,
158593,
240518,
109447,
224145,
355217,
256922,
289690,
240544,
289698,
420773,
289703,
363438,
347055,
289727,
273344,
330689,
363458,
379844,
19399,
338899,
248796,
248797,
207838,
347103,
314342,
52200,
289774,
347123,
240630,
314362,
257024,
330754,
330763,
281626,
248872,
322612,
314448,
339030,
314467,
281700,
257125,
322663,
273515,
207979,
404593,
363641,
363644,
150657,
248961,
330888,
363669,
339100,
380061,
339102,
199839,
429214,
265379,
249002,
306346,
3246,
421048,
339130,
208058,
322749,
265412,
290000,
298208,
298212,
298213,
290022,
330984,
298221,
298228,
216315,
208124,
363771,
388349,
437505,
322824,
257305,
126237,
339234,
208164,
372009,
412971,
298291,
306494,
216386,
224586,
372043,
331090,
314710,
372054,
159066,
314720,
314726,
314728,
134506,
380271,
314739,
208244,
314741,
249204,
290173,
306559,
314751,
298374,
314758,
314760,
142729,
388487,
314766,
306579,
282007,
290207,
314783,
314789,
314791,
396711,
396712,
282024,
241066,
314798,
380337,
380338,
150965,
380357,
339398,
306639,
413137,
429542,
191981,
191990,
290301,
282114,
372227,
323080,
323087,
175639,
388632,
396827,
134686,
282146,
306723,
347694,
290358,
265798,
265804,
396882,
290390,
306776,
44635,
396895,
323172,
282213,
323178,
224883,
314998,
323196,
175741,
339584,
224901,
282245,
282246,
323217,
282259,
282273,
323236,
298661,
282280,
61101,
224946,
110268,
224958,
282303,
323264,
274115,
306890,
282318,
241361,
241365,
298712,
298720,
282339,
12010,
282348,
282358,
175873,
323331,
339715,
323332,
339720,
372496,
323346,
249626,
282400,
241441,
241442,
339745,
257830,
421672,
282417,
282427,
315202,
307011,
282434,
282438,
323406,
216918,
241495,
307039,
282474,
282480,
241528,
339841,
241540,
315273,
315274,
110480,
372626,
380821,
282518,
282519,
118685,
298909,
323507,
282549,
290745,
290746,
274371,
151497,
372701,
298980,
380908,
282633,
241692,
102437,
315432,
315434,
102445,
233517,
176175,
241716,
225351,
315465,
315476,
307289,
200794,
315487,
356447,
307299,
438377,
315498,
299121,
233589,
266357,
422019,
241808,
323729,
381073,
233636,
299174,
323762,
241843,
299187,
405687,
184505,
299198,
258239,
389313,
299203,
299209,
372941,
282831,
266449,
356576,
176362,
307435,
438511,
381172,
184570,
184575,
381208,
315673,
299293,
151839,
233762,
217380,
151847,
282919,
332083,
332085,
332089,
315706,
282939,
241986,
438596,
332101,
323913,
323916,
348492,
323920,
250192,
348500,
168281,
332123,
332127,
323935,
242023,
242029,
160110,
242033,
291192,
340357,
225670,
332167,
242058,
373134,
291224,
242078,
283038,
61857,
315810,
315811,
381347,
61859,
340398,
61873,
61880,
283064,
127427,
127428,
283075,
291267,
324039,
373197,
176601,
242139,
160225,
242148,
242149,
291311,
233978,
291333,
340490,
258581,
291358,
283184,
234036,
315960,
348732,
242237,
70209,
348742,
70215,
348749,
381517,
332378,
201308,
242277,
111208,
184940,
373358,
389745,
209530,
373375,
152195,
348806,
184973,
316049,
111253,
316053,
111258,
111259,
176808,
299699,
299700,
422596,
422599,
291530,
225995,
242386,
422617,
422626,
234217,
299759,
299776,
291585,
430849,
242433,
291592,
62220,
422673,
430865,
291604,
422680,
152365,
422703,
422709,
152374,
242485,
160571,
430910,
160575,
160580,
299849,
283467,
381773,
201551,
242529,
349026,
357218,
275303,
201577,
308076,
242541,
209783,
209785,
177019,
185211,
308092,
398206,
291712,
381829,
316298,
308107,
349072,
308112,
209817,
324506,
324507,
390045,
127902,
185250,
324517,
185254,
316333,
373687,
316343,
349121,
373706,
316364,
340955,
340961,
324586,
340974,
316405,
349175,
201720,
127992,
357379,
324625,
308243,
316437,
201755,
300068,
357414,
300084,
324666,
308287,
21569,
218186,
300111,
341073,
439384,
250981,
300135,
316520,
300136,
357486,
316526,
144496,
300150,
291959,
300151,
160891,
341115,
300158,
349316,
349318,
373903,
177296,
169104,
308372,
185493,
324760,
119962,
300187,
300188,
300201,
300202,
373945,
259268,
283847,
62665,
283852,
283853,
259280,
316627,
333011,
357595,
234733,
234742,
128251,
316669,
234755,
242954,
439562,
292107,
414990,
251153,
177428,
349462,
333090,
382258,
300343,
382269,
333117,
193859,
177484,
406861,
259406,
234831,
251213,
120148,
283991,
374109,
234850,
292195,
333160,
243056,
316787,
357762,
112017,
234898,
259475,
275859,
112018,
357786,
251298,
333220,
316842,
374191,
210358,
284089,
292283,
415171,
300487,
300489,
366037,
210390,
210391,
210393,
144867,
316902,
54765,
251378,
308723,
333300,
333303,
300536,
210433,
366083,
259599,
316946,
308756,
398869,
374296,
374299,
308764,
349726,
333343,
431649,
349741,
169518,
431663,
194110,
235070,
349763,
218696,
292425,
243274,
128587,
333388,
333393,
300630,
128599,
235095,
333408,
300644,
374372,
415338,
243307,
54893,
325231,
366203,
325245,
194180,
415375,
153251,
300714,
210603,
415420,
333503,
218819,
259781,
333517,
333520,
333521,
333523,
325346,
153319,
325352,
284401,
325371,
194303,
284429,
284431,
243472,
366360,
284442,
325404,
325410,
341796,
333610,
399147,
431916,
317232,
300848,
259899,
325439,
325445,
153415,
341836,
415567,
325457,
317269,
341847,
350044,
128862,
284514,
276327,
292712,
325484,
423789,
292720,
325492,
276341,
300918,
341879,
317304,
333688,
112509,
194429,
325503,
55167,
333701,
243591,
325515,
243597,
325518,
333722,
350109,
292771,
333735,
415655,
284587,
243637,
284619,
301008,
153554,
219101,
292836,
292837,
317415,
325619,
432116,
333817,
292858,
415741,
333828,
358410,
399373,
317467,
145435,
292902,
325674,
243759,
129076,
243767,
358456,
325694,
309345,
194666,
260207,
432240,
284788,
333940,
292992,
333955,
415881,
104587,
235662,
325776,
317587,
284826,
333991,
333992,
284842,
301251,
309444,
227524,
194782,
301279,
317664,
243962,
375039,
309503,
194820,
375051,
325905,
334103,
325912,
309529,
227616,
211235,
432421,
211238,
358703,
358709,
260418,
325968,
6481,
366930,
366929,
6489,
391520,
383332,
383336,
317820,
211326,
317831,
227725,
252308,
178582,
293274,
317852,
121245,
285090,
375207,
342450,
334260,
293303,
293310,
416197,
129483,
342476,
317901,
326100,
285150,
342498,
358882,
334309,
195045,
391655,
432618,
375276,
342536,
342553,
416286,
375333,
244269,
375343,
23092,
375351,
244281,
301638,
309830,
293448,
55881,
416341,
244310,
416351,
268899,
244327,
39530,
244347,
326287,
375440,
334481,
227990,
318106,
318107,
342682,
318130,
383667,
293556,
342713,
285373,
39614,
318173,
375526,
285415,
342762,
342763,
293612,
129773,
154359,
432893,
162561,
285444,
383754,
326414,
285458,
310036,
326429,
293664,
326433,
400166,
293672,
318250,
318252,
285487,
375609,
285497,
252741,
293711,
244568,
244570,
301918,
293730,
351077,
342887,
326505,
269178,
400252,
359298,
359299,
260996,
113542,
228233,
392074,
228234,
236428,
56208,
293781,
318364,
310176,
310178,
293800,
236461,
326581,
326587,
326601,
359381,
433115,
343005,
130016,
64485,
326635,
203757,
187374,
383983,
318461,
293886,
293893,
433165,
384016,
146448,
433174,
252958,
252980,
203830,
359478,
302139,
359495,
392290,
253029,
228458,
318572,
351344,
187506,
285814,
392318,
187521,
384131,
302216,
228491,
228493,
285838,
162961,
326804,
351390,
302240,
343203,
253099,
253100,
318639,
367799,
113850,
294074,
64700,
228542,
302274,
367810,
343234,
244940,
228563,
195808,
310497,
228588,
253167,
302325,
261377,
228609,
318733,
245019,
253216,
130338,
130343,
261425,
351537,
318775,
286013,
286018,
146762,
294218,
294219,
318805,
425304,
294243,
163175,
327024,
327025,
327031,
318848,
179587,
253317,
384393,
368011,
318864,
318868,
318875,
310692,
245161,
286129,
286132,
228795,
425405,
302529,
302531,
163268,
425418,
310732,
64975,
327121,
228827,
286172,
310757,
187878,
245223,
343542,
343543,
286202,
359930,
286205,
302590,
228867,
253451,
253452,
359950,
146964,
253463,
286244,
245287,
245292,
286254,
196164,
56902,
179801,
196187,
343647,
286306,
310889,
204397,
138863,
188016,
294529,
286343,
229001,
310923,
188048,
425626,
229020,
302754,
245412,
40613,
40614,
40615,
229029,
384695,
319162,
327358,
286399,
319177,
212685,
384720,
245457,
302802,
286423,
278234,
294622,
278240,
212716,
212717,
360177,
286459,
278272,
319233,
360195,
278291,
294678,
286494,
409394,
319292,
360252,
360264,
188251,
376669,
245599,
425825,
425833,
417654,
188292,
327557,
253829,
294807,
294809,
376732,
311199,
319392,
294823,
327596,
294843,
188348,
237504,
294850,
384964,
163781,
344013,
212942,
212946,
24532,
294886,
253929,
327661,
311281,
311282
] |
ec2d4866c4e6d0a8623f85eb493fcec738e127bf | 43d0bb9a38f26712f03849ef25a4e540612e8909 | /E-Shop/Main Model/Basket.swift | 166717f6a9e947834fb1c51337247f6449b54523 | [] | no_license | walidrafeii/E-SHOP | e1ed7a998f9d7212b9e0b74e2b9624b9bd7a7da1 | 6939217a4c242a8775eb4fd7ef09732055c393db | refs/heads/main | 2023-04-28T20:13:15.455649 | 2021-05-18T21:22:05 | 2021-05-18T21:22:05 | 368,667,381 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,822 | swift | //
// Basket.swift
// E-Shop
//
// Created by Walid Rafei on 9/2/20.
// Copyright © 2020 Walid Rafei. All rights reserved.
//
import Foundation
class Basket {
var id: String!
var ownerId: String!
var itemIds: [String]!
init() {
}
init(_dictionary: NSDictionary) {
id = _dictionary[kOBJECTID] as? String
ownerId = _dictionary[kOWNERID] as? String
itemIds = _dictionary[kITEMIDS] as? [String]
}
}
//MARK: save to Firebase
func saveBasketToFireStore(basket: Basket) {
FirebaseReference(.Basket).document(basket.id).setData(basketDictionaryFrom(basket) as! [String: Any])
}
//MARK: Download Items from Firebase
func downloadBasketFromFireStore(_ ownerId: String, completion: @escaping(_ basket: Basket?) -> Void) {
FirebaseReference(.Basket).whereField(kOWNERID, isEqualTo: ownerId).getDocuments { (snapshot, error) in
guard let snapshot = snapshot else {
completion(nil)
return
}
if !snapshot.isEmpty && snapshot.documents.count > 0 {
let basket = Basket(_dictionary: snapshot.documents.first!.data() as NSDictionary)
completion(basket)
}
else {
completion(nil)
}
}
}
//MARK: HELPER FUNCTIONS
func basketDictionaryFrom(_ basket: Basket) -> NSDictionary {
return NSDictionary(objects: [basket.id, basket.ownerId, basket.itemIds],
forKeys: [kOBJECTID as NSCopying, kOWNERID as NSCopying, kITEMIDS as NSCopying])
}
//MARK: Update Basket
func updateBasketInFireStore(_ basket: Basket, withValues: [String: Any], completion: @escaping(_ error: Error?) -> Void) {
FirebaseReference(.Basket).document(basket.id).updateData(withValues){ (error) in
completion(error)
}
}
| [
-1
] |
8a87a3239a629e2ba64e57bd7a6f7200a0b67bd6 | 863937e912548818683860003813365533382140 | /problem_043.swift | 43bfe0395e42be52c414256100affc9d634ba97a | [] | no_license | mryingster/ProjectEuler | a6822c489ffe027fbeeaf94b6f1b1d7dca84bb04 | 56e06def01fc12c46683d9bb9ab76ced895eb0d5 | refs/heads/master | 2021-11-11T04:43:38.055700 | 2021-09-04T00:54:58 | 2021-09-10T23:21:05 | 23,477,151 | 3 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,797 | swift | #!/usr/bin/xcrun swift
// -*- compile-command: "swiftc problem_043.swift -o problem_043" -*-
// Copyright (c) 2016 Michael Caldwell
import Cocoa
print("Project Euler - Problem 43:")
print("Find the sum of all 0 to 9 pandigital numbers with the sub-string divisibility property.\n")
func nextPermutation(let a: [Int]) -> [Int] {
var a = a
// Find the largest index k such that a[k] < a[k + 1]
var k = 0
for i in 0...8 {
if a[i] < a[i+1] {
k = i
}
}
// Find the largest index l greater than k such that a[k] < a[l]
var l = 0
for i in k...9 {
if a[k] < a[i] {
l = i
}
}
// Swap the value of a[k] with that of a[l]
let t = a[k]
a[k] = a[l]
a[l] = t
// Reverse the sequence from a[k + 1] up to and including the final element a[n]
if k < 8 {
var r = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
var j = 9
for i in (k+1)...9 {
r[j] = a[i]
j -= 1
}
for i in (k+1)...9 {
a[i] = r[i]
}
}
return a
}
func subStringDivisible(let a: [Int]) -> Bool {
let divisor = [0, 2, 3, 5, 7, 11, 13, 17]
for i in 1...divisor.count-1 {
let n = a[i] * 100 + a[i+1] * 10 + a[i+2]
if n % divisor[i] != 0 {
return false
}
}
return true
}
func arrayToNum(let a: [Int]) -> Int {
var n = 0
for i in 0...a.count-1 {
n *= 10
n += a[i]
}
return n
}
var array: [Int] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
var sum = 0
while array != [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] {
// Permute
array = nextPermutation(array)
// Check for eligibility
if subStringDivisible(array) {
// Add!
sum += arrayToNum(array)
}
}
print(sum)
| [
-1
] |
7c8036cfacf22e2f4400dd40f3d22a0a1a2a03e9 | df7534daed1973df0398f1ea3daaa43612c76fc7 | /GHActionsTest/Pods/PubNubSwift/Sources/PubNub/Networking/Response/ResponseOperator.swift | d278420ebfcbcd9243e95f57c9675fdb909bb881 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | estebansotoara/GHActionsTest | 52416ae6f5e959b3d77d6286dd018f40204edf93 | 3f48884be4cdfff329b8627e1076b5400b557c5b | refs/heads/Develop | 2023-03-07T05:23:32.946782 | 2021-02-19T00:08:19 | 2021-02-19T00:08:19 | 337,876,790 | 0 | 0 | MIT | 2021-02-19T00:08:20 | 2021-02-10T22:58:01 | Swift | UTF-8 | Swift | false | false | 5,999 | swift | //
// ResponseOperator.swift
//
// PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks
// Copyright © 2019 PubNub Inc.
// https://www.pubnub.com/
// https://www.pubnub.com/terms
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
import Foundation
// MARK: - Response Decoder
/// The object responsible for decoding the raw response data
public protocol ResponseDecoder where Payload: Codable {
associatedtype Payload
/// The method called when attempting to decode the response data for a given Endpoint
///
/// - Parameters:
/// - response: The raw `Response` to be decoded
/// - decoder: The `ResponseDecoder` used to decode the raw response data
/// - Returns: The decoded payload or the error that occurred during the decoding process
func decode(response: EndpointResponse<Data>) -> Result<EndpointResponse<Payload>, Error>
/// The method called when attempting to decode the response error data for a given Endpoint
///
/// - Parameters:
/// - endpoint: The endpoint that was requested
/// - request: The `URLRequest` that failed
/// - response: The `HTTPURLResponse` that was returned
/// - for: The `ResponseDecoder` used to decode the raw response data
/// - Returns: The `PubNubError` that represents the response error
func decodeError(router: HTTPRouter, request: URLRequest, response: HTTPURLResponse, for data: Data) -> PubNubError?
/// The method called when attempting to decode the response error data for a given Endpoint
///
/// - Parameters:
/// - response: The response to be decrypted
/// - Returns: The decrypted Payload or an Error
func decrypt(response: EndpointResponse<Payload>) -> Result<EndpointResponse<Payload>, Error>
}
extension ResponseDecoder {
func decodeError(router: HTTPRouter, request: URLRequest, response: HTTPURLResponse, for data: Data) -> PubNubError? {
return decodeDefaultError(router: router, request: request, response: response, for: data)
}
func decode(response: EndpointResponse<Data>) -> Result<EndpointResponse<Payload>, Error> {
do {
let decodedPayload = try Constant.jsonDecoder.decode(Payload.self, from: response.payload)
let decodedResponse = EndpointResponse<Payload>(router: response.router,
request: response.request,
response: response.response,
data: response.data,
payload: decodedPayload)
return .success(decodedResponse)
} catch {
return .failure(PubNubError(.jsonDataDecodingFailure, response: response, error: error))
}
}
func decrypt(response: EndpointResponse<Payload>) -> Result<EndpointResponse<Payload>, Error> {
return .success(response)
}
func decodeDefaultError(
router: HTTPRouter,
request: URLRequest,
response: HTTPURLResponse,
for data: Data
) -> PubNubError? {
// Attempt to decode based on general system response payload
let generalErrorPayload = try? Constant.jsonDecoder.decode(GenericServicePayloadResponse.self, from: data)
return PubNubError(reason: generalErrorPayload?.pubnubReason,
router: router, request: request, response: response,
additional: generalErrorPayload?.details)
}
}
// MARK: - Request: Response Handling
extension Request {
public func response<D: ResponseDecoder>(
on queue: DispatchQueue = .main,
decoder responseDecoder: D,
completion: @escaping (Result<EndpointResponse<D.Payload>, Error>) -> Void
) {
appendResponseCompletion { result in
queue.async {
completion(
result.flatMap { response in
// Decode the data response into the correct data type
responseDecoder.decode(response: response).flatMap { decoded in
// Do any decryption of the decoded data result
responseDecoder.decrypt(response: decoded)
}
}
)
}
}
}
func appendResponseCompletion(_ closure: @escaping (Result<EndpointResponse<Data>, Error>) -> Void) {
// Add the completion closure to the request and wait for it to complete
requestQueue.async { [weak self] in
self?.atomicState.lockedWrite { mutableState in
mutableState.responseCompletionClosure = closure
}
}
}
func processResponseCompletion(_ result: Result<EndpointResponse<Data>, Error>) {
// Request is now complete, so fire the stored completion closure
var responseCompletion: ((Result<EndpointResponse<Data>, Error>) -> Void)?
atomicState.lockedWrite { state in
responseCompletion = state.responseCompletionClosure
if state.taskState.canTransition(to: .finished) {
state.taskState = .finished
}
}
responseCompletion?(result)
}
}
| [
-1
] |
ddf143575dd7b655b488d9575bee689a8b64a263 | 610dadce6a26a55e99035d8d51f86ab765f57793 | /SDKTests/SDKTests.swift | 8fae70a2e0d3daf1aaf7d23035cb12ed59c45793 | [
"Apache-2.0"
] | permissive | peacemakr-io/peacemakr-ios-sdk | 21adca8de84c4785cfae6f612eae4bc86ceebdbe | e1b644dd8997d8cd27ede26ae72e40050b7701b5 | refs/heads/master | 2023-08-17T10:52:47.664061 | 2021-09-30T05:07:43 | 2021-09-30T05:07:43 | 156,140,286 | 0 | 0 | Apache-2.0 | 2021-09-30T05:07:44 | 2018-11-05T00:47:06 | C | UTF-8 | Swift | false | false | 3,167 | swift | //
// SDKTests.swift
// SDKTests
//
// Created by Aman LaChapelle on 11/4/18.
// Copyright © 2018 Peacemakr. All rights reserved.
//
import XCTest
@testable import Peacemakr
func log(_ s: String) -> Void {
print(s)
}
class SDKTests: XCTestCase {
var sdk: Peacemakr? = nil
var data: AppData? = nil
let gibblygook = "gibblygook"
override func setUp() {
super.setUp()
data = AppData()
data!.setSomeProperty(prop: "something")
data!.setSomeOtherProperty(key: "someKey", value: "someValue")
}
override func tearDown() {
super.tearDown()
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testRegister() {
sdk = try? Peacemakr(apiKey: "", url: "http://localhost:8080", testingMode: true)
XCTAssertNotNil(sdk)
let expectation = self.expectation(description: "Registration successful")
sdk?.register(completion: { error in
XCTAssertNil(error, error!.localizedDescription)
expectation.fulfill()
})
waitForExpectations(timeout: 5, handler: nil)
XCTAssert(sdk!.registrationSuccessful(), "Register failed")
}
func testSync() {
sdk = try? Peacemakr(apiKey: "", url: "http://localhost:8080", testingMode: true)
XCTAssertNotNil(sdk)
let expectation = self.expectation(description: "Registration successful")
sdk?.register(completion: { error in
XCTAssertNil(error)
expectation.fulfill()
})
waitForExpectations(timeout: 10, handler: nil)
UserDefaults.standard.synchronize()
let gotOrgInfoExpectation = self.expectation(description: "Got org info")
sdk?.sync(completion: { error in
XCTAssertNil(error)
gotOrgInfoExpectation.fulfill()
})
waitForExpectations(timeout: 60, handler: nil)
}
func testEncryptDecrypt() throws {
sdk = try? Peacemakr(apiKey: "", url: "http://localhost:8080", testingMode: true)
XCTAssertNotNil(sdk)
let expectation = self.expectation(description: "Registration successful")
sdk?.register(completion: { error in
XCTAssertNil(error)
expectation.fulfill()
})
waitForExpectations(timeout: 10, handler: nil)
UserDefaults.standard.synchronize()
let gotOrgInfoExpectation = self.expectation(description: "Got org info")
sdk?.sync(completion: { error in
XCTAssertNil(error)
gotOrgInfoExpectation.fulfill()
})
waitForExpectations(timeout: 60, handler: nil)
XCTAssert(sdk!.registrationSuccessful(), "Register failed")
let decryptExpectation = self.expectation(description: "Decrypt successful")
sdk!.encrypt(plaintext: data!.serializedValue, completion: {(serialized, error) in
XCTAssert(error == nil, error!.localizedDescription)
self.sdk!.decrypt(ciphertext: serialized!, completion: { (dest) in
XCTAssert(dest.error == nil, dest.error!.localizedDescription)
XCTAssert(dest.data != nil, dest.error!.localizedDescription)
XCTAssertEqual(dest.data, self.data?.serializedValue)
decryptExpectation.fulfill()
})
})
waitForExpectations(timeout: 10, handler: nil)
}
}
| [
-1
] |
5355e1441e86ac2a342fdb03338534d3d9812e8f | e6b2dfcaf7125a62d3284db7c037ba7e8d0ce252 | /CMExchangeCenter/Models/CMNewsItem.swift | afb35e6d55c29d9962bada19760fde6a14d13849 | [] | no_license | wangnima123/CMExchangeCenterDemo | 0bc5221e83be9a9a0eb96ee4be0444c97182c8b5 | cfb21c8618603f1511f07270e51f9ff03ea9ff8c | refs/heads/master | 2020-03-10T13:11:04.062401 | 2018-04-13T11:49:32 | 2018-04-13T11:49:32 | 129,394,508 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,611 | swift | //
// CMNewsItem.swift
// CMExchangeCenter
//
// Created by wangze on 2018/4/12.
// Copyright © 2018年 wangze. All rights reserved.
//
import UIKit
import ObjectMapper
class CMNewsItem: Mappable {
var code :String?
var data :DetailNewsList?
var msg :String?
required init?(map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
data <- map["data"]
msg <- map["msg"]
}
}
class DetailNewsList: Mappable {
required init?(map: Map) {
}
func mapping(map: Map) {
news_list <- map["news_list"]
}
var news_list:[DetailNewsItem]?
}
class DetailNewsItem: Mappable {
var desc :String?
var language :String?
var newsType :Int?
var news_date :CLongLong?
var news_id :CLongLong?
var picture :String?
var publishTime :CLongLong?
var publisher :String?
var seedUrl :String?
var source_url :String?
var title :String?
var updateTime :CLongLong?
var view_num :String?
required init?(map: Map) {
}
func mapping(map: Map) {
desc <- map["description"]
language <- map["language"]
newsType <- map["newsType"]
news_date <- map["news_date"]
news_id <- map["news_id"]
picture <- map["picture"]
publishTime <- map["publishTime"]
publisher <- map["publisher"]
seedUrl <- map["seedUrl"]
source_url <- map["source_url"]
title <- map["title"]
updateTime <- map["updateTime"]
view_num <- map["view_num"]
}
}
| [
-1
] |
5f57c98be2c44012778059d3f5b740bcf8215e89 | ff1715836fa1013d36c1ce73e71d386fc52573aa | /MapDirectionDemo/MapDirectionDemo/ViewController.swift | e5debda40eeb05b02d38af1be9ccbfb3330e3fe2 | [
"MIT"
] | permissive | naokits/my-programming-marathon | 3ddc738cab525072068835da960dee80666bf6cf | ab7a883fce7bb3a27475aff9b6413d2543b6190c | refs/heads/master | 2020-04-06T07:12:58.260639 | 2016-09-12T17:30:00 | 2016-09-12T17:30:00 | 48,183,562 | 35 | 3 | null | 2016-09-12T17:30:00 | 2015-12-17T15:51:04 | Objective-C | UTF-8 | Swift | false | false | 517 | swift | //
// ViewController.swift
// MapDirectionDemo
//
// Created by Naoki Tsutsui on 2/15/16.
// Copyright © 2016 Naoki Tsutsui. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
309264,
317473,
237616,
360501,
286775,
288827,
286786,
159812,
278606,
237655,
307288,
200802,
309347,
276580,
309349,
309351,
309353,
307311,
276597,
278657,
303242,
311437,
278675,
299165,
278686,
278693,
280760,
280770,
227523,
280772,
280775,
280777,
313550,
229585,
280797,
278749,
278752,
301284,
280808,
280810,
286963,
280821,
286965,
280824,
280826,
280832,
276736,
278786,
278791,
287004,
287005,
287007,
282917,
233767,
282922,
282926,
307516,
278845,
287055,
289112,
311645,
323933,
289120,
227688,
278897,
280947,
313733,
233869,
227740,
289187,
289190,
289191,
305577,
289196,
305582,
278968,
127418,
293308,
278973,
289224,
281042,
276959,
279011,
276965,
236022,
287231,
279041,
279046,
215562,
277006,
281107,
279064,
281118,
295460,
281142,
279096,
277057,
129604,
311913,
277108,
281218,
281221,
285321,
227984,
303760,
117399,
228000,
295586,
225955,
287399,
277180,
285377,
226009,
277224,
199402,
234223,
312049,
289524,
226038,
230147,
226055,
281373,
295711,
228127,
281380,
283433,
289578,
312107,
285495,
289596,
283453,
289600,
279360,
283461,
279380,
295766,
279386,
308064,
303977,
293742,
277364,
207738,
291709,
183173,
324491,
304012,
304015,
226196,
275358,
277406,
289697,
283556,
291755,
277420,
277422,
297903,
324528,
230323,
277429,
277430,
277432,
277433,
277434,
230328,
293816,
281530,
291774,
295874,
289771,
183278,
277487,
293874,
277502,
293888,
275466,
293909,
300057,
197664,
197677,
304174,
300086,
300089,
238653,
300107,
203858,
300116,
277602,
281701,
281703,
296042,
277612,
164974,
226447,
349332,
226454,
226455,
226456,
226458,
285855,
283839,
277696,
228548,
228551,
279754,
230604,
298189,
302286,
230608,
290004,
290006,
302295,
189655,
298202,
298204,
298206,
363743,
298207,
290016,
298211,
290020,
120054,
333048,
204027,
312586,
296214,
277797,
130346,
113972,
300358,
238920,
234829,
296272,
306540,
216433,
290166,
310649,
333179,
290175,
275842,
224643,
300432,
310673,
226705,
306578,
288165,
144811,
370093,
279982,
286126,
277935,
282035,
306633,
288205,
286158,
280015,
163289,
280029,
280030,
286175,
280031,
286189,
282095,
302580,
292341,
310773,
288251,
290299,
286204,
290303,
294411,
282128,
286234,
284192,
284197,
296487,
286249,
296489,
286257,
226878,
288321,
228932,
226887,
288331,
288332,
284236,
284239,
226896,
212561,
284240,
284242,
292435,
300629,
276054,
228945,
280146,
212573,
292451,
284261,
306791,
286314,
284275,
284276,
284277,
294518,
314996,
284279,
292478,
284287,
284289,
284293,
284298,
282262,
284315,
284317,
284323,
282275,
280231,
284328,
313007,
284336,
286390,
276150,
282301,
296638,
276167,
294600,
284361,
282320,
317137,
284373,
282338,
284391,
294636,
358127,
288501,
282357,
358137,
358139,
286462,
282368,
358147,
282377,
300817,
282393,
278298,
329499,
276256,
278304,
282403,
304933,
315177,
282411,
159541,
282426,
288577,
288579,
298830,
307029,
276309,
298843,
188253,
292701,
200549,
292730,
284570,
294812,
284574,
284577,
284580,
284586,
276396,
282548,
298951,
301012,
294877,
294889,
231405,
298989,
227315,
237556
] |
1ac29ef8568383435e6f4d6ed2ec1fb7d2670e06 | 56cbebbb71df5b6c206966f1f1bad6bcc082efca | /AmplifyPredictionsSampleApp/TabViews/IdentifyViews/TextDetailView.swift | e375b18cdfc25437c6c7a4ffe25f90f944e62b77 | [] | no_license | kneekey23/SwiftPredictions | c24af78b92425431bc458313fe20e443990794ae | b1a97d23df0dfbe134bf04fa60e115f28c341db4 | refs/heads/master | 2020-09-20T13:54:10.984116 | 2020-03-20T20:54:45 | 2020-03-20T20:54:45 | 224,501,994 | 6 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 1,088 | swift | //
// TextDetailView.swift
// AmplifyPredictionsSampleApp
//
// Created by Stone, Nicki on 11/22/19.
// Copyright © 2019 AWS. All rights reserved.
//
import SwiftUI
import Amplify
import CoreGraphics
import UIKit
struct TextDetailView: View {
var line: Line
var incomingImage: UIImage
var body: some View {
ZStack {
Image(uiImage: incomingImage)
.resizable()
.scaledToFit()
.overlay(
GeometryReader { geometry in
Rectangle()
.path(in: CGRect(
x: self.line.boundingBox.minX * geometry.size.width,
y: self.line.boundingBox.minY * geometry.size.height,
width: self.line.boundingBox.width * geometry.size.width,
height: self.line.boundingBox.height * geometry.size.height))
.stroke(Color.red, lineWidth: 2.0)
}
)
}
}
}
| [
-1
] |
0ff195e012164993ec3276e1c913867287f56f8b | 059800990a2ca507a5367ad76bd396e060931898 | /Zeus/ViewControllers/活动/ActivityInfoCell.swift | 5f70abbb0fc764cffb4b02e6fe81298a506e6176 | [
"MIT"
] | permissive | wuleijun/Zeus | ce6e309313fca0fa29db285fe10679ae20998886 | 7f71cced4edb5bbfff3c0431517e77dd1be23929 | refs/heads/master | 2021-01-01T05:17:15.564517 | 2016-05-13T06:17:31 | 2016-05-13T06:17:31 | 58,425,784 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 569 | swift | //
// ActivityInfoCell.swift
// Zeus
//
// Created by 吴蕾君 on 16/5/10.
// Copyright © 2016年 rayjuneWu. All rights reserved.
//
import UIKit
class ActivityInfoCell: BaseTableViewCell{
override class func heightOfCell() -> CGFloat {
return 264
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
| [
-1
] |
ebb6fdedcd07888263e71bf92ea373dcb43da0a8 | 86bf5cfdc919ae0d4bce33aa42384db24bc6edf2 | /Stepic/Sources/Frameworks/ContentProcessor/HTMLExtractor.swift | c8b632273a0242bc1d17a6fa704cffb853cfcabf | [
"MIT"
] | permissive | BNazh/stepik-ios | 6bb0b560342ed8b164cc6d4e52537a80dd71d93e | 11f4c9eda9293e72ee0b5769ff0de01407c2652f | refs/heads/master | 2022-02-25T13:54:54.198751 | 2019-10-23T17:17:02 | 2019-10-23T17:17:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,361 | swift | import Foundation
import Kanna
protocol HTMLExtractorProtocol: class {
static func extractAllTagsAttribute(tag: String, attribute: String, from text: String) -> [String]
static func extractAllTagsContent(tag: String, from text: String) -> [String]
static func extractAllTags(tag: String, from text: String) -> [String]
}
final class HTMLExtractor: HTMLExtractorProtocol {
private static func makeDocumentDOM(from text: String) -> HTMLDocument? {
return try? Kanna.HTML(html: text, encoding: String.Encoding.utf8)
}
static func extractAllTagsAttribute(tag: String, attribute: String, from text: String) -> [String] {
guard let documentDOM = HTMLExtractor.makeDocumentDOM(from: text) else {
return []
}
return documentDOM.css(tag).compactMap { $0[attribute] }
}
static func extractAllTagsContent(tag: String, from text: String) -> [String] {
guard let documentDOM = HTMLExtractor.makeDocumentDOM(from: text) else {
return []
}
return documentDOM.css(tag).compactMap { $0.text }
}
static func extractAllTags(tag: String, from text: String) -> [String] {
guard let documentDOM = HTMLExtractor.makeDocumentDOM(from: text) else {
return []
}
return documentDOM.css(tag).compactMap { $0.toHTML }
}
}
| [
-1
] |
faf299ad797c258a3f54f38752989c9c1e9c364b | f748f4e82af28a2997ff8b2dd8182d3c20498def | /Sources/HelloWorldModel/helloworld.pb.swift | 9935d811571acb6f3cc03887d0383e41320e5855 | [] | no_license | yulin-liang/grpc-swift-server | ae273e09b1f9ea11cd6a1a50344cc147bdadef8d | 9e61d88e22e6ef6c15801a4ed6abc277d9250b69 | refs/heads/master | 2022-10-07T13:55:13.926021 | 2020-05-27T23:11:55 | 2020-05-27T23:11:55 | 267,443,824 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,357 | swift | // DO NOT EDIT.
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: helloworld.proto
//
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import Foundation
import SwiftProtobuf
// If the compiler emits an error on this type, it is because this file
// was generated by a version of the `protoc` Swift plug-in that is
// incompatible with the version of SwiftProtobuf to which you are linking.
// Please ensure that you are building against the same version of the API
// that was used to generate this file.
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
typealias Version = _2
}
/// The request message containing the user's name.
struct Helloworld_HelloRequest {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
var name: String = String()
var unknownFields = SwiftProtobuf.UnknownStorage()
init() {}
}
/// The response message containing the greetings.
struct Helloworld_HelloReply {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
var message: String = String()
var unknownFields = SwiftProtobuf.UnknownStorage()
init() {}
}
// MARK: - Code below here is support for the SwiftProtobuf runtime.
fileprivate let _protobuf_package = "helloworld"
extension Helloworld_HelloRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = _protobuf_package + ".HelloRequest"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "name"),
]
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
switch fieldNumber {
case 1: try decoder.decodeSingularStringField(value: &self.name)
default: break
}
}
}
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if !self.name.isEmpty {
try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
}
try unknownFields.traverse(visitor: &visitor)
}
static func ==(lhs: Helloworld_HelloRequest, rhs: Helloworld_HelloRequest) -> Bool {
if lhs.name != rhs.name {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension Helloworld_HelloReply: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = _protobuf_package + ".HelloReply"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "message"),
]
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
switch fieldNumber {
case 1: try decoder.decodeSingularStringField(value: &self.message)
default: break
}
}
}
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if !self.message.isEmpty {
try visitor.visitSingularStringField(value: self.message, fieldNumber: 1)
}
try unknownFields.traverse(visitor: &visitor)
}
static func ==(lhs: Helloworld_HelloReply, rhs: Helloworld_HelloReply) -> Bool {
if lhs.message != rhs.message {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
| [
-1
] |
63dec7fbaa550d7800d4cf5083b94cb77f1fa28c | 46a9010376427563c6cec09a79c0d6b46c0cbed5 | /MBTAKit/Schedule.swift | d51e3af2a63076c8e6db694c3110824697571a66 | [] | no_license | drewferreira83/ViciniT | ea763eb6c152a393606c36611c6a36f71fd1670e | fcb6354d1fd962ae9fc5cd84a460babf35cbce4b | refs/heads/master | 2020-04-03T06:26:08.776765 | 2019-04-02T21:26:24 | 2019-04-02T21:26:24 | 155,074,607 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,676 | swift | //
// Schedule.swift
// ViciniT
//
// Created by Andrew Ferreira on 9/8/18.
// Copyright © 2018 Andrew Ferreira. All rights reserved.
//
import UIKit
open class Schedule: HasID {
public static let Unknown = Schedule()
struct Attributes: Decodable {
let arrival_time: String
let departure_time: String
let drop_off_type: Int
let pickup_type: Int
let stop_sequence: Int
let timepoint: Bool
}
public let arrival: Date?
public let departure: Date?
public let dropOff: GTFS.ScheduledStopType
public let pickUp: GTFS.ScheduledStopType
public let stopSequence: Int
public let timepoint: Bool
public let routeID: String
public let stopID: String
public let tripID: String
public let route: Route
public let stop: Stop
public let trip: Trip
private init() {
arrival = nil
departure = nil
route = Route.Unknown
trip = Trip.Unknown
stop = Stop.Unknown
routeID = Route.Unknown.id
tripID = Trip.Unknown.id
stopID = Stop.Unknown.id
dropOff = .none
pickUp = .none
stopSequence = -1
timepoint = false
super.init( id: "schedule.unknown" )
}
init( source: JXObject, included: [JXObject]? = nil) {
guard let attributes = source.attributes as? Attributes else {
fatalError( "Schedule could not extract attributes from JXObject \(source)")
}
self.arrival = attributes.arrival_time.asDate
self.departure = attributes.departure_time.asDate
self.dropOff = GTFS.ScheduledStopType(rawValue: attributes.drop_off_type) ?? .none
self.pickUp = GTFS.ScheduledStopType(rawValue: attributes.pickup_type) ?? .none
self.stopSequence = attributes.stop_sequence
self.timepoint = attributes.timepoint
guard let routeID = source.relatedID(key: .route) else {
fatalError( "Schedule didn't have routeID. \(source.id)" )
}
self.routeID = routeID
guard let stopID = source.relatedID( key: .stop ) else {
fatalError( "Schedule didn't have stopID. \(source.id)" )
}
self.stopID = stopID
guard let tripID = source.relatedID(key: .trip ) else {
fatalError( "Schedule didn't have tripID. \(source.id)" )
}
self.tripID = tripID
// A query of /schedule might have included data.
// If the JXObject is part of the included data of a different query,
// (like /predictions/include=schedule), then the assoicated route/trip/stop object
// will be nil, but the corresponding ID fields might have valid values.
// Fill in the Stop, Trip, Route and Vehicle from the included data (if it exists).
// TripID is invalid for Green Line Trains east of Park.
// Some shuttles or unscheduled trips don't have all of this data.
if let jxStopData = included?.search(forKind: .stop, id: stopID) {
stop = Stop( source: jxStopData )
} else {
stop = Stop.Unknown
}
if let jxTripData = included?.search(forKind: .trip, id: tripID) {
trip = Trip( source: jxTripData )
} else {
trip = Trip.Unknown
}
if let jxRouteData = included?.search( forKind: .route, id: routeID ) {
route = Route( source: jxRouteData )
} else {
route = Route.Unknown
}
super.init(id: source.id)
}
}
| [
-1
] |
6365a16efe2734741aad3eed513ca66bd3e50740 | f208a5a0d1f403d11aaa55fca28a67493674f270 | /SmallStore/Source/Product.swift | 570dc2dbb885399cbae578da4c8a4e1889fa2b9b | [] | no_license | bartkessels/dia-workshop-unit-tests | 9c24956cb65be9323293352e764975718bc3fd01 | d83f9f509cc79142a863d6154902c2e34f393370 | refs/heads/master | 2020-07-29T02:13:35.186503 | 2019-09-19T19:00:21 | 2019-09-19T19:00:21 | 209,628,459 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 278 | swift | //
// Product.swift
// SmallStore
//
// Created by Bart Kessels on 19/09/2019.
// Copyright © 2019 Bart Kessels. All rights reserved.
//
import Foundation
protocol Product {
func getPrice() -> Double
func getName() -> String
func getDescription() -> String
}
| [
-1
] |
f401f1fbed2ee249770051fcb7e7d4c2d25818bd | 9f56e0e1f3b6b4eb27f3002bf05eb9ad0b1e232c | /mnc-igetspot-ios/Sources/Controllers/Order/RequestOrderTVC.swift | d1afb6e69901acbcc46dff8f0bba1a652bdd1420 | [] | no_license | mariobagus97/igetspot | 35c4f1d108db2f8cb0871ea8ee1f05a6fa5e7ce5 | f828ab3e1a58a5ceae9e237521619fec1d5cc5cd | refs/heads/master | 2023-06-05T04:56:11.477164 | 2021-06-28T18:03:01 | 2021-06-28T18:03:01 | 381,116,163 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 16,318 | swift | ////
// I Get Spot
//
// Created by Muhammad Nizar on 07/01/19.
// Copyright © 2019 MNC Innovation Center. All rights reserved.
//
import UIKit
import CRRefresh
import SwiftMessages
import FloatingPanel
protocol RequestOrderTVCDelegate:class {
func requestStartOrderButtonDidClicked()
func refreshTitle()
}
let kRefreshDataRequestOrderNotificationName = "kRefreshDataRequestOrderNotification"
class RequestOrderTVC: MKTableViewController {
var presenter = RequestOrderPresenter()
var contentSection = MKTableViewSection()
var loadingCell: LoadingCell!
var emptyCell: IGSEmptyCell!
weak var delegate: RequestOrderTVCDelegate?
var orderRequestArray: [OrderRequest]?
var deleteOrderFPC: FloatingPanelController?
var searchKeyword = ""
init(title: String) {
super.init(nibName: nil, bundle: nil)
self.title = title
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
addObserverNotification()
presenter.attachview(self)
getRequestOrderList()
contentView.tableView.cr.addHeadRefresh(animator: NormalHeaderAnimator()) { [weak self] in
self?.getRequestOrderList()
}
}
override func registerNibs() {
super.registerNibs()
contentView.registeredCellIdentifiers.append(R.nib.igsEmptyCell.name)
contentView.registeredCellIdentifiers.append(R.nib.loadingCell.name)
contentView.registeredCellIdentifiers.append(R.nib.infoMasterCell.name)
contentView.registeredCellIdentifiers.append(R.nib.packageOrderCell.name)
contentView.registeredCellIdentifiers.append(R.nib.subTotalOrderCell.name)
contentView.registeredCellIdentifiers.append(R.nib.totalOrderProcessCell.name)
contentView.registeredCellIdentifiers.append(R.nib.addAnotherPackageCell.name)
}
override func createSections() {
super.createSections()
contentView.appendSection(contentSection)
}
override func createRows() {
super.createRows()
}
// MARK: - Public Funtions
@objc func handleHasNewOrder() {
getRequestOrderList()
}
func removeAllRows() {
contentSection.removeAllRows()
}
@objc func getRequestOrderList() {
self.presenter.getRequestOrderList()
}
func searchOrder(keyword: String){
self.searchKeyword = keyword
if let array = self.orderRequestArray {
let resultArray = array.filter {
$0.masterName?.lowercased().contains(keyword.lowercased()) ?? false || $0.orderPackageArray?.contains(where: { $0.packageName?.lowercased().contains(keyword.lowercased()) ?? false }) ?? false
}
contentSection.removeAllRows()
if (resultArray.count == 0){
self.showEmptyView(withMessage: NSLocalizedString("You don't have any request with keyword \"\(self.searchKeyword)\"", comment: ""))
return
}
var totalPrice = 0
for orderRequest in resultArray {
let subTotalPrice = addOrderRequest(orderRequest: orderRequest)
totalPrice = totalPrice + subTotalPrice
}
let totalOrderProcessCell = createTotalOrderProcessCell()
totalOrderProcessCell.delegate = self
contentSection.appendRow(cell: totalOrderProcessCell)
totalOrderProcessCell.setContent(price: "\(totalPrice)")
let addAnotherPackageCell = createAddAnotherPackageCell()
addAnotherPackageCell.delegate = self
contentSection.appendRow(cell: addAnotherPackageCell)
contentView.reloadData()
}
contentView.reloadData()
}
func resetOrder(){
if let array = self.orderRequestArray, array.count > 0 {
self.setContent(orderRequestArray: self.orderRequestArray!)
} else {
self.showEmptyView(withMessage: NSLocalizedString("You don't have any order request yet", comment: ""),
description: NSLocalizedString("Need a creative service?", comment: ""),
buttonTitle: NSLocalizedString("Start Order", comment: ""), emptyCellButtonType:.start)
}
}
func updateTitle(_ totalRequestOrder: Int) {
self.title = "\(NSLocalizedString("Waiting", comment: ""))(\(totalRequestOrder))"
delegate?.refreshTitle()
}
// MARK: - Private Funtions
private func hideCRRefresh() {
contentView.tableView.cr.endHeaderRefresh()
}
private func reloadContent(orderRequestArray : [OrderRequest]) {
contentSection.removeAllRows()
var totalPrice = 0
updateTitle(orderRequestArray.count)
for orderRequest in orderRequestArray {
let subTotalPrice = addOrderRequest(orderRequest: orderRequest)
totalPrice = totalPrice + subTotalPrice
}
let totalOrderProcessCell = createTotalOrderProcessCell()
totalOrderProcessCell.delegate = self
contentSection.appendRow(cell: totalOrderProcessCell)
totalOrderProcessCell.setContent(price: "\(totalPrice)")
let addAnotherPackageCell = createAddAnotherPackageCell()
addAnotherPackageCell.delegate = self
contentSection.appendRow(cell: addAnotherPackageCell)
contentView.reloadData()
}
private func addOrderRequest(orderRequest : OrderRequest) -> Int {
let infoMasterCell = createInfoMasterCell()
contentSection.appendRow(cell: infoMasterCell)
infoMasterCell.setContent(masterName: orderRequest.masterName, masterInfo: orderRequest.masterOf, masterImageUrl: orderRequest.masterImageUrl ?? "", masterId: orderRequest.masterId)
infoMasterCell.hideChatButton()
if let orderPackageArray = orderRequest.orderPackageArray, orderPackageArray.count > 0 {
let subTotalPrice = addOrderPackage(orderPackageArray: orderPackageArray, masterId: orderRequest.masterId)
let subTotalOrderCell = createSubtotalOrderCell()
contentSection.appendRow(cell: subTotalOrderCell)
subTotalOrderCell.setContent(price: "\(subTotalPrice)")
return subTotalPrice
} else {
return 0
}
}
private func addOrderPackage(orderPackageArray:[OrderPackage], masterId:String?) -> Int {
var totalPrice = 0
for orderPackage in orderPackageArray {
let packageOrderCell = createPackageOrderCell()
contentSection.appendRow(cell: packageOrderCell)
packageOrderCell.setContent(orderPackage: orderPackage)
packageOrderCell.isClickable = false
packageOrderCell.delegate = self
packageOrderCell.masterId = masterId
if orderPackage.isSelected, let packagePrice = orderPackage.packagePrice, let packagePriceInt = Int(packagePrice) {
totalPrice = totalPrice + packagePriceInt
}
}
return totalPrice
}
private func addObserverNotification() {
NotificationCenter.default.addObserver(self, selector: #selector(getRequestOrderList), name: NSNotification.Name(kRefreshDataRequestOrderNotificationName), object: nil)
}
private func createEmptyCell() {
emptyCell = contentView.dequeueReusableCellWithIdentifier(nibName: R.nib.igsEmptyCell.name) as? IGSEmptyCell
}
private func createLoadingCell() {
loadingCell = contentView.dequeueReusableCellWithIdentifier(nibName: R.nib.loadingCell.name) as? LoadingCell
}
private func createInfoMasterCell() -> InfoMasterCell {
let cell = contentView.dequeueReusableCellWithIdentifier(nibName: R.nib.infoMasterCell.name) as! InfoMasterCell
return cell
}
private func createPackageOrderCell() -> PackageOrderCell {
let cell = contentView.dequeueReusableCellWithIdentifier(nibName: R.nib.packageOrderCell.name) as! PackageOrderCell
return cell
}
private func createSubtotalOrderCell() -> SubTotalOrderCell {
let cell = contentView.dequeueReusableCellWithIdentifier(nibName: R.nib.subTotalOrderCell.name) as! SubTotalOrderCell
return cell
}
private func createTotalOrderProcessCell() -> TotalOrderProcessCell {
let cell = contentView.dequeueReusableCellWithIdentifier(nibName: R.nib.totalOrderProcessCell.name) as! TotalOrderProcessCell
return cell
}
private func createAddAnotherPackageCell() -> AddAnotherPackageCell {
let cell = contentView.dequeueReusableCellWithIdentifier(nibName: R.nib.addAnotherPackageCell.name) as! AddAnotherPackageCell
return cell
}
private func showDeleteOrderFPC(packageId:String, masterId:String) {
deleteOrderFPC = FloatingPanelController()
// Initialize FloatingPanelController and add the view
deleteOrderFPC?.surfaceView.cornerRadius = 8.0
deleteOrderFPC?.surfaceView.shadowHidden = false
deleteOrderFPC?.isRemovalInteractionEnabled = true
deleteOrderFPC?.delegate = self
let contentVC = DeleteOrderVC()
contentVC.packageId = packageId
contentVC.masterId = masterId
contentVC.delegate = self
// Set a content view controller
deleteOrderFPC?.set(contentViewController: contentVC)
self.present(deleteOrderFPC!, animated: true, completion: nil)
}
private func hideDeleteOrderFPC(animated:Bool) {
if let deleteOrderFPC = self.deleteOrderFPC {
deleteOrderFPC.dismiss(animated: animated, completion: nil)
}
}
}
// MARK:- RequestOrderView
extension RequestOrderTVC: RequestOrderView {
func showLoadingView() {
if contentSection.numberOfRows() == 0 {
contentView.scrollEnabled(false)
contentSection.removeAllRows()
createLoadingCell()
contentSection.appendRow(cell: loadingCell)
loadingCell.updateHeight(100)
loadingCell.loadingIndicatorView.startAnimating()
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
self.contentView.reloadData()
}
}
}
func hideLoadingView() {
hideCRRefresh()
contentView.scrollEnabled(true)
contentSection.removeAllRows()
}
func showEmptyView(withMessage message:String, description:String? = "", buttonTitle:String? = nil, emptyCellButtonType:EmtypCellButtonType? = .error) {
updateTitle(0)
createEmptyCell()
emptyCell.delegate = self
emptyCell.setContent(withTitle: message, description: description, buttonTitle: buttonTitle, buttonType: emptyCellButtonType)
contentSection.appendRow(cell: emptyCell)
contentView.reloadData()
}
func setContent(orderRequestArray : [OrderRequest]) {
self.orderRequestArray = orderRequestArray
reloadContent(orderRequestArray: orderRequestArray)
}
func handleOrderSuccess() {
getRequestOrderList()
showSuccessMessageBanner(NSLocalizedString("Your order has been submitted successfully.", comment: ""))
if let mainTabBarController = UIApplication.getMainPageTabBarController() {
mainTabBarController.selectedIndex = TabBarIndex.transaction
let navigationController = mainTabBarController.selectedViewController as? UINavigationController
if let transactionTVC = navigationController?.viewControllers.first as? TransactionTVC {
transactionTVC.openWaitingTabAndRefreshData()
}
}
}
func showOrderLoadingHUD() {
showLoadingHUD()
}
func hideOrderLoadingHUD() {
hideLoadingHUD()
}
func showMessageSuccess(message:String) {
showSuccessMessageBanner(message)
}
func showMessageError(message:String) {
showErrorMessageBanner(message)
}
}
// MARK:- FloatingPanelControllerDelegate
extension RequestOrderTVC: FloatingPanelControllerDelegate {
func floatingPanel(_ vc: FloatingPanelController, layoutFor newCollection: UITraitCollection) -> FloatingPanelLayout? {
if vc == deleteOrderFPC {
return IntrinsicPanelLayout()
}
return nil
}
}
// MARK:- DeleteOrderVCDelegate
extension RequestOrderTVC: DeleteOrderVCDelegate {
func deleteOrderCloseButtonDidClicked() {
hideDeleteOrderFPC(animated: true)
}
func deleteOrderAndSaveToFavorites(packageId:String, masterId:String) {
hideDeleteOrderFPC(animated: true)
showAlertMessage(title: NSLocalizedString("Delete & Save To Favorites", comment: ""), message: NSLocalizedString("Are you sure want to delete this package and add to favorite ?", comment: ""), iconImage: nil, okButtonTitle: NSLocalizedString("Delete & Save To Favorites", comment: ""), okAction: { [weak self] in
SwiftMessages.hide()
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
self?.presenter.deletePackageOrderAndSaveToFavorite(packageId: packageId, masterId: masterId)
}
}, cancelButtonTitle: NSLocalizedString("Cancel", comment: ""), cancelAction: {
SwiftMessages.hide()
})
}
func deleteOrder(packageId:String, masterId:String) {
hideDeleteOrderFPC(animated: true)
showAlertMessage(title: NSLocalizedString("Delete", comment: ""), message: NSLocalizedString("Are you sure want to delete this package ?", comment: ""), iconImage: nil, okButtonTitle: NSLocalizedString("Delete", comment: ""), okAction: { [weak self] in
SwiftMessages.hide()
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
self?.presenter.deletePackageOrder(packageId: packageId)
}
}, cancelButtonTitle: NSLocalizedString("Cancel", comment: ""), cancelAction: {
SwiftMessages.hide()
})
}
}
// MARK: - IGSEmptyCellDelegate
extension RequestOrderTVC: IGSEmptyCellDelegate {
func buttonDidClicked(withButtonType buttonType: EmtypCellButtonType?) {
if (buttonType == .error) {
getRequestOrderList()
} else {
delegate?.requestStartOrderButtonDidClicked()
}
}
}
// MARK: - TotalOrderProcessCellDelegate
extension RequestOrderTVC: TotalOrderProcessCellDelegate {
func processOrderButtonDidClicked() {
guard let orderRequestArray = self.orderRequestArray else {
return
}
presenter.requestSubmitOrder(orderRequestArray: orderRequestArray)
}
}
// MARK: - AddAnotherPackageCellDelegate
extension RequestOrderTVC: AddAnotherPackageCellDelegate {
func addAnotherPackageCellDidClicked() {
self.tabBarController?.selectedIndex = TabBarIndex.home
}
}
// MARK: - PackageOrderCellDelegate
extension RequestOrderTVC: PackageOrderCellDelegate {
func deleteButtonDidClicked(orderPackage:OrderPackage, orderId:String?) {
}
func deleteButtonDidClicked(orderPackage: OrderPackage, masterId:String?) {
guard let packageId = orderPackage.packageId, let masterIdString = masterId else {
return
}
showDeleteOrderFPC(packageId: packageId, masterId: masterIdString)
}
func checkListButtonDidClicked(orderPackage: OrderPackage) {
guard let orderRequestArray = self.orderRequestArray else {
return
}
for orderRequest in orderRequestArray {
if let orderPackageArray = orderRequest.orderPackageArray {
for package in orderPackageArray {
if orderPackage.packageId == package.packageId {
package.isSelected = !orderPackage.isSelected
break
}
}
}
}
reloadContent(orderRequestArray: orderRequestArray)
}
}
| [
-1
] |
a6d1e6ea92ccf54a5d8921c20a6aa64309ba753b | ea2bab8120dc804b82d2e1cb0937019aed741102 | /SwiftSVG/SVG Extensions/CALayer+SVG.swift | 08d3ceb42c026ddec0d3d45d167004631e6bfce7 | [
"MIT"
] | permissive | gr-markin/SwiftSVG | f3c00799000bcd4922798b72e4454ac8586dc10d | cfbf0aed23b7022ee59f43609cf21d053f6010a8 | refs/heads/master | 2020-12-26T08:24:45.641396 | 2020-10-22T15:09:57 | 2020-10-22T15:09:57 | 237,446,782 | 0 | 0 | NOASSERTION | 2020-01-31T14:29:49 | 2020-01-31T14:29:49 | null | UTF-8 | Swift | false | false | 4,823 | swift | //
// CALayer+SVG.swift
// SwiftSVG
//
//
// Copyright (c) 2017 Michael Choe
// http://www.github.com/mchoe
// http://www.straussmade.com/
// http://www.twitter.com/_mchoe
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#if os(iOS) || os(tvOS)
import UIKit
#elseif os(OSX)
import AppKit
#endif
/**
A set of convenience initializers that create new `CALayer` instances from SVG data.
If you choose to use these initializers, it is assumed that you would like to exercise a higher level of control. Synchronous construction
*/
public extension CALayer {
/**
Convenience initializer that creates a new `CALayer` from a local or remote URL. You must provide a completion block and add the passed `SVGLayer to a sublayer`.
- Parameter svgURL: The local or remote `URL` of the SVG resource
- Parameter parser: The optional parser to use to parse the SVG file
- Parameter completion: A required completion block to execute once the SVG has completed parsing. You must add the passed `SVGLayer` to a sublayer to display it.
*/
@discardableResult
convenience init(svgURL: URL, parser: SVGParser? = nil, completion: @escaping (SVGLayer) -> ()) {
do {
let svgData = try Data(contentsOf: svgURL)
self.init(svgData: svgData, parser: parser, completion: completion)
} catch {
self.init()
}
}
/// :nodoc:
@available(*, deprecated, renamed: "init(svgURL:parser:completion:)")
@discardableResult
convenience init(SVGURL: URL, parser: SVGParser? = nil, completion: @escaping (SVGLayer) -> ()) {
self.init(svgURL: SVGURL, parser: parser, completion: completion)
}
/**
Convenience initializer that creates a new `CALayer` from SVG data. You must provide a completion block and add the passed `SVGLayer to a sublayer`.
- Parameter svgData: The SVG `Data` to be parsed
- Parameter parser: The optional parser to use to parse the SVG file
- Parameter completion: A required completion block to execute once the SVG has completed parsing. You must add the passed `SVGLayer` to a sublayer to display it.
*/
@discardableResult
convenience init(svgData: Data, parser: SVGParser? = nil, completion: @escaping (SVGLayer) -> ()) {
self.init()
if let cached = SVGCache.default[svgData.cacheKey], let cachedCopy = cached.svgLayerCopy {
DispatchQueue.main.safeAsync {
self.addSublayer(cachedCopy)
}
completion(cachedCopy)
return
}
let dispatchQueue = DispatchQueue(label: "com.straussmade.swiftsvg", attributes: .concurrent)
dispatchQueue.async { [weak self] in
let parserToUse: SVGParser
if let parser = parser {
parserToUse = parser
} else {
parserToUse = NSXMLSVGParserAsync(svgData: svgData) { (svgLayer) in
DispatchQueue.global(qos: .userInitiated).async {
guard let layerCopy = svgLayer.svgLayerCopy else {
return
}
SVGCache.default[svgData.cacheKey] = layerCopy
}
DispatchQueue.main.safeAsync {
self?.addSublayer(svgLayer)
}
completion(svgLayer)
}
}
parserToUse.startParsing()
}
}
/// :nodoc:
@available(*, deprecated, renamed: "init(svgData:parser:completion:)")
@discardableResult
convenience init(SVGData: Data, parser: SVGParser? = nil, completion: @escaping (SVGLayer) -> ()) {
self.init()
}
}
| [
430491
] |
ebe02da4f339ca6979580581d97b73416e709143 | 54ac127f99cb98b342d7262f4758860f83ee3b39 | /Storemator/TabBar/Search/Model/SearchModel.swift | 315346edd426e7857baa49e6736eedb32433e6f1 | [] | no_license | acmobiledev/Storemator | 32a8b7e9e84e610b39e947ec035a10abd35e834b | 6847c423b34faa82fcc1223c93343ae8fffac43c | refs/heads/master | 2023-06-10T13:46:35.738652 | 2021-07-03T23:22:23 | 2021-07-03T23:22:23 | 324,157,921 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 228 | swift | //
// SearchModel.swift
// Storemator
//
// Created by Amit Chaudhary on 12/29/20.
// Copyright © 2020 Amit Chaudhary. All rights reserved.
//
import Foundation
import UIKit
struct AppStoreSearch {
let text: String
}
| [
-1
] |
ce49c8f0be28cda46605f761cf914e94065a38c4 | 9e6f92651008aa321b8d6aa072045aae2c68c87c | /App5/App5/Player4ViewController.swift | 6ac1e64ba78f315aefcc67c05f4d555dc9a72c07 | [] | no_license | LorenaGarcia-Foncillas/Horse-Race-Accessible-Board-Game | 0b2a73071115f03a2943d135617db30d429ac5b5 | a26c2c18e21bab3fe48cbcafc677aac86edd3a3b | refs/heads/master | 2022-11-01T03:10:58.704290 | 2020-06-14T15:04:56 | 2020-06-14T15:04:56 | 272,217,726 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 10,818 | swift | //
// Player4ViewController.swift
// App5
//
// Created by Lorena Garcia-Foncillas on 11/03/2020.
// Copyright © 2020 Lorena Garcia-Foncillas. All rights reserved.
//
import UIKit
class Player4ViewController: UIViewController {
@IBOutlet weak var Left_button: UIButton!
@IBOutlet weak var Right_button: UIButton!
@IBOutlet weak var speed_label: UILabel!
@IBOutlet weak var timer_label: UILabel!
@IBOutlet weak var GoBack: UIButton!
@IBOutlet weak var Ready_button: UIButton!
@IBOutlet weak var WebUrl: UIWebView!
//VARIABLES FOR POST_REQUEST
var timer4 = Timer()
var PostRequestBool: Bool = true
var PostType: Bool = false
//STRING VARIABLES FOR URL
var WebURL: String = "http://192.168.137.184"
//VARIABLES FOR TIMER FUNCTIONS
var TimerOn3: Bool = false
var TimerOn4: Bool = false
var timer3 = Timer()
var Duration3 = 0
//VARIABLE SPEED FUNCTION
var State = 0
var velocity: Double = 0
var probability: Double = 0
var counter: Double = 0
var currentState = ["Press Ready","Preparing"]
//VARIABLE FOR LOOP_GET_REQUEST
var timer1 = Timer()
var GetRequest: Bool = false
let sign1 = CharacterSet (charactersIn: "<")
var Game: NSString?
var Player4: NSString?
//VARIABLES FOR TIMED FUNC
var TimerFunc: Bool = true
var check: Bool = false
var timer2 = Timer()
var colors = [UIColor.green, UIColor.red]
//VARIABLES DISPATCH_QUEUE
var DispatchBool1: Bool = false
var DispatchBool2: Bool = true
//VARIABLES SECONFLAP FUNCTION
var lap2: Bool = false
var clock = Timer()
var timing = 0
override func viewDidLoad() {
super.viewDidLoad()
Speed()
}
//FUNCTION: CREATE GET REQUEST (in the context of the game it acts as a POST request)
func PostRequest(on: Bool){
timer4 = Timer.scheduledTimer(withTimeInterval: 2, repeats: true) {_ in
if self.PostType == false {
let url = URL(string:"http://192.168.137.184/get?player1=ready")!
var requestPost = URLRequest(url:url)
self.WebUrl.loadRequest(requestPost)
}
else if self.PostType == true {
let url = URL(string:"http://192.168.137.184/get?player1=\(self.velocity)")!
var requestPost = URLRequest(url:url)
self.WebUrl.loadRequest(requestPost)
}
}
}
//SYNCHRONOUS FUNCTION: SEND GET REQUEST
func LoopGetRequest(on: Bool) {
if GetRequest == true {
timer1 = Timer.scheduledTimer(withTimeInterval: 2, repeats: true) {_ in
let url = URL (string: self.WebURL)
guard let requestUrl = url else {fatalError()}
var request = URLRequest(url:requestUrl)
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) {(data, response, error) in
if let error = error {
print("Error took place: \(error)")
return
}
if let response = response as? HTTPURLResponse {
print("Response HTTP status code: \(response.statusCode)")
}
if let data = data, let dataString = String(data: data, encoding: .utf8) {
print("Response data string: \n \(dataString)")
let scanner1 = Scanner(string: dataString)
scanner1.charactersToBeSkipped = self.sign1
scanner1.scanUpToCharacters(from: self.sign1, into: &self.Game)
if self.Game == "Game:1" {
scanner1.scanUpToCharacters(from: self.sign1, into: &self.Player4)
scanner1.scanUpToCharacters(from: self.sign1, into: &self.Player4)
scanner1.scanUpToCharacters(from: self.sign1, into: &self.Player4)
scanner1.scanUpToCharacters(from: self.sign1, into: &self.Player4)
if self.Player4 == "db>Player4:0"{
print("lap 1")
self.PostType = true
self.check = true
self.RandomColor()
self.TimedFunction(on: self.TimerFunc)
self.TimerOn3 = true
self.Timer3(on: self.TimerOn3)
}
else if self.Player4 == "db>Player4:1"{
print("lap 2")
self.lap2 = true
self.SecondLap(on: self.lap2)
self.TimerFunc = false
self.timer2.invalidate()
self.check = false
}
else if self.Player4 == "db>Player4:2"{
print("reset")
self.Reset(sender: self.GoBack)
}
}
}
}
task.resume()
}
}
}
//SYNCHRONOUS FUNCTION: SET RANDOM_COLOR AND DISPATCH_QUEUE FUNCTIONS
func TimedFunction (on: Bool){
if on {
if check == true {
timer2 = Timer.scheduledTimer(withTimeInterval: 3, repeats: true) {_ in
if (self.Left_button.backgroundColor != UIColor.red) || (self.Right_button.backgroundColor != UIColor.red) {
self.Left_button.backgroundColor = self.colors[1]
self.Right_button.backgroundColor = self.colors[1]
}
self.RandomColor()
}
}
}
else {
timer2.invalidate()
}
}
//FUNCTION: GENERATE RANDOM NUMBER, CHANGE COLOR OF CORRESPONDING BUTTON
func RandomColor(){
DispatchBool1 = true
DispatchBool2 = true
dispatchQueue(on: DispatchBool1)
let number = Int.random(in: 1..<3)
if number == 1 {
self.Left_button.backgroundColor = colors[0]
}
else {
self.Right_button.backgroundColor = colors[0]
}
}
//SYNCHRONOUS FUNCTION: SET TIMER ON
func Timer3 (on: Bool){
if on{
timer3 = Timer.scheduledTimer(withTimeInterval: 1, repeats: true, block: {[weak self] (_) in
guard let clock3 = self else {return}
clock3.Duration3 += 1
clock3.timer_label.text = String(clock3.Duration3)
})
}
else {
timer3.invalidate()
}
}
//ASYNCHRONOUS FUNCTION: CHECK AFTER 5 SEC FROM START TIME BUTTON'S COLOR
func dispatchQueue (on: Bool){
let seconds: Double = 5
if DispatchBool2 == true {
DispatchQueue.main.asyncAfter(deadline: .now() + seconds) {
if (self.Left_button.backgroundColor != UIColor.red) || (self.Right_button.backgroundColor != UIColor.red) {
self.Left_button.backgroundColor = self.colors[1]
self.Right_button.backgroundColor = self.colors[1]
}
return
}
}
}
//FUNCTION: DISPLAY AND CALCULATE SPEED
func Speed() {
if TimerOn3 == true {
if Duration3 < 3 {
self.speed_label.text = " "
}
else {
probability = (Double(Duration3 / 3))
velocity = (counter/probability)
velocity = round(10*velocity)
if velocity < 40 {
self.speed_label.text = "🔴"
}
else if (40 < velocity) && (velocity < 60) {
self.speed_label.text = "🔴🔴"
}
else {
self.speed_label.text = "🔴🔴🔴"
}
}
}
else {
if State == 0 {
self.speed_label.text = currentState[0]
}
else if State == 1 {
self.speed_label.text = currentState[1]
}
}
}
//FUNCTION: IF IN 1º ROUND AND IF GREEN COUNTER +=1, IF IN 2º COUNTER =+ 1
@IBAction func LeftClick(sender: UIButton){
if Left_button.backgroundColor == UIColor.green {
counter+=1
DispatchBool1 = false
DispatchBool2 = false
}
}
//FUNCTION: IF IN 1º ROUND AND IF GREEN COUNTER +=1, IF IN 2º COUNTER =+ 1
@IBAction func RightClick (sender: UIButton){
counter+=1
DispatchBool1 = false
DispatchBool2 = false
}
//FUNCTION: SEND POST REQUEST WITH PLAYER#=READY
@IBAction func Ready(sender: UIButton){
State = 1
GetRequest = true
PostRequest(on: PostRequestBool)
LoopGetRequest(on: GetRequest)
}
//FUNCTION: RESET ALL VARIABLES, GO BACK TO MAIN MENU
@IBAction func GoBack(sender: UIButton){
Reset(sender: GoBack)
}
// FUNC: CHANGE COLOR OF BOTH BUTTONS DURING LAP 2
func SecondLap (on: Bool){
clock = Timer.scheduledTimer(withTimeInterval: 1, repeats: true, block: {[weak self] (_) in
guard let timepassing = self else {return}
timepassing.timing += 1
if self!.timing % 2 == 0 {
self?.Left_button.backgroundColor = UIColor.green
self?.Right_button.backgroundColor = UIColor.green
}
else {
self?.Left_button.backgroundColor = UIColor.red
self?.Right_button.backgroundColor = UIColor.red
}
})
}
//FUNCTION: RESET VARIABLES, GO BACK TO MAIN MENU
func Reset(sender: UIButton) {
State = 0
timer1.invalidate()
timer3.invalidate()
timer4.invalidate()
clock.invalidate()
TimerOn3 = false
lap2 = false
Duration3 = 0
counter = 0
DispatchBool1 = false
DispatchBool2 = false
timer_label.text = "0"
speed_label.text = " "
PostType = false
dismiss(animated: true, completion: nil)
}
}
| [
-1
] |
b426c98f2d709401e6848b4893457b3635891555 | 471d208951010d9bcf786de71eb9b481f40e4421 | /Stackview/Stack Exchange API/Models/ResponseWrapper.swift | f18936013745e2351211d4f8828ed8e8c5ae4938 | [] | no_license | sergiymomot/Stackviewer-App-Project | 08d7ecd0b682687fd35f197eb8c2b6b6b5dc1569 | 047da685012e9a9e6f97324c4f4e0290c1db17eb | refs/heads/master | 2021-01-19T16:02:35.733196 | 2017-11-07T19:34:24 | 2017-11-07T19:34:24 | 100,984,147 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 905 | swift | //
// ResponseWrapper.swift
// Stack Exchange API Swift
//
// Created by Sergiy Momot on 8/14/17.
// Copyright © 2017 Sergiy Momot. All rights reserved.
//
import Foundation
struct ResponseWrapper: Decodable {
let backoffTime: Int?
let errorID: Int?
let errorMessage: String?
let errorName: String?
let hasMore: Bool?
let page: Int?
let pageSize: Int?
let quotaMax: Int?
let quotaRemaining: Int?
let total: Int?
let type: String?
private enum CodingKeys: String, CodingKey {
case backoffTime = "backoff"
case errorID = "error_id"
case errorMessage = "error_message"
case errorName = "error_name"
case hasMore = "has_more"
case page
case pageSize = "page_size"
case quotaMax = "quota_max"
case quotaRemaining = "quota_remaining"
case total
case type
}
}
| [
-1
] |
cec695da20d5b2784a4de497b37ef0a2867bf701 | d7fa2c2e02ae03d038a24832d75f10d911a34ac6 | /HappyMap/MasterViewController.swift | ece84060f757b30fd9660e1f9f48e2eaa4667a21 | [] | no_license | lu4jay/HappyMap | de105e9459a0ade2b94e6ab8c1a363412106d18b | 90a88563cb5ef678b54ad72b044141cbf66f2dc8 | refs/heads/master | 2020-07-29T19:40:14.095550 | 2019-09-21T08:31:56 | 2019-09-21T08:31:56 | 209,935,748 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 985 | swift | //
// MasterViewController.swift
// HappyMap
//
// Created by apple on 2019/9/21.
// Copyright © 2019 apple. All rights reserved.
//
import UIKit
class MasterViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 0
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
return nil
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
1991005756e0983124403bab16a878f227ff10fc | 91e14977f869a44478e805a7c1292004b0f86b43 | /DangerTestTests/Specs/TaskManagerSpec.swift | def41fc3e5a021fe89d52a3d0f5db658e621801b | [] | no_license | KaMagno/TestingDanger | 9c1081d3eaae9cb0ea51e224090a51b71a101386 | 2624b53fb690c533b45fb0229d88a7e2a824dac9 | refs/heads/master | 2020-07-13T23:48:07.795463 | 2019-09-12T19:01:09 | 2019-09-12T19:01:09 | 205,181,839 | 0 | 0 | null | 2019-09-11T20:58:58 | 2019-08-29T14:25:11 | Swift | UTF-8 | Swift | false | false | 1,163 | swift | //
// DangerTestTests.swift
// DangerTestTests
//
// Created by kaique.magno.santos on 23/08/19.
// Copyright © 2019 kaique.magno.santos. All rights reserved.
//
import XCTest
@testable import DangerTest
class DangerTestTests: XCTestCase {
let taskManagerMock = TaskManagerMock()
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
taskManagerMock.tasks = [Task]()
}
func testSaveATask() {
let date = Date()
let task = Task(id: "1234", creationDate: date, title: "Testing", isCompleted: false)
taskManagerMock.save(task: task)
XCTAssert(taskManagerMock.tasks.count > 0)
XCTAssertEqual(task, taskManagerMock.tasks.first!)
}
func testDelete() {
let date = Date()
let task = Task(id: "1234", creationDate: date, title: "Testing", isCompleted: false)
taskManagerMock.tasks.append(task)
XCTAssertNoThrow(try taskManagerMock.delete(task: task))
XCTAssertEqual(0, taskManagerMock.tasks.count)
}
}
| [
-1
] |
e9526ef28b9183854a659dd3415b2e0ddd5f3a70 | 83dabf33946177b81c9293a119024b4911a4eb89 | /Dashboard/Core/Extensions/String+Extra.swift | 108a9f481b6e71ebdbe29be3f22c3a86bc55218f | [] | no_license | MykolaDenysyuk/dashboard | 132df17041095bbe5e5a77aa86f44dac33e72d6c | 4c494902aede9b5b8657ff73335fddd0907346bf | refs/heads/master | 2021-01-09T06:26:18.285281 | 2017-02-07T13:27:20 | 2017-02-07T13:27:20 | 80,987,800 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 435 | swift | //
// String+Extra.swift
// Dashboard
//
// Created by Mykola Denysyuk on 2/6/17.
// Copyright © 2017 Mykola Denysyuk. All rights reserved.
//
import Foundation
extension String {
// Localizable
public var localized:String {
return localized()
}
public func localized(_ comment:String? = nil) -> String {
return NSLocalizedString(self, comment: comment ?? "\(#function)")
}
}
| [
-1
] |
f7a0bb37b9a4ef208b1e30ddc25e0d2a7b9c8088 | 45c00dbe941d32fa4038efc0da3b95602d2aae13 | /MediaSearch/Resources/MediaListTableViewController.swift | 7d6cd0bb2a2546ffc87850394eee455be78a2f8f | [] | no_license | canderson84097/PersonalProject | fcc2a849d41eeac180c3477a1e215d64ae9345fa | adf9e698214b8ef9d92c34284f4adb84c92af85a | refs/heads/master | 2020-12-02T22:01:16.888494 | 2020-01-08T23:06:43 | 2020-01-08T23:06:43 | 231,138,935 | 0 | 0 | null | 2020-01-08T23:06:45 | 2019-12-31T19:35:49 | Swift | UTF-8 | Swift | false | false | 7,105 | swift | ////
//// MainTableViewController.swift
//// AppleSearch
////
//// Created by Chris Anderson on 11/21/19.
//// Copyright © 2019 Renaissance Apps. All rights reserved.
////
//
//import UIKit
//
//class MediaListTableViewController: UITableViewController, UISearchBarDelegate, ItemTableViewCellDelegate, RecItemsTableViewControllerDelegate {
//
// // MARK: - Outlets
//
// @IBOutlet weak var itemSearchBar: UISearchBar!
// @IBOutlet weak var itemSegmentedControl: UISegmentedControl!
//
// // MARK: - Properties
//
// var mediaItems: [MediaItem] = []
//
// // MARK: - Life Cycle Methods
//
// override func viewDidLoad() {
// super.viewDidLoad()
// itemSearchBar.delegate = self
// setUpUI()
// }
//
// // MARK: - Actions
//
// func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
// guard let searchText = itemSearchBar.text, !searchText.isEmpty else { return }
// DispatchQueue.main.async {
// var itemType: MediaItem.ItemType {
// switch self.itemSegmentedControl.selectedSegmentIndex {
// case 0:
// return .movie
// case 1:
// return .tvShow
// case 2:
// return .music
// case 3:
// return .podcast
// case 4:
// return .ebook
// default:
// return .movie
// }
// }
// MediaItemController.shared.getItemsOf(type: itemType, searchText: searchText) { (items) in
// if items.isEmpty {
// self.presentInvalidSearch()
// } else if itemType == .tvShow {
// let sortedItems = items.sorted(by: { $0.releaseDate < $1.releaseDate })
// self.mediaItems = sortedItems
// self.updateViews()
// }
// else {
// self.mediaItems = items
// self.updateViews()
// }
// }
// }
// }
//
// @IBAction func signOutButtonTapped(_ sender: Any) {
// signOutUser()
// UserController.shared.currentUser = nil
// }
//
// // MARK: - Table View Data Source
//
// override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
//
// return mediaItems.count
// }
//
// override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
//
// guard let cell = tableView.dequeueReusableCell(withIdentifier: "mediaItemCell", for: indexPath) as? ItemTableViewCell else { return UITableViewCell() }
//
// let mediaItem = mediaItems[indexPath.row]
// cell.item = mediaItem
// cell.delegate = self
// return cell
// }
//
// // MARK: - Alerts
//
// func presentInvalidSearch() {
// DispatchQueue.main.async {
// let alertController = UIAlertController(title: "Invalid Search", message: "Invalid search or media type", preferredStyle: .alert)
// let okayAction = UIAlertAction(title: "Okay", style: .default) { (_) in
// self.itemSearchBar.text = ""
// }
// alertController.addAction(okayAction)
// self.present(alertController, animated: true)
// }
// }
//
// override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
//
// if itemSegmentedControl.selectedSegmentIndex == 1 || itemSegmentedControl.selectedSegmentIndex == 2 {
// performSegue(withIdentifier: "toTrackListVC", sender: self)
// } else {
// performSegue(withIdentifier: "toItemDetailVC", sender: self)
// }
// }
//
// // MARK: - Custom Methods
//
// func updateViews() {
// DispatchQueue.main.async {
// self.tableView.reloadData()
// self.itemSearchBar.text = ""
// }
// }
//
// func setUpUI() {
// itemSearchBar.layer.backgroundColor = UIColor.cyan.cgColor
// let textFieldInsideSearchBar = itemSearchBar.value(forKey: "searchField") as? UITextField
// textFieldInsideSearchBar?.textColor = .black
// }
//
// func signOutUser() {
// DispatchQueue.main.async {
// self.navigationController?.dismiss(animated: true)
// }
// }
//
// func searchRecItem(recItem: RecItem) {
// var type: MediaItem.ItemType {
// switch recItem.type {
// case "movie":
// return MediaItem.ItemType.movie
// case "show":
// return MediaItem.ItemType.tvShow
// case "music":
// return MediaItem.ItemType.music
// case "podcast":
// return MediaItem.ItemType.podcast
// case "book":
// return MediaItem.ItemType.ebook
// default:
// return MediaItem.ItemType.movie
// }
// }
// let searchTerm = recItem.title
// MediaItemController.shared.getItemsOf(type: type, searchText: searchTerm) { (items) in
// self.mediaItems = items
// self.updateViews()
// DispatchQueue.main.async {
// self.itemSearchBar.text = recItem.title
// }
// }
// }
//
//
//
// func favoriteButtonPressed(mediaItem: MediaItem, title: String) {
// DispatchQueue.main.async {
// UserController.shared.favorites.insert(mediaItem)
// UserController.shared.saveToPersistentStore()
// let storyboard = UIStoryboard(name: "RecommendedItems", bundle: nil)
// guard let viewController = storyboard.instantiateViewController(identifier: "recItemsTVC") as? RecItemsTableViewController else { return }
// viewController.searchTerm = title
// viewController.delegate = self
// self.present(viewController, animated: true)
// }
// }
//
// // MARK: - Navigation
//
// override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// if segue.identifier == "toItemDetailVC" {
// guard let indexPath = tableView.indexPathForSelectedRow,
// let destinationVC = segue.destination as? ItemDetailViewController else { return }
// let chosenItem = mediaItems[indexPath.row]
// destinationVC.item = chosenItem
// } else if segue.identifier == "toTrackListVC" {
// guard let indexPath = tableView.indexPathForSelectedRow,
// let destinationVC = segue.destination as? TrackListTableViewController else { return }
// let chosenItem = mediaItems[indexPath.row]
// destinationVC.trackTypeString = itemSegmentedControl.selectedSegmentIndex == 1 ? "tvEpisode" : "musicTrack"
// destinationVC.collectionItem = chosenItem
// }
// }
//}
| [
-1
] |
686f141447eb1e206d1a9e83b47a00055223e760 | ec5caab93be8f4ca0d7e17a1f92e2200cf177335 | /challenges/Challenge76/Package.swift | 7d50ec6b2d41e67b3f8c1ef2b464eb5fdbe4bf71 | [] | no_license | cham-s/Daily-Swift-Coding-Challenge | bb7372061a2dd02082079782da635bcf8c06397b | e3eca17aef51f4377f19cf8ddfccdc389affc9c5 | refs/heads/master | 2020-04-07T20:58:46.573299 | 2019-05-29T20:37:34 | 2019-05-29T20:37:34 | 158,709,780 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,037 | swift | // swift-tools-version:4.2
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "Challenge76",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "Challenge76",
targets: ["Challenge76"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "Challenge76",
dependencies: []),
.testTarget(
name: "Challenge76Tests",
dependencies: ["Challenge76"]),
]
)
| [
415748,
415758,
237593,
323612,
217118,
372779,
102447,
321584,
213040,
385074,
321590,
415804,
321598,
378952,
168017,
254035,
376917,
385112,
395359,
139366,
258151,
362606,
2161,
192626,
2164,
2165,
2172,
2173,
2174,
2177,
2179,
2199,
2204,
2205,
393379,
2212,
260266,
315563,
256188,
295100,
315584,
389316,
315591,
385237,
266456,
133337,
266463,
317666,
411879,
194808,
379128,
205050,
395512,
356604,
178430,
192774,
338189,
338192,
311584,
342306,
334115,
248106,
325932,
377150,
250175,
344393,
416093,
246116,
151919,
362866,
299394,
420230,
43400,
373131,
215442,
393626,
35242,
258475,
305585,
235957,
201144,
344514,
254407,
432587,
184787,
338388,
262620,
416228,
145899,
164333,
340484,
154138,
33336,
162361,
242239,
377408,
389700,
201285,
389705,
332367,
295520,
373359,
346745,
160385,
357000,
258708,
330389,
264857,
176794,
311962,
248488,
258733,
336559,
225979,
350908,
225985,
211655,
256720,
223959,
340697,
264939,
353017,
393979,
162564,
379673,
348960,
201507,
328500,
244555,
111456,
211813,
357222,
260978,
189309,
269190,
390023,
355224,
355228,
355233,
222123,
355243,
158640,
326591,
340945,
363478,
347124,
324608,
369691,
201762,
224295,
201769,
140330,
201771,
201773,
201775,
201777,
396342,
173122,
339016,
341075,
248917,
296024,
384092,
160864,
392291,
261220,
410724,
345190,
205930,
66668,
62572,
253045,
273525,
347258,
271482,
201853,
339072,
160898,
339075,
201858,
339078,
201866,
339087,
339090,
339093,
162966,
380058,
44192,
222381,
373948,
222400,
357568,
66762,
421067,
257228,
66765,
265424,
66770,
177384,
374022,
343308,
136461,
249101,
347417,
150811,
259360,
52520,
259368,
273707,
347440,
384329,
134482,
251240,
316779,
21871,
337271,
357752,
249211,
259455,
214412,
349583,
253341,
398776,
329151,
372174,
380372,
208354,
241122,
200181,
411133,
304657,
214553,
192028,
159263,
425505,
402986,
159303,
327255,
374373,
194154,
333424,
431731,
298612,
339573,
204420,
317062,
204425,
323211,
222881,
388788,
108215,
173752,
153273,
384704,
159439,
253649,
339667,
366292,
409324,
337650,
315123,
360178,
388856,
425724,
388863,
425728,
388865,
388867,
388868,
153349,
388870,
315150,
341807,
388918,
255800,
388922,
388930,
384848,
339800,
253789,
341853,
253793,
198498,
431973,
253801,
253805,
1905,
399234,
255882,
1945,
1946,
1947,
321435,
1948,
1950,
1952,
1955,
1956,
1957,
1959,
1960,
178087,
1963,
1975,
1976,
225211,
1996,
24525,
1998,
2006,
45015,
2008,
2011,
319457,
380902,
247797
] |
a03b4b3b4548b166002ea5b56e8893ed9fccd35e | 6f5ca33106892fca7e671386d38924874493a475 | /Assignment/Controller/SetTimeAlarmVC.swift | c4ade1ee325b802bc0bf98934aa2705d59ca78ee | [] | no_license | Cooldownn/Assignment_iOS | 9540e7ae178d828056f49d6132bc1e4da7407b23 | 0c3169985480ce3eea5165d654c497b646f09014 | refs/heads/master | 2020-03-30T16:49:04.772522 | 2018-10-07T09:15:25 | 2018-10-07T09:15:25 | 151,428,375 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 8,212 | swift | //
// SetTimeAlarmVC.swift
// Assignment
//
// Created by Cooldown on 21/8/18.
// Copyright © 2018 Cooldown. All rights reserved.
//
import UIKit
import Foundation
import MediaPlayer
class SetTimeAlarmVC: UIViewController, UITableViewDelegate, UITableViewDataSource{
@IBOutlet weak var datePicker: UIDatePicker!
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var methodLabel: UILabel!
var alarmSet: AlarmDelegate = AlarmSet()
var alarmModel: Alarms = Alarms()
var globalVar: GlobalVariable!
var enabled: Bool!
var chooseMethod: [Int] = []
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(_ animated: Bool) {
alarmModel=Alarms()
tableView.reloadData()
super.viewWillAppear(animated)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
@IBAction func saveEditAlarm(_ sender: AnyObject) {
let date = AlarmSet.correctSecondComponent(date: datePicker.date)
let index = globalVar.curCellIndex
var tempAlarm = Alarm()
if methodLabel.text == "Taking a Picture"{
tempAlarm.chooseMethod.append(1)
}
else if methodLabel.text == "Playing TicTacToe"{
tempAlarm.chooseMethod.append(2)
}
else if methodLabel.text == "Solving math problems"{
tempAlarm.chooseMethod.append(3)
}
tempAlarm.date = date
tempAlarm.label = globalVar.label
tempAlarm.enabled = true
tempAlarm.mediaLabel = globalVar.mediaLabel
tempAlarm.mediaID = globalVar.mediaID
tempAlarm.repeatWeekdays = globalVar.repeatWeekdays
tempAlarm.uuid = UUID().uuidString
if globalVar.isEditMode {
alarmModel.alarms[index] = tempAlarm
}
else {
alarmModel.alarms.append(tempAlarm)
}
self.performSegue(withIdentifier: Identifier.saveSegueIdentifier, sender: self)
}
func numberOfSections(in tableView: UITableView) -> Int {
// Return the number of sections.
if globalVar.isEditMode {
return 2
}
else {
return 1
}
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 {
return 3
}
else {
return 1
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCell(withIdentifier: Identifier.settingIdentifier)
if(cell == nil) {
cell = UITableViewCell(style: UITableViewCellStyle.value1, reuseIdentifier: Identifier.settingIdentifier)
}
if indexPath.section == 0 {
if indexPath.row == 0 {
cell!.textLabel!.text = "Repeat"
cell!.detailTextLabel!.text = WeekdaysVC.repeatText(weekdays: globalVar.repeatWeekdays)
cell!.accessoryType = UITableViewCellAccessoryType.disclosureIndicator
}
else if indexPath.row == 1 {
cell!.textLabel!.text = "Label"
cell!.detailTextLabel!.text = globalVar.label
cell!.accessoryType = UITableViewCellAccessoryType.disclosureIndicator
}
else if indexPath.row == 2 {
cell!.textLabel!.text = "Sound"
cell!.detailTextLabel!.text = globalVar.mediaLabel
cell!.accessoryType = UITableViewCellAccessoryType.disclosureIndicator
}
// else if indexPath.row == 3 {
// cell!.textLabel!.text = "Choose Alarm Method"
// cell!.detailTextLabel!.text = SetMethodAlarmVC.chooseMethod(position: segueInfo.chooseMethod)
// cell!.accessoryType = UITableViewCellAccessoryType.disclosureIndicator
// }
}
return cell!
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let cell = tableView.cellForRow(at: indexPath)
if indexPath.section == 0 {
switch indexPath.row{
case 0:
performSegue(withIdentifier: Identifier.weekdaysSegueIdentifier, sender: self)
cell?.setSelected(true, animated: false)
cell?.setSelected(false, animated: false)
case 1:
performSegue(withIdentifier: Identifier.labelSegueIdentifier, sender: self)
cell?.setSelected(true, animated: false)
cell?.setSelected(false, animated: false)
case 2:
performSegue(withIdentifier: Identifier.soundSegueIdentifier, sender: self)
cell?.setSelected(true, animated: false)
cell?.setSelected(false, animated: false)
// case 3:
// performSegue(withIdentifier: Id.alarmMethodIdentifier, sender: self)
// cell?.setSelected(true, animated: false)
// cell?.setSelected(false, animated: false)
default:
break
}
}
else if indexPath.section == 1 {
//delete alarm
alarmModel.alarms.remove(at: globalVar.curCellIndex)
performSegue(withIdentifier: Identifier.saveSegueIdentifier, sender: self)
}
}
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
if segue.identifier == Identifier.saveSegueIdentifier {
let dist = segue.destination as! AlarmVC
let cells = dist.tableView.visibleCells
for cell in cells {
let sw = cell.accessoryView as! UISwitch
if sw.tag > globalVar.curCellIndex
{
sw.tag -= 1
}
}
alarmSet.reSchedule()
}
else if segue.identifier == Identifier.soundSegueIdentifier {
let vc = segue.destination as! SoundBrowsingVC
vc.mediaID = globalVar.mediaID
vc.mediaLabel = globalVar.mediaLabel
}
else if segue.identifier == Identifier.labelSegueIdentifier {
let vc = segue.destination as! AlarmNameVC
vc.label = globalVar.label
}
else if segue.identifier == Identifier.weekdaysSegueIdentifier {
let vc = segue.destination as! WeekdaysVC
vc.weekdays = globalVar.repeatWeekdays
}
// else if segue.identifier == Id.alarmMethodIdentifier {
// let dist = segue.destination as! SetMethodAlarmVC
//// dist.setTimeAlarmVC = self
// dist.position = segueInfo.chooseMethod
// }
}
@IBAction func unwindFromLabelEditView(_ segue: UIStoryboardSegue) {
let src = segue.source as! AlarmNameVC
globalVar.label = src.label
}
@IBAction func unwindFromWeekdaysView(_ segue: UIStoryboardSegue) {
let src = segue.source as! WeekdaysVC
globalVar.repeatWeekdays = src.weekdays
}
@IBAction func unwindFromMediaView(_ segue: UIStoryboardSegue) {
let src = segue.source as! SoundBrowsingVC
globalVar.mediaLabel = src.mediaLabel
globalVar.mediaID = src.mediaID
}
// @IBAction func unwindFromMethod(_ segue: UIStoryboardSegue) {
// let src = segue.source as! SetMethodAlarmVC
// segueInfo.chooseMethod = src.position
// }
@IBAction func chooseMethod(_ sender: Any) {
let vc = storyboard?.instantiateViewController(withIdentifier: "chooseMethodVC") as! SetMethodAlarmVC
vc.setTimeAlarmVC = self
self.navigationController?.pushViewController(vc, animated: true)
}
}
| [
-1
] |
390dc8b283d08d0af648861f25f2069914896a7e | 1646bfcd046cdccd7886569ed3152cc9a843699a | /pruebaGitHubTests/pruebaGitHubTests.swift | b7d98602f4e700a4ac001ad3039a24153d6a5ca9 | [] | no_license | calzonzote/test | f7d4821d6a294ba329ff457d5d7feea4410566d9 | 52c528761b7db95ea7e4ce969e94005df54cd599 | refs/heads/master | 2021-01-10T12:59:55.215064 | 2016-02-03T20:33:46 | 2016-02-03T20:33:46 | 51,027,671 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 997 | swift | //
// pruebaGitHubTests.swift
// pruebaGitHubTests
//
// Created by Rubén Gómez on 2/3/16.
// Copyright © 2016 Rubén Gómez. All rights reserved.
//
import XCTest
@testable import pruebaGitHub
class pruebaGitHubTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock {
// Put the code you want to measure the time of here.
}
}
}
| [
313357,
305179,
145435,
98333,
278558,
307231,
313375,
317467,
241692,
239650,
102437,
292902,
329765,
354343,
354345,
227370,
360491,
223274,
315434,
325674,
282672,
241716,
276534,
180280,
288828,
159807,
288833,
288834,
286788,
280649,
315465,
311372,
311374,
354385,
196691,
223316,
315476,
223318,
329814,
307289,
288857,
227417,
354393,
200794,
194656,
309345,
280675,
227428,
280677,
276582,
43110,
321637,
329829,
131178,
276589,
278638,
227439,
319598,
288879,
204916,
131189,
223350,
131191,
233590,
288889,
280694,
131198,
292992,
141450,
215178,
311435,
319629,
311438,
235662,
325776,
276627,
276632,
284826,
196773,
299174,
153776,
239793,
129203,
299187,
131256,
184505,
227513,
295098,
280762,
223419,
299198,
180408,
258239,
280768,
301251,
309444,
227524,
276682,
321745,
280795,
194782,
301279,
311519,
356576,
280802,
346346,
286958,
125169,
233715,
157944,
211193,
227578,
184570,
168188,
327929,
184575,
194820,
321800,
278797,
338197,
309529,
278810,
282909,
299293,
227616,
282913,
233762,
278816,
305440,
211235,
282919,
151847,
262450,
332083,
332085,
280887,
332089,
315706,
282939,
287041,
287043,
139589,
227654,
311621,
280902,
182597,
227658,
276813,
282960,
6481,
6482,
325968,
366929,
289110,
168281,
6489,
332123,
334171,
323935,
106847,
332127,
354655,
276835,
321894,
416104,
280939,
276847,
285040,
242033,
313713,
199029,
291192,
315773,
211326,
291198,
280961,
332167,
242058,
311691,
227725,
240016,
108944,
178578,
190871,
291224,
293274,
285084,
317852,
242078,
141728,
61857,
285090,
61859,
315810,
289189,
315811,
381347,
108972,
278961,
299441,
278965,
293303,
276920,
283064,
278970,
293306,
33211,
276925,
311738,
293310,
291265,
278978,
291267,
127427,
127428,
283075,
311745,
278989,
281037,
317901,
281040,
278993,
289232,
369116,
285150,
287198,
279008,
227809,
358882,
160225,
279013,
227813,
127465,
279018,
311786,
330218,
279022,
291311,
309744,
281072,
109042,
319987,
279029,
233978,
279039,
301571,
291333,
276998,
342536,
287241,
279050,
186893,
303631,
283153,
303636,
279062,
223767,
289304,
223769,
279065,
291358,
180771,
293419,
244269,
283184,
234036,
289332,
277048,
338490,
115270,
293448,
55881,
377418,
281166,
295519,
66150,
277094,
244327,
277101,
295536,
287346,
277111,
287352,
301689,
244347,
279164,
291454,
189057,
184962,
303746,
152203,
330379,
277133,
133774,
311949,
316049,
330387,
330388,
117397,
111253,
230040,
295576,
289434,
111258,
221852,
207732,
279206,
285353,
295599,
205487,
303793,
285361,
299699,
293556,
342706,
166582,
289462,
299700,
164533,
109241,
285371,
285372,
285373,
285374,
287422,
303803,
66242,
248517,
199366,
287433,
363211,
154316,
225997,
242386,
226004,
203477,
279252,
226007,
289502,
299746,
226019,
295652,
285415,
234217,
342762,
277227,
230125,
289518,
299759,
209783,
230134,
199414,
228088,
234234,
221948,
279294,
205568,
242433,
299776,
234241,
285444,
295682,
209670,
291592,
322313,
226058,
234250,
234253,
326414,
312079,
322319,
295697,
166676,
291604,
234263,
207640,
234268,
291612,
293664,
281377,
326433,
234277,
262951,
279336,
289576,
234283,
312108,
295724,
234286,
285487,
152365,
234289,
262962,
301871,
318252,
234294,
230199,
293693,
162621,
234301,
289598,
281408,
295746,
162626,
277316,
318278,
234311,
234312,
299849,
234317,
277325,
293711,
201549,
234323,
281427,
353109,
234326,
281433,
230234,
234331,
322395,
301918,
279392,
109409,
349026,
303972,
234340,
234343,
177001,
234346,
201577,
242541,
400239,
330609,
234355,
174963,
109428,
295798,
277366,
234360,
279417,
209785,
177019,
234361,
277370,
234366,
234367,
291712,
158593,
234372,
226181,
113542,
213894,
226184,
277381,
228234,
308107,
109447,
416646,
228233,
316298,
56208,
308112,
295824,
234386,
234387,
236428,
234392,
209817,
289690,
324507,
127902,
234400,
279456,
234404,
283558,
310182,
289703,
234409,
240552,
275371,
353195,
236461,
293806,
316333,
234419,
316343,
234425,
289722,
234427,
230332,
287677,
234430,
289727,
353215,
234436,
234438,
279498,
52172,
234444,
234445,
183248,
234451,
234454,
304087,
234457,
234463,
234466,
277479,
234472,
234473,
52200,
326635,
203757,
304110,
234477,
289774,
234482,
287731,
277492,
314355,
316405,
295927,
240630,
312314,
314362,
328700,
234498,
328706,
234500,
277509,
277510,
293893,
134150,
230410,
234506,
330763,
320527,
238610,
277523,
277524,
308243,
293910,
230423,
316437,
197657,
281626,
281625,
175132,
326685,
234531,
300068,
234534,
310317,
234542,
238639,
234548,
322612,
238651,
234555,
277563,
302139,
230463,
234560,
21569,
207938,
234565,
214086,
234569,
300111,
234577,
296019,
339030,
234583,
234584,
353367,
277597,
281697,
230499,
281700,
314467,
300135,
322663,
228458,
207979,
281706,
275565,
318572,
316526,
15471,
156785,
312434,
275571,
353397,
300150,
300151,
234616,
398457,
337017,
285820,
234622,
300158,
150657,
285828,
279685,
285830,
302213,
253063,
234632,
275591,
228491,
228493,
177296,
234642,
308372,
326804,
296086,
238743,
187544,
119962,
119963,
296092,
283802,
285851,
300188,
234656,
330913,
306338,
234659,
234663,
275625,
300202,
300201,
306346,
279728,
238769,
226481,
294074,
208058,
277690,
230588,
228542,
228540,
283840,
302274,
279747,
283847,
353479,
353481,
283852,
279760,
290000,
189652,
189653,
148696,
333022,
304351,
363744,
310497,
195811,
298212,
304356,
290022,
234733,
298221,
279792,
353523,
298228,
204022,
234742,
228600,
216315,
208124,
292091,
228609,
320770,
292107,
251153,
177428,
245019,
126237,
115998,
277792,
130338,
339234,
199971,
304421,
333090,
130343,
277800,
113966,
279854,
226608,
298291,
171317,
300343,
318775,
286013,
333117,
226624,
286018,
113987,
15686,
300359,
226632,
230729,
294218,
312648,
177484,
222541,
296270,
296273,
331090,
120148,
314709,
314710,
357719,
283991,
134491,
316765,
218462,
224606,
222559,
142689,
230756,
281957,
163175,
333160,
281962,
230765,
306542,
296303,
284014,
327025,
249204,
249205,
181625,
111993,
290169,
306559,
224640,
306560,
148867,
294275,
298374,
281992,
142729,
368011,
304524,
296335,
230799,
112017,
112018,
306579,
234898,
224661,
318875,
310692,
282022,
279974,
282024,
241066,
316842,
310701,
314798,
286129,
279989,
296375,
228795,
292283,
296387,
292292,
415171,
163269,
306631,
296392,
300489,
296391,
300487,
310732,
280013,
312782,
284107,
302540,
64975,
310736,
222675,
284116,
327121,
228827,
286172,
226781,
280032,
144867,
310757,
316902,
103909,
245223,
280041,
296425,
191981,
282096,
296433,
321009,
329200,
306677,
191990,
280055,
300536,
290300,
290301,
300542,
286205,
296448,
230913,
306692,
306693,
292356,
192010,
296461,
149007,
323087,
65041,
323089,
282136,
204313,
282141,
187938,
278060,
245292,
286254,
230959,
288309,
290358,
194110,
288318,
280130,
288326,
282183,
288327,
276040,
366154,
56902,
292423,
276045,
243274,
333388,
286288,
224847,
228943,
280147,
118353,
290390,
128599,
235095,
300630,
306776,
44635,
147036,
243292,
333408,
157281,
286306,
300644,
282213,
317032,
312940,
204397,
222832,
224883,
276085,
314998,
333430,
175741,
188031,
337535,
294529,
192131,
312965,
282246,
288392,
229001,
290443,
310923,
188048,
323217,
282259,
302739,
276120,
229020,
276126,
282271,
282273,
302754,
257699,
282276,
229029,
40613,
40614,
282280,
40615,
298661,
61101,
278191,
321199,
198324,
286388,
296628,
286391,
337591,
306874,
280251,
327358,
282303,
286399,
323264,
321219,
333509,
276173,
302797,
212688,
9936,
302802,
9937,
282327,
286423,
278233,
278234,
216795,
67292,
294622,
278240,
229088,
298720,
276195,
321249,
153319,
313065,
12010,
288491,
280300,
239341,
284401,
419569,
276210,
323316,
229113,
313081,
286459,
276219,
325371,
194303,
288512,
194304,
311042,
280004,
288516,
216839,
282378,
276238,
321295,
284431,
243472,
161554,
323346,
294678,
116505,
284442,
278299,
310131,
276253,
313120,
241441,
315171,
284459,
294700,
159533,
282417,
200498,
296755,
276282,
276283,
280380,
319292,
345919,
276287,
315202,
307011,
325445,
282438,
276294,
153415,
280392,
276298,
304977,
325457,
413521,
317269,
216918,
307031,
18262,
280410,
284507,
300894,
245599,
237408,
302946,
296806,
276327,
282474,
288619,
288620,
325484,
280430,
296814,
282480,
292720,
313203,
325492,
300918,
276344,
241528,
194429,
325503,
315264,
188292,
241540,
327557,
67463,
243591,
315273,
315274,
243597,
110480,
40853,
282518,
282519,
44952,
329622,
294807,
298909,
311199,
247712,
292771,
300963,
313254,
294823,
298920,
292782,
317360,
276408,
290746,
294843,
214977,
280514,
276421,
214984,
284619,
344013,
276430,
231375,
301008,
153554,
276444,
280541,
294886,
276454,
317415,
276459,
296941,
278512,
311281,
311282,
223218,
333817,
292858
] |
134cd40cc6f9f5d0738201670f91ba70fa3a28be | e4e6394e24e325a764ef8713d9a0c3a98efc2c2d | /2019/SwiftUI Essentials/Play/Play WatchKit Extension/HostingController.swift | 9c709d44fb75d840ce7664b2514dc91016a8947a | [] | no_license | lexuanquynh/A-Swiftly-Tilting-Planet | b5fafdaa3be094236c4957c8e9751d4129862e1d | aa9d65d77ebab1e70f1518a35d5f75ba3aad5af7 | refs/heads/master | 2020-09-09T13:55:25.937791 | 2019-10-27T07:20:31 | 2019-10-27T07:20:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 345 | swift | //
// HostingController.swift
// Play WatchKit Extension
//
// Created by Caleb Wells on 7/3/19.
// Copyright © 2019 Caleb Wells. All rights reserved.
//
import WatchKit
import Foundation
import SwiftUI
class HostingController : WKHostingController<ContentView> {
override var body: ContentView {
return ContentView()
}
}
| [
-1
] |
e5a2c49e03253ac06ec04a8043a8ab9c95e206fb | 5b8a79c1bbe73990761443a435eb730d68d6cf94 | /SwiftDiExample/ContentView.swift | d3d0d1e90a9429e3d9cfdaac373611e52dfa8e38 | [] | no_license | prongbang/SwiftDiExample | c96484963067dbfd60e6bcc70c68567e9d068bf3 | 6064d01dc9ce7b6e874f9e739aebbfb5abd9b2d2 | refs/heads/master | 2020-09-29T01:50:59.630095 | 2020-01-26T05:06:33 | 2020-01-26T05:06:33 | 226,919,173 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 352 | swift | //
// ContentView.swift
// SwiftDiExample
//
// Created by Endtry on 9/12/2562 BE.
// Copyright © 2562 Endtry. All rights reserved.
//
import SwiftUI
struct ContentView: View {
var body: some View {
FeedView()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
| [
-1
] |
7ef2dfcd9acf54a6341654ce688d849790fd833c | fa4dca07a1ee4981ce4a223f5aedbf31cdc50b2e | /Coding-Interviews/24. 反转链表.swift | 189fc182215a712449f7c93697675fa9b916cb69 | [
"MIT"
] | permissive | yeziahehe/Coding-Interviews | db0e088badb3605e8716689a524926dc91f7680b | fc059dba35289164752e65a5404d0e7229e84950 | refs/heads/master | 2022-11-14T08:15:35.043900 | 2020-06-18T06:34:53 | 2020-06-18T06:34:53 | 268,449,936 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,212 | swift | //
// 24. 反转链表.swift
// Coding-Interviews
//
// Created by 叶帆 on 2020/6/10.
// Copyright © 2020 Suzhou Coryphaei Information&Technology Co., Ltd. All rights reserved.
//
/**
定义一个函数,输入一个链表的头节点,反转该链表并输出反转后链表的头节点。
示例:
输入: 1->2->3->4->5->NULL
输出: 5->4->3->2->1->NULL
限制:
0 <= 节点个数 <= 5000
注意:本题与主站 206 题相同:https://leetcode-cn.com/problems/reverse-linked-list/
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/fan-zhuan-lian-biao-lcof
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*/
import Foundation
public class ListNode {
public var val: Int
public var next: ListNode?
public init(_ val: Int) {
self.val = val
self.next = nil
}
}
class Solution {
func reverseList(_ head: ListNode?) -> ListNode? {
var pre: ListNode? = nil
var cur = head
while cur != nil {
let temp = cur?.next
cur?.next = pre
pre = cur
cur = temp
}
return pre
}
}
| [
-1
] |
c33c5b97c82bbaeeb4d1918ef1b312844c04a530 | 9826baf5ab0a5106c5be717b1a1cd1f02813b06e | /ParseDemo/AppDelegate.swift | c6fc20ba8a386e95ac52cc860f3a2f6d73997aa0 | [] | no_license | BichVN/ParseFirstApp | 0905d01d5f147e8e3d70cfde53814e0a44be2a51 | 46253e32c065e31f7c2a2f05566f4799c481a519 | refs/heads/master | 2016-09-01T06:56:48.110371 | 2016-01-20T07:59:27 | 2016-01-20T07:59:27 | 49,587,809 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,603 | swift | //
// AppDelegate.swift
// ParseDemo
//
// Created by Rumiya Murtazina on 7/28/15.
// Copyright (c) 2015 abearablecode. All rights reserved.
//
import UIKit
import Parse
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
Parse.enableLocalDatastore()
UINavigationBar.appearance().barTintColor = UIColor.orangeColor()
UINavigationBar.appearance().tintColor = UIColor.whiteColor()
// Initialize Parse.
Parse.setApplicationId("QqXdaGwAnVTjSlglkiNMJZUx5C5N43yYdiRb8Q1r", clientKey: "ZeUfZz65Uu1NquUmjLJDdSpSFQ7VgjC2SEzJudke")
// [Optional] Track statistics around application opens.
PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions)
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,
229391,
278545,
229394,
278548,
229397,
229399,
278556,
229405,
278564,
294950,
229415,
229417,
327722,
229426,
229428,
286774,
229432,
286776,
286778,
319544,
286791,
237640,
278605,
196692,
311383,
278623,
278626,
319590,
311400,
278635,
278639,
131192,
278648,
327814,
131209,
303241,
417930,
319633,
286873,
286876,
311460,
311469,
327862,
286906,
180413,
286910,
286916,
286922,
286924,
286926,
278743,
278747,
155872,
319716,
278760,
237807,
303345,
286962,
229622,
327930,
278781,
278783,
278785,
278792,
286987,
319757,
286999,
287003,
287009,
287014,
287016,
287019,
262448,
155966,
319809,
319810,
319814,
319818,
311628,
287054,
319822,
196963,
196969,
106872,
311683,
319879,
319898,
311719,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
278983,
319945,
278986,
278990,
278994,
279003,
279006,
188895,
279010,
287202,
279015,
172520,
319978,
279020,
279023,
311791,
172529,
279027,
164343,
311804,
303617,
279045,
172550,
287238,
172552,
303623,
320007,
279051,
172558,
279055,
279058,
279063,
279067,
172572,
279072,
172577,
172581,
279082,
279084,
172591,
172598,
279095,
172607,
172612,
377413,
172614,
172618,
303690,
33357,
279124,
172634,
311911,
189034,
295533,
172655,
172656,
189039,
295538,
189040,
172660,
189044,
287349,
352880,
287355,
287360,
295553,
287365,
311942,
303751,
352905,
279178,
287371,
311946,
311951,
287377,
287381,
311957,
221850,
287386,
164509,
303773,
287394,
303780,
287398,
279208,
287400,
172714,
279212,
172721,
287409,
66227,
303797,
189114,
287419,
328381,
287423,
328384,
279231,
287427,
172748,
287436,
107212,
172755,
303827,
279255,
279258,
303835,
213724,
189149,
303838,
279267,
279272,
312050,
230131,
230146,
328453,
230154,
33548,
312077,
295707,
328476,
303914,
279340,
279353,
230202,
222018,
377676,
148302,
287569,
279390,
230241,
279394,
303976,
336744,
328563,
213895,
320391,
304013,
279438,
279445,
58262,
279452,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
304063,
304065,
213954,
189378,
156612,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
295928,
320505,
295945,
295949,
320528,
140312,
295961,
238620,
304164,
189479,
238641,
238652,
238655,
336964,
205895,
320584,
238666,
296021,
205931,
279661,
205934,
164973,
279669,
337018,
279679,
279683,
222340,
205968,
296084,
238745,
238756,
165035,
337067,
238766,
238770,
230592,
279750,
230600,
230607,
148690,
279769,
304348,
279777,
304354,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
312622,
312630,
222522,
222525,
312639,
378181,
230727,
238919,
320840,
222545,
230739,
337244,
230752,
410987,
230768,
296305,
312692,
230773,
304506,
181631,
312711,
312712,
296331,
288140,
337306,
288160,
173472,
288162,
288164,
279975,
370092,
288176,
296373,
279991,
312759,
288185,
337335,
222652,
312766,
173507,
230860,
280014,
288210,
370130,
288212,
280021,
288214,
239064,
288217,
329177,
280027,
288220,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288236,
288240,
288242,
288244,
288250,
402942,
304651,
370187,
304653,
230923,
230940,
108066,
296486,
157229,
157236,
288320,
124489,
280145,
288338,
280149,
280152,
239194,
280158,
403039,
370272,
312938,
280183,
280185,
280188,
288408,
280222,
280232,
321195,
321200,
337585,
296634,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
280276,
321239,
280283,
313052,
288478,
313055,
313066,
280302,
288494,
321266,
288502,
280314,
288510,
67330,
280324,
198405,
288519,
280331,
198416,
296723,
116503,
329498,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
280388,
304968,
280393,
280402,
173907,
313176,
280419,
321381,
313201,
1920,
305028,
280454,
247688,
280464,
124817,
280468,
280473,
124827,
214940,
247709,
214944,
296883,
10170,
296890,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
313320,
124913,
239612,
313340,
313347,
313358,
321560,
313371,
223273,
313386,
354348,
124978,
124980,
321595,
313406,
288831,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288859,
280669,
313438,
280671,
223327,
321634,
313451,
223341,
313458,
280691,
313464,
329850,
321659,
288895,
321670,
215175,
141455,
141459,
313498,
100520,
288936,
280755,
288947,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
280919,
354653,
313700,
280937,
190832,
280946,
313720,
280956,
239997,
280959,
199051,
240011,
240017,
190868,
297365,
297368,
297372,
141725,
297377,
289186,
240052,
289207,
305594,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
281095,
338440,
150025,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
158262,
289342,
281154,
322115,
158283,
281163,
199262,
338532,
281190,
281196,
158317,
313973,
281210,
158347,
133776,
314003,
117398,
314007,
174754,
330404,
289448,
133801,
314029,
314033,
240309,
133817,
314047,
314051,
297671,
199367,
289522,
289525,
322310,
322314,
322318,
281361,
281372,
215850,
281388,
289593,
281401,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
281435,
281438,
281442,
224110,
207737,
183172,
240519,
322440,
289687,
297883,
289694,
289700,
52163,
281567,
322534,
183277,
281581,
322550,
322610,
314421,
281654,
314427,
207937,
207949,
322642,
281691,
314461,
281702,
281704,
281708,
281711,
289912,
248995,
306341,
306347,
306354,
142531,
199877,
289991,
330988,
216303,
322801,
257302,
199978,
314671,
298292,
298294,
298306,
380226,
281923,
224587,
224594,
216404,
306517,
314714,
224603,
159068,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
298358,
314743,
306552,
290171,
314747,
298365,
290174,
281987,
281990,
298377,
314763,
142733,
224657,
314785,
282025,
314793,
282027,
241070,
282034,
150966,
298424,
306618,
282044,
323015,
306640,
290275,
339431,
282089,
191985,
282098,
282101,
191992,
290298,
290302,
282111,
192008,
282127,
290321,
282130,
282133,
290325,
290328,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
282186,
224849,
282195,
282201,
159324,
159330,
241260,
257658,
282249,
282261,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
282328,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
323345,
282388,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
241450,
282410,
315184,
315190,
241464,
159545,
282425,
307009,
282446,
307027,
315221,
282454,
315223,
241496,
241498,
307035,
307040,
282465,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
282499,
282505,
298896,
298898,
44948,
298901,
282520,
282531,
282537,
282547,
298975,
323574,
290807,
241661,
282623,
315396,
241669,
315397,
282632,
282639,
282645,
282654,
241701,
217127,
282669,
323630,
282681,
290877,
282687,
315463,
192589,
307287,
315482,
217179,
315483,
192605,
200801,
299105,
217188,
299109,
307303,
45163,
307307,
315502,
192624,
307314,
299126,
233591,
307338,
233613,
241813,
307352,
299164,
184479,
184481,
307370,
307376,
323763,
176311,
299191,
307385,
307386,
258235,
176316,
307388,
307390,
299200,
307394,
307396,
323784,
307409,
307411,
176343,
233701,
282881,
282893,
282906,
291104,
233766,
307508,
315701,
307510,
307512,
151864,
307515,
282942,
307518,
151874,
282947,
323917,
110926,
323921,
323926,
233815,
315739,
299357,
242024,
250231,
242043,
291197,
291202,
299398,
242057,
291212,
299405,
283033,
291226,
242075,
315801,
291231,
283042,
291238,
291241,
127405,
291247,
299444,
127413,
283062,
283069,
127424,
299457,
283080,
176592,
315860,
299481,
160221,
242143,
291299,
242152,
291305,
176620,
127474,
291314,
291317,
135672,
291330,
283142,
233994,
234003,
234006,
152087,
242202,
234010,
135707,
242206,
242208,
291361,
234038,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
373383,
316051,
225941,
135834,
373404,
299677,
299680,
225954,
242343,
209576,
242345,
373421,
299706,
135870,
135873,
135876,
299723,
225998,
226002,
226005,
226008,
201444,
283368,
234219,
283372,
381677,
226037,
283382,
234231,
234236,
226045,
234239,
242431,
209665,
234242,
299778,
226053,
234246,
226056,
234248,
234254,
291601,
242452,
234261,
201496,
234269,
283421,
234274,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
234292,
234298,
283452,
234307,
234309,
234313,
316233,
316235,
234316,
283468,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234338,
242530,
349027,
234341,
234344,
234347,
177004,
324464,
234353,
152435,
234358,
234362,
226171,
234368,
234370,
201603,
226182,
234375,
226185,
234379,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
226200,
291748,
291750,
234407,
324518,
324520,
234410,
324522,
226220,
291756,
324527,
291760,
234417,
201650,
324531,
275384,
234428,
291773,
234431,
242623,
324544,
324546,
324548,
226245,
234437,
234439,
234443,
234446,
275406,
234449,
316370,
234452,
234455,
234459,
234461,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
316403,
234484,
324599,
234490,
234493,
234496,
316416,
234501,
234504,
234507,
234510,
234515,
300054,
234519,
316439,
234523,
234528,
300066,
234532,
234537,
234540,
144430,
234543,
275508,
234549,
300085,
234556,
234558,
316479,
234561,
316483,
160835,
234568,
234570,
316491,
300108,
234580,
234581,
242777,
234585,
234590,
234595,
300133,
234601,
300139,
160879,
234607,
275569,
234614,
398455,
144506,
234618,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
275594,
234636,
177293,
275602,
234643,
226453,
275606,
234647,
275608,
308373,
234650,
234653,
324766,
119967,
283805,
234657,
234661,
283813,
234664,
275626,
316596,
234687,
300226,
226500,
234692,
300229,
308420,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
300248,
300253,
300256,
300258,
300265,
161003,
300267,
300270,
300272,
120053,
300278,
316663,
300284,
275710,
300287,
300289,
300292,
283917,
300301,
177424,
283939,
259367,
243003,
226628,
283973,
300357,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
284010,
136562,
275834,
275836,
275840,
316803,
316806,
316811,
226703,
300433,
234899,
226709,
316824,
316826,
144796,
300448,
144810,
144812,
284076,
144814,
144820,
284084,
284087,
292279,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
333280,
292329,
300523,
300527,
226802,
292338,
308727,
316947,
308757,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
284218,
226877,
284223,
292421,
226886,
284231,
128584,
276043,
284238,
226895,
284241,
194130,
284243,
284245,
276053,
284247,
317015,
284249,
243290,
284251,
284253,
284255,
284258,
292452,
284263,
284265,
292458,
292461,
284272,
284274,
276086,
284278,
292470,
292473,
284283,
276093,
276095,
284288,
292481,
284290,
325250,
284292,
276098,
284297,
284299,
317068,
276109,
284301,
284303,
276114,
284306,
284308,
284312,
284316,
276127,
284320,
284327,
276137,
284329,
284331,
317098,
284333,
284335,
284337,
284343,
284346,
284350,
276160,
358080,
284354,
358083,
276166,
284358,
358089,
276170,
284362,
276175,
276177,
284370,
317138,
284372,
276187,
284379,
284381,
284384,
284386,
358114,
358116,
276197,
358119,
284392,
325353,
284394,
358122,
284397,
358126,
276206,
358128,
284399,
358133,
276216,
284413,
358146,
317187,
284418,
317191,
300816,
284440,
300828,
276255,
325408,
284449,
300834,
317221,
227109,
358183,
276268,
194351,
243504,
284469,
276280,
325436,
276291,
276295,
358224,
276308,
284502,
317271,
178006,
276315,
292700,
284511,
227175,
284529,
292721,
300915,
292729,
317306,
284540,
276365,
284564,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
276395,
358326,
276410,
276411,
358330,
276418,
301009,
301011,
301013,
292823,
301015,
301017,
358360,
292828,
276446,
153568,
276448,
276452,
276455,
292839,
292843,
276460,
276464,
227314,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
276496,
317458,
243733,
243751,
292904,
276528,
243762,
309298,
325685,
235579,
276539,
235581,
178238,
276544,
284739,
243785,
276553,
350295,
194649,
227418,
309337,
350302,
227423,
194654,
178273,
194657,
227426,
194660,
276579,
227430,
276583,
309346,
309348,
309350,
309352,
309354,
350308,
276590,
350313,
350316,
350321,
284786,
276595,
227440,
350328,
292993,
301185,
350339,
350342,
350345,
325777,
350354,
350359,
276638,
350366,
284837,
350375,
350379,
350381,
350385,
350387,
350389,
350395,
350399,
227520,
301252,
350406,
227529,
309450,
276685,
276689,
309462,
301272,
309468,
301283,
317672,
276713,
227571,
243960,
276735,
227583,
227587,
276739,
276742,
227593,
227596,
325910,
309530,
342298,
276766,
211232,
276775,
260421,
276809,
276811,
235853,
276829,
276833,
391523,
276836,
276843,
293227,
276848,
293232,
186744,
211324,
227709,
285061,
317833,
178572,
285070,
178575,
285077,
227738,
317853,
276896,
317858,
285093,
317864,
276907,
235955,
276917,
293304,
317910,
293343,
227810,
293346,
293352,
236013,
317951,
309764,
121352,
236043,
342541,
113167,
317971,
277011,
309781,
227877,
227879,
227882,
309804,
105007,
236082,
277054,
129603,
318020,
277071,
285265,
309844,
277080,
309849,
285277,
285282,
326244,
277100,
121458,
277106,
170619,
277122,
277128,
285320,
301706,
318092,
326285,
318094,
334476,
277136,
277139,
227992,
285340,
318108,
227998,
383658,
285357,
318128,
277170,
342707,
154292,
285368,
277177,
277181,
277191,
277194,
277196,
277201,
137946,
113378,
228069,
277223,
342760,
285417,
56043,
277232,
228081,
56059,
285441,
310020,
285448,
228113,
285459,
277273,
326430,
228128,
228135,
318248,
277291,
293677,
318253,
285489,
293685,
285494,
301884,
310080,
277314,
277317,
277322,
277329,
277337,
301913,
301921,
400236,
236397,
162671,
310134,
15224,
236408,
277368,
416639,
416640,
310147,
39817,
187274,
277385,
301972,
277405,
277411,
310179,
293802,
236460,
277426,
293811,
293820,
203715,
276586,
293861,
228327,
228328,
228330,
318442,
277486,
326638,
318450,
293876,
285686,
56313,
285690,
293887,
277504,
277507,
277511,
277519,
277526,
293939,
318516,
277561,
277564,
310336,
277573,
228422,
310344,
277577,
277583,
310355,
277594,
138332,
277598,
285792,
277601,
310374,
203879,
277608,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
285821,
302205,
285824,
392326,
285831,
285835,
285852,
302237,
285854,
285856,
277671,
302248,
277678,
302258,
277687,
318651,
277695,
244930,
302275,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
228606,
64768,
310531,
285958,
318742,
277798,
130345,
113964,
285999,
318773,
318776,
286016,
294211,
302403,
326991,
179547,
302436,
294246,
327015,
310632,
327017,
351594,
351607,
310648,
310651,
310657,
351619,
294276,
327046,
253320,
310665,
318858,
310672,
351633,
310689,
277932,
310710,
310715,
228799,
64966,
245191,
163272,
302543,
310737,
228825,
286169,
310749,
310755,
187880,
310764,
286188,
40443,
286203,
310780,
40448,
228864,
228871,
65038,
302614,
286233,
146977,
286246,
286248,
278057,
310831,
212538,
40507,
228933,
40525,
212560,
228944,
400976,
147032,
40537,
40539,
278109,
40550,
286313,
40554,
310892,
40557,
294521,
343679,
278150,
310925,
286354,
278163,
278168,
327333,
229030,
278188,
302764,
278192,
319153,
319171,
302789,
294599,
278216,
343757,
212690,
278227,
286420,
319187,
229076,
319194,
278235,
278238,
229086,
294625,
286460,
278274,
278277,
302854,
294664,
311048,
311053,
302862,
278306,
294701,
278320,
229192,
302925,
327554,
294811,
294817,
319394,
311209,
180142,
188340,
294847,
24528,
393177,
294876,
294879,
294890,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
81b7c43229306e07a409f8582f39932ed444922c | 9808bc18ab8752424b9a1d5845deb1de884b385a | /LMS/ViewAllLoansCell.swift | 47723a7e1bd479949a0171f097a431912f243a94 | [] | no_license | rameshzce/lms | b3d46ce86408a4dc8fed112a0b0dec935335b1c4 | e66625699f89dfdecc572bef7cc02b6591a9f061 | refs/heads/master | 2021-01-23T04:03:05.409259 | 2017-04-02T15:34:44 | 2017-04-02T15:34:44 | 86,150,435 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 598 | swift | //
// ViewAllLoansCell.swift
// Loan Management
//
// Created by Ramesh Kolamala on 18/03/17.
// Copyright © 2017 tokkalo.com. All rights reserved.
//
import UIKit
class ViewAllLoansCell: UITableViewCell {
@IBOutlet var loanName: UILabel!
@IBOutlet var titleBg: 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
}
}
| [
-1
] |
3c100985167699d49b97b48616ff448b8f70cdb1 | 4ed9fd15af48fea72fd1ba008cbeda3e9f969f0e | /LunchApp_swift1.2/DetailWindowViewController.swift | f6f440d9dd6ca821e0af9ca9d00cf198f31f6d43 | [] | no_license | bygeek01/LunchApp | 888c21a17cae1d210cf040bb7fdc63de4d46607d | 703392f317c2b344ac0635246a16ca6d20d0900b | refs/heads/master | 2016-09-06T13:31:54.898682 | 2015-07-23T12:18:59 | 2015-07-23T12:18:59 | 39,565,497 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,449 | swift | //
// DetailWindowViewController.swift
// LunchApp_swift1.2
//
/**
* 一覧画面上のセルをタップした場合に、遷移してくる詳細画面を管理するVC
詳細画面は3行のtableViewで設計しており、各行内容は下記の通り
0行目=メニュー画像の表示エリア
1行目=店舗名等の基本情報表示エリア
2行目=マップエリア
各行ごとにVCを分けてそれぞれのviewで管理してもよいが、煩雑なため現段階ではtableviewで構築
*
*/
// Created by hide on 2015/07/05.
// Copyright (c) 2015年 byGeek01. All rights reserved.
//
import Foundation
import UIKit
class DetailWindowViewController:UIViewController {
//let detailCollectionView = DetailCollectionView(frame: CGRectZero, collectionViewLayout: DetailCollectionLayout())
let detailCollectionView = DetailTableView(frame: CGRectZero, style: UITableViewStyle.Plain)
var testPath:NSIndexPath?
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor.blackColor()
//navigationBarを透明にする
self.navigationController?.navigationBarHidden = false
let backImage = UIImage()
self.navigationController?.navigationBar.setBackgroundImage(backImage, forBarMetrics: .Default)
self.navigationController?.navigationBar.shadowImage = backImage
self.navigationController?.navigationBar.translucent = true
self.navigationController?.navigationBar.layer.cornerRadius = 3.0
self.navigationController?.navigationBar.tintColor = UIColor.whiteColor()
self.view.addSubview(detailCollectionView)
//navigationBarの真下に潜り込ませる
self.automaticallyAdjustsScrollViewInsets = false
}
override func viewDidLayoutSubviews() {
//detailCollectionView.frame = CGRect(x: -SettingConfig.spaceWidth/2, y: 0, width: SettingConfig.screenWidth+SettingConfig.spaceWidth, height: SettingConfig.screenHeight)
detailCollectionView.frame = CGRect(x: 0, y: 0, width: SettingConfig.screenWidth, height: SettingConfig.screenHeight)
}
//tableviewが表示されるたびに、表示データをreloadする
override func viewWillAppear(animated: Bool) {
self.navigationController?.navigationBarHidden = false
detailCollectionView.reloadData()
}
} | [
-1
] |
5d52bd7a056735995bf58fad761e59ac778e32fc | a0d4bb0085059f63bbb96ab64c618ac0e57659ec | /Yuya Quiz/Answer.swift | 2ea83eac008cf316ead7f9fd7ba0cdbdd7db052f | [] | no_license | Upzz/SwiftQuiz | 804e00a8ddd02a3fbfa1b2738177da8ffa6cc71f | 305a485bd94201f2a2eee8f395238fa3afa4159a | refs/heads/master | 2020-03-25T07:24:34.542193 | 2018-08-04T19:58:59 | 2018-08-04T19:58:59 | 143,559,113 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 319 | swift | //
// Answer.swift
// Yuya Quiz
//
// Created by UCode on 8/1/18.
// Copyright © 2018 UCode. All rights reserved.
//
import Foundation
class Answer{
var answerText:String;
var isCorrect:Bool;
init(_ answer:String, _ correct:Bool){
answerText = answer
isCorrect = correct
}
}
| [
-1
] |
2f40c38948c3eb320ac7625783aee0b5cc9a34d5 | df734d56c6c2de7a8a6d03d211cf304e20039c71 | /Sources/Brotli/Types/Brotli.Quality.swift | afc2459adca7e4a9ac0f3d31e69d1abfbacde3ea | [
"MIT",
"LicenseRef-scancode-proprietary-license"
] | permissive | L1MeN9Yu/Elva | 012cc283ab85b463d77fc29bcb2a0b493d561116 | 9cd193dd5f0df430726256ab5d6aa08455f5d39b | refs/heads/main | 2023-06-30T03:50:02.539850 | 2023-06-13T06:00:04 | 2023-06-13T06:00:04 | 223,358,149 | 8 | 6 | MIT | 2023-06-13T05:56:54 | 2019-11-22T08:29:48 | Swift | UTF-8 | Swift | false | false | 954 | swift | //
// Created by Mengyu Li on 2019/11/28.
// Copyright (c) 2019 Mengyu Li. All rights reserved.
//
@_implementationOnly import Elva_Brotli
public extension Brotli {
struct Quality: RawRepresentable, Hashable {
public typealias RawValue = Int32
public let rawValue: RawValue
public init?(rawValue: RawValue) {
guard Self._min...Self._max ~= rawValue else { return nil }
self.rawValue = rawValue
}
private init(builtinValue: RawValue) {
rawValue = builtinValue
}
}
}
public extension Brotli.Quality {
static let `default` = Self(builtinValue: Self._default)
static let min = Self(builtinValue: Self._min)
static let max = Self(builtinValue: Self._max)
}
private extension Brotli.Quality {
private static let _min = BROTLI_MIN_QUALITY
private static let _max = BROTLI_MAX_QUALITY
private static let _default = BROTLI_DEFAULT_QUALITY
}
| [
-1
] |
6e4be82279c1bb4b80ba25aef2242f734fd4ebea | 5863bdf789d6d7eb5ef07602c36d2330c603a429 | /Judo Heroes/CompetitionInfoVC.swift | f940fe3a4684803deef3666b1ebd25085fe6db72 | [] | no_license | bobek00/Judo-Heroes | cbb5a2c0564a337c3a46d0f97b806f29019acd8b | d9414d5bac22a166f54bcd66537a9ab9dddac076 | refs/heads/master | 2021-01-18T17:27:04.423486 | 2017-04-12T20:51:59 | 2017-04-12T20:51:59 | 86,802,052 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,289 | swift | //
// CompetitionInfoVC.swift
// Judo Heroes
//
// Created by Boris Rudas on 04/04/2017.
// Copyright © 2017 Boris Rudas. All rights reserved.
//
import UIKit
import SDWebImage
class CompetitionInfoVC: UIViewController {
@IBOutlet var infoview: UIView!
@IBOutlet var cityLbl: UILabel!
@IBOutlet var countryLbl: UILabel!
@IBOutlet var dateLbl: UILabel!
@IBOutlet var CompetitionNameLabel: UILabel!
@IBOutlet var cityImg: UIImageView!
var competitionName = String()
var competitionID = String()
var competitionYear = String()
override func viewDidLoad() {
super.viewDidLoad()
CompetitionNameLabel.text = competitionName
parseDataFromUrl()
print(competitionYear)
}
override func viewWillAppear(_ animated: Bool) {
infoview.layer.cornerRadius = 6
}
func parseDataFromUrl() {
let urlString = "http://data.judobase.org/api/get_json?access_token=¶ms%5Baction%5D=general.get_one¶ms%5B__ust%5D=¶ms%5Bmodule%5D=competition¶ms%5Bid%5D=\(competitionID)"
let url = URL(string: urlString)
URLSession.shared.dataTask(with:url!) { (data, response, error) in
if error != nil {
print(error!)
} else {
do {
let parsedData = try JSONSerialization.jsonObject(with: data!, options: []) as! [String:Any]
let city = parsedData["city"] as! String
let country = parsedData["country"] as! String
let bgpic = parsedData["bgpic"] as! String
let date_from = parsedData["date_from"] as! String
let date_to = parsedData["date_to"] as! String
// let ages = parsedData["ages"] as! String
// let country_short = parsedData["country_short"] as! String
// let rank_group = parsedData["rank_group"] as! String
// let rank_name = parsedData["rank_name"] as! String
var year = parsedData["year"] as! String
// let title = parsedData["title"] as! String
self.cityLbl.text = city
self.countryLbl.text = country
self.dateLbl.text = "The competition will be held from \(date_from) until \(date_to)"
self.cityImg.sd_setImage(with: URL(string: bgpic))
self.competitionYear = year
} catch let error as NSError {
print(error)
}
}
}.resume()
}
@IBAction func dissmisButton(_ sender: Any) {
self.dismiss(animated: true, completion: nil)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "categoriesSegue" {
if let compCatVC = segue.destination as? CategoriesVC {
compCatVC.competitionID = competitionID
compCatVC.competitionName = competitionName
compCatVC.competitionYear = self.competitionYear
}
}
}
}
| [
-1
] |
eeb07dacac031ca7f2d0c20a04ff11a1e8cbb326 | 32abee4aabb3c997b4b5e06d14a2d47972aeefd5 | /52WorkHelper/52WorkHelper/Class/ViewControllers/Message/Model/CQIndexModel.swift | 7499aa338e0b133dc972bed6d0241c4032c21bc5 | [] | no_license | powerforward741852/52 | 6f87b854eaf2d0404637a8eca84f1922a77daf71 | 7100dff0443d2a361af030b256c50e36feceabe5 | refs/heads/master | 2022-11-13T16:09:57.683840 | 2020-07-11T09:31:51 | 2020-07-11T09:31:51 | 278,586,946 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 201 | swift | //
// CQIndexModel.swift
// 52WorkHelper
//
// Created by chenqihang on 2018/7/23.
// Copyright © 2018年 chenqihang. All rights reserved.
//
import UIKit
class CQIndexModel: NSObject {
}
| [
-1
] |
377b86a3bc283fdc6c3f4b73e354276f6d4bf8c4 | 6ac428e983c1a9dbebc12d248f056f3fce72f7b4 | /Demo DailyRecipe/ViewController/SeeAllTodayViewController/HeaderSeeAllToday/HeaderSeeAllTodayTableViewCell.swift | 31c5d37f8cf2e164eaec776ca485aff6112e8adf | [] | no_license | vankiet09101996/DailyFoodApp | c021cc19fad04504b2ee5dd2d7484027a4ecd28e | 40c626838d4346ca2ef191849a05d5b9c1bb7f64 | refs/heads/main | 2023-06-19T04:49:00.252748 | 2021-07-19T04:59:01 | 2021-07-19T04:59:01 | 387,333,383 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 628 | swift | //
// HeaderSeeAllTodayTableViewCell.swift
// Demo DailyRecipe
//
// Created by NEM on 22/06/2021.
//
import UIKit
class HeaderSeeAllTodayTableViewCell: UITableViewCell {
var buttonFiter : (() -> ()) = {}
@IBOutlet weak var mySearchBar: UISearchBar!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
@IBAction func onSetting(_ sender: Any) {
buttonFiter()
}
}
| [
-1
] |
2cf28ba13a0e460669ae59bc855298cb7a29b6fb | d5810c9bf9abfc52b7317b2dde89cbbf91bb7d29 | /CSAccessibility/CSAccessibility/Modules/JobDetail/Presenter/JobDetailPresenterProtocol.swift | bdcacc8e874864f65e6d7e1d9f5e0b7ae6487977 | [] | no_license | andrehsouza/AccessibilityJobs | 761cbe15e8382298ee6053d3cf0b992b499ca43b | d6d692267e6c8d0eb1061a1c4fc43a30220ac43c | refs/heads/master | 2020-04-30T17:39:01.677187 | 2019-03-25T21:18:45 | 2019-03-25T21:18:45 | 176,986,651 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 347 | swift | //
// JobDetailPresenterProtocol.swift
// CSAccessibility
//
// Created by andre.luiz.de.souza on 22/02/19.
// Copyright © 2019 andre.luiz.de.souza. All rights reserved.
//
import Foundation
protocol JobDetailPresenterProtocol: class {
var job: JobModel { get }
func attachView(view: JobDetailViewProtocol)
func viewDidLoad()
}
| [
-1
] |
a11455d0a68494d438fc06c860a441b03dfce299 | 3a318eb5a6c42c6c2b1780a1c5e3e433134eef28 | /mowineUITests/Page Objects/AnonymousUserPage.swift | 93faf22163b2f9db615355ed738667737c56eddd | [] | no_license | joshfreed/mowine | e4808491e332d8a4becc4ef125a8d390824f933e | 83a45aedff7b20e5648dfd983e5951390f37aa5e | refs/heads/main | 2022-08-18T12:19:13.455232 | 2022-07-26T16:10:56 | 2022-07-26T16:10:56 | 83,926,999 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 770 | swift | //
// AnonymousUserPage.swift
// AnonymousUserPage
//
// Created by Josh Freed on 7/22/21.
// Copyright © 2021 Josh Freed. All rights reserved.
//
import XCTest
class AnonymousUserPage {
let app: XCUIApplication
init(app: XCUIApplication) throws {
self.app = app
guard waitForExistence() else { throw PageErrors.wrongPage }
}
private func waitForExistence() -> Bool {
app.staticTexts["Get mo' out of mo' wine with a free account"].waitForExistence(timeout: .default)
}
func signUp() throws -> SignUpPage {
app.buttons["Sign Up"].tap()
return try SignUpPage(app: app)
}
func logIn() throws -> LogInPage {
app.buttons["Log In"].tap()
return try LogInPage(app: app)
}
}
| [
-1
] |
3fbb09f1355a91c7ee667de92b8cb6f82ccd9e7a | b742151fbd3a56a28831ca156ad4c08ef55d450e | /Filtering Operators/Debounce,Throttle.playground/Contents.swift | a71ab0588ca95d673bf33a42daafc11889d247ba | [] | no_license | eastbright-kim/Rxswift | 891fd692d442999e47e816a90e5819ee95c9519e | c7cba4f2c18ad7c708fc8e10a9e2f2a2d274e8f7 | refs/heads/main | 2023-06-24T03:16:10.257697 | 2021-07-23T13:44:12 | 2021-07-23T13:44:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,341 | swift | import UIKit
import RxSwift
let bag = DisposeBag()
let buttonTap = Observable<String>.create { observer -> Disposable in
DispatchQueue.global().async {
for i in 1...10 {
observer.onNext("buttonTap \(i)")
Thread.sleep(forTimeInterval: 0.3)
}
Thread.sleep(forTimeInterval: 1)
for i in 11...20 {
observer.onNext("buttonTap \(i)")
Thread.sleep(forTimeInterval: 0.5)
}
observer.onCompleted()
}
return Disposables.create {}
}
buttonTap
.throttle(.milliseconds(1000), scheduler: MainScheduler.instance)
.subscribe{ print($0) }
.disposed(by: bag)
//let buttonTap = Observable<String>.create { observer -> Disposable in
//
// for i in 1...10 {
// observer.onNext("buttonTap \(i)")
// Thread.sleep(forTimeInterval: 0.3)
// }
//
// Thread.sleep(forTimeInterval: 1)
//
// for i in 11...20 {
// observer.onNext("buttonTap \(i)")
// Thread.sleep(forTimeInterval: 0.5)
// }
//
// observer.onCompleted()
//
//
//
// return Disposables.create {}
//}
//
//buttonTap
// .debounce(.milliseconds(1000), scheduler: MainScheduler.instance)
// .subscribe{ print($0) }
// .disposed(by: bag)
//throttle은 지정된 주기 동안 하나의 이벤트만 구독자에 전달
| [
-1
] |
1a349b051e45459e9d676ab3eec41230ad1cd967 | e019317094e0cd4cabd263229afd9627f38f22b0 | /Velocimetro/Velocimetro.playground/Contents.swift | 09a82f81baeefdbe55583e42454ca0c5eccd7c78 | [] | no_license | gbm2494/Curso-Swift | 0db8112370f7098315ed9ad5863edb6ae9d7b740 | ba4abaf35b670f52bbf532d4b3406afdf8bca753 | refs/heads/master | 2021-01-10T11:16:52.691870 | 2016-01-04T05:43:52 | 2016-01-04T05:43:52 | 47,435,889 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,978 | swift | //: Minireto velocímetro Gaudy Blanco
import UIKit
/*Enumeración de las velocidades de un auto*/
enum Velocidades : Int{
/*Distintos case para las diferentes velocidades del auto*/
case Apagado = 0, VelocidadBaja = 20, VelocidadMedia = 50, VelocidadAlta = 120
/*inicializador que recibe la velocidad inicial que tendrá la enumeración*/
init(velocidadInicial : Velocidades){
self = velocidadInicial
}
}
/*Clase Auto*/
class Auto{
/*Se crea la instancia de la enumeración*/
var velocidad : Velocidades
/*inicializador de la clase Auto*/
init(){
/*Aquí se inicializa la enumeración con el valor inicial de apagado*/
velocidad = Velocidades(velocidadInicial: Velocidades.Apagado)
}
/*Función para el cambio de velocidad que retorna la velocidad en km y el tipo de velocidad al que cambió*/
func cambioDeVelocidad( ) -> ( actual : Int, velocidadEnCadena: String){
var velocidadString : String = ""
if velocidad.rawValue == 0 {
velocidad = Velocidades(velocidadInicial: Velocidades.VelocidadBaja)
velocidadString = "Velocidad baja"
}
else if velocidad.rawValue == 20{
velocidad = Velocidades(velocidadInicial: Velocidades.VelocidadMedia)
velocidadString = "Velocidad Media"
}
else if velocidad.rawValue == 50{
velocidad = Velocidades(velocidadInicial: Velocidades.VelocidadAlta)
velocidadString = "Velocidad Alta"
}
else if velocidad.rawValue == 120 {
velocidad = Velocidades(velocidadInicial: Velocidades.VelocidadMedia)
velocidadString = "Velocidad Media"
}
return (velocidad.rawValue, velocidadString)
}
}
var carro = Auto()
for var i = 0 ; i < 20; i++
{
var tupla = carro.cambioDeVelocidad()
print(tupla.actual, tupla.velocidadEnCadena)
}
| [
-1
] |
da717ea986b9ee4cb9d091c5ad61f16552192218 | 4cdb7ab62e31436ef8d1ec6ca750a2dde36c2f37 | /SimpleAppTransport/SimpleAppTransport/ViewController.swift | b86911365fe5ea3fe2b9d1a0687e6ff42743c22e | [] | no_license | LearningSwift2/LearningApps | f5e887c36ae931b09c3e47515d4c65b7c80ccec5 | c3d9e1fb20972304e0457a625b420c238a439164 | refs/heads/master | 2021-01-21T04:31:28.481028 | 2016-06-27T16:27:43 | 2016-06-27T16:27:43 | 46,907,351 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,239 | swift | //
// ViewController.swift
// SimpleAppTransport
//
// Created by Phil Wright on 3/20/16.
// Copyright © 2016 Touchopia, LLC. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
typealias JSONDictionary = [String:AnyObject]
typealias JSONArray = [JSONDictionary]
override func viewDidLoad() {
super.viewDidLoad()
let postEndpoint: String = "http://jsonplaceholder.typicode.com/posts/1"
guard let url = NSURL(string: postEndpoint) else {
print("Error: cannot create URL")
return
}
let urlRequest = NSURLRequest(URL: url)
let config = NSURLSessionConfiguration.defaultSessionConfiguration()
let session = NSURLSession(configuration: config)
// Completion Handler for Task
let myCompletionHandler: (NSData?, NSURLResponse?, NSError?) -> Void = {
(data, response, error) in
//print(response)
//print(error)
guard let responseData = data else {
print("Error: did not receive data")
return
}
guard error == nil else {
print("error calling GET on /posts/1")
print(error)
return
}
// parse the result as JSON
do {
if let postDict = try NSJSONSerialization.JSONObjectWithData(responseData,
options: []) as? JSONDictionary {
print(postDict)
print("\n\n")
if let body = postDict["body"] as? String {
print("The post is: \(body)")
}
if let postTitle = postDict["title"] as? String {
print("The title is: \(postTitle)")
}
if let userId = postDict["userId"] as? Int {
print("The userId is \(userId)")
}
if let postId = postDict["id"] as? Int {
print("The post id is \(postId)")
}
}
} catch {
print("Error trying to convert data to JSON")
return
}
}
// GET
let task = session.dataTaskWithRequest(urlRequest, completionHandler: myCompletionHandler)
task.resume()
// POST
let postsEndpoint: String = "http://jsonplaceholder.typicode.com/posts"
let postsUrlRequest = NSMutableURLRequest(URL: NSURL(string: postsEndpoint)!)
postsUrlRequest.HTTPMethod = "POST"
let newPost: NSDictionary = ["title": "Frist Psot", "body": "I iz fisrt", "userId": 1];
do {
let jsonPost = try NSJSONSerialization.dataWithJSONObject(newPost, options: [])
postsUrlRequest.HTTPBody = jsonPost
} catch {
print("Error: cannot create JSON from post")
}
let postTask = session.dataTaskWithRequest(postsUrlRequest, completionHandler: myCompletionHandler)
postTask.resume()
// DELETE
let firstPostEndpoint: String = "http://jsonplaceholder.typicode.com/posts/1"
let firstPostUrlRequest = NSMutableURLRequest(URL: NSURL(string: firstPostEndpoint)!)
firstPostUrlRequest.HTTPMethod = "DELETE"
let deleteTask = session.dataTaskWithRequest(firstPostUrlRequest, completionHandler: {
(data, response, error) in
guard let _ = data else {
print("error calling DELETE on /posts/1")
return
}
})
deleteTask.resume()
}
}
| [
-1
] |
01d15cd341e222407db7c7ab7f75e8da8e20bd4d | 89ce820ca4ecdd57c6a57456ce21f248157c3602 | /Source/LibraryDemo_Pastel/LibraryDemo_Pastel/Source/Classes/PastelLabel.swift | a53411ed8ebab313d415b616604f487d997b48ca | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | simplisticated/awesome-libs-ios | 44068cdb3f068c190856a7534b9a8951b24119d5 | 9f184ed0acaa882688a6de3911fabea116b3459a | refs/heads/master | 2023-02-24T10:23:35.310233 | 2021-01-30T05:10:59 | 2021-01-30T05:10:59 | 289,075,500 | 1 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 1,332 | swift | import UIKit
public protocol PastelLabelable {
var text: String? { get set }
var font: UIFont? { get set }
var textAlignment: NSTextAlignment { get set }
var attributedText: NSAttributedString? { get set }
}
open class PastelLabel: PastelView, PastelLabelable {
private let label = UILabel()
//MARK: - PastelLabelable
open var text: String? {
didSet {
label.text = text
}
}
open var font: UIFont? {
didSet {
label.font = font
}
}
open var attributedText: NSAttributedString? {
didSet {
label.attributedText = attributedText
}
}
open var textAlignment: NSTextAlignment = .center {
didSet {
label.textAlignment = textAlignment
}
}
public override init(frame: CGRect) {
super.init(frame: frame)
setup()
}
public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setup()
}
open override func awakeFromNib() {
super.awakeFromNib()
setup()
}
func setup() {
textAlignment = .center
mask = label
}
open override func layoutSubviews() {
super.layoutSubviews()
label.frame = bounds
}
}
| [
-1
] |
c90275bec807cbd18778372ab2500540258f51b9 | 5086df65eafa03c05cea64f38270956124c84e34 | /RecipeApp/App/AppCoordinator.swift | 98db85e653d40fcb7fd88959c6cfa7950561b0ab | [] | no_license | lkquan2303/RecipeAppTest | 0fe383814f1b178b952d41373e525974a6193236 | f436b03d59aa72e8f8c28a8e214afd1d391e4239 | refs/heads/main | 2023-01-23T06:59:54.766921 | 2020-12-04T01:29:33 | 2020-12-04T01:29:33 | 317,104,562 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 582 | swift | //
// AppCoordinator.swift
// Recipe-App
//
// Created by Uri on 11/27/20.
//
import Foundation
import UIKit
class AppCoordinator{
private let window: UIWindow
init(window: UIWindow) {
self.window = window
}
func start() {
let homeViewController = RecipeHomeViewController.instantiate(viewModel: RecipeListViewModel())
let navigationController = UINavigationController(rootViewController: homeViewController)
window.rootViewController = navigationController
window.makeKeyAndVisible()
}
}
| [
-1
] |
8921ecda9d1463469fc0d11455dea25a27d3a6cc | 8243b760d96a5f9ccb9d8e5aadcd416f68f18c73 | /GithubFollowersV2/Screens/Favorites Screen/GFFavoriteListVC.swift | 33497535564cab791338a9ffcb7dff2ea40bf113 | [] | no_license | JasonGoodney/GitHubFollowersV2 | 16a8608f89aa5d5e3c8b6451194324c9bfd662cd | 6f82a400d1017a2f4f861c1ce59c1cbba7672b3a | refs/heads/master | 2021-04-24T01:29:35.752294 | 2020-03-25T18:42:46 | 2020-03-25T18:42:46 | 250,053,578 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,352 | swift | //
// GFFavoriteListVC.swift
// GithubFollowersV2
//
// Created by Jason Goodney on 3/22/20.
// Copyright © 2020 Jason Goodney. All rights reserved.
//
import UIKit
class GFFavoriteListVC: GFDataLoadingVC {
private lazy var tableView: UITableView = {
let tableView = UITableView(frame: view.bounds, style: .plain)
tableView.tableFooterView = UIView()
tableView.delegate = self
tableView.dataSource = self
tableView.rowHeight = 80
tableView.register(GFFavoriteCell.self, forCellReuseIdentifier: GFFavoriteCell.reuseId)
return tableView
}()
var favorites: [Follower] = []
override func viewDidLoad() {
super.viewDidLoad()
view.addSubviews(tableView)
configureNavBar()
}
override func viewWillAppear(_ animated: Bool) {
super.viewDidAppear(true)
tableView.deselectSelectedRow(animated: true)
retrieveFavoritesFromPersistance()
}
private func retrieveFavoritesFromPersistance() {
PersistenceManager.retrieveFavorites { [weak self] (result) in
guard let self = self else { return }
switch result {
case .success(let favorites):
self.favorites = favorites
self.tableView.reloadDataOnMainThread()
case .failure(let error):
self.showEmptyStateView(withMessage: error.rawValue, in: self.view)
}
}
}
private func configureNavBar() {
title = "Favorites"
navigationController?.navigationBar.prefersLargeTitles = true
}
}
extension GFFavoriteListVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return favorites.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: GFFavoriteCell.reuseId, for: indexPath) as! GFFavoriteCell
let favorite = favorites[indexPath.row]
cell.set(favorite: favorite)
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let favorite = favorites[indexPath.row]
let destinationVC = GFFollowerListVC(username: favorite.login)
navigationController?.pushViewController(destinationVC, animated: true)
}
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
guard editingStyle == .delete else { return }
let favorite = favorites[indexPath.row]
PersistenceManager.updateWith(favorite: favorite, actionType: .remove) { [weak self] (error) in
guard let self = self else { return }
if let error = error {
self.presentAlertOnMainThread(title: "Something went wrong", message: error.rawValue)
return
}
self.favorites.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: .left)
}
}
}
| [
-1
] |
31bdcdccd854dd53e527a465484a6ae03c030e2d | cc9e99fa3ffd11bc77737db1973b1c9205f6643a | /AviasalesSDKTemplate/Source/HotelsSource/SearchVC/KidsPicker/HLKidsPickerVC.swift | c7b0a23959b946bcc9a45d4b3d06df4328c8b93a | [
"MIT"
] | permissive | ecofincoo/Aviasales-iOS-SDK | e05a157dac00b58fad2ffe2831aaed34c192dece | 3004fce7988952b10f009a02cdb678ec4fab18b8 | refs/heads/master | 2021-09-01T07:09:51.558398 | 2017-11-10T10:22:02 | 2017-11-10T10:22:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 8,048 | swift | import UIKit
fileprivate func < <T: Comparable>(lhs: T?, rhs: T?) -> Bool {
switch (lhs, rhs) {
case let (l?, r?):
return l < r
case (nil, _?):
return true
default:
return false
}
}
fileprivate func > <T: Comparable>(lhs: T?, rhs: T?) -> Bool {
switch (lhs, rhs) {
case let (l?, r?):
return l > r
default:
return rhs < lhs
}
}
fileprivate func <= <T: Comparable>(lhs: T?, rhs: T?) -> Bool {
switch (lhs, rhs) {
case let (l?, r?):
return l <= r
default:
return !(rhs < lhs)
}
}
@objc protocol KidsPickerDelegate: class {
func kidsSelected()
}
@objc class HLKidsPickerVC: HLCommonVC, UITableViewDataSource, UITableViewDelegate, HLKidAgePickerViewDelegate {
var searchInfo: HLSearchInfo? {
didSet {
self.updateControls()
}
}
weak var delegate: KidsPickerDelegate?
@IBOutlet private weak var tableView: UITableView!
var cleanButton: UIBarButtonItem?
private var kidAgePickerView: HLKidAgePickerView?
private var lockerView: HLLockerView?
private var rowsCount: Int = 4
// MARK: - Override methods
override func viewDidLoad() {
super.viewDidLoad()
title = NSLS("HL_KIDS_PICKER_TITLE")
view.backgroundColor = JRColorScheme.mainBackgroundColor()
tableView.scrollsToTop = false
tableView.allowsSelectionDuringEditing = false
tableView.hl_registerNib(withName: HLKidsPickerTableCell.hl_reuseIdentifier())
let sel = #selector(HLKidsPickerVC.clean)
cleanButton = UIBarButtonItem(title: NSLS("HL_CLEAN_BUTTON_TITLE"), style: .plain, target: self, action: sel)
navigationItem.rightBarButtonItem = cleanButton
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
updateControls()
}
override func goBack() {
delegate?.kidsSelected()
super.goBack()
}
// MARK: - Private metods
@objc @IBAction func clean() {
searchInfo?.kidAgesArray = []
updateControls()
}
func updateControls() {
cleanButton?.isEnabled = (searchInfo?.kidAgesArray.count > 0)
tableView?.reloadData()
}
private func cellState(_ indexPath: IndexPath) -> HLKidsPickerTableCellState {
let kidsCount = searchInfo?.kidAgesArray.count
var state = HLKidsPickerTableCellState.disabled
if kidsCount == indexPath.row {
state = HLKidsPickerTableCellState.ready
} else if kidsCount > indexPath.row {
state = HLKidsPickerTableCellState.selected
}
return state
}
private func showAgePicker() {
kidAgePickerView = loadViewFromNibNamed("HLKidAgePickerView") as! HLKidAgePickerView?
kidAgePickerView?.delegate = self
kidAgePickerView?.frame = view.bounds
let index = tableView.indexPathForSelectedRow?.row
if let kidAges = searchInfo?.kidAgesArray, kidAges.count > index {
kidAgePickerView?.kidAge = kidAges[index!]
}
kidAgePickerView?.show(view, animated: true)
}
// MARK: - Needed for cell editing mode!!
private func lockScreenWithTouchTransparent(_ forCell: HLKidsPickerTableCell?) {
lockerView = HLLockerView(frame: view.bounds)
let deleteButtonFrame = forCell?.deleteButton.frame ?? CGRect.zero
lockerView!.touchTransparentRect = (forCell?.convert(deleteButtonFrame, to: tableView))!
lockerView!.translatesAutoresizingMaskIntoConstraints = false
lockerView!.backgroundColor = UIColor.clear
lockerView!.touchAction = {
if let cell = forCell {
cell.hideDeleteButton(true)
}
}
view.addSubview(lockerView!)
let constraintWidth = NSLayoutConstraint.constraints(withVisualFormat: "H:|[selfView]|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: ["selfView": lockerView!])
view.addConstraints(constraintWidth)
}
private func unlockScreen() {
lockerView?.removeFromSuperview()
}
// MARK: - UITableViewDataSource methods
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return rowsCount
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return tableView.bounds.height / 4.0
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: HLKidsPickerTableCell.hl_reuseIdentifier()) as! HLKidsPickerTableCell
cell.kidNumber = indexPath.row + 1
cell.state = cellState(indexPath)
cell.hideDeleteButton(false)
cell.willBeginEditingCellHandler = { [weak self] (cell: HLKidsPickerTableCell) -> Void in
self?.lockScreenWithTouchTransparent(cell)
self?.tableView.isEditing = true
}
cell.didEndEditingCellHandler = { [weak self] (cell: HLKidsPickerTableCell) -> Void in
self?.unlockScreen()
self?.tableView.isEditing = false
}
cell.deleteCellHandler = { [weak self] (cell: HLKidsPickerTableCell) -> Void in
if let strongSelf = self {
if strongSelf.searchInfo?.kidAgesArray.count > (indexPath as NSIndexPath).row {
strongSelf.searchInfo?.kidAgesArray.remove(at: indexPath.row)
strongSelf.view.isUserInteractionEnabled = false
CATransaction.begin()
CATransaction.setCompletionBlock({ () -> Void in
strongSelf.view.isUserInteractionEnabled = true
strongSelf.updateControls()
})
tableView.beginUpdates()
tableView.deleteRows(at: [indexPath], with: UITableViewRowAnimation.bottom)
let lastIndexPath = IndexPath(row: strongSelf.rowsCount - 1, section: 0)
tableView.insertRows(at: [lastIndexPath], with: UITableViewRowAnimation.bottom)
tableView.endUpdates()
CATransaction.commit()
}
}
}
if let kidAges = searchInfo?.kidAgesArray {
if kidAges.count > indexPath.row {
cell.kidAge = kidAges[indexPath.row]
}
}
return cell
}
// MARK: - UITableViewDelegate methods
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row <= searchInfo?.kidAgesArray.count {
showAgePicker()
}
}
func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCellEditingStyle {
return UITableViewCellEditingStyle.none
}
func tableView(_ tableView: UITableView, shouldIndentWhileEditingRowAt indexPath: IndexPath) -> Bool {
return false
}
// MARK: - HLKidAgePickerViewDelegate methods
func didSelectAge(_ age: Int) {
if let ip = tableView.indexPathForSelectedRow {
if searchInfo?.kidAgesArray.count > ip.row {
searchInfo?.kidAgesArray[ip.row] = age
} else {
searchInfo?.kidAgesArray.append(age)
}
updateControls()
}
}
func didCloseAgeSelector() {
if let indexPath = tableView.indexPathForSelectedRow {
tableView.deselectRow(at: indexPath, animated: true)
}
}
// MARK: - HLLockerView class
fileprivate class HLLockerView: UIView {
var touchTransparentRect: CGRect = CGRect.zero
var touchAction:(() -> Void)?
fileprivate override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
if touchTransparentRect.contains(point) {
return false
}
touchAction?()
return super.point(inside: point, with: event)
}
}
}
| [
-1
] |
ec05b73ba48e88aef86bbb9dc35593341d09e1bc | 80eebb80698267ae4392d7a59f3db6802a11fe26 | /Alayam/SourceCode/Model/Data/BreakingNewsData.swift | 74772fd0fbb6c7e1530c01d79b31c2cb00ecdca9 | [] | no_license | hebenapps/Alayam-iOS | f15281088a5da7fac74cb593b6e33c92d16221d6 | 1988e63fe35cf93102d49f0c0e707edfe43b7ad9 | refs/heads/master | 2021-01-20T22:19:06.541840 | 2016-09-25T08:22:33 | 2016-09-25T08:22:33 | 63,856,038 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,344 | swift | //
// BreakingNewsData.swift
// Alayam
//
// Created by Mala on 9/6/15.
// Copyright (c) 2015 Vaijayanthi Mala. All rights reserved.
//
import UIKit
class BreakingNewsData: NSObject {
}
class BreakingNewsRequestDTO: NSObject {
var category = ""
}
class BreakingNewsResponseDTO: NSObject {
var Data = DataDTO()
}
class BreakingNewsDataDTO : NSObject
{
var HomeRegularNews = NSMutableArray()
// var CategoryNews = NSMutableArray()
}
class BreakingNewsContentDTO : NSObject {
var ContentType = ""
var SectionName = ""
var IssueID : NSNumber = 0.0
var NewsTitle = ""
var NewsSubTitle = ""
var NewsSummary = ""
var NewsPhotoCaption = ""
var NewsDetails = ""
var NewsDate = ""
var ImageURL = ""
var ImageURL_S = ""
var ImageURL_EXS = ""
var NEWSURL = ""
var NEWSTIME = ""
}
class BreakingNewsDTO: BreakingNewsContentDTO {
}
class BreakingNewsCategoryDTO: BreakingNewsContentDTO
{
}
class TagsResponseDTO : NSObject
{
var Data = DataDTO()
}
class TagsDTO : NSObject{
var TagID : NSNumber = 0
var Name = ""
}
class TagsNewsResponseDTO : NSObject
{
var Data = DataDTO()
}
class TagsNewsDTO : NSObject{
var Data = DataDTO()
var Status = ""
var ErrorMessage : String?
var ErrorCode : String?
}
| [
-1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.