blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
625
content_id
stringlengths
40
40
detected_licenses
listlengths
0
47
license_type
stringclasses
2 values
repo_name
stringlengths
5
116
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
643 values
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
80.4k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
16 values
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_language
stringclasses
85 values
src_encoding
stringclasses
7 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
1 class
length_bytes
int64
4
6.44M
extension
stringclasses
17 values
content
stringlengths
4
6.44M
duplicates
listlengths
1
9.02k
b28ad60eebf5c43bb7e99feeea93b8f760effc00
f5c63de302c538303b8c11a119c3873a07195937
/eggplant-brownie/Models/RefeicaoDao.swift
593abca5425b8661f04f1a634398bc139a1ccd67
[]
permissive
soniishy/eggplant-brownie
a0b70006a2af8ac8680bd9ef328e107bace03ecd
9ab415f84bd89dbec394da241fb72a5abd03729a
refs/heads/main
2023-03-25T09:17:48.182868
2021-03-18T17:33:56
2021-03-18T17:33:56
346,394,958
0
0
MIT
2021-03-10T15:05:52
2021-03-10T15:05:51
null
UTF-8
Swift
false
false
1,269
swift
// // RefeicaoDao.swift // eggplant-brownie // // Created by Soni Hachtel Ishy on 3/17/21. // Copyright © 2021 Alura. All rights reserved. // import Foundation class RefeicaoDao { func save(_ refeicoes: [Refeicao]) { guard let caminho = recuperaCaminho() else { return } do { let dados = try NSKeyedArchiver.archivedData(withRootObject: refeicoes, requiringSecureCoding: false) try dados.write(to: caminho) } catch { print(error.localizedDescription) } } func recupera() -> [Refeicao] { guard let caminho = recuperaCaminho() else { return [] } do { let dados = try Data(contentsOf: caminho) guard let refeicoesSalvas = try NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(dados) as? Array<Refeicao> else { return [] } return refeicoesSalvas } catch { print(error.localizedDescription) return [] } } func recuperaCaminho() -> URL? { guard let diretorio = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else { return nil } let caminho = diretorio.appendingPathComponent("refeicao") return caminho } }
[ -1 ]
d473f5db41734995823a9c82802c1e3d4533198b
491753f1e29ca5842b69c889727a00a757ba3aed
/StockTickerExample/StockTickerExample/StockTickerExample/StockTickerExample/AppDelegate.swift
c69ba56f9ef81fb7fe9fc71879b64d0c833b3c50
[]
no_license
ZedYeung/Smartphones_Based_Web_Development
ada99ab4d7636dcc7521d8fa932166f50897f87c
f1c7ca36d9a8817739136bfe4f64f07df43ea63a
refs/heads/master
2020-05-04T17:59:57.312747
2019-04-25T01:35:19
2019-04-25T01:35:19
179,335,221
0
0
null
null
null
null
UTF-8
Swift
false
false
4,602
swift
// // AppDelegate.swift // StockTickerExample // // Created by Ashish on 2/19/19. // Copyright © 2019 Ashish. All rights reserved. // import UIKit import CoreData @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(_ application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. } func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. // Saves changes in the application's managed object context before the application terminates. self.saveContext() } // MARK: - Core Data stack lazy var persistentContainer: NSPersistentContainer = { /* The persistent container for the application. This implementation creates and returns a container, having loaded the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail. */ let container = NSPersistentContainer(name: "StockTickerExample") container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { // Replace this implementation with code to handle the error appropriately. // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. /* Typical reasons for an error here include: * The parent directory does not exist, cannot be created, or disallows writing. * The persistent store is not accessible, due to permissions or data protection when the device is locked. * The device is out of space. * The store could not be migrated to the current model version. Check the error message to determine what the actual problem was. */ fatalError("Unresolved error \(error), \(error.userInfo)") } }) return container }() // MARK: - Core Data Saving support func saveContext () { let context = persistentContainer.viewContext if context.hasChanges { do { try context.save() } catch { // Replace this implementation with code to handle the error appropriately. // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. let nserror = error as NSError fatalError("Unresolved error \(nserror), \(nserror.userInfo)") } } } }
[ 294405, 243717, 163848, 313353, 320008, 320014, 313360, 288275, 322580, 289300, 290326, 329747, 139803, 322080, 306721, 229408, 296483, 322083, 229411, 306726, 309287, 308266, 292907, 217132, 322092, 40495, 316465, 288306, 322102, 324663, 164408, 308281, 322109, 286783, 315457, 313409, 313413, 320582, 349765, 309832, 288329, 242250, 215117, 196177, 241746, 344661, 231000, 212571, 300124, 287323, 309342, 325220, 306790, 290409, 310378, 296043, 311914, 322666, 334446, 307310, 292466, 314995, 307315, 314487, 291450, 314491, 222846, 288383, 318599, 312970, 239252, 311444, 294038, 311449, 323739, 300194, 298662, 233638, 233644, 313005, 286896, 295600, 300208, 286389, 294070, 125111, 234677, 321212, 309439, 235200, 284352, 296641, 242371, 302787, 284360, 321228, 319181, 298709, 284374, 189654, 182486, 320730, 241371, 311516, 357083, 179420, 322272, 317665, 298210, 165091, 311525, 288489, 290025, 229098, 307436, 304365, 323310, 125167, 313073, 286455, 306424, 322299, 319228, 302332, 319231, 184576, 309505, 241410, 311043, 366339, 309509, 318728, 125194, 234763, 321806, 125201, 296218, 313116, 237858, 326434, 295716, 313125, 300836, 289577, 125226, 133421, 317233, 241971, 316726, 318264, 201530, 313660, 159549, 287038, 292159, 218943, 182079, 288578, 301893, 234828, 292172, 300882, 321364, 243032, 201051, 230748, 258397, 294238, 298844, 300380, 291169, 199020, 293741, 266606, 319342, 292212, 313205, 244598, 316788, 124796, 196988, 305022, 317821, 243072, 314241, 313215, 303999, 242050, 325509, 293767, 316300, 306576, 322448, 308114, 319900, 298910, 313250, 308132, 316327, 306605, 316334, 324015, 324017, 200625, 300979, 316339, 322998, 67000, 316345, 296888, 300987, 319932, 310718, 292288, 317888, 323520, 312772, 214980, 298950, 306632, 310733, 289744, 310740, 235994, 286174, 315359, 240098, 323555, 236008, 319465, 248299, 311789, 326640, 188913, 203761, 320498, 314357, 288246, 309243, 300540, 310782 ]
773526b82f45850b82f71e1a965825ba083806c3
0553d728cff40c7cac6abb4b8318ea386461240b
/テスト版【最新】ログインできるデータ,0829よりパスワード忘れた方など作り込み開始/practice20210704/ContactViewController.swift
8f25d00c53e354668f214a5a35072d948c0fbd88
[]
no_license
minakoyasui/question
815caa3dd5a6a429e5c8eda71d55ff1f26d826c4
082371ec5a8987bcb62cb6921c0fff0c7a037ac7
refs/heads/main
2023-07-16T17:41:03.662524
2021-09-04T17:58:22
2021-09-04T17:58:22
403,120,015
0
0
null
null
null
null
UTF-8
Swift
false
false
859
swift
// // ContactViewController.swift // practice20210704 // // Created by MINAKO YASUI on 2021/08/22. // import UIKit import WebKit class ContactViewController: UIViewController { @IBOutlet weak var webview: WKWebView! override func viewDidLoad() { super.viewDidLoad() if let url = NSURL(string: "https://www.google.com") { let request = NSURLRequest(url: url as URL) webview.load(request as URLRequest) } } /* // 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 ]
33ac3e70b5b454589fcbe210400c4d345de60d5b
632f71eae497a8b71ca659b8c599e26b4972ef01
/MinimedKitTests/ChangeTempBasalCarelinkMessageBodyTests.swift
19d1a60f535439d6486f72ef2c8d85c6225f3176
[ "MIT" ]
permissive
ochenmiller/naterade-ios
4811594a75ca34914f1faee93a37e2aabd3a50c3
2cbd0bc732112c535689dd5b192520be151095d1
refs/heads/master
2021-01-18T05:03:42.323994
2016-04-07T04:49:35
2016-04-07T04:49:35
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,802
swift
// // ChangeTempBasalCarelinkMessageBodyTests.swift // Naterade // // Created by Nathan Racklyeft on 3/6/16. // Copyright © 2016 Nathan Racklyeft. All rights reserved. // import XCTest @testable import MinimedKit class ChangeTempBasalCarelinkMessageBodyTests: XCTestCase { func testTempBasalMessageBody() { let message = PumpMessage(packetType: .Carelink, address: "123456", messageType: .ChangeTempBasal, messageBody: ChangeTempBasalCarelinkMessageBody(unitsPerHour: 1.1, duration: NSTimeInterval(30 * 60))) XCTAssertEqual( NSData(hexadecimalString: "a71234564C03002C0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), message.txData ) } func testTempBasalMessageBodyLarge() { let message = PumpMessage(packetType: .Carelink, address: "123456", messageType: .ChangeTempBasal, messageBody: ChangeTempBasalCarelinkMessageBody(unitsPerHour: 6.5, duration: NSTimeInterval(150 * 60))) XCTAssertEqual( NSData(hexadecimalString: "a71234564C0301040500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), message.txData ) } func testTempBasalMessageBodyRounding() { let message = PumpMessage(packetType: .Carelink, address: "123456", messageType: .ChangeTempBasal, messageBody: ChangeTempBasalCarelinkMessageBody(unitsPerHour: 1.442, duration: NSTimeInterval(65.5 * 60))) XCTAssertEqual( NSData(hexadecimalString: "a71234564C0300390200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), message.txData ) } }
[ -1 ]
5a3625bcc6d6b95810de460c15230dc0a2613c34
ae9000e568d1569a7cf78f333072314f810928b9
/AutoLayout/AutoLayout/AppDelegate.swift
4e387ab853b3541b25c067d00d91ee88fa34e2e4
[]
no_license
scottpark/iOS
33a555bdda0d585b1add1e5920ce823d40ef495e
6cbaa98111084857aa3dd8344c8424c9a9f9f89a
refs/heads/master
2021-01-19T17:07:14.612599
2017-05-08T19:19:49
2017-05-08T19:19:49
88,305,089
0
0
null
null
null
null
UTF-8
Swift
false
false
6,090
swift
// // AppDelegate.swift // AutoLayout // // Created by Scott on 18/04/2017. // Copyright © 2017 Scott. All rights reserved. // import UIKit import CoreData @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } func applicationDidEnterBackground(application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. // Saves changes in the application's managed object context before the application terminates. self.saveContext() } // MARK: - Core Data stack lazy var applicationDocumentsDirectory: NSURL = { // The directory the application uses to store the Core Data store file. This code uses a directory named "com.ScottPark.AutoLayout" in the application's documents Application Support directory. let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask) return urls[urls.count-1] }() lazy var managedObjectModel: NSManagedObjectModel = { // The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model. let modelURL = NSBundle.mainBundle().URLForResource("AutoLayout", withExtension: "momd")! return NSManagedObjectModel(contentsOfURL: modelURL)! }() lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator = { // The persistent store coordinator for the application. This implementation creates and returns a coordinator, having added the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail. // Create the coordinator and store let coordinator = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel) let url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("SingleViewCoreData.sqlite") var failureReason = "There was an error creating or loading the application's saved data." do { try coordinator.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: nil) } catch { // Report any error we got. var dict = [String: AnyObject]() dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data" dict[NSLocalizedFailureReasonErrorKey] = failureReason dict[NSUnderlyingErrorKey] = error as NSError let wrappedError = NSError(domain: "YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict) // Replace this with code to handle the error appropriately. // abort() 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. NSLog("Unresolved error \(wrappedError), \(wrappedError.userInfo)") abort() } return coordinator }() lazy var managedObjectContext: NSManagedObjectContext = { // Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) This property is optional since there are legitimate error conditions that could cause the creation of the context to fail. let coordinator = self.persistentStoreCoordinator var managedObjectContext = NSManagedObjectContext(concurrencyType: .MainQueueConcurrencyType) managedObjectContext.persistentStoreCoordinator = coordinator return managedObjectContext }() // MARK: - Core Data Saving support func saveContext () { if managedObjectContext.hasChanges { do { try managedObjectContext.save() } catch { // Replace this implementation with code to handle the error appropriately. // abort() 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 NSLog("Unresolved error \(nserror), \(nserror.userInfo)") abort() } } } }
[ 283144, 277514, 277003, 280085, 278551, 278042, 276510, 281635, 194085, 277030, 228396, 277038, 223280, 278577, 280132, 162394, 282203, 189025, 292450, 285796, 279148, 278125, 285296, 227455, 278656, 228481, 276611, 278665, 280205, 225934, 278674, 188050, 276629, 283803, 278687, 282274, 277154, 278692, 228009, 287402, 227499, 278700, 284845, 278705, 276149, 278711, 279223, 278718, 283838, 228544, 279753, 229068, 227533, 280273, 278751, 201439, 226031, 159477, 280312, 203532, 181516, 277262, 280335, 284432, 278289, 278801, 284434, 321296, 276751, 278287, 276755, 278808, 278297, 282910, 281379, 282915, 280370, 277306, 278844, 280382, 282433, 237382, 164166, 226634, 276313, 278877, 280415, 277344, 276321, 227687, 334185, 279405, 278896, 277363, 281972, 275828, 278902, 280439, 276347, 228220, 279422, 278916, 284557, 293773, 191374, 277395, 283028, 288147, 214934, 278943, 282016, 283554, 230320, 230322, 281011, 283058, 286130, 278971, 276923, 282558, 299970, 280007, 288200, 284617, 287689, 286157, 326096, 281041, 283091, 282585, 294390, 282616, 214010 ]
1a4a8f606b86f7bdae53478e61d28111daba482b
65f47ce8a083a7161906c5d319960d9699185976
/FishSnap/FishSnap/AppDelegate.swift
9071bbce5fc363d9777561c3c6616532969f25cf
[ "MIT" ]
permissive
andrewcar/fishsnap
d2a92404b664ac4e89f34918f189802013094700
6c35c260b079182a5a4ac6f08a8777af89b16658
refs/heads/master
2021-04-28T15:04:03.562635
2018-02-14T01:28:55
2018-02-14T01:28:55
121,980,554
2
0
null
2018-02-18T18:55:57
2018-02-18T18:55:57
null
UTF-8
Swift
false
false
255
swift
// // AppDelegate.swift // FishSnap // // Created by Dulio Denis on 2/10/18. // Copyright © 2018 ddApps. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? }
[ -1 ]
2f860d9caff86d50f2a2390c33d29a37fc8da36b
53ec9500eaf93cb2aa5dcb1f1ee74f6c28fad619
/iOSapp/iOSapp/NewsViewController.swift
f9e0d0ebad99eb99948e950043fa88dfd245947c
[]
no_license
nBeebz/4577-iOS404
25967ed5490d7f8ee59eb98dca2aab6b7bfce870
b16f249efe8b4613f27a605558a02d4101a3b0b8
refs/heads/master
2020-05-17T19:40:59.764041
2015-04-12T17:49:20
2015-04-12T17:49:20
29,716,029
0
3
null
null
null
null
UTF-8
Swift
false
false
745
swift
// // NewsViewController.swift // iOSapp // // Created by Nav Bhatti on 2015-04-07. // Copyright (c) 2015 Team 404. All rights reserved. // import UIKit class NewsViewController: UIViewController { @IBOutlet var titled: UILabel! @IBOutlet var text: UITextView! @IBOutlet var date: UILabel! @IBOutlet var author: UILabel! override func viewDidLoad() { super.viewDidLoad() var newsItem = Data.sharedInstance.activeNews text.text = newsItem["content"].stringValue date.text = "Posted on " + DataSource.getNiceDate(newsItem["_id"].doubleValue as NSTimeInterval) author.text = "By " + newsItem["name"].stringValue titled.text = newsItem["title"].stringValue } }
[ -1 ]
36bfed9156c443860827a9c535e30c3966dfb432
1f7ffdb199e25baf505d2329e25e7a441f4ea3ee
/Slipways/View/Details/WaterDetailsView.swift
de06453120a39f81779da778dcc9cfd18d94ac74
[]
no_license
Marcel-B/Slipways.iOS
64e5d5c0af3b618feb65a0a1cf29a1341b511045
11feab34f248bb43ea4265924871ed2f7361696c
refs/heads/master
2020-08-31T14:19:39.124330
2020-02-03T21:37:41
2020-02-03T21:37:41
218,709,363
1
0
null
2020-02-03T21:37:42
2019-10-31T07:33:15
Swift
UTF-8
Swift
false
false
934
swift
// // WaterDetailsView.swift // Slipways // // Created by Marcel Benders on 23.11.19. // Copyright © 2019 Marcel Benders. All rights reserved. // import SwiftUI struct WaterDetailsView: View { let water: Water var body: some View { List{ HStack{ Text("Stations") Spacer() Image("ruler") } ForEach(water.station?.allObjects as! [Station], id: \.self) { station in NavigationLink(destination: StationDetailsView(stationViewModel: StationViewModel(station))){ Text(station.name ?? String.Empty) .font(.custom("Exo2-Regular", size: 22)) } } }.navigationBarTitle(water.name ?? "n/a") } } struct WaterDetailsView_Previews: PreviewProvider { static var previews: some View { WaterDetailsView(water: Water()) } }
[ -1 ]
ff751cdf3f966bc26cc893a8cd23727eb79129aa
e7ed2f4bb6404206076c8137a0ae023c14100028
/Layout/UIStackView+Layout.swift
30ad7a43b6776f656cce51d8dfe825bd90912327
[ "MIT" ]
permissive
wanhmr/layout
3b23bf46f57d4c6c108b18b256e22c28cec74b2c
3e03de19caaec1570663e4c23701647c7b30529b
refs/heads/master
2021-07-12T03:00:12.844704
2017-10-16T14:09:05
2017-10-17T10:30:24
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,288
swift
// Copyright © 2017 Schibsted. All rights reserved. import UIKit extension UIStackView { open override class var expressionTypes: [String: RuntimeType] { var types = super.expressionTypes types["axis"] = RuntimeType([ "horizontal": .horizontal, "vertical": .vertical, ] as [String: UILayoutConstraintAxis]) types["distribution"] = RuntimeType([ "fill": .fill, "fillEqually": .fillEqually, "fillProportionally": .fillProportionally, "equalSpacing": .equalSpacing, "equalCentering": .equalCentering, ] as [String: UIStackViewDistribution]) types["alignment"] = RuntimeType([ "fill": .fill, "leading": .leading, "top": .top, "firstBaseline": .firstBaseline, "center": .center, "trailing": .trailing, "bottom": .bottom, "lastBaseline": .lastBaseline, // Valid for horizontal axis only ] as [String: UIStackViewAlignment]) types["spacing"] = RuntimeType(CGFloat.self) types["arrangedSubviews"] = .unavailable() // UIStackView is a non-drawing view, so none of these properties are available for name in [ "backgroundColor", "contentMode", "layer.backgroundColor", "layer.cornerRadius", "layer.borderColor", "layer.borderWidth", "layer.contents", "layer.masksToBounds", "layer.shadowColor", "layer.shadowOffset", "layer.shadowOffset.height", "layer.shadowOffset.width", "layer.shadowOpacity", "layer.shadowPath", "layer.shadowPathIsBounds", "layer.shadowRadius", ] { types[name] = .unavailable() } return types } open override func didInsertChildNode(_ node: LayoutNode, at index: Int) { super.didInsertChildNode(node, at: index) addArrangedSubview(node.view) } open override func willRemoveChildNode(_ node: LayoutNode, at index: Int) { (node._view as UIView?).map(removeArrangedSubview) super.willRemoveChildNode(node, at: index) } }
[ -1 ]
e22c643ba61d28c8029ac2283a4c1f3a5529b3bf
74490ea35e626599149c02a30cb499a276dfb2f6
/Sources/SQLKit/Query/SQLFunction.swift
42fd406257407b23cec5507d5980337b3a322b96
[ "MIT" ]
permissive
vapor/sql-kit
b794fbf4e3e8feafc13b7e41383198ed00079528
f7bbbb022cb52e1828a137bcab2bd1ea2a3e583d
refs/heads/main
2023-08-07T13:55:19.040338
2023-08-01T23:41:02
2023-08-01T23:41:02
130,444,879
136
46
MIT
2023-07-11T02:03:43
2018-04-21T06:02:52
Swift
UTF-8
Swift
false
false
1,248
swift
public struct SQLFunction: SQLExpression { public let name: String public let args: [any SQLExpression] @inlinable public init(_ name: String, args: String...) { self.init(name, args: args.map { SQLIdentifier($0) }) } @inlinable public init(_ name: String, args: [String]) { self.init(name, args: args.map { SQLIdentifier($0) }) } @inlinable public init(_ name: String, args: any SQLExpression...) { self.init(name, args: args) } @inlinable public init(_ name: String, args: [any SQLExpression] = []) { self.name = name self.args = args } public func serialize(to serializer: inout SQLSerializer) { serializer.write(self.name) SQLGroupExpression(self.args).serialize(to: &serializer) } } extension SQLFunction { @inlinable public static func coalesce(_ expressions: [any SQLExpression]) -> SQLFunction { .init("COALESCE", args: expressions) } /// Convenience for creating a `COALESCE(foo)` function call (returns the first non-null expression). @inlinable public static func coalesce(_ exprs: any SQLExpression...) -> SQLFunction { self.coalesce(exprs) } }
[ -1 ]
be34c926c34621587490e7a36684fd33eb4396fa
c5212256b6052b374f7e1b42f0190a25d0feb4c3
/SwiftUI MVVM Example/ViewModels/StockListViewModel.swift
ab172a5e3a6fe65fb9164e46de8d8171b1577af0
[]
no_license
fomagran/SwiftUI-MVVM-Example
76028b239e1d62e52eccbe80e029d52b21b8f5ea
9eaf4d133a035dc9e453e40c650f783499c7b316
refs/heads/main
2023-04-22T18:44:32.347915
2021-05-03T04:00:14
2021-05-03T04:00:14
355,035,892
0
0
null
null
null
null
UTF-8
Swift
false
false
992
swift
// // StockListViewModel.swift // SwiftUI MVVM Example // // Created by Fomagran on 2021/04/06. // import Foundation import SwiftUI class StockListViewModel :ObservableObject{ @Published var dragOffset:CGSize = CGSize(width:0,height:680) @Published var searchTerm:String = "" @Published var stocks:[StockViewModel] = [StockViewModel]() @Published var news: [NewsArticleViewModel] = [] func load() { fetchNews() fetchStocks() } private func fetchStocks() { WebService().getStocks { stocks in if let stocks = stocks { DispatchQueue.main.async { self.stocks = stocks.map(StockViewModel.init) } } } } private func fetchNews() { WebService().getTopNews { news in if let news = news { self.news = news.map(NewsArticleViewModel.init) } } } }
[ -1 ]
c642e109d7b0b447668dd4454d9b99516f7d2870
02ccaf8ddcd63f90a706721061cb6c7866fc2091
/Nutritious/Helper/Downloader.swift
8f95fa3b75f8d122e7901aef1e6173f0bfca76dc
[]
no_license
ntminh2712/Nutritious
826db7f3927dc2c98ac83f5ee571d31b13670808
ff8bb9aa90c481f028d9b8b7b99b39f3559f9171
refs/heads/master
2020-09-17T00:16:47.280224
2019-12-11T12:40:43
2019-12-11T12:40:43
223,929,546
0
0
null
null
null
null
UTF-8
Swift
false
false
3,361
swift
// // Downloader.swift // Meditation // // Created by MinhNT on 11/22/19. // Copyright © 2019 MinhNT. All rights reserved. // import Foundation class Downloader { static func loadFileSync(url: URL, completion: @escaping (String?, Error?) -> Void) { let documentsUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first! let destinationUrl = documentsUrl.appendingPathComponent(url.lastPathComponent) if FileManager().fileExists(atPath: destinationUrl.path) { print("File already exists [\(destinationUrl.path)]") completion(destinationUrl.path, nil) } else if let dataFromURL = NSData(contentsOf: url) { if dataFromURL.write(to: destinationUrl, atomically: true) { print("file saved [\(destinationUrl.path)]") completion(destinationUrl.path, nil) } else { print("error saving file") let error = NSError(domain:"Error saving file", code:1001, userInfo:nil) completion(destinationUrl.path, error) } } else { let error = NSError(domain:"Error downloading file", code:1002, userInfo:nil) completion(destinationUrl.path, error) } } static func loadFileAsync(url: URL,name:String, completion: @escaping (String?, Error?) -> Void) { let documentsUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first! let destinationUrl = documentsUrl.appendingPathComponent("\(name)") if FileManager().fileExists(atPath: destinationUrl.path) { completion(destinationUrl.path, nil) } else { let session = URLSession(configuration: URLSessionConfiguration.default, delegate: nil, delegateQueue: nil) var request = URLRequest(url: url) request.httpMethod = "GET" let task = session.dataTask(with: request, completionHandler: { data, response, error in if error == nil { if let response = response as? HTTPURLResponse { if response.statusCode == 200 { if let data = data { if let _ = try? data.write(to: destinationUrl, options: Data.WritingOptions.atomic) { completion(destinationUrl.path, error) } else { completion(destinationUrl.path, error) } } else { completion(destinationUrl.path, error) } } } } else { completion(destinationUrl.path, error) } }) task.resume() } } }
[ 134432 ]
ff9b4060e2eb5a5e84c2caa481971f927f31845e
f8a2f192fb3da62bed854689e861469c59769efb
/Gem/Source/Modules/Main/Coordinator/MainNavigationCoordinator.swift
ec7abb8c4393906912f642e44c56789658515ca2
[]
no_license
johnm03/Gem
d4169660d900c1d641f3c3bac01968f2458842ff
c72f7b799c361481967e3022ca5101a502fd0e2a
refs/heads/master
2020-03-27T04:49:35.432172
2018-09-07T13:11:59
2018-09-07T13:11:59
145,971,599
0
0
null
null
null
null
UTF-8
Swift
false
false
543
swift
// // MainNavigationCoordinator.swift // Gem import UIKit struct MainNavigationCoordinator: Coordinatable { let destination: MainTabBarController func prepareForNavigation() { let menuItems = [Menu(type: .master, title: "Master"), Menu(type: .prs, title: "PRs")] let presenter = MainPresenter(withMenuItems: MenuViewModelFactory().makeMenuViewModels(fromMenu: menuItems)) presenter.viewController = destination destination.presenter = presenter } }
[ -1 ]
65208ab51562cded9600ffaf405fb9518f6e72a6
376c0b7212720144f07ec0aa009add999dfc3bad
/ToDoAppTests/ViewControllerTests.swift
3adf34ccbd5fd0b58dc90ef6d9021842b7af4003
[]
no_license
richagnetto/ToDo_Swift
c72161add13c8ee8040925f356311d71c2cf2c29
9020f6e0e24029df5e1f01bc4ffadd3edf2a8c59
refs/heads/master
2021-08-23T22:59:37.432200
2017-12-07T00:25:32
2017-12-07T00:25:32
113,374,824
0
0
null
null
null
null
UTF-8
Swift
false
false
1,725
swift
// // ViewControllerTests.swift // ToDoAppTests // // Created by Richa Netto on 12/6/17. // Copyright © 2017 Richa Netto. All rights reserved. // import XCTest import RealmSwift @testable import ToDoApp class ViewControllerTests: 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 testInit_ShouldTakeDetailAndPriority(){ let newToDoObject = ToDo(detail: "Groceries", priority: 3) XCTAssertEqual(newToDoObject.detail, "Groceries") XCTAssertEqual(newToDoObject.priority, 3) XCTAssertNotNil(newToDoObject.createdAt) } //Can be tested when realm data is initially empty to check for sorting /* func testInit_EntriesShouldBeSortedByPriority(){ let firstToDoObject = ToDo(detail: "Driving Practice", priority: 2) let secondToDoObject = ToDo(detail: "Dance Practice", priority: 4) RealmService.shared.create(firstToDoObject) RealmService.shared.create(secondToDoObject) //var ToDoObjs = [ToDo]() var ToDoPriorities = [Int]() for obj in RealmService.shared.realm.objects(ToDo.self).sorted(byKeyPath: "priority", ascending: false){ ToDoPriorities.append(obj.priority) } print(ToDoPriorities) XCTAssertEqual(ToDoPriorities, [4,2]) RealmService.shared.delete(firstToDoObject) RealmService.shared.delete(secondToDoObject) } */ }
[ -1 ]
f474bbdbeb5bcec5ab93d65411ed05d711020483
f9d00fac32a3f232b521d745c82c43b8d1525f0b
/pokedex/ViewController.swift
c3ddd6999eb0811ead74048c4d6556239347d34b
[]
no_license
ryantallmadge/ios-pokedex
6a40416e71cf637a7a6b36a2b19ecfe2da97b4fe
aa33c644088128e155a7bf179063bc8a93af90e3
refs/heads/master
2020-06-16T23:45:11.286550
2015-12-16T15:21:57
2015-12-16T15:21:57
48,118,065
0
0
null
null
null
null
UTF-8
Swift
false
false
502
swift
// // ViewController.swift // pokedex // // Created by Ryan Tallmadge on 12/16/15. // Copyright © 2015 ryant. 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. } }
[ 278543, 317473, 237616, 360501, 286775, 237624, 288827, 286786, 159812, 284740, 243786, 286796, 237655, 307288, 200802, 276580, 356460, 307311, 276597, 276612, 280710, 303242, 311437, 278675, 299165, 278693, 100521, 307379, 280760, 280770, 227523, 280772, 280775, 280777, 276686, 313550, 229585, 307410, 280797, 280808, 286963, 280821, 286965, 280824, 280826, 280832, 276736, 278786, 287007, 282917, 233767, 307516, 278845, 289088, 287055, 323933, 289120, 227688, 313706, 299374, 199024, 276849, 278897, 311684, 313733, 227740, 285087, 289187, 278968, 127418, 293308, 278973, 289224, 281042, 276959, 279011, 276965, 281078, 236022, 233980, 287231, 279041, 279046, 215562, 277006, 281107, 279064, 236057, 281118, 295460, 289318, 309807, 279096, 234043, 277057, 129604, 301637, 158285, 281202, 277108, 287350, 285321, 227984, 117399, 228000, 225955, 287399, 326311, 277171, 285377, 287437, 226009, 277224, 234223, 312049, 289524, 226038, 234232, 230147, 226055, 299786, 295696, 281373, 228127, 281380, 234279, 283433, 312107, 293682, 289596, 283453, 279360, 289600, 293700, 279380, 295766, 279386, 308064, 303977, 293742, 162672, 207738, 291709, 303998, 183173, 304008, 324491, 304012, 234380, 304015, 226196, 277406, 234402, 291755, 324528, 230323, 234423, 277432, 281530, 291774, 295874, 299973, 234465, 168936, 183278, 277487, 293874, 277502, 293888, 277508, 277512, 275466, 234511, 304174, 300086, 234551, 300089, 238653, 293961, 300107, 300116, 281701, 281703, 296042, 277612, 164974, 312433, 300149, 234619, 285837, 226447, 234641, 349332, 302235, 285855, 234665, 283839, 277696, 228548, 228551, 279751, 279754, 230604, 298189, 302286, 230608, 189655, 302295, 298202, 298204, 363743, 298207, 298211, 228585, 120054, 204027, 300288, 312586, 296216, 277797, 130346, 300358, 238920, 234829, 296272, 306540, 310649, 333179, 290175, 275842, 224643, 300432, 226705, 310673, 306578, 144811, 370093, 286126, 277935, 282035, 292277, 296374, 130487, 306633, 288205, 286158, 280015, 310734, 163289, 286175, 286189, 282095, 308721, 296436, 302580, 310773, 290299, 288251, 286204, 290303, 282128, 286234, 282143, 282145, 284197, 296487, 296489, 286249, 286257, 40505, 226878, 288321, 228932, 226887, 288331, 288332, 226896, 212561, 284242, 292435, 284240, 300629, 276054, 280146, 228945, 282202, 212573, 40545, 292451, 284261, 306791, 286314, 284275, 314996, 284277, 276087, 284279, 284287, 284289, 276099, 284298, 278157, 282262, 280219, 284315, 284317, 282270, 282275, 280231, 284328, 313007, 284336, 284341, 286390, 300727, 276150, 282301, 302788, 282311, 276167, 284361, 282320, 284373, 282329, 282338, 284391, 282346, 294636, 358127, 288501, 282357, 358137, 358139, 282365, 286462, 282368, 358147, 282377, 300817, 282389, 282393, 278298, 329499, 276256, 278304, 315170, 282403, 282411, 159541, 282426, 288577, 288579, 307029, 276309, 241499, 188253, 292730, 294812, 284580, 284586, 276396, 282548, 165832, 301012, 301016, 294889, 231405, 298989, 227315, 237556, 237564 ]
fc6d3d440197305fd9fb6cdadf23b4f3ef4f378e
0138ccdc11f1cee3f4e66c90de4b5b425ea38d67
/DrawMyNameTests/DrawMyNameTests.swift
393609cfcd2e50e37fa349c440548a29598174ed
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
lcs-syang/TortoiseGraphics
336d94910cc74379c426d04ff3017525aa9cc5bf
48997b6a5a26c8c9dfc1caa322b0feadee2c5458
refs/heads/master
2020-04-04T14:13:57.898435
2019-01-09T14:59:24
2019-01-09T14:59:24
155,992,221
0
0
null
null
null
null
UTF-8
Swift
false
false
862
swift
// // DrawMyNameTests.swift // DrawMyNameTests // // Created by Yang, Selena on 2018-11-02. // import XCTest @testable import DrawMyName class DrawMyNameTests: 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, 229413, 204840, 344107, 155694, 229430, 163896, 180280, 376894, 352326, 311372, 311374, 196691, 385116, 237663, 254048, 319591, 221290, 131178, 319598, 204916, 131191, 131198, 319629, 311438, 196760, 426138, 377009, 180408, 295098, 139479, 229597, 311519, 205035, 327929, 344313, 147717, 368905, 278797, 254226, 368916, 262421, 377114, 237856, 237857, 278816, 311597, 98610, 180535, 336183, 287041, 139589, 344401, 377169, 368981, 155990, 368984, 106847, 98657, 270701, 270706, 139640, 311685, 106888, 385417, 311691, 385422, 213403, 385454, 377264, 311738, 33211, 336320, 311745, 278978, 254406, 188871, 278989, 278993, 328152, 369116, 287198, 279008, 279013, 279018, 311786, 319981, 319987, 279029, 254456, 377338, 377343, 254465, 279050, 139792, 303636, 279062, 393751, 279065, 377376, 377386, 197167, 385588, 115270, 377418, 385615, 426576, 369235, 139872, 295536, 287346, 139892, 287352, 344696, 279164, 311941, 336518, 311945, 369289, 344715, 311949, 287374, 377489, 311954, 352917, 295576, 230040, 271000, 303771, 377500, 377497, 205471, 344738, 139939, 279206, 205487, 295599, 303793, 336564, 164533, 287417, 287422, 377539, 164560, 385747, 279252, 361176, 418520, 287452, 295652, 369385, 312052, 172792, 344827, 221948, 279294, 205568, 295682, 197386, 434957, 312079, 295697, 426774, 197399, 426775, 197411, 279336, 295724, 312108, 197422, 353070, 164656, 295729, 197431, 230199, 336702, 295746, 353109, 377686, 230234, 189275, 435039, 295776, 303972, 385893, 246643, 295798, 361337, 254850, 369538, 295824, 353195, 140204, 377772, 304051, 230332, 377790, 353215, 213957, 345033, 279498, 386006, 418776, 50143, 123881, 287731, 271350, 295927, 312314, 328700, 328706, 410627, 320516, 295942, 386056, 353290, 377869, 320527, 238610, 418837, 140310, 197657, 369701, 238639, 312373, 238651, 377926, 214086, 296019, 353367, 304222, 230499, 173166, 312434, 377972, 353397, 337017, 377983, 402565, 386189, 238743, 296092, 238765, 238769, 402613, 230588, 353479, 353481, 402634, 189652, 189653, 419029, 148696, 296153, 304351, 304356, 222440, 328940, 279792, 353523, 386294, 386301, 320770, 386306, 328971, 353551, 320796, 222494, 115998, 279854, 353584, 345396, 386359, 345403, 378172, 312648, 337225, 304456, 230729, 238927, 353616, 296273, 222559, 378209, 386412, 296303, 296307, 116084, 181625, 337281, 148867, 296329, 304524, 296335, 9619, 370071, 173491, 304564, 279989, 353719, 280004, 361927, 312782, 271843, 329200, 296433, 321009, 280055, 230913, 329225, 296461, 304656, 329232, 370197, 402985, 394794, 230959, 288309, 312889, 288318, 288327, 280147, 239198, 157281, 99938, 312940, 222832, 337534, 337535, 263809, 312965, 288392, 239250, 419478, 321199, 337591, 280251, 321219, 403148, 9936, 9937, 370388, 272085, 345814, 345821, 321247, 321249, 345833, 345834, 280300, 67315, 173814, 288512, 288516, 321295, 321302, 345879, 116505, 321310, 255776, 313120, 362283, 378668, 296755, 345919, 436031, 403267, 280392, 345929, 18262, 362327, 345951, 362337, 345955, 296806, 296814, 214895, 313199, 362352, 182144, 305026, 67463, 329622, 337815, 436131, 313254, 436137, 362417, 362431, 214977, 280514, 214984, 362443, 231375, 329695, 436191, 313319, 436205, 296941, 223218, 43014, 354316, 313357, 239650, 329765, 354343, 223274, 346162, 288828, 436285, 288833, 288834, 436292, 403525, 436301, 338001, 354385, 338003, 280661, 329814, 354393, 280675, 280677, 43110, 321637, 329829, 436329, 288879, 223350, 280694, 288889, 215164, 215166, 280712, 346271, 436383, 362659, 239793, 182456, 379071, 280768, 149703, 346314, 321745, 280795, 387296, 280802, 379106, 346346, 321772, 125169, 436470, 149760, 411906, 313608, 321800, 272658, 338197, 305440, 338218, 321840, 379186, 321860, 182597, 280902, 289110, 215385, 354655, 321894, 313713, 354676, 436608, 362881, 240002, 436611, 108944, 190871, 149916, 420253, 141728, 289189, 108972, 272813, 338356, 436661, 281037, 289232, 281040, 256477, 330218, 109042, 174593, 240131, 420369, 289304, 207393, 289332, 174648, 338489, 338490, 297560, 436832, 436834, 420463, 346737, 313971, 346740, 420471, 330379, 330387, 117396, 346772, 330388, 264856, 289434, 346779, 289462, 314040, 109241, 248517, 363211, 363230, 289502, 264928, 330474, 289518, 199414, 322313, 117517, 322319, 166676, 207640, 281377, 289576, 191283, 273207, 289598, 281427, 322395, 109409, 330609, 174963, 207732, 109428, 158593, 109447, 224145, 355217, 256922, 289690, 420773, 289703, 240552, 363438, 347055, 289722, 289727, 273344, 330689, 363458, 379844, 19399, 248796, 347103, 52200, 289774, 347123, 240630, 314362, 257024, 330754, 134150, 330763, 281626, 175132, 248872, 322612, 314448, 339030, 281697, 314467, 257125, 281706, 273515, 207979, 404593, 363641, 363644, 150657, 248961, 330888, 363669, 339100, 380061, 429214, 199839, 265379, 249002, 306346, 3246, 421048, 265412, 290000, 298208, 298212, 298213, 290022, 330984, 298221, 298228, 216315, 208124, 437505, 322824, 257305, 126237, 339234, 372009, 412971, 298291, 306494, 216386, 224586, 331090, 314709, 314710, 372054, 159066, 134491, 314720, 134506, 306542, 380271, 208244, 249204, 249205, 290169, 290173, 306559, 314751, 224640, 306560, 298374, 314758, 314760, 142729, 388487, 314766, 224661, 290207, 314783, 314789, 314791, 396711, 396712, 241066, 314798, 380337, 380338, 150965, 380357, 339398, 306631, 306639, 413137, 429542, 191981, 282096, 191990, 290301, 372227, 323080, 323087, 323089, 175639, 388632, 396827, 282141, 134686, 347694, 290358, 265798, 282183, 265804, 224847, 118353, 396882, 290390, 44635, 396895, 323172, 224883, 314998, 323196, 175741, 339584, 282246, 290443, 282259, 257699, 298661, 61101, 224946, 110268, 224958, 282303, 323264, 274115, 306890, 241361, 298720, 12010, 339715, 216839, 339720, 372496, 323346, 339745, 241441, 315171, 257830, 421672, 200498, 315202, 307011, 282438, 413521, 216918, 241495, 282480, 241528, 315264, 339841, 241540, 315273, 315274, 372626, 380821, 118685, 298909, 323507, 290745, 274371, 151497, 372701, 298980, 380908, 241692, 315432, 315434, 102445, 233517, 176175, 282672, 241716, 225351, 315465, 307289, 200794, 315487, 356447, 438377, 233589, 266357, 233590, 422019, 241808, 381073, 299174, 405687, 258239, 389313, 299203, 299209, 372941, 266449, 356576, 307435, 438511, 381172, 184575, 381208, 151839, 233762, 217380, 151847, 282919, 332083, 332085, 332089, 282939, 438596, 332101, 323913, 348492, 282960, 323920, 348500, 168281, 332123, 332127, 323935, 242023, 160110, 242033, 291192, 315773, 291198, 340357, 225670, 332167, 242058, 373134, 291224, 242078, 315810, 315811, 381347, 340398, 299441, 283064, 291265, 127427, 291267, 127428, 283075, 324039, 373197, 160225, 127465, 291311, 233978, 291333, 340490, 258581, 291358, 234036, 315960, 348732, 242237, 70209, 348742, 70215, 348749, 381517, 332378, 201308, 111208, 184940, 373358, 389745, 209530, 291454, 373375, 152195, 348806, 316049, 111253, 316053, 111258, 111259, 176808, 299699, 299700, 422596, 422599, 291530, 225995, 242386, 422617, 422626, 299746, 234217, 299759, 299776, 291585, 430849, 291592, 62220, 422673, 430865, 291604, 422680, 291612, 152365, 422703, 422709, 152374, 160571, 430910, 160575, 160580, 381773, 201549, 201551, 242529, 349026, 357218, 177001, 201577, 308076, 242541, 209783, 177019, 185211, 308092, 398206, 291712, 381829, 316298, 349072, 308112, 209817, 390045, 127902, 185250, 185254, 316333, 373687, 316343, 373706, 316364, 316405, 349175, 201720, 127992, 357379, 324625, 308243, 316437, 300068, 357414, 300084, 324666, 308287, 21569, 218186, 341073, 439384, 300135, 316520, 357486, 316526, 144496, 300150, 291959, 300151, 160891, 300158, 349316, 349318, 373903, 169104, 177296, 119962, 300187, 300188, 283802, 300201, 300202, 373945, 259268, 283852, 283853, 259280, 316627, 333011, 333022, 234733, 234742, 128251, 292091, 439562, 292107, 414990, 251153, 177428, 349462, 333090, 382258, 300343, 382269, 333117, 300359, 177484, 406861, 259406, 234831, 120148, 357719, 374109, 316765, 333160, 316787, 111993, 357762, 112017, 234898, 259475, 275859, 112018, 357786, 251298, 333220, 316842, 374191, 292283, 300487, 300489, 284107, 210390, 210391, 210393, 333282, 144867, 103909, 316902, 251378, 308723, 300536, 300542, 292356, 259599, 316946, 308756, 398869, 374296, 374299, 308764, 431649, 169518, 431663, 194110, 235070, 349763, 292423, 218696, 292425, 243274, 128587, 333388, 128599, 235095, 333408, 300644, 415338, 243307, 54893, 325231, 333430, 325245, 194180, 415375, 153251, 300714, 210603, 415420, 333503, 259781, 333509, 333517, 333520, 325346, 153319, 325352, 325371, 194303, 194304, 284431, 243472, 161554, 366360, 325404, 399147, 431916, 284459, 300848, 259899, 325439, 325445, 153415, 341836, 415567, 325457, 317269, 341847, 284507, 350044, 128862, 300894, 276327, 292712, 325484, 423789, 292720, 325492, 276341, 341879, 317304, 333688, 112509, 194429, 55167, 325503, 333701, 243591, 243597, 325518, 333722, 350109, 292771, 300963, 415655, 292782, 317360, 243637, 284619, 301008, 153554, 292836, 292837, 317415, 325619, 432116, 333817, 292858, 415741, 333828, 358410, 399373, 145435, 317467, 292902, 325674, 129076, 243767, 358456, 309345, 194666, 260207, 432240, 333940, 415881, 104587, 235662, 325776, 284826, 333991, 227513, 301251, 227524, 309444, 194782, 301279, 317664, 243962, 375039, 194820, 325905, 325912, 227616, 211235, 432421, 211238, 358703, 358709, 325968, 366929, 366930, 334171, 383332, 383336, 211326, 317831, 227725, 252308, 285084, 121245, 317852, 342450, 293303, 293310, 416197, 129483, 342476, 317901, 285150, 342498, 358882, 334309, 391655, 432618, 375276, 301571, 342536, 416286, 375333, 293419, 244269, 375343, 23092, 375351, 244281, 301638, 309830, 293448, 55881, 416341, 244310, 416351, 268899, 244327, 39530, 301689, 244347, 326287, 375440, 334481, 318106, 318107, 342682, 318130, 383667, 293556, 342706, 39614, 154316, 375526, 342762, 342763, 293612, 154359, 432893, 162561, 383754, 326414, 310036, 326429, 293664, 326433, 400166, 293672, 318252, 285487, 301871, 375609, 293693, 252741, 318278, 293711, 244568, 244570, 342887, 400239, 310131, 400252, 359298, 359299, 260996, 113542, 416646, 228233, 392074, 236428, 56208, 318364, 310176, 310178, 310182, 293800, 236461, 293806, 326581, 326587, 326601, 359381, 433115, 343005, 326635, 203757, 187374, 383983, 277492, 318461, 293886, 293893, 433165, 384016, 433174, 326685, 252958, 203830, 359478, 302139, 392290, 253029, 228458, 318572, 15471, 351344, 285814, 285820, 392318, 384131, 302213, 302216, 228491, 228493, 326804, 285851, 351390, 253099, 253100, 318639, 367799, 113850, 294074, 228540, 228542, 302274, 367810, 195808, 310497, 302325, 261377, 228609, 245019, 253216, 261425, 351537, 171317, 318775, 286013, 146762, 294218, 294219, 318805, 425304, 163175, 327024, 327025, 318848, 294275, 253317, 384393, 368011, 318864, 318868, 318875, 310692, 245161, 286129, 286132, 228795, 425405, 302531, 425418, 302540, 310732, 64975, 310736, 327121, 286172, 245223, 286202, 359930, 286205, 302590, 253451, 359950, 146964, 253463, 187938, 286244, 245287, 245292, 196164, 56902, 228943, 179801, 343647, 286306, 310889, 204397, 138863, 188016, 294529, 229001, 188048, 302739, 425626, 229020, 302754, 40613, 40614, 40615, 384695, 327358, 212685, 384720, 302802, 229088, 212716, 212717, 360177, 319233, 360195, 286494, 294700, 409394, 319292, 360252, 360264, 376669, 245599, 237408, 425825, 302946, 425833, 417654, 188292, 327557, 294807, 376732, 311199, 319392, 294823, 327596, 294843, 188348, 237504, 294850, 384964, 344013, 212942, 24532, 294886, 278512, 311281, 311282 ]
13cb31c53a8ff01b072ccf43cd44d9be847edbb5
fe36aa3f487664cc4917c3e53db84104f11a07b8
/InTouchApp/Core Layer/Networking/Request/RequestSender.swift
2bfe4475d3944dfc3810964a415454aff28ba904
[]
no_license
CrazyMillerGitHub/InTouch
bfad62b19f3c969f4cf1ebdb13717e8acaf1808c
f59e48541bc35ec8a65ff992df934608d53f3f38
refs/heads/master
2021-06-17T23:39:26.906049
2019-04-23T20:02:35
2019-04-23T20:02:35
169,702,313
0
1
null
2021-02-14T08:08:05
2019-02-08T08:03:30
Swift
UTF-8
Swift
false
false
1,341
swift
// // RequestSender.swift // InTouchApp // // Created by Михаил Борисов on 17/04/2019. // Copyright © 2019 Mikhail Borisov. All rights reserved. // import Foundation class RequestSender: IRequestSender { let session = URLSession.shared func send<Parser>(requestConfig config: RequestConfig<Parser>, completionHandler: @escaping (Result<Parser.Model>) -> Void) { guard let urlRequest = config.request.urlRequest else { completionHandler(Result.error("url string can't be parsed to URL")) return } let task = session.dataTask(with: urlRequest) { (data: Data?, _: URLResponse?, error: Error?) in if let error = error { completionHandler(Result.error(error.localizedDescription)) return } print("I'm here to parse your daata") guard let data = data, let parsedModel: Parser.Model = config.parser.parse(data: data) else { completionHandler(Result.error("received data can't be parsed")) return } DispatchQueue.global(qos: .background).async { completionHandler(Result.success(parsedModel)) } } task.resume() } }
[ 165169 ]
295e9fabda437398bb7c48b64faaedf86e958073
f5ffa44cf5278d155b50f12faca0a6fc9ca322c8
/Sources/BluetoothGATT/GATTClientCharacteristicConfiguration.swift
0157f2c34194e6b456eab65182d48ea05934bc41
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
PureSwift/Bluetooth
d1a1d2cb455378ab4564529ed4c7fe14e34355b3
9b0a2d0fba678831f9b87cde805d686177e4551d
refs/heads/master
2023-05-13T11:26:06.296388
2023-04-28T07:12:22
2023-04-28T07:12:22
55,272,510
162
26
MIT
2022-11-17T08:50:50
2016-04-02T01:45:12
Swift
UTF-8
Swift
false
false
2,469
swift
// // GATTClientCharacteristicConfiguration.swift // Bluetooth // // Created by Alsey Coleman Miller on 6/13/18. // Copyright © 2018 PureSwift. All rights reserved. // import Foundation /// GATT Client Characteristic Configuration Descriptor /// /// The Client Characteristic Configuration descriptor defines how the characteristic may be /// configured by a specific client. /// /// This descriptor shall be persistent across connections for bonded devices. /// The Client Characteristic Configuration descriptor is unique for each client. /// A client may read and write this descriptor to determine and set the configuration for that client. /// Authentication and authorization may be required by the server to write this descriptor. /// The default value for the Client Characteristic Configuration descriptor is `0x00`. /// Upon connection of non-binded clients, this descriptor is set to the default value. @frozen public struct GATTClientCharacteristicConfiguration: GATTDescriptor { public static let uuid: BluetoothUUID = .clientCharacteristicConfiguration public static let length = 2 public var configuration: BitMaskOptionSet<Configuration> public init(configuration: BitMaskOptionSet<Configuration> = []) { self.configuration = configuration } public init?(data: Data) { guard data.count == type(of: self).length else { return nil } let rawValue = UInt16(littleEndian: UInt16(bytes: (data[0], data[1]))) self.configuration = BitMaskOptionSet<Configuration>(rawValue: rawValue) } public var data: Data { let bytes = configuration.rawValue.littleEndian.bytes return Data([bytes.0, bytes.1]) } public var descriptor: GATTAttribute.Descriptor { return GATTAttribute.Descriptor(uuid: type(of: self).uuid, value: data, permissions: [.read, .write]) } } // MARK: - Supporting Types public extension GATTClientCharacteristicConfiguration { /// GATT Client Characteristic Configuration Options enum Configuration: UInt16, BitMaskOption { /// Notifications enabled case notify = 0b01 /// Indications enabled case indicate = 0b10 public static let allCases: [Configuration] = [.notify, .indicate] } }
[ -1 ]
36a7cd08fa9ac6774b89b113f2ae4c67fccfe8b6
c300578d95e5dcacab6508c5319a22e519e707a1
/adventOfCode2015Tests/Day7Tests.swift
de8465439eced2857064892f91d3fec64eec969c
[]
no_license
fatlazycat/adventOfCode2015
a7769c5fdd82e7afeae231d37e1375a86ca07ca1
dbdcb4181166d1d02242c403aa3e1725a6f1088c
refs/heads/main
2023-08-19T17:04:11.883967
2021-10-28T07:20:21
2021-10-28T07:20:21
324,507,555
0
0
null
null
null
null
UTF-8
Swift
false
false
7,348
swift
import XCTest import SwiftHamcrest import Parsing import Foundation class Day7Test: XCTestCase { let notParser = Skip(PrefixThrough<Substring>("NOT ")) .take(Prefix(while: { $0.isLetter })) .skip(StartsWith(" -> ")) .take(Rest()) .map{ Logic.NOT(from: String($0), to: String($1)) } let leftShiftParser = Prefix<Substring>(while: { $0.isLetter }) .skip(StartsWith(" LSHIFT ")) .take(Int.parser()) .skip(StartsWith(" -> ")) .take(Rest()) .map{ Logic.LSHIFT(from: String($0), to: String($2), shift: $1) } let rightShiftParser = Prefix<Substring>(while: { $0.isLetter }) .skip(StartsWith(" RSHIFT ")) .take(Int.parser()) .skip(StartsWith(" -> ")) .take(Rest()) .map{ Logic.RSHIFT(from: String($0), to: String($2), shift: $1) } let andParser = Int.parser().map{ Either.Right(UInt16($0)) } .orElse(Prefix<Substring>(while: { $0.isLetter }).map{ Either.Left(String($0)) }) .skip(StartsWith(" AND ")) .take(Prefix(while: { $0.isLetter })) .skip(StartsWith(" -> ")) .take(Rest()) .map{ Logic.AND(gateOne: $0, gateTwo: String($1), to: String($2)) } let orParser = Prefix<Substring>(while: { $0.isLetter }) .skip(StartsWith(" OR ")) .take(Prefix(while: { $0.isLetter })) .skip(StartsWith(" -> ")) .take(Rest()) .map{ Logic.OR(gateOne: String($0), gateTwo: String($1), to: String($2)) } let passThroughParser = Int.parser().map{ Either.Right(UInt16($0)) } .orElse(Prefix<Substring>(while: { $0.isLetter }).map{ Either.Left(String($0)) }) .skip(StartsWith(" -> ")) .take(Rest()) .map{ Logic.PASSTHROUGH(from: $0, to: String($1)) } func testNotParser() throws { assertThat(notParser.parse("NOT jd -> je") == Logic.NOT(from: "jd", to: "je")) } func testLeftShiftParser() throws { assertThat(leftShiftParser.parse("hb LSHIFT 1 -> hv") == Logic.LSHIFT(from: "hb", to: "hv", shift: 1)) } func testRightShiftParser() throws { assertThat(rightShiftParser.parse("fo RSHIFT 3 -> fq") == Logic.RSHIFT(from: "fo", to: "fq", shift: 3)) } func testAndParser() throws { assertThat(andParser.parse("ih AND ij -> ik") == Logic.AND(gateOne: .Left("ih"), gateTwo: "ij", to: "ik")) } func testOneAndParser() throws { assertThat(andParser.parse("1 AND jj -> jk") == Logic.AND(gateOne: .Right(1), gateTwo: "jj", to: "jk")) } func testOrParser() throws { assertThat(orParser.parse("t OR s -> u") == Logic.OR(gateOne: "t", gateTwo: "s", to: "u")) } func testPassThroughGateParser() throws { assertThat(passThroughParser.parse("lx -> a") == Logic.PASSTHROUGH(from: .Left("lx"), to: "a")) } func testPassThroughNumberParser() throws { assertThat(passThroughParser.parse("1 -> b") == Logic.PASSTHROUGH(from: .Right(1), to: "b")) } func testPart1testdata() throws { let logicParser = notParser .orElse(leftShiftParser) .orElse(rightShiftParser) .orElse(andParser) .orElse(orParser) .orElse(passThroughParser) let data = day7test.lines.map{ logicParser.parse($0)! } let outputGates = data.toDictionary{ $0.toGate() } assertThat(LogicGateCalc().resultForGate(gate: "d", gates: outputGates), equalTo(72)) assertThat(LogicGateCalc().resultForGate(gate: "e", gates: outputGates), equalTo(507)) assertThat(LogicGateCalc().resultForGate(gate: "f", gates: outputGates), equalTo(492)) assertThat(LogicGateCalc().resultForGate(gate: "g", gates: outputGates), equalTo(114)) assertThat(LogicGateCalc().resultForGate(gate: "h", gates: outputGates), equalTo(65412)) assertThat(LogicGateCalc().resultForGate(gate: "i", gates: outputGates), equalTo(65079)) assertThat(LogicGateCalc().resultForGate(gate: "x", gates: outputGates), equalTo(123)) assertThat(LogicGateCalc().resultForGate(gate: "y", gates: outputGates), equalTo(456)) } func testPart1() throws { let logicParser = notParser .orElse(leftShiftParser) .orElse(rightShiftParser) .orElse(andParser) .orElse(orParser) .orElse(passThroughParser) let data = day7.lines.map{ logicParser.parse($0)! } let outputGates = data.toDictionary{ $0.toGate() } let result = LogicGateCalc().resultForGate(gate: "a", gates: outputGates) assertThat(result, equalTo(46065)) } func testPart2() throws { let logicParser = notParser .orElse(leftShiftParser) .orElse(rightShiftParser) .orElse(andParser) .orElse(orParser) .orElse(passThroughParser) let data = day7.lines.map{ logicParser.parse($0)! } var outputGates = data.toDictionary{ $0.toGate() } outputGates.updateValue(.PASSTHROUGH(from: Either.Right(46065), to: "b"), forKey: "b") let result = LogicGateCalc().resultForGate(gate: "a", gates: outputGates) assertThat(result, equalTo(14134)) } } enum Either<A, B>: Equatable where A: Equatable, B: Equatable { case Left(A) case Right(B) static func from(_ a: A) -> Either { return .Left(a) } static func from(_ b: B) -> Either { return .Right(b) } } enum Logic: Equatable { case NOT(from: String, to: String) case LSHIFT(from: String, to: String, shift: Int) case RSHIFT(from: String, to: String, shift: Int) case AND(gateOne: Either<String, UInt16>, gateTwo: String, to: String) case OR(gateOne: String, gateTwo: String, to: String) case PASSTHROUGH(from: Either<String, UInt16>, to: String) func toGate() -> String { switch self { case .NOT(from: _, to: let to): return to case .LSHIFT(from: _, to: let to, shift: _): return to case .RSHIFT(from: _, to: let to, shift: _): return to case .AND(gateOne: _, gateTwo: _, to: let to): return to case .OR(gateOne: _, gateTwo: _, to: let to): return to case .PASSTHROUGH(from: _, to: let to): return to } } } class LogicGateCalc { private var memo: Dictionary<String, UInt16> = Dictionary() func resultForGate(gate: String, gates: Dictionary<String, Logic>) -> UInt16 { let logicGate = gates[gate]! if let memo = memo[gate] { return memo } let result: UInt16 switch logicGate { case .NOT(from: let from, to: _): result = ~resultForGate(gate: from, gates: gates) case .LSHIFT(from: let from, to: _, shift: let shift): result = resultForGate(gate: from, gates: gates) << shift case .RSHIFT(from: let from, to: _, shift: let shift): result = resultForGate(gate: from, gates: gates) >> shift case .AND(Either<String, UInt16>.Left(gateOne: let gateOne), gateTwo: let gateTwo, to: _): result = resultForGate(gate: gateOne, gates: gates) & resultForGate(gate: gateTwo, gates: gates) case .AND(Either<String, UInt16>.Right(gateOne: let gateOne), gateTwo: let gateTwo, to: _): result = gateOne & resultForGate(gate: gateTwo, gates: gates) case .OR(gateOne: let gateOne, gateTwo: let gateTwo, to: _): result = resultForGate(gate: gateOne, gates: gates) | resultForGate(gate: gateTwo, gates: gates) case .PASSTHROUGH(Either<String, UInt16>.Left(from: let from), to: _): result = resultForGate(gate: from, gates: gates) case .PASSTHROUGH(Either<String, UInt16>.Right(from: let from), to: _): result = from } memo[gate] = result return result } }
[ -1 ]
d2be8491e23fd7770e099bbdf94e94a7d6824d00
f3f29c86fc31146fa69cc29569c58b232a279375
/Sources/AccountTransactionApiV3p1p1Types/Models/OBStandingOrder5Detail.swift
c4b6fa2da1cef0eef9b67f0a51a3b385ac576421
[ "Apache-2.0" ]
permissive
oscarbano/open-banking-connector-swift
2568a3f43078efe799a3c0cebc6697e8329c9efa
c38b9a383fc3b6388aaa3d0fee9d546671c75ae2
refs/heads/master
2022-03-31T05:49:22.667747
2020-02-05T23:46:53
2020-02-05T23:46:53
null
0
0
null
null
null
null
UTF-8
Swift
false
false
6,427
swift
// // OBStandingOrder5Detail.swift // // Generated by swagger-codegen // https://github.com/swagger-api/swagger-codegen // import Foundation public struct OBStandingOrder5Detail: Codable { public var accountId: AccountId /** A unique and immutable identifier used to identify the standing order resource. This identifier has no meaning to the account owner. */ public var standingOrderId: String? /** Individual Definitions: EvryDay - Every day EvryWorkgDay - Every working day IntrvlDay - An interval specified in number of calendar days (02 to 31) IntrvlWkDay - An interval specified in weeks (01 to 09), and the day within the week (01 to 07) WkInMnthDay - A monthly interval, specifying the week of the month (01 to 05) and day within the week (01 to 07) IntrvlMnthDay - An interval specified in months (between 01 to 06, 12, 24), specifying the day within the month (-05 to -01, 01 to 31) QtrDay - Quarterly (either ENGLISH, SCOTTISH, or RECEIVED) ENGLISH &#x3D; Paid on the 25th March, 24th June, 29th September and 25th December. SCOTTISH &#x3D; Paid on the 2nd February, 15th May, 1st August and 11th November. RECEIVED &#x3D; Paid on the 20th March, 19th June, 24th September and 20th December. Individual Patterns: EvryDay (ScheduleCode) EvryWorkgDay (ScheduleCode) IntrvlDay:NoOfDay (ScheduleCode + NoOfDay) IntrvlWkDay:IntervalInWeeks:DayInWeek (ScheduleCode + IntervalInWeeks + DayInWeek) WkInMnthDay:WeekInMonth:DayInWeek (ScheduleCode + WeekInMonth + DayInWeek) IntrvlMnthDay:IntervalInMonths:DayInMonth (ScheduleCode + IntervalInMonths + DayInMonth) QtrDay: + either (ENGLISH, SCOTTISH or RECEIVED) ScheduleCode + QuarterDay The regular expression for this element combines five smaller versions for each permitted pattern. To aid legibility - the components are presented individually here: EvryDay EvryWorkgDay IntrvlDay:((0[2-9])|([1-2][0-9])|3[0-1]) IntrvlWkDay:0[1-9]:0[1-7] WkInMnthDay:0[1-5]:0[1-7] IntrvlMnthDay:(0[1-6]|12|24):(-0[1-5]|0[1-9]|[12][0-9]|3[01]) QtrDay:(ENGLISH|SCOTTISH|RECEIVED) Full Regular Expression: ^(EvryDay)$|^(EvryWorkgDay)$|^(IntrvlDay:((0[2-9])|([1-2][0-9])|3[0-1]))$|^(IntrvlWkDay:0[1-9]:0[1-7])$|^(WkInMnthDay:0[1-5]:0[1-7])$|^(IntrvlMnthDay:(0[1-6]|12|24):(-0[1-5]|0[1-9]|[12][0-9]|3[01]))$|^(QtrDay:(ENGLISH|SCOTTISH|RECEIVED))$ */ public var frequency: String /** Unique reference, as assigned by the creditor, to unambiguously refer to the payment transaction. Usage: If available, the initiating party should provide this reference in the structured remittance information, to enable reconciliation by the creditor upon receipt of the amount of money. If the business context requires the use of a creditor reference or a payment remit identification, and only one identifier can be passed through the end-to-end chain, the creditor&#39;s reference or payment remittance identification should be quoted in the end-to-end transaction identification. */ public var reference: String? /** The date on which the first payment for a Standing Order schedule will be made. All dates in the JSON payloads are represented in ISO 8601 date-time format. All date-time fields in responses must include the timezone. An example is below: 2017-04-05T10:43:07+00:00 */ public var firstPaymentDateTime: Date? /** The date on which the next payment for a Standing Order schedule will be made. All dates in the JSON payloads are represented in ISO 8601 date-time format. All date-time fields in responses must include the timezone. An example is below: 2017-04-05T10:43:07+00:00 */ public var nextPaymentDateTime: Date? /** The date on which the final payment for a Standing Order schedule will be made. All dates in the JSON payloads are represented in ISO 8601 date-time format. All date-time fields in responses must include the timezone. An example is below: 2017-04-05T10:43:07+00:00 */ public var finalPaymentDateTime: Date? public var standingOrderStatusCode: OBExternalStandingOrderStatus1Code? public var firstPaymentAmount: OBActiveOrHistoricCurrencyAndAmount? public var nextPaymentAmount: OBActiveOrHistoricCurrencyAndAmount? public var finalPaymentAmount: OBActiveOrHistoricCurrencyAndAmount? public var supplementaryData: OBSupplementaryData1? public var creditorAgent: OBBranchAndFinancialInstitutionIdentification5? public var creditorAccount: OBCashAccount5 public init(accountId: AccountId, standingOrderId: String?, frequency: String, reference: String?, firstPaymentDateTime: Date?, nextPaymentDateTime: Date?, finalPaymentDateTime: Date?, standingOrderStatusCode: OBExternalStandingOrderStatus1Code?, firstPaymentAmount: OBActiveOrHistoricCurrencyAndAmount?, nextPaymentAmount: OBActiveOrHistoricCurrencyAndAmount?, finalPaymentAmount: OBActiveOrHistoricCurrencyAndAmount?, supplementaryData: OBSupplementaryData1?, creditorAgent: OBBranchAndFinancialInstitutionIdentification5?, creditorAccount: OBCashAccount5) { self.accountId = accountId self.standingOrderId = standingOrderId self.frequency = frequency self.reference = reference self.firstPaymentDateTime = firstPaymentDateTime self.nextPaymentDateTime = nextPaymentDateTime self.finalPaymentDateTime = finalPaymentDateTime self.standingOrderStatusCode = standingOrderStatusCode self.firstPaymentAmount = firstPaymentAmount self.nextPaymentAmount = nextPaymentAmount self.finalPaymentAmount = finalPaymentAmount self.supplementaryData = supplementaryData self.creditorAgent = creditorAgent self.creditorAccount = creditorAccount } public enum CodingKeys: String, CodingKey { case accountId = "AccountId" case standingOrderId = "StandingOrderId" case frequency = "Frequency" case reference = "Reference" case firstPaymentDateTime = "FirstPaymentDateTime" case nextPaymentDateTime = "NextPaymentDateTime" case finalPaymentDateTime = "FinalPaymentDateTime" case standingOrderStatusCode = "StandingOrderStatusCode" case firstPaymentAmount = "FirstPaymentAmount" case nextPaymentAmount = "NextPaymentAmount" case finalPaymentAmount = "FinalPaymentAmount" case supplementaryData = "SupplementaryData" case creditorAgent = "CreditorAgent" case creditorAccount = "CreditorAccount" } }
[ -1 ]
9ca4aea08bab351718f394d0b1635f5c80868672
b93e9b7e8deaaefc85bb9038ea8c52a26ee5eba2
/OkDoc/PresentationLayer/ReusableComponents/VIPERModules/Dialog/View/DialogViewInput.swift
8a5c03de97b1cab31fd6f70d2a4d2e21bb0268ea
[]
no_license
mohsinalimat/OkDoc
36c945fbd5480702b1c1629eed803a461c8cbc94
8ddfca9aff2b46818ea42084478fcfc227f5b9d4
refs/heads/master
2020-04-23T06:09:57.490559
2018-05-05T16:16:30
2018-05-05T16:16:30
170,964,448
1
0
null
2019-02-16T04:57:28
2019-02-16T04:57:28
null
UTF-8
Swift
false
false
298
swift
// // DialogDialogViewInput.swift // OkDoc // // Created by Beslan Tularov on 19/04/2018. // Copyright © 2018 BTR. All rights reserved. // protocol DialogViewInput: class { /** @author Beslan Tularov Setup initial state of the view */ func setupInitialState() }
[ -1 ]
7cd075ac65f6c3275ce15615973fb1272c7d7d25
da5704e6c78e1143568dc43b4dfe024a6881651e
/04_C4/04_C4/ScreenRecorder.swift
82d44465c3c3521a581d01d5ae51007906fde900
[]
no_license
sgnm/C4
2106a72111f81d0f83d60c11f5fa1c2a70c1dcc1
3bc3b8be083223c292ee72b5c28c10e16d80550f
refs/heads/master
2021-01-22T21:32:56.058949
2016-04-03T05:16:11
2016-04-03T05:16:11
53,933,844
2
1
null
2016-04-03T05:16:12
2016-03-15T10:04:12
Swift
UTF-8
Swift
false
false
3,007
swift
// Copyright © 2016 C4 // // 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 ReplayKit public class ScreenRecorder: NSObject, RPPreviewViewControllerDelegate { public typealias PreviewControllerFinishedAction = (activities: Set<String>?) -> () public typealias RecorderStoppedAction = () -> () let recorder = RPScreenRecorder.sharedRecorder() var preview: RPPreviewViewController? var activities: Set<String>? public var previewFinishedAction: PreviewControllerFinishedAction? public var recordingEndedAction: RecorderStoppedAction? public var enableMicrophone = false public func start() { preview = nil recorder.startRecordingWithMicrophoneEnabled(enableMicrophone) { error in if let error = error { print("Start Recording Error: \(error.localizedDescription)") } } } public func start(duration: Double) { start() wait(duration) { self.stop() } } public func stop() { recorder.stopRecordingWithHandler { previewViewController, error in self.preview = previewViewController self.preview?.previewControllerDelegate = self self.recordingEndedAction?() } } public func showPreviewInController(controller: UIViewController) { guard let preview = preview else { print("Recorder has no preview to show.") return } controller.presentViewController(preview, animated: true, completion: nil) } public func previewController(previewController: RPPreviewViewController, didFinishWithActivityTypes activityTypes: Set<String>) { activities = activityTypes } public func previewControllerDidFinish(previewController: RPPreviewViewController) { previewFinishedAction?(activities: activities) preview?.parentViewController?.dismissViewControllerAnimated(true, completion: nil) } }
[ -1 ]
78feb238cb2470b8ae19df25f6febc4546f9c736
d8f38621684c6ba4de3e857abff7060424dfa3c9
/SimulationFramework/SmartSimulationFramework/SmartSimulationFramework/Situations/Homelessness.swift
9d99f5cbb565ac3e4d8d954451450860a153c08e
[ "MIT" ]
permissive
mrommel/SmartSimulation
7c782dc3f695c7691bc4591bc46a567620f9fe46
19ee89102a514933fa7007dd3a21bdaf28ff24e3
refs/heads/master
2020-04-21T17:43:23.792531
2019-08-09T19:32:06
2019-08-09T19:32:06
169,745,570
0
0
null
null
null
null
UTF-8
Swift
false
false
1,702
swift
// // Homelessness.swift // SmartSimulationFramework // // Created by Michael Rommel on 19.10.18. // Copyright © 2018 Michael Rommel. All rights reserved. // import Foundation public class Homelessness: Situation { init() { super.init( identifier: "Homelessness", name: "Homelessness", summary: "More and more of our citizens are homeless and have taken to sleeping in the streets. This is having knock-on effects in the areas of crime and violent crime, and is also reducing everyone's quality of life. Something needs to be done to provide homes for these people!", startMessage: "We now have a homelessness problem. Many of our cities have people sleeping in the streets, often begging for money.", startTrigger: 0.6, endMessage: "We no longer have a problem with homelessness and people sleeping on our streets. This will cheer up our more liberal citizens, socialists, and of course the poorer members of our society.", endTrigger: 0.4, category: .welfare) // outputs: // Poor,-0.24-(0.3*x) // MiddleIncome,-0.06-(0.05*x) // Liberal,-0.09-(0.09*x) // CrimeRate,0.04+(0.04*x) // Alcoholism,0+(0.2*x) // DrugAddiction,0+(0.2*x) // Suicide,0+(0.4*x) } override func setup(with global: GlobalSimulation) { self.add(simulation: StaticProperty(value: 0.1)) self.add(simulation: global.simulations.povertyRate, formula: "0.9*x") //StateHousing,0-(0.4*x) //PrivateHousing,0-(0.4*x) //UnemployedBenefit,0-(0.3*x) //Unemployment,0+(0.9*x) //MortgageTaxRelief,-0.04-(0.04*x) //PropertyTax,0+(0.04*x) //Immigration,0+(0.06*x),4 super.setup(with: global) } }
[ -1 ]
6bc3d1bc3a59e02f578d68bcb9029bde34e444af
79e1d760b636c1866f81b4c6bf070e00fb53bbaf
/GithubAPI/SecondViewController.swift
bca40d5f87737d46b5e585cf42c6b16631eedf39
[]
no_license
ryosism/GithubAPI
ebb44f720489977675d03033c9c501cc2f0a4552
52e3a71c388210c458944776e1e176b4668a85c5
refs/heads/master
2021-01-22T06:59:16.612699
2017-02-13T03:37:52
2017-02-13T03:38:07
81,796,329
0
0
null
null
null
null
UTF-8
Swift
false
false
523
swift
// // SecondViewController.swift // GithubAPI // // Created by 祖父江亮 on 2017/02/08. // Copyright © 2017年 Ryo Sobue. All rights reserved. // import UIKit class SecondViewController: 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. } }
[ 281218, 281221, 295699, 349332, 294433, 295460, 236458, 284586, 279981, 292277, 292280, 290875, 277179, 10179, 302532, 280772, 158411, 296272, 311761, 280797, 289120, 281701, 281703, 229229, 293742, 216432, 293874, 189557, 281205, 358137 ]
e91744b0e4e58e000464188977ba5a7669e0e2bd
20d962db7ae6fb6849d61ece4e743b15fff3b3ff
/Sources/SwiftyMockyCLICore/Application.swift
8483827f03c8c96659732cd2a1430383b6c0b873
[ "MIT" ]
permissive
chkpnt/SwiftyMockyCLI
ba078cd9ffc32263ca9870753559d192693e2b0f
7d1d2b976b7911bea9a912b66a6604bdbb74b485
refs/heads/master
2022-11-29T11:22:58.205597
2020-08-01T11:30:01
2020-08-01T11:30:01
285,660,515
0
0
null
2020-08-06T20:01:29
2020-08-06T20:01:28
null
UTF-8
Swift
false
false
6,947
swift
import Foundation import PathKit import Commander public class Application { // MARK: - Properties public let version = "4.0.0" public var pwd = Path(ProcessInfo.processInfo.environment["PWD"] ?? "") public var handle: (Error) -> Void = { error in switch error { case let error as MockyError: Message.failure(Messages.message(for: error)) default: Message.failure("Error: \(error)") } exit(1) } // MARK: - Lifecycle public init() { } // MARK: - Commands public func generate(disableCache: Bool, verbose: Bool) { do { Message.info("Running at: \(pwd)") let command = try Instance.factory.resolveGenerationCommand(root: pwd) try command.generate(disableCache: disableCache, verbose: verbose) } catch { handle(error) } } public func generate(mock named: String, disableCache: Bool, verbose: Bool, watch: Bool = false) { do { Message.info("Running at: \(pwd)") let command = try Instance.factory.resolveGenerationCommand(root: pwd) try command.generate(mockName: named, disableCache: disableCache, verbose: verbose, watch: watch) } catch { handle(error) } } public func initialize() { let mockfilePath = (pwd + "Mockfile") guard !mockfilePath.exists else { Message.failure("Mockfile already exists!") return handle(MockyError.overrideWarning) } do { try mockfilePath.write(Assets.mockfileTemplate) Message.success("Successfully generated Mockfile") Message.hint("Use 'doctor' to validate it, or update manually. You can use 'autoimport' to resolve imports automatically") } catch { handle(error) } } #if os(macOS) public func setup(project path: String?) { let projectPath = path ?? "" do { let project = try ProjectSetupController( project: Path(projectPath), at: pwd ) let migration = try MigrationController(project: project.project, at: pwd) // 1. Verify if there is already a Mockfile if project.mockfileExists { Message.warning("Mockfile™ already exists.") Message.just(""" Available options: - continue (you will be prompted about overriding) - cancel, and setup manually """ ) // Read option Message.empty() Message.subheader("Do you want to continue?") switch BoolOption.select() { case .yes: break // Continue flow case .no: return // Finish now } } if migration.migrationPossible() { Message.success("Migration possible.") Message.just(""" Existing SwiftyMocky yml configurations found. Available options: - migrate (you will migrate existing yml configurations) - setup as new """ ) // Read option Message.empty() Message.subheader("Do you want to migrate?") switch BoolOption.select() { case .yes: try migration.migrate() case .no: try project.initializeAsANewMockfile() } } else { try project.initializeAsANewMockfile() } Message.empty() } catch { handle(error) } } public func migrate(project path: String?) { let projectPath = path ?? "" do { let setup = try MigrationController( project: Path(projectPath), at: pwd ) guard setup.migrationPossible() else { return Message.failure(Messages.Migrate.noConfigurations) } try setup.migrate() Message.empty() } catch { handle(error) } } public func autoimport() { do { let command = try Instance.factory.resolveGenerationCommand(root: pwd) try command.updateAllImports() } catch { handle(error) } } public func autoimport(forMock name: String?) { guard let name = name else { return autoimport() } do { let command = try Instance.factory.resolveGenerationCommand(root: pwd) try command.updateImports(forMockNamed: name) } catch { handle(error) } } public func doctor(project path: String?) { let projectPath = path ?? "" do { let inspector = try InspectionController(project: Path(projectPath), at: pwd) try inspector.inspectProject() inspector.inspectTools() inspector.inspectMockfile() Message.empty() } catch { handle(error) } } #endif // MARK: - Helpers and Debug public func assetizeTemplates( mockTemplate: Path, prototypeTemplate: Path, allTypesTemplate: Path, template: Path, output: Path ) { let allTypesName = "AllTypes.swifttemplate" let allTypesPlaceholder = "{{ \(allTypesName) }}" let allTypesContent = encoded(allTypesTemplate) Message.success("Encoded all types template") let mockName = "Mock.swifttemplate" let mockPlaceholder = "{{ \(mockName) }}" let mockContent = encoded(mockTemplate) Message.success("Encoded mock template") let prototypeName = "Prototype.swifttemplate" let prototypePlaceholder = "{{ \(prototypeName) }}" let prototypeContent = encoded(prototypeTemplate) Message.success("Encoded prototype template") Message.info("Writing assets to `\(output)` ...") var assetsContents: String = try! template.read() assetsContents = assetsContents.replacingOccurrences(of: allTypesPlaceholder, with: allTypesContent) assetsContents = assetsContents.replacingOccurrences(of: mockPlaceholder, with: mockContent) assetsContents = assetsContents.replacingOccurrences(of: prototypePlaceholder, with: prototypeContent) try! output.write(assetsContents) Message.success("Done") } private func encoded(_ file: Path) -> String { let data: Data = try! file.read() return data.base64EncodedString() } }
[ -1 ]
2a24d825cf4c38e479ced69d34d630d2cedbd1c0
2edf215bea62851d3f1c6d94947a685c8275126b
/ChattoAdditions/Source/Chat Items/BaseMessage/BaseMessageViewModel.swift
b42102e43ee09f41caa13bc5832d2a284c1bf7f1
[ "MIT" ]
permissive
futureflynet/Chatto
3a4f8bcbcc6feb04a24f6eff4352dd10a65e4bb5
79f807261e5eaaf077657515cdb35845e8fbc9fa
refs/heads/master
2020-06-17T02:15:49.799969
2016-11-29T06:17:41
2016-11-29T06:17:41
75,049,492
0
0
null
2016-11-29T06:12:18
2016-11-29T06:12:18
null
UTF-8
Swift
false
false
4,758
swift
/* The MIT License (MIT) Copyright (c) 2015-present Badoo Trading Limited. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import Foundation public enum MessageViewModelStatus { case success case sending case failed } public extension MessageStatus { public func viewModelStatus() -> MessageViewModelStatus { switch self { case .success: return MessageViewModelStatus.success case .failed: return MessageViewModelStatus.failed case .sending: return MessageViewModelStatus.sending } } } public protocol MessageViewModelProtocol: class { // why class? https://gist.github.com/diegosanchezr/29979d22c995b4180830 var isIncoming: Bool { get } var showsTail: Bool { get set } var maskAvatar: Bool { get set } var showsFailedIcon: Bool { get } var date: String { get } var status: MessageViewModelStatus { get } var avatarImage: Observable<UIImage?> { set get } func willBeShown() // Optional func wasHidden() // Optional } extension MessageViewModelProtocol { public func willBeShown() {} public func wasHidden() {} } public protocol DecoratedMessageViewModelProtocol: MessageViewModelProtocol { var messageViewModel: MessageViewModelProtocol { get } } extension DecoratedMessageViewModelProtocol { public var isIncoming: Bool { return self.messageViewModel.isIncoming } public var showsTail: Bool { get { return self.messageViewModel.showsTail } set { self.messageViewModel.showsTail = newValue } } public var date: String { return self.messageViewModel.date } public var status: MessageViewModelStatus { return self.messageViewModel.status } public var showsFailedIcon: Bool { return self.messageViewModel.showsFailedIcon } public var avatarImage: Observable<UIImage?> { get { return self.messageViewModel.avatarImage } set { self.messageViewModel.avatarImage = newValue } } } open class MessageViewModel: MessageViewModelProtocol { public var maskAvatar: Bool = true open var isIncoming: Bool { return self.messageModel.isIncoming } open var status: MessageViewModelStatus { return self.messageModel.status.viewModelStatus() } open var showsTail: Bool open lazy var date: String = { return self.dateFormatter.string(from: self.messageModel.date as Date) }() public let dateFormatter: DateFormatter public private(set) var messageModel: MessageModelProtocol public init(dateFormatter: DateFormatter, showsTail: Bool, messageModel: MessageModelProtocol, avatarImage: UIImage?) { self.dateFormatter = dateFormatter self.showsTail = showsTail self.messageModel = messageModel self.avatarImage = Observable<UIImage?>(avatarImage) self.maskAvatar = true } open var showsFailedIcon: Bool { return self.status == .failed } public var avatarImage: Observable<UIImage?> } public class MessageViewModelDefaultBuilder { public init() {} static let dateFormatter: DateFormatter = { let formatter = DateFormatter() formatter.locale = Locale.current formatter.dateStyle = .none formatter.timeStyle = .short return formatter }() public func createMessageViewModel(_ message: MessageModelProtocol) -> MessageViewModelProtocol { // Override to use default avatarImage return MessageViewModel(dateFormatter: MessageViewModelDefaultBuilder.dateFormatter, showsTail: false, messageModel: message, avatarImage: nil) } }
[ -1 ]
2967d6df8ecc889290b80ced6b7153226fee8dd0
57862d4b73e41edfb2811d2bf5ea7462a65f8506
/arcgis-ios-sdk-samples/Maps/Set map spatial reference/SetMapsSRViewController.swift
d1c6ab9797ceba15d25c4aae2ff9dc02cfd29bc8
[ "Apache-2.0" ]
permissive
mhdostal/arcgis-runtime-samples-ios
7f736f4099ad6a86da5bd98d9923d0c59b2e48ab
b2694f9e5a97cd81ea042c1078708215ab4f3f48
refs/heads/main
2023-03-24T10:43:25.887525
2023-01-06T20:09:46
2023-01-06T20:09:46
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,732
swift
// Copyright 2016 Esri. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. import UIKit import ArcGIS class SetMapsSRViewController: UIViewController { @IBOutlet private weak var mapView: AGSMapView! private var map: AGSMap! override func viewDidLoad() { super.viewDidLoad() // add the source code button item to the right of navigation bar (self.navigationItem.rightBarButtonItem as! SourceCodeBarButtonItem).filenames = ["SetMapsSRViewController"] // initialize the map, spatial reference as world bonne (54024) or goode (54052) self.map = AGSMap(spatialReference: AGSSpatialReference(wkid: 54024)!) // Adding a map image layer which can reproject itself to the map's spatial reference // Note: Some layer such as tiled layer cannot reproject and will fail to draw if their spatial // reference is not the same as the map's spatial reference self.map.operationalLayers.add(AGSArcGISMapImageLayer(url: URL(string: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer")!)) // assing the map to the map view self.mapView.map = self.map } }
[ -1 ]
bd6eb101573de2646b3f19fc22beae184eee06ac
481d44e71eb07f4b40f348a69a22d9f3e1cdfee4
/Day19/CoreDataSwift/CoreDataSwift/BootLogic.swift
a1a8f70cd4158b6648185a2df8bd46a305d6e382
[]
no_license
jieen/IOS26
c33db0f7ecdc4630ae20c60b119299da77eaadeb
253f2ab572781f83073e3fca2f873f985d6085c0
refs/heads/master
2021-01-16T21:57:33.364391
2014-12-06T16:41:52
2014-12-06T16:41:52
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,271
swift
// // BootLogic.swift // TechmasterSwiftApp // // Created by Adam on 9/8/14. // Copyright (c) 2014 Adam. All rights reserved. // Techmaster Vietnam import UIKit let SECTION = "section" let MENU = "menu" let TITLE = "title" let CLASS = "class" class BootLogic: NSObject { var menu : NSArray? class func boot(window:UIWindow){ let mainScreen = MainScreen(style: UITableViewStyle.Grouped) var simpleIO = [SECTION: "Simple IO",MENU:[ [TITLE: "Read from plist",CLASS: "ReadPlist"], [TITLE: "Write to plist",CLASS: "WritePlist"], [TITLE: "Read/Write NSUserDefaults",CLASS: "ReadWriteNSUserDefaults#Storyboard"], [TITLE: "NSCoding",CLASS: "NSCodingDemo"], [TITLE: "Key Value Observer (KVO)",CLASS: "KVODemo"], [TITLE: "Notification Center",CLASS: "NotificationDemo"], ] ] var basic = [SECTION: "Basic",MENU:[ [TITLE: "Check Singleton",CLASS: "CheckSingleton"], [TITLE: "CRUD",CLASS: "DemoCRUD"], [TITLE: "CRUD2",CLASS: "DemoCRUD2"], [TITLE: "NSFetchResultController",CLASS: "CRUDTable"], [TITLE: "Template Fetch Request",CLASS: "TemplateFetchRequest"], [TITLE: "Paging Fetch Request",CLASS: "PagingFetch"], [TITLE: "Predicate Fetch",CLASS: "PredicateFetch"], [TITLE: "Transient Property",CLASS: "TransientProperty"], [TITLE: "One to Many",CLASS: "OneToMany"], [TITLE: "Many to Many",CLASS: "ManyToMany"], [TITLE: "Inheritance",CLASS: "Inheritance"], [TITLE: "Cat By CatBreed",CLASS: "CatByCatBreedVC"] ] ] var advanced = [SECTION: "Advanced",MENU:[ [TITLE: "Schema Migration",CLASS: "SchemaMigration"], [TITLE: "Transient Property",CLASS: "TransientProperty"], ] ] mainScreen.menu = [simpleIO, basic] mainScreen.title = "Core Data" mainScreen.about = "Đây là ứng dụng minh hoạ CoreData được viết bởi TechMaster" let nav = UINavigationController(rootViewController: mainScreen) window.rootViewController = nav } }
[ -1 ]
bd3676515d12a2d3dc0eceacc15cacd9a303d9f9
3238e89bf8a6617ef42c5ac714dd2af0f3e0bd75
/MatchBox Closet/LeftViewController.swift
91726224a866c53c5ff9418c1c4521cdf72dd28d
[]
no_license
prasannakumar367/Matchbox
529decd90d1b1dfde163ccbc9390ebdae0091d63
2ab0abea5666d703b350c16de398257721a1ae7b
refs/heads/master
2021-01-19T21:15:55.300970
2017-02-20T02:46:28
2017-02-20T02:46:28
82,478,195
0
0
null
null
null
null
UTF-8
Swift
false
false
11,093
swift
// // LeftViewController.swift // MatchBox Closet // // Copyright © 2016 Prasanna kumar. All rights reserved. // import UIKit enum LeftMenu: Int { case home = 0 case profile case tutorial case recommendedtheapp case logout // case main = 0 // case swift // case java // case go // case nonMenu } protocol LeftMenuProtocol : class { func changeViewController(_ menu: LeftMenu) } class LeftViewController : UIViewController, LeftMenuProtocol { var tableView: UITableView = UITableView() var window: UIWindow? var menus = ["Home", "Profile", "Tutorial", "Recommend The App", "Logout"] var mainViewController: UIViewController! var profileViewController : UIViewController! var tutorialViewController: UIViewController! var rateTheappViewController: UIViewController! //var feedBackViewController: UIViewController! var contactUsMenuViewController: UIViewController! var recommendViewController : UIViewController! var profileBgView = UIView() var profilePic = UIImageView() // required init?(coder aDecoder: NSCoder) { // super.init(coder: aDecoder) // } override func viewDidLoad() { super.viewDidLoad() //self.tableView.separatorColor = UIColor(red: 224/255, green: 224/255, blue: 224/255, alpha: 1.0) self.tableView.frame = CGRect(x: 0, y: 160, width: 270, height: self.view.frame.size.height) self.tableView.backgroundColor = UIColor(hex: "E0E0E0") self.view.addSubview(self.tableView); // let storyboard = UIStoryboard(name: "Main", bundle: nil) // let swiftViewController = storyboard.instantiateViewController(withIdentifier: "SwiftViewController") as! SwiftViewController // self.swiftViewController = UINavigationController(rootViewController: swiftViewController) // // let javaViewController = storyboard.instantiateViewController(withIdentifier: "JavaViewController") as! JavaViewController // self.javaViewController = UINavigationController(rootViewController: javaViewController) // // let goViewController = storyboard.instantiateViewController(withIdentifier: "GoViewController") as! GoViewController // self.goViewController = UINavigationController(rootViewController: goViewController) // // let nonMenuController = storyboard.instantiateViewController(withIdentifier: "NonMenuController") as! NonMenuController // nonMenuController.delegate = self // self.nonMenuViewController = UINavigationController(rootViewController: nonMenuController) self.profileViewController = ProfileViewController(nibName: nil, bundle: nil) self.tutorialViewController = TutorialViewController(nibName: nil, bundle: nil) //self.rateTheappViewController = RateTheAppViewController(nibName: nil, bundle: nil) //self.feedBackViewController = FeedBackViewController(nibName: nil, bundle: nil) //self.contactUsMenuViewController = ContactUsViewController(nibName: nil, bundle: nil) self.recommendViewController = RecommendAppViewController(nibName: nil, bundle: nil) let navController = UINavigationController(rootViewController: self.profileViewController) self.profileViewController = navController let navController1 = UINavigationController(rootViewController: self.tutorialViewController) self.tutorialViewController = navController1 //let navController2 = UINavigationController(rootViewController: self.feedBackViewController) //self.feedBackViewController = navController2 let navController3 = UINavigationController(rootViewController: self.recommendViewController) self.recommendViewController = navController3 self.tableView.delegate = self; self.tableView.dataSource = self; self.tableView.isScrollEnabled = false self.tableView.separatorColor = UIColor.clear self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell") profileBgView.backgroundColor = UIColor(hex: "E0E0E0") self.profilePic.clipsToBounds = true self.profilePic.layer.borderWidth = 1 self.profilePic.layer.borderColor = UIColor.white.cgColor self.profilePic.frame = CGRect(x: 90, y: 40, width: 100, height: 100) self.profilePic.image = UIImage.init(named: "logo.png") self.profilePic.layer.cornerRadius = 100 / 2 self.profileBgView.addSubview(self.profilePic) self.view.addSubview(self.profileBgView) } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) } override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() self.profileBgView.frame = CGRect(x: 0, y: 0, width: self.view.frame.width, height: 160) self.view.layoutIfNeeded() } func changeViewController(_ menu: LeftMenu) { switch menu { case .home: self.slideMenuController()?.changeMainViewController(self.mainViewController, close: true) case .profile: self.slideMenuController()?.changeMainViewController(self.profileViewController, close: true) case .tutorial: self.slideMenuController()?.changeMainViewController(self.tutorialViewController, close: true) case .recommendedtheapp: shareTextButton() case .logout: logout() default: break } } //case .feedback: //self.slideMenuController()?.changeMainViewController(self.feedBackViewController, close: true) func logout() { // Create the alert controller let alertController = UIAlertController(title: "Logout", message: "Are you sure, You want to Logout?", preferredStyle: .alert) // Create the actions let yesAction = UIAlertAction(title: "Yes", style: UIAlertActionStyle.default) { UIAlertAction in // get a reference to the app delegate let appDelegate = UIApplication.shared.delegate as! AppDelegate // call didFinishLaunchWithOptions ... why? appDelegate.application(UIApplication.shared, didFinishLaunchingWithOptions: nil) // // self.window = UIWindow(frame: UIScreen.main.bounds) // // // Override point for customization after application launch. // let vc = AccountViewController(nibName:nil, bundle: nil) // let navigationController = UINavigationController(rootViewController: vc) // self.window!.rootViewController = navigationController // self.window!.makeKeyAndVisible() // navigationController.setNavigationBarHidden(true, animated: false) // self.window!.backgroundColor = UIColor.white // // } UserDefaults.standard.set("false", forKey: "isLogged") alertController.addAction(UIAlertAction(title: "No", style: .cancel, handler: nil)) // Add the actions alertController.addAction(yesAction) // Present the controller self.present(alertController, animated: true, completion: nil) } func shareTextButton() { // text to share let text = "MatchBox app is a free closet organiser for Men and Women. Mix - match your clothes, accessories and footwear to make best outfit and style yourself. http://matchboxapp.co/" // set up activity view controller let textToShare = [ text ] let activityViewController = UIActivityViewController(activityItems: textToShare, applicationActivities: nil) activityViewController.popoverPresentationController?.sourceView = self.view // so that iPads won't crash // exclude some activity types from the list (optional) activityViewController.excludedActivityTypes = [ UIActivityType.airDrop, UIActivityType.postToFacebook, UIActivityType.postToTwitter, UIActivityType.postToWeibo, UIActivityType.message, UIActivityType.mail, UIActivityType.print, UIActivityType.copyToPasteboard, UIActivityType.assignToContact, UIActivityType.saveToCameraRoll, UIActivityType.addToReadingList, UIActivityType.postToFlickr, UIActivityType.postToVimeo, UIActivityType.postToTencentWeibo ] // present the view controller self.present(activityViewController, animated: true, completion: nil) } } /* case .ratetheapp: self.slideMenuController()?.changeMainViewController(self.rateTheappViewController, close: true) case .contactus: self.slideMenuController()?.changeMainViewController(self.contactUsMenuViewController, close: true) */ extension LeftViewController : UITableViewDelegate { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { if let menu = LeftMenu(rawValue: indexPath.row) { switch menu { case .home, .profile, .tutorial, .recommendedtheapp, .logout: return 50 } } return 0 } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if let menu = LeftMenu(rawValue: indexPath.row) { for cell in tableView.visibleCells { cell.textLabel?.textColor = UIColor.black } tableView.cellForRow(at: indexPath)?.textLabel?.textColor = purpleColor self.changeViewController(menu) } } func scrollViewDidScroll(_ scrollView: UIScrollView) { if self.tableView == scrollView { } } } extension LeftViewController : UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return menus.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if let menu = LeftMenu(rawValue: indexPath.row) { switch menu { case .home, .profile, .tutorial, .recommendedtheapp, .logout: let cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: "td") cell.textLabel?.text = menus[indexPath.row] cell.selectionStyle = .none cell.backgroundColor = UIColor(hex: "E0E0E0") return cell } } return UITableViewCell() } }
[ -1 ]
3aca4ef7ced951ae77cedbd153c5012654cd277c
2400b293f228f3022a8515118e270e061ac0536c
/MonEx/MessagesCollectionViewCell.swift
dc0aaa07450247439927f9d2b572256de4872bb9
[]
no_license
carlosdelamora/MonEx
03d4c3999b3280d8e344088d8b3d2b6a7420f948
78d73c6e65414831a59ec297b66a96fd5633033a
refs/heads/master
2021-03-19T18:38:15.421160
2017-11-11T16:03:53
2017-11-11T16:03:53
79,371,691
0
0
null
null
null
null
UTF-8
Swift
false
false
3,130
swift
// // MessagesCollectionViewCell.swift // MonEx // // Created by Carlos De la mora on 2/13/17. // Copyright © 2017 carlosdelamora. All rights reserved. // import UIKit import CoreGraphics class MessagesCollectionViewCell: UICollectionViewCell { let textView: UITextView = { let textView = UITextView() textView.text = "Sample Text" textView.font = UIFont.systemFont(ofSize: 16) textView.translatesAutoresizingMaskIntoConstraints = false textView.backgroundColor = .clear textView.textColor = .white textView.isScrollEnabled = false textView.isEditable = false return textView }() let bubbleView: UIView = { let view = UIView() view.backgroundColor = Constants.color.messagesBlue view.translatesAutoresizingMaskIntoConstraints = false view.layer.cornerRadius = 16 view.clipsToBounds = true return view }() let profileView: UIImageView = { let imageView = UIImageView() imageView.image = UIImage(named: "photoPlaceholder") imageView.layer.cornerRadius = imageView.frame.width/2 imageView.clipsToBounds = true imageView.contentMode = .scaleAspectFill imageView.translatesAutoresizingMaskIntoConstraints = false return imageView }() var bubbleWidthAnchor: NSLayoutConstraint? var bubbleViewRightAnchor: NSLayoutConstraint? var bubbleViewLeftAnchor: NSLayoutConstraint? override init(frame: CGRect) { super.init(frame: frame) addSubview(profileView) profileView.leftAnchor.constraint(equalTo: self.leftAnchor, constant: 8).isActive = true profileView.bottomAnchor.constraint(equalTo: self.bottomAnchor).isActive = true profileView.widthAnchor.constraint(equalToConstant: 32).isActive = true profileView.heightAnchor.constraint(equalToConstant: 32).isActive = true addSubview(bubbleView) bubbleViewRightAnchor = bubbleView.rightAnchor.constraint(equalTo: self.rightAnchor, constant: -16) bubbleViewRightAnchor?.isActive = true bubbleView.topAnchor.constraint(equalTo: self.topAnchor).isActive = true bubbleView.bottomAnchor.constraint(equalTo: self.bottomAnchor).isActive = true bubbleWidthAnchor = bubbleView.widthAnchor.constraint(equalToConstant: 200) bubbleWidthAnchor?.isActive = true bubbleViewLeftAnchor = bubbleView.leftAnchor.constraint(equalTo: profileView.rightAnchor, constant: 8) //bubbleViewLeftAnchor.isActive = false by default addSubview(textView) textView.leftAnchor.constraint(equalTo: bubbleView.leftAnchor, constant: 8).isActive = true textView.topAnchor.constraint(equalTo: self.topAnchor).isActive = true textView.bottomAnchor.constraint(equalTo: self.bottomAnchor).isActive = true textView.rightAnchor.constraint(equalTo: bubbleView.rightAnchor).isActive = true } required init?(coder aDecoder: NSCoder) { fatalError("init aDecoder has not been implemented") } }
[ -1 ]
fbb662ff657bf2a7f162939d0697d8a9269737d4
519879dcd4930608c48e48e78660da3fbcb51cb4
/tyokinn/ViewController3.swift
5c6823d1bdd61ad447a55c3ece715572a480c6d9
[]
no_license
aikaji/Ai11
bf358686b1aa55124eec21d6711dadb0bfe01569
260950d9471059fc9939f478d2bfe2da4ab3cfe9
refs/heads/master
2023-06-29T14:23:23.186055
2021-08-03T09:54:33
2021-08-03T09:54:33
361,341,723
0
0
null
null
null
null
UTF-8
Swift
false
false
645
swift
// // ViewController3.swift // ORI // // Created by 梶山清美 on 2019/11/21. // Copyright © 2019年 梶山清美. All rights reserved. // import UIKit class ViewController3: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. Timer.scheduledTimer(withTimeInterval: 5, repeats: false) { (t) in self.performSegue(withIdentifier: "modoru", sender: nil) } } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }
[ -1 ]
ee6757c45ec4118203a9cdee8e98f924eeedb534
101b1708f4fee60d27e032332f726d928f8f2cca
/SwaggerClient/Classes/Swaggers/Models/Options.swift
7a2040f1150ce88dc35051bb3c452e66652b7b64
[]
no_license
facestorept/api-sdk-swift
09d80ca73e26a8b832a52043ab35fa1433066480
5880f1c98dd556c041d1ea1ff94776726042f470
refs/heads/master
2021-08-26T03:52:38.402142
2017-11-21T14:14:35
2017-11-21T14:14:35
111,557,790
0
0
null
null
null
null
UTF-8
Swift
false
false
1,017
swift
// // Options.swift // // Generated by swagger-codegen // https://github.com/swagger-api/swagger-codegen // import Foundation public class Options: JSONEncodable { public var id: Int64? public var position: Int64? public var auxCode: String? public var i18n: I18n? public var createdAt: NSDate? public var updatedAt: NSDate? public init() {} // MARK: JSONEncodable func encodeToJSON() -> AnyObject { var nillableDictionary = [String:AnyObject?]() nillableDictionary["id"] = self.id?.encodeToJSON() nillableDictionary["position"] = self.position?.encodeToJSON() nillableDictionary["aux_code"] = self.auxCode nillableDictionary["i18n"] = self.i18n?.encodeToJSON() nillableDictionary["created_at"] = self.createdAt?.encodeToJSON() nillableDictionary["updated_at"] = self.updatedAt?.encodeToJSON() let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } }
[ -1 ]
08708c5058033d59abf69f4162b9b232d8abba37
03e585fbe3af0d79643c6f6dfe76b4233165539b
/megplotter/Graph.swift
c9f5eed3eb21e63e63e6664d266a15939caae0b4
[ "MIT" ]
permissive
moppymopperson/megplotter
6ab219e3b7902f0c03084b96a8a41e5120425de1
dfd4d353a0a0b9c4270bb1b350dfaf37c9a61702
refs/heads/master
2021-01-12T06:38:19.496775
2016-12-26T19:23:35
2016-12-26T19:23:35
77,401,795
0
0
null
null
null
null
UTF-8
Swift
false
false
2,670
swift
// // Graph.swift // Grapher // // Created by Erik Hornberger on 12/22/16. // Copyright © 2016 EExT. All rights reserved. // import UIKit /** A view that owns and draws `Line`s. Any number of lines can be plotted, but all lines must have the same number of points. Lines are all plotted on the same axis, like a butterfly plot. */ class Graph: UIView { /// The lines that will be draw let lines:[Line] /// The X values of the points being plotted. Calculated when the lines are set. internal let xValues:[CGFloat] /// The max value of Y that the `Line`s will contain. Must be known a priori. internal let maxY:CGFloat = 1 /// The location of 0 on the Y axis. internal let y0:CGFloat /// The values in each `Line` are multiplied by `yScale` so that `maxY` /// precisly reaches the top of the view internal let yScale:CGFloat init(frame:CGRect, lines:[Line]) { self.lines = lines // Array of linearly spaced x values across the view's width self.xValues = { var x = [CGFloat]() let step = frame.width / CGFloat(lines[0].values.count) for k in 0..<lines[0].values.count { x.append(CGFloat(k)*step) } return x }() // y0 in the middle of the view self.y0 = frame.height / 2 // Set scale so that `maxY` exactly reaches the top self.yScale = (frame.height / 2) / maxY super.init(frame: frame) self.backgroundColor = .darkGray } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } /// Each time the view is drawn, plot each line override func draw(_ rect: CGRect) { for line in lines { plot(line) } } /// Plot one line on the view func plot(_ line:Line) { let path = UIBezierPath() path.lineWidth = line.width // Draw a line from one point to the next, for all points for k in 0..<line.values.count - 1 { path.move(to: CGPoint(x: xValues[k], y: y0 - line.values[k] * yScale)) path.addLine(to: CGPoint(x: xValues[k+1], y: y0 - line.values[k+1] * yScale)) } // Draw a circle on the far right, last point let circlePath = UIBezierPath(arcCenter: path.currentPoint, radius: 4, startAngle: 0, endAngle: 2*3.1415, clockwise: true) // Color and fill line.color.setStroke() line.color.setFill() path.stroke() circlePath.fill() } }
[ -1 ]
f7332df88a03f48f7531a1196feb1b984d1da747
f5ebbbf4eae52f5f4f3618d19110de65a9dcbf30
/dices/SceneDelegate.swift
fff25672e6290e01c5591e77263f99e16476f886
[]
no_license
jhen0605/dices
bdad88fba5bdf39c562cbdec803196e6a99247bd
5e1a85173060613f506d184a86cedcabdcde0ee3
refs/heads/main
2023-04-13T09:56:39.232158
2021-04-25T19:53:31
2021-04-25T19:53:31
361,524,433
0
0
null
null
null
null
UTF-8
Swift
false
false
2,286
swift
// // SceneDelegate.swift // dices // // Created by 簡吟真 on 2021/4/26. // import UIKit class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). guard let _ = (scene as? UIWindowScene) else { return } } func sceneDidDisconnect(_ scene: UIScene) { // Called as the scene is being released by the system. // This occurs shortly after the scene enters the background, or when its session is discarded. // Release any resources associated with this scene that can be re-created the next time the scene connects. // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). } func sceneDidBecomeActive(_ scene: UIScene) { // Called when the scene has moved from an inactive state to an active state. // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. } func sceneWillResignActive(_ scene: UIScene) { // Called when the scene will move from an active state to an inactive state. // This may occur due to temporary interruptions (ex. an incoming phone call). } func sceneWillEnterForeground(_ scene: UIScene) { // Called as the scene transitions from the background to the foreground. // Use this method to undo the changes made on entering the background. } func sceneDidEnterBackground(_ scene: UIScene) { // Called as the scene transitions from the foreground to the background. // Use this method to save data, release shared resources, and store enough scene-specific state information // to restore the scene back to its current state. } }
[ 393221, 163849, 393228, 393231, 393251, 352294, 344103, 393260, 393269, 213049, 376890, 385082, 393277, 376906, 327757, 254032, 368728, 180314, 254045, 180322, 376932, 286833, 286845, 286851, 417925, 262284, 360598, 286880, 377003, 377013, 164029, 327872, 180418, 377030, 377037, 377047, 418008, 418012, 377063, 327915, 205037, 393457, 393461, 393466, 418044, 385281, 336129, 262405, 180491, 164107, 336140, 262417, 368913, 262423, 377118, 377121, 262437, 254253, 336181, 262455, 393539, 262473, 344404, 213333, 418135, 270687, 418145, 262497, 262501, 213354, 246124, 262508, 262512, 213374, 385420, 393613, 262551, 262553, 385441, 385444, 262567, 385452, 262574, 393649, 385460, 262587, 344512, 262593, 360917, 369119, 328178, 328180, 328183, 328190, 254463, 328193, 164362, 328207, 410129, 393748, 262679, 377372, 188959, 385571, 197160, 377384, 33322, 352822, 270905, 197178, 418364, 188990, 369224, 270922, 385610, 352844, 385617, 352865, 262761, 352875, 344694, 352888, 336513, 377473, 385671, 148106, 213642, 377485, 352919, 98969, 344745, 361130, 336556, 385714, 434868, 164535, 336568, 164539, 328379, 328387, 352969, 344777, 385743, 385749, 139998, 189154, 369382, 361196, 418555, 344832, 336644, 344837, 344843, 328462, 361231, 394002, 336660, 418581, 418586, 434971, 369436, 262943, 369439, 418591, 418594, 336676, 418600, 418606, 369464, 361274, 328516, 336709, 328520, 336712, 361289, 328523, 336715, 361300, 213848, 426842, 361307, 197469, 361310, 254813, 361318, 344936, 361323, 361335, 328574, 369544, 361361, 222129, 345036, 115661, 386004, 345046, 386012, 386019, 328690, 435188, 328703, 328710, 418822, 328715, 377867, 361490, 386070, 271382, 336922, 345119, 377888, 345134, 345139, 361525, 386102, 361537, 377931, 345172, 189525, 156762, 402523, 361568, 148580, 345200, 361591, 386168, 361594, 410746, 214150, 345224, 386187, 345247, 361645, 345268, 402615, 361657, 337093, 402636, 328925, 165086, 66783, 165092, 222438, 328942, 386286, 386292, 206084, 328967, 345377, 345380, 353572, 345383, 263464, 337207, 345400, 378170, 369979, 386366, 337224, 337230, 337235, 263509, 353634, 337252, 402792, 271731, 378232, 337278, 271746, 181639, 353674, 181644, 361869, 181650, 181655, 230810, 181671, 181674, 181679, 181682, 337330, 181687, 370105, 181691, 181697, 361922, 337350, 181704, 337366, 271841, 329192, 361961, 329195, 116211, 337399, 402943, 337416, 329227, 419341, 419345, 329234, 419351, 345626, 419357, 345631, 370208, 419360, 394787, 419363, 370214, 419369, 394796, 419377, 419386, 206397, 214594, 419401, 419404, 353868, 419408, 214611, 419412, 403040, 345702, 222831, 370298, 353920, 403073, 403076, 345737, 198282, 403085, 403092, 345750, 419484, 345758, 345763, 419492, 419498, 419502, 370351, 419507, 337588, 419510, 419513, 419518, 337601, 403139, 337607, 419528, 419531, 419536, 272083, 394967, 419545, 345819, 419548, 419551, 345829, 419560, 337643, 419564, 337647, 370416, 337671, 362249, 362252, 395022, 362256, 321300, 345888, 362274, 378664, 354107, 345916, 354112, 370504, 329545, 345932, 370510, 354132, 247639, 337751, 370520, 313181, 182110, 354143, 345965, 354157, 345968, 345971, 345975, 403321, 1914, 354173, 247692, 395148, 337809, 247701, 329625, 436127, 436133, 247720, 337834, 362414, 337845, 190393, 346059, 247760, 346064, 346069, 419810, 329699, 354275, 190440, 354314, 346140, 436290, 395340, 378956, 436307, 338005, 100454, 329833, 329853, 329857, 329868, 411806, 329886, 346273, 362661, 100525, 387250, 379067, 387261, 256193, 395467, 256214, 411862, 411865, 411869, 411874, 379108, 411877, 387303, 346344, 395496, 338154, 387307, 346350, 338161, 387314, 436474, 321787, 379135, 411905, 411917, 379154, 395539, 387350, 387353, 338201, 182559, 338212, 395567, 248112, 362823, 436556, 321880, 362844, 379234, 354674, 321911, 420237, 379279, 354728, 338353, 338382, 272849, 248279, 256474, 182755, 338404, 338411, 330225, 248309, 248332, 330254, 199189, 420377, 330268, 191012, 330320, 199250, 191069, 346722, 248427, 191085, 338544, 346736, 191093, 346743, 346769, 150184, 174775, 248505, 174778, 363198, 223936, 355025, 273109, 355029, 264919, 256735, 338661, 264942, 363252, 338680, 264965, 338701, 256787, 363294, 199455, 396067, 346917, 396070, 215854, 355123, 355141, 355144, 338764, 355151, 330581, 387929, 330585, 355167, 265056, 265059, 355176, 355180, 355185, 412600, 207809, 379849, 347082, 396246, 330711, 248794, 248799, 347106, 437219, 257009, 265208, 265215, 199681, 338951, 330761, 330769, 330775, 248863, 158759, 396329, 347178, 404526, 396337, 330803, 396340, 339002, 388155, 339010, 347208, 248905, 330827, 248915, 183384, 339037, 412765, 257121, 322660, 265321, 248952, 420985, 330886, 330890, 347288, 248986, 44199, 380071, 339118, 249018, 339133, 126148, 322763, 330959, 330966, 265433, 265438, 388320, 363757, 388348, 339199, 396552, 175376, 175397, 273709, 372016, 437553, 347442, 199989, 175416, 396601, 208189, 437567, 175425, 437571, 126279, 437576, 437584, 331089, 437588, 331094, 396634, 175451, 437596, 429408, 175458, 175461, 175464, 265581, 331124, 175478, 249210, 175484, 249215, 175487, 249219, 175491, 249225, 249228, 249235, 175514, 175517, 396703, 396706, 175523, 355749, 396723, 388543, 380353, 216518, 380364, 339406, 372177, 339414, 413143, 249303, 339418, 339421, 249310, 249313, 339425, 339429, 339435, 249329, 69114, 372229, 208399, 380433, 175637, 405017, 134689, 339504, 265779, 421442, 413251, 265796, 265806, 224854, 224858, 339553, 257636, 224871, 372328, 257647, 372338, 224885, 224888, 224891, 224895, 372354, 126597, 421509, 224905, 11919, 224911, 224914, 126611, 224917, 224920, 126618, 224923, 208539, 224927, 224930, 224933, 257705, 224939, 224943, 257713, 257717, 224949, 257721, 224954, 257725, 224960, 257733, 224966, 224970, 257740, 224976, 257745, 339664, 257748, 224982, 257752, 224987, 257762, 224996, 225000, 225013, 257788, 225021, 257791, 339711, 225027, 257796, 257802, 339722, 257805, 225039, 257808, 249617, 225044, 167701, 372500, 257815, 225049, 257820, 225054, 184096, 257825, 225059, 339748, 225068, 257837, 413485, 225071, 225074, 257843, 225077, 257846, 225080, 397113, 225083, 397116, 257853, 225088, 225094, 225097, 257869, 257872, 225105, 397140, 225109, 225113, 257881, 257884, 257887, 225120, 257891, 413539, 225128, 257897, 339818, 225138, 339827, 257909, 225142, 372598, 257914, 257917, 225150, 257922, 380803, 225156, 339845, 257927, 225166, 397201, 225171, 380823, 225176, 225183, 372698, 372704, 372707, 356336, 380919, 372739, 405534, 266295, 266298, 217158, 421961, 200786, 356440, 217180, 430181, 266351, 356467, 266365, 192640, 266375, 381069, 225425, 250003, 225430, 250008, 356507, 250012, 225439, 135328, 438434, 225442, 192674, 225445, 438438, 225448, 438441, 356521, 225451, 258223, 225456, 430257, 225459, 225462, 225468, 389309, 225472, 372931, 225476, 430275, 389322, 225485, 225488, 225491, 266454, 225494, 225497, 225500, 225503, 225506, 356580, 225511, 217319, 225515, 225519, 381177, 397572, 389381, 381212, 356638, 356641, 356644, 356647, 266537, 356650, 389417, 356656, 332081, 307507, 340276, 356662, 397623, 332091, 225599, 201030, 348489, 332107, 151884, 332118, 348503, 430422, 250201, 250203, 250211, 340328, 250217, 348523, 348528, 332153, 356734, 389503, 332158, 438657, 332162, 389507, 348548, 356741, 250239, 332175, 160152, 373146, 340380, 373149, 70048, 356783, 373169, 266688, 324032, 201158, 340452, 127473, 217590, 340473, 324095, 324100, 324103, 324112, 340501, 324118, 324122, 340512, 332325, 324134, 381483, 356908, 324141, 324143, 356917, 324150, 324156, 168509, 348734, 324161, 324165, 356935, 348745, 381513, 324171, 324174, 324177, 389724, 332381, 373344, 340580, 348777, 381546, 119432, 340628, 184983, 373399, 258723, 332460, 389806, 332464, 332473, 381626, 332484, 332487, 332494, 357070, 357074, 332512, 332521, 340724, 332534, 155647, 373499, 348926, 389927, 348979, 152371, 348983, 340792, 398141, 357202, 389971, 357208, 389979, 357212, 430940, 357215, 439138, 201580, 201583, 349041, 340850, 381815, 430967, 324473, 398202, 340859, 324476, 430973, 119675, 340863, 324479, 324482, 373635, 324485, 324488, 381834, 185226, 324493, 324496, 324499, 430996, 324502, 324511, 422817, 324514, 201638, 398246, 373672, 324525, 5040, 111539, 324534, 5047, 324539, 324542, 398280, 349129, 340940, 340942, 209874, 340958, 431073, 398307, 340964, 209896, 209904, 201712, 349173, 381947, 201724, 349181, 431100, 431107, 349203, 209944, 209948, 357411, 250915, 250917, 169002, 357419, 209966, 209969, 209973, 209976, 209980, 209988, 209991, 209996, 431180, 341072, 349268, 177238, 250968, 210011, 373853, 341094, 210026, 210028, 210032, 349296, 210037, 210042, 210045, 349309, 152704, 349313, 160896, 210053, 210056, 349320, 373905, 259217, 210068, 210072, 210078, 210081, 210085, 210089, 210096, 210100, 324792, 210108, 357571, 210116, 210128, 210132, 333016, 210139, 210144, 218355, 218361, 275709, 128254, 275713, 242947, 275717, 275723, 333075, 349460, 333079, 251161, 349486, 349492, 415034, 210261, 365912, 259423, 374113, 251236, 374118, 333164, 234867, 390518, 357756, 374161, 112021, 349591, 333222, 259516, 415168, 415187, 366035, 366039, 415192, 415194, 415197, 415200, 333285, 415208, 366057, 366064, 415217, 415225, 423424, 415258, 415264, 366118, 415271, 382503, 349739, 144940, 415279, 415282, 415286, 210488, 415291, 415295, 349762, 333396, 374359, 333400, 366173, 423529, 423533, 210547, 415354, 333440, 267910, 267929, 333512, 259789, 366301, 333535, 153311, 366308, 366312, 431852, 399086, 366319, 210673, 366322, 399092, 366326, 333566, 268042, 210700, 366349, 210707, 399129, 333595, 210720, 358192, 366384, 366388, 210740, 358201, 325441, 366403, 325447, 341831, 341835, 341839, 341844, 415574, 358235, 341852, 350046, 399200, 399208, 268144, 358256, 358260, 341877, 325494, 399222, 333690, 325505, 333699, 399244, 333709, 333725, 333737, 382891, 382898, 350153, 358348, 333777, 219094, 399318, 358372, 350190, 350194, 333819, 350204, 350207, 325633, 325637, 350214, 219144, 268299, 333838, 350225, 186388, 350232, 333851, 350238, 350241, 374819, 350245, 350249, 350252, 178221, 350257, 350260, 350272, 243782, 350281, 350286, 374865, 342113, 252021, 342134, 374904, 268435, 333998, 334012, 260299, 350411, 350417, 350423, 211161, 350426, 350449, 358645, 350459, 350462, 350465, 350469, 268553, 350477, 268560, 350481, 432406, 350487, 325915, 350491, 325918, 350494, 325920, 350500, 194854, 350505, 358701, 391469, 350510, 358705, 358714, 358717, 383307, 358738, 334162, 383331, 383334, 391531, 383342, 334204, 268669, 194942, 391564, 366991, 334224, 268702, 342431, 375209, 375220, 334263, 326087, 358857, 195041, 334312, 104940, 375279, 416255, 350724, 186898, 342546, 350740, 342551, 334359, 342555, 334364, 416294, 350762, 252463, 358962, 334386, 334397, 358973, 252483, 219719, 399957, 334425, 326240, 375401, 334466, 334469, 391813, 162446, 326291, 342680, 342685, 260767, 342711, 244410, 260798, 260802, 350918, 154318, 342737, 391895, 154329, 416476, 64231, 113389, 342769, 203508, 375541, 342777, 391938, 391949, 375569, 326417, 375572, 375575, 375580, 162592, 334633, 326444, 383794, 326452, 326455, 375613, 244542, 260925, 375616, 326463, 326468, 342857, 326474, 326479, 326486, 416599, 342875, 244572, 326494, 433001, 400238, 326511, 211826, 211832, 392061, 351102, 359296, 252801, 260993, 351105, 400260, 211846, 342921, 342931, 252823, 400279, 392092, 400286, 252838, 359335, 211885, 252846, 400307, 351169, 359362, 351172, 170950, 326599, 359367, 187335, 359383, 359389, 383968, 343018, 359411, 261109, 261112, 244728, 383999, 261130, 359452, 261148, 211999, 261155, 261160, 261166, 359471, 375868, 343132, 384099, 384102, 384108, 367724, 187503, 343155, 384115, 212095, 351366, 384136, 384140, 384144, 351382, 384152, 384158, 384161, 351399, 384169, 367795, 244917, 384182, 367801, 384189, 351424, 384192, 343232, 367817, 244938, 384202, 253132, 326858, 384209, 146644, 351450, 384225, 359650, 343272, 351467, 359660, 384247, 351480, 384250, 351483, 351492, 343307, 384270, 261391, 359695, 253202, 261395, 384276, 384284, 245021, 384290, 253218, 171304, 245032, 384299, 351535, 376111, 245042, 326970, 384324, 343366, 212296, 212304, 367966, 343394, 367981, 343410, 155000, 327035, 245121, 245128, 253321, 155021, 384398, 245137, 245143, 245146, 245149, 343453, 245152, 245155, 155045, 245158, 40358, 245163, 114093, 327090, 343478, 359867, 384444, 146878, 327108, 327112, 384457, 359887, 359891, 368093, 155103, 343535, 343540, 368120, 343545, 409092, 253445, 359948, 359951, 245295, 359984, 343610, 400977, 400982, 179803, 155241, 245358, 155255, 155274, 368289, 245410, 425652, 425663, 155328, 245463, 155352, 155356, 212700, 155364, 245477, 155372, 245487, 212723, 409336, 155394, 155404, 245528, 155423, 360224, 155439, 204592, 155444, 155448, 417596, 384829, 384831, 360262, 155463, 155477, 376665, 155484, 261982, 425823, 155488, 376672, 155492, 327532, 261997, 376686, 262000, 262003, 262006, 327542, 147319, 262009, 425846, 262012, 155517, 155523, 155526, 360327, 376715, 155532, 262028, 262031, 262034, 262037, 262040, 262043, 155550, 253854, 262046, 262049, 262052, 327590, 155560, 155563, 155566, 327613, 393152, 311244, 393170, 155604, 155620, 253924, 155622, 253927, 327655, 360432, 393204, 360439, 253944, 393209, 393215 ]
bd48c7c64aa510b9be8e5f42b2055dd3b476a5e0
4f39fe8bd157a7e20a1df4ef1c9ab1d326859a9d
/Tayseer/Controller/Home/categoriesDetails/categoriesDetailsVC.swift
ce0f636f1d0884cd7404398c011752ed7e1fd6fa
[]
no_license
AhmedFarid/Tayseer
1de9fc2dadcd88b2703c4644e44b693baf31ccc9
0c768d0a850dce93f679baa855d2597cd58ffb3a
refs/heads/master
2021-04-17T08:31:07.746946
2020-07-22T14:43:03
2020-07-22T14:43:03
249,429,284
2
0
null
null
null
null
UTF-8
Swift
false
false
6,742
swift
// // categoriesDetailsVC.swift // Tayseer // // Created by Ahmed farid on 3/23/20. // Copyright © 2020 E-bakers. All rights reserved. // import UIKit class categoriesDetailsVC: UIViewController { @IBOutlet weak var bannerCollectionView: UICollectionView! @IBOutlet weak var subCatTabelView: UITableView! @IBOutlet weak var bageControl: UIPageControl! var singleItem: sectionsData? var slider = [sliderData]() var timer : Timer? var currentIndex = 0 override func viewDidLoad() { super.viewDidLoad() setUpNavColore(false, singleItem?.title ?? "") bannerCollectionView.register(UINib(nibName: "bannerCell", bundle: nil), forCellWithReuseIdentifier: "cell") bannerCollectionView.delegate = self bannerCollectionView.dataSource = self subCatTabelView.rowHeight = UITableView.automaticDimension subCatTabelView.estimatedRowHeight = UITableView.automaticDimension subCatTabelView.register(UINib(nibName: "categoriesDetailsCell", bundle: nil), forCellReuseIdentifier: "cell") subCatTabelView.delegate = self subCatTabelView.dataSource = self sliderHandelRefresh() startTimer() } override func viewWillAppear(_ animated: Bool) { refesHcart() } func sliderHandelRefresh(){ categoryApi.sliderApi(section_id: singleItem?.id ?? 0){ (error,success,slider) in if let slider = slider{ self.slider = slider.data ?? [] print(slider) self.bageControl.isHidden = false self.bageControl.numberOfPages = self.slider.count self.bageControl.currentPage = 0 self.bannerCollectionView.reloadData() } } } func startTimer(){ DispatchQueue.main.async { self.timer = Timer.scheduledTimer(timeInterval: 3, target: self, selector: #selector(self.changeImage), userInfo: nil, repeats: true) } } @objc func changeImage() { if currentIndex < slider.count { let index = IndexPath.init(item: currentIndex, section: 0) self.bannerCollectionView.scrollToItem(at: index, at: .centeredHorizontally, animated: true) bageControl.currentPage = currentIndex currentIndex += 1 } else { currentIndex = 0 let index = IndexPath.init(item: currentIndex, section: 0) self.bannerCollectionView.scrollToItem(at: index, at: .centeredHorizontally, animated: true) bageControl.currentPage = currentIndex currentIndex = 1 } } } extension categoriesDetailsVC: UICollectionViewDataSource,UICollectionViewDelegate, UICollectionViewDelegateFlowLayout{ func numberOfSections(in collectionView: UICollectionView) -> Int { return 1 } func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return slider.count } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { if let cell = bannerCollectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as? bannerCell { cell.configureCell(images: slider[indexPath.row]) return cell }else { return bannerCell() } } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize{ return CGSize(width: bannerCollectionView.frame.size.width, height: bannerCollectionView.frame.size.height) } func scrollViewDidScroll(_ scrollView: UIScrollView) { if scrollView == bannerCollectionView{ currentIndex = Int(scrollView.contentOffset.x / bannerCollectionView.frame.size.width) bageControl.currentPage = currentIndex } } } extension categoriesDetailsVC: UITableViewDelegate,UITableViewDataSource { func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 3 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if let cell = subCatTabelView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? categoriesDetailsCell { if indexPath.row == 0 { if singleItem?.haveProduct == "0" { cell.isHidden = true }else if singleItem?.haveProduct == "1" { cell.catImage.image = UIImage(named: "lamp") cell.productName.text = "Product" } }else if indexPath.row == 1 { if singleItem?.haveMaintenance == "0" { cell.isHidden = true }else if singleItem?.haveMaintenance == "1" { cell.catImage.image = UIImage(named: "support") cell.productName.text = "Maintenance Service" } }else if indexPath.row == 2 { if singleItem?.haveEmergency == "0" { cell.isHidden = true }else if singleItem?.haveMaintenance == "1" { cell.catImage.image = UIImage(named: "siren") cell.productName.text = "Emergency" } } return cell }else { return categoriesDetailsCell() } } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return subCatTabelView.frame.height / 3 } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if indexPath.row == 0 { let vc = productVC(nibName: "productVC", bundle: nil) vc.singleItem = singleItem self.navigationController!.pushViewController(vc, animated: true) }else if indexPath.row == 1 { let vc = maintenanceVC(nibName: "maintenanceVC", bundle: nil) vc.singleItem = singleItem self.navigationController!.pushViewController(vc, animated: true) }else if indexPath.row == 2 { let vc = emergencyServicesVC(nibName: "emergencyServicesVC", bundle: nil) vc.singleItem = singleItem self.navigationController!.pushViewController(vc, animated: true) } } }
[ -1 ]
194b5ff9d19bacd3167630570cba9741328824cf
ca37f74e42d664d6c424067e32f729d12b2099b7
/MKBadge/Core/BadgeView.swift
a31ee92a6415117c698392fb890ebd9502b7d46e
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
mohsinalimat/MKBadge
b6161449bc7cdc29b085cb2b02a9be6833d253a3
56ae5c0a8c412a086084d3de66e76e9d4a3de603
refs/heads/master
2020-05-17T22:45:17.639972
2019-04-15T04:00:00
2019-04-15T04:00:00
184,011,953
1
0
null
2019-04-29T06:23:05
2019-04-29T06:23:05
null
UTF-8
Swift
false
false
9,645
swift
// // BadgeView.swift // MKBadge // // Created by xiaobin liu on 2019/2/13. // Copyright © 2019 Sky. All rights reserved. // import UIKit import Foundation /// MARK - 角标View open class BadgeView: UILabel { override open func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { if let superview = superview { return superview } else { return super.hitTest(point, with: event) } } } private var badgeKey: Void? // MARK: - 扩展Badge角标 public extension UIView { var badge: Badge { get { let badge: Badge if let value = objc_getAssociatedObject(self, &badgeKey) as? Badge { badge = value } else { badge = Badge(self) objc_setAssociatedObject(self, &badgeKey, badge, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) } return badge } } } /// MARK - Badge public class Badge { public var type: BadgeType = .none { didSet { switch type { case .none, .point: badgeView.text = nil badgeView.attributedText = nil case .count(let count): badgeView.isHidden = count == 0 let string: String if count > maxNumber { string = "99+" } else { string = "\(count)" } badgeView.attributedText = nil badgeView.text = string case .custom(let result): badgeView.isHidden = result.count == 0 badgeView.attributedText = nil badgeView.text = result case let .customRichText(attributedString, height, _): badgeView.isHidden = false badgeView.backgroundColor = .clear badgeView.numberOfLines = 0 if let height = height { self.height = height } badgeView.text = nil badgeView.attributedText = attributedString } remakeConstraints() } } /// 角标位置类型 public var positionType: BadgePositionType = .topRight { didSet { remakeConstraints() } } /// 默认最大数量 public var maxNumber: Int = 99 /// 字体大小 public var fontSize: CGFloat = 13 { didSet { if case .count = type { updateFont() } } } /// 角标的高度,角标的角半径是这个值的一半 public var height: CGFloat = 9 { didSet { updateHeight() } } /// 角标背景颜色 public var backgroundColor: UIColor = UIColor.red { didSet { badgeView.backgroundColor = backgroundColor } } /// 角标文本颜色 public var textColor: UIColor = UIColor.white { didSet { badgeView.textColor = textColor } } private let badgeView: BadgeView private var centerXConstraint: NSLayoutConstraint? private var centerYConstraint: NSLayoutConstraint? private var heightConstraint: NSLayoutConstraint? private var widthConstraint: NSLayoutConstraint? internal init(_ superView: UIView) { badgeView = BadgeView() badgeView.translatesAutoresizingMaskIntoConstraints = false badgeView.backgroundColor = .red badgeView.layer.masksToBounds = true badgeView.numberOfLines = 1 badgeView.font = UIFont.systemFont(ofSize: fontSize, weight: .regular) badgeView.textColor = .white badgeView.textAlignment = .center superView.addSubview(badgeView) } private func remakeConstraints() { guard let _ = badgeView.superview else { return } updateConstraint() updateHeightConstraint() updateWidthConstraint() updateCornerRadius() } private func updateFont() { badgeView.font = UIFont.systemFont(ofSize: fontSize, weight: .regular) } private func updateHeight() { updateHeightConstraint() updateWidthConstraint() updateCornerRadius() } private func updateConstraint() { guard let superView = badgeView.superview else { return } switch positionType { case .topLeft: centerXConstraint?.isActive = false centerXConstraint = badgeView.trailingAnchor.constraint(equalTo: superView.leadingAnchor, constant: superView.layer.cornerRadius/2) centerXConstraint?.isActive = true centerYConstraint?.isActive = false centerYConstraint = badgeView.bottomAnchor.constraint(equalTo: superView.topAnchor, constant: superView.layer.cornerRadius/4) centerYConstraint?.isActive = true case .topRight: centerXConstraint?.isActive = false centerXConstraint = badgeView.leadingAnchor.constraint(equalTo: superView.trailingAnchor, constant: -superView.layer.cornerRadius/2) centerXConstraint?.isActive = true centerYConstraint?.isActive = false centerYConstraint = badgeView.bottomAnchor.constraint(equalTo: superView.topAnchor, constant: superView.layer.cornerRadius/4) centerYConstraint?.isActive = true case .bottomLeft: centerXConstraint?.isActive = false centerXConstraint = badgeView.trailingAnchor.constraint(equalTo: superView.leadingAnchor, constant: superView.layer.cornerRadius/4) centerXConstraint?.isActive = true centerYConstraint?.isActive = false centerYConstraint = badgeView.bottomAnchor.constraint(equalTo: superView.bottomAnchor, constant: superView.layer.cornerRadius/6) centerYConstraint?.isActive = true case .bottomRight: centerXConstraint?.isActive = false centerXConstraint = badgeView.leadingAnchor.constraint(equalTo: superView.trailingAnchor, constant: -superView.layer.cornerRadius/4) centerXConstraint?.isActive = true centerYConstraint?.isActive = false centerYConstraint = badgeView.bottomAnchor.constraint(equalTo: superView.bottomAnchor, constant: superView.layer.cornerRadius/6) centerYConstraint?.isActive = true case let .custom(offset): centerXConstraint?.isActive = false centerXConstraint = badgeView.centerXAnchor.constraint(equalTo: superView.centerXAnchor, constant: offset.x) centerXConstraint?.isActive = true centerYConstraint?.isActive = false centerYConstraint = badgeView.centerYAnchor.constraint(equalTo: superView.centerYAnchor, constant: offset.y) centerYConstraint?.isActive = true } } private func updateHeightConstraint() { heightConstraint?.isActive = false heightConstraint = badgeView.heightAnchor.constraint(equalToConstant: height) heightConstraint?.isActive = true } private func updateWidthConstraint() { let width: CGFloat? switch type { case .none: width = 0 case .point: width = height case .count(let count): if count > 0, let string = badgeView.text { if count >= 10 { width = string.boundingWidth(with: badgeView.font)+(height-"0".boundingWidth(with: badgeView.font)) } else { width = height } } else { width = 0 } case .custom(let result): if result.count > 0, let string = badgeView.text { width = string.boundingWidth(with: badgeView.font)+(height-"0".boundingWidth(with: badgeView.font)) } else { width = 0 } case .customRichText: width = nil } if let width = width { if let widthConstraint = widthConstraint { widthConstraint.constant = width } else { widthConstraint = badgeView.widthAnchor.constraint(equalToConstant: width) widthConstraint?.isActive = true } } else { widthConstraint?.isActive = false widthConstraint = nil } } private func updateCornerRadius() { switch type { case .none: break case .point, .count, .custom(_): badgeView.layer.cornerRadius = height/2 case let .customRichText(_, _, cornerRadius): if let cornerRadius = cornerRadius { badgeView.layer.cornerRadius = cornerRadius } else { badgeView.layer.cornerRadius = height/2 } } } } // MARK: - <#Description#> internal extension String { func boundingWidth(with font: UIFont) -> CGFloat { let size = CGSize(width: CGFloat.greatestFiniteMagnitude, height: font.lineHeight) let preferredRect = (self as NSString).boundingRect(with: size, options: [.usesLineFragmentOrigin, .usesFontLeading], attributes: [NSAttributedString.Key.font: font], context: nil) return ceil(preferredRect.width) } }
[ -1 ]
4137e70df2726dc2a11564a7c91d65b2508d3d3b
65023abbf680b332022f10fde7732985df3f5a78
/GWC Final/GWC Final/FinalGame/FinalGame/RandomFunction.swift
37337f4c4d678d4535875e70af112c2c7cd716e1
[ "MIT" ]
permissive
kelly-lo/2016_GWC_Homelessness_Project
b14d021dafb46e7b1a3afcd6aceea09d94e9e64c
de7d3facc8cf62975f65087b7b9cbbea91744af9
refs/heads/master
2020-04-27T23:37:30.608557
2016-07-29T22:14:10
2016-07-29T22:14:10
174,783,302
0
0
null
null
null
null
UTF-8
Swift
false
false
489
swift
// // RandomFunction.swift // game4 // // Created by Facebook on 7/28/16. // Copyright © 2016 DaryaVer. All rights reserved. // import Foundation import CoreGraphics public extension CGFloat{ public static func random() -> CGFloat{ return CGFloat(Float(arc4random()) / 0xFFFFFFFF) } public static func random(min min : CGFloat, max : CGFloat) -> CGFloat{ return CGFloat.random() * (max - min) + min } }
[ -1 ]
b3439a5fb74ac79677d70564e15dd0da642e9bfb
3349db880bef0cda61058ea8ddb1a6ecb3e5872b
/ADARateAlertView/Controllers/ADARateAlertView.swift
bd64d06211cb0072defee8837c65b79c8c69ba09
[ "MIT" ]
permissive
AmirDaliri/ADARateAlertView
2f0cdd40d9df6f8411ee30076f75c125f46b6cc7
e2f201710bcbc946086a596f29f5cfe838a7f452
refs/heads/master
2020-05-30T07:47:12.748535
2019-06-07T14:20:18
2019-06-07T14:20:18
189,604,980
0
0
null
null
null
null
UTF-8
Swift
false
false
2,049
swift
// // ADARateAlertView.swift // ADARateAlertView // // Created by Amir Daliri on 7.06.2019. // Copyright © 2019 Amir Daliri. All rights reserved. // import Foundation import StoreKit let Defaults = UserDefaults.standard struct UserDefaultsKeys { static let APP_OPENED_COUNT = "APP_OPENED_COUNT" } struct ADARateAlertView { static func incrementAppOpenedCount() { // called from appdelegate didfinishLaunchingWithOptions: guard var appOpenCount = Defaults.value(forKey: UserDefaultsKeys.APP_OPENED_COUNT) as? Int else { Defaults.set(1, forKey: UserDefaultsKeys.APP_OPENED_COUNT) return } appOpenCount += 1 Defaults.set(appOpenCount, forKey: UserDefaultsKeys.APP_OPENED_COUNT) } static func checkAndAskForReview() { // call this whenever appropriate // this will not be shown everytime. Apple has some internal logic on how to show this. guard let appOpenCount = Defaults.value(forKey: UserDefaultsKeys.APP_OPENED_COUNT) as? Int else { Defaults.set(1, forKey: UserDefaultsKeys.APP_OPENED_COUNT) ADARateAlertView().requestReview() return } print(appOpenCount) switch appOpenCount { case 1: Defaults.set(2, forKey: UserDefaultsKeys.APP_OPENED_COUNT) ADARateAlertView().requestReview() case 2: Defaults.set(3, forKey: UserDefaultsKeys.APP_OPENED_COUNT) ADARateAlertView().requestReview() case 10,50: ADARateAlertView().requestReview() case _ where appOpenCount%100 == 0 : ADARateAlertView().requestReview() default: print("App run count is : \(appOpenCount)") break; } } fileprivate func requestReview() { if #available(iOS 10.3, *) { SKStoreReviewController.requestReview() } else { // Fallback on earlier versions // Try any other 3rd party or manual method here. } } }
[ 201554, 308770 ]
f6ac6784c15ffd2195d4ff5d9117af0b4afb4572
f2c634bfedd5a90405a759ec8172c9c26f70ea85
/submodules/TelegramCore/Sources/MarkMessageContentAsConsumedInteractively.swift
d3233fe88f6bb127b60ac6e939ea35beeb7c0a07
[]
no_license
TianXianBob/Telegram
5a1e4cdf816a47bc603de9ac7c7ce3ceac4f8176
f99588f65114129664a03b3291f42dee1918c164
refs/heads/master
2023-01-21T15:00:08.168173
2020-12-03T05:13:05
2020-12-03T05:13:05
317,711,982
1
1
null
null
null
null
UTF-8
Swift
false
false
10,391
swift
import Foundation import Postbox import TelegramApi import SwiftSignalKit import SyncCore public func markMessageContentAsConsumedInteractively(postbox: Postbox, messageId: MessageId) -> Signal<Void, NoError> { return postbox.transaction { transaction -> Void in if let message = transaction.getMessage(messageId), message.flags.contains(.Incoming) { var updateMessage = false var updatedAttributes = message.attributes for i in 0 ..< updatedAttributes.count { if let attribute = updatedAttributes[i] as? ConsumableContentMessageAttribute { if !attribute.consumed { updatedAttributes[i] = ConsumableContentMessageAttribute(consumed: true) updateMessage = true if message.id.peerId.namespace == Namespaces.Peer.SecretChat { if let state = transaction.getPeerChatState(message.id.peerId) as? SecretChatState { var layer: SecretChatLayer? switch state.embeddedState { case .terminated, .handshake: break case .basicLayer: layer = .layer8 case let .sequenceBasedLayer(sequenceState): layer = sequenceState.layerNegotiationState.activeLayer.secretChatLayer } if let layer = layer { var globallyUniqueIds: [Int64] = [] if let globallyUniqueId = message.globallyUniqueId { globallyUniqueIds.append(globallyUniqueId) let updatedState = addSecretChatOutgoingOperation(transaction: transaction, peerId: message.id.peerId, operation: SecretChatOutgoingOperationContents.readMessagesContent(layer: layer, actionGloballyUniqueId: arc4random64(), globallyUniqueIds: globallyUniqueIds), state: state) if updatedState != state { transaction.setPeerChatState(message.id.peerId, state: updatedState) } } } } } else { addSynchronizeConsumeMessageContentsOperation(transaction: transaction, messageIds: [message.id]) } } } else if let attribute = updatedAttributes[i] as? ConsumablePersonalMentionMessageAttribute, !attribute.consumed { transaction.setPendingMessageAction(type: .consumeUnseenPersonalMessage, id: messageId, action: ConsumePersonalMessageAction()) updatedAttributes[i] = ConsumablePersonalMentionMessageAttribute(consumed: attribute.consumed, pending: true) } } let timestamp = Int32(CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970) for i in 0 ..< updatedAttributes.count { if let attribute = updatedAttributes[i] as? AutoremoveTimeoutMessageAttribute { if attribute.countdownBeginTime == nil || attribute.countdownBeginTime == 0 { var timeout = attribute.timeout if let duration = message.secretMediaDuration { timeout = max(timeout, duration) } updatedAttributes[i] = AutoremoveTimeoutMessageAttribute(timeout: timeout, countdownBeginTime: timestamp) updateMessage = true transaction.addTimestampBasedMessageAttribute(tag: 0, timestamp: timestamp + timeout, messageId: messageId) if messageId.peerId.namespace == Namespaces.Peer.SecretChat { var layer: SecretChatLayer? let state = transaction.getPeerChatState(message.id.peerId) as? SecretChatState if let state = state { switch state.embeddedState { case .terminated, .handshake: break case .basicLayer: layer = .layer8 case let .sequenceBasedLayer(sequenceState): layer = sequenceState.layerNegotiationState.activeLayer.secretChatLayer } } if let state = state, let layer = layer, let globallyUniqueId = message.globallyUniqueId { let updatedState = addSecretChatOutgoingOperation(transaction: transaction, peerId: messageId.peerId, operation: .readMessagesContent(layer: layer, actionGloballyUniqueId: arc4random64(), globallyUniqueIds: [globallyUniqueId]), state: state) if updatedState != state { transaction.setPeerChatState(messageId.peerId, state: updatedState) } } } } break } } if updateMessage { transaction.updateMessage(message.id, update: { currentMessage in var storeForwardInfo: StoreMessageForwardInfo? if let forwardInfo = currentMessage.forwardInfo { storeForwardInfo = StoreMessageForwardInfo(authorId: forwardInfo.author?.id, sourceId: forwardInfo.source?.id, sourceMessageId: forwardInfo.sourceMessageId, date: forwardInfo.date, authorSignature: forwardInfo.authorSignature) } return .update(StoreMessage(id: currentMessage.id, globallyUniqueId: currentMessage.globallyUniqueId, groupingKey: currentMessage.groupingKey, timestamp: currentMessage.timestamp, flags: StoreMessageFlags(currentMessage.flags), tags: currentMessage.tags, globalTags: currentMessage.globalTags, localTags: currentMessage.localTags, forwardInfo: storeForwardInfo, authorId: currentMessage.author?.id, text: currentMessage.text, attributes: updatedAttributes, media: currentMessage.media)) }) } } } } func markMessageContentAsConsumedRemotely(transaction: Transaction, messageId: MessageId) { if let message = transaction.getMessage(messageId) { var updateMessage = false var updatedAttributes = message.attributes var updatedMedia = message.media var updatedTags = message.tags for i in 0 ..< updatedAttributes.count { if let attribute = updatedAttributes[i] as? ConsumableContentMessageAttribute { if !attribute.consumed { updatedAttributes[i] = ConsumableContentMessageAttribute(consumed: true) updateMessage = true } } else if let attribute = updatedAttributes[i] as? ConsumablePersonalMentionMessageAttribute, !attribute.consumed { if attribute.pending { transaction.setPendingMessageAction(type: .consumeUnseenPersonalMessage, id: messageId, action: nil) } updatedAttributes[i] = ConsumablePersonalMentionMessageAttribute(consumed: true, pending: false) updatedTags.remove(.unseenPersonalMessage) updateMessage = true } } let timestamp = Int32(CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970) for i in 0 ..< updatedAttributes.count { if let attribute = updatedAttributes[i] as? AutoremoveTimeoutMessageAttribute { if (attribute.countdownBeginTime == nil || attribute.countdownBeginTime == 0) && message.containsSecretMedia { updatedAttributes[i] = AutoremoveTimeoutMessageAttribute(timeout: attribute.timeout, countdownBeginTime: timestamp) updateMessage = true if message.id.peerId.namespace == Namespaces.Peer.SecretChat { transaction.addTimestampBasedMessageAttribute(tag: 0, timestamp: timestamp + attribute.timeout, messageId: messageId) } else { for i in 0 ..< updatedMedia.count { if let _ = updatedMedia[i] as? TelegramMediaImage { updatedMedia[i] = TelegramMediaExpiredContent(data: .image) } else if let _ = updatedMedia[i] as? TelegramMediaFile { updatedMedia[i] = TelegramMediaExpiredContent(data: .file) } } } } break } } if updateMessage { transaction.updateMessage(message.id, update: { currentMessage in var storeForwardInfo: StoreMessageForwardInfo? if let forwardInfo = currentMessage.forwardInfo { storeForwardInfo = StoreMessageForwardInfo(authorId: forwardInfo.author?.id, sourceId: forwardInfo.source?.id, sourceMessageId: forwardInfo.sourceMessageId, date: forwardInfo.date, authorSignature: forwardInfo.authorSignature) } return .update(StoreMessage(id: currentMessage.id, globallyUniqueId: currentMessage.globallyUniqueId, groupingKey: currentMessage.groupingKey, timestamp: currentMessage.timestamp, flags: StoreMessageFlags(currentMessage.flags), tags: updatedTags, globalTags: currentMessage.globalTags, localTags: currentMessage.localTags, forwardInfo: storeForwardInfo, authorId: currentMessage.author?.id, text: currentMessage.text, attributes: updatedAttributes, media: updatedMedia)) }) } } }
[ -1 ]
022d8598a9c3dce31c0e76d3ccdce0cbb23ed642
dfbd6f6f325085fd00fc148f0734ccca8332610b
/HoroScope/Cell/CellZodiac/CellZodiac.swift
9674692c928625accaf570d861ca4f171e22e86e
[]
no_license
nguyenvietluy123/HoroScope
f61c5055745c1f09ae4479f03203b3a408ad88bf
3e2773223e85c86238c6cafe1131bdbb71a36426
refs/heads/master
2023-02-10T09:13:48.544238
2023-02-03T06:54:57
2023-02-03T06:54:57
172,818,925
2
0
null
null
null
null
UTF-8
Swift
false
false
624
swift
// // CellZodiac1.swift // HoroScope // // Created by Luy Nguyen on 2/25/19. // Copyright © 2019 Luy Nguyen. All rights reserved. // import UIKit class CellZodiac: UICollectionViewCell { @IBOutlet weak var lbName: KHLabel! @IBOutlet weak var lbDate: KHLabel! @IBOutlet weak var imgView: UIImageView! @IBOutlet weak var viewContent: UIView! override func awakeFromNib() { super.awakeFromNib() } } extension CellZodiac { func config(obj: ZodiacObj) { self.lbName.text = obj.name self.lbDate.text = obj.date self.imgView.image = obj.img } }
[ -1 ]
efeda8f2abebd626a5c9696f8e5ab9a802c1ef67
210b5a12f329795470573ecd5adf821520330bb8
/Sources/Equations/API/Equations+Lesser.swift
e454c6da7c9954240f0dfc97ef93ef158422c080
[ "MIT" ]
permissive
hfehrmann/equations
e96514aaf87ec374fcafa32fe0d08cadd8f624ae
abec2b15ac3a4886b390fd0ea6b0505742874859
refs/heads/master
2023-01-12T23:23:06.830383
2020-11-13T15:58:26
2020-11-13T16:26:49
297,458,036
0
0
null
null
null
null
UTF-8
Swift
false
false
1,187
swift
// // Equations+Lesser.swift // Equations // // Created by Hans Fehrmann on 21-09-20. // Copyright © 2020 Fehrmann Inc. All rights reserved. // import CoreGraphics #if canImport(UIKit) import UIKit #elseif canImport(AppKit) import AppKit #endif @discardableResult public func <=<A: LayoutAnchor>(_ lhs: LayoutProxy<A>, rhs: A) -> NSLayoutConstraint { return lhs.createConstraint { $0.constraint(lessThanOrEqualTo: rhs, constant: 0) } } @discardableResult public func <=<A: LayoutAnchor>(_ lhs: LayoutProxy<A>, rhs: LayoutConfiguration<A>) -> NSLayoutConstraint { return lhs.createConstraint { $0.constraint(lessThanOrEqualTo: rhs.anchor, constant: rhs.constant) } } // MARK: - Dimension API @discardableResult public func <=<A: LayoutDimension>(_ lhs: LayoutProxy<A>, rhs: CGFloat) -> NSLayoutConstraint { return lhs.createConstraint { $0.constraint(lessThanOrEqualToConstant: rhs) } } @discardableResult public func <=<A: LayoutDimension>(_ lhs: LayoutProxy<A>, rhs: LayoutConfiguration<A>) -> NSLayoutConstraint { return lhs.createConstraint { $0.constraint(lessThanOrEqualTo: rhs.anchor, multiplier: rhs.multiplier, constant: rhs.constant) } }
[ -1 ]
a21622547d30c9a7409969d9d7a9ac06dff767e7
c9f7ca2f43b63469dc02b899494ef32dc4049e3f
/Sources/SwiftNetworking/Foundation/URLSession+HTTPClient.swift
17c05ee5ca7b0d7a7b3e6f3a3e1c09a68642b6a9
[]
no_license
niazoff/SwiftNetworking
7f978c8ed0c2ce0eec42f4530392fb2082ee22aa
daf22b4f039b2f48a9ce210160e54f352a931cc7
refs/heads/master
2023-05-13T10:41:45.642710
2023-04-30T16:38:19
2023-04-30T16:38:19
195,137,314
0
0
null
null
null
null
UTF-8
Swift
false
false
1,230
swift
// // URLSession+HTTPClient.swift // SwiftNetworking // // Created by Natanel Niazoff on 7/3/19. // Copyright © 2019 Natanel Niazoff. All rights reserved. // import Foundation extension URLSession: HTTPClient { @discardableResult public func send(_ request: URLRequest, completionHandler: @escaping (HTTPResult) -> Void = { _ in }) -> AsyncTask { let task = self.dataTask(with: request) { data, response, error in self.dataTaskCompletionHandler(data: data, response: response, error: error, completionHandler: completionHandler) } task.resume() return task } private func dataTaskCompletionHandler(data: Data?, response: URLResponse?, error: Error?, completionHandler: @escaping (HTTPResult) -> Void) { if let error = error { completionHandler(.failure(error)); return } else if let response = response as? HTTPURLResponse, let data = data { // Ensure a valid HTTP status code or send the HTTP error. guard case 100..<300 = response.statusCode else { completionHandler(.failure(HTTPError(statusCode: response.statusCode, data: data))); return } completionHandler(.success(HTTPResponse(statusCode: response.statusCode, data: data))) } } }
[ -1 ]
b181f8512133fdf9076d8fabf1e1310c4a859aa2
a2d9fe1e6e43f271e6953491ccfe2dec9586d977
/ZoomableImageView/ZoomableImageView.swift
4f156cee5c1034d01c18fba7d1b353262ed6104d
[]
no_license
jolingenfelter/ZoomableImageView
03cac9afb8c8ce4bde908e617ffe4882b0d6c58a
a822302f2f373d380a6560dbef59ad2ff81d4724
refs/heads/master
2021-08-07T19:18:19.282188
2017-11-08T20:46:07
2017-11-08T20:46:07
109,620,408
0
1
null
2017-11-06T16:30:28
2017-11-05T22:03:31
Swift
UTF-8
Swift
false
false
4,128
swift
// // ZoomableImageView.swift // MeWork // // Created by Joanna LINGENFELTER on 11/5/17. // Copyright © 2017 JoLingenfelter. All rights reserved. // import UIKit class ZoomableImageView: UIScrollView { fileprivate var imageView: UIImageView? fileprivate var originalImage: UIImage? fileprivate var isFirstLoad = true override init(frame: CGRect) { super.init(frame: frame) customInit() } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) customInit() } func customInit() { self.layer.borderColor = UIColor.black.cgColor self.layer.borderWidth = 2.0 self.layer.cornerRadius = 15.0 self.showsVerticalScrollIndicator = false self.showsHorizontalScrollIndicator = false self.bouncesZoom = true self.decelerationRate = UIScrollViewDecelerationRateFast self.delegate = self } override func layoutSubviews() { super.layoutSubviews() } // Constraints myst be set on scrollView (or frame) in setup before this method is called func showImage(_ image: UIImage) { if self.imageView != nil { self.imageView?.removeFromSuperview() self.imageView = nil } self.imageView = UIImageView(image: image) configureForImageSize(image.size) self.addSubview(imageView!) if isFirstLoad { originalImage = image isFirstLoad = false } } private func configureForImageSize(_ imageSize: CGSize) { self.contentSize = imageSize setZoomScale() } private func setZoomScale() { guard let imageView = imageView else { return } let imageViewSize = imageView.bounds.size let scrollViewSize = self.bounds.size let widthScale = scrollViewSize.width / imageViewSize.width let heightScale = scrollViewSize.height / imageViewSize.height self.minimumZoomScale = min(widthScale, heightScale) self.maximumZoomScale = 10.0 self.contentOffset = CGPoint(x: imageViewSize.width/2, y: imageViewSize.height/2) self.zoomScale = self.minimumZoomScale } // MARK: - CropImage func cropImage(completion: (UIImage) -> ()) throws { guard let imageView = imageView else { return } let scale: CGFloat = 1/self.zoomScale let x: CGFloat = self.contentOffset.x * scale let y: CGFloat = self.contentOffset.y * scale let width: CGFloat = self.frame.size.width * scale let height: CGFloat = self.frame.size.height * scale let cropRect = CGRect(x: x, y: y, width: width, height: height) guard let croppedCGImage = imageView.image?.cgImage?.cropping(to: cropRect) else { throw ImageCroppingError.unknownError } let newImage = UIImage(cgImage: croppedCGImage) showImage(image: newImage) completion(newImage) } func revertToOriginal() { guard let originalImage = originalImage else { return } showImage(image: originalImage) } } // MARK: - UIScrollViewDelegate extension ZoomableImageView: UIScrollViewDelegate { func viewForZooming(in scrollView: UIScrollView) -> UIView? { return self.imageView } func scrollViewDidZoom(_ scrollView: UIScrollView) { let imageViewSize = imageView!.frame.size let scrollViewSize = self.bounds.size let verticalPadding = imageViewSize.height < scrollViewSize.height ? (scrollViewSize.height - imageViewSize.height) / 2 : 0 let horizontalPadding = imageViewSize.width < scrollViewSize.width ? (scrollViewSize.width - imageViewSize.width) / 2 : 0 scrollView.contentInset = UIEdgeInsets(top: verticalPadding, left: horizontalPadding, bottom: verticalPadding, right: horizontalPadding) } }
[ -1 ]
bea218fc51a0e98907ff6f90343a15be25e69219
a677da39159fb9d35d053a652c560952d09873fd
/Arena Challenge/Arena Challenge/Extensions/UIStoryboardExtensions.swift
66bc276e4041aa7927bb0e0b2adfa06e34546358
[]
no_license
fgallo/desafio-ios
6d3c17e7b1a242befeaca05d180ba5bfe6d31216
1aa20042dcf0b6f04569775220405b99ec9cad5f
refs/heads/master
2021-01-19T08:35:44.173784
2017-04-10T00:58:34
2017-04-10T00:58:34
87,651,312
0
0
null
2017-04-08T17:25:25
2017-04-08T17:25:25
null
UTF-8
Swift
false
false
658
swift
// // UIStoryboardExtensions.swift // Arena Challenge // // Created by Fernando Gallo on 09/04/17. // Copyright © 2017 arena. All rights reserved. // import UIKit extension UIStoryboard { @nonobjc static var main: UIStoryboard { return UIStoryboard(name: "Main", bundle: nil) } var repositoriesViewController: RepositoriesViewController { guard let vc = UIStoryboard.main.instantiateViewController(withIdentifier: "RepositoriesViewController") as? RepositoriesViewController else { fatalError("RepositoriesViewController couldn't be found in Storyboard file") } return vc } }
[ -1 ]
b71b8b6a974805abdc4d23b6ddb55ecf4e55d1ce
c018297ec676f3a1d01979aac06fb9f084607cf2
/scripts/health_metrics/generate_code_coverage_report/Sources/UpdatedFilesCollector/main.swift
b10ba40b3ea7f892fb82b0fd23ca6644b85b820e
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license" ]
permissive
invertase/firebase-ios-sdk
ab7ac5fab7c0f8f9d5475543e0d6eca6761542fa
7a141fd867ef09053d6b215393ca9a543bfda79c
refs/heads/master
2023-08-27T13:29:58.226140
2022-01-08T00:08:20
2022-01-08T00:08:20
296,361,450
1
1
Apache-2.0
2020-09-17T15:06:42
2020-09-17T15:06:40
null
UTF-8
Swift
false
false
4,510
swift
/* * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import ArgumentParser import Foundation struct SDKFilePattern: Codable { let sdk: String let podspecs: [String] let filePatterns: [String] } /// SDKPodspec is to help generate an array of podspec in json file, e.g. /// ``` output.json /// [{"podspec":"FirebaseABTesting.podspec"},{"podspec":"FirebaseAnalytics.podspec.json"}] /// ``` struct SDKPodspec: Codable { let podspec: String } struct UpdatedFilesCollector: ParsableCommand { @Option(help: "A txt File with updated files.", transform: { str in let url = URL(fileURLWithPath: str) let data = try String(contentsOf: url) return data.components(separatedBy: .newlines) }) var changedFilePaths: [String] @Option(help: "A JSON file path conforming to the struct SDKFilePattern", transform: { str in let url = URL(fileURLWithPath: str) let jsonData = try Data(contentsOf: url) return try JSONDecoder().decode([SDKFilePattern].self, from: jsonData) }) var codeCoverageFilePatterns: [SDKFilePattern] @Option(help: "A output file with all Podspecs with related changed files", transform: { str in print(FileManager.default.currentDirectoryPath) let documentDir = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) return documentDir.appendingPathComponent(str) }) var outputSDKFileURL: URL? func run() throws { var podspecsWithChangedFiles: [SDKPodspec] = [] print("=============== list changed files ===============") print(changedFilePaths.joined(separator: "\n")) // Initiate all run_job flag to false. for sdkPatterns in codeCoverageFilePatterns { print("::set-output name=\(sdkPatterns.sdk)_run_job::false") } // Go through patterns of each sdk. Once there is a path of changed file matching // any pattern of this sdk, the run_job flag of this sdk will be turned to true. for sdkPatterns in codeCoverageFilePatterns { var trigger_pod_test_for_coverage_report = false for pattern in sdkPatterns.filePatterns { let regex = try! NSRegularExpression(pattern: pattern) // If one changed file path match one path of this sdk, the run_job flag of // the sdk will be turned on. for changedFilePath in changedFilePaths { let range = NSRange(location: 0, length: changedFilePath.utf16.count) if regex.firstMatch(in: changedFilePath, options: [], range: range) != nil { print("=============== paths of changed files ===============") print("::set-output name=\(sdkPatterns.sdk)_run_job::true") for podspec in sdkPatterns.podspecs { podspecsWithChangedFiles.append(SDKPodspec(podspec: podspec)) } print("\(sdkPatterns.sdk): \(changedFilePath) is updated under the pattern, \(pattern)") trigger_pod_test_for_coverage_report = true // Once this sdk run_job flag is turned to true, then the loop // will skip to the next sdk. break } if trigger_pod_test_for_coverage_report { break } } if trigger_pod_test_for_coverage_report { break } } } if let outputPath = outputSDKFileURL { do { // Instead of directly writing Data to a file, trasnferring Data to // String can help trimming whitespaces and newlines in advance. let str = try String( decoding: JSONEncoder().encode(podspecsWithChangedFiles), as: UTF8.self ) try str.trimmingCharacters(in: .whitespacesAndNewlines).write( to: outputPath, atomically: true, encoding: String.Encoding.utf8 ) } catch { fatalError("Error while writting in \(outputPath.path).\n\(error)") } } } } UpdatedFilesCollector.main()
[ -1 ]
65ec5af4296d65d06433fcedb18d0f6387fcedc8
ee1bddd239322c0ba6c9992dc5834888c54b58d4
/machineLearning/MLApp/MLApp/FacialFeatures.swift
5c62458d9f9b16ac2961d371b136bf1c1c993d87
[]
no_license
shreesha-kedilaya/Map_Clustering
63ea33e832b6df1d5899b9c58ae9be70241809e5
6e42b5c35172f38cfb7b1d781603c5624ef98297
refs/heads/master
2020-03-20T04:14:51.431203
2018-09-13T12:42:19
2018-09-13T12:42:19
137,176,452
0
0
null
null
null
null
UTF-8
Swift
false
false
6,820
swift
// // FacialFeatures.swift // MLApp // // Created by DImple on 01/12/17. // Copyright © 2017 DImple. All rights reserved. // import UIKit class FacialFeatures: NSObject { class func calculateFacialFeatures(data: NSMutableArray) -> [Double] { let outerBrowRaiserValue = outerBrowRaiser(right: [data.getY(index: 17), data.getY(index: 36), data.getY(index: 18), data.getY(index: 36)], left: [data.getY(index: 26), data.getY(index: 45), data.getY(index: 25), data.getY(index: 45)]) let browLowererValue = browLowerer(right: [data.getY(index: 21), data.getY(index: 39), data.getY(index: 20), data.getY(index: 38), data.getY(index: 19), data.getY(index: 37)], left: [data.getY(index: 22), data.getY(index: 42), data.getY(index: 23), data.getY(index: 43), data.getY(index: 24), data.getY(index: 44)]) let upperLidRaiserValue = upperLidRaiser(right: [data.getY(index: 37), data.getY(index: 41), data.getY(index: 38), data.getY(index: 40)], left: [data.getY(index: 43), data.getY(index: 47), data.getY(index: 44), data.getY(index: 46)]) let cheekRaiserValue = cheekRaiser(right: [data.getY(index: 40), data.getY(index: 48)], left: [data.getY(index: 47), data.getY(index: 54)]) let lidTightenerValue = lidTightener(right: [data.getY(index: 37), data.getY(index: 41), data.getY(index: 38), data.getY(index: 40)], left: [data.getY(index: 43), data.getY(index: 47), data.getY(index: 44), data.getY(index: 46)]) let noseWrinklerValue = noseWrinkler(right: [data.getY(index: 39), data.getY(index: 31)], left: [data.getY(index: 42), data.getY(index: 35)]) let lipCornerPullerValue = lipCornerPuller(right: data.getX(index: 48), left: data.getX(index: 54)) let dimplerValue = dimpler(right: [data.getY(index: 40), data.getY(index: 48)], left: [data.getY(index: 47), data.getY(index: 54)]) let lipCornerDepresserValue = lipCornerDepresser(right: data.getY(index: 48), left: data.getY(index: 54), middle: [data.getY(index: 8), data.getY(index: 57)]) let lowerLipDepresserValue = lowerLipDepresser(param: [data.getY(index: 50), data.getY(index: 58), data.getY(index: 51), data.getY(index: 57), data.getY(index: 52), data.getY(index: 56)]) let lipStretcherValue = lipStretcher(param: [data.getY(index: 50), data.getY(index: 58), data.getY(index: 51), data.getY(index: 57), data.getY(index: 52), data.getY(index: 56)]) let lipTightenerValue = lipCornerPullerValue let jawDropValue = jawDrop(param: [data.getY(index: 33), data.getY(index: 8)]) let features = [outerBrowRaiserValue, browLowererValue, upperLidRaiserValue, cheekRaiserValue, lidTightenerValue, noseWrinklerValue, lipCornerPullerValue, dimplerValue, lipCornerDepresserValue, lowerLipDepresserValue, lipStretcherValue, lipTightenerValue, jawDropValue] return features } private class func outerBrowRaiser(right rightParam: [Double], left leftParam: [Double]) -> Double { let right = [rightParam[1] - rightParam[0], rightParam[3] - rightParam[2]].average let left = [leftParam[1] - leftParam[0], leftParam[3] - leftParam[2]].average return [right, left].average } private class func browLowerer(right rightParam: [Double], left leftParam: [Double]) -> Double { let right = [rightParam[1] - rightParam[0], rightParam[3] - rightParam[2], rightParam[5] - rightParam[4]].average let left = [leftParam[1] - leftParam[0], leftParam[3] - leftParam[2], leftParam[5] - leftParam[4]].average return [right, left].average } private class func upperLidRaiser(right rightParam: [Double], left leftParam: [Double]) -> Double { let right = [rightParam[1] - rightParam[0], rightParam[3] - rightParam[2]].average let left = [leftParam[1] - leftParam[0], leftParam[3] - leftParam[2]].average return [right, left].average } private class func cheekRaiser(right rightParam: [Double], left leftParam: [Double]) -> Double { let right = rightParam[1] - rightParam[0] let left = leftParam[1] - leftParam[0] return [right, left].average } private class func lidTightener(right rightParam: [Double], left leftParam: [Double]) -> Double { // combines with browLowerer value let right = [rightParam[1] - rightParam[0], rightParam[3] - rightParam[2]].average let left = [leftParam[1] - leftParam[0], leftParam[3] - leftParam[2]].average return [right, left].average } private class func noseWrinkler(right rightParam: [Double], left leftParam: [Double]) -> Double { let right = rightParam[1] - rightParam[0] let left = leftParam[1] - leftParam[0] return [right, left].average } private class func lipCornerPuller(right rightParam: Double, left leftParam: Double) -> Double { return abs(rightParam - leftParam) } private class func dimpler(right rightParam: [Double], left leftParam: [Double]) -> Double { let right = rightParam[1] - rightParam[0] let left = leftParam[1] - leftParam[0] return abs(right - left) } private class func lipCornerDepresser(right rightParam: Double, left leftParam: Double, middle middleParam: [Double]) -> Double { let right = rightParam - middleParam[0] let left = leftParam - middleParam[0] let middle = middleParam[1] - middleParam[0] let avg = [right, left].average return middle - avg // max for normal } private class func lowerLipDepresser(param: [Double]) -> Double { return [param[1] - param[0], param[3] - param[2], param[5] - param[4]].average } private class func lipStretcher(param: [Double]) -> Double { return [param[1] - param[0], param[3] - param[2], param[5] - param[4]].average } private class func jawDrop(param: [Double]) -> Double { return param[1] - param[0] } } extension Array where Element: FloatingPoint { var total: Element { return reduce(0, +) } var average: Element { return isEmpty ? 0 : total / Element(count) } } extension NSMutableArray { func getX(index: Int) -> Double { return Double((self[index] as! CGPoint).x) } func getY(index: Int) -> Double { return Double((self[index] as! CGPoint).y) } }
[ -1 ]
0d09f81e6ab11a60b123b31a6b4752ccd9c67e45
381ade6bf0f6adfa5c2312d2ebf0e0b575aa0e3b
/Training/Training/View/EmveepTextField.swift
352ef909f623cbd1b1653fc226e9f23d0e48b262
[]
no_license
valabal/TrainingProject
34970ef39bc6fb2770d25c82299ca7d2878279dc
48735a4afd02955567e8e4c9ede60991a8e98ea0
refs/heads/master
2021-01-19T14:28:15.174731
2017-08-22T09:51:54
2017-08-22T09:51:54
100,906,673
0
1
null
null
null
null
UTF-8
Swift
false
false
1,279
swift
// // EmveepTextField.swift // EmveepApp // // Created by Valbal on 12/6/16. // Copyright © 2016 Emveep. All rights reserved. // import UIKit import JVFloatLabeledTextField class EmveepTextField: MaterialDesignTextField { @IBInspectable var isBold: Bool = false required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder)! self.commonInit() } override init(frame:CGRect) { super.init(frame:frame) self.commonInit() } override func commonInit(){ super.commonInit() self.underlineNormalColor = UIColor.basicLineColor self.underlineHighlightedColor = UIColor.basicLineColor.lighten(0.25) self.errorColor = UIColor.alertTextColor self.floatingLabelTextColor = UIColor.basicTextColor.lighten(0.25); self.floatingLabelActiveTextColor = UIColor.activeTextColor; self.placeholderColor = UIColor.basicTextPlaceholderColor; self.textColor = UIColor.basicTextColor; if (self.isBold){ self.font = UIFont.boldFontWithSize(size: (self.font?.pointSize)!) } else{ self.font = UIFont.regularFontWithSize(size: (self.font?.pointSize)!) } } }
[ -1 ]
55f1f4c09d22a4b66a2f60e07ca74d08f6af9e34
1fbdd72c16a61c8d351abaecfc8d1bfb189d3453
/Package.swift
0bf5673322c228c48d6c60666aa90146d4af0efa
[ "MIT" ]
permissive
Magic-Solutions-DMCC/VDKit
7c6387adb7ee2c8b7b52cb9e4569db6cd25146ba
1a67416342b49914365225349894c7327dcc1bea
refs/heads/master
2023-07-14T19:03:36.357290
2021-08-21T02:56:20
2021-08-21T02:56:20
398,449,473
0
0
NOASSERTION
2021-08-21T02:48:35
2021-08-21T02:41:53
null
UTF-8
Swift
false
false
521
swift
// swift-tools-version:5.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "VDKit", platforms: [ .iOS(.v11) ], products: [ .library(name: "VDKit", targets: ["VDKit"]), ], dependencies: [], targets: [ .target(name: "VDKitRuntime", dependencies: []), .target(name: "VDKit", dependencies: ["VDKitRuntime"]), .testTarget(name: "VDKitTests", dependencies: ["VDKit"]), ] )
[ 399392, 374465, 344802, 405005, 374610, 10484, 136342, 259900 ]
619936829317b701344e1dac35cf7d1a88f872c8
48ed13ea9e1db4dd0242df07cdb4d9feb688ee24
/ZhSwiftDemo/ZhSwiftDemo/Classes/Cell/DYGameCollCell.swift
e27213b8de28325ee5b610c31e6c65d531828542
[]
no_license
Zhuangjt/ZhSwiftDemo
696197c481653dfb49b6819253256d27b797e97d
95aa40d7d968a0cd60833b387b8e6380203505fb
refs/heads/master
2020-03-24T20:34:46.996824
2018-11-02T10:39:21
2018-11-02T10:39:21
142,985,799
3
0
null
null
null
null
UTF-8
Swift
false
false
1,419
swift
// // DYGameCollCell.swift // ZhSwiftDemo // // Created by Zhuang on 2018/10/22. // Copyright © 2018 Zhuang. All rights reserved. // import UIKit class DYGameCollCell: BaseCollectionViewCell { var model: RecomCateList?{ didSet{ contentImg.kf.setImage(with: URL.init(string: model?.square_icon_url ?? "")) labName.text = model?.cate2_name } } lazy var contentImg: UIImageView = { let contentImg = UIImageView() return contentImg }() lazy var labName: UILabel = { let labName = UILabel.quickCreateLabel(text: "王者荣耀", textColor: KCOLOR_TEXT_BLACK1, font: KFontSize(FONT_SUPER_SMALL)) labName.textAlignment = NSTextAlignment.center return labName }() override func setUpUI() { addSubview(contentImg) addSubview(labName) contentImg.snp.makeConstraints { (make) in make.top.equalTo(KAutoLayoutWidth(14)) make.centerX.equalTo(self.contentView) make.size.equalTo(CGSize(width: KAutoLayoutWidth(KAutoLayoutWidth(60)), height: KAutoLayoutWidth(40))) } labName.snp.makeConstraints { (make) in make.centerX.equalTo(self.contentView) make.top.equalTo(contentImg.snp.bottom).offset(10) make.left.equalTo(3) make.right.equalTo(-3) } } }
[ -1 ]
88dbba22193ca0ea16639f0b6d3e6f135a942d85
495a4acd21e490e79d5620a3bad95882e76f6e9a
/zhuishushenqi/Root/Views/RootNavigationView.swift
533777bb8d0a861f701f51cb5cc197d7e4d4c3ad
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
samshine/zhuishushenqi
142459328f3ed147859699de49fe32d6fb3c343c
876a9ee6afa162f4fb71eff5fa02f2e0dbe52ae2
refs/heads/master
2021-01-21T19:51:38.495655
2017-04-25T15:32:01
2017-04-25T15:32:01
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,664
swift
// // RootNavigationView.swift // zhuishushenqi // // Created by Nory Cao on 2017/3/16. // Copyright © 2017年 QS. All rights reserved. // import UIKit class RootNavigationView: UIView { override init(frame: CGRect) { super.init(frame: frame) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } static func make(delegate:UIViewController){ let leftBtn = BarButton(type: .custom) leftBtn .addTarget(delegate, action: #selector(RootViewController.leftAction(_:)), for: .touchUpInside) leftBtn.setBackgroundImage(UIImage(named: "nav_home_side_menu"), for: UIControlState()) leftBtn.setBackgroundImage(UIImage(named: "nav_home_side_menu_selected"), for: .highlighted) leftBtn.frame = CGRect(x: 0, y: 0, width: 40, height: 40) let leftBar = UIBarButtonItem(customView: leftBtn) let rightBtn = BarButton(type: .custom) rightBtn.addTarget(delegate, action: #selector(RootViewController.rightAction(_:)), for: .touchUpInside) rightBtn.setBackgroundImage(UIImage(named: "nav_add_book"), for: UIControlState()) rightBtn.setBackgroundImage(UIImage(named: "nav_add_book_selected"), for: .highlighted) rightBtn.frame = CGRect(x: 0, y: 0, width: 40, height: 40) let rightBar = UIBarButtonItem(customView: rightBtn) delegate.navigationItem.leftBarButtonItem = leftBar delegate.navigationItem.rightBarButtonItem = rightBar let titleImg = UIImageView(image: UIImage(named: "zssq_image")) delegate.navigationItem.titleView = titleImg } }
[ -1 ]
7ea1aaef5158904dd481239180a2b780a632f745
7f1b1ad865b0d89312f80e9e051d11ed5dd1a137
/BithumbHomeworkJskang/BithumbHomeworkJskang/ViewControllers/CoinListViewController/CoinListPresenter.swift
a598973188384c8dfd14c76aeec8e446089b3cc5
[]
no_license
jskang1988/BithumbHomeworkJskang
ea13254156af8f63efa23856bc41480a831ac970
509261bd56f04ce59c1251423f48737cdb8c64df
refs/heads/master
2023-03-17T01:35:04.050556
2021-03-04T12:33:04
2021-03-04T12:33:04
344,437,836
0
0
null
null
null
null
UTF-8
Swift
false
false
1,436
swift
// // CoinListPresenter.swift // BithumbHomeworkJskang // // Created by 강진석 on 2021/03/02. // Copyright (c) 2021 ___ORGANIZATIONNAME___. 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 protocol CoinListPresentationLogic { func presentAllCoinList(response: CoinList.AllCoinList.Response) func presentBTCCoin(response: CoinList.BTCCoin.Response) func presentCoinListByInfo(response: CoinList.CoinListByInfo.Response) } class CoinListPresenter: CoinListPresentationLogic { weak var viewController: CoinListDisplayLogic? func presentAllCoinList(response: CoinList.AllCoinList.Response) { var viewModel = CoinList.AllCoinList.ViewModel() viewModel.coinList = response.coinList viewController?.displayAllCoinList(viewModel: viewModel) } func presentBTCCoin(response: CoinList.BTCCoin.Response) { var viewModel = CoinList.BTCCoin.ViewModel() viewModel.btcCoin = response.btcCoin viewController?.displayBTCCoin(viewModel: viewModel) } func presentCoinListByInfo(response: CoinList.CoinListByInfo.Response) { let viewModel = CoinList.CoinListByInfo.ViewModel(coinList: response.coinList) viewController?.displayCoinListByInfo(viewModel: viewModel) } }
[ -1 ]
f87faf3bd5a6a4d79149d71b3e6037e878339b8e
2a7d7cf1813b24e1e81ad82a40c279cb2c01a107
/Recipes/RecipeListViewController.swift
b203ee3b9842a946fa27f4786b4ed0b457183f82
[]
no_license
meetkarthiksv89/recipes
af3f031be5c082f05c2eb426fc8212cd5afdbff4
5ccdbf12399c103c22cdaa84dbed9438082dc056
refs/heads/master
2021-01-21T08:32:57.920541
2017-07-19T03:38:26
2017-07-19T03:38:26
91,631,393
0
0
null
null
null
null
UTF-8
Swift
false
false
6,404
swift
// // ViewController.swift // Recipes // // Created by Karthik S V on 07/05/17. // Copyright © 2017 SV. All rights reserved. // import UIKit import RealmSwift import Realm class RecipeListViewController: UIViewController{ @IBOutlet weak var recipeTableView: UITableView! var recipes: Results<Recipe>! var selectedRecipe: Recipe! var notificationToken: NotificationToken! var realm: Realm! override func viewDidLoad() { super.viewDidLoad() self.title = "Recipes" recipeTableView.delegate = self recipeTableView.dataSource = self // let recipeOne = Recipe(withTitle: "Masala Dosa", timeNeeded: "2 mins", ingredients: ["Bread","Eggs","Eggs","Milk"], directions: ["Bread","Eggs","Eggs","Milk"]) // recipes.append(recipeOne) let realm = try! Realm() // try! realm.write { // realm.deleteAll() // } recipes = realm.objects(Recipe.self).sorted(byKeyPath: "title", ascending: true) } func setupRealm() { // Log in existing user with username and password let username = "[email protected]" // <--- Update this let password = "svkkar001" // <--- Update this SyncUser.logIn(with: .usernamePassword(username: username, password: password, register: false), server: URL(string: "http://127.0.0.1:9080")!) { user, error in guard let user = user else { fatalError(String(describing: error)) } DispatchQueue.main.async { // Open Realm let configuration = Realm.Configuration( syncConfiguration: SyncConfiguration(user: user, realmURL: URL(string: "realm://127.0.0.1:9080/~/realmtasks")!) ) self.realm = try! Realm(configuration: configuration) // Show initial tasks func updateList() { self.recipes = self.realm.objects(Recipe.self) self.recipeTableView.reloadData() } updateList() // Notify us when Realm changes self.notificationToken = self.realm.addNotificationBlock { _ in updateList() } } } } // deinit { // notificationToken.stop() // } override func viewWillAppear(_ animated: Bool) { recipeTableView.reloadData() } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "showDetail" { if let recipeDetailViewController = segue.destination as? RecipeDetailsViewController { if let indexPath = recipeTableView.indexPath(for: sender as! UITableViewCell){ recipeDetailViewController.recipe = recipes[indexPath.row] recipeDetailViewController.fromDetailsTableView = true recipeDetailViewController.title = recipes[indexPath.row].title recipeDetailViewController.delegate = self } } } else if segue.identifier == "addDetail" { if let recipeDetailViewController = segue.destination as? RecipeDetailsViewController { //recipeDetailViewController.recipe = recipes[indexPath.row] recipeDetailViewController.fromDetailsTableView = false recipeDetailViewController.title = "Add Recipe" recipeDetailViewController.delegate = self } } } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } @IBAction func editTableView(_ sender: Any) { recipeTableView.isEditing = !recipeTableView.isEditing } } extension RecipeListViewController: UITableViewDataSource, UITableViewDelegate { func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return recipes.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if let cell = recipeTableView.dequeueReusableCell(withIdentifier: "recipeCell") as? RecipeCellTableViewCell{ cell.updateUI(recipe: recipes[indexPath.row]) return cell } return UITableViewCell() } func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool { return true } // func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) { // //var recipes = self.recipes as! Array<Any> // let itemToMove = recipes // // // // //try! recipes.realm!.write { // recipes.realm!.beginWrite() // // recipes.realm!.beginWriteTransaction() // recipes // recipes.removeObjectAtIndex(UInt(sourceIndexPath.row)) // itemToMove.insertObject(itemToMove, atIndex: UInt(destinationIndexPath.row)) // recipes.realm!.commitWrite() // //// recipes.remove(at: sourceIndexPath.row) //// recipes.insert(itemToMove, at: destinationIndexPath.row) // } func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { return true } func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) { if (editingStyle == UITableViewCellEditingStyle.delete) { try! recipes.realm!.write { recipes.realm!.delete(recipes[indexPath.row]) } recipeTableView.reloadData() // handle delete (by removing the data from your array and updating the tableview) } } } extension RecipeListViewController: RecipeProtocol{ func saveAndReloadTheTable(recipe: Recipe){ // recipes.append(recipe) } }
[ -1 ]
528ba5a713349ff52fb84436514c3bae6b8a6bc5
71b718d1222937aa005366ef79d96c9e8a4bfd27
/Sources/HelloGtkRadioButtons/main.swift
f15935108a4d661629a9c530faad8a43da8d7b3f
[ "BSD-2-Clause" ]
permissive
mag911/SwiftHelloGtkRadioButtons
9cce590541307e507eea3c8094f544516d9820a9
e39055c8ef961ac832a5e1ca3a50d74725289f7c
refs/heads/master
2022-06-02T04:53:10.250659
2020-04-29T02:24:14
2020-04-29T02:24:14
259,794,231
0
0
null
2020-04-29T01:31:35
2020-04-29T01:31:35
null
UTF-8
Swift
false
false
1,090
swift
import CGLib import GLib import Gtk let status = Application.run { app in let window = ApplicationWindowRef(application: app) window.title = "Hello, Radio Buttons" window.setDefaultSize(width: 160, height: 80) let hbox = Box(orientation: .horizontal, spacing: 10) let lbox = Box(orientation: .vertical, spacing: 0) let rbox = Box(orientation: .vertical, spacing: 0) window.add(widget: hbox) hbox.add(widget: lbox) hbox.add(widget: rbox) // // create left hand side buttons manually, gtk-style // let button1 = RadioButton(label: "Left 1") let button2 = RadioButton(group: button1.group, label: "Left 2") lbox.add(widget: button1) lbox.add(widget: button2) // // create right button group using convenience constructor // let buttons = RadioButton.groupLabeled("Right 1", "Right 2") rbox.add(widgets: buttons) window.showAll() } guard let status = status else { fatalError("Could not create Application") } guard status == 0 else { fatalError("Application exited with status \(status)") }
[ -1 ]
dfb1e7d462b42ec71cf287f2fb1f5f3cc18d18b9
05fc81432f3b7d7a1474be4c5e58d2a88a23d7d4
/TableViewOptimizationTest/TableViewOptimization/TableViewController.swift
c7cc09b2bf74a2b8141e99251e7b5e5ad346ccc6
[]
no_license
bonyadmitr/XcodeProjects
ce2b30e0e705f53cb6de87d75d71b9303ca4e4a2
9825f2f24869ae2c967c171f8d1121de4229c586
refs/heads/master
2023-08-09T08:30:16.243387
2023-07-21T23:00:27
2023-07-21T23:00:27
127,461,427
45
6
null
2023-04-12T05:21:59
2018-03-30T18:41:35
Swift
UTF-8
Swift
false
false
1,624
swift
// // TableViewController.swift // TableViewOptimization // // Created by Bondar Yaroslav on 29.11.16. // Copyright © 2016 Bondar Yaroslav. All rights reserved. // import UIKit class TableViewController: UITableViewController { override func viewDidLoad() { super.viewDidLoad() } // MARK: - Table view data source override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 10000 } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! TableViewCell // if indexPath.row % 2 == 0 { // cell.someImage.image = #imageLiteral(resourceName: "Ferrari") // } else { // cell.someImage.image = #imageLiteral(resourceName: "iTunesArtwork") // } // image cell.someImage.layer.shadowOffset = CGSize(width: 0, height: 5) cell.someImage.layer.shadowOpacity = 0.8 cell.someImage.layer.shadowPath = UIBezierPath(rect: cell.someImage.bounds).cgPath // cell.someImage.layer.shouldRasterize = true // cell.someImage.layer.rasterizationScale = UIScreen.main.scale cell.label.text = "Row \(indexPath.row + 1)" return cell } // override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { // let cell = cell as! TableViewCell // // // // } }
[ -1 ]
2ce1967455e047c36b8cf7292aca3efc6371ff33
6b7de2c2778b2b7dc562f4a0156fdfd30ec1debf
/Tableau/TabularDataHeaderCell.swift
2bba46ec4b857eaa318607abb563f4d68bddd7f2
[]
no_license
gumbright-sf/TabularData-iOS
fab93f0f774ac8d8a441e7dee937cf4d03c31687
dcea4598b4698a2e7a63dbe65897e286d79f1885
refs/heads/master
2021-01-17T05:10:12.743012
2016-08-29T18:33:42
2016-08-29T18:33:42
null
0
0
null
null
null
null
UTF-8
Swift
false
false
3,996
swift
// // TabularDataHeaderCell.swift // TableSandbox // // Created by Jason Barker on 8/24/16. // Copyright © 2016 Jason Barker. All rights reserved. // import UIKit enum SortOrder { case Ascending case Descending } class TabularDataHeaderCell: UIView { struct defaults { static var leftInset: CGFloat = 8 static var rightInset: CGFloat = -8 } @IBOutlet weak var label: UILabel! @IBOutlet weak var leftSortIcon: UIImageView! @IBOutlet weak var rightSortIcon: UIImageView! @IBOutlet weak var contentView: UIStackView! var contentAlignment: TabularDataContentAlignment = .Left { didSet { configureUI() } } var sortable: Bool = false { didSet { configureUI() } } var selected: Bool = false { didSet { configureUI() } } var sortOrder: SortOrder = .Ascending { didSet { configureUI() } } private var temporaryConstraints = [NSLayoutConstraint]() required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } override func awakeFromNib() { super.awakeFromNib() configureUI() } func toggleSortOrder() { switch sortOrder { case .Ascending: sortOrder = .Descending case .Descending: sortOrder = .Ascending } } func configureUI() { var font = normalFont() var hideLeftIcon = true var hideRightIcon = true if sortable && selected { font = boldFont() configureSortIconImage() switch contentAlignment { case .Left: hideRightIcon = false case .Center: hideRightIcon = false case .Right: hideLeftIcon = false } } removeConstraints(temporaryConstraints) temporaryConstraints.removeAll() if contentAlignment == .Left { temporaryConstraints.append(NSLayoutConstraint(item: contentView, attribute: .Left, relatedBy: .Equal, toItem: self, attribute: .Left, multiplier: 1, constant: defaults.leftInset)) // temporaryConstraints.append(NSLayoutConstraint(item: contentView, attribute: .Right, relatedBy: .GreaterThanOrEqual, toItem: self, attribute: .Right, multiplier: 1, constant: defaults.rightInset)) } else if contentAlignment == .Center { temporaryConstraints.append(NSLayoutConstraint(item: contentView, attribute: .CenterX, relatedBy: .Equal, toItem: self, attribute: .CenterX, multiplier: 1, constant: 0)) } else if contentAlignment == .Right { // temporaryConstraints.append(NSLayoutConstraint(item: contentView, attribute: .Left, relatedBy: .GreaterThanOrEqual, toItem: self, attribute: .Left, multiplier: 1, constant: defaults.leftInset)) temporaryConstraints.append(NSLayoutConstraint(item: contentView, attribute: .Right, relatedBy: .Equal, toItem: self, attribute: .Right, multiplier: 1, constant: defaults.rightInset)) } addConstraints(temporaryConstraints) label.font = font leftSortIcon.hidden = hideLeftIcon rightSortIcon.hidden = hideRightIcon } func configureSortIconImage() { let image = getImageForSortOrder(sortOrder) leftSortIcon.image = image rightSortIcon.image = image } private func getImageForSortOrder(sortOrder: SortOrder) -> UIImage? { var imageName: String? switch sortOrder { case .Ascending: imageName = "arrow_small_white_up" case .Descending: imageName = "arrow_small_white_down" } return UIImage(named: imageName!) } func boldFont() -> UIFont { return UIFont.boldSystemFontOfSize(label.font.pointSize) } func normalFont() -> UIFont { return UIFont.systemFontOfSize(label.font.pointSize) } }
[ -1 ]
a608d043b3adc43cc9dae374328edab5e044f6dd
82066ef1141413e9b4a9b1259d5083c12ee06824
/Example/FaviconManExample/FaviconManExample/ScanIconsViewController.swift
eeee4958dc02e3611abfa74b82a479c00a223a4a
[ "MIT" ]
permissive
dirtmelon/FaviconMan
31e62960389b22f03ec8bf971e307b5def47b4a0
f50ccc977c0cdc42ebaa9e91488c0002ce3967fe
refs/heads/master
2022-09-09T13:37:38.241786
2020-05-24T14:00:21
2020-05-24T14:00:21
260,174,446
1
0
null
null
null
null
UTF-8
Swift
false
false
2,539
swift
// // ViewController.swift // FaviconManExample // // Copyright (c) 2020-2020 FavcionMan // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // import UIKit import FaviconMan import SafariServices class ScanIconsViewController: BaseViewController { private var icons: [Icon] = [] override func textFieldShouldReturn(_ textField: UITextField) -> Bool { FaviconMan.fman.request(textField.text!, preferredIconType: .appleTouchIconPrecomposed)? .responseURLs(completionHandler: { [weak self] (result) in guard let self = self else { return } switch result { case .success(let icons): self.icons = icons self.tableView.reloadData() case .failure(let error): print(error) } }) return true } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return icons.count } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: cellReuseIdentifier, for: indexPath) cell.textLabel?.text = icons[indexPath.row].url.absoluteString return cell } override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { defer { tableView.deselectRow(at: indexPath, animated: true) } let viewController = SFSafariViewController(url: icons[indexPath.row].url) present(viewController, animated: true) } }
[ 141685 ]
5fee233251b397f9908bb1b5ff91fa7a406ef646
4fed7d91ee0a9e99dd239cafe6aea429fda1f285
/Baekjoon/1260.swift
ffa2966acf26af256f99b554fdb74cbeb357dae4
[]
no_license
TheSongOfSongs/Algorithm
33b6da0d98fb0e3de82158115840f26ae04bd86e
b7ba601e69296296016b5047102b076b291908ec
refs/heads/master
2023-02-07T10:35:32.241719
2023-01-30T04:52:58
2023-01-30T04:52:58
247,258,995
0
0
null
null
null
null
UTF-8
Swift
false
false
1,325
swift
import Foundation var dfsResult: String = "" var bfsResult: String = "" let input = readLine()!.split(separator: " ").map({Int($0)!}) let node = input[0] let line = input[1] let start = input[2] var array: [[Bool]] = Array(repeating: Array(repeating: false, count: node+1), count: node+1) var visited: [Bool] = Array(repeating: false, count: node+1) for _ in 0..<line { let input = readLine()!.split(separator: " ").map({Int($0)!}) array[input[0]][input[1]] = true array[input[1]][input[0]] = true } visited[start] = true func dfs(start: Int) { dfsResult.append("\(start) ") for i in 1...node { if array[start][i] && !visited[i] { visited[i] = true dfs(start: i) } } } func bfs(start: Int) { var visited = Array(repeating: false, count: node+1) var start: Int = start var queue: [Int] = [start] visited[start] = true while !queue.isEmpty { start = queue.first! queue.removeFirst() bfsResult.append("\(start) ") for i in 1...node { if array[start][i] && !visited[i] { visited[i] = true queue.append(i) } } } } dfs(start: start) bfs(start: start) dfsResult.removeLast() bfsResult.removeLast() print(dfsResult) print(bfsResult)
[ -1 ]
0034f99d7074fe2c410040007d55dd4458b999a0
7bb45c15843dbd6eb2cf0201f5ed005efc6b025b
/MyFinalProject/AppDelegate.swift
79bc5093280e2e1df0c1e617b5d1924ebb34f050
[]
no_license
MirellaLDS/IOSAvancado_ToDoList
dd5b778341ff913147629ab6c75b31a4c70414ae
f523ced9bd9a417395df5d7cf7d0061362c19298
refs/heads/master
2020-04-22T12:37:16.165614
2019-02-15T12:24:54
2019-02-15T12:24:54
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,528
swift
// // AppDelegate.swift // MyFinalProject // // Created by Halyson Ribeiro Pessoa on 10/01/2019. // Copyright © 2019 Halyson Ribeiro Pessoa. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } /// set orientations you want to be allowed in this property by default var orientationLock = UIInterfaceOrientationMask.all func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { return self.orientationLock } 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:. } }
[ 278539, 294924, 294950, 229415, 229417, 327722, 237613, 229422, 229426, 229428, 311349, 229432, 286776, 319544, 286791, 237640, 311375, 163920, 196692, 319573, 311383, 319590, 311400, 131192, 237693, 327814, 303241, 303244, 319633, 286873, 286876, 311460, 311469, 32944, 327862, 286906, 327866, 180413, 286910, 286916, 295110, 286922, 286924, 286926, 319694, 131281, 295133, 319716, 237807, 303345, 286962, 131314, 229622, 327930, 237826, 319751, 286987, 319757, 286999, 287003, 287006, 287009, 287012, 287014, 287016, 287019, 311598, 287023, 311601, 295220, 319809, 319810, 319814, 311623, 319818, 311628, 287054, 319822, 229717, 196963, 196969, 139638, 213367, 106872, 319872, 319879, 139689, 311728, 311741, 319938, 319945, 188895, 287202, 172520, 319978, 172526, 311791, 172529, 319989, 311804, 287230, 303617, 172550, 320007, 172552, 303623, 172558, 303637, 172572, 172577, 295459, 172581, 295461, 172591, 172607, 172612, 172614, 172618, 303690, 33357, 172634, 172644, 311911, 172656, 352880, 295538, 172660, 287349, 287355, 295553, 311942, 352905, 311946, 279178, 311951, 287377, 172691, 311957, 287381, 287386, 221850, 230045, 172702, 303773, 172705, 287394, 172707, 287398, 205479, 172714, 295595, 189102, 172721, 66227, 303797, 189114, 287419, 328381, 287423, 328384, 172748, 295633, 172755, 303827, 287450, 303835, 189149, 303838, 295654, 230128, 312048, 312050, 205564, 303871, 230146, 230154, 312077, 295695, 295701, 230169, 295707, 328476, 295710, 230175, 303914, 279340, 230202, 312124, 328508, 222018, 295755, 377676, 148302, 287569, 303959, 230237, 230241, 303976, 336744, 303985, 303987, 303991, 303997, 295806, 295808, 295813, 304005, 304007, 320391, 304009, 304011, 304013, 295822, 189329, 304019, 58262, 304023, 279452, 304042, 213931, 304055, 230327, 287675, 230334, 304063, 238528, 213954, 156612, 312272, 304090, 320481, 304106, 320490, 312302, 328687, 320496, 304114, 295928, 320505, 295945, 230413, 320528, 140312, 295961, 238620, 304164, 304170, 304175, 238641, 238652, 238655, 238658, 336964, 205895, 320584, 238666, 296021, 230497, 296036, 296040, 312432, 337018, 189562, 304258, 205968, 296084, 238745, 304285, 238756, 222377, 337067, 238766, 230576, 304311, 230592, 312518, 230600, 230607, 148690, 320727, 304354, 296163, 320740, 304360, 320748, 304370, 296189, 320771, 312585, 296205, 230674, 320786, 296213, 230677, 296215, 320792, 230681, 230689, 173350, 312622, 312630, 222525, 296253, 296255, 312639, 296259, 296262, 230727, 238919, 320840, 296264, 296271, 230739, 312663, 222556, 312676, 230760, 148843, 230763, 230768, 296305, 312692, 230773, 304505, 304506, 181631, 148865, 312711, 296331, 288140, 288144, 288154, 288164, 288176, 173488, 312755, 312759, 222652, 312766, 173507, 230860, 312783, 288208, 230865, 148946, 222676, 329177, 239070, 320998, 296435, 296446, 296450, 230916, 230919, 230923, 304651, 304653, 230940, 296488, 157229, 239152, 230961, 157236, 288320, 288325, 124489, 288338, 288344, 239194, 239202, 312938, 116354, 288408, 321195, 296622, 321200, 337585, 296634, 296637, 206536, 321239, 313052, 288478, 313055, 321252, 313066, 288494, 288499, 288510, 198416, 296723, 321304, 321311, 313121, 313123, 304932, 321316, 321336, 288576, 345921, 337732, 173907, 321381, 296809, 313201, 305028, 124817, 124827, 214944, 321458, 296883, 124853, 296890, 288700, 296894, 190403, 296900, 337862, 165831, 280521, 124913, 165876, 321528, 313340, 239612, 313347, 313358, 305176, 313371, 305191, 223273, 313386, 124978, 215090, 124980, 288824, 288826, 321595, 313406, 288831, 288836, 215123, 280669, 149599, 149601, 321634, 149603, 215154, 313458, 321659, 288895, 321670, 215175, 141455, 313498, 288947, 321717, 321740, 338147, 125171, 280825, 125187, 125191, 125207, 125209, 125218, 321842, 223539, 125239, 289087, 305480, 239944, 239947, 305485, 305489, 354653, 313700, 190832, 223606, 313720, 280956, 313731, 199051, 240011, 289166, 240017, 297363, 297365, 297368, 297372, 297377, 289186, 297391, 289201, 240052, 289207, 289210, 305594, 289218, 166378, 305647, 174580, 240124, 305662, 305664, 305666, 240132, 223749, 305668, 330244, 223752, 150025, 223757, 322074, 150066, 158266, 289342, 322115, 199273, 19053, 158317, 313973, 297594, 158347, 182926, 314003, 117398, 289436, 174754, 330404, 289448, 314033, 240309, 314047, 297671, 158409, 289493, 289513, 289522, 289532, 322303, 289537, 322310, 322314, 322318, 322341, 215850, 281413, 240458, 240468, 322393, 281438, 224110, 207733, 207737, 183172, 338823, 322440, 314249, 183184, 142226, 240535, 289687, 289694, 289696, 289700, 289724, 289762, 322550, 322563, 314372, 330764, 175134, 322610, 314421, 281654, 314427, 314433, 314456, 314461, 314474, 306341, 306347, 306354, 199877, 289991, 306377, 289997, 363742, 298216, 330988, 216303, 322801, 388350, 257302, 199976, 199978, 314671, 298294, 216376, 298306, 380226, 224587, 314714, 314718, 314723, 150890, 306539, 314732, 314736, 290161, 306549, 298358, 314743, 306552, 290171, 306555, 314747, 290174, 224641, 298372, 314756, 298377, 314763, 314768, 224657, 306581, 314773, 314779, 314785, 314793, 241068, 241070, 241072, 150966, 298424, 306618, 323015, 306640, 290263, 290270, 290275, 339431, 191985, 191992, 290298, 290302, 290305, 257550, 290325, 241175, 290328, 290332, 290344, 290349, 290356, 306778, 314979, 298598, 323176, 224875, 241260, 323181, 315016, 282249, 290445, 175770, 298651, 282269, 323229, 298655, 192163, 323260, 323266, 241362, 306904, 52959, 241380, 323304, 323318, 306945, 241412, 323345, 323349, 315167, 315169, 315174, 323367, 241448, 306991, 315184, 323376, 315190, 241464, 159545, 307009, 307012, 315211, 307027, 315221, 315223, 241496, 241498, 307035, 307040, 110433, 241509, 110438, 298860, 110445, 315253, 315255, 339838, 315267, 315269, 241544, 241546, 241548, 298896, 298898, 241556, 298901, 241560, 241563, 241565, 241567, 241569, 241574, 298922, 241581, 241583, 323504, 241586, 290739, 241588, 241590, 241592, 241598, 290751, 241600, 241605, 151495, 241610, 298975, 241632, 298984, 241643, 298988, 241646, 241649, 241652, 323574, 290807, 241661, 299006, 315396, 241669, 315397, 282645, 241693, 102438, 290877, 315463, 315466, 315482, 217179, 315483, 192605, 233567, 200801, 299105, 217188, 299109, 307303, 315495, 356457, 307307, 45163, 315502, 192624, 307314, 299126, 307329, 307338, 233613, 307352, 299164, 299167, 184486, 307370, 307372, 307374, 307376, 299185, 323763, 184503, 307385, 258235, 307388, 307390, 299200, 307394, 299204, 307396, 184518, 307399, 323784, 307409, 307411, 299225, 233701, 307432, 291104, 315701, 307510, 332086, 307515, 307518, 323917, 233808, 323921, 315733, 323926, 233815, 315739, 299357, 242018, 242024, 299373, 315757, 250231, 242043, 315771, 299391, 291202, 242057, 291212, 299405, 291222, 315801, 242075, 291231, 61855, 291238, 291241, 127403, 127405, 127407, 291247, 299444, 127413, 291254, 127417, 291260, 127421, 127424, 299457, 127429, 315856, 315860, 127447, 299481, 176605, 242143, 127457, 291299, 340454, 127463, 242152, 291305, 127466, 176620, 127469, 127474, 291314, 291317, 135672, 233979, 291323, 291330, 127494, 283142, 127497, 135689, 233994, 233998, 127506, 234003, 234006, 127511, 152087, 242202, 135707, 234010, 135710, 242206, 242208, 291361, 242220, 152118, 234038, 234041, 315961, 70213, 111193, 242275, 299620, 242279, 135805, 135808, 316054, 135834, 135839, 135844, 299684, 242343, 242345, 135870, 135873, 135876, 135879, 299720, 299723, 299726, 201444, 299750, 234219, 316151, 242431, 299778, 234246, 291601, 234258, 242452, 201496, 234264, 234266, 234272, 152355, 299814, 185138, 234296, 160572, 316233, 316235, 234319, 201557, 308063, 234336, 242530, 349027, 234344, 324464, 152435, 177011, 234356, 291711, 291714, 201603, 291716, 234373, 308105, 324490, 324504, 209818, 308123, 234396, 324508, 291742, 291747, 291748, 234405, 291750, 324518, 324522, 291754, 291756, 324527, 291760, 201650, 324531, 324536, 291773, 242623, 324544, 324546, 234434, 324548, 234464, 168935, 324585, 316400, 234481, 316403, 234485, 234487, 316416, 300054, 316439, 234520, 234526, 300066, 234540, 234546, 300085, 234553, 316479, 234561, 308291, 316483, 316491, 234572, 234574, 234593, 234597, 300133, 300139, 234605, 160879, 234610, 316530, 300148, 144506, 234620, 177293, 234640, 308373, 324757, 234647, 234648, 234650, 308379, 300189, 324766, 119967, 324768, 242852, 300197, 234667, 316596, 234687, 300226, 234692, 300229, 308420, 308422, 300234, 300238, 300241, 316625, 300243, 300245, 316630, 300248, 300253, 300256, 300258, 300260, 300263, 300265, 300267, 300270, 300272, 300278, 275703, 316663, 300284, 275710, 300287, 292097, 300289, 161027, 300292, 275719, 177419, 242957, 275725, 349464, 292143, 300344, 243003, 300357, 316758, 357722, 316766, 292192, 316768, 292197, 316774, 136562, 316806, 316811, 316814, 300433, 234899, 357783, 316824, 316826, 300448, 144810, 144814, 144820, 292279, 144826, 144830, 144832, 144835, 144837, 144839, 144841, 144844, 144847, 144852, 144855, 103899, 300507, 333280, 218597, 292329, 300523, 300527, 308720, 292338, 316917, 292343, 300537, 308762, 284191, 284194, 284196, 235045, 284199, 284204, 284206, 284209, 284211, 284213, 284215, 194103, 284218, 292414, 284226, 243268, 292421, 284231, 284234, 317004, 284238, 284241, 292433, 284243, 194130, 284245, 300628, 284247, 317015, 284249, 300638, 284255, 292452, 292454, 292458, 292461, 284272, 284274, 284278, 292470, 292473, 284283, 284286, 292479, 284288, 292481, 284290, 325250, 284292, 292485, 284297, 317066, 284299, 317068, 284301, 284303, 284306, 284308, 284312, 284314, 284316, 284320, 284322, 284327, 284329, 317098, 284331, 284333, 284335, 284337, 284339, 300726, 284343, 284350, 358080, 276160, 284354, 358083, 284358, 276166, 358089, 284362, 284370, 317138, 284372, 358098, 284381, 358114, 358116, 358119, 325353, 358122, 358126, 358128, 358133, 358135, 358138, 300795, 358140, 358142, 358146, 317189, 317191, 300816, 300819, 317207, 300830, 300832, 325408, 317221, 358183, 243504, 366406, 153417, 292681, 317271, 292700, 292715, 292721, 300915, 292729, 317306, 292734, 325512, 358292, 350106, 358312, 317353, 358326, 358330, 301011, 301013, 292823, 301015, 301017, 358360, 292828, 153568, 292843, 292845, 325624, 317435, 317456, 317458, 178195, 243733, 243740, 317468, 325666, 243751, 292904, 243762, 309298, 325685, 325689, 325692, 235581, 243779, 243785, 350293, 350295, 309337, 350302, 178273, 309346, 194660, 309348, 309350, 350308, 292968, 350313, 309354, 301163, 350316, 309352, 350321, 350325, 350328, 292985, 350332, 292989, 292993, 301185, 350339, 317570, 350342, 350345, 350349, 317584, 325777, 350354, 194708, 350357, 350359, 350362, 350366, 350375, 350379, 350381, 350383, 350385, 350387, 350389, 350395, 350397, 350399, 350402, 301252, 350406, 301258, 301272, 194780, 309468, 301283, 317672, 317674, 325867, 243960, 325910, 342298, 211241, 325937, 325943, 211260, 235853, 235858, 276829, 391523, 293227, 293232, 186744, 211324, 317833, 317853, 342434, 317858, 317864, 235955, 293304, 293307, 293314, 309707, 293325, 317910, 293336, 235996, 317917, 293343, 293346, 293352, 293364, 293370, 317951, 309764, 301575, 342541, 113167, 309779, 317971, 293417, 227882, 293421, 236082, 301636, 318020, 301639, 301643, 309844, 309849, 326244, 121458, 309885, 309888, 301706, 318092, 326285, 334476, 318094, 334488, 318108, 318110, 383658, 318128, 293555, 318144, 137946, 113378, 342760, 56043, 56059, 310015, 285448, 310029, 326430, 293666, 318248, 293677, 318253, 293685, 301880, 301884, 293696, 162643, 310100, 301911, 301921, 236397, 162671, 310134, 236408, 416639, 416640, 113538, 310147, 416648, 301972, 424853, 310179, 293798, 293802, 236460, 293820, 293849, 293861, 228327, 318442, 326638, 318450, 293876, 285686, 302073, 121850, 293882, 302075, 293899, 302105, 293917, 293939, 318516, 310336, 293956, 293960, 203857, 310355, 293971, 310359, 236632, 277601, 310374, 318573, 367737, 302205, 392326, 285831, 162964, 384148, 187542, 285852, 302237, 285854, 285856, 302241, 64682, 294063, 302258, 318651, 318657, 244930, 130244, 302282, 310476, 302285, 302288, 310481, 302290, 302292, 302294, 310498, 302315, 294132, 138485, 204026, 64768, 310531, 138505, 318742, 285999, 318773, 318776, 417086, 286016, 302403, 294211, 294221, 326991, 294223, 294246, 327015, 310632, 327017, 351594, 351607, 310651, 310657, 310659, 351619, 253320, 310665, 318858, 310672, 351633, 310689, 130468, 310703, 310710, 310712, 302526, 228799, 302534, 245191, 310727, 302543, 310749, 310755, 310764, 310772, 40440, 40443, 286203, 40448, 286214, 302603, 302614, 302617, 302621, 146977, 187939, 40484, 294435, 286246, 294439, 294440, 40488, 40486, 40491, 294443, 294445, 196133, 245288, 40499, 40502, 212538, 40507, 40511, 327240, 40521, 40525, 40527, 212560, 40533, 40537, 40539, 40541, 40550, 40552, 40554, 310892, 40557, 294521, 343679, 294537, 327333, 229030, 319153, 302781, 302789, 294599, 294601, 212690, 278227, 286425, 319194, 294625, 294634, 302838, 319226, 286460, 302852, 302854, 294664, 311048, 319243, 302862, 319251, 294682, 294701, 319290, 229192, 188252, 237409, 229233, 294776, 327554, 319390, 40865, 319394, 311209, 319419, 294844, 294847, 393177, 294876, 294879, 237555, 311283, 237562 ]
821fb053a8cada43cc82f1787e470385316ad24e
263039c946c323f2863bb93ae75f6ded294c96b7
/MemeMe/NotificationsExtension.swift
2b55a3664f681f9c81bce9822d0b9f86bb39fc77
[]
no_license
vsanjay/MemeMe_iOSApp_Version2.0
1b741f65772f903d5b4dea3859d48e17eace42ab
159d9843054f3b9de2ebd313f5d80fb94ec13e21
refs/heads/master
2021-01-20T08:56:43.065016
2017-08-27T19:23:04
2017-08-27T19:23:04
101,574,951
0
0
null
null
null
null
UTF-8
Swift
false
false
417
swift
import Foundation extension MemeEditorViewController { func subscribeForNotifications(){ NotificationCenter.default.addObserver(self, selector: #selector(keyboardPoppedUp), name: Notification.Name.UIKeyboardWillShow, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(keyboardPoppedDown), name: Notification.Name.UIKeyboardWillHide, object: nil) } }
[ -1 ]
1b1a9aecc4bdda80a59065dc5744b144fb50f78b
0ea9255478df5471798f3958109f078332d4e13c
/Classes/Classes/main.swift
94aec1a5ce1aa396d02f97e26fb60a0e053ace13
[]
no_license
vmmelo/some-swift-scripts
3a4906101c6e108d05f61ac50bef17878c34ea0a
0e0ec2467ecc144c3a5acebd25c4e316ebb7f0e6
refs/heads/master
2020-03-10T15:20:46.692350
2018-04-23T21:43:21
2018-04-23T21:43:21
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,474
swift
// // main.swift // Classes // // Created by Victor Miranda de Melo on 20/04/18. // Copyright © 2018 Victor Miranda de Melo. All rights reserved. // import Cocoa class Vehicle { var currentSpeed = 0.0 var description: String { return "traveling at \(currentSpeed) miles per hour" } func makeNoise() { // do nothing - an arbitrary vehicle doesn't necessarily make a noise } } class Train: Vehicle { override func makeNoise() { print("Choo Choo") } } class Bicycle: Vehicle { var hasBasket = false } class FormaGeometrica { var x: Double var y: Double init(x:Double, y:Double) { self.x = x self.y = y } func mover(_ newX : Double, _ newY : Double) { self.x = newX self.y = newY } func igualForma(a outro: FormaGeometrica) -> Bool { return self.x == outro.x && self.y == outro.y } } class Retangulo : FormaGeometrica { var altura: Double var largura: Double func area() -> Double { return altura * largura } func igual(a outro:Retangulo) -> Bool { print(self.x) print(outro.x) return self.altura == outro.altura && self.largura == outro.largura && self.x == outro.x && self.y == outro.y } init(x: Double, y: Double, largura: Double, altura: Double) { self.largura = largura self.altura = altura super.init(x: x, y: y) } } let ret = Retangulo(x: 4.0, y: 3.0, largura: 20.0, altura: 20.0) let ret2 = Retangulo(x: 4.0, y: 3.0, largura: 20.0, altura: 20.0) //let ret2 = ret ret.x = 2 //print(ret.igual(a: ret2)) class Circulo : FormaGeometrica { var raio:Double func area() -> Double { return raio*raio*Double.pi } func igual(a outro:Circulo) -> Bool { return self.raio == outro.raio && self.x == outro.x && self.y == outro.y } init(x: Double, y: Double, raio: Double) { self.raio = raio super.init(x:x, y:y) } } let circ = Circulo(x: 6.0, y: 8.0, raio: 2.0) let circ2 = Circulo(x: 3.0, y: 4.0, raio: 2.0) print(circ2.x) print(circ.x) class Forma3D: FormaGeometrica { var z: Double init(x: Double, y: Double, z: Double) { self.z = z super.init(x: x, y: y) } func volume() -> Double { return self.x * self.y * self.z } } //class Esfera: Forma3D { // //}
[ -1 ]
f149769b581cbde465b0e704be4b095f86611eab
b2de3e54507a182989920105cbe4d08b64e19f86
/NetworkUtilityTools/StreamPlayerViewController.swift
f96a7606ea008d004075b430b08928be3a6b2924
[]
no_license
pengyanb/NetworkUtilityTools
47da2b8ec2f983f3a6fbad5306c6625b133faa71
40275c85dcd8e7d5504bc77768e70efefd4625c8
refs/heads/master
2021-01-10T05:27:58.005098
2016-04-02T09:04:46
2016-04-02T09:04:46
54,942,628
3
0
null
null
null
null
UTF-8
Swift
false
false
4,236
swift
// // StreamPlayerViewController.swift // NetworkUtilityTools // // Created by Yanbing Peng on 23/02/16. // Copyright © 2016 Yanbing Peng. All rights reserved. // import UIKit class StreamPlayerViewController: UIViewController, UITextFieldDelegate, GCDAsyncSocketDelegate{ //MARK: -Variables var ipAddress:String! var portNum:String! var needToResolveUrl:Bool = false var mediaPlayer : VLCMediaPlayer? private var tcpSocket:GCDAsyncSocket? //MARK: -Outlets @IBOutlet weak var playButton: UIButton! @IBOutlet weak var stopButton: UIButton! @IBOutlet weak var logTextView: UITextView! @IBOutlet weak var mediaView: UIView! @IBOutlet weak var streamUrlTextField: UITextField! @IBOutlet weak var logTextViewHeightLayoutConstraint: NSLayoutConstraint! //MARK: -Action Methods @IBAction func playButtonPressed() { if let player = mediaPlayer{ if player.isPlaying(){ player.pause() playButton.setTitle("||", forState: UIControlState.Normal) } else { playMedia(player) } } } @IBAction func stopButtonPressed() { mediaPlayer?.stop() } //MARK: -View Life Cycle override func viewDidLoad() { super.viewDidLoad() mediaPlayer = VLCMediaPlayer.init() mediaPlayer?.drawable = mediaView streamUrlTextField.text = "rtsp://\(ipAddress):\(portNum)" // Do any additional setup after loading the view. streamUrlTextField.delegate = self } override func viewWillAppear(animated: Bool) { super.viewWillAppear(animated) if needToResolveUrl{ logTextViewHeightLayoutConstraint.constant = 50 tryResolveUrl() } else{ logTextViewHeightLayoutConstraint.constant = 0 } } //MARK: -Delegate methods [Socket] @objc func socket(sock: GCDAsyncSocket!, didConnectToHost host: String!, port: UInt16) { let dataString = "DESCRIBE rtsp://\(host) RTSP/1.0\r\nCSeq: 2\r\n\r\n" if let dataToSend = dataString.dataUsingEncoding(CONSTANTS.ENCODING_ASCII.getAssociatedUInt()){ sock.writeData(dataToSend, withTimeout: 5, tag: 0) sock.readDataWithTimeout(5, tag: 0) print("[Sent: \(dataString)]") } else { sock.disconnect() } } @objc func socket(sock: GCDAsyncSocket!, didReadData data: NSData!, withTag tag: Int) { if let rtspResponse = String.init(data: data, encoding: CONSTANTS.ENCODING_ASCII.getAssociatedUInt()) { logTextView.text = rtspResponse } } //MARK: -keyboard Related func textFieldShouldEndEditing(textField: UITextField) -> Bool { return true } func textFieldShouldReturn(textField: UITextField) -> Bool { self.view.endEditing(true) return false } //MARK: -private func private func tryResolveUrl()->Bool{ print("[TryResolveUrl]") tcpSocket = GCDAsyncSocket.init(delegate: self, delegateQueue: dispatch_get_main_queue()) do{ try tcpSocket?.connectToHost(ipAddress, onPort: UInt16.init(portNum)!, withTimeout: 5) return true } catch{ return false } } private func playMedia(player:VLCMediaPlayer){ if let url = getMediaURL(){ if let media = VLCMedia(URL: url){ player.setMedia(media) player.play() playButton.setTitle("▶︎", forState: UIControlState.Normal) } else { UIAlertView.init(title: "Error", message: "Invalid URL", delegate: nil, cancelButtonTitle: "OK").show() } } else { UIAlertView.init(title: "Error", message: "Invalid URL", delegate: nil, cancelButtonTitle: "OK").show() } } private func getMediaURL()->NSURL?{ return NSURL.init(string: streamUrlTextField.text!) } }
[ -1 ]
c9109e5ef3b00663edb04dc4ff40479926e6cbb6
cd47f2b5a0c05551a881cfd82199df3afbb501db
/ShowMessageTests/ShowMessageTests.swift
b13202d34fd2ffd25ed7d928eb95ead602dbc0e7
[]
no_license
moisesaq/ShowMessageiOS
8343164c50793fb4684061dae8fd495e414204e5
2331f6f7c0f6f847ef90db2ffda4f2e44e62645b
refs/heads/master
2021-05-05T12:42:51.698681
2018-01-20T18:40:12
2018-01-20T18:40:12
118,270,514
0
0
null
null
null
null
UTF-8
Swift
false
false
976
swift
// // ShowMessageTests.swift // ShowMessageTests // // Created by Moises on 11/25/17. // Copyright © 2017 Moises. All rights reserved. // import XCTest @testable import ShowMessage class ShowMessageTests: XCTestCase { override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } func testExample() { // This is an example of a functional test case. // Use XCTAssert and related functions to verify your tests produce the correct results. } func testPerformanceExample() { // This is an example of a performance test case. self.measure { // Put the code you want to measure the time of here. } } }
[ 360462, 98333, 278558, 16419, 229413, 204840, 278570, 344107, 155694, 253999, 229424, 229430, 319542, 180280, 163896, 352315, 213052, 376894, 286788, 352326, 311372, 196691, 278615, 385116, 237663, 254048, 319591, 221290, 278634, 278638, 319598, 352368, 204916, 131191, 237689, 131198, 278655, 311438, 278677, 196760, 426138, 278685, 311458, 278691, 49316, 278699, 32941, 278704, 377009, 278708, 131256, 295098, 139479, 254170, 229597, 311519, 205035, 286958, 327929, 344313, 147717, 368905, 278797, 180493, 254226, 368916, 262421, 377114, 278816, 237857, 237856, 311597, 98610, 180535, 336183, 278842, 287041, 287043, 139589, 319821, 254286, 344401, 377169, 368981, 155990, 368984, 106847, 98657, 270701, 246127, 270706, 139640, 246136, 106874, 246137, 311685, 106888, 385417, 385422, 213403, 385454, 377264, 278970, 311738, 33211, 319930, 336317, 336320, 311745, 278978, 254406, 188871, 278989, 278993, 278999, 328152, 369116, 287198, 279008, 279013, 311786, 279018, 319981, 279029, 254456, 279032, 377338, 377343, 279039, 254465, 287241, 279050, 139792, 303636, 393751, 254488, 279065, 377376, 180771, 377386, 197167, 385588, 352829, 115270, 377418, 385615, 426576, 369235, 295519, 139872, 66150, 344680, 279146, 295536, 287346, 139892, 344696, 287352, 279164, 189057, 311941, 336518, 369289, 311945, 344715, 279177, 311949, 287374, 377489, 311954, 352917, 230040, 377497, 271000, 303771, 221852, 377500, 205471, 344738, 139939, 279206, 295590, 287404, 295599, 205487, 303793, 336564, 164533, 287417, 303803, 287422, 66242, 377539, 287433, 164560, 385747, 279252, 361176, 418520, 287452, 295652, 279269, 369385, 230125, 312047, 279280, 312052, 172792, 344827, 221948, 205568, 295682, 197386, 434957, 426774, 197399, 426775, 336671, 344865, 197411, 262951, 279336, 295724, 353069, 312108, 197422, 353070, 164656, 262962, 295729, 328499, 353078, 230199, 353079, 197431, 336702, 295744, 295746, 353094, 353095, 353109, 377686, 230234, 189275, 435039, 295776, 279392, 303972, 385893, 246641, 246643, 295798, 246648, 361337, 279417, 254850, 369538, 287622, 295824, 189348, 353195, 140204, 353197, 377772, 304051, 230332, 189374, 377790, 353215, 353216, 213957, 213960, 345033, 279498, 386006, 418776, 50143, 123881, 320493, 320494, 304110, 271350, 295927, 312314, 304122, 328700, 320507, 328706, 410627, 320516, 295942, 386056, 230410, 353290, 377869, 320527, 238610, 418837, 140310, 230423, 197657, 336929, 189474, 369701, 345132, 238639, 312373, 238651, 377926, 238664, 353367, 156764, 156765, 304222, 230499, 279660, 173166, 312434, 377972, 353397, 279672, 377983, 279685, 402565, 222343, 386189, 296086, 238743, 296092, 238765, 279728, 238769, 402613, 279747, 353479, 353481, 353482, 402634, 189652, 189653, 419029, 148696, 296153, 279774, 304351, 304356, 222440, 328940, 279792, 353523, 386294, 386301, 320770, 386306, 279814, 328971, 312587, 353551, 320796, 222494, 304421, 279854, 353584, 345396, 386359, 116026, 378172, 222524, 279875, 304456, 230729, 312648, 337225, 222541, 296270, 238927, 353616, 296273, 222559, 378209, 230756, 386412, 230765, 296303, 279920, 312689, 296307, 116084, 181625, 337281, 148867, 378244, 296329, 296335, 9619, 370071, 279974, 279984, 173491, 304564, 353719, 361927, 296392, 280010, 370123, 148940, 280013, 312782, 222675, 353750, 280032, 271843, 280041, 361963, 296433, 321009, 280055, 288249, 296448, 230913, 230921, 329225, 296461, 304656, 329232, 370197, 402985, 394794, 230959, 288309, 312889, 288318, 280130, 124485, 288326, 288327, 239198, 99938, 312940, 222832, 247416, 337534, 337535, 263809, 288392, 239250, 419478, 345752, 255649, 337591, 321207, 296632, 280251, 280257, 321219, 280267, 403148, 9936, 9937, 370388, 272085, 345814, 280278, 280280, 18138, 67292, 345821, 321247, 321249, 345833, 345834, 288491, 280300, 239341, 67315, 173814, 313081, 124669, 288512, 67332, 288516, 280329, 321295, 321302, 345879, 116505, 321310, 313120, 255776, 247590, 362283, 378668, 280366, 296755, 280372, 321337, 280380, 345919, 436031, 403267, 280390, 345929, 255829, 18262, 362327, 280410, 370522, 345951, 362337, 345955, 296806, 288619, 288620, 280430, 214895, 313199, 362352, 313203, 124798, 182144, 305026, 67463, 329622, 337815, 124824, 214937, 239514, 436131, 354212, 436137, 362417, 124852, 288697, 362431, 214977, 280514, 214984, 362443, 247757, 231375, 346067, 280541, 329695, 436191, 313319, 337895, 247785, 296941, 436205, 329712, 362480, 313339, 43014, 354316, 313357, 182296, 223268, 354345, 223274, 124975, 346162, 124984, 288828, 436285, 288833, 288834, 436292, 403525, 436301, 338001, 354385, 338003, 223316, 280661, 329814, 338007, 354393, 280675, 280677, 43110, 321637, 313447, 436329, 288879, 223350, 280694, 215164, 313469, 215166, 280712, 215178, 346271, 436383, 362659, 239793, 125109, 182456, 280762, 223419, 379071, 149703, 338119, 346314, 321745, 387296, 280802, 379106, 338150, 346346, 321772, 125169, 338164, 436470, 125183, 149760, 411906, 125188, 313608, 125193, 125198, 272658, 125203, 125208, 305440, 125217, 338218, 321840, 379186, 125235, 280887, 125240, 321860, 280902, 182598, 289110, 305495, 215385, 272729, 379225, 321894, 280939, 313713, 354676, 199029, 436608, 362881, 240002, 436611, 248194, 395659, 395661, 240016, 108944, 190871, 149916, 420253, 141728, 289189, 108972, 272813, 338356, 436661, 281037, 289232, 281040, 256477, 281072, 174593, 420369, 289304, 207393, 182817, 289332, 174648, 338489, 338490, 322120, 281166, 297560, 354911, 436832, 436834, 191082, 313966, 420463, 281199, 346737, 313971, 346740, 420471, 330379, 330387, 117396, 117397, 346772, 330388, 264856, 314009, 289434, 346779, 338613, 289462, 166582, 314040, 158394, 363211, 363230, 289502, 264928, 338662, 330474, 346858, 289518, 125684, 199414, 35583, 363263, 322313, 322316, 117517, 322319, 166676, 207640, 289576, 191283, 273207, 289598, 420677, 355146, 355152, 355154, 281427, 281433, 355165, 355178, 330609, 207732, 158593, 240518, 224145, 355217, 256922, 289690, 420773, 289703, 363438, 347055, 289727, 273344, 330689, 363458, 379844, 19399, 338899, 330708, 248796, 248797, 207838, 347103, 314342, 289774, 183279, 347123, 314355, 240630, 314362, 257024, 330754, 134150, 330763, 281626, 248872, 322612, 314448, 339030, 314467, 281700, 257125, 322663, 281706, 207979, 273515, 404593, 363641, 363644, 150657, 248961, 330888, 363669, 339100, 380061, 339102, 199839, 429214, 330913, 265379, 249002, 306346, 3246, 421048, 339130, 265412, 290000, 298208, 298212, 298213, 290022, 330984, 298221, 298228, 216315, 208124, 388349, 363771, 437505, 322824, 257305, 126237, 339234, 109861, 372009, 412971, 298291, 306494, 216386, 224586, 372043, 331090, 314709, 314710, 372054, 159066, 314720, 281957, 314728, 306542, 380271, 314739, 208244, 314741, 249204, 290173, 306559, 306560, 314751, 298374, 388487, 314758, 142729, 314760, 314766, 306579, 224661, 282007, 290207, 314783, 314789, 282022, 314791, 396711, 396712, 282024, 241066, 380337, 380338, 150965, 380357, 339398, 306631, 306639, 413137, 429542, 191981, 282096, 290300, 290301, 282114, 372227, 306692, 323080, 323087, 175639, 388632, 396827, 282141, 134686, 282146, 306723, 347694, 290358, 265798, 282183, 265804, 396882, 290390, 306776, 44635, 396895, 323172, 282213, 323178, 224883, 314998, 323196, 175741, 339584, 224901, 282245, 282246, 290443, 323217, 282259, 298654, 282271, 282273, 282276, 298661, 323236, 290471, 282280, 224946, 306874, 110268, 224958, 282303, 274115, 306890, 241361, 282327, 298712, 298720, 12010, 282348, 282355, 323316, 282358, 175873, 339715, 323331, 323332, 216839, 339720, 282378, 372496, 323346, 282391, 249626, 282400, 339745, 241441, 257830, 421672, 282409, 282417, 200498, 282427, 282434, 307011, 315202, 282438, 216918, 241495, 282474, 241528, 339841, 282504, 315273, 315274, 110480, 372626, 380821, 282518, 282519, 298909, 118685, 298920, 323507, 290745, 290746, 274371, 151497, 372701, 298980, 380908, 290811, 282633, 241692, 102437, 315432, 102445, 233517, 176175, 282672, 241716, 225351, 315465, 315476, 307289, 200794, 315487, 356447, 45153, 307299, 438377, 315498, 299121, 233589, 233590, 266357, 422019, 241808, 381073, 323729, 233636, 299174, 405687, 184505, 299198, 258239, 389313, 299203, 299209, 372941, 282831, 266449, 356576, 176362, 307435, 438511, 381172, 184570, 184575, 381208, 282909, 299293, 151839, 282913, 233762, 217380, 151847, 282919, 332083, 332085, 332089, 315706, 282939, 241986, 438596, 332101, 323913, 348492, 323916, 323920, 250192, 348500, 168281, 332123, 332127, 323935, 242023, 242029, 160110, 242033, 291192, 340357, 225670, 332167, 242058, 373134, 291224, 242078, 283038, 61857, 315810, 315811, 61859, 381347, 340398, 61873, 61880, 283064, 291267, 127427, 127428, 283075, 324039, 373197, 176601, 242139, 160225, 242148, 291311, 233978, 291333, 340490, 283153, 258581, 291358, 283182, 283184, 234036, 234040, 315960, 348732, 242237, 70209, 348742, 70215, 348749, 340558, 381517, 332378, 201308, 111208, 184940, 373358, 389745, 209530, 373375, 152195, 348806, 152203, 184973, 316049, 316053, 111253, 111258, 111259, 176808, 299699, 299700, 422596, 422599, 291530, 225995, 242386, 422617, 422626, 234217, 299759, 234234, 299776, 242433, 291585, 430849, 291592, 62220, 422673, 430865, 291604, 422680, 152365, 422703, 422709, 152374, 234294, 242485, 160571, 430910, 160575, 160580, 299849, 283467, 381773, 201551, 242529, 349026, 357218, 275303, 308076, 242541, 209783, 209785, 177019, 185211, 308092, 398206, 291712, 381829, 316298, 308107, 308112, 349072, 209817, 324506, 324507, 390045, 185250, 324517, 283558, 185254, 316333, 316343, 373687, 349121, 373706, 316364, 340955, 340961, 324586, 340974, 316405, 349175, 201720, 127992, 357379, 324625, 234514, 308243, 316437, 201755, 300068, 357414, 300084, 324666, 308287, 21569, 218186, 300111, 341073, 439384, 234587, 250981, 300135, 316520, 300136, 316526, 357486, 144496, 300146, 300150, 291959, 300151, 160891, 341115, 300158, 349316, 349318, 234638, 373903, 169104, 177296, 308372, 283802, 119962, 300187, 300188, 234663, 300201, 300202, 373945, 259268, 283847, 62665, 283852, 283853, 259280, 316627, 333011, 357595, 234733, 292085, 234742, 128251, 316669, 234755, 439562, 292107, 242954, 414990, 251153, 177428, 349462, 382258, 300343, 382269, 193859, 177484, 406861, 259406, 234831, 251213, 120148, 357719, 283991, 374109, 292195, 333160, 284014, 243056, 316787, 111993, 357762, 112017, 234898, 259475, 275859, 112018, 357786, 251298, 333220, 316842, 374191, 210358, 284089, 292283, 415171, 292292, 300487, 300489, 284107, 366037, 210390, 210391, 210392, 210393, 144867, 54765, 251378, 308723, 300536, 300542, 210433, 366083, 259599, 316946, 308756, 398869, 374296, 374299, 308764, 349726, 431649, 349741, 169518, 431663, 194110, 235070, 349763, 218696, 292425, 243274, 128587, 333388, 333393, 349781, 300630, 128599, 235095, 333408, 374372, 300644, 317032, 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, 243472, 366360, 284442, 325404, 325410, 341796, 284459, 399147, 431916, 317232, 300848, 259899, 325439, 153415, 341836, 415567, 325457, 317269, 341847, 350044, 300894, 128862, 284514, 276327, 292712, 325484, 423789, 292720, 325492, 276341, 300918, 341879, 317304, 333688, 194429, 112509, 55167, 325503, 333701, 243591, 350093, 325518, 243597, 333722, 350109, 292771, 300963, 333735, 415655, 284587, 292782, 317360, 243637, 301008, 153554, 219101, 292836, 292837, 317415, 325619, 432116, 333817, 292858, 415741, 333828, 358410, 399373, 317467, 145435, 292902, 325674, 227370, 129076, 243767, 358456, 309345, 227428, 194666, 260207, 432240, 284788, 333940, 292988, 292992, 333955, 227460, 415881, 104587, 235662, 325776, 317587, 284826, 333991, 333992, 284842, 153776, 227513, 301251, 309444, 194782, 301279, 317664, 227578, 243962, 375039, 309503, 375051, 325905, 325912, 211235, 432421, 211238, 358703, 358709, 260418, 227654, 6481, 366930, 366929, 6489, 391520, 383332, 416104, 383336, 211326, 317831, 227725, 227726, 252308, 293274, 39324, 121245, 317852, 285090, 375207, 342450, 334260, 293303, 293306, 293310, 416197, 129483, 342476, 317901, 326100, 285150, 342498, 358882, 334309, 195045, 391655, 432618, 375276, 309744, 301571, 342536, 342553, 416286, 375333, 293419, 244269, 375343, 236081, 23092, 375351, 244281, 301638, 309830, 293448, 55881, 416341, 309846, 285271, 244310, 416351, 268899, 39530, 301689, 244347, 326287, 375440, 334481, 227990, 318106, 318107, 342682, 318130, 383667, 293556, 342713, 285371, 285372, 285373, 285374, 39614, 154316, 318173, 375526, 285415, 342762, 342763, 293612, 154359, 228088, 432893, 162561, 285444, 383754, 285458, 310036, 326429, 293664, 326433, 400166, 293672, 318250, 318252, 285487, 375609, 293693, 252741, 293711, 244568, 244570, 293730, 351077, 342887, 211829, 269178, 211836, 400252, 359298, 359299, 260996, 113542, 416646, 228233, 392074, 228234, 56208, 293781, 400283, 318364, 310176, 310178, 310182, 293800, 236461, 293806, 252847, 326581, 326587, 326601, 359381, 433115, 343005, 130016, 64485, 326635, 203757, 187374, 383983, 277492, 318461, 293886, 277509, 293893, 433165, 384016, 146448, 277524, 293910, 433174, 326685, 252958, 252980, 203830, 359478, 302139, 359495, 277597, 392290, 253029, 228458, 15471, 351344, 187506, 285814, 285820, 392318, 187521, 384131, 285828, 302213, 285830, 302216, 228491, 228493, 285838, 162961, 326804, 187544, 351390, 302240, 343203, 253099, 253100, 318639, 294068, 367799, 294074, 113850, 64700, 228542, 302274, 367810, 343234, 244940, 228563, 195808, 310497, 228588, 253167, 302325, 228600, 261377, 228609, 245019, 253216, 130338, 130343, 261425, 351537, 286013, 286018, 113987, 146762, 294218, 294219, 318805, 425304, 294243, 163175, 327024, 327025, 327031, 318848, 179587, 294275, 253317, 384393, 368011, 318864, 318868, 318875, 310692, 245161, 310701, 286129, 286132, 228795, 425405, 302529, 302531, 163268, 425418, 302540, 310732, 64975, 310736, 327121, 228827, 286172, 310757, 187878, 343542, 343543, 286202, 359930, 228861, 302590, 286205, 294400, 228867, 253451, 253452, 359950, 146964, 253463, 286244, 245287, 245292, 286254, 425535, 196164, 56902, 179801, 196187, 343647, 286306, 310889, 204397, 138863, 188016, 294529, 229001, 310923, 188048, 425626, 229020, 302754, 245412, 229029, 40614, 40613, 40615, 286391, 384695, 319162, 327358, 286399, 212685, 212688, 384720, 302802, 245457, 286423, 278233, 278234, 294622, 278240, 229088, 212716, 212717, 360177, 229113, 286459, 278272, 319233, 360195, 278291, 294678, 286494, 409394, 319292, 360252, 360264, 188251, 376669, 245599, 237408, 425825, 302946, 425833, 417654, 188292, 253829, 294807, 294809, 376732, 294814, 311199, 319392, 294823, 327596, 294843, 188348, 237504, 294850, 384964, 163781, 344013, 212942, 212946, 24532, 294886, 253929, 327661, 311281, 311282 ]
118eaee629a142d6f5bd446a44d7b6c9868262f4
3085fc212fa58646b9c034741eb9c78165386612
/Mac/MainWindow/Sidebar/SidebarOutlineDataSource.swift
5185d6f0cea025026372784d9961846959574473
[ "MIT" ]
permissive
sbarex/NetNewsWire
c97e05fb9c4d3023143a5b9e315ed5db5544b09e
c4522c2789a45dddb9ffb198326350a72bcd542e
refs/heads/master
2020-09-03T17:28:25.201813
2019-11-04T14:46:50
2019-11-04T14:46:50
219,520,984
2
0
MIT
2019-11-04T14:29:32
2019-11-04T14:29:32
null
UTF-8
Swift
false
false
23,495
swift
// // SidebarOutlineDataSource.swift // NetNewsWire // // Created by Brent Simmons on 2/12/18. // Copyright © 2018 Ranchero Software. All rights reserved. // import AppKit import RSTree import Articles import RSCore import Account @objc final class SidebarOutlineDataSource: NSObject, NSOutlineViewDataSource { let treeController: TreeController static let dragOperationNone = NSDragOperation(rawValue: 0) private var draggedNodes: Set<Node>? = nil init(treeController: TreeController) { self.treeController = treeController } // MARK: - NSOutlineViewDataSource func outlineView(_ outlineView: NSOutlineView, numberOfChildrenOfItem item: Any?) -> Int { return nodeForItem(item).numberOfChildNodes } func outlineView(_ outlineView: NSOutlineView, child index: Int, ofItem item: Any?) -> Any { return nodeForItem(item).childNodes[index] } func outlineView(_ outlineView: NSOutlineView, isItemExpandable item: Any) -> Bool { return nodeForItem(item).canHaveChildNodes } func outlineView(_ outlineView: NSOutlineView, pasteboardWriterForItem item: Any) -> NSPasteboardWriting? { let node = nodeForItem(item) guard nodeRepresentsDraggableItem(node) else { return nil } return (node.representedObject as? PasteboardWriterOwner)?.pasteboardWriter } // MARK: - Drag and Drop func outlineView(_ outlineView: NSOutlineView, draggingSession session: NSDraggingSession, willBeginAt screenPoint: NSPoint, forItems draggedItems: [Any]) { draggedNodes = Set(draggedItems.map { nodeForItem($0) }) } func outlineView(_ outlineView: NSOutlineView, validateDrop info: NSDraggingInfo, proposedItem item: Any?, proposedChildIndex index: Int) -> NSDragOperation { let draggedFolders = PasteboardFolder.pasteboardFolders(with: info.draggingPasteboard) let draggedFeeds = PasteboardFeed.pasteboardFeeds(with: info.draggingPasteboard) if (draggedFolders == nil && draggedFeeds == nil) || (draggedFolders != nil && draggedFeeds != nil) { return SidebarOutlineDataSource.dragOperationNone } let parentNode = nodeForItem(item) if let draggedFolders = draggedFolders { if draggedFolders.count == 1 { return validateLocalFolderDrop(outlineView, draggedFolders.first!, parentNode, index) } else { return validateLocalFoldersDrop(outlineView, draggedFolders, parentNode, index) } } if let draggedFeeds = draggedFeeds { let contentsType = draggedFeedContentsType(draggedFeeds) switch contentsType { case .singleNonLocal: let draggedNonLocalFeed = singleNonLocalFeed(from: draggedFeeds)! return validateSingleNonLocalFeedDrop(outlineView, draggedNonLocalFeed, parentNode, index) case .singleLocal: let draggedFeed = draggedFeeds.first! return validateSingleLocalFeedDrop(outlineView, draggedFeed, parentNode, index) case .multipleLocal: return validateLocalFeedsDrop(outlineView, draggedFeeds, parentNode, index) case .multipleNonLocal, .mixed, .empty: return SidebarOutlineDataSource.dragOperationNone } } return SidebarOutlineDataSource.dragOperationNone } func outlineView(_ outlineView: NSOutlineView, acceptDrop info: NSDraggingInfo, item: Any?, childIndex index: Int) -> Bool { let draggedFolders = PasteboardFolder.pasteboardFolders(with: info.draggingPasteboard) let draggedFeeds = PasteboardFeed.pasteboardFeeds(with: info.draggingPasteboard) if (draggedFolders == nil && draggedFeeds == nil) || (draggedFolders != nil && draggedFeeds != nil) { return false } let parentNode = nodeForItem(item) if let draggedFolders = draggedFolders { return acceptLocalFoldersDrop(outlineView, draggedFolders, parentNode, index) } if let draggedFeeds = draggedFeeds { let contentsType = draggedFeedContentsType(draggedFeeds) switch contentsType { case .singleNonLocal: let draggedNonLocalFeed = singleNonLocalFeed(from: draggedFeeds)! return acceptSingleNonLocalFeedDrop(outlineView, draggedNonLocalFeed, parentNode, index) case .singleLocal: return acceptLocalFeedsDrop(outlineView, draggedFeeds, parentNode, index) case .multipleLocal: return acceptLocalFeedsDrop(outlineView, draggedFeeds, parentNode, index) case .multipleNonLocal, .mixed, .empty: return false } } return false } } // MARK: - Private private extension SidebarOutlineDataSource { func nodeForItem(_ item: Any?) -> Node { if item == nil { return treeController.rootNode } return item as! Node } func nodeRepresentsDraggableItem(_ node: Node) -> Bool { // Don’t allow PseudoFeed to be dragged. // This will have to be revisited later. For instance, // user-created smart feeds should be draggable, maybe. return node.representedObject is Folder || node.representedObject is Feed } // MARK: - Drag and Drop enum DraggedFeedsContentsType { case empty, singleLocal, singleNonLocal, multipleLocal, multipleNonLocal, mixed } func draggedFeedContentsType(_ draggedFeeds: Set<PasteboardFeed>) -> DraggedFeedsContentsType { if draggedFeeds.isEmpty { return .empty } if draggedFeeds.count == 1 { let feed = draggedFeeds.first! return feed.isLocalFeed ? .singleLocal : .singleNonLocal } var hasLocalFeed = false var hasNonLocalFeed = false for feed in draggedFeeds { if feed.isLocalFeed { hasLocalFeed = true } else { hasNonLocalFeed = true } if hasLocalFeed && hasNonLocalFeed { return .mixed } } if hasLocalFeed { return .multipleLocal } return .multipleNonLocal } func singleNonLocalFeed(from feeds: Set<PasteboardFeed>) -> PasteboardFeed? { guard feeds.count == 1, let feed = feeds.first else { return nil } return feed.isLocalFeed ? nil : feed } func validateSingleNonLocalFeedDrop(_ outlineView: NSOutlineView, _ draggedFeed: PasteboardFeed, _ parentNode: Node, _ index: Int) -> NSDragOperation { // A non-local feed should always drag on to an Account or Folder node, with NSOutlineViewDropOnItemIndex — since we don’t know where it would sort till we read the feed. guard let dropTargetNode = ancestorThatCanAcceptNonLocalFeed(parentNode) else { return SidebarOutlineDataSource.dragOperationNone } if parentNode !== dropTargetNode || index != NSOutlineViewDropOnItemIndex { outlineView.setDropItem(dropTargetNode, dropChildIndex: NSOutlineViewDropOnItemIndex) } return .copy } func validateSingleLocalFeedDrop(_ outlineView: NSOutlineView, _ draggedFeed: PasteboardFeed, _ parentNode: Node, _ index: Int) -> NSDragOperation { // A local feed should always drag on to an Account or Folder node, and we can provide an index. guard let dropTargetNode = ancestorThatCanAcceptLocalFeed(parentNode) else { return SidebarOutlineDataSource.dragOperationNone } if nodeHasChildRepresentingDraggedFeed(dropTargetNode, draggedFeed) { return SidebarOutlineDataSource.dragOperationNone } if violatesAccountSpecificBehavior(dropTargetNode, draggedFeed) { return SidebarOutlineDataSource.dragOperationNone } if parentNode == dropTargetNode && index == NSOutlineViewDropOnItemIndex { return localDragOperation() } let updatedIndex = indexWhereDraggedFeedWouldAppear(dropTargetNode, draggedFeed) if parentNode !== dropTargetNode || index != updatedIndex { outlineView.setDropItem(dropTargetNode, dropChildIndex: updatedIndex) } return localDragOperation() } func validateLocalFeedsDrop(_ outlineView: NSOutlineView, _ draggedFeeds: Set<PasteboardFeed>, _ parentNode: Node, _ index: Int) -> NSDragOperation { // Local feeds should always drag on to an Account or Folder node, and index should be NSOutlineViewDropOnItemIndex since we can’t provide multiple indexes. guard let dropTargetNode = ancestorThatCanAcceptLocalFeed(parentNode) else { return SidebarOutlineDataSource.dragOperationNone } if nodeHasChildRepresentingAnyDraggedFeed(dropTargetNode, draggedFeeds) { return SidebarOutlineDataSource.dragOperationNone } if violatesAccountSpecificBehavior(dropTargetNode, draggedFeeds) { return SidebarOutlineDataSource.dragOperationNone } if parentNode !== dropTargetNode || index != NSOutlineViewDropOnItemIndex { outlineView.setDropItem(dropTargetNode, dropChildIndex: NSOutlineViewDropOnItemIndex) } return localDragOperation() } func localDragOperation() -> NSDragOperation { if NSApplication.shared.currentEvent?.modifierFlags.contains(.option) ?? false { return .copy } else { return .move } } func accountForNode(_ node: Node) -> Account? { if let account = node.representedObject as? Account { return account } if let folder = node.representedObject as? Folder { return folder.account } if let feed = node.representedObject as? Feed { return feed.account } return nil } func commonAccountsFor(_ nodes: Set<Node>) -> Set<Account> { var accounts = Set<Account>() for node in nodes { guard let oneAccount = accountForNode(node) else { continue } accounts.insert(oneAccount) } return accounts } func accountHasFolderRepresentingAnyDraggedFolders(_ account: Account, _ draggedFolders: Set<PasteboardFolder>) -> Bool { for draggedFolder in draggedFolders { if account.existingFolder(with: draggedFolder.name) != nil { return true } } return false } func validateLocalFolderDrop(_ outlineView: NSOutlineView, _ draggedFolder: PasteboardFolder, _ parentNode: Node, _ index: Int) -> NSDragOperation { guard let dropAccount = parentNode.representedObject as? Account, dropAccount.accountID != draggedFolder.accountID else { return SidebarOutlineDataSource.dragOperationNone } if accountHasFolderRepresentingAnyDraggedFolders(dropAccount, Set([draggedFolder])) { return SidebarOutlineDataSource.dragOperationNone } let updatedIndex = indexWhereDraggedFolderWouldAppear(parentNode, draggedFolder) if index != updatedIndex { outlineView.setDropItem(parentNode, dropChildIndex: updatedIndex) } return localDragOperation() } func validateLocalFoldersDrop(_ outlineView: NSOutlineView, _ draggedFolders: Set<PasteboardFolder>, _ parentNode: Node, _ index: Int) -> NSDragOperation { guard let dropAccount = parentNode.representedObject as? Account else { return SidebarOutlineDataSource.dragOperationNone } if accountHasFolderRepresentingAnyDraggedFolders(dropAccount, draggedFolders) { return SidebarOutlineDataSource.dragOperationNone } for draggedFolder in draggedFolders { if dropAccount.accountID == draggedFolder.accountID { return SidebarOutlineDataSource.dragOperationNone } } if index != NSOutlineViewDropOnItemIndex { outlineView.setDropItem(parentNode, dropChildIndex: NSOutlineViewDropOnItemIndex) } return localDragOperation() } func copyFeedInAccount(node: Node, to parentNode: Node) { guard let feed = node.representedObject as? Feed, let destination = parentNode.representedObject as? Container else { return } destination.account?.addFeed(feed, to: destination) { result in switch result { case .success: break case .failure(let error): NSApplication.shared.presentError(error) } } } func moveFeedInAccount(node: Node, to parentNode: Node) { guard let feed = node.representedObject as? Feed, let source = node.parent?.representedObject as? Container, let destination = parentNode.representedObject as? Container else { return } BatchUpdate.shared.start() source.account?.moveFeed(feed, from: source, to: destination) { result in BatchUpdate.shared.end() switch result { case .success: break case .failure(let error): NSApplication.shared.presentError(error) } } } func copyFeedBetweenAccounts(node: Node, to parentNode: Node) { guard let feed = node.representedObject as? Feed, let destinationAccount = nodeAccount(parentNode), let destinationContainer = parentNode.representedObject as? Container else { return } if let existingFeed = destinationAccount.existingFeed(withURL: feed.url) { destinationAccount.addFeed(existingFeed, to: destinationContainer) { result in switch result { case .success: break case .failure(let error): NSApplication.shared.presentError(error) } } } else { destinationAccount.createFeed(url: feed.url, name: feed.editedName, container: destinationContainer) { result in switch result { case .success: break case .failure(let error): NSApplication.shared.presentError(error) } } } } func moveFeedBetweenAccounts(node: Node, to parentNode: Node) { guard let feed = node.representedObject as? Feed, let sourceAccount = nodeAccount(node), let sourceContainer = node.parent?.representedObject as? Container, let destinationAccount = nodeAccount(parentNode), let destinationContainer = parentNode.representedObject as? Container else { return } if let existingFeed = destinationAccount.existingFeed(withURL: feed.url) { BatchUpdate.shared.start() destinationAccount.addFeed(existingFeed, to: destinationContainer) { result in switch result { case .success: sourceAccount.removeFeed(feed, from: sourceContainer) { result in BatchUpdate.shared.end() switch result { case .success: break case .failure(let error): NSApplication.shared.presentError(error) } } case .failure(let error): BatchUpdate.shared.end() NSApplication.shared.presentError(error) } } } else { BatchUpdate.shared.start() destinationAccount.createFeed(url: feed.url, name: feed.editedName, container: destinationContainer) { result in switch result { case .success: sourceAccount.removeFeed(feed, from: sourceContainer) { result in BatchUpdate.shared.end() switch result { case .success: break case .failure(let error): NSApplication.shared.presentError(error) } } case .failure(let error): BatchUpdate.shared.end() NSApplication.shared.presentError(error) } } } } func acceptLocalFeedsDrop(_ outlineView: NSOutlineView, _ draggedFeeds: Set<PasteboardFeed>, _ parentNode: Node, _ index: Int) -> Bool { guard let draggedNodes = draggedNodes else { return false } draggedNodes.forEach { node in if sameAccount(node, parentNode) { if NSApplication.shared.currentEvent?.modifierFlags.contains(.option) ?? false { copyFeedInAccount(node: node, to: parentNode) } else { moveFeedInAccount(node: node, to: parentNode) } } else { if NSApplication.shared.currentEvent?.modifierFlags.contains(.option) ?? false { copyFeedBetweenAccounts(node: node, to: parentNode) } else { moveFeedBetweenAccounts(node: node, to: parentNode) } } } return true } func nodeIsAccountOrFolder(_ node: Node) -> Bool { return node.representedObject is Account || node.representedObject is Folder } func nodeIsDropTarget(_ node: Node) -> Bool { return node.canHaveChildNodes && nodeIsAccountOrFolder(node) } func ancestorThatCanAcceptLocalFeed(_ node: Node) -> Node? { if nodeIsDropTarget(node) { return node } guard let parentNode = node.parent else { return nil } return ancestorThatCanAcceptLocalFeed(parentNode) } func ancestorThatCanAcceptNonLocalFeed(_ node: Node) -> Node? { // Default to the On My Mac account, if needed, so we can always accept a nonlocal feed drop. if nodeIsDropTarget(node) { return node } guard let parentNode = node.parent else { if let onMyMacAccountNode = treeController.nodeInTreeRepresentingObject(AccountManager.shared.defaultAccount) { return onMyMacAccountNode } return nil } return ancestorThatCanAcceptNonLocalFeed(parentNode) } func copyFolderBetweenAccounts(node: Node, to parentNode: Node) { guard let sourceFolder = node.representedObject as? Folder, let destinationAccount = nodeAccount(parentNode) else { return } replicateFolder(sourceFolder, destinationAccount: destinationAccount, completion: {}) } func moveFolderBetweenAccounts(node: Node, to parentNode: Node) { guard let sourceFolder = node.representedObject as? Folder, let sourceAccount = nodeAccount(node), let destinationAccount = nodeAccount(parentNode) else { return } BatchUpdate.shared.start() replicateFolder(sourceFolder, destinationAccount: destinationAccount) { sourceAccount.removeFolder(sourceFolder) { result in BatchUpdate.shared.end() switch result { case .success: break case .failure(let error): NSApplication.shared.presentError(error) } } } } func replicateFolder(_ folder: Folder, destinationAccount: Account, completion: @escaping () -> Void) { destinationAccount.addFolder(folder.name ?? "") { result in switch result { case .success(let destinationFolder): let group = DispatchGroup() for feed in folder.topLevelFeeds { if let existingFeed = destinationAccount.existingFeed(withURL: feed.url) { group.enter() destinationAccount.addFeed(existingFeed, to: destinationFolder) { result in group.leave() switch result { case .success: break case .failure(let error): NSApplication.shared.presentError(error) } } } else { group.enter() destinationAccount.createFeed(url: feed.url, name: feed.editedName, container: destinationFolder) { result in group.leave() switch result { case .success: break case .failure(let error): NSApplication.shared.presentError(error) } } } } group.notify(queue: DispatchQueue.main) { completion() } case .failure(let error): NSApplication.shared.presentError(error) completion() } } } func acceptLocalFoldersDrop(_ outlineView: NSOutlineView, _ draggedFolders: Set<PasteboardFolder>, _ parentNode: Node, _ index: Int) -> Bool { guard let draggedNodes = draggedNodes else { return false } draggedNodes.forEach { node in if !sameAccount(node, parentNode) { if NSApplication.shared.currentEvent?.modifierFlags.contains(.option) ?? false { copyFolderBetweenAccounts(node: node, to: parentNode) } else { moveFolderBetweenAccounts(node: node, to: parentNode) } } } return true } func acceptSingleNonLocalFeedDrop(_ outlineView: NSOutlineView, _ draggedFeed: PasteboardFeed, _ parentNode: Node, _ index: Int) -> Bool { guard nodeIsDropTarget(parentNode), index == NSOutlineViewDropOnItemIndex else { return false } // Show the add-feed sheet. if let account = parentNode.representedObject as? Account { appDelegate.addFeed(draggedFeed.url, name: draggedFeed.editedName ?? draggedFeed.name, account: account, folder: nil) } else { let account = parentNode.parent?.representedObject as? Account let folder = parentNode.representedObject as? Folder appDelegate.addFeed(draggedFeed.url, name: draggedFeed.editedName ?? draggedFeed.name, account: account, folder: folder) } return true } func nodeHasChildRepresentingDraggedFeed(_ parentNode: Node, _ draggedFeed: PasteboardFeed) -> Bool { return nodeHasChildRepresentingAnyDraggedFeed(parentNode, Set([draggedFeed])) } func nodeRepresentsAnyDraggedFeed(_ node: Node, _ draggedFeeds: Set<PasteboardFeed>) -> Bool { guard let feed = node.representedObject as? Feed else { return false } for draggedFeed in draggedFeeds { if feed.url == draggedFeed.url { return true } } return false } func sameAccount(_ node: Node, _ parentNode: Node) -> Bool { if let accountID = nodeAccountID(node), let parentAccountID = nodeAccountID(parentNode) { if accountID == parentAccountID { return true } } return false } func nodeAccount(_ node: Node) -> Account? { if let account = node.representedObject as? Account { return account } else if let folder = node.representedObject as? Folder { return folder.account } else if let feed = node.representedObject as? Feed { return feed.account } else { return nil } } func nodeAccountID(_ node: Node) -> String? { return nodeAccount(node)?.accountID } func nodeHasChildRepresentingAnyDraggedFeed(_ parentNode: Node, _ draggedFeeds: Set<PasteboardFeed>) -> Bool { for node in parentNode.childNodes { if nodeRepresentsAnyDraggedFeed(node, draggedFeeds) { return true } } return false } func violatesAccountSpecificBehavior(_ parentNode: Node, _ draggedFeed: PasteboardFeed) -> Bool { return violatesAccountSpecificBehavior(parentNode, Set([draggedFeed])) } func violatesAccountSpecificBehavior(_ parentNode: Node, _ draggedFeeds: Set<PasteboardFeed>) -> Bool { if violatesDisallowFeedInRootFolder(parentNode) { return true } if violatesDisallowFeedCopyInRootFolder(parentNode, draggedFeeds) { return true } return false } func violatesDisallowFeedInRootFolder(_ parentNode: Node) -> Bool { guard let parentAccount = nodeAccount(parentNode), parentAccount.behaviors.contains(.disallowFeedInRootFolder) else { return false } if parentNode.representedObject is Account { return true } return false } func violatesDisallowFeedCopyInRootFolder(_ parentNode: Node, _ draggedFeeds: Set<PasteboardFeed>) -> Bool { guard let parentAccount = nodeAccount(parentNode), parentAccount.behaviors.contains(.disallowFeedCopyInRootFolder) else { return false } for draggedFeed in draggedFeeds { if parentAccount.accountID != draggedFeed.accountID { return false } } if parentNode.representedObject is Account && (NSApplication.shared.currentEvent?.modifierFlags.contains(.option) ?? false) { return true } return false } func indexWhereDraggedFeedWouldAppear(_ parentNode: Node, _ draggedFeed: PasteboardFeed) -> Int { let draggedFeedWrapper = PasteboardFeedObjectWrapper(pasteboardFeed: draggedFeed) let draggedFeedNode = Node(representedObject: draggedFeedWrapper, parent: nil) let nodes = parentNode.childNodes + [draggedFeedNode] // Revisit if the tree controller can ever be sorted in some other way. let sortedNodes = nodes.sortedAlphabeticallyWithFoldersAtEnd() let index = sortedNodes.firstIndex(of: draggedFeedNode)! return index } func indexWhereDraggedFolderWouldAppear(_ parentNode: Node, _ draggedFolder: PasteboardFolder) -> Int { let draggedFolderWrapper = PasteboardFolderObjectWrapper(pasteboardFolder: draggedFolder) let draggedFolderNode = Node(representedObject: draggedFolderWrapper, parent: nil) draggedFolderNode.canHaveChildNodes = true let nodes = parentNode.childNodes + [draggedFolderNode] // Revisit if the tree controller can ever be sorted in some other way. let sortedNodes = nodes.sortedAlphabeticallyWithFoldersAtEnd() let index = sortedNodes.firstIndex(of: draggedFolderNode)! return index } } final class PasteboardFeedObjectWrapper: DisplayNameProvider { var nameForDisplay: String { return pasteboardFeed.editedName ?? pasteboardFeed.name ?? "" } let pasteboardFeed: PasteboardFeed init(pasteboardFeed: PasteboardFeed) { self.pasteboardFeed = pasteboardFeed } } final class PasteboardFolderObjectWrapper: DisplayNameProvider { var nameForDisplay: String { return pasteboardFolder.name } let pasteboardFolder: PasteboardFolder init(pasteboardFolder: PasteboardFolder) { self.pasteboardFolder = pasteboardFolder } }
[ -1 ]
3b2d3830b085d76e8ff72b5bcb8fd8f654b88438
b3efae254c903ca3c23d979cba6cadc5f0e63075
/Sources/Cast.swift
ebffc3b2cc9957cae08390f330dc0ac3a9defaaa
[ "MIT" ]
permissive
dche/GLMath
e75311193d35b4fb62b2fd55e64a84afe47ca27f
d404725e7016e68566e55b5478f2895eda986587
refs/heads/master
2021-01-11T01:10:04.489963
2017-10-07T00:41:07
2017-10-07T00:41:07
71,051,064
1
0
null
2017-10-07T00:41:08
2016-10-16T13:10:44
Swift
UTF-8
Swift
false
false
1,147
swift
// // GLMath - Cast.swift // // Explicit type casting. // // Copyright (c) 2017 The GLMath authors. // Licensed under MIT License. extension NumericVector { /// Constructs a numreic vector from a boolean vector with same dimension. /// /// - parameter b: A boolean vector. /// /// ## Example /// ``` /// import GLMath /// /// let b3 = bvec3(true, true, false) /// let i3 = ivec3(b3) /// assert(i3.x == 1 && i3.y == 1 && i3.z == 0) /// ``` public init<T: Vector>(_ b: T) where T.Dim == Self.Dim, T.Component == Bool { var a = Self(Self.Component.zero) for i in 0 ..< T.dimension { if b[i] { a[i] = Self.Component.one } } self = a } } extension Vector where Component == Bool { /// Constructs a boolean vector from a numeric vector with same dimension. /// /// - parameter v: A numeric vector. public init<T: NumericVector>(_ v: T) where T.Dim == Self.Dim { var a = Self(true) for i in 0 ..< T.dimension { if v[i].isZero { a[i] = false } } self = a } }
[ -1 ]
da1f7dfec44478ad12e56b3c7d3d060a9ee2b443
aa189b66e9dd0c60f5c9932a0f69074a7a4ba572
/InstaCloneFireBase/ViewController.swift
ac867698c34fd606f7704ab74f74f9cdbbbb9c6a
[]
no_license
klonesa/InstaCloneFireBase
6ad53f21d6be5b53944982a1e22141b8da568729
0ed325d7d0fd08b51238012f555966781b7bbe4d
refs/heads/main
2023-08-24T06:12:30.120869
2021-10-27T18:35:16
2021-10-27T18:35:16
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,058
swift
// // ViewController.swift // InstaCloneFireBase // // Created by mesut on 26.10.2021. // import UIKit import Firebase class ViewController: UIViewController { @IBOutlet weak var passwordText: UITextField! @IBOutlet weak var emailText: UITextField! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } @IBAction func signInClicked(_ sender: Any) { if emailText.text != "" && passwordText.text != ""{ Auth.auth().signIn(withEmail: emailText.text!, password: passwordText.text!) { (authdata, error) in if error != nil{ self.makeAlert(nameInput: "Error", messageInput: error?.localizedDescription ?? "Error3") }else { self.performSegue(withIdentifier: "toFeedVc", sender: nil) } } }else{ makeAlert(nameInput: "Error", messageInput: "Error2") } } //signUp @IBAction func signUpClicked(_ sender: Any) { if emailText.text != "" && passwordText.text != ""{ Auth.auth().createUser(withEmail: emailText.text!, password: passwordText.text!) { (authdats, error)in if error != nil{ self.makeAlert(nameInput: "Error", messageInput: error?.localizedDescription ?? "Error1") }else{ self.performSegue(withIdentifier: "toFeedVc", sender: nil) } } }else{ makeAlert(nameInput: "Error", messageInput: "Username/password ?") } } func makeAlert(nameInput:String,messageInput:String){ let alert = UIAlertController(title: nameInput, message: messageInput, preferredStyle: UIAlertController.Style.alert) let okButton = UIAlertAction(title: "OK", style: UIAlertAction.Style.default) alert.addAction(okButton) self.present(alert, animated: true, completion: nil) } }
[ -1 ]
93e48d26dcf626b8953ad64a5919c60f45d5868b
fe01f91b17d1a63ba09fe196bc888450d008cc81
/VidEngine/AppDelegate.swift
db2882baaa7c4cfb90bd8e890e642c20d9c77fea
[]
no_license
johndpope/VidEngine
eae17926bca0f93fdec4618e7cfd3c9a74f8b546
264a94fddc074f0b178cb9cc0f5e8dfcfff705f0
refs/heads/master
2021-01-12T03:08:26.936947
2016-10-09T18:27:19
2016-10-09T18:27:19
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,161
swift
// // AppDelegate.swift // // Created by David Gavilan on 3/31/16. // Copyright © 2016 David Gavilan. 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 throttle down OpenGL ES frame rates. Games should use this method to pause the game. } func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } }
[ 229380, 229383, 229385, 278539, 229388, 294924, 278542, 229391, 327695, 278545, 229394, 278548, 229397, 229399, 229402, 278556, 229405, 278559, 229408, 278564, 294950, 229415, 229417, 327722, 237613, 229422, 360496, 229426, 237618, 229428, 286774, 319544, 204856, 229432, 286776, 286778, 352318, 286791, 237640, 278605, 286797, 311375, 237646, 163920, 196692, 319573, 311383, 278623, 319590, 311400, 278635, 303212, 278639, 131192, 278648, 237693, 327814, 131209, 303241, 417930, 311436, 303244, 319633, 286873, 286876, 311460, 311469, 32944, 327862, 286906, 327866, 180413, 286910, 131264, 286916, 286922, 286924, 286926, 319694, 286928, 131281, 278743, 278747, 295133, 155872, 319716, 278760, 237807, 303345, 286962, 131314, 229622, 327930, 278781, 278783, 278785, 237826, 319751, 278792, 286987, 319757, 311569, 286999, 319770, 287003, 287006, 287009, 287012, 287014, 287016, 287019, 311598, 287023, 262448, 311601, 287032, 155966, 278849, 319809, 319810, 319814, 311623, 319818, 311628, 229709, 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, 279010, 287202, 279015, 172520, 319978, 279020, 172526, 279023, 311791, 172529, 279027, 319989, 164343, 180727, 279035, 311804, 287230, 279040, 303617, 287234, 279045, 287238, 172550, 303623, 320007, 172552, 279051, 172558, 279055, 303632, 279058, 303637, 279063, 279067, 172572, 279072, 172577, 295459, 172581, 295461, 279082, 311850, 279084, 172591, 172598, 279095, 172607, 172609, 172612, 377413, 172614, 172618, 303690, 33357, 287309, 279124, 172634, 262752, 311911, 189034, 295533, 189039, 189040, 172655, 172656, 352880, 189044, 172660, 295538, 287349, 287355, 287360, 295553, 287365, 295557, 311942, 303751, 352905, 279178, 287371, 311946, 311951, 287377, 287381, 311957, 221850, 287386, 230045, 287390, 295583, 303773, 172705, 287394, 164509, 303780, 172702, 287398, 172707, 287400, 279208, 172714, 295595, 279212, 189102, 172721, 287409, 66227, 303797, 189114, 287419, 303804, 328381, 279231, 328384, 287423, 287427, 312006, 107208, 107212, 172748, 287436, 172751, 287440, 295633, 172755, 303827, 279255, 172760, 287450, 303835, 279258, 189149, 303838, 213724, 279267, 312035, 295654, 279272, 312048, 230128, 312050, 230131, 205564, 303871, 230146, 328453, 295685, 230154, 33548, 312077, 295695, 295701, 369433, 230169, 295707, 328476, 295710, 230175, 303914, 279340, 205613, 279353, 230202, 312124, 222018, 295755, 377676, 148302, 287569, 303959, 230237, 279390, 230241, 279394, 303976, 336744, 303985, 328563, 303987, 279413, 303991, 303997, 295806, 295808, 304005, 295813, 304007, 320391, 213895, 304009, 304011, 230284, 304013, 213902, 279438, 189325, 189329, 295822, 189331, 304019, 279445, 58262, 304023, 295825, 279452, 234648, 410526, 279461, 279462, 304042, 213931, 304055, 230327, 287675, 197564, 304063, 238528, 304065, 189378, 213954, 156612, 295873, 213963, 312272, 304084, 304090, 320481, 304106, 320490, 312302, 328687, 320496, 304114, 295928, 320505, 312321, 295945, 295949, 197645, 230413, 320528, 140312, 295961, 238620, 197663, 304164, 189479, 304170, 238641, 312374, 238652, 238655, 230465, 238658, 296004, 132165, 336964, 205895, 320584, 238666, 296021, 402518, 336987, 230497, 296036, 361576, 296040, 205931, 296044, 164973, 205934, 279661, 312432, 279669, 337018, 189562, 279679, 279683, 222340, 205968, 296084, 238745, 304285, 238756, 205991, 222377, 165035, 337067, 165038, 238766, 230576, 238770, 304311, 230592, 279750, 312518, 230600, 230607, 148690, 320727, 279769, 304348, 279777, 304354, 296163, 320740, 279781, 304360, 320748, 279788, 279790, 304370, 296189, 320771, 312585, 296202, 296205, 230674, 320786, 230677, 296213, 296215, 320792, 230681, 230679, 214294, 304416, 230689, 173350, 312622, 296243, 312630, 222522, 222525, 296253, 296255, 312639, 230718, 296259, 378181, 296262, 230727, 296264, 238919, 320840, 296267, 296271, 222545, 230739, 312663, 337244, 222556, 230752, 312676, 230760, 173418, 410987, 230763, 230768, 296305, 312692, 230773, 304505, 181626, 304506, 279929, 181631, 312711, 312712, 296331, 288140, 230800, 288144, 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, 280021, 288214, 222676, 239064, 288217, 288218, 280027, 288220, 329177, 239070, 288224, 288226, 370146, 280036, 288229, 280038, 288230, 288232, 280034, 288234, 320998, 288236, 288238, 288240, 288242, 296435, 288244, 288250, 148990, 321022, 206336, 402942, 296446, 296450, 230916, 230919, 214535, 370187, 304651, 304653, 402969, 230940, 222752, 108066, 296486, 296488, 157229, 230961, 288320, 288325, 124489, 280140, 280145, 288338, 280149, 280152, 288344, 239194, 280158, 403039, 370272, 181854, 239202, 370279, 312938, 280183, 280185, 280188, 280191, 280194, 116354, 280208, 280211, 288408, 280218, 280222, 419489, 190118, 321195, 296622, 321200, 337585, 296626, 296634, 296637, 419522, 313027, 280260, 419525, 280264, 206536, 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, 194130, 280402, 173907, 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, 10170, 296890, 288700, 296894, 280515, 190403, 296900, 337862, 165831, 280521, 231379, 296921, 354265, 354270, 239586, 313320, 354281, 231404, 124913, 165876, 321528, 313340, 239612, 288764, 239617, 313347, 288773, 313358, 305176, 321560, 313371, 354338, 305191, 223273, 313386, 354348, 124978, 215090, 124980, 288824, 288826, 321595, 378941, 313406, 288831, 288836, 67654, 280651, 354382, 288848, 280658, 215123, 354390, 288855, 288859, 280669, 313438, 280671, 149599, 149601, 321634, 149603, 223327, 329830, 280681, 313451, 223341, 280687, 215154, 280691, 313458, 313464, 329850, 321659, 280702, 288895, 321670, 215175, 141446, 288909, 141455, 141459, 280725, 313498, 100520, 288936, 280747, 288940, 280755, 288947, 321717, 280759, 280764, 280769, 280771, 280774, 280776, 321740, 313548, 280783, 280786, 280788, 313557, 280793, 280796, 280798, 338147, 280804, 280807, 157930, 280811, 280817, 125171, 157940, 280819, 182517, 280823, 280825, 280827, 280830, 280831, 280833, 125187, 280835, 125191, 125207, 125209, 321817, 125218, 321842, 223539, 125239, 280888, 280891, 289087, 280897, 280900, 239944, 305480, 280906, 239947, 305485, 305489, 379218, 280919, 248153, 215387, 354653, 313700, 313705, 280937, 190832, 280946, 223606, 313720, 280956, 239997, 280959, 313731, 240011, 199051, 289166, 240017, 297363, 190868, 297365, 240021, 297368, 297372, 141725, 297377, 289186, 297391, 289201, 240052, 289207, 305594, 289210, 281024, 289218, 289221, 289227, 436684, 281045, 281047, 215526, 166378, 305647, 281075, 174580, 281084, 240124, 305662, 305664, 240129, 305666, 305668, 223749, 330244, 281095, 223752, 338440, 150025, 240132, 223757, 281102, 223763, 223765, 281113, 322074, 281116, 281121, 182819, 281127, 281135, 150066, 158262, 158266, 289342, 281154, 322115, 158283, 281163, 281179, 199262, 338528, 338532, 281190, 199273, 281196, 158317, 19053, 313973, 297594, 281210, 158347, 264845, 182926, 133776, 182929, 314003, 117398, 314007, 289436, 174754, 330404, 289448, 133801, 174764, 314029, 314033, 240309, 133817, 314045, 314047, 314051, 199364, 297671, 158409, 289493, 363234, 289513, 289522, 289525, 289532, 322303, 289537, 322310, 264969, 322314, 322318, 281361, 281372, 322341, 215850, 281388, 207661, 289593, 281401, 289601, 281410, 281413, 281414, 240458, 281420, 240468, 281430, 322393, 297818, 281435, 281438, 281442, 174955, 224110, 207733, 207737, 183172, 158596, 338823, 322440, 314249, 240519, 183184, 240535, 289687, 224151, 297883, 289694, 289696, 289700, 289712, 281529, 289724, 52163, 183260, 420829, 281567, 289762, 322534, 297961, 183277, 281581, 322550, 134142, 322563, 330764, 175134, 322599, 322610, 314421, 281654, 314427, 314433, 207937, 314441, 207949, 322642, 314456, 281691, 314461, 281702, 281704, 314474, 281708, 281711, 289912, 248995, 306341, 306344, 306347, 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, 308418, 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, 282025, 314793, 282027, 241068, 241070, 241072, 282034, 241077, 150966, 298424, 306618, 282044, 323015, 306635, 306640, 290263, 290270, 290275, 339431, 282089, 191985, 282098, 290291, 282101, 241142, 191992, 290298, 151036, 290302, 282111, 290305, 175621, 192008, 323084, 257550, 282127, 290321, 282130, 323090, 282133, 290325, 241175, 290328, 282137, 290332, 241181, 282142, 282144, 290344, 306731, 290349, 290351, 290356, 28219, 282186, 224849, 282195, 282199, 282201, 306778, 159324, 159330, 314979, 298598, 323176, 224875, 241260, 323181, 257658, 315016, 282249, 290445, 282255, 282261, 175770, 298651, 323229, 282269, 298655, 323231, 61092, 282277, 306856, 282295, 282300, 323260, 323266, 282310, 323273, 282319, 306897, 241362, 282328, 306904, 298714, 52959, 282337, 216801, 241380, 216806, 323304, 282345, 12011, 282356, 323318, 282364, 282367, 306945, 241412, 323333, 282376, 216842, 323345, 282388, 323349, 282392, 184090, 315167, 315169, 282402, 315174, 323367, 241448, 315176, 241450, 282410, 306988, 306991, 315184, 323376, 315190, 241464, 159545, 282425, 298811, 307009, 413506, 241475, 307012, 298822, 148946, 315211, 282446, 307027, 315221, 282454, 315223, 241496, 323414, 241498, 307035, 307040, 282465, 110433, 241509, 110438, 298860, 110445, 282478, 282481, 110450, 315251, 315249, 315253, 315255, 339838, 282499, 315267, 315269, 241544, 282505, 241546, 241548, 298896, 282514, 298898, 241556, 298901, 44948, 282520, 241560, 241563, 241565, 241567, 241569, 282531, 241574, 282537, 298922, 36779, 241581, 282542, 241583, 323504, 241586, 282547, 241588, 290739, 241590, 241592, 241598, 290751, 241600, 241605, 151495, 241610, 298975, 241632, 241640, 298984, 241643, 298988, 241646, 241649, 241652, 323574, 290807, 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, 315483, 217179, 192605, 233567, 200801, 299105, 217188, 299109, 307303, 315495, 356457, 307307, 45163, 315502, 192624, 307314, 323700, 299126, 233591, 299136, 307329, 307338, 233613, 241813, 307352, 299164, 184479, 299167, 184481, 315557, 184486, 307370, 307372, 184492, 307374, 307376, 323763, 176311, 299191, 307385, 307386, 258235, 307388, 176316, 307390, 184503, 299200, 184512, 307394, 307396, 299204, 184518, 307399, 323784, 307409, 307411, 176343, 299225, 233701, 307432, 184572, 282881, 184579, 282893, 291089, 282906, 291104, 233766, 282931, 307508, 315701, 307510, 332086, 151864, 307512, 176435, 307515, 168245, 282942, 307518, 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, 291226, 242075, 283033, 291231, 61855, 283042, 291238, 291241, 194657, 127403, 127405, 127407, 291247, 299440, 299444, 127413, 283062, 291254, 194660, 127417, 291260, 283069, 127421, 127424, 299457, 127429, 127431, 176592, 315856, 315860, 176597, 283095, 127447, 299481, 176605, 242143, 291299, 340454, 242152, 291305, 127466, 176620, 127474, 291314, 291317, 135672, 233979, 291323, 291330, 283142, 127497, 233994, 135689, 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, 291456, 135808, 373383, 299655, 135820, 316051, 225941, 316054, 299672, 135834, 373404, 299677, 225948, 135839, 299680, 225954, 135844, 299684, 242343, 209576, 242345, 373421, 135870, 135873, 135876, 135879, 299720, 299723, 225998, 299726, 226002, 119509, 226005, 226008, 242396, 299740, 201444, 299750, 283368, 234219, 283372, 381677, 185074, 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, 291608, 283421, 234269, 234272, 234274, 152355, 234278, 299814, 283432, 234281, 234284, 234287, 283440, 185138, 242483, 234292, 234296, 234298, 283452, 160572, 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, 226185, 234379, 291716, 234384, 234388, 234390, 226200, 234393, 209818, 308123, 324504, 324508, 234396, 234398, 291742, 234401, 291747, 291748, 234405, 291750, 234407, 324520, 324518, 234410, 291754, 226220, 291756, 324522, 324527, 291760, 234417, 201650, 324531, 234414, 234422, 226230, 324536, 275384, 234428, 291773, 234431, 242623, 324544, 324546, 234434, 324548, 226245, 234437, 234439, 226239, 234443, 291788, 193486, 234446, 193488, 234449, 275406, 316370, 234452, 234455, 234459, 234461, 234464, 234467, 234470, 168935, 5096, 324585, 234475, 234478, 316400, 234481, 316403, 234484, 234485, 324599, 234487, 234490, 234493, 234496, 316416, 234501, 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, 234556, 234558, 316479, 234561, 308291, 316483, 234563, 234568, 234570, 316491, 300108, 234572, 234574, 300115, 234580, 234581, 242777, 234585, 275545, 234590, 234593, 234595, 300133, 234597, 234601, 300139, 234605, 160879, 234607, 275569, 234610, 300148, 234614, 398455, 144506, 234618, 275579, 234620, 234623, 226433, 234627, 275588, 234629, 242822, 234634, 234636, 177293, 234640, 275602, 234643, 226453, 308373, 234647, 275608, 275606, 234650, 308379, 324757, 283805, 234653, 300189, 119967, 324766, 324768, 234657, 242852, 283813, 234661, 300197, 234664, 275626, 234667, 316596, 308414, 300223, 234687, 316610, 300226, 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, 177419, 300299, 283917, 242957, 300301, 177424, 349451, 275725, 349464, 415009, 283939, 259367, 283951, 292143, 300344, 226617, 243003, 283963, 226628, 283973, 300357, 177482, 283983, 316758, 357722, 316766, 316768, 292192, 218464, 292197, 316774, 243046, 218473, 284010, 324978, 136562, 275834, 333178, 275836, 275840, 316803, 316806, 226696, 316811, 226699, 316814, 226703, 300433, 234899, 226709, 357783, 316824, 316826, 144796, 300448, 144807, 144810, 144812, 284076, 144814, 144820, 284084, 284087, 292279, 144826, 144828, 144830, 144832, 284099, 144835, 144837, 38342, 144839, 144841, 144844, 144847, 144852, 144855, 103899, 300507, 333280, 218597, 292329, 300523, 259565, 259567, 308720, 300527, 226802, 292338, 316917, 308727, 292343, 300537, 316933, 316947, 308757, 308762, 284191, 284194, 284196, 235045, 284199, 284204, 284206, 284209, 284211, 284213, 194101, 284215, 316983, 194103, 284218, 226877, 284223, 284226, 284228, 292421, 226886, 284231, 128584, 243268, 284234, 366155, 317004, 276043, 284238, 226895, 284241, 292433, 284243, 276052, 284245, 300628, 284247, 317015, 235097, 243290, 284251, 276053, 284253, 300638, 284255, 284249, 243293, 284258, 292452, 292454, 284263, 177766, 284265, 292458, 284267, 292461, 284272, 284274, 276086, 284278, 292470, 292473, 284283, 276093, 284286, 276095, 284288, 292481, 284290, 325250, 284292, 292485, 276098, 292479, 284297, 317066, 284299, 317068, 276109, 284301, 284303, 284306, 276114, 284308, 284312, 284314, 284316, 276127, 284320, 284322, 284327, 276137, 284329, 317098, 284331, 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, 284386, 358114, 358116, 276197, 317158, 358119, 284392, 325353, 284394, 358122, 284397, 276206, 284399, 358126, 358128, 358133, 358135, 276216, 358138, 300795, 358140, 284413, 358142, 284418, 317187, 358146, 317189, 317191, 284428, 300816, 300819, 317207, 284440, 186139, 300828, 300830, 276255, 325408, 300832, 300834, 284449, 317221, 227109, 358183, 186151, 276268, 300845, 194351, 243504, 300850, 284469, 276280, 325436, 358206, 276291, 366406, 276295, 300872, 153417, 292681, 284499, 276308, 284502, 317271, 178006, 276315, 292700, 284511, 227175, 292715, 300912, 284529, 292721, 300915, 284533, 292729, 317306, 284540, 292734, 325512, 169868, 276365, 284564, 358292, 284566, 317332, 399252, 350106, 284572, 276386, 284579, 276388, 358312, 284585, 317353, 276395, 292776, 292784, 276402, 358326, 161718, 276410, 276411, 358330, 276418, 276425, 301009, 301011, 301013, 292823, 301015, 301017, 358360, 292828, 276446, 153568, 276448, 276452, 276455, 292839, 350186, 292843, 276460, 276464, 178161, 276466, 227314, 276472, 350200, 325624, 317435, 276476, 276479, 276482, 350210, 276485, 317446, 178181, 276490, 350218, 292876, 350222, 317456, 276496, 317458, 243733, 317468, 243740, 317472, 325666, 243751, 292904, 276528, 178224, 243762, 309298, 325685, 325689, 235579, 276539, 235581, 178238, 325692, 276544, 284739, 243779, 292934, 243785, 276553, 350293, 350295, 309337, 194649, 227418, 194654, 227423, 350302, 178273, 227426, 309346, 309348, 350308, 227430, 276583, 309350, 350313, 309352, 301163, 350316, 309354, 276590, 292968, 227440, 350321, 284786, 276595, 301167, 350325, 350328, 292985, 301178, 292989, 301185, 292993, 350339, 317570, 317573, 350342, 350345, 350349, 301199, 317584, 325777, 350354, 350357, 350359, 350362, 276638, 350366, 284837, 153765, 350375, 350379, 350381, 350383, 129200, 350385, 350387, 350389, 350395, 350397, 350399, 227520, 350402, 227522, 301252, 350406, 227529, 309450, 301258, 276685, 309455, 276689, 309462, 301272, 276699, 309468, 194780, 309471, 301283, 317672, 317674, 325867, 243948, 194801, 227571, 309491, 309494, 243960, 227583, 276735, 227587, 276739, 211204, 276742, 227593, 227596, 325910, 309530, 342298, 276766, 211232, 317729, 276775, 211241, 325937, 276789, 325943, 211260, 260421, 276809, 285002, 276811, 235853, 276816, 235858, 276829, 276833, 391523, 276836, 276843, 293227, 276848, 293232, 186744, 211324, 227709, 285061, 366983, 317833, 178572, 285070, 285077, 178583, 227738, 317853, 276896, 317858, 342434, 285093, 317864, 285098, 276907, 235955, 276917, 293304, 293307, 293314, 309707, 293325, 129486, 317910, 293336, 235996, 317917, 293343, 358880, 276961, 227810, 293346, 276964, 293352, 236013, 293364, 301562, 293370, 317951, 309764, 301575, 121352, 236043, 317963, 342541, 55822, 113167, 317971, 309779, 309781, 277011, 55837, 227877, 227879, 293417, 227882, 309804, 293421, 105007, 236082, 285236, 23094, 277054, 244288, 219714, 129603, 318020, 301636, 301639, 301643, 277071, 285265, 399955, 309844, 277080, 309849, 285277, 285282, 326244, 318055, 277100, 309871, 121458, 277106, 170618, 170619, 309885, 309888, 277122, 227975, 285320, 277128, 301706, 318092, 326285, 334476, 318094, 277136, 277139, 227992, 318108, 285340, 318110, 227998, 137889, 383658, 285357, 318128, 277170, 342707, 154292, 277173, 318132, 293555, 285368, 277177, 277181, 318144, 277187, 277191, 277194, 277196, 277201, 342745, 137946, 342747, 113378, 203491, 228069, 277223, 342760, 56041, 285417, 56043, 56045, 277232, 228081, 56059, 310015, 285441, 310020, 285448, 310029, 228113, 285459, 277273, 293659, 326430, 228128, 293666, 285474, 228135, 318248, 277291, 318253, 293677, 285489, 301876, 293685, 285494, 301880, 285499, 301884, 310080, 293696, 277317, 277322, 277329, 162643, 310100, 301911, 301913, 277337, 301921, 400236, 236397, 162671, 326514, 310134, 277368, 15224, 236408, 416639, 416640, 113538, 310147, 416648, 39817, 187274, 277385, 301972, 424853, 277405, 277411, 310179, 293798, 293802, 236460, 277426, 276579, 293811, 293817, 293820, 203715, 326603, 342994, 276586, 293849, 293861, 228327, 228328, 228330, 318442, 228332, 326638, 277486, 351217, 318450, 293876, 293877, 285686, 302073, 285690, 244731, 121850, 293882, 302075, 293887, 277504, 277507, 277511, 277519, 293908, 293917, 293939, 318516, 277561, 277564, 310336, 7232, 293956, 277573, 228422, 310344, 277577, 293960, 277583, 203857, 310355, 293971, 310359, 236632, 277594, 138332, 277598, 285792, 203872, 277601, 310374, 203879, 310376, 228460, 318573, 203886, 187509, 285815, 285817, 367737, 302205, 285821, 392326, 285831, 253064, 302218, 285835, 294026, 384148, 162964, 187542, 302231, 285849, 302233, 285852, 302237, 285854, 285856, 302241, 285862, 277671, 302248, 64682, 277678, 294063, 294065, 302258, 277687, 294072, 318651, 294076, 277695, 318657, 244930, 302275, 130244, 302277, 228550, 302282, 310476, 302285, 302288, 310481, 302290, 203987, 302292, 302294, 302296, 384222, 310498, 285927, 318698, 302315, 195822, 228592, 294132, 138485, 204023, 228601, 204026, 228606, 204031, 64768, 310531, 285958, 228617, 138505, 318742, 204067, 277798, 130345, 277801, 113964, 285997, 384302, 285999, 277804, 113969, 277807, 277811, 318773, 318776, 277816, 286010, 277819, 294204, 417086, 277822, 286016, 302403, 294211, 384328, 277832, 277836, 146765, 326991, 277839, 277842, 277847, 277850, 179547, 277853, 146784, 277857, 302436, 277860, 294246, 327015, 310632, 327017, 351594, 277864, 277869, 277872, 351607, 310648, 277880, 310651, 277884, 277888, 310657, 310659, 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, 64966, 245191, 163272, 302534, 310727, 277959, 277963, 302541, 277966, 302543, 310737, 277971, 286169, 228825, 163290, 277978, 310749, 277981, 277984, 310755, 277989, 277991, 187880, 277995, 310764, 286188, 278000, 228851, 310772, 278003, 278006, 40440, 212472, 278009, 40443, 286203, 310780, 40448, 228864, 286214, 228871, 302603, 65038, 302614, 286233, 302617, 302621, 187936, 146977, 286240, 187939, 40484, 294435, 40486, 286246, 286248, 40488, 278057, 40491, 245288, 294439, 294440, 310831, 294443, 294445, 40499, 212538, 40507, 40511, 40513, 228933, 40521, 286283, 40525, 40527, 400976, 212560, 228944, 40533, 147032, 40537, 40539, 278109, 40541, 40544, 40548, 40550, 286312, 286313, 40552, 40554, 310892, 40557, 40560, 188022, 122488, 294521, 343679, 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, 229086, 278238, 286432, 294625, 294634, 302838, 319226, 286460, 171774, 278274, 302852, 278277, 302854, 311048, 294664, 352008, 319243, 311053, 302862, 319251, 302872, 294682, 278306, 188199, 294701, 278320, 319280, 319290, 229192, 302925, 188247, 188252, 237409, 294776, 360317, 294785, 327554, 360322, 40840, 40851, 294803, 188312, 294811, 319390, 40865, 319394, 294817, 294821, 311209, 180142, 294831, 188340, 40886, 319419, 294844, 294847, 237508, 393177, 294876, 294879, 294883, 393190, 294890, 311279, 278513, 237555, 278516, 311283, 278519, 237562 ]
9e00d36073913d3cfb7642ab33bb22c90203c564
fa6fa61b92018f67b69e2b078df71d500abcc2d0
/Delaney _ Mikayla/FBLA/FBLAUITests/FBLAUITests.swift
5b918dc3575ef9d763b2220a9a2650156e03a6db
[]
no_license
delaneybarrow/FBLA-Mobile-App-Development
dd09f9b158149493ad1f84810d6871466bf03007
856ba502202cd127e77d40458832b419adc0c11c
refs/heads/master
2020-05-02T22:59:02.167373
2019-03-28T19:54:59
2019-03-28T19:54:59
178,269,043
0
0
null
null
null
null
UTF-8
Swift
false
false
1,158
swift
// // FBLAUITests.swift // FBLAUITests // // Created by Delaney Barrow on 3/25/19. // Copyright © 2019 Delaney Barrow. All rights reserved. // import XCTest class FBLAUITests: XCTestCase { override func setUp() { // Put setup code here. This method is called before the invocation of each test method in the class. // In UI tests it is usually best to stop immediately when a failure occurs. continueAfterFailure = false // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. XCUIApplication().launch() // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. } func testExample() { // Use recording to get started writing UI tests. // Use XCTAssert and related functions to verify your tests produce the correct results. } }
[ 333827, 243720, 282634, 155665, 305173, 241695, 237599, 223269, 354342, 315431, 229414, 315433, 354346, 325675, 278571, 292901, 124974, 102446, 282671, 229425, 102441, 243763, 313388, 321589, 241717, 215095, 319543, 229431, 180279, 288829, 325695, 286787, 288835, 307269, 237638, 313415, 239689, 233548, 315468, 333902, 196687, 278607, 311377, 354386, 311373, 329812, 315477, 223317, 200795, 323678, 315488, 315489, 45154, 321632, 280676, 313446, 215144, 217194, 194667, 233578, 278637, 307306, 319599, 288878, 278642, 284789, 284790, 131190, 249976, 288890, 292987, 215165, 131199, 194692, 235661, 278669, 241809, 323730, 278676, 311447, 153752, 327834, 284827, 329884, 278684, 299166, 278690, 233635, 215204, 311459, 284840, 299176, 278698, 284843, 184489, 278703, 323761, 184498, 278707, 125108, 180409, 280761, 258233, 278713, 227517, 223418, 280767, 295099, 299197, 299202, 139459, 309443, 176325, 131270, 301255, 227525, 280779, 233678, 282832, 321744, 227536, 301271, 229591, 280792, 356575, 311520, 325857, 334049, 280803, 182503, 338151, 319719, 295147, 317676, 286957, 125166, 125170, 313595, 125180, 184574, 125184, 309504, 125192, 125197, 125200, 194832, 227601, 325904, 125204, 319764, 278805, 334104, 315674, 282908, 311582, 125215, 282912, 278817, 299294, 233761, 211239, 282920, 125225, 317738, 325930, 311596, 321839, 315698, 98611, 125236, 332084, 282938, 168251, 278843, 307514, 287040, 319812, 311622, 227655, 280903, 319816, 323914, 201037, 282959, 229716, 289109, 168280, 379224, 201562, 323934, 391521, 239973, 381286, 285031, 416103, 313703, 280938, 242027, 242028, 321901, 354671, 354672, 287089, 278895, 227702, 199030, 315768, 315769, 139641, 291194, 248188, 223611, 313726, 211327, 291200, 311679, 291193, 240003, 158087, 313736, 227721, 242059, 311692, 285074, 227730, 240020, 190870, 315798, 190872, 291225, 285083, 293275, 317851, 242079, 227743, 285089, 293281, 289185, 305572, 156069, 283039, 301482, 311723, 289195, 234957, 377265, 338359, 299449, 319931, 311739, 293309, 278974, 311744, 317889, 291266, 278979, 326083, 278988, 289229, 281038, 326093, 278992, 283089, 373196, 281039, 283088, 279000, 242138, 176602, 285152, 369121, 279009, 291297, 195044, 188899, 242150, 279014, 319976, 279017, 311787, 281071, 319986, 236020, 279030, 311800, 317949, 279042, 283138, 233987, 287237, 377352, 322057, 342537, 309770, 279053, 283154, 303635, 303634, 279061, 182802, 279066, 188954, 322077, 291359, 227881, 293420, 289328, 236080, 283185, 279092, 23093, 234037, 244279, 244280, 338491, 234044, 301635, 322119, 55880, 309831, 377419, 281165, 303693, 281170, 326229, 115287, 309847, 189016, 332379, 111197, 295518, 287327, 242274, 244326, 279150, 281200, 287345, 313970, 287348, 301688, 244345, 189054, 287359, 291455, 297600, 303743, 301702, 164487, 279176, 311944, 334473, 316044, 311948, 311950, 184974, 316048, 311953, 316050, 336531, 287379, 326288, 227991, 295575, 289435, 303772, 221853, 205469, 285348, 314020, 279207, 295591, 248494, 318127, 293552, 279215, 285362, 295598, 299698, 164532, 166581, 342705, 154295, 287412, 287418, 314043, 303802, 66243, 291529, 287434, 363212, 287438, 242385, 279249, 303826, 279253, 158424, 230105, 299737, 322269, 295653, 342757, 289511, 230120, 330473, 234216, 285419, 330476, 289517, 215790, 170735, 312046, 279278, 125683, 230133, 199415, 234233, 242428, 279293, 205566, 322302, 289534, 299777, 291584, 228099, 285443, 291591, 295688, 346889, 285450, 264971, 312076, 322312, 326413, 322320, 285457, 295698, 291605, 166677, 283418, 285467, 326428, 221980, 281378, 283431, 262952, 262953, 279337, 318247, 318251, 262957, 293673, 164655, 328495, 289580, 301872, 303921, 234290, 285493, 230198, 285496, 201534, 281407, 289599, 222017, 295745, 342846, 293702, 318279, 283466, 281426, 279379, 244569, 281434, 295769, 322396, 234330, 230238, 275294, 301919, 230239, 279393, 293729, 349025, 281444, 303973, 279398, 351078, 177002, 308075, 242540, 242542, 310132, 295797, 201590, 207735, 228214, 295799, 177018, 269179, 279418, 308093, 314240, 291713, 158594, 330627, 240517, 287623, 299912, 416649, 279434, 236427, 316299, 252812, 228232, 189327, 308111, 308113, 234382, 320394, 293780, 310166, 289691, 209820, 240543, 283551, 310177, 289699, 189349, 289704, 293801, 279465, 326571, 304050, 177074, 326580, 289720, 326586, 289723, 189373, 213956, 281541, 345030, 19398, 213961, 326602, 279499, 56270, 191445, 183254, 304086, 340967, 304104, 314343, 324587, 183276, 289773, 203758, 320492, 320495, 287730, 240631, 320504, 312313, 214009, 312317, 328701, 328705, 234499, 293894, 320520, 230411, 320526, 330766, 234513, 238611, 140311, 293911, 238617, 197658, 316441, 330789, 248871, 132140, 113710, 189487, 281647, 322609, 312372, 203829, 238646, 300087, 238650, 320571, 21567, 308288, 160834, 336962, 314437, 349254, 238663, 300109, 207954, 234578, 205911, 296023, 314458, 156763, 281698, 281699, 230500, 285795, 214116, 322664, 228457, 279659, 318571, 234606, 300145, 279666, 312435, 187508, 230514, 238706, 302202, 285819, 314493, 285823, 150656, 279686, 222344, 318602, 228492, 337037, 177297, 162962, 187539, 326803, 308375, 324761, 285850, 296091, 119965, 234655, 330912, 300192, 339106, 306339, 234662, 300200, 249003, 208044, 238764, 3243, 322733, 302251, 294069, 300215, 294075, 339131, 228541, 64699, 148674, 283846, 312519, 279752, 283849, 148687, 290001, 189651, 316628, 279766, 189656, 279775, 304352, 298209, 310496, 304353, 279780, 228587, 279789, 290030, 302319, 251124, 316661, 283894, 279803, 208123, 292092, 228608, 320769, 234756, 322826, 242955, 318732, 177420, 312588, 126229, 245018, 320795, 318746, 320802, 304422, 130342, 130344, 292145, 298290, 312628, 345398, 300342, 159033, 333114, 333115, 286012, 222523, 181568, 279872, 279874, 216387, 193858, 300354, 300355, 372039, 294210, 304457, 345418, 230730, 296269, 234830, 224591, 238928, 296274, 314708, 318804, 283990, 314711, 357720, 300378, 300379, 316764, 294236, 314721, 292194, 230757, 281958, 314727, 134504, 306541, 314734, 284015, 234864, 312688, 316786, 327023, 314740, 296304, 314742, 327030, 230772, 314745, 290170, 310650, 224637, 306558, 314752, 243073, 179586, 306561, 290176, 294278, 314759, 296328, 296330, 304523, 318860, 298378, 279955, 112019, 306580, 224662, 234902, 282008, 314776, 314771, 318876, 282013, 290206, 148899, 314788, 314790, 282023, 333224, 298406, 245160, 241067, 279980, 314797, 279979, 286128, 173492, 279988, 286133, 284090, 302523, 228796, 310714, 54719, 415170, 292291, 302530, 228804, 280003, 306630, 300488, 310725, 370122, 339403, 302539, 300490, 306634, 310731, 329168, 312785, 327122, 222674, 280020, 329170, 310735, 280025, 310747, 239069, 144862, 286176, 320997, 310758, 187877, 280042, 280043, 191980, 300526, 337391, 329198, 282097, 308722, 296434, 306678, 40439, 191991, 288248, 286201, 300539, 288252, 312830, 290304, 245249, 228868, 323079, 292359, 218632, 230922, 323083, 302602, 294413, 329231, 323088, 304655, 282132, 230933, 302613, 316951, 282135, 374297, 302620, 313338, 222754, 306730, 245291, 312879, 230960, 288305, 239159, 290359, 323132, 235069, 157246, 288319, 288322, 280131, 349764, 310853, 124486, 282182, 288328, 286281, 292426, 194118, 333389, 224848, 224852, 290391, 196184, 239192, 306777, 128600, 235096, 212574, 99937, 204386, 323171, 345697, 300643, 282214, 300645, 312937, 204394, 224874, 243306, 312941, 206447, 310896, 294517, 288377, 290425, 325246, 333438, 235136, 280193, 282244, 239238, 288391, 323208, 282248, 286344, 188049, 239251, 229011, 280217, 323226, 229021, 302751, 198304, 282272, 245413, 282279, 298664, 212649, 298666, 317102, 286387, 337590, 286392, 300729, 302778, 306875, 280252, 280253, 282302, 323262, 286400, 323265, 321217, 296636, 333508, 321220, 280259, 282309, 319176, 296649, 239305, 306891, 212684, 280266, 302798, 9935, 241360, 282321, 333522, 313042, 286419, 241366, 280279, 282330, 18139, 280285, 294621, 282336, 325345, 321250, 294629, 153318, 333543, 181992, 12009, 337638, 282347, 288492, 282349, 34547, 67316, 323315, 286457, 284410, 288508, 200444, 282366, 286463, 319232, 288515, 280326, 282375, 323335, 284425, 300810, 116491, 216844, 280333, 300812, 282379, 284430, 161553, 124691, 278292, 118549, 278294, 282390, 116502, 284436, 325403, 321308, 321309, 282399, 241440, 282401, 325411, 186148, 186149, 315172, 241447, 280011, 333609, 294699, 286507, 284460, 280367, 300849, 282418, 280373, 282424, 319289, 321338, 280377, 413500, 280381, 345918, 241471, 282428, 280386, 325444, 280391, 153416, 325449, 315209, 159563, 280396, 307024, 337746, 317268, 325460, 307030, 241494, 237397, 18263, 188250, 284508, 300893, 307038, 237411, 284515, 276326, 282471, 296807, 292713, 282476, 292719, 313200, 296815, 325491, 333687, 317305, 124795, 317308, 339840, 182145, 315265, 280451, 325508, 333700, 243590, 282503, 67464, 188293, 327556, 305032, 315272, 315275, 243592, 184207, 124816, 311183, 279218, 325514, 282517, 294806, 214936, 337816, 124826, 329627, 239515, 294808, 214943, 298912, 319393, 333727, 219046, 333734, 294824, 298921, 313257, 284584, 292783, 126896, 200628, 300983, 343993, 288698, 98240, 294849, 214978, 280517, 280518, 214983, 282573, 153553, 24531, 231382, 329696, 323554, 292835, 6116, 190437, 292838, 294887, 317416, 313322, 278507, 329707, 311277, 296942, 298987, 124912, 327666, 278515, 325620, 239610 ]
fc2f2b8b3eebd3d849232bcad064b1ff012a8fc9
3f94b4417c0342c13b34556e4ed5b568a4f86067
/Virtual-Tourist/MapViewController.swift
89868cbfe87dd63234fda7734f55cda302d13241
[]
no_license
MichaelJoo/VirtualTourist
e435344c12f740c64c6387d246df2df15e9e19f1
3ccce3f2fafcdb46e0c646194ce0c10505d36e39
refs/heads/master
2022-12-11T21:55:12.437607
2020-09-15T02:28:35
2020-09-15T02:28:35
274,718,158
0
0
null
null
null
null
UTF-8
Swift
false
false
14,765
swift
// // MapViewController.swift // Virtual-Tourist // // Created by Do Hyung Joo on 14/6/20. // Copyright © 2020 Do Hyung Joo. All rights reserved. // import Foundation import UIKit import MapKit import CoreLocation import CoreData final class MapViewController: UIViewController, MKMapViewDelegate, UIGestureRecognizerDelegate, NSFetchedResultsControllerDelegate { @IBOutlet weak var mapView: MKMapView! var fetchedResultsController: NSFetchedResultsController<Pin>! var indicator: ActivtyIndicator! let locationManager = CLLocationManager() let geoCoder = CLGeocoder() let regioninMeters: Double = 10000 let places = CLLocation() fileprivate func setupFetchedResultsController() { let fetchRequest:NSFetchRequest<Pin> = Pin.fetchRequest() let sortDescriptor = NSSortDescriptor(key: "creationDate", ascending: false) fetchRequest.sortDescriptors = [sortDescriptor] fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: DataController.shared.viewContext, sectionNameKeyPath: nil, cacheName: nil) fetchedResultsController.delegate = self do { try fetchedResultsController.performFetch() } catch { fatalError("The fetched could not be executed: \(error.localizedDescription)") } } private func loadPin(latitude: Double, longitude: Double) -> Pin? { let predicate = NSPredicate(format: "latitude == %@ AND longitude == %@", NSNumber(value: latitude), NSNumber(value: longitude)) var pin: Pin? do { try pin = fetchPin(predicate) } catch { print(error) } return pin } func fetchPin(_ predicate: NSPredicate, sorting: NSSortDescriptor? = nil) throws -> Pin? { let fr = NSFetchRequest<NSFetchRequestResult>(entityName: "Pin") fr.predicate = predicate if let sorting = sorting { fr.sortDescriptors = [sorting] } guard let pin = (try DataController.shared.viewContext.fetch(fr) as! [Pin]).first else { return nil } return pin } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. let gestureRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(self.handleTap(gestureRecognizer:))) gestureRecognizer.minimumPressDuration = 1.5 gestureRecognizer.delegate = self mapView.addGestureRecognizer(gestureRecognizer) mapView.delegate = self checkLocationServices() setupFetchedResultsController() changeActivityIndicatorMessage(message: "Downloading") } override func viewDidDisappear(_ animated: Bool) { super.viewDidDisappear(animated) fetchedResultsController = nil } func changeActivityIndicatorMessage (message: String) { indicator = ActivtyIndicator(inview:self.view,loadingViewColor: UIColor.gray, indicatorColor: UIColor.black, msg: message) self.view.addSubview(indicator!) } func setupLocationManager() { locationManager.delegate = self locationManager.desiredAccuracy = kCLLocationAccuracyBest } func centerViewUserLocation() { if let location = locationManager.location?.coordinate { let region = MKCoordinateRegion.init(center:location, latitudinalMeters: regioninMeters, longitudinalMeters: regioninMeters) mapView.setRegion(region, animated: true) } } func checkLocationServices() { if CLLocationManager.locationServicesEnabled() { setupLocationManager() checkLocationAuthorization() } else { //show alert to user to inform they have to turn location manager on } } func checkLocationAuthorization() { switch CLLocationManager.authorizationStatus() { case .authorizedWhenInUse: //make changes to fix the initial location for the app here //mapView.showsUserLocation = true centerViewUserLocation() locationManager.startUpdatingLocation() break case .denied: // show alert instructing them how to turn on permission break case .notDetermined: locationManager.requestWhenInUseAuthorization() break case .restricted: //show alert instruction them how to turn on permission break case .authorizedAlways: break @unknown default: fatalError() break } } @objc func handleTap(gestureRecognizer: UILongPressGestureRecognizer) { if gestureRecognizer.state == UIGestureRecognizer.State.ended { let location = gestureRecognizer.location(in: mapView) let coordinate = mapView.convert(location, toCoordinateFrom: mapView) // Add annotation: let annotation = MKPointAnnotation() annotation.coordinate = coordinate mapView.addAnnotation(annotation) //Add annotation to Pin Data model addPin(annotation: annotation) findAddress(annotation: annotation) { (String) in let pinData = Pin(context: DataController.shared.viewContext) pinData.title = annotation.title pinData.subtitle = annotation.subtitle pinData.latitude = annotation.coordinate.latitude pinData.longitude = annotation.coordinate.longitude pinData.creationDate = Date() try? DataController.shared.viewContext.save() print("findaddress executed") print(pinData.self) } } } func findAddress(annotation: MKPointAnnotation, completionHandler: @escaping (String) -> Void) { let locationforAdress = CLLocation(latitude: annotation.coordinate.latitude, longitude: annotation.coordinate.longitude) geoCoder.reverseGeocodeLocation(locationforAdress, completionHandler: { (placemarks, error) -> Void in if (error) == nil { // Place details var placeMark: CLPlacemark! placeMark = placemarks?[0] let address = "\(placeMark?.country ?? ""),\(placeMark?.subAdministrativeArea ?? ""), \(placeMark?.thoroughfare ?? ""), \(placeMark?.postalCode ?? "")" annotation.title = address completionHandler(address) } }) } func addPin(annotation: MKPointAnnotation) { let pinData = Pin(context: DataController.shared.viewContext) pinData.title = annotation.title pinData.subtitle = annotation.subtitle pinData.latitude = annotation.coordinate.latitude pinData.longitude = annotation.coordinate.longitude pinData.creationDate = Date() try? DataController.shared.viewContext.save() mapView.addAnnotation(annotation) print(pinData.self) addPhotos(Pin: pinData, longitude: pinData.longitude, latitude: pinData.latitude) } func addPhotos (Pin: Pin, longitude: Double, latitude: Double) { self.indicator!.start() VirtualTouristClient.SearchPhoto(longitude: longitude, Latitude: latitude) { (photo, error) in print("SearchPhoto API Executed") if photo.count == 0 { let alertVC = UIAlertController(title: "No Images", message: "No Image to display", preferredStyle: .alert) self.present(alertVC, animated: true, completion: nil) } else { for images in photo { let photoData = Photo(context: DataController.shared.viewContext) //let rawflickerImageURLAddress = "https://farm{\(images.farm)}.staticflickr.com/{\(images.server)}/{\(images.id)}_{\(images.secret)}.jpg" let flickerImageURLAddress = URL(string:"https://farm\(images.farm).staticflickr.com/\(images.server)/\(images.id)_\(images.secret).jpg")! photoData.pin = Pin photoData.creationDate = Pin.creationDate if let data = try? Data(contentsOf: flickerImageURLAddress) { print("activity indicator called") photoData.image = data print(photoData.image!) self.indicator!.stop() } print(photoData) try? DataController.shared.viewContext.save() } } } } } extension MapViewController: CLLocationManagerDelegate { func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { guard let location = locations.last else { return } let center = CLLocationCoordinate2D(latitude: location.coordinate.latitude, longitude: location.coordinate.longitude) let region = MKCoordinateRegion.init(center: center, latitudinalMeters: regioninMeters, longitudinalMeters: regioninMeters) mapView.setRegion(region, animated: true) } func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) { checkLocationAuthorization() } func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? { let pin = MKPointAnnotation() let reuseID = "pin" var pinView = mapView.dequeueReusableAnnotationView(withIdentifier: reuseID) as? MKPinAnnotationView if pinView == nil { pinView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "pin") pinView!.pinTintColor = .red pinView!.animatesDrop = true pinView!.isDraggable = true pinView!.canShowCallout = true pinView!.rightCalloutAccessoryView = UIButton(type: .detailDisclosure) } else { pinView!.annotation = annotation } mapView.addAnnotation(pin) return pinView } func mapView(_ mapView: MKMapView, annotationView view: MKAnnotationView, didChange newState: MKAnnotationView.DragState, fromOldState oldState: MKAnnotationView.DragState) { if newState == MKAnnotationView.DragState.ending || newState == MKAnnotationView.DragState.canceling { view.dragState = MKAnnotationView.DragState.none let newAnnotation = MKPointAnnotation() newAnnotation.coordinate = view.annotation!.coordinate mapView.removeAnnotation(view.annotation!) findAddress(annotation: newAnnotation) { (String) in let pinData = Pin(context: DataController.shared.viewContext) pinData.title = newAnnotation.title pinData.subtitle = newAnnotation.subtitle pinData.latitude = newAnnotation.coordinate.latitude pinData.longitude = newAnnotation.coordinate.longitude pinData.creationDate = Date() try? DataController.shared.viewContext.save() mapView.addAnnotation(newAnnotation) print(pinData.self) self.addPhotos(Pin: pinData, longitude: pinData.longitude, latitude: pinData.latitude) } } } func mapView(mapView: MKMapView!, annotationView view: MKAnnotationView!, didChangeDragState newState: MKAnnotationView.DragState, fromOldState oldState: MKAnnotationView.DragState) { switch (newState) { case .starting: view.dragState = .dragging print("dragging started") case .ending, .canceling: view.dragState = .none print("dragstate ending started") default: break } } func mapView(_ mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control: UIControl) { //TBD to segue to PhotoAlbumView Controller let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil) let PhotoAlbumViewController = storyBoard.instantiateViewController(withIdentifier: "PhotoAlbumView") as! PhotoAlbumViewController let annotation = mapView.selectedAnnotations[0] let lat = annotation.coordinate.latitude let long = annotation.coordinate.longitude let pinDataUponClick = loadPin(latitude: lat, longitude: long) PhotoAlbumViewController.pinData = pinDataUponClick self.present(PhotoAlbumViewController, animated: true, completion: nil) //fault meaning - Managed objects typically represent data held in a persistent store. In some situations a managed object may be a fault—an object whose property values have not yet been loaded from the external data store. Faulting reduces the amount of memory your application consumes. //A fault is a placeholder object that represents a managed object that has not yet been fully realized, or a collection object that represents a relationship: //None of the photos added to the pin has been realized due to "fault". It is unclear why the photos were still "unrealized in PhotoAlbumViewController" because one of its property, imageURL has been accessed to populate collection View cell. } }
[ -1 ]
4be7743c8bb31539808a0c7a851c6945413d111f
2905f816984f39d8857b7cc7655ce211c08c246a
/FriendlyGuide/App/BusinessLogic/Network/Factories/Cities/CityNames/GetCityNamesFactory.swift
e6fa19fefa62531c57fa3bd1b769f6cfadc76846
[]
no_license
AlexanderPLv/FriendlyGuide
b5b7a9a041d11c91fc199d3dbd64a0c4c9fa4a74
e36b3c50f76032d3fe8f4add39e6b72da52c1550
refs/heads/master
2023-06-20T13:29:41.464162
2021-07-10T20:23:23
2021-07-10T20:23:23
384,769,230
0
0
null
null
null
null
UTF-8
Swift
false
false
251
swift
// // GetCityNamesFactory.swift // FriendlyGuide // // Created by Alexander Pelevinov on 24.05.2021. // import Foundation protocol GetCityNamesFactory { func load( completionHandler: @escaping (Result<[CityName], NetworkingError>) -> Void) }
[ -1 ]
efcf04ff4deedbe2916c81e54cbe442083f30015
e14b0637082a4b0f27de70784525a94b136932fa
/TransactionIntents/IntentHandler.swift
8f8387f9c187ebc8aeb6799449a843232a93db58
[]
no_license
juuuuuun/Money.io
de7fdc518d7dbaa7b99950025f218cfdec2c1930
fdab0b28e79ba1568f1b29e0dfb64ac4c4bcdb7c
refs/heads/master
2020-04-28T19:36:27.869940
2019-03-14T01:50:52
2019-03-14T01:50:52
175,516,854
1
0
null
2019-03-13T23:57:10
2019-03-13T23:57:10
null
UTF-8
Swift
false
false
1,470
swift
// // IntentHandler.swift // TransactionIntents // // Created by Matthew Chan on 2019-03-09. // Copyright © 2019 Matthew Chan. All rights reserved. // import Intents class CreateTransactionIntentHandler: NSObject, CreateNewTransactionIntentHandling { func confirm(intent: CreateNewTransactionIntent, completion: @escaping (CreateNewTransactionIntentResponse) -> Void) { completion(CreateNewTransactionIntentResponse(code: .ready, userActivity: nil)) } func handle(intent: CreateNewTransactionIntent, completion: @escaping (CreateNewTransactionIntentResponse) -> Void) { guard let name = intent.name else { return } guard let amount = intent.amount else { return } guard let paidUser = intent.paidUser else { return } guard let splitUsers = intent.splitUsers else { return } // let printIntentStatment = print("Intent Handler: Created \(amount) dollars \(name) transaction between \(paidUser) and \(splitUsers).") // print(printIntentStatment) print("Intent Handler: \(name)") completion(CreateNewTransactionIntentResponse(code: .success, userActivity: nil)) } } class IntentHandler: INExtension { override func handler(for intent: INIntent) -> Any { guard intent is CreateNewTransactionIntent else { fatalError("Unhandled intent.") } return CreateNewTransactionIntent() } }
[ -1 ]
36f9a9370b389919c6480b2becadb82f849933f4
832938d1e644bff88a154a94d27940f8f5144b1f
/IxigoDemo/Model/RealmBaseUtils.swift
557b6b26d8c9981c92dad15156bd7d94aebc999d
[]
no_license
sanchitgarg1909/IxigoDemo
4d549cdbd6bc5d5538ad7afe60b1bb644869e69b
ae075a8f92d17e3f40da357d2e8920b15ee362c8
refs/heads/master
2020-06-13T10:12:35.919449
2019-07-01T07:40:14
2019-07-01T07:40:14
194,623,981
0
0
null
null
null
null
UTF-8
Swift
false
false
4,834
swift
// // RealmBaseUtils.swift // IxigoDemo // // Created by Sanchit Garg on 01/07/19. // Copyright © 2019 Sanchit Garg. All rights reserved. // import RealmSwift class RealmBaseUtils { class func realmConfig() -> Realm.Configuration { return Realm.Configuration(schemaVersion: 1, migrationBlock: { (migration, oldSchemaVersion) in }, deleteRealmIfMigrationNeeded: true, shouldCompactOnLaunch: { (totalBytes, usedBytes) -> Bool in return true }) } static var isFirstTime = true private class func realmInstance() -> Realm { do { if isFirstTime { let realm = try Realm(configuration: realmConfig()) isFirstTime = false realm.invalidate() } let newRealm = try Realm(configuration: realmConfig()) return newRealm } catch { if isFirstTime { deleteRealmFiles(atURL: Realm.Configuration.defaultConfiguration.fileURL!) } return try! Realm(configuration: realmConfig()) } } class func write(_ block: @escaping ((Realm) -> Void)) { autoreleasepool { let currentRealm = realmInstance() if currentRealm.isInWriteTransaction { return } else { try! currentRealm.write { block(currentRealm) } } } } class func update(_ object: Object, block: @escaping (() -> Void)) { if object.isInvalidated { return } RealmBaseUtils.write { (realmInstance) in if object.isInvalidated { return } block() } } class func add(_ object: Object, updatesAllowed update: Bool = true) { RealmBaseUtils.write { (realmInstance) in realmInstance.add(object, update: update) } } class func add<S: Sequence>(_ objects: S, updatesAllowed update: Bool = true) where S.Iterator.Element: Object { RealmBaseUtils.write { (realmInstance) in realmInstance.add(objects, update: update) } } class func delete(_ object: Object) { RealmBaseUtils.write { (realmInstance) in if object.isInvalidated { return } realmInstance.delete(object) } } class func delete<S: Sequence>(_ objects: S) where S.Iterator.Element: Object { RealmBaseUtils.write { (realmInstance) in realmInstance.delete(objects) } } class func delete(fromEntity entityClass: Object.Type, withPredicate predicate: NSPredicate? = nil) { RealmBaseUtils.delete(RealmBaseUtils.get(fromEntity: entityClass, withPredicate: predicate)) } class func delete(fromEntity entityClass: Object.Type, withPrimaryKey primaryKey: String) { if let object = RealmBaseUtils.get(fromEntity: entityClass, withPrimaryKey: primaryKey) { RealmBaseUtils.delete(object) } } class func get<R: Object>(fromEntity entityClass : R.Type, withPredicate predicate: NSPredicate? = nil, sortedByKey sortKey: String? = nil, inAscending isAscending: Bool = true) -> Results<R> { var objects = realmInstance().objects(entityClass) if predicate != nil { objects = objects.filter(predicate!) } if sortKey != nil { objects = objects.sorted(byKeyPath: sortKey!, ascending: isAscending) } return objects } class func getFirst<R: Object>(fromEntity entityClass : R.Type, withPredicate predicate: NSPredicate? = nil, sortedByKey sortKey: String? = nil, inAscending isAscending: Bool = true) -> R? { var objects = realmInstance().objects(entityClass) as Results<R> if predicate != nil { objects = objects.filter(predicate!) } if sortKey != nil { objects = objects.sorted(byKeyPath: sortKey!, ascending: isAscending) } return objects.first } class func get<R: Object>(fromEntity entityClass : R.Type, withPrimaryKey primaryKey: String) -> R? { return realmInstance().object(ofType: entityClass, forPrimaryKey: primaryKey as AnyObject) } class func deleteRealmFiles(atURL realmURL: URL) { let realmURLs = [ realmURL, realmURL.appendingPathExtension("lock"), realmURL.appendingPathExtension("note"), realmURL.appendingPathExtension("management") ] for path in realmURLs { try? FileManager.default.removeItem(at: path) } } }
[ -1 ]
b768fa75f7a568dcc25e71ee70b0d3748ea02a9d
3b50bd1a92ad067fc0c9dac9e3bc5b1ce8198d0d
/viewTransition/SecondViewController.swift
cc46c94688b1c755b51c295173d89475d78b2966
[]
no_license
Kimminjong94/viewTransition
d90dc09aec816f8a2bf86e6050cff43ab5124274
0dcbb5fed924a128f8bf5f4e5c7fc8ba60deed06
refs/heads/main
2023-08-29T21:00:44.167203
2021-11-10T04:07:51
2021-11-10T04:07:51
426,478,808
0
0
null
null
null
null
UTF-8
Swift
false
false
1,196
swift
// // SecondViewController.swift // viewTransition // // Created by 김민종 on 2021/08/07. // import UIKit class SecondViewController: UIViewController { class SecondViewController:UIViewController { @IBOutlet weak var nameLabel: UILabel! @IBOutlet weak var ageLabel: UILabel! override func viewDidLoad() { super.viewDidLoad() print("SecondViewController의 View가 메모리에 로드 됨") } } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } @IBAction func popToPrev() { self.navigationController?.popViewController(animated: true) } @IBAction func dissmissModal() { self.dismiss(animated: true, completion: nil) } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destination. // Pass the selected object to the new view controller. } */ }
[ -1 ]
e4086c0cbd5642d37cc79b5ef8824425ca5dfded
f3775302342654ad685a02b5c8e65a60bfdd6bb3
/Sources/Model/Token.swift
1eb956b64e35642971fdb35dd2f75e9d2a89686b
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
permissive
mobgen/halo-ios
3ba3726c4dbf725f9b9e5cf049bc0bc88665a1ec
b27e8be9a0d13b396575887061cb8c0fc38f8ffb
refs/heads/master
2021-07-17T05:04:40.615851
2020-01-27T09:47:57
2020-01-27T09:47:57
77,059,230
1
6
Apache-2.0
2019-05-02T14:20:14
2016-12-21T14:36:29
Swift
UTF-8
Swift
false
false
2,818
swift
// // HaloToken.swift // HaloSDK // // Created by Borja on 28/07/15. // Copyright © 2015 MOBGEN Technology. All rights reserved. // import Foundation 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 } } /** Class holding all the information related to the authentication token */ @objc(HaloToken) open class Token: NSObject, NSCoding { struct Keys { static let AccessToken = "access_token" static let RefreshToken = "refresh_token" static let TokenType = "token_type" static let ExpiresIn = "expires_in" } /// Access token open var token: String? /// Refresh token open var refreshToken: String? /// Type of the auth token open var tokenType: String? /// Expiration date of this authentication token open var expirationDate: Date? override init() { super.init() } public required init?(coder aDecoder: NSCoder) { super.init() token = aDecoder.decodeObject(forKey: Keys.AccessToken) as? String refreshToken = aDecoder.decodeObject(forKey: Keys.RefreshToken) as? String tokenType = aDecoder.decodeObject(forKey: Keys.TokenType) as? String expirationDate = aDecoder.decodeObject(forKey: Keys.ExpiresIn) as? Date } public func encode(with aCoder: NSCoder) { aCoder.encode(token, forKey: Keys.AccessToken) aCoder.encode(refreshToken, forKey: Keys.RefreshToken) aCoder.encode(tokenType, forKey: Keys.TokenType) aCoder.encode(expirationDate, forKey: Keys.ExpiresIn) } /** Initialise a HaloToken from a given dictionary - parameter dict: Dictionary containing all the token related information */ open static func fromDictionary(_ dict: [String: Any]) -> Token { let token = Token() token.token = dict[Keys.AccessToken] as? String token.refreshToken = dict[Keys.RefreshToken] as? String token.tokenType = dict[Keys.TokenType] as? String if let expire = dict[Keys.ExpiresIn] as? NSNumber { token.expirationDate = Date().addingTimeInterval(expire.doubleValue/1000) } return token } /** Utility function to check whether the current token has expired or not - returns: Boolean determining whether the token has expired or not */ open func isExpired() -> Bool { return expirationDate?.timeIntervalSince(Date()) < 0 } /** Utility function to check whether the current token is still valid or not - returns: Boolean determining whether the token is still valid or not */ open func isValid() -> Bool { return !isExpired() } }
[ -1 ]
e1db3d4babd754a8b19b7a9101322d1228044c06
7dab91a7f471b71a999c78895dc7c4916724d8d0
/BeerPong/UserSearchResult/UserSearchResultCell.swift
4fca984970357713240f79baa3fe100820295b9f
[]
no_license
zsoltpete/BeerPong
ee51fad30a56a0fb7891debf49714fef06a3dfbc
64647531d86329b54ce0ce9f50a11e92388a60e3
refs/heads/master
2021-07-01T05:13:35.663685
2017-09-19T20:20:15
2017-09-19T20:20:15
103,432,842
0
0
null
null
null
null
UTF-8
Swift
false
false
721
swift
// // UserSearchResultCell.swift // BeerPong // // Created by Zsolt Pete on 2017. 09. 19.. // Copyright © 2017. Zsolt Pete. All rights reserved. // import UIKit import RxSwift import RxCocoa import NSObject_Rx class UserSearchResultCell: UITableViewCell { @IBOutlet weak var nameLabel: UILabel! var viewModel: UserSearchResultViewModel = UserSearchResultViewModel() override func awakeFromNib() { super.awakeFromNib() self.bindComponents() } func bindComponents(){ self.viewModel.name.asObservable().bind(to: self.nameLabel.rx.text).addDisposableTo(rx.disposeBag) } func bind(to model: Player){ self.viewModel.model = model } }
[ -1 ]
c0bd7e71820ebf63d5867653850d005236a30333
31060fe97d53f6789a7f736d9fbd8b8f2b1f92ab
/19-core-image-kernels/FilterBuilder/FilterBuilder/SobelViewController.swift
802e24c4cd601daa58f873de43b720c3090de313
[ "LicenseRef-scancode-unknown-license-reference", "CC-BY-4.0", "Apache-2.0" ]
permissive
agrippa1994/iOS8-day-by-day
294f50a196a09cc9b06279e4ad2dcfb8fc593192
1bee7d51c127485344e7a6e00b145028b290cd02
refs/heads/master
2021-01-15T12:55:17.447251
2014-09-13T13:13:37
2014-09-13T13:13:37
24,000,459
1
0
null
null
null
null
UTF-8
Swift
false
false
1,408
swift
// // Copyright 2014 Scott Logic // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // import UIKit class SobelViewController: UIViewController { // MARK: - Properties let filter = SobelFilter() // MARK: - IBOutlets @IBOutlet weak var outputImageView: UIImageView! // MARK: - Lifecycle override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. setupFilter() updateOutputImage() } // MARK: - Utility methods private func updateOutputImage() { outputImageView.image = filteredImage() } private func filteredImage() -> UIImage { let outputImage = filter.outputImage return UIImage(CIImage: outputImage) } private func setupFilter() { // Need an input image let inputImage = UIImage(named: "flowers") filter.inputImage = CIImage(image: inputImage) } }
[ 203921 ]
78bea624562489b50eeb3401238bc8da75635dbd
ce31432240d3c71a552b70b4582e6e5b13f1876a
/Spotify/Views/TitleHeaderCollectionReusableView.swift
ff68e6a335eae04fe7f43c0f7cef694e6c3bc53e
[ "MIT" ]
permissive
Godfrey48/Spotify
6f8bc11d1d16c79192212dbeeafa8ae2c1038ef1
63d978230e59b939dfc00a72c4afdab5f8aecf60
refs/heads/main
2023-05-31T07:09:47.999810
2021-06-14T09:01:15
2021-06-14T09:01:15
376,767,207
2
0
null
2021-06-14T09:19:10
2021-06-14T09:19:09
null
UTF-8
Swift
false
false
931
swift
// // TitleHeaderCollectionReusableView.swift // Spotify // // Created by Sree Sai Raghava Dandu on 01/05/21. // import UIKit class TitleHeaderCollectionReusableView: UICollectionReusableView { static let identifier = "TitleHeaderCollectionReusableView" private let label: UILabel = { let label = UILabel() label.textColor = .label label.numberOfLines = 1 label.font = .systemFont(ofSize: 22, weight: .regular) return label }() //Init override init(frame: CGRect) { super.init(frame: frame) backgroundColor = .systemBackground addSubview(label) } required init?(coder: NSCoder) { fatalError() } override func layoutSubviews() { super.layoutSubviews() label.frame = CGRect(x: 15, y: 0, width: width-30, height: height) } func configure(with title: String){ label.text = title } }
[ -1 ]
eeeb9a30477c9af8eeb335ee3781f2d26ad01d4e
a869d085a25c50c49b1eaa26be2702f9c8830a39
/iCCUT/Module/Network/Controller/CCNetworkController.swift
9d7767bf1cda193325bd64c3909f4e381324b767
[]
no_license
Maru-zhang/iCCUT
89d0ad99e21cfca753ade21c4ad6f79520388aa9
bfe85258efb731ed5dee1168d08aec3138589851
refs/heads/master
2021-01-15T08:31:45.497706
2016-06-17T02:50:03
2016-06-17T02:50:03
42,911,211
1
1
null
null
null
null
UTF-8
Swift
false
false
6,476
swift
// // CCNetworkController.swift // iCCUT // // Created by Maru on 15/9/22. // Copyright © 2015年 Alloc. All rights reserved. // import UIKit import Alamofire import SCLAlertView class CCNetworkController: UIViewController { /** HTTP管理 */ let client = CCHTTPClient.getInstance() /** 时间标签 */ @IBOutlet weak var timeLable: UILabel! /** 流量标签 */ @IBOutlet weak var flowLable: UILabel! /** 费用标签 */ @IBOutlet weak var feeLable: UILabel! /** 注销按钮 */ @IBOutlet weak var cancelButton: UIButton! /** 约束 */ @IBOutlet weak var loginButtonConstraints: NSLayoutConstraint! /** 默认属性 */ @IBOutlet weak var wifiLogo: UIImageView! let defaultText = "暂无数据" // MARK: - Life Cycle override func viewDidLoad() { super.viewDidLoad() } override func viewWillAppear(animated: Bool) { super.viewWillAppear(animated) setupView() setupSetting() } override func viewDidAppear(animated: Bool) { super.viewDidAppear(animated) Alamofire.request(.GET, SCHOOL_GATE) .response { request, response, data, error in if error == nil { // 成功 let pageContent = NSString(data: data!, encoding: KCodeGB2312) //检查是已经登陆还是还没有登陆 self.client.parser.parseHTMLWithPageString(pageContent!) if self.client.parser.loginStatus == CCUTLoginStatus.UnLogin { //还没有登陆 self.autoLoginOrNot() }else if self.client.parser.loginStatus == CCUTLoginStatus.Sucess { //已经登陆 self.updateFlowData() } }else { // 失败 SCLAlertView.showNetworkErrorView() } } } // < Action > @IBAction func cancelClick(sender: AnyObject) { if cancelButton.selected { //显示登陆界面 let loginVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("login") presentViewController(loginVC, animated: true, completion: nil) cancelButton.selected = false }else { let alerView = SCLAlertView() alerView.showCloseButton = false //登出成功和登出失败 client.logout({ (isSuccess) -> Void in if isSuccess { alerView.showError("注销成功!", subTitle: "",duration: 0.6) self.cancelButton.selected = true self.showDefaultLlowData() }else { alerView.showError("注销失败!", subTitle: "",duration: 0.6) self.cancelButton.selected = false } }) } } // <Private Method> func setupView() { //检测当前手机的类型 if SCREEN_BOUNDS.size.height == 568 { // iPhone5/5S loginButtonConstraints.constant = 20 view.layoutIfNeeded() } self.cancelButton.setTitle("登陆", forState: UIControlState.Selected) self.cancelButton.setTitle("注销", forState: UIControlState.Normal) } // Private Method private func setupSetting() { tabBarController?.navigationItem.title = tabBarItem.title tabBarController?.navigationItem.rightBarButtonItem = nil wifiLogo.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(updateFlowData))) } func updateFlowData() { // 更新数据 client.updateQueryLoginPage { (isConnect) -> Void in guard isConnect else { SCLAlertView.showNetworkErrorView() return } // 检测数据正确性 if self.client.resultArray != nil { self.showLatestFlowData() }else { self.showDefaultLlowData() } } } func autoLoginOrNot() { let userDefault = NSUserDefaults.standardUserDefaults() let account = userDefault.objectForKey(KACCOUNT) let password = userDefault.objectForKey(KPASSWORD) if (NSUserDefaults.standardUserDefaults().boolForKey(AutoLoginKey)) && (account != nil){ //可以自动登陆 client.loginWithAccountAndPassword(account as! NSString, pwd: password as! NSString, completeHandler: { (isSuccess) -> Void in //查看是否登陆成功 if self.client.parser.loginStatus == CCUTLoginStatus.Sucess { //刷新 self.updateFlowData() self.cancelButton.selected = false }else { //登陆失败 let alerView = SCLAlertView() alerView.showCloseButton = false alerView.showError("登陆失败!", subTitle: "",duration: 0.6) self.cancelButton.selected = true } }) } } //显示最新的数据或者显示默认的数据 private func showDefaultLlowData() { timeLable.text = defaultText flowLable.text = defaultText feeLable.text = defaultText } private func showLatestFlowData() { //获取对印的数值 let time = client.resultArray![0] as! NSNumber let flow = client.resultArray![1] as! NSNumber let menoy = client.resultArray![2] as! NSNumber timeLable.text = NSString(format: "%d分钟", time.integerValue) as String flowLable.text = NSString(format: "%d MByte", flow.integerValue) as String feeLable.text = NSString(format: "%d元", menoy.integerValue) as String } }
[ -1 ]
ba8b7ae9a4431641376feb638ee9f9a2a468f966
7c762d9163732f87d9cdfbb3a1987a3de02d3cfb
/Breathing App/Source Code/Feb 20/27-2-20/BreathingApp/BreathingApp/RecordVC.swift
ed8c2727fccbba86ecb9948bc38ead02a9e046e1
[]
no_license
ChethanSuputhraS/BreateApp
e3a0633424bb07f95ebdbcafb0715960078f9786
aa21b2f36fef64c31b2a354261e832951750ea25
refs/heads/master
2023-06-15T13:54:29.131255
2021-07-21T06:04:03
2021-07-21T06:04:03
388,010,090
0
0
null
null
null
null
UTF-8
Swift
false
false
29,845
swift
// // RecordVC.swift // BreathingApp // // Created by stuart watts on 12/02/2020. // Copyright © 2020 Ashwin. All rights reserved. // import UIKit import CoreBluetooth var rawChart: LineChart! var smoothChart: LineChart! var listPeripheralsConnected = stretchsenseObject.getListPeripheralsConnected() var numberOfSample = stretchsenseObject.numberOfSample var numberOfThePeripheralToUpdate = 0 var valueAverage : UInt8 = 0 var newConnection : Bool = false var previousNumberOfPeripheral = 0 var defaultValueOfTheNewSensor : CGFloat = 0 var timestampSampleRelativeTime = 0.0 var startTime = TimeInterval() class RecordVC: UIViewController { var sampleNumberC = 0 var sampleNumberA = 0 var isRecording = false var sentenceToRecord = "" var allRecordedChest : [String] = [] var allRecordedAbd : [String] = [] var circleChest : UILabel! var circleAbdome : UILabel! // var visualview : UIView! let rawView = UIView() let smoothView = UIView() let visualview = UIView() //css let bottomView = UIView() let btnRaw = UIButton() let btnTimer = UIButton() let btnSmooth = UIButton() let btnVisual = UIButton() let imgRaw = UIImageView() let imgSmooth = UIImageView() let imgVisual = UIImageView() let viewSessionTime = UIView() var btnBack = UIButton() var btnGraphTouch = UIButton() var popViewAlert = UIView() var btnEndSession = UIButton() var btnContinueSession = UIButton() var lblTime = UILabel() var count1 = 01 var timer : Timer? var viewType = 1 var chestTimer : Timer? var abdTimer : Timer? var isChestAllow = false var isAbdAllow = false override func viewDidLoad() { //Navigation View Setup self.navigationController?.isNavigationBarHidden = true self.view.backgroundColor = UIColor.init(red: 5.0/255, green: 56.0/255, blue: 83.0/255, alpha: 1) //BLE Initialization self.BLEInitMethod() self.SetTopHintView() self.SetupBottomView() btnBack.frame = CGRect(x: 0, y: 10, width: 50, height: 65) btnBack.setTitleColor(.white, for: .normal) btnBack.addTarget(self, action: #selector(btnBackClick), for: .touchUpInside) btnBack.setImage(UIImage.init(named: "back.png"), for: .normal) self.view.addSubview(btnBack) // for image purpose i did width and heigt less then i create image view for that..... btnTimer.frame = CGRect(x: constants.widths-40, y: 25, width: 20, height: 35) btnTimer.setTitleColor(.white, for: .normal) btnTimer.addTarget(self, action: #selector(btnTimerClick), for: .touchUpInside) btnTimer.setImage(UIImage.init(named: "timer.png"), for: .normal) self.view.addSubview(btnTimer) let viewHeight = constants.heighs-70-140 rawView.frame = CGRect(x: 0, y: 140, width: constants.widths, height: viewHeight) rawView.backgroundColor = UIColor.clear self.view.addSubview(rawView) let chartHeight = constants.widths * 0.853 rawChart = LineChart() rawChart.frame = CGRect(x: 0, y: (rawView.frame.height-chartHeight)/2, width: constants.widths, height: constants.widths * 0.853) rawChart.area = true rawChart.x.grid.count = 1 rawChart.y.grid.count = 1 rawChart.autoMinMax = false rawChart.translatesAutoresizingMaskIntoConstraints = true self.rawView.addSubview(rawChart) var views: [String: AnyObject] = [:] views["chart"] = rawChart smoothView.frame = CGRect(x: 0, y: 140, width: constants.widths, height: viewHeight) smoothView.backgroundColor = UIColor.clear smoothView.isHidden = true self.view.addSubview(smoothView) smoothChart = LineChart() smoothChart.frame = CGRect(x: 0, y: (smoothChart.frame.height-chartHeight)/2, width: constants.widths, height: constants.widths * 0.853) smoothChart.area = true smoothChart.x.grid.count = 1 smoothChart.y.grid.count = 1 smoothChart.autoMinMax = false smoothChart.translatesAutoresizingMaskIntoConstraints = true self.smoothView.addSubview(smoothChart) var views1: [String: AnyObject] = [:] views1["chart"] = smoothChart visualview.frame = CGRect(x: 0, y: 140, width: constants.widths, height: viewHeight) visualview.backgroundColor = UIColor.clear visualview.isHidden = true self.view.addSubview(visualview) circleChest = UILabel() circleChest.frame = CGRect(x: (visualview.frame.width-300)/2, y: (visualview.frame.height-300)/2, width: 300, height: 300) circleChest.backgroundColor = UIColor.clear circleChest.layer.masksToBounds = true circleChest.layer.cornerRadius = 150 circleChest.layer.borderWidth = 2.0 circleChest.layer.borderColor = UIColor.init(red: 106.0/255, green: 227.0/255, blue: 255.0/255, alpha: 1).cgColor visualview.addSubview(circleChest) circleAbdome = UILabel() circleAbdome.frame = CGRect(x: (visualview.frame.width-240)/2, y: (visualview.frame.height-240)/2, width: 240, height: 240) circleAbdome.backgroundColor = UIColor.clear circleAbdome.layer.masksToBounds = true circleAbdome.layer.cornerRadius = 120 circleAbdome.layer.borderWidth = 2.0 circleAbdome.layer.borderColor = UIColor.yellow.cgColor visualview.addSubview(circleAbdome) btnGraphTouch.frame = CGRect(x: 0, y: 140, width: constants.widths, height: viewHeight) btnGraphTouch.addTarget(self, action: #selector(btnGraphTouchClick), for: .touchUpInside) btnGraphTouch.backgroundColor = UIColor.clear self.view.addSubview(btnGraphTouch) timer = Timer.scheduledTimer(timeInterval: 1.0,target: self,selector: #selector(timerAction),userInfo: nil,repeats: true) chestTimer = Timer.scheduledTimer(timeInterval: 0.10,target: self,selector: #selector(chestTimerAction),userInfo: nil,repeats: true) abdTimer = Timer.scheduledTimer(timeInterval: 0.10,target: self,selector: #selector(abdTimerAction),userInfo: nil,repeats: true) self.SetupPopupMethod() super.viewDidLoad() // Do any additional setup after loading the view. } @objc func chestTimerAction() { isChestAllow = true } @objc func abdTimerAction() { isAbdAllow = true } @objc func BLEInitMethod() { let defaultCenter = NotificationCenter.default defaultCenter.addObserver(self, selector: #selector(newValueDetected), name: NSNotification.Name(rawValue: "UpdateValueNotification"),object: nil) defaultCenter.addObserver(self, selector: #selector(self.newInfoDetected), name: NSNotification.Name(rawValue: "UpdateInfo"),object: nil) let listPeripheralsAvailable = stretchsenseObject.getListPeripheralsAvailable() // for testing in simulator commented this code for i in 0...listPeripheralsAvailable.count-1 { let p = listPeripheralsAvailable[i] stretchsenseObject.discoverServicesforPeripherals(periph: p!) } } @objc func SetupBottomView() { let btnWidth = constants.widths/3 var yViewButtom = CGFloat(constants.heighs-70) if (constants.IS_IPHONE_X) { yViewButtom = yViewButtom - 20 } bottomView.frame = CGRect(x: 0, y: yViewButtom, width: constants.widths, height: 70) bottomView.backgroundColor = UIColor.clear self.view.addSubview(bottomView) //For Raw imgRaw.frame = CGRect(x: (btnWidth-30)/2, y: 15, width: 35, height: 30) imgRaw.image = UIImage.init(named: "Raw.png") bottomView.addSubview(imgRaw) btnRaw.frame = CGRect(x: 0, y: 0, width: btnWidth, height: 70) self.setButtonProperties(btnRaw, strTitle: "Raw", tagg: 1) //For Smooth imgSmooth.frame = CGRect(x: btnWidth + ((btnWidth-30)/2), y: 10, width: 40, height: 35) imgSmooth.image = UIImage.init(named: "Smooth.png") bottomView.addSubview(imgSmooth) btnSmooth.frame = CGRect(x: btnWidth, y: 0, width: btnWidth, height: 70) self.setButtonProperties(btnSmooth, strTitle: "Smooth", tagg: 2) //For Visual imgVisual.frame = CGRect(x: (btnWidth * 2) + ((btnWidth-30)/2), y: 10, width: 30, height: 30) imgVisual.image = UIImage.init(named: "Visual.png") bottomView.addSubview(imgVisual) btnVisual.frame = CGRect(x: btnWidth*2, y: 0, width: btnWidth, height: 70) self.setButtonProperties(btnVisual, strTitle: "Visual", tagg: 3) } @objc func setButtonProperties(_ btn : UIButton, strTitle : NSString, tagg : NSInteger) { btn.setTitle(strTitle as String, for: .normal) btn.setTitleColor(.lightGray, for: .normal) btn.addTarget(self, action: #selector(btnBottomMenuClick), for: .touchUpInside) btn.backgroundColor = UIColor.clear btn.contentVerticalAlignment = UIControl.ContentVerticalAlignment.bottom btn.tag = tagg bottomView.addSubview(btn) } @objc func SetTopHintView() { viewSessionTime.frame = CGRect(x: 25, y: 70, width: constants.widths-50, height: 80) viewSessionTime.backgroundColor = UIColor.init(red: 22.0/255, green: 68.0/255, blue: 93.0/255, alpha: 1) viewSessionTime.layer.cornerRadius = 44 self.view.addSubview(viewSessionTime) let lblChest = UILabel() lblChest.frame = CGRect(x: 50, y: 10, width: 100, height: 30) lblChest.text = "Chest" lblChest.textColor = .white viewSessionTime.addSubview(lblChest) let lblAbdomen = UILabel() lblAbdomen.frame = CGRect(x: 50, y: 40, width: 100, height: 30) lblAbdomen.text = "Abdomen" lblAbdomen.textColor = .white viewSessionTime.addSubview(lblAbdomen) let lblSession = UILabel() lblSession.frame = CGRect(x: 190, y: 10, width: 100, height: 30) lblSession.text = "Session Time" lblSession.font = UIFont.boldSystemFont(ofSize: 15) lblSession.textColor = .white viewSessionTime.addSubview(lblSession) lblTime.frame = CGRect(x: 190, y: 40, width: 150, height: 30) lblTime.text = "00:00" lblTime.textColor = .white lblTime.font = UIFont.boldSystemFont(ofSize: 35) viewSessionTime.addSubview(lblTime) let lblYellowRing = UILabel() lblYellowRing.frame = CGRect(x: 20, y: 45, width: 20, height: 20) lblYellowRing.layer.borderWidth = 3 lblYellowRing.layer.cornerRadius = 10 lblYellowRing.layer.borderColor = UIColor.yellow.cgColor viewSessionTime.addSubview(lblYellowRing) let lblBlueRing = UILabel() lblBlueRing.frame = CGRect(x: 20, y: 15, width: 20, height: 20) lblBlueRing.layer.borderWidth = 3 lblBlueRing.layer.cornerRadius = 10 lblBlueRing.layer.borderColor = UIColor.init(red: 106.0/255, green: 227.0/255, blue: 255.0/255, alpha: 1).cgColor viewSessionTime.addSubview(lblBlueRing) } @objc func SetupPopupMethod() { popViewAlert.frame = CGRect(x: 20, y: constants.heighs, width: constants.widths-40, height: 200) popViewAlert.backgroundColor = UIColor.init(red: 25.0/255, green: 78.0/255, blue: 107.0/255, alpha: 0.5) popViewAlert.layer.cornerRadius = 25 self.view.addSubview(popViewAlert) btnEndSession.frame = CGRect(x: 20, y: 40, width: 300, height: 50) btnEndSession.backgroundColor = UIColor.init(red: 87.0/255, green: 155.0/255, blue: 191.0/255, alpha: 1) btnEndSession.addTarget(self, action: #selector(btnEndSessinClick), for: .touchUpInside) btnEndSession.setTitle("End session & Save data", for: .normal) btnEndSession.setTitleColor(.white, for: .normal) btnEndSession.layer.cornerRadius = 26 popViewAlert.addSubview(btnEndSession) btnContinueSession.frame = CGRect(x: 20, y: 110, width: 300, height: 50) btnContinueSession.backgroundColor = UIColor.init(red: 87.0/255, green: 155.0/255, blue: 191.0/255, alpha: 1) btnContinueSession.addTarget(self, action: #selector(btnContinueSessionClick), for: .touchUpInside) btnContinueSession.setTitle("Continue Session", for: .normal) btnContinueSession.setTitleColor(.white, for: .normal) btnContinueSession.layer.cornerRadius = 26 popViewAlert.addSubview(btnContinueSession) // var data = readDataFromCSV(fileName: "StretchSense_2020-02-24 15:46:28", fileType: "csv") // // data = cleanRows(file: data!) // let csvRows = csv(data: data!) // print(csvRows) } //MARK:- Buttons @objc func btnBackClick() { // self.navigationController?.popViewController(animated: true) } @objc func newInfoDetected() { listPeripheralsConnected = stretchsenseObject.getListPeripheralsConnected() } @objc func btnBottomMenuClick (_ sender: AnyObject) { print("tag click",sender.tag ?? 0) viewType = sender.tag if sender.tag == 1 { isCircleAvail = false imgRaw.image = UIImage.init(named: "RawSelected.png") btnRaw.setTitleColor(.white, for: .normal) imgSmooth.image = UIImage.init(named: "Smooth.png") btnSmooth.setTitleColor(.lightGray, for: .normal) imgVisual.image = UIImage.init(named: "Visual.png") btnVisual.setTitleColor(.lightGray, for: .normal) rawView.isHidden = false smoothView.isHidden = true visualview.isHidden = true } else if sender.tag == 2 { isCircleAvail = false imgSmooth.image = UIImage.init(named: "SmoothSelected.png") btnSmooth.setTitleColor(.white, for: .normal) imgVisual.image = UIImage.init(named: "Visual.png") btnVisual.setTitleColor(.lightGray, for: .normal) imgRaw.image = UIImage.init(named: "Raw.png") btnRaw.setTitleColor(.lightGray, for: .normal) rawView.isHidden = true smoothView.isHidden = false visualview.isHidden = true } else if sender.tag == 3 { isCircleAvail = true imgVisual.image = UIImage.init(named: "VisualSelected.png") btnVisual.setTitleColor(.white, for: .normal) imgSmooth.image = UIImage.init(named: "Smooth.png") btnSmooth.setTitleColor(.lightGray, for: .normal) imgRaw.image = UIImage.init(named: "Raw.png") btnRaw.setTitleColor(.lightGray, for: .normal) visualview.isHidden = false rawView.isHidden = true smoothView.isHidden = true } } @objc func btnGraphTouchClick() { bottomView.isHidden = true viewSessionTime.isHidden = true btnBack.isHidden = true btnTimer.isHidden = true timer?.invalidate() UIView.transition(with: popViewAlert, duration: 0.5, options: .curveEaseIn, animations: {self.popViewAlert.frame = CGRect(x: 20, y: (constants.heighs-200)/2, width: constants.widths-40, height: 200) }, completion: {( finished: Bool) -> () in }) } @objc func btnEndSessinClick() { let strid = "111" let strName : NSString = "KP" let strEmail : NSString = "[email protected]" let strMob : NSString = "2323232" let update = "INSERT INTO UserData (serverID, name, email, password) VALUES ('\(strid)', '\(strName)', '\(strEmail)', '\(strMob)')" if DataBaseController.shared.execute(sqlStatement: update) == true { print("Success") } else { print("Error") } let formatter = DateFormatter() formatter.dateFormat = "yyyy-MM-dd HH:mm:ss" let myString = formatter.string(from: Date()) print(myString) //let exportFilePath = NSTemporaryDirectory() + "StretchSense_Record.csv" let exportFilePath = NSTemporaryDirectory() + "StretchSense_" + "\(myString)" + ".csv" let exportFileURL = URL(fileURLWithPath: exportFilePath) FileManager.default.createFile(atPath: exportFilePath, contents: Data(), attributes: nil) //var fileHandleError: NSError? = nil var fileHandle: FileHandle? = nil do { fileHandle = try FileHandle(forWritingTo: exportFileURL) } catch { print( "Error with fileHandle") } if fileHandle != nil { fileHandle!.seekToEndOfFile() let nsdataToShare: Data = stringArrayToNSData(allRecordedChest) fileHandle!.write(/*csvData!*/ nsdataToShare) fileHandle!.closeFile() } let firstActivityItem = URL(fileURLWithPath: exportFilePath) let activityViewController: UIActivityViewController = UIActivityViewController(activityItems: [firstActivityItem], applicationActivities: nil) self.present(activityViewController, animated: true, completion: nil) } @objc func btnContinueSessionClick() { bottomView.isHidden = false viewSessionTime.isHidden = false btnBack.isHidden = false btnTimer.isHidden = false UIView.transition(with: popViewAlert, duration: 0.5, options: .curveEaseIn, animations: { self.popViewAlert.frame = CGRect(x: 20, y: constants.heighs, width: constants.widths-40, height: 200) self.timer?.invalidate() self.timer = Timer.scheduledTimer(timeInterval: 1.0,target: self, selector: #selector(self.timerAction),userInfo: nil,repeats: true) }, completion: {( finished: Bool) -> () in }) } @objc func btnTimerClick() { } @objc func timerAction() { if(count1 > 0) { if count1 != 0 { count1 += 1 } else { if let timer = self.timer { timer.invalidate() self.timer = nil } } self.lblTime.text = self.timeFormatted(self.count1) } } func timeFormatted(_ totalSeconds: Int) -> String { let seconds: Int = totalSeconds % 60 let minutes: Int = (totalSeconds / 60) % 60 return String(format: "%02d:%02d", minutes, seconds) } //MARK:- BLE Methods @objc func newValueDetected() { // print("new value detected") listPeripheralsConnected = stretchsenseObject.getListPeripheralsConnected() ask_new_data() } func ask_new_data() { listPeripheralsConnected = stretchsenseObject.getListPeripheralsConnected() reloadGraph() if listPeripheralsConnected.count != 0 { for myPeripheralConnected in listPeripheralsConnected { let strChestUUID: NSString = UserDefaults.standard.value(forKey: "ChestUUID") as? NSString ?? "NA" let strAbdUUID: NSString = UserDefaults.standard.value(forKey: "AbdomenUUID") as? NSString ?? "NA" let strUUID = myPeripheralConnected.uuid as String sentenceToRecord = "\n" let rawValueFromThePeripheral = myPeripheralConnected.previousValueRawFromTheSensor[myPeripheralConnected.previousValueRawFromTheSensor.count-1] let realValueFromThePeripheral = Int(rawValueFromThePeripheral /** 0.1*/) sentenceToRecord += "\(realValueFromThePeripheral)" let formatter = DateFormatter() formatter.dateFormat = "HH:mm:ss.SSS" let myString = formatter.string(from: Date()) if strUUID == strChestUUID as String { if isChestAllow == true { if sampleNumberC == 0 { startTime = NSDate.timeIntervalSinceReferenceDate sentenceToRecord = "Sensor Value" } allRecordedChest.append(sentenceToRecord) sampleNumberC += 1 isChestAllow = false print("Chest Value=",myString, sentenceToRecord) } } else if strUUID == strAbdUUID as String { if isAbdAllow == true { if sampleNumberA == 0 { startTime = NSDate.timeIntervalSinceReferenceDate sentenceToRecord = "Sensor Value" } allRecordedAbd.append(sentenceToRecord) sampleNumberA += 1 isAbdAllow = false print("ABD Value=",realValueFromThePeripheral,myString) } } } } } func stringArrayToNSData(_ array: [String]) -> Data { print("stringArrayToNSData()") let data = NSMutableData() let terminator = [0] for string in array { if let encodedString = string.data(using: String.Encoding.utf8) { data.append(encodedString) data.append(terminator, length: 1) } else { NSLog("Cannot encode string \"\(string)\"") } } return data as Data } func reloadGraph() { rawChart.clear() smoothChart.clear() if listPeripheralsConnected.count != 0 { for myPeripheralConnected in listPeripheralsConnected { let strChestUUID = String(format: "%@", UserDefaults.standard.value(forKey: "ChestUUID") as! CVarArg) let strAbdomenUUID = String(format: "%@", UserDefaults.standard.value(forKey: "AbdomenUUID") as! CVarArg) if myPeripheralConnected.display == true { let strUUID = myPeripheralConnected.uuid as String var strType : Int = 1 if strUUID == strChestUUID { strType = 0 } else if strUUID == strAbdomenUUID { strType = 1 } if isCircleAvail { if myPeripheralConnected.value != 0.0 { var intVal : CGFloat = CGFloat(myPeripheralConnected.value - 280) if intVal > 0 { if intVal > 80 { intVal = intVal / 5.0 } UIView.animate(withDuration: Double(0.5), animations: { if strType == 0 { var chestRect : CGRect = self.circleChest.frame let vwithd = CGFloat(300 + (intVal)) chestRect.size.width = vwithd chestRect.size.height = vwithd chestRect.origin.x = CGFloat((self.visualview.frame.width - vwithd)/2) chestRect.origin.y = CGFloat((self.visualview.frame.height - vwithd)/2) self.circleChest.frame = chestRect self.circleChest.layer.cornerRadius = chestRect.size.height/2 } else { var chestRect : CGRect = self.circleAbdome.frame let vwithd = CGFloat(240 + (intVal)) chestRect.size.width = vwithd chestRect.size.height = vwithd chestRect.origin.x = CGFloat((self.visualview.frame.width - vwithd)/2) chestRect.origin.y = CGFloat((self.visualview.frame.height - vwithd)/2) self.circleAbdome.frame = chestRect self.circleAbdome.layer.cornerRadius = chestRect.size.height/2 } }) } else { } } } else { if (viewType == 1) { rawChart.addLine(myPeripheralConnected.previousValueAveraged, colorNumber: strType) } else if (viewType == 2 ) { smoothChart.addLine(myPeripheralConnected.previousValueAveraged, colorNumber: strType) } } } } } } func didSelectDataPoint(_ x: CGFloat, yValues: Array<CGFloat>) { } @objc func recordPauseButton(_ sender: AnyObject) { print("button : record/pause") if listPeripheralsConnected.count == 0 { print("button : record/pause - No Periph") } else { print("button : record/pause - Periph Detected") if isRecording == true { print("button : record/pause - Periph Detected - is recording") isRecording = false UIApplication.shared.isIdleTimerDisabled = false } else { print("button : record/pause - Periph Detected - is not recording") isRecording = true UIApplication.shared.isIdleTimerDisabled = true } } } @objc func deleteRecord(_ sender: AnyObject) { if listPeripheralsConnected.count == 0 { } else { if isRecording == true { // self.labelRecord.text = "Stop Recording First" } else { // If the system is not recording, ask for permission to delete the data recorded let refreshAlert = UIAlertController(title: "Delete", message: "Are you sure you want to delete all recorded data? ", preferredStyle: UIAlertController.Style.alert) refreshAlert.addAction(UIAlertAction(title: "Confirm", style: .default, handler: { (action: UIAlertAction!) in self.allRecordedChest = [] self.allRecordedAbd = [] self.sampleNumberC = 0 self.sampleNumberA = 0 })) refreshAlert.addAction(UIAlertAction(title: "Cancel", style: .default, handler: { (action: UIAlertAction!) in })) present(refreshAlert, animated: true, completion: nil) } } } // MARK: - Reading CSV file func csv(data: String) -> [[String]] { var result: [[String]] = [] let rows = data.components(separatedBy: "\n") for row in rows { let columns = row.components(separatedBy: ";") result.append(columns) } return result } func readDataFromCSV(fileName:String, fileType: String)-> String!{ guard let filepath = Bundle.main.path(forResource: fileName, ofType: fileType) else { return nil } do { var contents = try String(contentsOfFile: filepath, encoding: .utf8) contents = cleanRows(file: contents) return contents } catch { print("File Read Error for file \(filepath)") return nil } } func cleanRows(file:String)->String{ var cleanFile = file cleanFile = cleanFile.replacingOccurrences(of: "\r", with: "\n") cleanFile = cleanFile.replacingOccurrences(of: "\n\n", with: "\n") // cleanFile = cleanFile.replacingOccurrences(of: ";;", with: "") // cleanFile = cleanFile.replacingOccurrences(of: ";\n", with: "") return cleanFile } }
[ -1 ]
490b5fa8b619fbb2ca283c370e09f8143add223e
b27593b200ff0620ff4f6ec1f457209b9909fb5b
/MovieList/MovieList/ViewController/Movies/MovieList/MovieListDetail/MovieListDetailVC.swift
4f1e87e0a91d3f7e9caae7e6e2990ee18ef5421c
[]
no_license
bsenturk/MovieList
d3311a6ecf88b6eee48836de0ed86690ee1c2c34
c87e2ff39272cf97fe4949b6537e86f3ecb9ce67
refs/heads/master
2020-08-17T03:49:20.478696
2019-10-19T19:33:59
2019-10-19T19:33:59
215,602,877
1
0
null
null
null
null
UTF-8
Swift
false
false
2,096
swift
// // MovieListDetailVC.swift // MovieList // // Created by Burak Şentürk on 17.10.2019. // Copyright © 2019 Burak Şentürk. All rights reserved. // import UIKit class MovieListDetailVC: BaseVC { @IBOutlet weak var movieImageView: UIImageView! @IBOutlet weak var movieTitleLabel: UILabel! @IBOutlet weak var movieDescriptionLabel: UILabel! @IBOutlet weak var voteCountLabel: UILabel! private let viewModel = MovieListDetailViewModel() var isFavourite: Bool = false override func viewDidLoad() { super.viewDidLoad() let backButton = UIBarButtonItem() backButton.title = "" navigationController?.navigationBar.topItem?.backBarButtonItem = backButton if let data = viewModelData as? MovieListDetailViewModelData { updateUI(imageUrlPath: data.movieImageUrl, movieTitle: data.movieName, movieDescription: data.movieDescription, voteCount: "\(data.voteCount)") viewModel.id = data.id } setRightBarButtonImage() initializeViewModel() } func setRightBarButtonImage() { viewModel.getFavouriteMovie() ? setupRightBarButton(image: #imageLiteral(resourceName: "starFill")) : setupRightBarButton(image: #imageLiteral(resourceName: "star")) } func initializeViewModel() { viewModel.updateRightBarButtonImage = { [weak self] () in self?.setRightBarButtonImage() } } func updateUI(imageUrlPath: String, movieTitle: String, movieDescription: String, voteCount: String) { guard let url = URL(string: EndPoints.imageUrl + imageUrlPath) else { return } movieImageView.sd_setImage(with: url) movieTitleLabel.text = movieTitle movieDescriptionLabel.text = movieDescription voteCountLabel.text = "Vote Count: \(voteCount)" } override func rightBarButtonAction() { super.rightBarButtonAction() viewModel.favouriteButtonTapped() } }
[ -1 ]
5f3958af340d7633c8a9432c4df41fee8579b10f
405910e4ef5085d42c7c7be5786fe74812f4244c
/backgroundDownloadUITests/backgroundDownloadUITests.swift
4b7a11570b9433c2be9e39e964fb4a13c59b30de
[]
no_license
h-shiraishi/BackgroundDownload
f98e9abd77e2fe3a9b709edb45a0c2383abcd93a
242ef0be7ad81350f1bccc48ee811c5f8a5b7c74
refs/heads/master
2021-01-12T15:18:20.752881
2018-08-18T06:19:10
2018-08-18T06:19:10
71,751,433
1
0
null
null
null
null
UTF-8
Swift
false
false
1,279
swift
// // backgroundDownloadUITests.swift // backgroundDownloadUITests // // Created by Edelweiss on 2016/10/20. // Copyright © 2016年 Edelweiss. All rights reserved. // import XCTest class backgroundDownloadUITests: 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, 279066, 188954, 279092, 377419, 303693, 115287, 189016, 295518, 287327, 279143, 279150, 287345, 189054, 303743, 287359, 164487, 279176, 311944, 344714, 311948, 311950, 311953, 287379, 336531, 295575, 303772, 205469, 221853, 279207, 295591, 295598, 279215, 279218, 287412, 164532, 287418, 303802, 66243, 287434, 287438, 279249, 303826, 164561, 369365, 369366, 279253, 230105, 295653, 230120, 279278, 312046, 230133, 279293, 205566, 295688, 312076, 295698, 221980, 336678, 262952, 279337, 262953, 262957, 164655, 328495, 303921, 230198, 295745, 222017, 279379, 295769, 230238, 230239, 279393, 303973, 279398, 295797, 295799, 279418, 336765, 287623, 279434, 320394, 189349, 279465, 304050, 189373, 213956, 345030, 213961, 279499, 304086, 304104, 123880, 320492, 320495, 287730, 320504, 214009, 312313, 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, 230514, 238706, 312435, 279666, 279686, 222344, 337037, 296091, 238764, 279729, 148674, 312519, 279752, 148687, 189651, 279766, 189656, 279775, 304352, 304353, 279780, 279789, 279803, 320769, 312588, 320795, 320802, 304422, 312628, 345398, 222523, 181568, 279872, 279874, 304457, 230730, 345418, 337228, 296269, 222542, 238928, 296274, 230757, 312688, 296304, 230772, 337280, 296328, 296330, 304523, 9618, 279955, 148899, 279979, 279980, 173492, 279988, 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, 99937, 345697, 312937, 312941, 206447, 288377, 337533, 280193, 239238, 288391, 239251, 280217, 198304, 337590, 280252, 296636, 280253, 321217, 280259, 321220, 239305, 296649, 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, 124795, 280451, 67464, 305032, 124816, 214936, 337816, 124826, 239515, 214943, 313257, 288698, 214978, 280517, 280518, 214983, 231382, 329696, 190437, 313322, 329707, 174058, 296942, 124912, 313338, 239610, 182277, 313356, 305173, 223269, 354342, 354346, 313388, 124974, 215095, 288829, 288835, 313415, 239689, 354386, 280660, 223317, 329812, 354394, 321632, 280674, 280676, 313446, 215144, 288878, 288890, 215165, 280708, 329884, 215204, 125108, 280761, 223418, 280767, 338118, 280779, 321744, 280792, 280803, 182503, 338151, 125166, 125170, 395511, 313595, 125180, 125184, 125192, 125197, 125200, 125204, 338196, 125215, 125225, 338217, 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, 313970, 297600, 289435, 314020, 248494, 166581, 314043, 363212, 158424, 322269, 338658, 289511, 330473, 330476, 289517, 215790, 125683, 199415, 322302, 289534, 35584, 322312, 346889, 264971, 322320, 166677, 207639, 281378, 289580, 289599, 281407, 281426, 281434, 322396, 281444, 207735, 314240, 158594, 330627, 240517, 289691, 240543, 289699, 289704, 289720, 289723, 281541, 19398, 191445, 183254, 183258, 207839, 142309, 314343, 183276, 289773, 248815, 240631, 330759, 322571, 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, 314734, 314740, 314742, 314745, 290170, 224637, 306558, 290176, 306561, 314752, 314759, 298378, 314765, 314771, 306580, 224662, 282008, 314776, 282013, 290206, 314788, 298406, 314790, 282023, 241067, 314797, 306630, 306634, 339403, 191980, 282097, 306678, 191991, 290304, 323079, 323083, 323088, 282132, 282135, 175640, 282147, 306730, 290359, 323132, 282182, 224848, 224852, 290391, 306777, 323171, 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, 315433, 102441, 102446, 282671, 241717, 307269, 233548, 315468, 315477, 200795, 323678, 315488, 315489, 45154, 307306, 233578, 217194, 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, 282938, 307514, 127292, 168251, 323914, 201037, 282959, 250196, 168280, 323934, 381286, 242027, 242028, 250227, 315768, 291193, 291194, 315769, 291200, 242059, 315798, 291225, 242079, 283039, 299449, 291266, 283088, 283089, 176602, 242138, 160224, 291297, 242150, 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, 234330, 201562, 275294, 349025, 357219, 177002, 308075, 242540, 242542, 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, 283894, 316661, 292092, 234756, 242955, 177420, 292145, 300342, 333114, 333115, 193858, 300355, 300354, 234830, 283990, 357720, 300378, 300379, 316764, 292194, 284015, 234864, 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, 325508, 333700, 243590, 243592, 325514, 350091, 350092, 350102, 333727, 333734, 219046, 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, 227730, 285074, 317851, 293275, 285083, 227743, 285089, 293281, 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, 293552, 342705, 285362, 285360, 154295, 342757, 285419, 170735, 342775, 375552, 228099, 285443, 285450, 326413, 285457, 285467, 326428, 318247, 203560, 293673, 318251, 301872, 285493, 285496, 301883, 342846, 293702, 318279, 244569, 301919, 293729, 351078, 310132, 228214, 269179, 228232, 416649, 252812, 293780, 310166, 277404, 310177, 293801, 326571, 326580, 326586, 359365, 211913, 56270, 203758, 277493, 293894, 293911, 326684, 113710, 318515, 203829, 277600, 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, 318746, 245018, 130342, 130344, 130347, 286012, 294210, 286019, 294220, 318804, 294236, 327023, 327030, 310650, 179586, 294278, 318860, 368012, 318876, 343457, 245160, 286128, 286133, 310714, 302523, 228796, 302530, 228804, 310725, 302539, 310731, 310735, 327122, 310747, 286176, 187877, 310758, 40439, 286201, 359931, 286208, 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, 278273, 278292, 278294, 286507, 294699, 319289, 237397, 188250, 237411, 327556, 188293, 311183, 294806, 294808, 319393, 294820, 294824, 343993, 98240, 294849, 294887, 278507, 311277, 327666, 278515 ]
edc8483b4206aea4432f5da33d0aba560eecd69c
a9eb3a79393cf0d2f01522f95d745cce129c268d
/LabMaternalhaematology/Question3.swift
65e49f0ad3fd80680dc82b64caea95b8ebec30d3
[]
no_license
dancingbush/LabMaternalhaematology
1de81c694978b76794447ea8f7c28beede9772af
803cef62f838237effa8438d5ebaa494a1165c82
refs/heads/master
2020-12-30T10:36:49.529670
2015-05-07T09:32:41
2015-05-07T09:32:41
35,209,552
0
0
null
null
null
null
UTF-8
Swift
false
false
8,365
swift
// // Question3.swift // LabMaternalhaematology // // Created by Ciaran Mooney on 22/03/2015. // Copyright (c) 2015 Ciaran Mooney. All rights reserved. // import UIKit class Question3: UIViewController { //Instances var question = ""; var option1 = ""; var option2 = ""; var option3 = ""; var option4 = ""; var theAnswer = ""; var usersGuess = ""; var isUserAnwserCorrect : Bool = false; //checked in diiplaDalog // // results t display when a button clicked // var resultsA = "FVII = 0.25 - Low\nFIX = 0.90 - Norm\nvWF = 2.3 - Norm\nTT = 67s - High"; // var resultsB = "karyotype XY\nFISH - Normal"; // var resultsC = "No chromsomal Abnormalities"; // var resultsD = "BM: Retuclin deposits.\n>80% blasts\nMyelodysplasia\nTrephine: No abnormalities."; //Views @IBOutlet weak var labelQuestion: UILabel! @IBOutlet weak var buttonAnswer1: UIButton! @IBAction func buttonSelectAnswer1(sender: AnyObject) { println("ANSWER A CHOSEN"); // if anser correct then change colour of button to grren usersGuess = "A"; checkAnswer(usersGuess, button : sender as UIButton); // check anwer buttonAnswer1.userInteractionEnabled = false; } @IBOutlet weak var buttonAnswer2: UIButton! @IBAction func buttonSelectAnswer2(sender: AnyObject) { // if anser correct then change colour of button to grren usersGuess = "B"; checkAnswer(usersGuess, button: sender as UIButton); // check anwer buttonAnswer1.userInteractionEnabled = false; } @IBOutlet weak var buttonAnswer3: UIButton! @IBAction func buttonSelectAnswer3(sender: AnyObject) { usersGuess = "C"; checkAnswer(usersGuess, button : sender as UIButton); // check anwer buttonAnswer1.userInteractionEnabled = false; } @IBOutlet weak var buttonAnswer4: UIButton! @IBAction func buttonSelectAnswer4(sender: AnyObject) { usersGuess = "D"; checkAnswer(usersGuess, button : sender as UIButton); // check anwer buttonAnswer1.userInteractionEnabled = false; } func checkAnswer(userGuess : String, button : UIButton){ //when suer clicks button send the guess and dsiplay dialog accrodingly //var resultToDispaly = ""; // check if answer correct or not first, this is only checked once the very fisrt button is pressed, doeb by bool flag if (userGuess == theAnswer){ // get he anser form button passed usersAnsersToAllQuestions = usersAnsersToAllQuestions + "\nQ3: \(button.titleLabel!.text!) - Correct!"; if (numberOfCorrectANswers == "1"){ numberOfCorrectANswers = "2"; } else if (numberOfCorrectANswers == "0"){ numberOfCorrectANswers = "1"; } else { numberOfCorrectANswers = "3"; } println("CORRECT ANSWER CHOSEN \(userGuess) and aswer is \(theAnswer)"); self.isUserAnwserCorrect = true; } else if (userGuess != theAnswer){ // get he anser form button passed usersAnsersToAllQuestions = usersAnsersToAllQuestions + "\nQ3: \(button.titleLabel!.text!) - InCorrect!"; if (numberOfIncorrectAnswers == "1"){ numberOfIncorrectAnswers = "2"; } else if (numberOfIncorrectAnswers == "0"){ numberOfIncorrectAnswers = "1"; } else { numberOfIncorrectAnswers = "3"; } println("INCORRECT ANSWER CHOSEN \(userGuess) should of been \(self.theAnswer)"); self.isUserAnwserCorrect = false; } // do?", preferredStyle: .Alert) // let defaultAction = UIAlertAction(title: "OK", style: .Default, handler: nil) var alert = UIAlertController(title: "Finish", message: "Are uou sure?", preferredStyle: UIAlertControllerStyle.ActionSheet) alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: { action in println("Users selected \(self.usersGuess) as final answer, correct answer is \(self.theAnswer), . Bool anser is correct = \(self.isUserAnwserCorrect), disabling buttons"); self.disableAllButtons(); self.performSegueWithIdentifier("segueToSummary", sender: self);// naviaget to ext view })); alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Default, handler: { action in //nothing required here alow another choice println("Canvel sletected, user trys again, Bool anser is correct = \(self.isUserAnwserCorrect)"); })); self.presentViewController(alert, animated: true, completion: nil); } override func prefersStatusBarHidden() -> Bool { // hode the staus bar of phone return true } override func viewDidLoad() { super.viewDidLoad() //set parameters from globals from db query in History option1 = question3OptionA; option2 = question3OptionB; option3 = question3OptionC; option4 = question3OptionD; theAnswer = question3_answer; // Set button texts to the options from DB after view has loaded labelQuestion.text = theQuestion3; buttonAnswer1.setTitle(option1, forState: UIControlState.Normal); buttonAnswer2.setTitle(option2, forState: UIControlState.Normal); buttonAnswer3.setTitle(option3, forState: UIControlState.Normal); buttonAnswer4.setTitle(option4, forState: UIControlState.Normal); } func disableAllButtons(){ buttonAnswer1.titleLabel?.textColor = UIColor.blueColor(); buttonAnswer1.enabled = false; buttonAnswer2.titleLabel?.textColor = UIColor.blueColor(); buttonAnswer2.enabled = false; buttonAnswer3.titleLabel?.textColor = UIColor.blueColor(); buttonAnswer3.enabled = false; buttonAnswer4.titleLabel?.textColor = UIColor.blueColor(); buttonAnswer4.enabled = false; println("USER NASWER 1 = \(usersAnsersToAllQuestions)\nNO OF CORRECT-IN ANSWER = \(numberOfCorrectANswers) : \(numberOfIncorrectAnswers)"); } 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 prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. println("USER NASWER 1 = \(usersAnsersToAllQuestions)\nNO OF CORRECT-IN ANSWER = \(numberOfCorrectANswers) : \(numberOfIncorrectAnswers)"); } }
[ -1 ]
0076198d90c205738fc4a367fe552c2db6943866
47b44c48d11e250e973769533f465bedc9919f3a
/LotteryForecaster/LotteryForecaster/Source/Extension/UIColorExtension.swift
22c0f0b1508863daece39ec8ff6eced37b45f340
[ "MIT" ]
permissive
martinolee/LotteryForecaster
614fc61ac7121c188792b6d0aa2f7e21b51c9059
c16a04b12dc71c48362401e791b4e711002063e4
refs/heads/master
2022-07-18T22:51:20.190909
2020-05-15T13:48:53
2020-05-15T13:48:53
260,484,339
0
0
null
null
null
null
UTF-8
Swift
false
false
766
swift
// // UIColorExtension.swift // LotteryForecaster // // Created by Soohan Lee on 2020/05/04. // Copyright © 2020 Soohan Lee. All rights reserved. // import UIKit extension UIColor { static var lotteryYellow: UIColor { UIColor(red: 255 / 255, green: 190 / 255, blue: 50 / 255, alpha: 1) } static var lotteryBlue: UIColor { UIColor(red: 100 / 255, green: 100 / 255, blue: 255 / 255, alpha: 1) } static var lotteryRed: UIColor { UIColor(red: 255 / 255, green: 100 / 255, blue: 100 / 255, alpha: 1) } static var lotteryBlack: UIColor { UIColor(red: 50 / 255, green: 50 / 255, blue: 50 / 255, alpha: 1) } static var lotteryGreen: UIColor { UIColor(red: 90 / 255, green: 200 / 255, blue: 140 / 255, alpha: 1) } }
[ -1 ]
4a5230a6c1cb0bdc8573046851ae6f05b50e37fa
ea146b4bbecfe89984e50e3b89800fdade2ac692
/Sources/Addons/ActionSheet/ScreenShowActionSheetAction.swift
fb41f8a44b2fb7a2815779788bd559ce20e134de
[ "MIT" ]
permissive
ttoxa-xa/Nivelir
929bbc933540b6939fdb0c7833fc173c854d89f9
507581076055883d5c67ae24569379c7b319ae3c
refs/heads/main
2023-08-22T21:06:36.166123
2021-08-16T15:46:19
2021-08-16T15:46:19
411,299,669
0
0
MIT
2021-09-28T13:46:01
2021-09-28T13:46:00
null
UTF-8
Swift
false
false
4,036
swift
#if canImport(UIKit) import UIKit public struct ScreenShowActionSheetAction<Container: UIViewController>: ScreenAction { public typealias Output = UIAlertController public let actionSheet: ActionSheet public let animated: Bool public init(actionSheet: ActionSheet, animated: Bool = true) { self.actionSheet = actionSheet self.animated = animated } private func showAlertContainer( _ alertContainer: UIAlertController, in container: Container, completion: @escaping Completion ) { container.present(alertContainer, animated: animated) { completion(.success(alertContainer)) } } private func showAlertContainerUsingPopover( _ alertContainer: UIAlertController, from source: ScreenPopoverPresentationAnchor, in container: Container, completion: @escaping Completion ) { guard let popoverPresentationController = alertContainer.popoverPresentationController else { return showAlertContainer( alertContainer, in: container, completion: completion ) } if let permittedArrowDirections = source.permittedArrowDirections { popoverPresentationController.permittedArrowDirections = permittedArrowDirections } popoverPresentationController.sourceRect = source.rect ?? CGRect( x: container.view.bounds.midX, y: container.view.bounds.midY, width: .zero, height: .zero ) popoverPresentationController.sourceView = source.view ?? container.view popoverPresentationController.barButtonItem = source.barButtonItem showAlertContainer( alertContainer, in: container, completion: completion ) } private func makeAlertContainer() -> UIAlertController { let alertContainer = UIAlertController( title: actionSheet.title, message: actionSheet.message, preferredStyle: .actionSheet ) if let tintColor = actionSheet.tintColor { alertContainer.view.tintColor = tintColor } if let accessibilityIdentifier = actionSheet.accessibilityIdentifier { alertContainer.view.accessibilityIdentifier = accessibilityIdentifier } let actions = actionSheet .actions .map { action in UIAlertAction(title: action.title, style: action.style) { _ in action.handler?() } } actions.forEach { alertContainer.addAction($0) } return alertContainer } public func perform( container: Container, navigator: ScreenNavigator, completion: @escaping Completion ) { navigator.logInfo("Presenting \(actionSheet) on \(type(of: container))") let alertContainer = makeAlertContainer() switch UIDevice.current.userInterfaceIdiom { case .pad, .mac: showAlertContainerUsingPopover( alertContainer, from: actionSheet.anchor, in: container, completion: completion ) case .phone, .tv, .carPlay, .unspecified: showAlertContainer( alertContainer, in: container, completion: completion ) @unknown default: showAlertContainer( alertContainer, in: container, completion: completion ) } } } extension ScreenThenable where Current: UIViewController { public func showActionSheet( _ actionSheet: ActionSheet, animated: Bool = true ) -> Self { then( ScreenShowActionSheetAction<Current>( actionSheet: actionSheet, animated: animated ) ) } } #endif
[ -1 ]
6076b927dcebcc79b3a7f76aa4abfc0f649112c0
db34b69d3fd25237cc65583208101fdc81a9bb66
/ARKit-master/ARKitProject/MainViewController-CoreMLMarkup.swift
ec71c27629ca2b0a54f4b03e24daacdae3ec94c7
[]
no_license
suppermancool/ARKit-Diazz
f4ddb60d5a116697b95c429404ec16e73ce7e772
1d55905465db81bcf9c109ffb93c499402a32ee8
refs/heads/master
2021-09-03T16:45:08.924803
2018-01-10T14:46:24
2018-01-10T14:46:24
114,948,896
0
0
null
null
null
null
UTF-8
Swift
false
false
8,875
swift
import ARKit import Foundation import SceneKit import UIKit import Photos import ARVideoKit import Vision // MARK: - ARKit / ARSCNView extension MainViewController { func setupCoreML() { // Enable Default Lighting - makes the 3D text a bit poppier. sceneView.autoenablesDefaultLighting = true // Set up Vision Model guard let selectedModel = try? VNCoreMLModel(for: Inceptionv3().model) else { // (Optional) This can be replaced with other models on https://developer.apple.com/machine-learning/ fatalError("Could not load model. Ensure model has been drag and dropped (copied) to XCode Project from https://developer.apple.com/machine-learning/ . Also ensure the model is part of a target (see: https://stackoverflow.com/questions/45884085/model-is-not-part-of-any-target-add-the-model-to-a-target-to-enable-generation ") } // Set up Vision-CoreML Request let classificationRequest = VNCoreMLRequest(model: selectedModel, completionHandler: classificationCompleteHandler) classificationRequest.imageCropAndScaleOption = VNImageCropAndScaleOption.centerCrop // Crop from centre of images and scale to appropriate size. visionRequests = [classificationRequest] Timer.scheduledTimer(withTimeInterval: 5, repeats: true) { (_) in // Begin Loop to Update CoreML self.loopCoreMLUpdate() } for moMarkup in MOHelper.getAllMOMarkup() { let worldCoord : SCNVector3 = SCNVector3Make(moMarkup.posX, moMarkup.posY, moMarkup.posZ) self.addMarkupNode(pos: worldCoord, text: moMarkup.text!) } } // MARK: - Interaction @IBAction func makeup(_ sender: UIButton) { // HIT TEST : REAL WORLD // Get Screen Centre let screenCentre : CGPoint = CGPoint(x: self.sceneView.bounds.midX, y: self.sceneView.bounds.midY) let arHitTestResults : [ARHitTestResult] = sceneView.hitTest(screenCentre, types: [.featurePoint]) // Alternatively, we could use '.existingPlaneUsingExtent' for more grounded hit-test-points. if let closestResult = arHitTestResults.first { // Create 3D Text showAlert(defaultText: latestPrediction, showed: { [unowned self] (description) in // Get Coordinates of HitTest let transform : matrix_float4x4 = closestResult.worldTransform let worldCoord : SCNVector3 = SCNVector3Make(transform.columns.3.x, transform.columns.3.y, transform.columns.3.z) self.addMarkupNode(pos: worldCoord, text: description) MOHelper.createMOMarkup(text: description, pos: worldCoord) }) } } @discardableResult func addMarkupNode(pos: SCNVector3, text: String) -> SCNNode { let node : SCNNode = self.createNewBubbleParentNode(text) self.sceneView.scene.rootNode.addChildNode(node) node.position = pos self.objectArray.append(node) return node } func createNewBubbleParentNode(_ text : String) -> SCNNode { // Warning: Creating 3D Text is susceptible to crashing. To reduce chances of crashing; reduce number of polygons, letters, smoothness, etc. // TEXT BILLBOARD CONSTRAINT let billboardConstraint = SCNBillboardConstraint() billboardConstraint.freeAxes = SCNBillboardAxis.Y // BUBBLE-TEXT let bubble = SCNText(string: text, extrusionDepth: CGFloat(bubbleDepth)) var font = UIFont(name: "Futura", size: 0.15) font = font?.withTraits(traits: .traitBold) bubble.font = font bubble.alignmentMode = kCAAlignmentCenter bubble.firstMaterial?.diffuse.contents = UIColor.orange bubble.firstMaterial?.specular.contents = UIColor.white bubble.firstMaterial?.isDoubleSided = true // bubble.flatness // setting this too low can cause crashes. bubble.chamferRadius = CGFloat(bubbleDepth) // BUBBLE NODE let (minBound, maxBound) = bubble.boundingBox let bubbleNode = SCNNode(geometry: bubble) // Centre Node - to Centre-Bottom point bubbleNode.pivot = SCNMatrix4MakeTranslation( (maxBound.x - minBound.x)/2, minBound.y, bubbleDepth/2) // Reduce default text size bubbleNode.scale = SCNVector3Make(0.2, 0.2, 0.2) // CENTRE POINT NODE let sphere = SCNSphere(radius: 0.005) sphere.firstMaterial?.diffuse.contents = UIColor.cyan let sphereNode = SCNNode(geometry: sphere) // BUBBLE PARENT NODE let bubbleNodeParent = SCNNode() bubbleNodeParent.addChildNode(bubbleNode) bubbleNodeParent.addChildNode(sphereNode) bubbleNodeParent.constraints = [billboardConstraint] return bubbleNodeParent } // MARK: - CoreML Vision Handling func loopCoreMLUpdate() { // Continuously run CoreML whenever it's ready. (Preventing 'hiccups' in Frame Rate) dispatchQueueML.async { // 1. Run Update. self.updateCoreML() // 2. Loop this function. // self.loopCoreMLUpdate() } } func classificationCompleteHandler(request: VNRequest, error: Error?) { // Catch Errors if error != nil { print("Error: " + (error?.localizedDescription)!) return } guard let observations = request.results else { print("No results") return } // Get Classifications let classifications = observations[0...1] // top 2 results .flatMap({ $0 as? VNClassificationObservation }) .map({ "\($0.identifier) \(String(format:"- %.2f", $0.confidence))" }) .joined(separator: "\n") DispatchQueue.main.async { // Print Classifications print(classifications) print("--") // Display Debug Text on screen var debugText:String = "" debugText += classifications // self.debugTextView.text = debugText // Store the latest prediction var objectName:String = "…" objectName = classifications.components(separatedBy: "-")[0] objectName = objectName.components(separatedBy: ",")[0] self.latestPrediction = objectName } } func updateCoreML() { /////////////////////////// // Get Camera Image as RGB let pixbuff : CVPixelBuffer? = (sceneView.session.currentFrame?.capturedImage) if pixbuff == nil { return } let ciImage = CIImage(cvPixelBuffer: pixbuff!) // Note: Not entirely sure if the ciImage is being interpreted as RGB, but for now it works with the Inception model. // Note2: Also uncertain if the pixelBuffer should be rotated before handing off to Vision (VNImageRequestHandler) - regardless, for now, it still works well with the Inception model. /////////////////////////// // Prepare CoreML/Vision Request let imageRequestHandler = VNImageRequestHandler(ciImage: ciImage, options: [:]) // let imageRequestHandler = VNImageRequestHandler(cgImage: cgImage!, orientation: myOrientation, options: [:]) // Alternatively; we can convert the above to an RGB CGImage and use that. Also UIInterfaceOrientation can inform orientation values. /////////////////////////// // Run Image Request do { try imageRequestHandler.perform(self.visionRequests) } catch { print(error) } } func showAlert(defaultText: String?, showed: @escaping (String) -> Void) { let alert = UIAlertController(title: "Makeup", message: "Make Up Name", preferredStyle: .alert) alert.addTextField { (textField) in textField.text = defaultText } alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { [weak alert] (_) in let textField = alert?.textFields![0] showed((textField?.text!)!) })) alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil)) self.present(alert, animated: true, completion: nil) } } extension UIFont { // Based on: https://stackoverflow.com/questions/4713236/how-do-i-set-bold-and-italic-on-uilabel-of-iphone-ipad func withTraits(traits:UIFontDescriptorSymbolicTraits...) -> UIFont { let descriptor = self.fontDescriptor.withSymbolicTraits(UIFontDescriptorSymbolicTraits(traits)) return UIFont(descriptor: descriptor!, size: 0) } }
[ -1 ]
372553b5c0ba19830466653190d48cc5634595e1
b45b7df7bd96a4dae60d91ec7545491848672619
/Wag'n Jump/GameViewController.swift
52dd08e2c78790db7863bd59740e70f6507ff259
[]
no_license
rstoner19/Jump-game
239ca7ce22c9297bcc0207f18e6edf52dda963db
227fc9d47a15ac4714471bb343af620f299ac0f8
refs/heads/master
2021-05-15T21:50:11.759454
2017-10-11T19:36:57
2017-10-11T19:36:57
106,600,595
0
0
null
null
null
null
UTF-8
Swift
false
false
1,394
swift
// // GameViewController.swift // Wag'n Jump // // Created by Rick Stoner on 10/10/17. // Copyright © 2017 Rick Stoner. All rights reserved. // import UIKit import SpriteKit import GameplayKit class GameViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() if let view = self.view as! SKView? { // Load the SKScene from 'GameScene.sks' if let scene = SKScene(fileNamed: "GameScene") { // Set the scale mode to scale to fit the window scene.scaleMode = .aspectFill // Present the scene view.presentScene(scene) } view.ignoresSiblingOrder = true view.showsFPS = true view.showsNodeCount = true } } override var shouldAutorotate: Bool { return true } override var supportedInterfaceOrientations: UIInterfaceOrientationMask { if UIDevice.current.userInterfaceIdiom == .phone { return .allButUpsideDown } else { return .all } } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Release any cached data, images, etc that aren't in use. } override var prefersStatusBarHidden: Bool { return true } }
[ 350209, 316802, 300291, 311046, 350217, 370186, 342539, 276108, 310924, 350353, 350199, 350356, 309783, 315799, 287385, 241559, 402968, 241562, 294680, 419488, 415008, 241572, 350373, 212647, 290347, 234545, 241585, 293684, 264629, 350394, 264639, 345920, 264641, 350401, 234691, 300228, 419521, 419524, 319817, 264654, 317135, 300240, 248152, 288858, 300251, 222555, 370144, 419553, 110435, 300262, 292967, 110440, 196968, 241642, 241645, 230126, 412654, 350320, 351216, 110447, 370163, 299125, 297590, 350327, 318584, 292732, 242429, 318591 ]
6a29156f69b3c4833c3795344ee18a67007c42e9
521e11e16533de985f4044e9a88647d8e6bc4339
/Endless/Classes/public/IndicatorProtocol.swift
3bc7971f14c1d998cadd6d4ad0ce98b746f7f992
[ "MIT" ]
permissive
alltrails/Endless
e56493c43fbf64f39c3c835542f96a935b2e7622
1934da5eb44c9485502c6e7bf2e99956ee2311d9
refs/heads/master
2022-12-28T05:48:53.929740
2020-10-07T15:30:36
2020-10-07T15:30:36
292,392,760
1
0
MIT
2020-09-02T20:57:41
2020-09-02T20:55:39
null
UTF-8
Swift
false
false
146
swift
import Foundation public protocol IndicatorProtocol { var selectedIndex: Int { get set } func setup(with configuration: Configuration) }
[ -1 ]
d75c5b308127115b0233d909729e3193d78f32b4
9041a65aa9ca9457e84ee73ea0de51af228d17b8
/AnimatableStackView/Classes/AnimatableView.swift
b1a0c343d8f82055e33977e15d2b8450c355765d
[ "MIT" ]
permissive
APUtils/AnimatableStackView
4af4080b55a7993793ad91e73aaddba2ac4a74b4
34a02b66ef5288f049e729cf253353ae27b88e16
refs/heads/master
2022-03-14T14:39:54.381949
2022-02-21T22:13:57
2022-02-21T22:13:57
195,983,062
1
0
null
null
null
null
UTF-8
Swift
false
false
17,638
swift
// // AnimatableView.swift // AnimatableStackView // // Created by Anton Plebanovich on 7/2/20. // Copyright © 2020 Anton Plebanovich. All rights reserved. // import Foundation import RoutableLogger import UIKit /// Subview that can be created with view model and has an ID. public protocol AnimatableView_Subview: UIView, CreatableWithViewModel, Identifiable { var animatableViewModel: Any? { get } } /// View model that has ID and view class to which it belong. public protocol AnimatableView_ViewModel: Identifiable { var animatableViewClass: AnimatableView_Subview.Type { get } // Optional method that may be used to prevent updates if the view model doesn't have any changes compared to an another. func hasChanges(from viewModel: Any?) -> Bool } public extension AnimatableView_ViewModel { /// Creates view configures with `self`. func createConfiguredView() -> AnimatableView_Subview { animatableViewClass.create(viewModel: self) } } public extension AnimatableView_ViewModel { func hasChanges(from viewModel: Any?) -> Bool { true } } /// View that groups subviews in the vertical stack and animates chages. /// Just perform changes using `update(viewModels:postLayout:)` /// and then call `view.layoutIfNeeded()` inside animation block. open class AnimatableView: UIView { /// View model that has ID and view class to which it belong. public typealias ViewModel = AnimatableView_ViewModel /// Subview that can be created with view model and has an ID. public typealias Subview = AnimatableView_Subview // ******************************* MARK: - Properties private var previousViewModels: [ViewModel] = [] /// Array of `Views` that animatable view is currently displaying. View is considered visible if it's /// alpha is more than or equal to 0.01 and `isHidden` property is `false.` /// - warning: You should not check `subviews` property since it contains reusable and invisible views /// and their position and order might be ambiguous in that state. public private(set) var visibleViews: [Subview] = [] /// - warning: You should not check `subviews` property since it contains reusable and invisible views /// and their position and order might be ambiguous in that state. open override var subviews: [UIView] { super.subviews } private let viewsPool = ViewsPool() // ******************************* MARK: - Initialization and Setup public override init(frame: CGRect) { super.init(frame: frame) setup() } public required init?(coder: NSCoder) { super.init(coder: coder) } open override func awakeFromNib() { super.awakeFromNib() setup() } private func setup() { translatesAutoresizingMaskIntoConstraints = false clipsToBounds = true } // ******************************* MARK: - UIView Overrides open override var intrinsicContentSize: CGSize { .zero } // ******************************* MARK: - Methods /// Core method to update view's subviews. /// May be called inside animation block. /// If called inside animation block `layoutIfNeeded()` should be called on base view, /// e.g. view controller's view for animations to work. /// - parameter viewModels: View models that will be used to configure a new state. /// /// Views will be reused or created whenever needed and properly attached so animation will be smooth. /// /// - warning: View model and view (after configuration) IDs should match for the reuse logic to work. Basicaly, you should just return view model's ID after your view was configured with it. open func update(viewModels: [ViewModel]) { func beforeReuse(view: UIView) { // Restore original alpha if let originalAlpha = view.originalAlpha { view.alpha = originalAlpha view.originalAlpha = nil } } func afterReuse(view: UIView, previousView: UIView, hasChanges: Bool, isAnimating: Bool) { // Ignore invisible views guard view.isVisible else { return } // Prepare for animation if needed if isAnimating { view.performNonAnimatedForInvisible { let y = previousView === self ? 0 : previousView.frame.maxY if hasChanges { view.layoutHeight(y: y, width: bounds.width) view.layoutSubviewsOnly() } else { view.frame.origin.y = y } // Sned to back so new views will slide from under existing ones. sendSubviewToBack(view) } } } let ids = viewModels.map { $0.id } let uniqueIDs = Set(ids) if uniqueIDs.count < ids.count { var duplicatedIDs = ids uniqueIDs.forEach { uniqueID in guard let index = duplicatedIDs.firstIndex(of: uniqueID) else { return } duplicatedIDs.remove(at: index) } RoutableLogger.logError("Some view models have the same ID. That's prohibited. Please fix.", data: ["ids": ids, "uniqueIDs": uniqueIDs, "duplicatedIDs": duplicatedIDs]) } // Reusing views with the same ID first var existingReusableViews: [String: Subview] = viewModels.dictionaryMap { viewModel in if let view = viewsPool.getExistingNonConfiguredView(viewModel: viewModel) { return (viewModel.id, view) } else { return nil } } let isAnimating = UIView.isAnimating let previousViews = visibleViews var newViews: [Subview] = [] var previousView: UIView = self var constraints: [NSLayoutConstraint] = [] viewModels.forEach { viewModel in var view: Subview! if let existingView = visibleViews.first(where: { $0.id == viewModel.id }) { // Update view = existingView if viewModel.hasChanges(from: existingView.animatableViewModel) { view.configure(viewModel: viewModel) checkID(subview: view, viewModel: viewModel) } } else if let existingReusableView = existingReusableViews[viewModel.id] { // Reuse existing existingReusableViews[viewModel.id] = nil existingReusableView.performNonAnimatedForInvisible { beforeReuse(view: existingReusableView) if viewModel.hasChanges(from: existingReusableView.animatableViewModel as? AnimatableView.ViewModel) { existingReusableView.configure(viewModel: viewModel) afterReuse(view: existingReusableView, previousView: previousView, hasChanges: true, isAnimating: isAnimating) checkID(subview: existingReusableView, viewModel: viewModel) } else { afterReuse(view: existingReusableView, previousView: previousView, hasChanges: false, isAnimating: isAnimating) } } view = existingReusableView view.animateFadeInIfNeeded() } else { // Reuse or creation view = viewsPool.getConfiguredView(viewModel: viewModel, width: bounds.width, onCreation: { view in afterReuse(view: view, previousView: previousView, hasChanges: true, isAnimating: isAnimating) // Insert at 0 so new views will slide from under existing ones. insertSubview(view, at: 0) constraints.append(view.leadingAnchor.constraint(equalTo: leadingAnchor)) constraints.append(view.trailingAnchor.constraint(equalTo: trailingAnchor)) }, beforeReuse: beforeReuse, afterReuse: { afterReuse(view: $0, previousView: previousView, hasChanges: $1, isAnimating: isAnimating) }) view.animateFadeInIfNeeded() } // Return an invisible view to the views pool guard view.isVisible else { viewsPool.add(view) return } let anchor = previousView === self ? topAnchor : previousView.bottomAnchor view.constraintFromTopIfNeeded(to: previousView, anchor: anchor).flatMap { constraints.append($0) } previousView = view newViews.append(view) } let anchor = previousView === self ? topAnchor : previousView.bottomAnchor constraintFromBottomIfNeeded(to: previousView, anchor: anchor).flatMap { constraints.append($0) } NSLayoutConstraint.activate(constraints) /// Find removed views let removedViews = previousViews .filter { previousView in !newViews.contains { $0 === previousView } } /// Fade out removedViews.forEach { if $0.isVisible { $0.originalAlpha = $0.alpha $0.alpha = 0 } } viewsPool.add(removedViews) visibleViews = newViews } // ******************************* MARK: - Other Public Methods /// Find view that corresponds to passed ID. open func getView(id: String) -> Subview? { return subviews .compactMap { $0 as? Subview } .first { $0.id == id } } /// Find view that corresponds to passed identity. E.g. you can pass view model and get view for that. open func getView(identity: Identifiable) -> Subview? { return subviews .compactMap { $0 as? Subview } .first { $0.id == identity.id } } } private var c_topConstraintAssociationKey = 0 private var c_bottomConstraintAssociationKey = 0 private extension UIView { private var topConstraint: NSLayoutConstraint? { get { return objc_getAssociatedObject(self, &c_topConstraintAssociationKey) as? NSLayoutConstraint } set { objc_setAssociatedObject(self, &c_topConstraintAssociationKey, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) } } private var bottomConstraint: NSLayoutConstraint? { get { return objc_getAssociatedObject(self, &c_bottomConstraintAssociationKey) as? NSLayoutConstraint } set { objc_setAssociatedObject(self, &c_bottomConstraintAssociationKey, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) } } func constraintFromTopIfNeeded(to view: UIView, anchor: NSLayoutYAxisAnchor) -> NSLayoutConstraint? { if let existingConstraint = topConstraint { if existingConstraint.secondItem !== view || !existingConstraint.isActive { existingConstraint.isActive = false topConstraint = topAnchor.constraint(equalTo: anchor) return topConstraint } else { return nil } } else { topConstraint = topAnchor.constraint(equalTo: anchor) return topConstraint } } func constraintFromBottomIfNeeded(to view: UIView, anchor: NSLayoutYAxisAnchor) -> NSLayoutConstraint? { if let existingConstraint = bottomConstraint { if existingConstraint.secondItem !== view { existingConstraint.isActive = false bottomConstraint = bottomAnchor.constraint(equalTo: anchor) return bottomConstraint } else { return nil } } else { bottomConstraint = bottomAnchor.constraint(equalTo: anchor) return bottomConstraint } } } private extension CGFloat { /// Returns this value rounded to a pixel value using the specified rounding rule. /// Uses `.toNearestOrAwayFromZero` by default. /// - returns: The integral value found by rounding using rule. func roundedToPixel(_ rule: FloatingPointRoundingRule = .toNearestOrAwayFromZero) -> CGFloat { let scale = UIScreen.main.scale return (self * scale).rounded(rule) / scale } } private final class ViewsPool { typealias ViewClosure = (AnimatableView.Subview) -> Void typealias HasChangesClosure = (AnimatableView.Subview, Bool) -> Void // TODO: Can be improved by using dictionary but we need a performant way of converting `viewClass` to a hash. private var views: [AnimatableView.Subview] = [] func add(_ view: AnimatableView.Subview) { self.views.append(view) } func add(_ views: [AnimatableView.Subview]) { self.views.append(contentsOf: views) } func getExistingNonConfiguredView(viewModel: AnimatableView.ViewModel) -> AnimatableView.Subview? { if let existingViewIndex = views.firstIndex(where: { $0.id == viewModel.id }) { /// Found reusable view with the same ID. Checking if it requires reconfiguration. let existingView = views.remove(at: existingViewIndex) return existingView } else { return nil } } func getConfiguredView(viewModel: AnimatableView.ViewModel, width: CGFloat, onCreation: ViewClosure = { _ in }, beforeReuse: ViewClosure = { _ in }, afterReuse: HasChangesClosure = { _, _ in }) -> AnimatableView.Subview { if let existingViewIndex = views.firstIndex(where: { $0.id == viewModel.id }) { /// Found reusable view with the same ID. Checking if it requires reconfiguration. let existingView = views.remove(at: existingViewIndex) existingView.performNonAnimatedForInvisible { beforeReuse(existingView) if viewModel.hasChanges(from: existingView.animatableViewModel as? AnimatableView.ViewModel) { existingView.configure(viewModel: viewModel) afterReuse(existingView, true) checkID(subview: existingView, viewModel: viewModel) } else { afterReuse(existingView, false) } } return existingView } else if let existingView = views.reversed().first(where: { type(of: $0) == viewModel.animatableViewClass }) { /// Found reusable view of the same class. Reconfigure and use. if let existingViewIndex = views.firstIndex(where: { $0 === existingView }) { views.remove(at: existingViewIndex) } existingView.performNonAnimatedForInvisible { beforeReuse(existingView) existingView.configure(viewModel: viewModel) afterReuse(existingView, true) checkID(subview: existingView, viewModel: viewModel) } return existingView } else { /// Create new configured view and return. var view: AnimatableView.Subview! UIView.performWithoutAnimation { view = viewModel.createConfiguredView() // View will be managed by constraints so make sure mask is disabled if view.translatesAutoresizingMaskIntoConstraints { RoutableLogger.logInfo("Autoresizing mask will be disabled for a view: \(view.description)") view.translatesAutoresizingMaskIntoConstraints = false } // We need to layout because view might be of a wrong size after creation and configuration view.layoutHeight(width: width) view.layoutSubviewsOnly() onCreation(view) } return view } } } // ******************************* MARK: - Scripting extension Sequence { @inlinable func dictionaryMap<T, U>(_ transform: (_ element: Iterator.Element) throws -> (T, U)?) rethrows -> [T: U] { return try self.reduce(into: [T: U]()) { dictionary, element in guard let (key, value) = try transform(element) else { return } dictionary[key] = value } } } extension CALayer { func removeAllAnimationsRecursively() { removeAllAnimations() sublayers?.forEach { $0.removeAllAnimationsRecursively() } } } private func checkID(subview: AnimatableView_Subview, viewModel: AnimatableView_ViewModel) { if subview.id != viewModel.id { RoutableLogger.logError("View should have the same ID as view model after configuration", data: ["subviewID": subview.id, "viewModelID": viewModel.id, "subview": subview, "viewModel": viewModel]) } }
[ -1 ]
24213b2494587130a846b982f608dbd011cb4226
35a08861b0ade9ff9d270dcc8385be6c76413622
/Examples/Example1/ExampleTests/ExampleTests.swift
f5fcd60153c70ec5cf5015f0cefc30750124ac8f
[]
no_license
qqzhao/QZPodingLibs
d84d3641e81267d5a2a4daeb81909e180b90084b
e9ebc7eeb77a670d383cb5628ccb0373b1355623
refs/heads/master
2020-03-16T18:29:08.258559
2019-04-23T18:27:09
2019-04-23T18:27:09
132,875,040
0
1
null
2019-04-23T18:27:11
2018-05-10T08:57:57
Objective-C
UTF-8
Swift
false
false
968
swift
// // ExampleTests.swift // ExampleTests // // Created by qianzhao on 2018/5/10. // Copyright © 2018年 qianzhao. All rights reserved. // import XCTest @testable import Example class ExampleTests: XCTestCase { override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } func testExample() { // This is an example of a functional test case. // Use XCTAssert and related functions to verify your tests produce the correct results. } func testPerformanceExample() { // This is an example of a performance test case. self.measure { // Put the code you want to measure the time of here. } } }
[ 282633, 245457, 313357, 182296, 305179, 145435, 98333, 278558, 241692, 16419, 229413, 292902, 102437, 204840, 354345, 223274, 315434, 227370, 278570, 344107, 233517, 229424, 282672, 124975, 253999, 346162, 229430, 319542, 180280, 124984, 358456, 213052, 288833, 288834, 286788, 352326, 311372, 354385, 196691, 223316, 315476, 280661, 278615, 329814, 307289, 338007, 200794, 354393, 309345, 307299, 227428, 280675, 280677, 313447, 194666, 278634, 315498, 278638, 288879, 319598, 299121, 352368, 284788, 233589, 233590, 131191, 223350, 237689, 280694, 333940, 292988, 313469, 131198, 215164, 292992, 215166, 278655, 333955, 227460, 194691, 280712, 215178, 311438, 235662, 241808, 323729, 325776, 317587, 278677, 284826, 278685, 346271, 311458, 278691, 49316, 233636, 299174, 333991, 333992, 184484, 284842, 278699, 323236, 32941, 153776, 278704, 239793, 278708, 125109, 278869, 131256, 184505, 295098, 227513, 280762, 223419, 299198, 182456, 379071, 280768, 299203, 301251, 309444, 338119, 282831, 321745, 254170, 301279, 311519, 356576, 338150, 176362, 286958, 125169, 338164, 327929, 184570, 227578, 243962, 184575, 125183, 309503, 125188, 313608, 125193, 375051, 278797, 180493, 125198, 325905, 254226, 125203, 361927, 125208, 309529, 325912, 282909, 299293, 278816, 282913, 233762, 125217, 211235, 217380, 305440, 151847, 282919, 227616, 125235, 332085, 280887, 125240, 332089, 315706, 278842, 282939, 287041, 241986, 287043, 260418, 139589, 280902, 227654, 332101, 182598, 323916, 319821, 254286, 348492, 250192, 6481, 323920, 344401, 348500, 366929, 289110, 305495, 155990, 168281, 366930, 6489, 272729, 379225, 293556, 323935, 106847, 391520, 321894, 416104, 280939, 242029, 246127, 313713, 354676, 199029, 291192, 139640, 246136, 246137, 362881, 248194, 225670, 395659, 227725, 227726, 395661, 240016, 190871, 291224, 293274, 317852, 242078, 283038, 61857, 285090, 61859, 381347, 289189, 375207, 340398, 377264, 61873, 61880, 283064, 278970, 293306, 319930, 336317, 293310, 278978, 291267, 127427, 127428, 283075, 188871, 324039, 278989, 281037, 317901, 281040, 278993, 326100, 278999, 328152, 176601, 242139, 369116, 285150, 287198, 279008, 342498, 242148, 279013, 195045, 311786, 279018, 291311, 281072, 309744, 279029, 279032, 233978, 279039, 301571, 291333, 342536, 287241, 279050, 340490, 283153, 303636, 279062, 289304, 279065, 342553, 291358, 182817, 180771, 375333, 377386, 293419, 244269, 283182, 283184, 236081, 23092, 234036, 289332, 315960, 352829, 70209, 115270, 70215, 293448, 309830, 377418, 301638, 348742, 322120, 281166, 55881, 348749, 244310, 285271, 295519, 354911, 436832, 66150, 111208, 344680, 279146, 191082, 313966, 281199, 295536, 287346, 287352, 301689, 279164, 291454, 189057, 311941, 348806, 279177, 369289, 152203, 330379, 344715, 184973, 311949, 330387, 330388, 117397, 352917, 227990, 230040, 271000, 289434, 342682, 221852, 205471, 279206, 295590, 287404, 295599, 205487, 303793, 299699, 299700, 164533, 289462, 166582, 338613, 287417, 314040, 285371, 285372, 285373, 285374, 287422, 303803, 158394, 66242, 320493, 287433, 225995, 154316, 363211, 333521, 279252, 333523, 96984, 318173, 289502, 363230, 299746, 295652, 279269, 338662, 285415, 234217, 342762, 346858, 230125, 289518, 299759, 279280, 312047, 125684, 199414, 154359, 228088, 230134, 234234, 35583, 299776, 205568, 242433, 162561, 285444, 363263, 322313, 322319, 295697, 285458, 166676, 310036, 291604, 207640, 326429, 336671, 326433, 344865, 281377, 283430, 262951, 289576, 279336, 262954, 318250, 312108, 295724, 152365, 285487, 164656, 318252, 262962, 353069, 328499, 242485, 234294, 230199, 353078, 353079, 285497, 293693, 336702, 160575, 295744, 295746, 420677, 353094, 353095, 380357, 299849, 283467, 293711, 201551, 281427, 353109, 281433, 230234, 295776, 279392, 293730, 349026, 303972, 351077, 279397, 275303, 342887, 308076, 242541, 246641, 330609, 295798, 209783, 246648, 209785, 279417, 177019, 269178, 361337, 291712, 254850, 359298, 287622, 240518, 113542, 228233, 228234, 308107, 56208, 308112, 295824, 293781, 209817, 324506, 324507, 318364, 310178, 189348, 324517, 283558, 310182, 289703, 293800, 353195, 140204, 236461, 293806, 353197, 189374, 289727, 353216, 349121, 363458, 19399, 213960, 279498, 316364, 338899, 304087, 340955, 248797, 207838, 50143, 130016, 340961, 64485, 314342, 123881, 324586, 326635, 203757, 304110, 183279, 289774, 320494, 340974, 314355, 277492, 316405, 240630, 295927, 201720, 312314, 314362, 304122, 320507, 328700, 328706, 320516, 277509, 134150, 354343, 230410, 320527, 146448, 324625, 234514, 277524, 316437, 140310, 230423, 293910, 418837, 281626, 197657, 201755, 336929, 189474, 300068, 357414, 248872, 345132, 238639, 252980, 312373, 203830, 300084, 322612, 359478, 324666, 238651, 302139, 21569, 349255, 359495, 238664, 300111, 314448, 341073, 205906, 353367, 234587, 156764, 277597, 156765, 304222, 113760, 230499, 281700, 314467, 250981, 322663, 300135, 300136, 281706, 207979, 228458, 279660, 316520, 15471, 316526, 357486, 312434, 300146, 187506, 353397, 291959, 279672, 300151, 160891, 285820, 341115, 363644, 300158, 150657, 187521, 248961, 285828, 279685, 285830, 302213, 222343, 349316, 349318, 228491, 228493, 234638, 285838, 169104, 162961, 177296, 308372, 326804, 296086, 238743, 187544, 185493, 283802, 119962, 296092, 300187, 300188, 339102, 302240, 330913, 306338, 343203, 234663, 300201, 300202, 249002, 281771, 253099, 238765, 279728, 238769, 367799, 294074, 339130, 64700, 228542, 302274, 279747, 343234, 367810, 259268, 283847, 353479, 62665, 353481, 353482, 283852, 244940, 283853, 290000, 228563, 189652, 279765, 296153, 357595, 279774, 298208, 310497, 298212, 304356, 290022, 330984, 228588, 234733, 298221, 253167, 279792, 353523, 298228, 302325, 292085, 228600, 216315, 208124, 316669, 363771, 388349, 228609, 234755, 279814, 322824, 242954, 292107, 312587, 328971, 251153, 245019, 320796, 126237, 130338, 339234, 304421, 130343, 279854, 351537, 298291, 345396, 300343, 116026, 222524, 286018, 113987, 193859, 279875, 304456, 230729, 224586, 372043, 177484, 222541, 296270, 234831, 251213, 238927, 296273, 120148, 314709, 318805, 357719, 283991, 222559, 314720, 294243, 230756, 281957, 292195, 163175, 333160, 230765, 306542, 296303, 284014, 243056, 279920, 312689, 314739, 116084, 327025, 327031, 181625, 111993, 306559, 306560, 179587, 148867, 294275, 298374, 378244, 314758, 296329, 142729, 314760, 388487, 368011, 314766, 296335, 318864, 112017, 234898, 306579, 112018, 224661, 282007, 357786, 318875, 290207, 314783, 310692, 333220, 282022, 314789, 282024, 279974, 241066, 316842, 310701, 279984, 286129, 173491, 286132, 210358, 284089, 228795, 292283, 304577, 302529, 415171, 292292, 302531, 163268, 306631, 296392, 300489, 280010, 284107, 302540, 310732, 312782, 306639, 300487, 370123, 148940, 222675, 280013, 64975, 327121, 366037, 210390, 210391, 353750, 228827, 210393, 286172, 280032, 144867, 310757, 187878, 280041, 361963, 54765, 191981, 282096, 296433, 306673, 321009, 251378, 306677, 343542, 280055, 300536, 288249, 286202, 343543, 290300, 290301, 228861, 300542, 296448, 230913, 286205, 210433, 306692, 306693, 282114, 228867, 366083, 230921, 323080, 253452, 296461, 323087, 304656, 329232, 316946, 308756, 146964, 398869, 282136, 308764, 282141, 349726, 282146, 306723, 245287, 313339, 245292, 349741, 169518, 230959, 286254, 288309, 290358, 235070, 288318, 194110, 280130, 349763, 196164, 124485, 288326, 288327, 282183, 56902, 292425, 243274, 128587, 333388, 333393, 290390, 128599, 235095, 300630, 306776, 196187, 239198, 343647, 157281, 286306, 300644, 282213, 374372, 317032, 310889, 323178, 54893, 138863, 222832, 314998, 247416, 366203, 175741, 337535, 235135, 294529, 224901, 282245, 282246, 288392, 229001, 290443, 310923, 188048, 323217, 239250, 282259, 345752, 229020, 298654, 282271, 333470, 282273, 302754, 255649, 282276, 229029, 40613, 40614, 282280, 290471, 298661, 300714, 245412, 40615, 286391, 321207, 296632, 306874, 280251, 319162, 286399, 282303, 280257, 218819, 321219, 282312, 306890, 280267, 212685, 333517, 282318, 212688, 313041, 9936, 9937, 302802, 333520, 280278, 286423, 282327, 278233, 278234, 280280, 67292, 298712, 294622, 18138, 278240, 229088, 298720, 321247, 153319, 12010, 288491, 280300, 239341, 212716, 212717, 282348, 284401, 282355, 323316, 282358, 313081, 229113, 286459, 325371, 124669, 194303, 278272, 175873, 319233, 323331, 67332, 288516, 323332, 216839, 311042, 280329, 282378, 300811, 280327, 284429, 321295, 323346, 278291, 294678, 282391, 321302, 116505, 366360, 249626, 284442, 325404, 321310, 282400, 313120, 241441, 325410, 339745, 341796, 247590, 257830, 282409, 284459, 280366, 317232, 282417, 200498, 296755, 280372, 321337, 282427, 280380, 360252, 345919, 325439, 282434, 307011, 315202, 280390, 282438, 280392, 345929, 341836, 325457, 304977, 18262, 216918, 280410, 370522, 188251, 300894, 307039, 237408, 245599, 302946, 345951, 362337, 284514, 296806, 345955, 292712, 284512, 282474, 288619, 288620, 325484, 280430, 292720, 362352, 313203, 342713, 325492, 300918, 241528, 194429, 124798, 325503, 315264, 182144, 305026, 253829, 333701, 67463, 282504, 315273, 315274, 243591, 241361, 243597, 325518, 110480, 282518, 282519, 124824, 294809, 214937, 329622, 298909, 294814, 311199, 118685, 319392, 292771, 354212, 294823, 298920, 333735, 284587, 292782, 124852, 243637, 288697, 290746, 294843, 214977, 280514, 163781, 214984, 284619, 344013, 247757, 231375, 301008, 153554, 212946, 219101, 280541, 292836, 298980, 294886, 337895, 247785, 253929, 296941, 327661, 362480, 311281, 311282, 325619, 333817, 292858, 290811 ]
114c0deb2a0e7b45c8cd799c67fe5551fd3bfcbb
b7bedece0c219b3f6f72dfbc43b530b410e5f83f
/Phazia/ContentView.swift
d175cdc40b9e8adc0eccbfdb4d14e610bda1ee22
[]
no_license
Phazia/Phazia
e4be48335c283fd393b04b0f7ad62f95f0b8955d
bb148e38b0be1567442a86b032a75a8b39a7a584
refs/heads/master
2022-06-05T04:07:20.628258
2020-05-02T23:36:37
2020-05-02T23:36:37
260,555,684
0
0
null
null
null
null
UTF-8
Swift
false
false
352
swift
// // ContentView.swift // Phazia // // Created by Charan Sriram on 5/1/20. // Copyright © 2020 Charan Sriram. All rights reserved. // import SwiftUI struct ContentView: View { var body: some View { HomeView() } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }
[ 386465, 396165, 245201, 374130, 260372 ]
9a6a7388ffe63ebb3b439110e39507d1722efb4a
ec8bc96bb724815261355a281bd90515496bb651
/AVFoudationExample/ImagePreviewViewController.swift
43b46d825da65bf9f3d91b1147372f50e6abb5f9
[]
no_license
hung977/CaptureAVFoudation
3a363a340d6ebb92db15df9803163103975dc810
b0be0ff67bd270d47f17ac270096ca786d3eeb4f
refs/heads/master
2022-11-26T10:45:31.445993
2020-08-03T18:18:25
2020-08-03T18:18:25
284,774,779
0
0
null
null
null
null
UTF-8
Swift
false
false
711
swift
// // ImagePreviewViewController.swift // AVFoudationExample // // Created by admin on 8/3/20. // Copyright © 2020 admin. All rights reserved. // import Foundation import UIKit class ImagePreviewViewController : UIViewController { var capturedImage : UIImage? @IBOutlet weak var imageView: UIImageView! override func viewDidLoad() { super.viewDidLoad() NotificationCenter.default.addObserver(self, selector: #selector(didCapturePhoto(notification:)), name: .didCapturePhoto, object: nil) } @objc func didCapturePhoto(notification: Notification) { if let image = notification.object as? UIImage { imageView.image = image } } }
[ -1 ]
c38bcad14e7f10a91fa06321c8af2b81cfc1bf9a
cae4da287d965ba7fbd22e8f84251816737492ef
/locate_your_friend/SignInViewController.swift
97e05155790d319d0e54b3a219a4553ef7f27558
[]
no_license
ramyathay/locate_your_friend
4851168ebbdb632642ade92f58d0902b0d66640f
b5c7ef6b3741596dab92a3cda111783dd5acb9f5
refs/heads/master
2021-01-19T03:14:04.016163
2016-07-03T21:19:40
2016-07-03T21:19:40
52,637,599
1
0
null
null
null
null
UTF-8
Swift
false
false
2,064
swift
// // ViewController.swift // friendFinder // // import UIKit class SignInViewController: UIViewController, UITextFieldDelegate, CancelButtonDelegate{ // var colorArray = ColorSchemeOf(ColorScheme.Analogous, FlatGreen(), true) var userName: String? override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. let textField = userNameInput textField.delegate = self } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } @IBOutlet weak var userNameInput: UITextField! @IBAction func findFriendsSegueueButton(sender: AnyObject) { let userName: String = userNameInput.text! print(userName) performSegueWithIdentifier("findFriendsSegue", sender: userName) } override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "findFriendsSegue" { var userName = userNameInput.text! print(sender) if let whatSender = sender { print(whatSender, " THIS IS THE SENDER") } // userName = sender as! String let navigationController = segue.destinationViewController as! UINavigationController let controller = navigationController.topViewController as! MapViewController controller.userName = userName // signInViewController(controller: MapViewController, didFinishAddingUser: userName) // print(isEditing!) } } func textFieldShouldReturn(textField: UITextField) -> Bool { self.view.endEditing(true) print("WTF") return false } func cancelButtonPressedFrom(controller: UIViewController) { dismissViewControllerAnimated(true, completion: nil) print("we dismissed the view controller") } }
[ -1 ]
74c6a808d6fff675e531e5f24fe336bb7f68d0f1
7f8b2d10260b159cc2b3db6f403e1dd6a9f4104a
/Tests/PerformanceTests.swift
c2a7725ef9b28cab34da17fb77ea6ab24dddb012
[ "MIT" ]
permissive
tevelee/Expression
52ded09dde583a0c23b983ba309febe428595fe3
4e2d3195c6d1adcbd23a6fc97055f8c94b8d7216
refs/heads/master
2022-08-18T02:06:47.285979
2018-02-13T18:37:26
2018-02-13T18:37:26
121,484,851
0
0
MIT
2022-07-22T09:06:48
2018-02-14T07:53:42
Swift
UTF-8
Swift
false
false
19,253
swift
// // PerformanceTests.swift // ExpressionTests // // Created by Nick Lockwood on 24/05/2017. // Copyright © 2017 Nick Lockwood. All rights reserved. // // Distributed under the permissive MIT license // Get the latest version from here: // // https://github.com/nicklockwood/Expression // // 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 Expression import XCTest class PerformanceTests: XCTestCase { private let parseRepetitions = 500 private let evalRepetitions = 5000 private struct HashableStruct: Hashable { let foo: Int var hashValue: Int { return foo.hashValue } static func == (lhs: HashableStruct, rhs: HashableStruct) -> Bool { return lhs.foo == rhs.foo } } // MARK: parsing func testParsingShortExpressions() { let expressions = shortExpressions measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = Expression.parse(exp, usingCache: false) } } } } func testParsingMediumExpressions() { let expressions = mediumExpressions measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = Expression.parse(exp, usingCache: false) } } } } func testParsingLongExpressions() { let expressions = longExpressions measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = Expression.parse(exp, usingCache: false) } } } } func testParsingReallyLongExpressions() { let exp = reallyLongExpression measure { for _ in 0 ..< parseRepetitions { _ = Expression.parse(exp, usingCache: false) } } } func testParsingBooleanExpressions() { let expressions = booleanExpressions measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = Expression.parse(exp, usingCache: false) } } } } // MARK: optimizing func testOptimizingShortExpressions() { let expressions = shortExpressions.map { Expression.parse($0, usingCache: false) } measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = Expression(exp, options: .pureSymbols, symbols: symbols) } } } } func testOptimizingShortExpressionsWithNewInitializer() { let expressions = shortExpressions.map { Expression.parse($0, usingCache: false) } measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = Expression(exp, impureSymbols: { _ in nil }, pureSymbols: { symbols[$0] }) } } } } func testOptimizingShortAnyExpressions() { let expressions = shortExpressions.map { Expression.parse($0, usingCache: false) } measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = AnyExpression(exp, options: .pureSymbols, symbols: anySymbols) } } } } func testOptimizingShortAnyExpressionsWithNewInitializer() { let expressions = shortExpressions.map { Expression.parse($0, usingCache: false) } measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = AnyExpression(exp, impureSymbols: { _ in nil }, pureSymbols: { anySymbols[$0] }) } } } } func testOptimizingMediumExpressions() { let expressions = mediumExpressions.map { Expression.parse($0, usingCache: false) } measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = Expression(exp, options: .pureSymbols, symbols: symbols) } } } } func testOptimizingMediumExpressionsWithNewInitializer() { let expressions = mediumExpressions.map { Expression.parse($0, usingCache: false) } measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = Expression(exp, impureSymbols: { _ in nil }, pureSymbols: { symbols[$0] }) } } } } func testOptimizingMediumAnyExpressions() { let expressions = mediumExpressions.map { Expression.parse($0, usingCache: false) } measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = AnyExpression(exp, options: .pureSymbols, symbols: anySymbols) } } } } func testOptimizingMediumAnyExpressionsWithNewInitializer() { let expressions = mediumExpressions.map { Expression.parse($0, usingCache: false) } measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = AnyExpression(exp, impureSymbols: { _ in nil }, pureSymbols: { anySymbols[$0] }) } } } } func testOptimizingLongExpressions() { let expressions = longExpressions.map { Expression.parse($0, usingCache: false) } measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = Expression(exp, options: .pureSymbols, symbols: symbols) } } } } func testOptimizingLongExpressionsWithNewInitializer() { let expressions = longExpressions.map { Expression.parse($0, usingCache: false) } measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = Expression(exp, impureSymbols: { _ in nil }, pureSymbols: { symbols[$0] }) } } } } func testOptimizingLongAnyExpressions() { let expressions = longExpressions.map { Expression.parse($0, usingCache: false) } measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = AnyExpression(exp, options: .pureSymbols, symbols: anySymbols) } } } } func testOptimizingLongAnyExpressionsWithNewInitializer() { let expressions = longExpressions.map { Expression.parse($0, usingCache: false) } measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = AnyExpression(exp, impureSymbols: { _ in nil }, pureSymbols: { anySymbols[$0] }) } } } } func testOptimizingReallyLongExpression() { let exp = Expression.parse(reallyLongExpression, usingCache: false) measure { for _ in 0 ..< parseRepetitions { _ = Expression(exp, options: .pureSymbols, symbols: symbols) } } } func testOptimizinReallyLongExpressionWithNewInitializer() { let exp = Expression.parse(reallyLongExpression, usingCache: false) measure { for _ in 0 ..< parseRepetitions { _ = Expression(exp, impureSymbols: { _ in nil }, pureSymbols: { symbols[$0] }) } } } func testOptimizingReallyLongAnyExpression() { let exp = Expression.parse(reallyLongExpression, usingCache: false) measure { for _ in 0 ..< parseRepetitions { _ = AnyExpression(exp, options: .pureSymbols, symbols: anySymbols) } } } func testOptimizingReallyLongAnyExpressionWithNewInitializer() { let exp = Expression.parse(reallyLongExpression, usingCache: false) measure { for _ in 0 ..< parseRepetitions { _ = AnyExpression(exp, impureSymbols: { _ in nil }, pureSymbols: { anySymbols[$0] }) } } } func testOptimizingBooleanExpressions() { let expressions = booleanExpressions.map { Expression.parse($0, usingCache: false) } measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = Expression(exp, options: [.boolSymbols, .pureSymbols], symbols: symbols) } } } } func testOptimizingBooleanExpressionsWithNewInitializer() { let expressions = booleanExpressions.map { Expression.parse($0, usingCache: false) } measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = Expression(exp, impureSymbols: { _ in nil }, pureSymbols: { symbols[$0] }) } } } } func testOptimizingBooleanAnyExpressions() { let expressions = booleanExpressions.map { Expression.parse($0, usingCache: false) } measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = AnyExpression(exp, options: [.boolSymbols, .pureSymbols], symbols: anySymbols) } } } } func testOptimizingBooleanAnyExpressionsWithNewInitializer() { let expressions = booleanExpressions.map { Expression.parse($0, usingCache: false) } measure { for _ in 0 ..< parseRepetitions { for exp in expressions { _ = AnyExpression(exp, impureSymbols: { _ in nil }, pureSymbols: { anySymbols[$0] }) } } } } // MARK: evaluating func testEvaluatingShortExpressions() { let expressions = shortExpressions.map { Expression($0, options: .pureSymbols, symbols: symbols) } measure { for _ in 0 ..< evalRepetitions { for exp in expressions { _ = try! exp.evaluate() } } } } func testEvaluatingShortAnyExpressions() { let expressions = shortExpressions.map { AnyExpression($0, options: .pureSymbols, symbols: anySymbols) } measure { for _ in 0 ..< evalRepetitions { for exp in expressions { _ = try! exp.evaluate() as Any } } } } func testEvaluatingMediumExpressions() { let expressions = mediumExpressions.map { Expression($0, options: .pureSymbols, symbols: symbols) } measure { for _ in 0 ..< evalRepetitions { for exp in expressions { _ = try! exp.evaluate() } } } } func testEvaluatingMediumAnyExpressions() { let expressions = mediumExpressions.map { AnyExpression($0, options: .pureSymbols, symbols: anySymbols) } measure { for _ in 0 ..< evalRepetitions { for exp in expressions { _ = try! exp.evaluate() as Any } } } } func testEvaluatingLongExpressions() { let expressions = mediumExpressions.map { Expression($0, options: .pureSymbols, symbols: symbols) } measure { for _ in 0 ..< evalRepetitions { for exp in expressions { _ = try! exp.evaluate() } } } } func testEvaluatingLongAnyExpressions() { let expressions = mediumExpressions.map { AnyExpression($0, options: .pureSymbols, symbols: anySymbols) } measure { for _ in 0 ..< evalRepetitions { for exp in expressions { _ = try! exp.evaluate() as Any } } } } func testEvaluatingReallyLongExpression() { let exp = Expression(reallyLongExpression, options: .pureSymbols, symbols: symbols) measure { for _ in 0 ..< evalRepetitions { _ = try! exp.evaluate() } } } func testEvaluatingReallyLongAnyExpression() { let exp = AnyExpression(reallyLongExpression, options: .pureSymbols, symbols: anySymbols) measure { for _ in 0 ..< evalRepetitions { _ = try! exp.evaluate() as Any } } } func testEvaluatingBooleanExpressions() { let expressions = booleanExpressions.map { Expression($0, options: [.boolSymbols, .pureSymbols], symbols: symbols) } measure { for _ in 0 ..< evalRepetitions { for exp in expressions { _ = try! exp.evaluate() } } } } func testEvaluatingBooleanAnyExpressions() { let expressions = booleanExpressions.map { AnyExpression($0, options: [.boolSymbols, .pureSymbols], symbols: anySymbols) } measure { for _ in 0 ..< evalRepetitions { for exp in expressions { _ = try! exp.evaluate() as Any } } } } // MARK: == performance func testEquateDoubles() { let symbols: [AnyExpression.Symbol: AnyExpression.SymbolEvaluator] = [ .variable("a"): { _ in 5 }, .variable("b"): { _ in 6 }, ] let equalExpression = AnyExpression("a == a", symbols: symbols) let unequalExpression = AnyExpression("a == b", symbols: symbols) measure { for _ in 0 ..< evalRepetitions { _ = try! equalExpression.evaluate() as Any _ = try! unequalExpression.evaluate() as Any } } XCTAssertTrue(try equalExpression.evaluate()) XCTAssertFalse(try unequalExpression.evaluate()) } func testEquateBools() { let symbols: [AnyExpression.Symbol: AnyExpression.SymbolEvaluator] = [ .variable("a"): { _ in true }, .variable("b"): { _ in false }, ] let equalExpression = AnyExpression("a == a", symbols: symbols) let unequalExpression = AnyExpression("a == b", symbols: symbols) measure { for _ in 0 ..< evalRepetitions { _ = try! equalExpression.evaluate() as Any _ = try! unequalExpression.evaluate() as Any } } XCTAssertTrue(try equalExpression.evaluate()) XCTAssertFalse(try unequalExpression.evaluate()) } func testEquateStrings() { let symbols: [AnyExpression.Symbol: AnyExpression.SymbolEvaluator] = [ .variable("a"): { _ in "a" }, .variable("b"): { _ in "b" }, ] let equalExpression = AnyExpression("a == a", symbols: symbols) let unequalExpression = AnyExpression("a == b", symbols: symbols) measure { for _ in 0 ..< evalRepetitions { _ = try! equalExpression.evaluate() as Any _ = try! unequalExpression.evaluate() as Any } } XCTAssertTrue(try equalExpression.evaluate()) XCTAssertFalse(try unequalExpression.evaluate()) } func testEquateNSObjects() { let objectA = NSObject() let symbols: [AnyExpression.Symbol: AnyExpression.SymbolEvaluator] = [ .variable("a"): { _ in objectA }, .variable("b"): { _ in NSObject() }, ] let equalExpression = AnyExpression("a == a", symbols: symbols) let unequalExpression = AnyExpression("a == b", symbols: symbols) measure { for _ in 0 ..< evalRepetitions { _ = try! equalExpression.evaluate() as Any _ = try! unequalExpression.evaluate() as Any } } XCTAssertTrue(try equalExpression.evaluate()) XCTAssertFalse(try unequalExpression.evaluate()) } func testEquateArrays() { let symbols: [AnyExpression.Symbol: AnyExpression.SymbolEvaluator] = [ .variable("a"): { _ in ["hello"] }, .variable("b"): { _ in ["goodbye"] }, ] let equalExpression = AnyExpression("a == a", symbols: symbols) let unequalExpression = AnyExpression("a == b", symbols: symbols) measure { for _ in 0 ..< evalRepetitions { _ = try! equalExpression.evaluate() as Any _ = try! unequalExpression.evaluate() as Any } } XCTAssertTrue(try equalExpression.evaluate()) XCTAssertFalse(try unequalExpression.evaluate()) } func testEquateHashables() { let symbols: [AnyExpression.Symbol: AnyExpression.SymbolEvaluator] = [ .variable("a"): { _ in HashableStruct(foo: 5) }, .variable("b"): { _ in HashableStruct(foo: 6) }, ] let equalExpression = AnyExpression("a == a", symbols: symbols) let unequalExpression = AnyExpression("a == b", symbols: symbols) measure { for _ in 0 ..< evalRepetitions { _ = try! equalExpression.evaluate() as Any _ = try! unequalExpression.evaluate() as Any } } XCTAssertTrue(try equalExpression.evaluate()) XCTAssertFalse(try unequalExpression.evaluate()) } func testCompareAgainstNil() { let symbols: [AnyExpression.Symbol: AnyExpression.SymbolEvaluator] = [ .variable("a"): { _ in NSNull() }, .variable("b"): { _ in 5 }, ] let equalExpression = AnyExpression("a == a", symbols: symbols) let unequalExpression = AnyExpression("a == b", symbols: symbols) measure { for _ in 0 ..< evalRepetitions { _ = try! equalExpression.evaluate() as Any _ = try! unequalExpression.evaluate() as Any } } XCTAssertTrue(try equalExpression.evaluate()) XCTAssertFalse(try unequalExpression.evaluate()) } }
[ -1 ]
c21f7107f43d7f2702dcb26bd4afaa3aa149be5d
fd4a5ba59d5e745ba4e01b398debccb19165c4bc
/SwiftUIExample/View Modifiers/Adding Animations to a View/SU_Animation.swift
7e5faef897135cd96694732774c5c041d1f59211
[]
no_license
Jyhwenchai/SwiftUIExample
a644e2a22cb29e5c17fc4c6705382899a8803050
b8c509db7a9d6787492a484fe67302370721ca7e
refs/heads/master
2023-08-30T20:25:09.267669
2023-08-28T08:01:34
2023-08-28T08:01:34
249,932,726
2
0
null
null
null
null
UTF-8
Swift
false
false
1,242
swift
// // SU_Animation.swift // SwiftUIExample // // Created by 蔡志文 on 2020/3/19. // Copyright © 2020 蔡志文. All rights reserved. // import SwiftUI /** `func animation(_ animation: Animation?) -> some View` 将给定的动画应用于视图中的所有可动画的值。 在 SwiftUI 中几乎所有的属性都是可动画的,包括旋转、缩放、位移、透明度、圆角、颜色等等。你可以一一的进行尝试 */ struct SU_Animation: View { var body: some View { NavigationView { List(animationRowData) { item in NavigationLink(item.title, destination: item.destination) } .navigationBarTitle("Animations") } } } struct SU_Animation_Previews: PreviewProvider { static var previews: some View { SU_Animation() } } struct AnimationRow: Identifiable { var id = UUID() var title: String var destination: AnyView } private let animationRowData = [ AnimationRow(title: "Animation 01", destination: AnyView(SU_Animation_01())), AnimationRow(title: "Animation 02", destination: AnyView(SU_Animation_02())), AnimationRow(title: "Animation 03", destination: AnyView(SU_Animation_03())) ]
[ -1 ]
30b5e1882d380a455351daf195f41fd79713f1a4
b3a75ced7aab3694057d4b7da9206cc9db252b01
/homeWork4/ViewController.swift
165faff32716fda4be774ea4880b578d9c24708f
[]
no_license
youngleechan/hw4Tho
7c0eb95ca4c406703276e43ad5058824bca95774
8a5056c072e165bf47db5c76340f9315e228589c
refs/heads/master
2021-09-05T18:49:15.602547
2018-01-30T12:55:34
2018-01-30T12:55:34
119,522,910
0
0
null
null
null
null
UTF-8
Swift
false
false
1,853
swift
// // ViewController.swift // homeWork4 // // Created by Younglee on 1/28/18. // Copyright © 2018 Younglee. All rights reserved. // import UIKit class ViewController: UIViewController { @IBOutlet weak var GasLabel: UILabel! @IBOutlet weak var mileageLabel: UILabel! @IBOutlet weak var CarIsBroken: UILabel! @IBOutlet weak var GasRefillTextField: UITextField! @IBOutlet weak var raceKmTextField: UITextField! let carName = RaceCar.init(carBroke: false, typeCar: .sedan, gas: 0, mileage: 0) override func viewDidLoad() { print("Please refill gas before the race! there are no gas in car!") GasRefillTextField.keyboardType = .decimalPad raceKmTextField.keyboardType = . decimalPad } func setupData() { GasLabel.text = "\(carName.gas)" CarIsBroken.text = "\(carName.carBroke)" mileageLabel.text = "\(carName.mileage)" } @IBAction func gasRefilButton(_ sender: UIButton) { let literOfGas = GasRefillTextField.text if let literOfGas = literOfGas { if let literOfGasDouble = Double(literOfGas) { carName.refillGas(gasToReffill: literOfGasDouble) setupData() } else { print("The text is not a number") } } } @IBAction func raceKmButton(_ sender: UIButton) { if let kmRaceString = raceKmTextField.text { if let kmDouble = Double (kmRaceString) { carName.move(kilometers: kmDouble) carName.mileagePast(kilometers: kmDouble) setupData() } else { print("the text is not a number") } } } }
[ -1 ]
85b8f12b6d829db2985a18ceeb4d80a25d25f88b
c361b3bd07b57662ffa0d0d248f4b82ba33e48a5
/smack-app/smack-app/Controllers/ChatVC.swift
162fa3684b10050cc2845f07185234ae7096745b
[]
no_license
gredimano/ios-smack-app
be55960c2edfc9108795336d335562288fbe5961
3bc96b5fc459c6d0540cce319c007c18445d6897
refs/heads/master
2021-01-25T10:43:29.769335
2018-03-10T02:52:56
2018-03-10T02:52:56
123,367,540
0
0
null
null
null
null
UTF-8
Swift
false
false
7,054
swift
import UIKit class ChatVC: UIViewController, UITableViewDelegate, UITableViewDataSource { // Outlets @IBOutlet weak var menuBtn: UIButton! @IBOutlet weak var channelNameLbl: UILabel! @IBOutlet weak var messageTextBox: UITextField! @IBOutlet weak var tableView: UITableView! @IBOutlet weak var sendButton: UIButton! @IBOutlet weak var typingUsersLabel: UILabel! // Variables var isTyping = false override func viewDidLoad() { super.viewDidLoad() view.bindToKeyboard() tableView.delegate = self tableView.dataSource = self tableView.estimatedRowHeight = 80 tableView.rowHeight = UITableViewAutomaticDimension sendButton.isHidden = true let tap = UITapGestureRecognizer(target: self, action: #selector(ChatVC.handleTap)) view.addGestureRecognizer(tap) menuBtn.addTarget( self.revealViewController(), action: #selector(SWRevealViewController.revealToggle(_:)), for: .touchUpInside ) self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer()) self.view.addGestureRecognizer(self.revealViewController().tapGestureRecognizer()) NotificationCenter.default.addObserver( self, selector: #selector(ChatVC.userDataDidChange(_:)), name: NOTIF_USER_DATA_DID_CHANGE, object: nil ) NotificationCenter.default.addObserver( self, selector: #selector(ChatVC.channelSelected(_:)), name: NOTIF_CHANNEL_SELECTED, object: nil ) SocketService.instance.getChatMessage { (newMessage) in if newMessage.channelId == MessageService.instance.selectedChannel?._id && AuthService.instance.isLoggedIn { MessageService.instance.messages.append(newMessage) self.tableView.reloadData() if MessageService.instance.messages.count > 0 { let endIndex = IndexPath( row: MessageService.instance.messages.count - 1, section: 0 ) self.tableView.scrollToRow(at: endIndex, at: .bottom, animated: false) } } } SocketService.instance.getTypingUsers { (typingUsers) in guard let channelId = MessageService.instance.selectedChannel?._id else { return } var names = "" var numberOfTypers = 0 for (typingUser, channel) in typingUsers { if typingUser != UserDataService.instance.name && channel == channelId { if names == "" { names = typingUser } else { names = "\(names), \(typingUser)" } numberOfTypers += 1 } } if numberOfTypers > 0 && AuthService.instance.isLoggedIn { var verb = "is" if numberOfTypers > 1 { verb = "are" } self.typingUsersLabel.text = "\(names) \(verb) typing a message" } else { self.typingUsersLabel.text = "" } } if AuthService.instance.isLoggedIn { AuthService.instance.findUserByEmail(completion: { (success) in NotificationCenter.default.post(name: NOTIF_USER_DATA_DID_CHANGE, object: nil) }) } } @objc func userDataDidChange(_ notif: Notification) { if AuthService.instance.isLoggedIn { onLoginGetMessages() } else { channelNameLbl.text = "Please Log In" tableView.reloadData() } } @objc func channelSelected(_ notif: Notification) { updateWithChannel() } @objc func handleTap() { view.endEditing(true) } @IBAction func sendMessagePressed(_ sender: Any) { if AuthService.instance.isLoggedIn { guard let channelId = MessageService.instance.selectedChannel?._id else { return } guard let message = messageTextBox.text else { return } SocketService.instance.addMessage( messageBody: message, userId: UserDataService.instance.id, channelId: channelId, completion: { (success) in if success { self.messageTextBox.text = "" self.messageTextBox.resignFirstResponder() SocketService.instance.socket.emit("stopType", UserDataService.instance.name, channelId) } } ) } } func updateWithChannel() { let channelName = MessageService.instance.selectedChannel?.channelTitle ?? "" channelNameLbl.text = "#\(channelName)" getMessages() } @IBAction func messageBoxEditing(_ sender: Any) { guard let channelId = MessageService.instance.selectedChannel?._id else { return } if messageTextBox.text == "" { isTyping = false sendButton.isHidden = true SocketService.instance.socket.emit("stopType", UserDataService.instance.name, channelId) } else { if isTyping == false { sendButton.isHidden = false SocketService.instance.socket.emit("startType", UserDataService.instance.name, channelId) } isTyping = true } } func onLoginGetMessages() { MessageService.instance.findAllChannel { (success) in if success { if MessageService.instance.channels.count > 0 { MessageService.instance.selectedChannel = MessageService.instance.channels[0] self.updateWithChannel() } else { self.channelNameLbl.text = "No channels yet!" } } } } func getMessages() { guard let channelId = MessageService.instance.selectedChannel?._id else { return } MessageService.instance.findAllMessagesForChannel(channelId: channelId) { (success) in if success { self.tableView.reloadData() } } } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if let cell = tableView.dequeueReusableCell(withIdentifier: "messageCell", for: indexPath) as? MessageCell { let message = MessageService.instance.messages[indexPath.row] cell.configureCell(message: message) return cell } else { return UITableViewCell() } } func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return MessageService.instance.messages.count } }
[ 325657 ]
e10af72eb14b7453ff2deafda76acb4045da0a9f
f1610f34b5b3d5eb3fd09f95a921e497fef5e363
/PrimeGrid/AppDelegate.swift
a5803c81529e6f7cf63bf3aeccdf0cc6e28da850
[ "MIT" ]
permissive
alphabikram/PrimeGrid
78365db7f76537519fd4224a583793e87ddfbf70
f3f3307b6baf1fb3107bc8c7a3af67d02ad4fb3d
refs/heads/master
2021-06-08T09:30:52.924994
2016-10-06T21:37:55
2016-10-06T21:37:55
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,577
swift
// MIT License // // Copyright (c) 2016 stable|kernel // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { window = UIWindow(frame: UIScreen.main.bounds) window?.rootViewController = PrimeGridViewController() window?.makeKeyAndVisible() return true } }
[ 194560, 395267, 196612, 395271, 395274, 108279, 395278, 395280, 395281, 395282, 395283, 407569, 108281, 395286, 395287, 395289, 395290, 196638, 395295, 395296, 196641, 98341, 61478, 98344, 98345, 98349, 174135, 354359, 124987, 174139, 354364, 229438, 124988, 229440, 229441, 395328, 229443, 174148, 229444, 395332, 327751, 174152, 395333, 395334, 378951, 229449, 174159, 229456, 112721, 106580, 106582, 106584, 106585, 106586, 106587, 112730, 174171, 237682, 125048, 229504, 125057, 125064, 125065, 235658, 125066, 229524, 303255, 303256, 125087, 215205, 215206, 215208, 215211, 215212, 215215, 241846, 241852, 241859, 241862, 317638, 317640, 241864, 241866, 241868, 241870, 241873, 262353, 241877, 241878, 262359, 241879, 106713, 106714, 262366, 106720, 106725, 241894, 241897, 241901, 241903, 241904, 176370, 241907, 241908, 176373, 241910, 260342, 106742, 176378, 241916, 141565, 141566, 141569, 241923, 241928, 141577, 141578, 241930, 141576, 241931, 241934, 141583, 241936, 241937, 141586, 141588, 12565, 227604, 227607, 241944, 227608, 12569, 141593, 141594, 141595, 141596, 141597, 141598, 141599, 141600, 227610, 141603, 241952, 241957, 141606, 141607, 141608, 289062, 241962, 289067, 141612, 289068, 141609, 12592, 241961, 289074, 241963, 97347, 289078, 141627, 141629, 141632, 141634, 241989, 227609, 213319, 141640, 141641, 141642, 141643, 213320, 241992, 241996, 241998, 241999, 262475, 242002, 141651, 141646, 227612, 242006, 141655, 215384, 282967, 227613, 141650, 141660, 168285, 282969, 141663, 141664, 227614, 141670, 172391, 141674, 141677, 141679, 141681, 375154, 190840, 190841, 190842, 430456, 190843, 190844, 430458, 375165, 375168, 141700, 375172, 141702, 141701, 430471, 141707, 430476, 430475, 141711, 430483, 217492, 217494, 197016, 197018, 197019, 197021, 295330, 295331, 197029, 430502, 168359, 303550, 160205, 160208, 381398, 305638, 272872, 223741, 61971, 191006, 191007, 272931, 57893, 272934, 57896, 328232, 420394, 57899, 57900, 295467, 57903, 57904, 57905, 57906, 158257, 336445, 336446, 336450, 336451, 336454, 336455, 336457, 336460, 336465, 55890, 336466, 336469, 336470, 336471, 336472, 336473, 336474, 336478, 336479, 336480, 336481, 336482, 336483, 111202, 272994, 336488, 336489, 273003, 273021, 273023, 437305, 297615, 297620, 437310, 297625, 297636, 437314, 135854, 135861, 242361, 244419, 244421, 66247, 244427, 248524, 127693, 244430, 66257, 66261, 127702, 127703, 62174, 334562, 127716, 334564, 62183, 127727, 127729, 244469, 244470, 318199, 318200, 142073, 164601, 316155, 142076, 228510, 334590, 318207, 244480, 334591, 180070, 142083, 334596, 142087, 334600, 318218, 334603, 318220, 334602, 334606, 318223, 334607, 334604, 142095, 318228, 318231, 318233, 318234, 318236, 318237, 318239, 318241, 187173, 318246, 187174, 187175, 187177, 187178, 187179, 187180, 314167, 316216, 396088, 396089, 396091, 396092, 241955, 396094, 148287, 316224, 396095, 396098, 314179, 279367, 396104, 396110, 396112, 396114, 396115, 396118, 396119, 396120, 396122, 396123, 396125, 396126, 396127, 396128, 396129, 299880, 396137, 162668, 299884, 187248, 396147, 396151, 248696, 396153, 187258, 187259, 322430, 437356, 60304, 60318, 60322, 60323, 185258, 185259, 60331, 23469, 185262, 23470, 23472, 23473, 23474, 23475, 23476, 185267, 213935, 23479, 60337, 287674, 23483, 23487, 185280, 281538, 281539, 23492, 23494, 185286, 228306, 23508, 23515, 23517, 40089, 23523, 23531, 203755, 23533, 341058, 152560, 23552, 171008, 40096, 23559, 437256, 23561, 437258, 40098, 23572, 437269, 23574, 23575, 437273, 23580, 23581, 40101, 23585, 437281, 23590, 23591, 23594, 23596, 23599, 189488, 97327, 187442, 189490, 187444, 189492, 189493, 187447, 189491, 23601, 97329, 144435, 23607, 144437, 144438, 144441, 97339, 23612, 144442, 144443, 144444, 23616, 144445, 341057, 341060, 222278, 341062, 341063, 341066, 341068, 437326, 40109, 40110, 185428, 285781, 203862, 285782, 312407, 285785, 115805, 115806, 115807, 293982, 115809, 115810, 312413, 437349, 185446, 312423, 115817, 242794, 115819, 115820, 185452, 185454, 115823, 185455, 115825, 242796, 115827, 242803, 115829, 437364, 242807, 437371, 294012, 294016, 205959, 437390, 437392, 437396, 40088, 312473, 189594, 208026, 40092, 208027, 189598, 40095, 208029, 208033, 27810, 228512, 228513, 312476, 312478, 189607, 312479, 189609, 189610, 312482, 189612, 312489, 312493, 437415, 437416, 189617, 312497, 189619, 312498, 189621, 312501, 189623, 437424, 437426, 189626, 437428, 312502, 312504, 437431, 322751, 437433, 437436, 437440, 38081, 437443, 437445, 292041, 292042, 437451, 38092, 437453, 128874, 181455, 292049, 437458, 128875, 152789, 203990, 203991, 152795, 204000, 204003, 339176, 339177, 152821, 208117, 152825, 294137, 294138, 279818, 206094, 279823, 206097, 206098, 294162, 206102, 206104, 206108, 206109, 181533, 425247, 294181, 27943, 181544, 181545, 294183, 181547, 27948, 40105, 181553, 181559, 173368, 206138, 151285, 173379, 312480, 152906, 152907, 152908, 152909, 152910, 290123, 290125, 290126, 290127, 290130, 3119, 312483, 173394, 290135, 290136, 245081, 290137, 290139, 378206, 378208, 222562, 222563, 222566, 228717, 222573, 228721, 222577, 222579, 222581, 222582, 222587, 222590, 222591, 54655, 222596, 222597, 177543, 222599, 222601, 54666, 222603, 222604, 54669, 148878, 222605, 222606, 222607, 54673, 54678, 54680, 56730, 279969, 54692, 152998, 54698, 54701, 54703, 153009, 19893, 298431, 212420, 370118, 153037, 153049, 153051, 157151, 222689, 222692, 222693, 112111, 112115, 112117, 112120, 40451, 112131, 40453, 280068, 40455, 40458, 40460, 40463, 112144, 112145, 40466, 40469, 40471, 40475, 40477, 40479, 40482, 362020, 362022, 116267, 282156, 34362, 316993, 173634, 173635, 316995, 316997, 173639, 312427, 106085, 319081, 319085, 319088, 319089, 300660, 300661, 300662, 300663, 319094, 319098, 319101, 319103, 394899, 52886, 52887, 394905, 394908, 394910, 394912, 52896, 52899, 52900, 339622, 147115, 151218, 394935, 321210, 292544, 108230, 108234, 296682, 341052, 108240, 34516, 108245, 212694, 296660, 341054, 34522, 341055, 34531, 192230, 192231, 192232, 296681, 34538, 296679, 34540, 34541, 216812, 216814, 216815, 216816, 216818, 216819, 296684, 296687, 216822, 296688, 296691, 296692, 216826, 296698, 216828, 216829, 296699, 296700, 216832, 216833, 216834, 296703, 216836, 216837, 216838, 296707, 296708, 296710, 296712, 296713, 296694, 313101, 276232, 313099, 313104, 276236, 313102, 313108, 313111, 313112, 149274, 149275, 159518, 149280, 159523, 296701, 296704, 321342, 210755, 210756, 210757, 210758, 321353, 218959, 120655, 120656, 218962, 218963, 218964, 223064, 223065, 180058, 229209, 223069, 229213, 169824, 229217, 169826, 292705, 223075, 237413, 169830, 292709, 237416, 128873, 223076, 169835, 128876, 169837, 128878, 223086, 223087, 128881, 128882, 128883, 128884, 227180, 227183, 227188, 141181, 327550, 108419, 141189, 141198, 108431, 108432, 141202, 141208, 219033, 108448, 219040, 141219, 219043, 219044, 141220, 141223, 141228, 141229, 108460, 108462, 229294, 229295, 141235, 319426, 141253, 319432, 141264, 59349, 141272, 141273, 40931, 40932, 141284, 141290, 40940, 40941, 141293, 141295, 174063, 231406, 174066, 174067, 237559, 174074, 395259, 194559 ]
8b39ddd16aef1ea0f7774dc6365ea4a3db8e319a
ee1528347ef0b6fefc8776843b802d5e4a7b84e5
/LeBaluchon/Model/ExchangeRate/ExchangeRateService.swift
63cf0764dcfccc0d1993f207eed6b4ae5bb2dfd5
[]
no_license
David-DaSilva7/P9_Le_Baluchon
576b51418b380dd1913518333be7dab0694f7217
0d6236fd8a4e0ef980b0b365d92b1c9d385fe821
refs/heads/main
2023-01-02T03:13:16.892007
2020-10-23T07:01:04
2020-10-23T07:01:04
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,546
swift
// // ExchangeRateService.swift // LeBaluchon // // Created by ousama boujaouane on 21/10/2020. // Copyright © 2020 Sajid. All rights reserved. // import Foundation class ExchangeRateService { // MARK: - Properties static var shared = ExchangeRateService() private init() {} private var task: URLSessionDataTask? private var exchangeRateSession = URLSession(configuration: .default) init(exchangeRateSession: URLSession) { self.exchangeRateSession = exchangeRateSession } // MARK: - Function func getExchangeRate(callback: @escaping (Bool, ExchangeRate?) -> Void) { var request = URLRequest(url: URL(string: FixerExchangeRate.url)!) request.httpMethod = HTTPMethod.get.rawValue task?.cancel() task = exchangeRateSession.dataTask(with: request) { data, response, error in // dependency injection DispatchQueue.main.async { guard let data = data, error == nil else { callback(false, nil) return } guard let response = response as? HTTPURLResponse, response.statusCode == 200 else { callback(false, nil) return } guard let responseJSON = try? JSONDecoder().decode(ExchangeRate.self, from: data) else { callback(false, nil) return } callback(true, responseJSON) } } task?.resume() } }
[ -1 ]
741403ffc395a8a4588b46d196530d57ffa47307
1d4af510a3ed66f6c4105fa310d6bb6e797c558b
/Animations/Animations/AppDelegate.swift
b21753789087ed7e3103097fa2a34a436bf2bb96
[]
no_license
zmfrew/advanced-ios-volume1
b2c82eb8f48f4f61399d64a526166a31574a2a5d
a6074326c738350fbb2d9413f23a35b338b2e20b
refs/heads/master
2020-09-30T05:51:02.557955
2019-12-10T21:45:44
2019-12-10T21:45:44
227,220,567
0
0
null
null
null
null
UTF-8
Swift
false
false
1,417
swift
// // AppDelegate.swift // Animations // // Created by Zachary Frew on 12/10/19. // Copyright © 2019 Zach Frew. 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, 393230, 393250, 344102, 393261, 163891, 213048, 385081, 376889, 376905, 327756, 254030, 286800, 368727, 180313, 368735, 180320, 376931, 286831, 368752, 286844, 262283, 286879, 286888, 377012, 327871, 180416, 377036, 180431, 377046, 377060, 327914, 205036, 393456, 393460, 418043, 336123, 336128, 385280, 262404, 180490, 368911, 262416, 262422, 377117, 262436, 336180, 262454, 262472, 344403, 213332, 65880, 262496, 418144, 262499, 213352, 246123, 262507, 262510, 213372, 385419, 393612, 262550, 262552, 385440, 385443, 385451, 262573, 393647, 385458, 262586, 344511, 262592, 360916, 369118, 328177, 328179, 328182, 328189, 328192, 164361, 328206, 410128, 393747, 254490, 188958, 385570, 33316, 197159, 377383, 352821, 188987, 418363, 369223, 385609, 385616, 352856, 352864, 369253, 262760, 352874, 352887, 254587, 377472, 148105, 377484, 352918, 98968, 344744, 361129, 336555, 434867, 164534, 336567, 328378, 164538, 328386, 352968, 344776, 418507, 385742, 385748, 361179, 189153, 369381, 361195, 418553, 344831, 336643, 344835, 344841, 361230, 336659, 418585, 434970, 369435, 418589, 262942, 418593, 336675, 328484, 418598, 418605, 336696, 361273, 328515, 336708, 328519, 336711, 328522, 336714, 426841, 254812, 361309, 197468, 361315, 361322, 328573, 369542, 361360, 222128, 345035, 345043, 386003, 386011, 386018, 386022, 435187, 328702, 328714, 361489, 386069, 336921, 386073, 336925, 345118, 377887, 328746, 345133, 345138, 386101, 361536, 197707, 189520, 345169, 156761, 361567, 148578, 345199, 386167, 361593, 410745, 361598, 214149, 345222, 386186, 337047, 345246, 214175, 337071, 337075, 386258, 328924, 66782, 222437, 386285, 328941, 386291, 345376, 353570, 345379, 410917, 345382, 345399, 378169, 369978, 337222, 337229, 337234, 263508, 402791, 345448, 271730, 378227, 271745, 181638, 353673, 181643, 181654, 230809, 181670, 181673, 181678, 181681, 337329, 181684, 181690, 361917, 181696, 337349, 181703, 337365, 271839, 329191, 361960, 116210, 337398, 337415, 329226, 419339, 419343, 419349, 345625, 419355, 370205, 419359, 394786, 419362, 370213, 419368, 419376, 206395, 214593, 419400, 419402, 353867, 419406, 419410, 345701, 394853, 222830, 370297, 403070, 403075, 345736, 198280, 345749, 345757, 345762, 419491, 345765, 419497, 419501, 370350, 419506, 419509, 419512, 337592, 337599, 419527, 419530, 419535, 272081, 419542, 394966, 419544, 181977, 345818, 419547, 419550, 419559, 337642, 419563, 337645, 337659, 141051, 337668, 362247, 395021, 362255, 321299, 116509, 345887, 378663, 345905, 354106, 354111, 247617, 354117, 370503, 329544, 345930, 370509, 354130, 247637, 337750, 370519, 313180, 354142, 345967, 345970, 345974, 403320, 354172, 247691, 337808, 247700, 329623, 436126, 436132, 337833, 362413, 337844, 346057, 247759, 346063, 329697, 354277, 190439, 247789, 354313, 346139, 436289, 378954, 395339, 338004, 329832, 329855, 329867, 329885, 411805, 346272, 100524, 387249, 379066, 387260, 256191, 395466, 346316, 411861, 411864, 411868, 411873, 379107, 411876, 387301, 346343, 338152, 387306, 387312, 346355, 436473, 321786, 379134, 411903, 411916, 379152, 395538, 387349, 338199, 387352, 182558, 338211, 395566, 248111, 362822, 436555, 190796, 321879, 354673, 321910, 248186, 420236, 379278, 354727, 338352, 330189, 338381, 338386, 338403, 338409, 248308, 199164, 330252, 199186, 420376, 330267, 354855, 10828, 199249, 346721, 174695, 248425, 191084, 338543, 191092, 346742, 330383, 354974, 150183, 174774, 248504, 174777, 223934, 355024, 273108, 355028, 264918, 183005, 256734, 338660, 338664, 264941, 207619, 264964, 338700, 256786, 199452, 363293, 396066, 346916, 396069, 215853, 355122, 355131, 355140, 355143, 338763, 355150, 330580, 355166, 265055, 265058, 355175, 355179, 330610, 330642, 355218, 412599, 207808, 379848, 396245, 330710, 248792, 248798, 347105, 257008, 183282, 265207, 330748, 330760, 330768, 248862, 396328, 158761, 199728, 396336, 330800, 396339, 339001, 388154, 388161, 347205, 248904, 330826, 248914, 339036, 412764, 257120, 265320, 248951, 420984, 330889, 347287, 248985, 339097, 44197, 380070, 339112, 249014, 126144, 330958, 330965, 265432, 265436, 388319, 388347, 175375, 159005, 175396, 208166, 273708, 372015, 347441, 372018, 199988, 175415, 396600, 437566, 175423, 437570, 437575, 437583, 331088, 437587, 331093, 396633, 175450, 437595, 175457, 208227, 175460, 175463, 265580, 437620, 175477, 249208, 175483, 175486, 249214, 175489, 249218, 249224, 249227, 249234, 175513, 175516, 396705, 175522, 355748, 380332, 396722, 388542, 372163, 216517, 380360, 216522, 339404, 372176, 208337, 339412, 413141, 339417, 249308, 339420, 339424, 249312, 339428, 339434, 249328, 69113, 372228, 208398, 380432, 175635, 339503, 265778, 265795, 396872, 265805, 224853, 224857, 257633, 224870, 372327, 257646, 372337, 224884, 224887, 224890, 224894, 224897, 372353, 216707, 126596, 339588, 421508, 224904, 224909, 11918, 159374, 224913, 126610, 339601, 224916, 224919, 126616, 224922, 208538, 224926, 224929, 224932, 224936, 257704, 224942, 257712, 224947, 257716, 257720, 224953, 257724, 224959, 257732, 224965, 224969, 339662, 224975, 257747, 224981, 224986, 257761, 224993, 257764, 224999, 339695, 225012, 257787, 225020, 339710, 257790, 225025, 339721, 257801, 257804, 225038, 257807, 225043, 372499, 167700, 225048, 257819, 225053, 184094, 225058, 339747, 339749, 257833, 225066, 257836, 413484, 225070, 225073, 372532, 257845, 225079, 397112, 225082, 397115, 225087, 225092, 225096, 323402, 257868, 225103, 257871, 397139, 225108, 257883, 257886, 225119, 257890, 339814, 225127, 257896, 274280, 257901, 225137, 339826, 257908, 225141, 257912, 225148, 257916, 257920, 225155, 339844, 225165, 397200, 225170, 380822, 225175, 225180, 118691, 184244, 372664, 372702, 372706, 356335, 380918, 405533, 430129, 266294, 217157, 421960, 356439, 421990, 266350, 356466, 266362, 381068, 225423, 250002, 250004, 225429, 356506, 225437, 135327, 225441, 438433, 225444, 438436, 225447, 438440, 225450, 258222, 225455, 430256, 225458, 225461, 225466, 389307, 225470, 381120, 372929, 430274, 225475, 389320, 225484, 225487, 225490, 266453, 225493, 225496, 225499, 225502, 225505, 356578, 225510, 217318, 225514, 225518, 372976, 381176, 397571, 389380, 356637, 356640, 356643, 356646, 266536, 356649, 356655, 332080, 340275, 356660, 397622, 332090, 225597, 332097, 201028, 348488, 332106, 332117, 348502, 250199, 250202, 332125, 250210, 348522, 348525, 348527, 332152, 389502, 250238, 332161, 356740, 332172, 373145, 340379, 389550, 324030, 160234, 127471, 340472, 324094, 266754, 324099, 324102, 324111, 340500, 324117, 324131, 332324, 324139, 356907, 324142, 356916, 324149, 324155, 348733, 324160, 324164, 356934, 348743, 381512, 324170, 324173, 324176, 389723, 332380, 373343, 381545, 340627, 184982, 258721, 332453, 332459, 389805, 332463, 381617, 332471, 332483, 332486, 332493, 357069, 357073, 332511, 332520, 340718, 332533, 348924, 389892, 373510, 389926, 152370, 348978, 340789, 348982, 398139, 127814, 357201, 357206, 389978, 430939, 357211, 357214, 201579, 201582, 349040, 340849, 201588, 430965, 381813, 324472, 398201, 340858, 324475, 430972, 340861, 324478, 119674, 324481, 373634, 324484, 324487, 381833, 324492, 324495, 324498, 430995, 324501, 324510, 422816, 324513, 398245, 201637, 324524, 340909, 324533, 5046, 324538, 324541, 398279, 340939, 340941, 209873, 340957, 431072, 398306, 340963, 201711, 381946, 349180, 439294, 431106, 209943, 250914, 357410, 185380, 357418, 209965, 209968, 209971, 209975, 209979, 209987, 209990, 341071, 349267, 250967, 210010, 341091, 210025, 210027, 210030, 210039, 349308, 210044, 349311, 152703, 160895, 210052, 349319, 210055, 210067, 210071, 210077, 210080, 251044, 210084, 185511, 210088, 210095, 210098, 210107, 210115, 332997, 210127, 333009, 210131, 333014, 210138, 210143, 218354, 218360, 251128, 275706, 275712, 275715, 275721, 349459, 333078, 251160, 349484, 251189, 415033, 251210, 357708, 210260, 259421, 365921, 333154, 251235, 374117, 333162, 234866, 390516, 333175, 357755, 251271, 136590, 112020, 349590, 357792, 259515, 415166, 415185, 366034, 366038, 415191, 415193, 415196, 415199, 423392, 333284, 415207, 366056, 366061, 210420, 415224, 423423, 415257, 415263, 366117, 415270, 144939, 415278, 415281, 415285, 210487, 415290, 415293, 349761, 415300, 333386, 333399, 366172, 333413, 423528, 423532, 210544, 415353, 333439, 415361, 267909, 333498, 210631, 333511, 358099, 153302, 333534, 366307, 366311, 431851, 366318, 210672, 366321, 210695, 268041, 210698, 210706, 399128, 333594, 210719, 358191, 366387, 399159, 358200, 325440, 366401, 341829, 325446, 46920, 341834, 341838, 341843, 415573, 358234, 341851, 350045, 399199, 259938, 399206, 268143, 358255, 399215, 358259, 341876, 333689, 243579, 325504, 333698, 333708, 333724, 382890, 350146, 358339, 333774, 358371, 350189, 350193, 350202, 333818, 350206, 350213, 268298, 350224, 350231, 333850, 350237, 350240, 350244, 350248, 178218, 350251, 350256, 350259, 350271, 243781, 350285, 374864, 342111, 342133, 374902, 432271, 333997, 334011, 260289, 260298, 350410, 350416, 350422, 211160, 350425, 268507, 334045, 350445, 375026, 358644, 350458, 350461, 350464, 325891, 350467, 350475, 194828, 268559, 350480, 432405, 350486, 350490, 325914, 325917, 350493, 350498, 350504, 358700, 350509, 391468, 358704, 358713, 358716, 383306, 334161, 383321, 383330, 383333, 391530, 383341, 334203, 268668, 194941, 366990, 416157, 342430, 268701, 375208, 326058, 375216, 334262, 334275, 326084, 358856, 334304, 334311, 375277, 334321, 350723, 186897, 342545, 334358, 342550, 342554, 334363, 350761, 252461, 334384, 383536, 358961, 334394, 252482, 219718, 334407, 334420, 350822, 375400, 334465, 162445, 326290, 342679, 342683, 260766, 342710, 244409, 260797, 334528, 260801, 350917, 154317, 391894, 154328, 416473, 64230, 113388, 342766, 375535, 203506, 342776, 391937, 391948, 375568, 326416, 375571, 162591, 326441, 326451, 326454, 326460, 244540, 375612, 260924, 326467, 244551, 326473, 326477, 326485, 416597, 326490, 342874, 326502, 375656, 433000, 326507, 326510, 211825, 211831, 351097, 392060, 359295, 351104, 342915, 400259, 236430, 342930, 252822, 392091, 400285, 252836, 359334, 211884, 400306, 351168, 359361, 326598, 359366, 359382, 359388, 383967, 343015, 359407, 261108, 244726, 261111, 383997, 261129, 359451, 261147, 211998, 261153, 261159, 359470, 359476, 343131, 384098, 384101, 384107, 367723, 187502, 384114, 343154, 212094, 351364, 384135, 384139, 384143, 351381, 384151, 384160, 384168, 367794, 244916, 384181, 384188, 384191, 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, 425276, 384323, 212291, 343365, 212303, 343393, 343398, 425328, 343409, 253303, 154999, 343417, 327034, 245127, 384397, 245136, 245142, 245145, 343450, 245148, 245151, 245154, 245157, 245162, 327084, 359865, 384443, 146876, 327107, 384453, 327110, 327115, 327117, 359886, 359890, 343507, 368092, 343534, 343539, 368119, 343544, 368122, 409091, 359947, 359955, 359983, 343630, 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, 155438, 155442, 155447, 155461, 360261, 376663, 155482, 261981, 425822, 155487, 376671, 155490, 155491, 327531, 261996, 376685, 261999, 262002, 327539, 262005, 147317, 262008, 262011, 155516, 155521, 155525, 360326, 376714, 155531, 262027, 262030, 262033, 262036, 262039, 262042, 155549, 262045, 262048, 262051, 327589, 155559, 155562, 155565, 393150, 393169, 384977, 155611, 155619, 253923, 155621, 253926, 327654, 204784, 360438, 253943, 393212, 155646 ]
447e25a8a35e89171ebee357f6997dffb068c759
120ff1f61152974657b7e3ab2359682fce45eed6
/Contents/Chapters/Chapter2.Advanced.playgroundchapter/Pages/1.Height Sensors.playgroundpage/Contents.swift
64785d666032865728489ebf291a411bd51031ef
[]
no_license
swipswaps/Tello-Swift-Playgrounds
83d3fecdbcd5ee81c3d61e3c84900b7b36bc69c4
52429c226a546df951f6523c500675bd5a263800
refs/heads/master
2021-10-10T23:12:21.901390
2019-01-14T21:45:17
2019-01-14T21:45:17
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,109
swift
//#-hidden-code import UIKit import PlaygroundSupport //#-code-completion(everything, hide) //#-code-completion(identifier, show, takeOff(), land(), wait(seconds:)) //#-code-completion(identifier, show, getHeight()) _setupOneDroneEnv() startAssessor() //#-end-hidden-code /*:#localized(key: "FirstProseBlock") */ takeOff() //#-editable-code Tap to enter code //#-end-editable-code land() //#-hidden-code _cleanOneDroneEnv() let success = NSLocalizedString( "### Well done!\nYou've learned your first getter command.\n\n[**Next Page**](@next)", comment: "Height Sensors page success") let expected: [Assessor.Assessment] = [ (.takeOff, [NSLocalizedString("To take off you need to use the `takeOff()` command.", comment: "takeOff hint")]), (.getHeight, [NSLocalizedString("To get height of drone you need to use the `getHeight()` command.", comment: "getHeight hint")]), (.land, [NSLocalizedString("To land you need to use the `land()` command.", comment: "land hint")]), ] PlaygroundPage.current.assessmentStatus = checkAssessment(expected:expected, success: success) //#-end-hidden-code
[ -1 ]
cd39bed0b52df9199574762d3ad359b2cfc00f1c
47632396c4ce3c8d26dcdf717f79ec453928179d
/YourWorkout/CustomClasses/MyMDCFloatingButton.swift
d9755d61f664af8238752c7b8b9bc5024ac1fbb9
[]
no_license
pockerhead/YourWorkOut
decccec315bf11fa53cb598940d938f0d5552753
1b27623e2ee3f42cfda075ad4cfb2468fffb4e9f
refs/heads/master
2021-09-08T18:57:13.454843
2018-03-11T19:15:02
2018-03-11T19:15:02
116,722,681
0
0
null
null
null
null
UTF-8
Swift
false
false
1,044
swift
// // MyButton.swift // YourWorkout // // Created by Артём Балашов on 15.01.2018. // Copyright © 2018 Артём Балашов. All rights reserved. // import Foundation import UIKit import MaterialComponents class MyMDCFloatingButton: MDCFloatingButton { typealias DidTapButton = (MyMDCFloatingButton) -> () init(){ super.init(frame: .zero, shape: .default) } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } // MARK: - Actions @objc func didTouchUpInside(sender: UIButton) { if let handler = didTouchUpInside { handler(self) } } var didTouchUpInside: DidTapButton? { didSet { if didTouchUpInside != nil { addTarget(self, action: #selector(didTouchUpInside(sender:)), for: .touchUpInside) } else { removeTarget(self, action: #selector(didTouchUpInside(sender:)), for: .touchUpInside) } } } }
[ -1 ]