blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
625
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
47
license_type
stringclasses
2 values
repo_name
stringlengths
5
116
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
643 values
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
80.4k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
16 values
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_language
stringclasses
85 values
src_encoding
stringclasses
7 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
1 class
length_bytes
int64
4
6.44M
extension
stringclasses
17 values
content
stringlengths
4
6.44M
duplicates
sequencelengths
1
9.02k
a42f305ed5ff2502cb17b76868adc27222510da9
0a91e7d3a5ab90f0a6373e5899fcf5e2504304c2
/Example/Cenfonet/ViewController.swift
aedf6b1c628653bb539c5e655feabe266d2a9c00
[ "MIT" ]
permissive
wbarrantes-cenfotec/Cenfonet
a5e574a1673436850279aae47e2272cd8822c2c2
1642efe44081c0ae63f05ecca2a999d6774e8e27
refs/heads/main
2023-06-02T20:19:17.961723
2021-06-21T22:57:44
2021-06-21T22:57:44
378,764,488
0
0
null
null
null
null
UTF-8
Swift
false
false
877
swift
// // ViewController.swift // Cenfonet // // Created by wbarrantes-cenfotec on 06/20/2021. // Copyright (c) 2021 wbarrantes-cenfotec. All rights reserved. // import UIKit import Cenfonet struct Feed: Codable { var feed: String } class ViewController: UIViewController { var client: Client? override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. client = Client(session: URLSession.shared) /*client?.fetch(type: Feed.self, stringUrl: "", method: .post, parameters: [:]) { result in }*/ } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }
[ -1 ]
b1d7ee1ebed461c91c6f952ea113b69473f6a4f8
609a954af62be51b5a5c1edbee538e052f786f2c
/YJKlicker/ClickerViewController.swift
e819f5383f84c441ea39cb8acbc6e1ec7e6f04de
[]
no_license
yejinjennykim/YJKlicker
d031f5bad670a0991efd22a10662a696acdc5303
675eb56b3c8e2e196382ef150b1b4f8d7938acf5
refs/heads/master
2021-01-10T01:12:37.201275
2015-11-11T15:01:05
2015-11-11T15:01:05
44,887,404
0
0
null
null
null
null
UTF-8
Swift
false
false
1,425
swift
// // ClickerViewController.swift // YJKlicker // // Created by JeeWan Gue on 11/1/15. // Copyright © 2015 Yejin. All rights reserved. // import UIKit class ClickerViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate { @IBOutlet weak var clickerButtonCollection: UICollectionView! override func viewDidLoad() { super.viewDidLoad() clickerButtonCollection.dataSource = self clickerButtonCollection.delegate = self clickerButtonCollection.backgroundColor = UIColor(white: 1.0, alpha: 1.0) } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return 10 } func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { let i = collectionView.dequeueReusableCellWithReuseIdentifier("clickerCell", forIndexPath: indexPath) as UICollectionViewCell! return i } /* override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. } */ }
[ -1 ]
4896eaa2a0c18adbc13610f2bb2d27d297fa64d4
394e895dd28847623feb8fc9d44d13f2343b58d2
/KekkaTests/ResultTests.swift
4b77e79bd7e83ec793849cff3c40f427e98e7619
[ "MIT" ]
permissive
kandelvijaya/Kekka
5438057c578d0f57d67459eb1672c6020f1b73c0
7bb70c18996c7104b8d60fe29116132e34a75c56
refs/heads/master
2021-06-08T10:45:06.545790
2019-03-22T13:48:05
2019-03-22T13:48:05
116,726,611
4
1
MIT
2019-03-22T13:39:11
2018-01-08T20:50:33
Swift
UTF-8
Swift
false
false
4,274
swift
// // ResultTests.swift // KekkaTests // // Created by Vijaya Prakash Kandel on 08.01.18. // Copyright © 2018 com.kandelvijaya. All rights reserved. // import XCTest @testable import Kekka final class ResultTTests: XCTestCase { enum IntError: Error { case testError case cannotDivideByZero } private func divBy0(_ a: Int) -> Result<Int> { return .failure(IntError.cannotDivideByZero) } private func divBy2(_ a: Int) -> Result<Int> { return .success(a / 2) } func testWhenResultWithSuccessIsMapped_thenOutputIsResultWithTransformation() { let resultInt = Result<Int>.success(12) let output = resultInt.map { $0 * 2 } XCTAssertEqual(output, .success(24)) } func testWhenResultWithFailureIsMapped_thenOutputIsResultWithInitialFailure() { let failInt = Result<Int>.failure(IntError.testError) let output = failInt.map { "\($0)" } XCTAssertEqual(output, .failure(IntError.testError)) } func testWhenResultWithFailureIsMappedSuccessively_thenOutputIsResultWithFirstFailure() { let failInt = Result<Int>.failure(IntError.testError) let output = failInt.map { $0 * 2 }.map { "\(0)" }.map { $0.uppercased() } XCTAssertEqual(output, .failure(IntError.testError)) } func testWhenIntResultWithSuccessIsMappedToDivBy2_thenItProducesDoubleWrappedResult() { let initialInt = Result<Int>.success(12) let output = initialInt.map(divBy2) let expected = Result.success(Result<Int>.success(6)) XCTAssertEqual(output, expected) } // As seen above, chaining becomes tedious if the result is double wrapped // `initialInt.map(divBy2).map { $0.map(divBy2) }` // This is exactly why we have `flatMap`.g // The above becomes `intitialInt.flatMap(divBy2).flatMap(divBy2)` func testWhenIntResultWithSuccesIsFlatMappedToDivBy2_thenItProducesSingleWrappedResult() { let initialInt = Result<Int>.success(12) let output = initialInt.flatMap(divBy2) let expected = Result<Int>.success(6) XCTAssertEqual(output, expected) } func testWhenIntResultWithSuccessIsFlatMappedToDivBy0ThenDivBy2_thenItProducesResultWithDivFailure() { let initialInt = Result<Int>.success(12) let output = initialInt.flatMap(divBy2).flatMap(divBy0).flatMap(divBy2) let expected = Result<Int>.failure(IntError.cannotDivideByZero) XCTAssertEqual(output, expected) } //MARK:- Equality Tests func test_whenResultWithSameIntsAreCompared_thenTheyAreEqual() { let a = Result.success(1) let b = Result.success(1) XCTAssertEqual(a, b) } func test_whenResultWithSameErrorsAreCompared_thenTheyAreEqual() { let a = Result<Int>.failure(TestError.cantDivideByTwo) let b = Result<Int>.failure(TestError.cantDivideByTwo) XCTAssertEqual(a, b) } func test_whenResultWithSameErrorWithAssociatedTypesAreCompared_thenTheyAreEqual() { let a = Result<Int>.failure(TestError.unknown("some error")) let b = Result<Int>.failure(TestError.unknown("some error")) XCTAssertEqual(a, b) } func test_whenResultWithErrorsWithDifferentValueForAssocaitedTypesAreCompared_thenTheyAreNotEqual() { XCTAssertNotEqual(Result<Int>.failure(TestError.unknown("a")), Result<Int>.failure(TestError.unknown("b"))) } func test_whenResultWithDifferentErrorAreComapred_thenTheyAreNotEqual() { XCTAssertNotEqual(Result<String>.failure(TestError.cantDivideByTwo), Result<String>.failure(TestError.cantRepresentComplexNumber)) } func test_whenResultStringsWithDifferentValuesAreCompared_thenTheyAreNotEqual() { XCTAssertNotEqual(Result<String>.success("hello"), Result<String>.success("there")) } func test_whenResultWithErrorAndValueAreCompared_thenTheyAreNotEqual() { XCTAssertNotEqual(Result<String>.success("a"), Result<String>.failure(TestError.unknown("a"))) } enum TestError: Error { case cantDivideByTwo case cantRepresentComplexNumber case unknown(String) } }
[ -1 ]
03e38b93decf6345cca9d6c91b928fdaa87dc292
5ac82bae37d11150c81bf44c5e45e4bb8e010b2a
/CoreDataSample/CoreDataSupport.swift
c79c4846969d8c1e0850aa04d3e10e593c95469c
[]
no_license
touyou/CoreDataSample
c145480095269175954d2aaefc7bc6a6743ef74c
d6ab62f240be77abf65ad9e6a9ddfd50baca25dd
refs/heads/master
2021-01-11T22:40:17.906308
2017-01-18T04:25:16
2017-01-18T04:25:16
79,013,997
0
0
null
null
null
null
UTF-8
Swift
false
false
743
swift
// // CoreDataSupport.swift // CoreDataSample // // Created by 藤井陽介 on 2017/01/18. // Copyright © 2017年 touyou. All rights reserved. // import Foundation import CoreData import UIKit final class CoreDataSupport<T: NSManagedObject> { private var appDelegate: AppDelegate private var context: NSManagedObjectContext init() { appDelegate = UIApplication.shared.delegate as! AppDelegate context = appDelegate.persistentContainer.viewContext } open func searchData(by predicate: NSPredicate) -> [T]? { let fetchRequest = T.fetchRequest() let fetchData = try! context.fetch(fetchRequest) return fetchData as? [T] } open func saveOrUpdateData() {} }
[ -1 ]
f71fc19982e9ec2c351bd178f9e83e84b2024204
019109e31c7108bb0c632079902bfb37e9494426
/RX宁夏/CustomUI/NXNavBar/NXSettingNavBar.swift
b3f61296100d07afb0d20824e0f66bdf215ea3e6
[]
no_license
TRS-CODER/NXZZQ
3f16dab6c5eabc8c1c827cb48029bc8f1f9d3fad
07eb9a3b83e98f881c2618ebe15c3c52c8fbf7a5
refs/heads/master
2020-04-07T05:50:04.244046
2018-03-07T06:54:00
2018-03-07T06:54:00
124,186,368
0
0
null
null
null
null
UTF-8
Swift
false
false
1,380
swift
// // NXSettingNavBar.swift // RX宁夏 // // Created by yudai on 2018/3/6. // Copyright © 2018年 拓尔思. All rights reserved. // import UIKit // MARK:- 常量 fileprivate struct Metric { static let homeBarW: CGFloat = kScreenW static let homeBarH: CGFloat = kNavBarH() } class NXSettingNavBar: NXBaseNavBar { typealias AddBlock = (_ model: YDNavigationBarItemModel) -> Void var itemClicked: AddBlock? = { (_) in return } override init(frame: CGRect) { super.init(frame: frame) initUI() } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) initUI() } } extension NXSettingNavBar: YDNavUniversalable { private func initUI() { // 返回 let back = self.universal(model: YDNavigationBarItemMetric.back) { (model) in self.itemClicked!(model) } // logo let logo = self.universal(model: YDNavigationBarItemMetric.logo) // 布局(只需要位置) back.snp.makeConstraints { (make) in make.left.equalToSuperview().offset(10) make.bottom.equalToSuperview().offset(-8) } logo.snp.makeConstraints { (make) in make.centerY.equalTo(back.snp.centerY) make.centerX.equalToSuperview() } } }
[ -1 ]
69a01ffe5065dc3da671c99284fa9dad4c9ea3b2
5afd93e55ae25c445f5167043bb2ec6f637daabd
/networking/networking/Constants.swift
5a798ad0f696287724e4253c0285f9e25930deb7
[]
no_license
AlChWi/networking
6e21ff4b4d4baa95a7bea13e6dbe2dbd0fa05a05
d004b2caab3614b46b7fbc4dcf19a53a097a6a3c
refs/heads/master
2022-02-22T19:24:12.695357
2019-08-20T12:32:34
2019-08-20T12:32:34
198,266,577
0
0
null
null
null
null
UTF-8
Swift
false
false
352
swift
// // Constants.swift // networking // // Created by Alex P on 06/08/2019. // Copyright © 2019 Алексей Перов. All rights reserved. // import Foundation import UIKit enum Constants { enum UIConstants { static var appTintColor = #colorLiteral(red: 0.9568627477, green: 0.6588235497, blue: 0.5450980663, alpha: 1) } }
[ -1 ]
35f86a150cd3e76d972a51eb4995e73c512cae66
b764bc57a93d5d7317e9f0e65cfea407bb0a1690
/SwinjectExample/AppDelegate.swift
df35f5c86efd2d5f0f5f27fa890a618f83266016
[]
no_license
garbalinskiy/swinjectexample
f75f35cbba47e8121cd7d5d3b98b9a13e3a54b87
624ccbdc5d0773580123f29a00d0e9f8d720ac5e
refs/heads/master
2023-03-03T22:01:03.535881
2021-02-07T22:25:15
2021-02-07T22:25:15
336,904,059
0
0
null
null
null
null
UTF-8
Swift
false
false
2,747
swift
// // AppDelegate.swift // SwinjectExample // // Created by Serghei Garbalinschi on 8.02.21. // import UIKit import Swinject @main class AppDelegate: UIResponder, UIApplicationDelegate { lazy var container: Container = { let container = Container() container.register(RemoteConfigProtocol.self) { _ in RemoteConfig() } container.register(NetworkServiceProtocol.self) { _ in NetworkService() } // Social container.register(SocialServiceProtocol.self) { resolver in SocialService(networkService: resolver.resolve(NetworkServiceProtocol.self)!) } container.register(SocialTopicsProvider.self) { resolver in resolver.resolve(SocialServiceProtocol.self)! } container.register(SocialLikesProvider.self) { resolver in resolver.resolve(SocialServiceProtocol.self)! } // Premium container.register(PremiumServiceProtocol.self) { resolver in PremiumService(networkService: resolver.resolve(NetworkServiceProtocol.self)!) } container.register(PremiumStatusProvider.self) { resolver in resolver.resolve(PremiumServiceProtocol.self)! } container.register(PremiumSubscriptionProvider.self) { resolver in resolver.resolve(PremiumServiceProtocol.self)! } return container }() 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, 354313, 268298, 333850, 405533, 344102, 178218, 393261, 430129, 266294, 213048, 266297, 376889, 436289, 243781, 421960, 376905, 254030, 338004, 356439, 368727, 368735, 100453, 266350, 329855, 417924, 262283, 381068, 225423, 225429, 356506, 225437, 135327, 346272, 225441, 438433, 225444, 362660, 438436, 225447, 225450, 100524, 258222, 387249, 225458, 377012, 225466, 225470, 256191, 180416, 430274, 225475, 395466, 225484, 377036, 225487, 225490, 225493, 266453, 411861, 225496, 411864, 225499, 411868, 334045, 225502, 411873, 379107, 217318, 225510, 225514, 387306, 205036, 225518, 372976, 387312, 375026, 358644, 436473, 336123, 418043, 379134, 385280, 262404, 180490, 268559, 368911, 379152, 395538, 262422, 338199, 61722, 356640, 262436, 356646, 266536, 356649, 358700, 391468, 248111, 332080, 358704, 262454, 397622, 358713, 332090, 358716, 332097, 393538, 362822, 262472, 348488, 383306, 213332, 65880, 383321, 262496, 379233, 383330, 262499, 418144, 213352, 391530, 383341, 262510, 334203, 268668, 194941, 213372, 250238, 356740, 385419, 393612, 379278, 272786, 262550, 262552, 340379, 268701, 416157, 385440, 385443, 375208, 385451, 262573, 389550, 393647, 385458, 262586, 266687, 262592, 344511, 358856, 360916, 256472, 369118, 338403, 334311, 160234, 328177, 248308, 199164, 266754, 350723, 164361, 330252, 334358, 342550, 254490, 334363, 342554, 358941, 385570, 354855, 377383, 350761, 381481, 252461, 334384, 358961, 383536, 352821, 334394, 348733, 369223, 385616, 389723, 352864, 369253, 350822, 262760, 352874, 191084, 254587, 377472, 340627, 352918, 342679, 98968, 373398, 354974, 258721, 332453, 150183, 332459, 164534, 174774, 248504, 174777, 244409, 332471, 342710, 223934, 260801, 350917, 332486, 352968, 373449, 352971, 332493, 352973, 357069, 357073, 273108, 264918, 154328, 416473, 361179, 183005, 332511, 369381, 64230, 338664, 361195, 264941, 340718, 342766, 332533, 418553, 348924, 375568, 256786, 336659, 375571, 434970, 199452, 363293, 262942, 162591, 396066, 396069, 389926, 348982, 336696, 361273, 398139, 127814, 430939, 361309, 361315, 375656, 387944, 361322, 355179, 349040, 340849, 330610, 324472, 398201, 324475, 392060, 324478, 324481, 324484, 324487, 392091, 400285, 422816, 252836, 398245, 359334, 222128, 412599, 207808, 351168, 359361, 359366, 340939, 345035, 386003, 396245, 359382, 248792, 386011, 359388, 340957, 248798, 383967, 347105, 386018, 398306, 343015, 201711, 257008, 183282, 261108, 349180, 383997, 439294, 261129, 361489, 386069, 336921, 386073, 359451, 211998, 248862, 345118, 261153, 377887, 261159, 158761, 345133, 199728, 330800, 396336, 396339, 359476, 386101, 388161, 248904, 345169, 248914, 349267, 343131, 412764, 361567, 384098, 367723, 384107, 187502, 343154, 384114, 248951, 420984, 361593, 410745, 212094, 160895, 349311, 351364, 214149, 349319, 384135, 386186, 384139, 384143, 248985, 339097, 384160, 44197, 380070, 185511, 339112, 384168, 337071, 367794, 337075, 345267, 384181, 249014, 351423, 384191, 384198, 253130, 343244, 146642, 330965, 359649, 343270, 351466, 328941, 386285, 218354, 351479, 218360, 384249, 388347, 275712, 275721, 343306, 261389, 175375, 253200, 261393, 384275, 333078, 251160, 345376, 345379, 175396, 410917, 273708, 349484, 351534, 372015, 376110, 372018, 349491, 44342, 175415, 345399, 378169, 369978, 384314, 396600, 415033, 425276, 175423, 437566, 437570, 384323, 343365, 337222, 337229, 212303, 437583, 337234, 331093, 396633, 175450, 437595, 259421, 175457, 333154, 208227, 175460, 175463, 402791, 333162, 425328, 343409, 271730, 378227, 390516, 175477, 437620, 253303, 249208, 343417, 175483, 175486, 249214, 175489, 181638, 353673, 249227, 112020, 175513, 175516, 396705, 175522, 355748, 245162, 181681, 208311, 359865, 259515, 384443, 361917, 415166, 372163, 384453, 327110, 380360, 216522, 339404, 359886, 372176, 208337, 366034, 343507, 339412, 415185, 366038, 415193, 339420, 368092, 271839, 339424, 415199, 423392, 333284, 339428, 415207, 361960, 415216, 116210, 343539, 69113, 368122, 423423, 372228, 329226, 419339, 208398, 419343, 380432, 419349, 415257, 419355, 370205, 415263, 419359, 419362, 366117, 370213, 415270, 419368, 415278, 419376, 415281, 265778, 415285, 210487, 415290, 415293, 214593, 349761, 265795, 415300, 396872, 419400, 353867, 265805, 419406, 419410, 224853, 224857, 257633, 345701, 394853, 423528, 423532, 138864, 210544, 372337, 155254, 370297, 415353, 333439, 353919, 415361, 216707, 126596, 198280, 155273, 153227, 159374, 126610, 403091, 126616, 419491, 425638, 257704, 419497, 257712, 257716, 257720, 337592, 333498, 257724, 155327, 337599, 210631, 419527, 259788, 419535, 257747, 358099, 394966, 155351, 419542, 419544, 155354, 345818, 419547, 257761, 155363, 224999, 366311, 155371, 245483, 419563, 366318, 370415, 210672, 366321, 366325, 409335, 337659, 257790, 339710, 155393, 225025, 257794, 337668, 257801, 210698, 155403, 257804, 339721, 225038, 362255, 366348, 225043, 167700, 372499, 399128, 257819, 155422, 360223, 257833, 225066, 257836, 413484, 155438, 225073, 155442, 210739, 345905, 257845, 366387, 155447, 358200, 372532, 397112, 397115, 354111, 325440, 247617, 366401, 225092, 155461, 325446, 341829, 360261, 341834, 257868, 341838, 225103, 257871, 397139, 225108, 247637, 337750, 376663, 225112, 415573, 155482, 257883, 261981, 425822, 155487, 225119, 376671, 155490, 155491, 399199, 399206, 257896, 274280, 261996, 257901, 376685, 261999, 268143, 225137, 262002, 358255, 257908, 425845, 262005, 147317, 225141, 262008, 257912, 333689, 262011, 155516, 257916, 403320, 325504, 155521, 257920, 339844, 155525, 360326, 247691, 262027, 225165, 262030, 333708, 397200, 225170, 262036, 380822, 262039, 262042, 225180, 155549, 262045, 436126, 262048, 262051, 436132, 155559, 155562, 382890, 155565, 184244, 337844, 372664, 393150, 350146, 346057, 384977, 393169, 155611, 372702, 155619, 253923, 155621, 253926, 354277, 356335, 360438, 253943, 380918, 393212, 155646 ]
9775cdb47cbad8e2b344224fe32bd84e44d83e8d
a31372ccf82e4ad44963f5ae973b34d1330cb3b6
/Package.swift
f4479c64b1a8480894b6f739b3116ceae7a6b393
[ "MIT" ]
permissive
dufflink/MediaHandler
1ca20c6af178a14538e7105993c4de98993b981a
05ff5e3ec829d8b5855365d0eb017c1952d9d15b
refs/heads/master
2020-08-14T22:21:45.249925
2020-03-17T07:36:14
2020-03-17T07:36:14
215,240,419
1
0
null
null
null
null
UTF-8
Swift
false
false
1,085
swift
// swift-tools-version:5.1 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "MediaHandler", platforms: [ .iOS(.v9) ], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "MediaHandler", targets: ["MediaHandler"]), ], dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( name: "MediaHandler", dependencies: []), .testTarget( name: "MediaHandlerTests", dependencies: ["MediaHandler"]), ] )
[ 324608, 415748, 340484, 304657, 35346, 141049, 237593, 154138, 369691, 192028, 217118, 159263, 425505, 201762, 224295, 140330, 201771, 372779, 201773, 402986, 102447, 201775, 201777, 321584, 321590, 33336, 321598, 242239, 173122, 389700, 159303, 339016, 389705, 332367, 254035, 341075, 248917, 327255, 296024, 385112, 384092, 395359, 160864, 261220, 374373, 345190, 139366, 258151, 205930, 66668, 362606, 373359, 333424, 2161, 192626, 431731, 298612, 2165, 253045, 273525, 339573, 346745, 201853, 2173, 245376, 339072, 160898, 2179, 204420, 339075, 339078, 357000, 204425, 201866, 339081, 339087, 339090, 339093, 330389, 162966, 176794, 380058, 2205, 44192, 393379, 2212, 334503, 248488, 315563, 222381, 258733, 336559, 108215, 173752, 225979, 256188, 222400, 225985, 357568, 153283, 389316, 315584, 211655, 66762, 66765, 159439, 256720, 253649, 339667, 366292, 385237, 266456, 340697, 317666, 411879, 177384, 211186, 337650, 194808, 353017, 205050, 379128, 388856, 393979, 395512, 425724, 425728, 388865, 356604, 388867, 162564, 388868, 388870, 374022, 208137, 343308, 136461, 249101, 338189, 347417, 150811, 259360, 311584, 342306, 334115, 201507, 52520, 248106, 325932, 341807, 328500, 388918, 255800, 388922, 377150, 250175, 388930, 244555, 384848, 134482, 339800, 341853, 253789, 253793, 246116, 211813, 357222, 431973, 251240, 253801, 253805, 21871, 151919, 1905, 260978, 337271, 388474, 249211, 299394, 420230, 43400, 373131, 349583, 215442, 355224, 1946, 1947, 355228, 321435, 1950, 1952, 355233, 1955, 1957, 178087, 1960, 1963, 222123, 258475, 355243, 305585, 235957, 1976, 201144, 398776, 329151, 326591, 344514, 432587, 1996, 1998, 373198, 184787, 338388, 380372, 2006, 45015, 2008, 363478, 2011, 262620, 319457, 241122, 208354, 416228, 380902, 164333, 347124, 247797, 411133 ]
918232c2ea334e60033dc15b850e4e5cdf061a51
f3266a073a02d3066d6a56b016506308197bbc42
/TableViewCell.swift
510c282b609c4412e42862b1083282b224951302
[]
no_license
evenlost/bloodbankrepo
8c73c3477490e5ec528ac2116fb3aead230512ee
470d8eccfba087990186ddce40f0b4a52ebd2710
refs/heads/master
2021-01-01T18:08:22.350428
2017-07-25T09:32:47
2017-07-25T09:32:47
98,253,570
0
0
null
null
null
null
UTF-8
Swift
false
false
645
swift
// // TableViewCell.swift // bloodapp // // Created by HOME on 7/25/17. // Copyright © 2017 HOME. All rights reserved. // import UIKit class TableViewCell: UITableViewCell { @IBOutlet weak var cellbgroup: UILabel! @IBOutlet weak var cellcontact: UILabel! @IBOutlet weak var cellsn: UILabel! @IBOutlet weak var cellname: UILabel! override func awakeFromNib() { super.awakeFromNib() // Initialization code } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } }
[ 155576, 201155, 305659 ]
a9687180cfbdd260d2156e38944a0cf441c6ab7d
4992fe24e104785a79b0cdf8662ffa5d2a44ea46
/TSWeChat/Classes/CoreModule/Http/HttpManager.swift
497f39bd0e96af3db15dfcd381c23ce3d4665f39
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
gewill/TSWeChat
b84a244da86aa8263e59f9081643b4c11db822bf
b322526eeee2b00754019e90e48a33108d64d9b4
refs/heads/master
2021-02-04T18:10:49.338227
2020-02-28T06:57:34
2020-02-28T06:57:34
243,695,795
0
0
MIT
2020-02-28T06:39:18
2020-02-28T06:39:17
null
UTF-8
Swift
false
false
602
swift
// // HttpManager.swift // TSWeChat // // Created by Hilen on 11/3/15. // Copyright © 2015 Hilen. All rights reserved. // import UIKit //简写的 key->value public typealias ts_parameters = [String : AnyObject] public typealias SuccessClosure = (AnyObject) -> Void public typealias FailureClosure = (NSError) -> Void class HttpManager: NSObject { class var sharedInstance : HttpManager { struct Static { static let instance : HttpManager = HttpManager() } return Static.instance } fileprivate override init() { super.init() } }
[ -1 ]
136505d6ad3ac9da481ed0ca01d89552777350d2
2061edd7f7ca25887cc62dab91f62dc766bc90c0
/qn/Extensions/UIViewController+Utils.swift
fb6832378a1e0ae305ad3e72b7da7b742a5d3c52
[]
no_license
sp-hk2ldn/qn
9fa3c2b36f53356701754de74b871d3d107abc89
3837370e61e5068b5ed25bd1aebad80ba384956c
refs/heads/main
2023-02-27T01:50:46.561214
2021-02-01T22:54:15
2021-02-01T22:54:15
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,253
swift
// // UIViewController+Utils.swift // qn // // Created by Stephen Parker on 1/2/2021. // import UIKit extension UIViewController { func showAlert(with apiError: APIError, completion: (() -> Void)? = nil) { var title = "" switch apiError { case .notAuthorized: title = "Error: Resource not authorized" case .notFound: title = "Error: Resource not found" default: title = "Error: Please try again later" } showGenericAlert(with: title, message: apiError.localizedDescription) } func showGenericAlert(with title: String, message: String, handler: (() -> Void)? = nil) { let alertView = UIAlertController(title: title, message: message, preferredStyle: .alert) let alertAction = UIAlertAction(title: "OK", style: .default) { _ in handler?() } alertView.addAction(alertAction) self.present(alertView, animated: true, completion: nil) } func showAlertWith(title: String? = nil, message: String? = nil) { let alertView = UIAlertController(title: title, message: message, preferredStyle: .alert) self.present(alertView, animated: true, completion: nil) } }
[ -1 ]
d49d4ffe9eb821fc8c1fc41c0f62add7dfd4dfce
d101e02c7609bb314862241c016f40f895883c80
/Tests/UVTests/LoopTests.swift
19d890fb6e127fc092c6170c4ee55637f36e984c
[ "Apache-2.0" ]
permissive
reactive-swift/UV
a25cd03d354c8ca3aadae1f9df45f0a60c164334
49db2db9d9bf9ce27c87934407b05c31af4be900
refs/heads/master
2020-04-10T10:55:31.987237
2017-02-27T22:15:06
2017-02-27T22:15:06
52,422,234
1
1
null
2017-02-27T22:15:06
2016-02-24T07:12:43
Swift
UTF-8
Swift
false
false
3,186
swift
//===--- LoopTests.swift -----------------------------------------------------===// //Copyright (c) 2016 Daniel Leping (dileping) // //Licensed under the Apache License, Version 2.0 (the "License"); //you may not use this file except in compliance with the License. //You may obtain a copy of the License at // //http://www.apache.org/licenses/LICENSE-2.0 // //Unless required by applicable law or agreed to in writing, software //distributed under the License is distributed on an "AS IS" BASIS, //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //See the License for the specific language governing permissions and //limitations under the License. //===-------------------------------------------------------------------------===// import Foundation import XCTest @testable import UV import CUV class LoopTests: XCTestCase { func testCreateDestroy() { let loop1 = try? Loop() XCTAssertNotNil(loop1) let loop2 = try? Loop() XCTAssertNotNil(loop2) XCTAssertNotEqual(loop1, loop2) } func testDefaultLoop() { let loop1 = Loop.defaultLoop let loop2 = Loop.defaultLoop XCTAssertEqual(loop1, loop2) } func testAlive() { let loop = try! Loop() XCTAssertFalse(loop.alive) //TODO: add source, check alive } func testStop() { //TODO: implement } func testBackendFd() { let fd = Loop.defaultLoop.backendFd XCTAssertGreaterThan(fd, 0) } func testBackendTimeout() { let loop = Loop.defaultLoop let timeout = loop.backendTimeout.flatMap { $0 == 0 ? nil : $0 } XCTAssertNil(timeout) //TODO: set timeout, test again } func testTime() { let loop = Loop.defaultLoop let time1 = loop.now let time2 = loop.now usleep(10000) loop.updateTime() let time3 = loop.now usleep(10000) loop.run() let time4 = loop.now XCTAssertEqual(time1, time2) XCTAssertNotEqual(time1, time3) XCTAssertNotEqual(time1, time4) XCTAssertNotEqual(time3, time4) } func testWalk() { let loop = Loop.defaultLoop var n = 0 loop.walk { handle in n += 1 } XCTAssertEqual(n, 0) let timer = try! Timer(loop: loop) { timer in } n = 0 loop.walk { handle in n += 1 } XCTAssertEqual(n, 1) XCTAssertEqual(loop.handles.count, 1) for handle in loop.handles { XCTAssertEqual(handle.baseHandle, timer.baseHandle) } } } #if os(Linux) extension LoopTests { static var allTests : [(String, LoopTests -> () throws -> Void)] { return [ ("testCreateDestroy", testCreateDestroy), ("testDefaultLoop", testDefaultLoop), ("testAlive", testAlive), ("testStop", testStop), ("testBackendFd", testBackendFd), ("testBackendTimeout", testBackendTimeout), ("testTime", testTime), ("testWalk", testWalk), ] } } #endif
[ -1 ]
6f09cf24507100108fea47305ed15767840e1c26
53d0c5f6494aa738fe821eb8d8ac6d36a2370efe
/WithBook/Scenes/BookEdit/Presentation/View/BookEditViewController.swift
1b87bd104d55d4f373abd293b9b26b41ef39ae5e
[ "MIT" ]
permissive
shintykt/WithBook
519b29a97081be4d6ecdd2d515c7144077a80829
e03c8937137fe9fd25e1cd53e0e5a65b6443999a
refs/heads/development
2021-04-02T09:12:49.365397
2020-05-05T04:10:15
2020-05-05T04:10:15
248,257,356
0
0
MIT
2020-05-05T04:11:37
2020-03-18T14:40:46
Swift
UTF-8
Swift
false
false
4,143
swift
// // BookEditViewController.swift // WithBook // // Created by shintykt on 2020/02/25. // Copyright © 2020 Takaya Shinto. All rights reserved. // import RxCocoa import RxSwift import UIKit struct BookEditViewControllerFactory { private init() {} static func create(for mode: BookEditMode) -> BookEditViewController { let viewController = R.storyboard.bookEdit().instantiateInitialViewController() as! BookEditViewController viewController.inject(mode) return viewController } } final class BookEditViewController: UIViewController { @IBOutlet private weak var titleTextField: UITextField! @IBOutlet private weak var authorTextField: UITextField! @IBOutlet private weak var imageView: UIImageView! @IBOutlet private weak var selectImageButton: UIButton! @IBOutlet private weak var completeButton: UIButton! private let viewModel = BookEditViewModel(model: BookEditModel()) private let disposeBag = DisposeBag() private var mode: BookEditMode! private lazy var modeRelay = BehaviorRelay<BookEditMode>(value: mode) private let imageRelay = PublishRelay<UIImage>() override func viewDidLoad() { super.viewDidLoad() setUpUI() setUpViewModel() } fileprivate func inject(_ mode: BookEditMode) { self.mode = mode } } // MARK: - セットアップ private extension BookEditViewController { func setUpUI() { let cancelButton = UIBarButtonItem(title: "キャンセル", style: .plain, target: self, action: nil) navigationItem.setLeftBarButton(cancelButton, animated: true) cancelButton.rx.tap .subscribe { [weak self] _ in self?.dismiss(animated: true) } .disposed(by: disposeBag) selectImageButton.rx.tap .subscribe { [weak self] _ in self?.selectImage() } .disposed(by: disposeBag) let backgroundTap = UITapGestureRecognizer() backgroundTap.rx.event .subscribe { [weak self] _ in self?.view.endEditing(true) } .disposed(by: disposeBag) view.addGestureRecognizer(backgroundTap) } func setUpViewModel() { let input = BookEditViewModel.Input( mode: modeRelay.asDriver(onErrorJustReturn: .adding), title: titleTextField.rx.text.orEmpty.asDriver(), author: authorTextField.rx.text.asDriver(), image: imageRelay.asDriver(onErrorJustReturn: Const.defaultImage), completeTap: completeButton.rx.tap.asDriver() ) let output = viewModel.transform(input: input) output.book .drive(onNext: { [weak self] book in self?.titleTextField.text = book.title self?.authorTextField.text = book.author self?.imageView.image = book.image }) .disposed(by: disposeBag) output.canTapComplete .drive(completeButton.rx.isEnabled) .disposed(by: disposeBag) output.completeResult .drive(onNext: { [weak self] event in self?.dismiss(animated: true) }) .disposed(by: disposeBag) } } // MARK: - 画像取得 extension BookEditViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate { private func selectImage() { guard UIImagePickerController.isSourceTypeAvailable(.photoLibrary) else { return } let imagePicker = UIImagePickerController() imagePicker.delegate = self imagePicker.sourceType = .photoLibrary present(imagePicker, animated: true) } func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { guard let selectedImage = info[.originalImage] as? UIImage else { return } imageView.image = selectedImage imageRelay.accept(selectedImage) dismiss(animated: true) } }
[ -1 ]
c355855448d0a9320eb73704aeac8879fd1b934f
64c1557ab16c1a0949e8731788a7597e91f82763
/appdb/Tabs/Settings/My Dylibs/MyDylibs+Extension.swift
e6951a3dc54c1ca79d8447f72571200b748cdb25
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
ipwnosx/appdb
2326e9bf56916028b7fc68b992f0a4757a2acc63
574aeb89f4b57874157fbed3fc8d22622414d39a
refs/heads/master
2023-09-01T19:46:34.879018
2023-08-24T09:27:01
2023-08-24T09:27:01
190,861,303
5
1
MIT
2023-08-24T22:57:46
2019-06-08T07:57:45
Swift
UTF-8
Swift
false
false
5,641
swift
// // MyDylibs+Extension.swift // appdb // // Created by stev3fvcks on 19.03.23. // Copyright © 2023 stev3fvcks. All rights reserved. // import UIKit import UniformTypeIdentifiers extension MyDylibs { convenience init() { if #available(iOS 13.0, *) { self.init(style: .insetGrouped) } else { self.init(style: .grouped) } } func setUp() { tableView.tableFooterView = UIView() tableView.theme_backgroundColor = Color.tableViewBackgroundColor tableView.theme_separatorColor = Color.borderColor tableView.cellLayoutMarginsFollowReadableWidth = true tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell") tableView.rowHeight = 45 if #available(iOS 13.0, *) { } else { // Hide the 'Back' text on back button let backItem = UIBarButtonItem(title: "", style: .done, target: nil, action: nil) navigationItem.backBarButtonItem = backItem } let addItem = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(addDylibClicked)) navigationItem.rightBarButtonItem = addItem state = .loading animated = true } // Only enable button if text is not empty /*@objc func repoUrlTextfieldTextChanged(sender: UITextField) { var responder: UIResponder = sender while !(responder is UIAlertController) { responder = responder.next! } if let alert = responder as? UIAlertController { (alert.actions[1] as UIAlertAction).isEnabled = !(sender.text ?? "").isEmpty } }*/ @objc func addDylibClicked() { self.addDylibFromUrl() /* let alertController = UIAlertController(title: "How do you want to add the dylib?".localized(), message: nil, preferredStyle: .actionSheet, adaptive: true) alertController.addAction(UIAlertAction(title: "Cancel".localized(), style: .cancel)) alertController.addAction(UIAlertAction(title: "Upload file".localized(), style: .default, handler: { _ in self.addDylibFromFile() })) alertController.addAction(UIAlertAction(title: "From URL".localized(), style: .default, handler: { _ in self.addDylibFromUrl() })) present(alertController, animated: true)*/ } /* func addDylibFromFile() { var docPicker: UIDocumentPickerViewController? if #available(iOS 14.0, *) { docPicker = UIDocumentPickerViewController(forOpeningContentTypes: [.data]) } else { docPicker = UIDocumentPickerViewController(documentTypes: ["dylib", "framework.zip", "deb"], in: .open) } docPicker!.delegate = self docPicker!.allowsMultipleSelection = false if #available(iOS 13.0, *) { docPicker!.shouldShowFileExtensions = true } self.present(docPicker!, animated: true, completion: nil) }*/ func addDylibFromUrl() { let alertController = UIAlertController(title: "Please enter URL to .dylib/.deb/.framework.zip".localized(), message: nil, preferredStyle: .alert, adaptive: true) alertController.addTextField { textField in textField.placeholder = "Dylib URL".localized() textField.theme_keyboardAppearance = [.light, .dark, .dark] textField.keyboardType = .URL //textField.addTarget(self, action: #selector(self.repoUrlTextfieldTextChanged(sender:)), for: .editingChanged) textField.clearButtonMode = .whileEditing } alertController.addAction(UIAlertAction(title: "Cancel".localized(), style: .cancel)) let addAction = UIAlertAction(title: "Add .dylib/.deb/.framework.zip".localized(), style: .default, handler: { _ in guard let text = alertController.textFields?[0].text else { return } API.addDylib(url: text) { Messages.shared.showSuccess(message: "Dylib was added successfully".localized(), context: .viewController(self)) self.loadDylibs() } fail: { error in Messages.shared.showError(message: "An error occurred while adding the new dylib".localized(), context: .viewController(self)) } }) alertController.addAction(addAction) //addAction.isEnabled = false present(alertController, animated: true) } } /* extension MyDylibs: UIDocumentPickerDelegate { func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) { if let dylibFile = urls.first { var hasValidSuffix = false for validSuffix in ["dylib", "framework.zip", "deb"] { if dylibFile.path.hasSuffix(validSuffix) { hasValidSuffix = true } } if hasValidSuffix { API.uploadDylib(fileURL: dylibFile) { r in } completion: { error in if error == nil { Messages.shared.showSuccess(message: "The dylib has been uploaded successfully".localized()) self.loadDylibs() } else { Messages.shared.showError(message: error!) } } } else { Messages.shared.showError(message: "Invalid file type. Only .dylib, .framework.zip, and .deb files are allowed") } } } } */
[ -1 ]
53c13cd9c31ecee6d7766d1b199250ce15e39e04
a9a5d44188c9cf0174c26d6b1615628b25fb9de1
/Classes/Views/TextActionsController.swift
84f9c4b357174c1b6a66464bca3d7ecd06e02128
[ "MIT" ]
permissive
vlada5/GitHawk
c5b5416459a3f3352bf4ce5cc8b4ca991e53b427
16c444331297ef4e04338bba451a67c9af315ef9
refs/heads/master
2021-08-22T17:56:57.074062
2017-11-29T15:11:18
2017-11-29T15:11:18
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,915
swift
// // TextActionsController.swift // Freetime // // Created by Ryan Nystrom on 10/8/17. // Copyright © 2017 Ryan Nystrom. All rights reserved. // import UIKit final class TextActionsController: NSObject, IssueTextActionsViewDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate, ImageUploadDelegate { private weak var textView: UITextView? weak var viewController: UIViewController? private var client: GithubClient? // MARK: Public API func configure(client: GithubClient, textView: UITextView, actions: IssueTextActionsView) { self.client = client self.textView = textView actions.delegate = self } // MARK: IssueTextActionsViewDelegate func didSelect(actionsView: IssueTextActionsView, operation: IssueTextActionOperation) { switch operation.operation { case .execute(let block): block() case .wrap(let left, let right): textView?.replace(left: left, right: right, atLineStart: false) case .line(let left): textView?.replace(left: left, right: nil, atLineStart: true) case .uploadImage: displayUploadImage() } } // MARK: Image Upload func displayUploadImage() { guard let superview = textView?.superview else { return } let imagePicker = UIImagePickerController() imagePicker.delegate = self imagePicker.modalPresentationStyle = .popover imagePicker.popoverPresentationController?.canOverlapSourceViewRect = true let sourceFrame = superview.frame let sourceRect = CGRect(origin: CGPoint(x: sourceFrame.midX, y: sourceFrame.minY), size: CGSize(width: 1, height: 1)) imagePicker.popoverPresentationController?.sourceView = superview imagePicker.popoverPresentationController?.sourceRect = sourceRect imagePicker.popoverPresentationController?.permittedArrowDirections = .up viewController?.present(imagePicker, animated: true, completion: nil) } // MARK: UIImagePickerControllerDelegate func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { guard let image = info[UIImagePickerControllerOriginalImage] as? UIImage else { return } let username = client?.sessionManager.focusedUserSession?.username ?? Constants.Strings.unknown guard let uploadController = ImageUploadTableViewController.create(image, username: username, delegate: self) else { return } picker.pushViewController(uploadController, animated: true) } func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { picker.dismiss(animated: true, completion: nil) } // MARK: ImageUploadDelegate func imageUploaded(link: String, altText: String) { textView?.replace(left: "![\(altText)](\(link))", right: nil, atLineStart: true) } }
[ -1 ]
b903db683ee4a49be25ecce222c9e0095a3f7071
01e40b63ecebf4d2e22c3da24673b1758a278429
/playback-project/JumpListTableViewController.swift
3d20a4aa47835135abe0df3c6893f3f1f609b446
[]
no_license
jacobp100/ios-test
6c1e3252c8161ee09592133b3a2f96184aab5b1f
c75fb39c4592c97b8a9b998bb1afc66ba6f8f79a
refs/heads/master
2020-12-25T16:47:57.621497
2016-09-10T09:21:04
2016-09-10T09:21:04
58,961,518
0
0
null
null
null
null
UTF-8
Swift
false
false
5,896
swift
// // JumpListTableViewController.swift // playback-project // // Created by Jacob Parker on 03/06/2016. // Copyright © 2016 Jacob Parker. All rights reserved. // import UIKit import CoreData enum JumpListActionHandler { case AddJumpListItem } class JumpListAction { var title: String! var action: JumpListActionHandler init(title: String, action: JumpListActionHandler) { self.title = title self.action = action } } class JumpListTableViewController: UITableViewController, PickTimeDelegate { var managedObjectContext: NSManagedObjectContext? var musicPlayer: MusicPlayer? { didSet { reload() if oldValue != nil { removeEvents() } if let currentMusicPlayer = musicPlayer { addEventListeners( selector: #selector(JumpListTableViewController.reload), events: [MusicPlayer.ITEM_DID_CHANGE, MusicPlayer.ITEM_DID_LOAD], object: currentMusicPlayer ) } } } private var actions: [JumpListAction] = [ JumpListAction(title: "Bookmark Time", action: .AddJumpListItem) ] private var segueIdentifier = "CurrentTimeSelection" private var jumplistItems: [JumplistItem] = [] override func viewDidLoad() { super.viewDidLoad() } deinit { removeEvents() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } // MARK: - Table view data source override func numberOfSectionsInTableView(tableView: UITableView) -> Int { return 2 } override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool { return indexPath.section != 0 } override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { if editingStyle == .Delete { print("DELETE") } } override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return section == 0 ? actions.count : jumplistItems.count } override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("JumpListCell", forIndexPath: indexPath) cell.imageView?.bounds = CGRect(x: 0, y: 0, width: 16, height: 16) let backgroundView = UIView() backgroundView.backgroundColor = self.tableView.separatorColor cell.selectedBackgroundView = backgroundView cell.textLabel?.highlightedTextColor = UIColor.blackColor() if indexPath.section == 0 { let action = actions[indexPath.row] cell.textLabel?.text = action.title } else { let formatter = NSDateComponentsFormatter() formatter.zeroFormattingBehavior = .Pad formatter.allowedUnits = [.Minute, .Second] if let time = jumplistItems[indexPath.row].time as? Double { cell.textLabel?.text = formatter.stringFromTimeInterval(time) } else { cell.textLabel?.text = ":O" } } return cell } override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? { return section == 1 ? "Bookmarks" : nil } override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { if indexPath.section == 0 { switch actions[indexPath.row].action { case .AddJumpListItem: performSegueWithIdentifier(segueIdentifier, sender: self) } } else if let time = jumplistItems[indexPath.row].time as? Double { musicPlayer?.play(time) } deselect() } override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == segueIdentifier { let pickTimeViewController = segue.destinationViewController as? PickTimeViewController pickTimeViewController?.delegate = self pickTimeViewController?.duration = musicPlayer?.currentItem?.duration ?? 0 if let time = musicPlayer?.currentItem?.time { pickTimeViewController?.time = time } } } func pickTimeDidPickTime(sender: PickTimeViewController, time: Double) { dismissViewControllerAnimated(true, completion: nil) guard let context = managedObjectContext else { return } guard let mediaItem = musicPlayer?.currentItem?.model else { return } context.performBlock { guard let _ = JumplistItem.jumplistItemForMediaItemTime(mediaItem, time: time, context: context) else { return } self.reload() guard let _ = try? context.save() else { print("Fuck") return } } } func pickTimeDidCancel(sender: PickTimeViewController) { dismissViewControllerAnimated(true, completion: nil) } func deselect() { if let selectedPath = tableView?.indexPathForSelectedRow { tableView?.deselectRowAtIndexPath(selectedPath, animated: false) } } func reload() { if let jumplistSet = musicPlayer?.currentItem?.model?.jumplistItems { jumplistItems = Array(jumplistSet) } else { jumplistItems = [] } dispatch_async(dispatch_get_main_queue()) { self.tableView?.reloadData() } } }
[ -1 ]
9ff0ca04548c44911448926ef22c8f0e8f59ee7c
0744a0f4729d394003b6dd38842ea21b51aa15b7
/Charts-Tutorial/Charts-Tutorial/AppDelegate.swift
0e37ce3b1c47be83bb3bbb7d30ff649ea9cc0c1c
[]
no_license
manyunov/iOS-Charts-Tutorial
4ab9bc9776dc767fa9bf1e77b4c8841039f4ea85
f0b6f1c8bd2acb016ae181f7e1af5c780caa3291
refs/heads/main
2023-06-29T21:03:01.760248
2021-07-26T01:49:29
2021-07-26T01:49:29
388,641,054
0
0
null
null
null
null
UTF-8
Swift
false
false
1,355
swift
// // AppDelegate.swift // Charts-Tutorial // // Created by Abhimanyu Das on 7/22/21. // import UIKit @main class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } // MARK: UISceneSession Lifecycle func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { // Called when a new scene session is being created. // Use this method to select a configuration to create the new scene with. return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) } func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) { // Called when the user discards a scene session. // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. // Use this method to release any resources that were specific to the discarded scenes, as they will not return. } }
[ 393222, 393224, 393230, 393250, 344102, 393261, 393266, 213048, 385081, 376889, 393275, 376905, 327756, 254030, 286800, 368727, 180313, 368735, 180320, 376931, 286831, 368752, 286844, 417924, 262283, 286879, 286888, 377012, 164028, 327871, 180416, 377036, 180431, 377046, 418007, 418010, 377060, 327914, 205036, 393456, 393460, 418043, 336123, 385280, 262404, 164106, 180490, 368911, 262416, 262422, 377117, 262436, 336180, 262454, 393538, 262472, 344403, 213332, 65880, 262496, 418144, 262499, 213352, 246123, 262507, 262510, 213372, 385419, 393612, 262550, 262552, 385440, 385443, 262566, 385451, 262573, 393647, 385458, 262586, 344511, 262592, 360916, 369118, 328177, 328179, 328182, 328189, 328192, 164361, 410128, 393747, 254490, 188958, 385570, 33316, 377383, 197159, 352821, 197177, 418363, 188987, 369223, 385609, 385616, 352864, 369253, 262760, 352874, 352887, 254587, 377472, 148105, 377484, 352918, 98968, 344744, 361129, 336555, 385713, 434867, 164534, 336567, 328378, 164538, 328386, 344776, 352968, 352971, 418507, 352973, 385742, 385748, 361179, 189153, 369381, 361195, 418553, 344831, 344835, 336643, 344841, 361230, 336659, 418580, 418585, 434970, 369435, 418589, 262942, 418593, 336675, 328484, 418598, 418605, 336696, 361273, 328515, 336708, 328519, 361288, 336711, 328522, 336714, 426841, 197468, 254812, 361309, 361315, 361322, 328573, 377729, 369542, 361360, 222128, 345035, 345043, 386003, 386011, 386018, 386022, 435187, 328702, 328714, 361489, 386069, 386073, 336921, 336925, 345118, 377887, 345133, 345138, 386101, 361536, 197707, 189520, 345169, 156761, 361567, 148578, 345199, 386167, 361593, 410745, 361598, 214149, 345222, 386186, 337047, 345246, 214175, 337071, 337075, 345267, 386258, 328924, 66782, 222437, 386285, 328941, 386291, 345376, 353570, 345379, 410917, 345382, 337205, 345399, 378169, 369978, 337222, 337229, 337234, 263508, 402791, 345448, 271730, 378227, 271745, 181638, 353673, 181643, 181649, 181654, 230809, 181673, 181681, 337329, 181684, 361917, 181696, 337349, 337365, 271839, 329191, 361960, 329194, 116210, 337398, 329226, 419339, 419343, 419349, 345625, 419355, 370205, 419359, 394786, 419362, 370213, 419368, 419376, 206395, 214593, 419400, 419402, 353867, 419406, 419410, 394853, 345701, 222830, 370297, 403070, 353919, 403075, 198280, 345736, 403091, 345749, 419483, 345757, 345762, 419491, 345765, 419497, 419501, 370350, 419506, 419509, 419512, 337592, 419517, 337599, 419527, 419530, 419535, 272081, 394966, 419542, 419544, 181977, 345818, 419547, 419550, 419559, 337642, 419563, 337645, 370415, 337659, 141051, 337668, 362247, 395021, 362255, 116509, 345887, 378663, 345905, 354106, 354111, 247617, 354117, 370503, 329544, 345930, 370509, 354130, 247637, 337750, 370519, 313180, 354142, 354150, 354156, 345967, 345970, 345974, 403320, 354172, 247691, 337808, 247700, 329623, 436126, 436132, 337833, 362413, 337844, 346057, 346063, 247759, 329697, 354277, 190439, 247789, 354313, 346139, 436289, 378954, 395339, 338004, 100453, 329832, 329855, 329885, 411805, 346272, 362660, 100524, 387249, 379066, 387260, 256191, 395466, 346316, 411861, 411864, 411868, 411873, 379107, 411876, 387301, 346343, 338152, 387306, 387312, 346355, 436473, 321786, 379134, 411903, 411916, 379152, 395538, 387349, 338199, 387352, 182558, 338211, 395566, 248111, 362822, 436555, 190796, 379233, 354673, 321910, 248186, 420236, 379278, 272786, 354727, 338352, 338381, 330189, 338386, 256472, 338403, 338409, 248308, 199164, 330252, 199186, 420376, 330267, 354855, 10828, 199249, 346721, 174695, 248425, 191084, 338543, 191092, 346742, 354974, 150183, 174774, 248504, 174777, 223934, 355024, 273108, 355028, 264918, 183005, 256734, 436962, 338660, 338664, 264941, 363251, 207619, 264964, 338700, 256786, 199452, 363293, 396066, 346916, 396069, 215853, 355122, 355131, 355140, 355143, 338763, 355150, 330580, 355166, 265055, 265058, 355175, 387944, 355179, 330610, 355218, 330642, 412599, 207808, 379848, 396245, 248792, 248798, 347105, 257008, 183282, 265207, 330748, 265214, 330760, 330768, 248862, 347176, 158761, 396328, 199728, 396336, 330800, 396339, 339001, 388154, 388161, 347205, 248904, 330826, 248914, 412764, 339036, 257120, 265320, 248951, 420984, 330889, 347287, 248985, 339097, 44197, 380070, 339112, 249014, 126144, 330958, 330965, 265432, 265436, 388319, 388347, 175375, 159005, 175396, 208166, 273708, 347437, 372015, 347441, 372018, 199988, 44342, 175415, 396600, 437566, 175423, 437570, 437575, 437583, 331088, 437587, 331093, 396633, 175450, 437595, 175457, 208227, 175460, 175463, 265580, 437620, 175477, 249208, 175483, 249214, 175486, 175489, 249218, 249227, 175513, 175516, 396705, 175522, 355748, 380332, 396722, 208311, 388542, 372163, 216517, 380360, 216522, 339404, 372176, 208337, 339412, 413141, 339417, 339420, 249308, 339424, 339428, 339434, 249328, 69113, 372228, 208398, 380432, 175635, 265778, 265795, 396872, 265805, 224853, 224857, 257633, 224870, 372327, 257646, 372337, 224884, 224887, 224890, 224894, 372353, 224897, 216707, 421508, 126596, 224904, 224909, 11918, 159374, 224913, 126610, 224916, 224919, 126616, 208538, 224922, 224926, 224929, 224932, 257704, 224936, 224942, 257712, 224947, 257716, 257720, 224953, 257724, 224959, 257732, 224965, 224969, 339662, 224975, 257747, 224981, 224986, 257761, 224993, 257764, 224999, 339695, 225012, 257787, 225020, 257790, 339710, 225025, 257794, 339721, 257801, 257804, 225038, 257807, 225043, 372499, 167700, 225048, 257819, 225053, 184094, 225058, 257833, 225066, 257836, 413484, 225070, 225073, 372532, 257845, 225079, 397112, 225082, 397115, 225087, 225092, 225096, 323402, 257868, 257871, 225103, 397139, 225108, 225112, 257883, 257886, 225119, 257890, 339814, 225127, 257896, 274280, 257901, 225137, 339826, 257908, 225141, 257912, 257916, 225148, 257920, 225155, 339844, 225165, 397200, 225170, 380822, 225175, 225180, 118691, 184244, 372664, 372702, 372706, 356335, 380918, 372738, 405533, 430129, 266294, 266297, 421960, 356439, 430180, 421990, 266350, 356466, 266362, 381068, 225423, 250002, 250004, 225429, 356506, 225437, 135327, 225441, 438433, 225444, 438436, 225447, 438440, 225450, 258222, 225455, 225458, 225461, 225466, 389307, 225470, 381120, 372929, 430274, 225475, 389320, 225484, 225487, 225490, 225493, 266453, 225496, 225499, 225502, 225505, 356578, 217318, 225510, 225514, 225518, 372976, 381176, 389380, 61722, 356637, 356640, 356643, 356646, 266536, 356649, 356655, 332080, 340275, 356660, 397622, 332090, 225597, 332097, 201028, 348488, 332106, 332117, 348502, 250199, 250202, 332125, 250210, 332152, 389502, 250238, 332161, 356740, 332172, 373145, 340379, 389550, 324030, 266687, 160234, 127471, 340472, 381436, 324094, 266754, 324099, 324102, 324111, 340500, 324117, 324131, 332324, 381481, 356907, 324139, 324142, 356916, 324149, 324155, 348733, 324164, 356934, 348743, 381512, 324170, 324173, 324176, 389723, 332380, 381545, 340627, 184982, 373398, 258721, 332453, 332459, 389805, 332463, 381617, 332471, 332483, 332486, 373449, 357069, 332493, 357073, 332511, 332520, 340718, 332533, 348924, 373510, 389926, 348978, 152370, 340789, 348982, 398139, 127814, 357201, 357206, 389978, 430939, 357211, 357214, 201579, 201582, 349040, 340849, 201588, 430965, 381813, 324472, 398201, 119674, 324475, 430972, 340858, 340861, 324478, 324481, 373634, 398211, 324484, 324487, 381833, 324492, 324495, 324498, 430995, 324501, 324510, 422816, 324513, 398245, 201637, 324524, 340909, 324533, 324538, 324541, 398279, 340939, 340941, 209873, 340957, 431072, 398306, 340963, 209895, 201711, 349172, 381946, 349180, 439294, 431106, 357410, 250914, 185380, 357418, 209965, 209968, 209975, 209979, 209987, 209995, 341071, 349267, 250967, 210010, 341091, 210025, 210027, 210030, 210036, 210039, 349308, 210044, 160895, 349311, 152703, 210052, 210055, 349319, 218247, 210067, 210071, 210077, 210080, 251044, 210084, 185511, 210088, 210095, 210098, 210107, 210115, 332997, 210127, 333009, 210131, 333014, 210138, 210143, 218354, 218360, 251128, 275712, 275715, 275721, 349459, 333078, 251160, 349484, 349491, 251189, 415033, 251210, 357708, 210260, 365911, 259421, 365921, 333154, 251235, 374117, 333162, 234866, 390516, 333175, 357755, 251271, 136590, 374160, 112020, 349590, 357792, 259515, 415166, 415185, 366034, 366038, 415191, 415193, 415196, 415199, 423392, 333284, 415207, 366056, 366061, 415216, 210420, 415224, 423423, 415257, 415263, 366117, 415270, 144939, 415278, 415281, 415285, 210487, 415290, 415293, 349761, 415300, 333386, 366172, 333413, 423528, 423532, 210544, 415353, 333439, 415361, 267909, 153227, 333498, 210631, 333511, 259788, 358099, 153302, 333534, 366307, 366311, 431851, 366318, 210672, 366321, 366325, 210695, 268041, 210698, 366348, 210706, 399128, 333594, 210719, 358191, 366387, 210739, 399159, 358200, 325440, 366401, 341829, 325446, 46920, 341834, 341838, 415573, 341851, 350045, 399199, 259938, 399206, 358255, 268143, 399215, 358259, 341876, 333689, 243579, 325504, 333698, 333708, 333724, 382890, 350146, 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, 350467, 325891, 350475, 375053, 268559, 350480, 432405, 350486, 325914, 350490, 325917, 350493, 325919, 350498, 194852, 350504, 358700, 391468, 350509, 358704, 358713, 358716, 383306, 334161, 383321, 383330, 383333, 391530, 383341, 334203, 268668, 194941, 391563, 366990, 416157, 268701, 342430, 375208, 326058, 375216, 334262, 334275, 326084, 358856, 334304, 334311, 375277, 334321, 350723, 186897, 342545, 334358, 342550, 342554, 334363, 358941, 350761, 252461, 334384, 358961, 383536, 334394, 252482, 219718, 334407, 334420, 350822, 375400, 334465, 334468, 162445, 326290, 342679, 342683, 260766, 342710, 244409, 260797, 260801, 350917, 154317, 391894, 154328, 416473, 64230, 113388, 342766, 375535, 203506, 342776, 391937, 391948, 375568, 326416, 375571, 375574, 162591, 326441, 383793, 326451, 326454, 375612, 260924, 244540, 326460, 326467, 244551, 326473, 326477, 416597, 326485, 326490, 342874, 326502, 375656, 433000, 326507, 326510, 211825, 211831, 351097, 392060, 359295, 351104, 342915, 400259, 236430, 342930, 252822, 392091, 400285, 252836, 359334, 211884, 400306, 351168, 359361, 359366, 326598, 359382, 359388, 383967, 343015, 359407, 261108, 244726, 261111, 383997, 261129, 261147, 359451, 211998, 261153, 261159, 359470, 359476, 343131, 384098, 384101, 367723, 384107, 187502, 343154, 384114, 212094, 351364, 384135, 384139, 384143, 351381, 384160, 384168, 367794, 384181, 367800, 351423, 384191, 384198, 326855, 244937, 253130, 343244, 146642, 359649, 343270, 351466, 351479, 384249, 343306, 261389, 359694, 384269, 253200, 261393, 384275, 245020, 245029, 171302, 351534, 376110, 245040, 384314, 425276, 212291, 384323, 343365, 212303, 367965, 343393, 343398, 367980, 425328, 343409, 253303, 154999, 343417, 327034, 245127, 384397, 245136, 245142, 245145, 343450, 245148, 245151, 245154, 245157, 245162, 327084, 359865, 384443, 146876, 327107, 384453, 327110, 327115, 327117, 359886, 359890, 343507, 368092, 343534, 343539, 368119, 343544, 368122, 409091, 359947, 359955, 359983, 343630, 179802, 155239, 327275, 245357, 138864, 155254, 155273, 368288, 245409, 425638, 425649, 155322, 425662, 155327, 155351, 155354, 212699, 155363, 245475, 155371, 245483, 409335, 155393, 155403, 155422, 360223, 155438, 155442, 155447, 417595, 360261, 155461, 376663, 155482, 261981, 425822, 376671, 155487, 155490, 155491, 327531, 261996, 376685, 261999, 262002, 327539, 147317, 262005, 425845, 262008, 262011, 155516, 155521, 155525, 360326, 376714, 155531, 262027, 262030, 262033, 262036, 262039, 262042, 155549, 262045, 262048, 262051, 327589, 155559, 155562, 155565, 393150, 393169, 384977, 155611, 155619, 253923, 155621, 253926, 327654, 204784, 393203, 360438, 253943, 393206, 393212, 155646 ]
ee5ecc4b8713296bfa703250e62069a2a06a6a66
1cc0d88f58f4fe502d20dc399b96b5a39e75d150
/iOS_Github_Client/Screens/FollowerListVC.swift
62756e03fe6adf4733707cc8c3b90c55dde1ba13
[]
no_license
roanacla/iOS_Github_Client
c46d339b7e820d91352da52c642d8ef165c007bd
1a4387c5c081356e050e505473d37092d1a117ad
refs/heads/main
2023-04-05T15:27:16.521806
2021-04-14T05:26:17
2021-04-14T05:26:17
354,419,333
0
0
null
null
null
null
UTF-8
Swift
false
false
2,338
swift
// // FollowerListVCViewController.swift // iOS_Github_Client // // Created by Roger Navarro on 4/4/21. // import UIKit class FollowerListVC: UIViewController { enum Section { case main } var username: String! var followers: [Follower] = [] var collectionView: UICollectionView! var dataSource: UICollectionViewDiffableDataSource<Section, Follower>! override func viewDidLoad() { super.viewDidLoad() configureViewController() configureCollectionView() getFollowers() connfigureDataSource() } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) navigationController?.setNavigationBarHidden(false, animated: true) } func configureViewController() { view.backgroundColor = .systemBackground navigationController?.navigationBar.prefersLargeTitles = true } func configureCollectionView() { collectionView = UICollectionView(frame: view.bounds, collectionViewLayout: UIHelper.createThreeColumnFlowLayout(in: view)) view.addSubview(collectionView) collectionView.backgroundColor = .systemBackground collectionView.register(FollowerCell.self, forCellWithReuseIdentifier: FollowerCell.reuseID) } func getFollowers() { NetworkManager.shared.getFollowers(for: username, page: 1) { [weak self] result in guard let self = self else { return } switch result { case .success(let followers): self.followers = followers self.updateData() case .failure(let error): self.presentGFAlertOnMainThread(title: "Error", message: error.rawValue, buttonTitle: "OK") } } } func connfigureDataSource() { dataSource = UICollectionViewDiffableDataSource<Section, Follower>(collectionView: collectionView, cellProvider: { (collectionView, indexPath, follower) -> UICollectionViewCell? in let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FollowerCell.reuseID, for: indexPath) as! FollowerCell cell.set(follower: follower) return cell }) } func updateData() { var snapshot = NSDiffableDataSourceSnapshot<Section, Follower>() snapshot.appendSections([.main]) snapshot.appendItems(followers) DispatchQueue.main.async { self.dataSource.apply(snapshot, animatingDifferences: true) } } }
[ 345904 ]
6940bc5dbd7f7574c0805e5ac108d46ebc9df365
90bb08f6283bf7e261d176770546a06ae4457de0
/Process Manager/ProcessManagerTests/ProcessManagerTests.swift
5f038621d202cf2c2b4fdb7cfd6b24328657d3f4
[]
no_license
andrey-krasivichev/ProcessManager
947fd384f3882394b19186546834f4425a920e98
25572a360b83449a63f7d4439b8474941e95989a
refs/heads/master
2022-11-11T15:21:00.875640
2020-07-05T16:48:29
2020-07-05T16:48:29
277,265,495
0
0
null
null
null
null
UTF-8
Swift
false
false
1,164
swift
// // ProcessManagerTests.swift // ProcessManagerTests // // Created by Andrey Krasivichev on 05.07.2020. // Copyright © 2020 Andrey Krasivichev. All rights reserved. // import XCTest @testable import Process_Manager class ProcessManagerTests: XCTestCase { var processFetcher: ProcessItemsFetcher! var didFetch: Bool = false override func setUpWithError() throws { self.processFetcher = ProcessItemsFetcher() } override func tearDownWithError() throws { self.processFetcher = nil } func testExample() throws { let promise = expectation(description: "Wait for fetch processes") self.processFetcher.itemsFetchedBlock = { (itemsById) in itemsById.count > 0 ? promise.fulfill() : XCTFail("There must be processes..") } self.processFetcher.startFetchEvents() self.wait(for: [promise], timeout: 1.0) self.processFetcher.finishFetchEvents() } func testPerformanceExample() throws { // This is an example of a performance test case. measure { // Put the code you want to measure the time of here. } } }
[ -1 ]
2e2849ad57027223c891c510db40997d0515d820
523cdf0062a5d8e97069b4dabd3b9e1a058eb67f
/FaceRecognizedUITests/FaceRecognizedUITests.swift
5784e965dc82e78ea3390243b524693e9e4f341e
[]
no_license
linder3hs/Machine-Learning
0c1e4a5515ce81d0af465fad59daa3a5642aa293
cb5325d0cedc7b651b75bf9ead621315c5dba787
refs/heads/master
2020-03-07T07:32:49.005752
2018-03-29T22:05:37
2018-03-29T22:05:37
127,352,185
0
0
null
null
null
null
UTF-8
Swift
false
false
1,255
swift
// // FaceRecognizedUITests.swift // FaceRecognizedUITests // // Created by Linder on 3/29/18. // Copyright © 2018 Linder. All rights reserved. // import XCTest class FaceRecognizedUITests: XCTestCase { override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. // In UI tests it is usually best to stop immediately when a failure occurs. continueAfterFailure = false // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. XCUIApplication().launch() // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } func testExample() { // Use recording to get started writing UI tests. // Use XCTAssert and related functions to verify your tests produce the correct results. } }
[ 333827, 243720, 282634, 313356, 155665, 305173, 241695, 223269, 229414, 315431, 292901, 315433, 102441, 325675, 354346, 278571, 124974, 282671, 102446, 229425, 313388, 243763, 321589, 241717, 229431, 180279, 215095, 213051, 288829, 325695, 286787, 288835, 307269, 237638, 313415, 239689, 233548, 315468, 311373, 196687, 278607, 311377, 354386, 315477, 223317, 354394, 323678, 315488, 321632, 45154, 315489, 280676, 313446, 215144, 227432, 217194, 194667, 233578, 278637, 307306, 319599, 288878, 278642, 284789, 131190, 249976, 288890, 292987, 215165, 131199, 227459, 194692, 235661, 278669, 241809, 323730, 278676, 311447, 153752, 327834, 284827, 329884, 278684, 299166, 278690, 233635, 311459, 215204, 284840, 299176, 278698, 184489, 284843, 278703, 323761, 184498, 278707, 125108, 180409, 280761, 278713, 295099, 227517, 299197, 280767, 258233, 223418, 299202, 139459, 309443, 176325, 131270, 301255, 299208, 227525, 280779, 233678, 282832, 321744, 227536, 301270, 301271, 229591, 280792, 356575, 311520, 325857, 280803, 182503, 338151, 319719, 307431, 295147, 317676, 286957, 125166, 125170, 313595, 125180, 184574, 125184, 309504, 125192, 217352, 125197, 125200, 194832, 227601, 325904, 125204, 319764, 278805, 334104, 315674, 282908, 311582, 125215, 299294, 282912, 233761, 278817, 211239, 282920, 125225, 317738, 325930, 311596, 321839, 315698, 98611, 125236, 307514, 282938, 278843, 168251, 287040, 319812, 311622, 227655, 280903, 319816, 323914, 282959, 229716, 289109, 379224, 323934, 391521, 239973, 381286, 285031, 313703, 416103, 280938, 242027, 242028, 321901, 278895, 354672, 287089, 227702, 199030, 315768, 315769, 291194, 139641, 248188, 223611, 313726, 211327, 291200, 311679, 291193, 240003, 158087, 313736, 227721, 242059, 285074, 227730, 240020, 190870, 315798, 190872, 291225, 285083, 293275, 317851, 242079, 227743, 285089, 283039, 289185, 305572, 156069, 293281, 301482, 289195, 311723, 377265, 338359, 299449, 311739, 319931, 293309, 278974, 311744, 317889, 291266, 278979, 278988, 289229, 281038, 326093, 278992, 283089, 373196, 283088, 281039, 279000, 242138, 176602, 285152, 369121, 291297, 279009, 195044, 160224, 242150, 279014, 319976, 279017, 188899, 311787, 281071, 319986, 236020, 279030, 311800, 279033, 317949, 279042, 283138, 233987, 287237, 377352, 322057, 309770, 342537, 279053, 182802, 303635, 283154, 279061, 303634, 279060, 279066, 188954, 322077, 291359, 370122, 227881, 293420, 289328, 283185, 236080, 279092, 23093, 234037, 244279, 244280, 338491, 234044, 301635, 309831, 55880, 322119, 377419, 303693, 281165, 301647, 281170, 326229, 309847, 189016, 115287, 287319, 111197, 295518, 242274, 244326, 279143, 279150, 281200, 287345, 313970, 287348, 301688, 189054, 287359, 291455, 297600, 303743, 301702, 164487, 279176, 311944, 334473, 316044, 311948, 184974, 311950, 316048, 311953, 316050, 336531, 287379, 295575, 227991, 289435, 303772, 221853, 205469, 285348, 314020, 279207, 295591, 248494, 318127, 293552, 295598, 285362, 279215, 287412, 166581, 285360, 154295, 342705, 299698, 287418, 314043, 303802, 66243, 291529, 287434, 225996, 363212, 287438, 242385, 303826, 164561, 279253, 158424, 230105, 299737, 322269, 342757, 289511, 230120, 330473, 234216, 285419, 330476, 289517, 279278, 170735, 312046, 215790, 125683, 230133, 199415, 234233, 242428, 279293, 205566, 322302, 289534, 299777, 291584, 285443, 228099, 291591, 295688, 346889, 285450, 322312, 312076, 285457, 295698, 166677, 283418, 285467, 221980, 234276, 283431, 262952, 262953, 279337, 318247, 318251, 262957, 289580, 164655, 328495, 301872, 242481, 303921, 234290, 285493, 230198, 285496, 301883, 201534, 281407, 289599, 222017, 295745, 293702, 318279, 283466, 281426, 279379, 295769, 201562, 281434, 322396, 230238, 275294, 301919, 293729, 279393, 349025, 281444, 303973, 279398, 230239, 177002, 308075, 242540, 242542, 310132, 295797, 201590, 207735, 228214, 295799, 177018, 269179, 279418, 308093, 314240, 291713, 158594, 330627, 240517, 287623, 228232, 416649, 279434, 236427, 316299, 320394, 299912, 189327, 308111, 308113, 293780, 310166, 289691, 209820, 277404, 240543, 283551, 310177, 289699, 189349, 293673, 289704, 279465, 293801, 177074, 304050, 289720, 289723, 189373, 213956, 281541, 345030, 19398, 213961, 326602, 279499, 56270, 191445, 183254, 304086, 183258, 234469, 340967, 304104, 314343, 324587, 183276, 289773, 203758, 320495, 320492, 234476, 287730, 277493, 240631, 320504, 214009, 312315, 312317, 354342, 234499, 293894, 320520, 230411, 322571, 320526, 330766, 234513, 238611, 140311, 293911, 238617, 316441, 197658, 330789, 248871, 113710, 189487, 281647, 322609, 312372, 203829, 238646, 300087, 238650, 320571, 21567, 308288, 160834, 336962, 314437, 349254, 238663, 300109, 207954, 234578, 205911, 296023, 314458, 277600, 281698, 281699, 230500, 285795, 322664, 228457, 318571, 279659, 234606, 300145, 238706, 312435, 187508, 279666, 300147, 230514, 302202, 285819, 314493, 285823, 150656, 234626, 279686, 222344, 285833, 318602, 285834, 228492, 337037, 234635, 177297, 162962, 187539, 308375, 324761, 285850, 296091, 119965, 302239, 330912, 300192, 339106, 306339, 234662, 300200, 249003, 208044, 238764, 322733, 3243, 302251, 279729, 294069, 300215, 294075, 339131, 64699, 228541, 283841, 148674, 283846, 312519, 279752, 283849, 148687, 290001, 189651, 316628, 279766, 189656, 279775, 304352, 298209, 304353, 310496, 279780, 228587, 279789, 290030, 302319, 251124, 234741, 283894, 316661, 279803, 292092, 208123, 228608, 320769, 234756, 322826, 242955, 177420, 312588, 318732, 126229, 245018, 320795, 318746, 320802, 304422, 130344, 292145, 298290, 312628, 345398, 300342, 159033, 222523, 286012, 181568, 279872, 279874, 294210, 216387, 286019, 300354, 300355, 193858, 304457, 345418, 230730, 294220, 296269, 234830, 224591, 238928, 222542, 296274, 314708, 318804, 283990, 314711, 357720, 300378, 300379, 316764, 294236, 314721, 292194, 230757, 281958, 314727, 134504, 306541, 314734, 284015, 234864, 327023, 316786, 312688, 314740, 230772, 314742, 327030, 296304, 314745, 290170, 310650, 224637, 306558, 290176, 243073, 179586, 306561, 294278, 314759, 296328, 296330, 298378, 318860, 314765, 368012, 292242, 279955, 306580, 314771, 224662, 234902, 282008, 314776, 318876, 282013, 290206, 148899, 314788, 314790, 282023, 333224, 298406, 241067, 279980, 314797, 279979, 286128, 173492, 279988, 284086, 286133, 284090, 302523, 310714, 228796, 54719, 415170, 292291, 302530, 280003, 228804, 310725, 300488, 306630, 306634, 339403, 280011, 302539, 300490, 310731, 234957, 312785, 327122, 222674, 280020, 310735, 280025, 310747, 239069, 144862, 286176, 320997, 310758, 187877, 280042, 280043, 300526, 337391, 282097, 308722, 296434, 306678, 40439, 191991, 286201, 288248, 300539, 288252, 312830, 290304, 286208, 228868, 292359, 323079, 218632, 230922, 302602, 323083, 294413, 329231, 304655, 323088, 282132, 230933, 302613, 282135, 316951, 374297, 302620, 313338, 282147, 222754, 306730, 312879, 230960, 288305, 239159, 290359, 323132, 157246, 288319, 288322, 280131, 349764, 310853, 124486, 194118, 288328, 286281, 292426, 282182, 224848, 224852, 290391, 196184, 239192, 306777, 128600, 235096, 212574, 99937, 204386, 323171, 345697, 300645, 282214, 300643, 312937, 204394, 224874, 243306, 312941, 206447, 310896, 294517, 314997, 288377, 290425, 325246, 333438, 235136, 280193, 282244, 239238, 288391, 323208, 286344, 282248, 179853, 286351, 188049, 239251, 229011, 280217, 323226, 179868, 229021, 302751, 282272, 198304, 245413, 282279, 298664, 212649, 298666, 317102, 286387, 300725, 337590, 286392, 302778, 306875, 280252, 296636, 282302, 280253, 286400, 323265, 280259, 333508, 321220, 282309, 296649, 239305, 306891, 212684, 280266, 302798, 9935, 241360, 282321, 333522, 286419, 313042, 241366, 280279, 282330, 18139, 280285, 294621, 282336, 325345, 321250, 294629, 153318, 333543, 12009, 282347, 282349, 323315, 67316, 286457, 284410, 288508, 200444, 282366, 286463, 319232, 278273, 288515, 280326, 282375, 323335, 284425, 300810, 282379, 116491, 280333, 216844, 284430, 300812, 161553, 124691, 278292, 118549, 278294, 282390, 116502, 284436, 325403, 321308, 321309, 282399, 241440, 282401, 186148, 186149, 315172, 241447, 294699, 286507, 284460, 280367, 300849, 282418, 280373, 282424, 280377, 321338, 282428, 280381, 345918, 241471, 413500, 280386, 325444, 280391, 325449, 315209, 159563, 280396, 307024, 337746, 317268, 325460, 307030, 237397, 18263, 241494, 188250, 284508, 300893, 307038, 237411, 284515, 276326, 282471, 296807, 292713, 282476, 292719, 296815, 313200, 313204, 317305, 124795, 339840, 182145, 315265, 280451, 325508, 333700, 243590, 282503, 67464, 327556, 188293, 325514, 243592, 305032, 315272, 184207, 124816, 315275, 311183, 279218, 282517, 294806, 214936, 337816, 294808, 329627, 239515, 214943, 298912, 319393, 294820, 219046, 333734, 294824, 298921, 284584, 313257, 292783, 126896, 300983, 343993, 288698, 98240, 294849, 214978, 280517, 280518, 214983, 282572, 282573, 372039, 153553, 24531, 231382, 329696, 323554, 292835, 190437, 292838, 294887, 317416, 313322, 278507, 329707, 298987, 296942, 311277, 124912, 327666, 278515, 325620, 239610 ]
4051b66565a7f7ad067b1ff251624d059eb24fd5
da35a5ee0380c02d252bfdcc33b51c2c4b835e06
/CreatubblesAPIClient/Sources/Requests/User/SearchInFollowedUsersResponseHandler.swift
c11cdce8dc12f8d33bde12b9a7e599e9ff6ca4bf
[ "MIT" ]
permissive
creatubbles/ctb-api-swift
a471dfa91f76f951904dd3564cbe2dd602bba9bf
bb6622f214a3469bd4601c8978ed2079cad522b0
refs/heads/develop
2021-06-11T04:30:31.413844
2020-04-13T23:46:31
2020-04-13T23:46:31
51,001,189
3
0
MIT
2019-03-06T10:00:53
2016-02-03T13:24:55
Swift
UTF-8
Swift
false
false
2,324
swift
// // SearchInFollowedUsersResponseHandler.swift // CreatubblesAPIClient // // Copyright (c) 2017 Creatubbles Pte. Ltd. // // 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 ObjectMapper class SearchInFollowedUsersResponseHandler: ResponseHandler { fileprivate let completion: UsersClosure? init(completion: UsersClosure?) { self.completion = completion } override func handleResponse(_ response: Dictionary<String, AnyObject>?, error: Error?) { if let response = response, let usersMapper = Mapper<UserMapper>().mapArray(JSONObject: response["data"]) { let metadata = MappingUtils.metadataFromResponse(response) let pageInfo = MappingUtils.pagingInfoFromResponse(response) let dataMapper = MappingUtils.dataIncludeMapperFromResponse(response, metadata: metadata) let users = usersMapper.map({ User(mapper: $0, dataMapper: dataMapper, metadata: metadata) }) executeOnMainQueue { self.completion?(users, pageInfo, ErrorTransformer.errorFromResponse(response, error: error)) } } else { executeOnMainQueue { self.completion?(nil, nil, ErrorTransformer.errorFromResponse(response, error: error)) } } } }
[ -1 ]
462f641b6546331c5ac4bc151b1acefcf5de24db
760ea6b8e716fb1087eb71c9dea24d551079a062
/Healthcare/UI/Telenursing/TelenursingView.swift
67169998c27d0a7d65de42ac082e2908e265f4d7
[]
no_license
TomoyaOnishi/BuildTest
a6789f3be22e16eef43783d8abfdf91f2dbecf86
abe61b8c2d773a63bb59f3955446ddad1b244fba
refs/heads/main
2023-08-04T21:40:06.490856
2021-09-07T11:04:40
2021-09-07T11:04:40
402,484,358
0
0
null
null
null
null
UTF-8
Swift
false
false
1,868
swift
// // TelenursingView.swift // Healthcare // // Created by T T on 2021/06/07. // import SwiftUI import TwilioVideo struct TelenursingView: View { @Environment(\.presentationMode) var presentationMode var body: some View { VStack { VStack { VStack(spacing: 8) { Text("次回のテレナーシング") .bold() .foregroundColor(.orange) .frame(maxWidth: .infinity, alignment: .leading) VStack(spacing: 8) { Text("2021年5月24日(月)") .bold() .frame(maxWidth: .infinity, alignment: .leading) Text("18:00〜19:00") .bold() .frame(maxWidth: .infinity, alignment: .leading) Text("水野 看護師") .bold() .frame(maxWidth: .infinity, alignment: .leading) } .padding(.horizontal) Button(action: { print("通話を開始") }, label: { Text("通話を開始") .bold() .foregroundColor(.white) .frame(width: 298, height: 60) .background(Color.orange) .cornerRadius(30) }) } .padding() } .background(Color.orange.opacity(0.2)) .padding() Spacer() } } } struct TelenursingView_Previews: PreviewProvider { static var previews: some View { TelenursingView() } }
[ -1 ]
61e27d90843c67c2c98374e9ef7bc0727c4bd0b3
5d3cf5ee7a362086c7401221660a5af0c574de97
/Hoofers Ski and Snowboard/GPSViewController.swift
9db452c10b89ff8d4b6989c5930f03da413a9932
[]
no_license
cvhnilicka/HooferSNS
75c11f56e769be7d64b48b99f29b84d6d8815d95
945a81bd3ec0276c7be36fbcde054c410ff51e49
refs/heads/master
2021-01-10T13:19:26.438998
2015-11-30T20:55:45
2015-11-30T20:55:45
46,834,762
0
3
null
2015-12-02T21:20:08
2015-11-25T03:23:12
Swift
UTF-8
Swift
false
false
4,052
swift
// // GPSViewController.swift // Hoofers Ski and Snowboard // // Created by Cormick Hnilicka on 11/25/15. // Copyright © 2015 Cormick Hnilicka. All rights reserved. // import UIKit import GoogleMaps class GPSViewController: UIViewController, CLLocationManagerDelegate, GMSMapViewDelegate { @IBOutlet weak var mapView: GMSMapView! @IBOutlet weak var MapType: UILabel! @IBOutlet weak var MapButton: UIButton! var locationmanager = CLLocationManager(); var firstLocationUpdate: Bool? var didFindMyLocation = false var pageViewController: UIPageViewController! var pageTitle: NSArray! var pageImages: NSArray! var pageIndex = 0; override func viewDidLoad() { super.viewDidLoad() mapView.delegate = self; mapView.animateToLocation(CLLocationCoordinate2DMake(43.4753, -110.7692)); mapView.animateToZoom(8); self.locationmanager.delegate = self; self.locationmanager.requestWhenInUseAuthorization(); mapView.addObserver(self, forKeyPath: "myLocation", options: NSKeyValueObservingOptions.New, context: nil); // Do any additional setup after loading the view. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer<Void>) { if !didFindMyLocation { let myLocation: CLLocation = change![NSKeyValueChangeNewKey] as! CLLocation mapView.camera = GMSCameraPosition.cameraWithTarget(myLocation.coordinate, zoom: 10.0) mapView.settings.myLocationButton = true didFindMyLocation = true } } func locationManager(manager: CLLocationManager, didChangeAuthorizationStatus status: CLAuthorizationStatus) { if status == CLAuthorizationStatus.AuthorizedWhenInUse { locationmanager.startUpdatingLocation() mapView.myLocationEnabled = true } } @IBAction func changeType(sender: AnyObject) { let actionSheet = UIAlertController(title: "Map Types", message: "Select map type:", preferredStyle: UIAlertControllerStyle.ActionSheet) let normalMapTypeAction = UIAlertAction(title: "Normal", style: UIAlertActionStyle.Default) { (alertAction) -> Void in self.mapView.mapType = kGMSTypeNormal self.MapButton.setTitle("Normal", forState: .Normal) } let terrainMapTypeAction = UIAlertAction(title: "Terrain", style: UIAlertActionStyle.Default) { (alertAction) -> Void in self.mapView.mapType = kGMSTypeTerrain self.MapButton.setTitle("Terrain", forState: .Normal) } let hybridMapTypeAction = UIAlertAction(title: "Hybrid", style: UIAlertActionStyle.Default) { (alertAction) -> Void in self.mapView.mapType = kGMSTypeHybrid self.MapButton.setTitle("Hybrid", forState: .Normal) } let cancelAction = UIAlertAction(title: "Close", style: UIAlertActionStyle.Cancel) { (alertAction) -> Void in } actionSheet.addAction(normalMapTypeAction) actionSheet.addAction(terrainMapTypeAction) actionSheet.addAction(hybridMapTypeAction) actionSheet.addAction(cancelAction) presentViewController(actionSheet, animated: true, completion: nil) } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. } */ }
[ -1 ]
88221b6ddd5831ba40a29057f3fb8f6b71382ddd
922839e68865924a8a9278a0adea8cb2611a43c4
/Yelp/DealCell.swift
0bb60000c1ef89c94039879f959e6a9021464b82
[ "Apache-2.0" ]
permissive
ryanchee/YelpClone
f80699020e2b30a63813e410654571f9fd8c1018
c6a66196af8d78fd844ef131908baf7e3e8890de
refs/heads/master
2021-01-12T17:15:57.318561
2016-10-24T04:48:36
2016-10-24T04:48:36
71,533,836
0
0
null
null
null
null
UTF-8
Swift
false
false
992
swift
// // DealCell.swift // Yelp // // Created by Ryan Chee on 10/23/16. // Copyright © 2016 Timothy Lee. All rights reserved. // import UIKit @objc protocol DealCellDelegate { @objc optional func dealCell(dealCell: DealCell, didChangeValue: Bool) } class DealCell: UITableViewCell { @IBOutlet weak var dealLabel: UILabel! @IBOutlet weak var dealSwitch: UISwitch! weak var delegate: DealCellDelegate? override func awakeFromNib() { super.awakeFromNib() // Initialization code dealSwitch.addTarget(self, action: "dealSwitchValueChanged", for: UIControlEvents.valueChanged) } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } func dealSwitchValueChanged() { delegate?.dealCell?(dealCell: self, didChangeValue: dealSwitch.isOn) print("switch value changed") } }
[ -1 ]
c9a401cab43ba66cd4cd9ff87a7b26dcdcd55163
5b88127c1909985cca7f7fbcd3016446e26783f7
/Travelogue/Controllers/Trip/NewTrip.swift
a1a969bcb5c5b5124f1dce5758a6c8727838a1a8
[]
no_license
averywald/Travelogue
8b0a957bf31327236f1741b69f47944fe91090b4
771039979d4791036189b40b8163e6aa3ee76708
refs/heads/main
2023-01-30T09:39:06.295161
2020-12-12T02:21:03
2020-12-12T02:21:03
319,398,506
0
0
null
2020-12-12T02:21:04
2020-12-07T17:45:58
Swift
UTF-8
Swift
false
false
1,620
swift
// // NewTrip.swift // Travelogue // // Created by Avery Wald on 12/9/20. // import UIKit class NewTrip: UIViewController { @IBOutlet weak var name: UITextField! @IBOutlet weak var startLoc: UITextField! @IBOutlet weak var startDate: UIDatePicker! @IBOutlet weak var endLoc: UITextField! @IBOutlet weak var endDate: UIDatePicker! var mode: String = "new" // hack way to track status var existingTrip: Trip? let mc = (UIApplication.shared.delegate as? AppDelegate)?.persistentContainer.viewContext override func viewDidLoad() { super.viewDidLoad() } override func viewWillAppear(_ animated: Bool) { // if editing a trip object if (existingTrip != nil) { self.title = "Edit Trip" // set page title self.mode = "edit" // change to edit mode // assign its values to the UI elements name.text = existingTrip?.name startLoc.text = existingTrip?.location // need end loc in model ?? startDate.date = (existingTrip?.startDate)! endDate.date = (existingTrip?.endDate)! } } @IBAction func save(_ sender: Any) { // get all the new category attribs let n = name.text let s = startLoc.text let d = startDate.date let e = endDate.date // try to create a Trip object from them if let trip = Trip(name: n, start: d, end: e, location: s) { if (mode == "edit") { do { try mc?.save() } catch { print("could not update trip") } } else { do { try trip.managedObjectContext?.save() } catch { print("could not save new trip") } } // redirect back to trip list self.navigationController?.popViewController(animated: true) } } }
[ -1 ]
421332d2ac7364891e89b546016bd14c13ec114c
6c2323a5abc02bcfc4d2a26e5596c92bce47882a
/ClassSourceCodes/Lecture 12 ThreadedCompositing/Section05/Section05/CompositingViewController.swift
989c2a0815fc3f0b7f56826379844e5cf8cfa52b
[]
no_license
codyhex/Harvard-iOS-SWIFT
d2854061aa57fd11abe33aafc8a3b1f9602f7f89
e42c7dc78ae4a4d32b4f6ab9ce775a64b316069e
refs/heads/master
2021-03-16T12:42:16.474410
2016-01-28T20:26:38
2016-01-28T20:26:38
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,867
swift
// // CompositingViewController.swift // Section05 // // Created by Van Simmons on 2/16/15. // Copyright (c) 2015 ComputeCycles, LLC. All rights reserved. // import UIKit import Section05Views enum Image: String { case Autumn = "Autumn" case Building = "Building" case City = "City" case Clouds = "Clouds" case Flowers = "Flowers" case River = "River" case Snow = "Snow" case Statue = "Statue" case Sunrise = "Sunrise" case Trees = "Trees" static let allArray = [Image.Autumn, Image.Building, Image.City, Image.Clouds, Image.Flowers, Image.River, Image.Snow, Image.Statue, Image.Sunrise, Image.Trees] static func all() -> [Image] { return allArray } } class CompositingViewController: UITableViewController, UITableViewDataSource, UITableViewDelegate { @IBOutlet var cellImageView:UIImageView? @IBOutlet var cellLabel:UILabel? var images:[UIImage] = [] var compositorNib:UINib = UINib(nibName: "Compositor", bundle: NSBundle.mainBundle()) override func viewDidLoad() { for img in Image.all() { var image = UIImage(named: img.rawValue)! images.append(image) } tableView.rowHeight = min(tableView.frame.size.width-30, tableView.frame.size.height-40) } override func numberOfSectionsInTableView(tableView: UITableView) -> Int { return 1 } override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 1000000 } override func shouldAutorotate() -> Bool { return true } override func didRotateFromInterfaceOrientation(fromInterfaceOrientation: UIInterfaceOrientation) { var op = NSBlockOperation { self.tableView.rowHeight = min(self.tableView.frame.size.width-30, self.tableView.frame.size.height-40) self.tableView.reloadData() } NSOperationQueue.mainQueue().addOperation(op) } override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("ImageCell", forIndexPath: indexPath) as! UITableViewCell cell.selectionStyle = .Default cell.textLabel!.backgroundColor = UIColor.clearColor() let row = indexPath.row % 10 var iv = UIImageView(frame: cell.imageView!.frame) var newCell = compositorNib.instantiateWithOwner(self, options: nil) self.cellLabel!.text = "\(Image.all()[row].rawValue), Row: \(indexPath.row)" self.cellImageView!.image = images[row] let i = cellImageView!.compositedImage() cell.imageView!.image = i return cell } }
[ -1 ]
7257a3ecf3872530f1faff270cfc4a7ae459db30
eeb54c6766f9c92894b824f8792e907dbafdb910
/TheMovieApp/Features/ServiceModel/CastPeopleDataModel.swift
1d08928fc88d19ac313c3d57d1aa216c1fd7e083
[]
no_license
Brsrld/TheMovieAppWithoutRxSwift
5f4669ea9752235892cf1ae40d85632de27c60c8
ca465c2da4c64a4459c1697219555e04e1a9e959
refs/heads/master
2023-06-05T21:08:14.420023
2021-06-29T18:57:34
2021-06-29T18:57:34
379,346,981
0
0
null
null
null
null
UTF-8
Swift
false
false
203
swift
// // CastPeopleDataModel.swift // TheMovieApp // // Created by Baris Saraldi on 19.06.2021. // import Foundation //MARK: CastPeople Model struct CastPeople: Codable { let biography: String? }
[ -1 ]
d828fbf285070f6db90c0c44a5272c338b5a5445
9e6b688407ecc9325141a687556bf8b307eeb540
/AppDelegate.swift
44f3439896b34c20bf15d2df78498242dbb780a6
[]
no_license
yennhan/intruderalert
4b52d269e0a4c07834a5846cd3ff047a9b750715
811012c8f70f943de9e02cf791aa00287cf041bf
refs/heads/master
2020-06-09T05:14:55.987708
2019-06-23T17:45:12
2019-06-23T17:45:12
193,378,119
0
0
null
null
null
null
UTF-8
Swift
false
false
5,099
swift
// // AppDelegate.swift // IntruderAlert // // Created by Leow Yenn Han on 14/08/2018. // Copyright © 2018 Leow Yenn Han. All rights reserved. // import UIKit import CoreData import AWSMobileClient import AWSCore import AWSCognito @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. let credentialsProvider = AWSCognitoCredentialsProvider(regionType:.APSoutheast1, identityPoolId:"ap-southeast-1:6a4752e3-65ab-4256-9092-b106d6b8a74f") let configuration = AWSServiceConfiguration(region:.APSoutheast1, credentialsProvider:credentialsProvider) AWSServiceManager.default().defaultServiceConfiguration = configuration 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: "IntruderAlert") 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, 320014, 313360, 288275, 322580, 289300, 290326, 139803, 322080, 306721, 296483, 322083, 229411, 306726, 309287, 292907, 217132, 322092, 40495, 316465, 288306, 322102, 324663, 308281, 322109, 286783, 315457, 313413, 320582, 288329, 215117, 196177, 344661, 231000, 212571, 300124, 309342, 325220, 310378, 296043, 311914, 334446, 307310, 292466, 314995, 314487, 291450, 314491, 318599, 312970, 239252, 311444, 294038, 311449, 323739, 300194, 298662, 233644, 286896, 295600, 300208, 286389, 294070, 125111, 234677, 309439, 235200, 284352, 296641, 242371, 302787, 284360, 284374, 189654, 320730, 241371, 311516, 179420, 357083, 317665, 298210, 311525, 288489, 290025, 229098, 307436, 304365, 323310, 125167, 286455, 306424, 322299, 319228, 302332, 319231, 184576, 309505, 241410, 311043, 366339, 309509, 125194, 234763, 321806, 125201, 296218, 313116, 237858, 295716, 313125, 300836, 289577, 125226, 133421, 317233, 241971, 316726, 318264, 201530, 287038, 292159, 288578, 234828, 292172, 321364, 230748, 258397, 294238, 199020, 266606, 319342, 292212, 313205, 244598, 316788, 124796, 196988, 305022, 317821, 243072, 314241, 325509, 293767, 306576, 322448, 308114, 319900, 298910, 316327, 306605, 316334, 324015, 324017, 300979, 316339, 322998, 296888, 316345, 300987, 319932, 310718, 292288, 317888, 312772, 298950, 306632, 289744, 310740, 235994, 240098, 323555, 236008, 319465, 248299, 326640, 188913, 203761, 320498, 314357, 288246, 309243, 300540, 310782 ]
2b6948b2cdac0001bf10664f8a90c2e12b07ad91
e3bb1e3c2eb077cc2ff807164d7e02e721b6d3e7
/StopWatch/StopWatch/AppDelegate.swift
aa72558a9cf49087725baf6e91057ee3c7ce20dc
[]
no_license
Seika139/geek-salmon
fe00655eaaf3e0ac9e56f72e577ec2a5edbb8ef3
e32609bc538b9bc5fb17c2fea5e0646ede1bdde0
refs/heads/master
2020-03-13T19:27:38.220495
2018-08-06T06:13:09
2018-08-06T06:13:09
131,253,813
0
0
null
null
null
null
UTF-8
Swift
false
false
2,174
swift
// // AppDelegate.swift // StopWatch // // Created by 鈴木健一 on 2018/05/11. // Copyright © 2018年 seika. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(_ application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. } func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } }
[ 229380, 229383, 229385, 294924, 229388, 229391, 327695, 229394, 229397, 229399, 229402, 278556, 229405, 229408, 278564, 294950, 229415, 229417, 327722, 237613, 229422, 360496, 229426, 237618, 229428, 311349, 286774, 286776, 319544, 286778, 204856, 229432, 352318, 286791, 237640, 286797, 278605, 311375, 163920, 237646, 196692, 319573, 311383, 319590, 311400, 278635, 303212, 278639, 131192, 278648, 237693, 303230, 327814, 303241, 131209, 417930, 303244, 311436, 319633, 286873, 286876, 311460, 311469, 32944, 327862, 286906, 327866, 180413, 286910, 131264, 286916, 295110, 286922, 286924, 286926, 319694, 286928, 131281, 278743, 278747, 295133, 155872, 319716, 237807, 303345, 286962, 303347, 131314, 229622, 327930, 278781, 278783, 278785, 237826, 319751, 278792, 286987, 319757, 311569, 286999, 319770, 287003, 287006, 287009, 287012, 287014, 287016, 287019, 311598, 287023, 262448, 311601, 295220, 287032, 155966, 319809, 319810, 278849, 319814, 311623, 319818, 311628, 229709, 319822, 287054, 278865, 229717, 196963, 196969, 139638, 213367, 106872, 319872, 311683, 319879, 311693, 65943, 319898, 311719, 278952, 139689, 278957, 311728, 278967, 180668, 311741, 278975, 319938, 278980, 98756, 278983, 319945, 278986, 319947, 278990, 278994, 311767, 279003, 279006, 188895, 172512, 287202, 279010, 279015, 172520, 319978, 279020, 172526, 311791, 279023, 172529, 279027, 319989, 172534, 180727, 164343, 279035, 311804, 287230, 279040, 303617, 287234, 279045, 172550, 303623, 172552, 320007, 287238, 279051, 172558, 279055, 303632, 279058, 303637, 279063, 279067, 172572, 279072, 172577, 295459, 172581, 295461, 279082, 311850, 279084, 172591, 172598, 279095, 172607, 172609, 172612, 377413, 172614, 213575, 172618, 303690, 33357, 287309, 303696, 279124, 172634, 262752, 254563, 172644, 311911, 189034, 295533, 172655, 172656, 352880, 295538, 189039, 172660, 287349, 189040, 189044, 287355, 287360, 295553, 172675, 295557, 311942, 303751, 287365, 352905, 311946, 279178, 287371, 311951, 287377, 172691, 287381, 311957, 221850, 287386, 230045, 172702, 287390, 303773, 172705, 287394, 172707, 303780, 164509, 287398, 205479, 279208, 287400, 172714, 295595, 279212, 189102, 172721, 287409, 66227, 303797, 189114, 287419, 303804, 328381, 287423, 328384, 172737, 279231, 287427, 312005, 312006, 107208, 172748, 287436, 107212, 172751, 287440, 295633, 172755, 303827, 279255, 172760, 287450, 303835, 279258, 189149, 303838, 213724, 312035, 279267, 295654, 279272, 230128, 312048, 312050, 230131, 189169, 205564, 303871, 230146, 328453, 295685, 230154, 33548, 312077, 295695, 295701, 230169, 369433, 295707, 328476, 295710, 230175, 295720, 303914, 279340, 205613, 279353, 230202, 312124, 328508, 222018, 295755, 377676, 148302, 287569, 303959, 230237, 279390, 230241, 279394, 303976, 336744, 303981, 303985, 303987, 328563, 279413, 303991, 303997, 295806, 295808, 295813, 304005, 320391, 304007, 213895, 304009, 304011, 230284, 304013, 295822, 279438, 189325, 189329, 295825, 304019, 189331, 58262, 304023, 304027, 279452, 234648, 410526, 279461, 279462, 304042, 213931, 230327, 304055, 287675, 197564, 230334, 304063, 238528, 304065, 213954, 189378, 156612, 295873, 213963, 197580, 312272, 304084, 304090, 320481, 304106, 320490, 312302, 328687, 320496, 304114, 295928, 320505, 312321, 295945, 230413, 295949, 197645, 320528, 140312, 295961, 238620, 197663, 304164, 304170, 304175, 238641, 312374, 238652, 238655, 230465, 238658, 336964, 132165, 296004, 205895, 320584, 238666, 296021, 402518, 336987, 230497, 296036, 296040, 361576, 205931, 296044, 279661, 205934, 164973, 312432, 279669, 337018, 189562, 279679, 304258, 279683, 222340, 66690, 205968, 296084, 238745, 304285, 238756, 205991, 222377, 165035, 337067, 238766, 165038, 230576, 238770, 304311, 230592, 312518, 279750, 230600, 230607, 148690, 320727, 279769, 304348, 279777, 304354, 296163, 320740, 279781, 304360, 320748, 279788, 279790, 304370, 296189, 320771, 312585, 296202, 296205, 230674, 320786, 230677, 296213, 296215, 320792, 230681, 230679, 214294, 304416, 230689, 173350, 312622, 296243, 312630, 222522, 296253, 222525, 296255, 312639, 230718, 296259, 378181, 296262, 230727, 238919, 296264, 320840, 296267, 296271, 222545, 230739, 312663, 222556, 337244, 230752, 312676, 230760, 173418, 148843, 410987, 230763, 230768, 296305, 312692, 230773, 304505, 304506, 181626, 181631, 148865, 312711, 312712, 296331, 288140, 288144, 230800, 304533, 337306, 288154, 288160, 173472, 288162, 288164, 279975, 304555, 370092, 279983, 173488, 288176, 279985, 312755, 296373, 312759, 337335, 288185, 279991, 222652, 312766, 173507, 296389, 222665, 230860, 312783, 288208, 230865, 288210, 370130, 288212, 222676, 280021, 288214, 239064, 329177, 288217, 280027, 288220, 288218, 239070, 288224, 280034, 288226, 280036, 288229, 280038, 288230, 288232, 370146, 320998, 288234, 288236, 288238, 288240, 288242, 296435, 288244, 288250, 296446, 321022, 402942, 148990, 296450, 206336, 230916, 230919, 214535, 230923, 304651, 304653, 370187, 402969, 230940, 222752, 108066, 296486, 296488, 157229, 239152, 230961, 157236, 288320, 288325, 124489, 280140, 280145, 288338, 280149, 288344, 280152, 239194, 280158, 403039, 370272, 181854, 239202, 370279, 312938, 280183, 280185, 280188, 280191, 116354, 280194, 280208, 280211, 288408, 280218, 280222, 419489, 190118, 198310, 321195, 296622, 321200, 337585, 296626, 296634, 296637, 419522, 313027, 280260, 419525, 206536, 280264, 206539, 206541, 206543, 263888, 313044, 280276, 321239, 280283, 313052, 18140, 288478, 313055, 419555, 321252, 313066, 288494, 280302, 280304, 313073, 321266, 419570, 288499, 288502, 280314, 288510, 124671, 67330, 280324, 198405, 288519, 280331, 198416, 280337, 296723, 116503, 321304, 329498, 296731, 321311, 313121, 313123, 304932, 321316, 280363, 141101, 165678, 280375, 321336, 296767, 288576, 345921, 280388, 337732, 304968, 280393, 280402, 173907, 313171, 313176, 280419, 321381, 296809, 296812, 313201, 1920, 255873, 305028, 280454, 247688, 280464, 124817, 280468, 239510, 280473, 124827, 214940, 247709, 214944, 280487, 313258, 321458, 296883, 124853, 214966, 296890, 10170, 288700, 296894, 190403, 296900, 280515, 337862, 165831, 280521, 231379, 296921, 354265, 354270, 239586, 313320, 354281, 231404, 124913, 165876, 321528, 239612, 313340, 288764, 239617, 313347, 288773, 313358, 305176, 321560, 313371, 354338, 305191, 223273, 313386, 354348, 124978, 215090, 124980, 288824, 288826, 321595, 378941, 313406, 288831, 288836, 67654, 280651, 354382, 288848, 280658, 215123, 354390, 288855, 288859, 280669, 313438, 149599, 280671, 149601, 321634, 149603, 223327, 329830, 280681, 313451, 223341, 280687, 149618, 215154, 313458, 280691, 313464, 329850, 321659, 280702, 288895, 321670, 215175, 141446, 288909, 141455, 141459, 280725, 313498, 100520, 288936, 280747, 288940, 288947, 280755, 321717, 280759, 280764, 280769, 280771, 280774, 280776, 313548, 321740, 280783, 280786, 280788, 313557, 280793, 280796, 280798, 338147, 280804, 280807, 157930, 280811, 280817, 125171, 157940, 280819, 182517, 280823, 280825, 280827, 280830, 280831, 280833, 125187, 280835, 125191, 125207, 125209, 321817, 125218, 321842, 223539, 125239, 280888, 280891, 289087, 280897, 280900, 305480, 239944, 280906, 239947, 305485, 305489, 379218, 280919, 248153, 215387, 354653, 313700, 313705, 280937, 190832, 280946, 223606, 313720, 280956, 239997, 280959, 313731, 199051, 240011, 289166, 240017, 297363, 190868, 240021, 297365, 297368, 297372, 141725, 297377, 289186, 297391, 289201, 240052, 289207, 289210, 305594, 281024, 289218, 289221, 289227, 436684, 281045, 281047, 215526, 166378, 305647, 281075, 174580, 240124, 281084, 305662, 305664, 240129, 305666, 305668, 223749, 330244, 281095, 223752, 150025, 338440, 240132, 223757, 281102, 223763, 223765, 281113, 322074, 281116, 281121, 182819, 281127, 150066, 158262, 158266, 289342, 281154, 322115, 158283, 281163, 281179, 338528, 338532, 281190, 199273, 281196, 19053, 158317, 313973, 297594, 281210, 158347, 264845, 182926, 133776, 182929, 314003, 117398, 314007, 289436, 174754, 330404, 289448, 133801, 174764, 314029, 314033, 240309, 133817, 314045, 314047, 314051, 199364, 297671, 158409, 256716, 289493, 363234, 289513, 289522, 289525, 289532, 322303, 289537, 322310, 264969, 322314, 322318, 281361, 281372, 322341, 215850, 281388, 289593, 281401, 289601, 281410, 281413, 281414, 240458, 281420, 240468, 281430, 322393, 297818, 281435, 281438, 281442, 174955, 224110, 207733, 207737, 158596, 183172, 338823, 322440, 314249, 240519, 183184, 142226, 289687, 240535, 224151, 297883, 289694, 289696, 289700, 289712, 281529, 289724, 52163, 183260, 420829, 281567, 289762, 322534, 297961, 183277, 281581, 322550, 134142, 322563, 314372, 330764, 175134, 322599, 322610, 314421, 281654, 314427, 314433, 207937, 314441, 207949, 322642, 314456, 281691, 314461, 281702, 281704, 314474, 281708, 281711, 289912, 248995, 306341, 306344, 306347, 322734, 306354, 142531, 199877, 289991, 306377, 289997, 249045, 363742, 363745, 298216, 330988, 126190, 216303, 322801, 388350, 257302, 363802, 199976, 199978, 314671, 298292, 298294, 257334, 216376, 380226, 298306, 224584, 224587, 224594, 216404, 306517, 150870, 314714, 224603, 159068, 314718, 265568, 314723, 281960, 150890, 306539, 314732, 314736, 290161, 216436, 306549, 298358, 314743, 306552, 290171, 314747, 306555, 298365, 290174, 224641, 281987, 298372, 314756, 281990, 224647, 265604, 298377, 314763, 142733, 298381, 314768, 224657, 306581, 314773, 314779, 314785, 314793, 282025, 282027, 241068, 241070, 241072, 282034, 241077, 150966, 298424, 306618, 282044, 323015, 306635, 306640, 290263, 290270, 290275, 339431, 282089, 191985, 282098, 290291, 282101, 241142, 191992, 290298, 151036, 290302, 282111, 290305, 175621, 306694, 192008, 323084, 257550, 290321, 282130, 323090, 290325, 282133, 241175, 290328, 282137, 290332, 241181, 282142, 282144, 290344, 306731, 290349, 290351, 290356, 28219, 282186, 224849, 282195, 282199, 282201, 306778, 159324, 159330, 314979, 298598, 323176, 224875, 241260, 323181, 257658, 315016, 282249, 290445, 282255, 282261, 175770, 298651, 282269, 323229, 298655, 323231, 61092, 282277, 306856, 196133, 282295, 323260, 282300, 323266, 282310, 323273, 282319, 306897, 241362, 306904, 282328, 298714, 52959, 216801, 282337, 241380, 216806, 323304, 282345, 12011, 282356, 323318, 282364, 282367, 306945, 241412, 323333, 282376, 216842, 323345, 282388, 323349, 282392, 184090, 315167, 315169, 282402, 315174, 323367, 241448, 315176, 241450, 282410, 306988, 306991, 315184, 323376, 315190, 241464, 159545, 282425, 298811, 118593, 307009, 413506, 307012, 241475, 298822, 148946, 315211, 282446, 307027, 315221, 323414, 315223, 241496, 241498, 307035, 307040, 110433, 282465, 241509, 110438, 298860, 110445, 282478, 315249, 110450, 315251, 282481, 315253, 315255, 339838, 315267, 282499, 315269, 241544, 282505, 241546, 241548, 298896, 298898, 282514, 241556, 298901, 44948, 241560, 282520, 241563, 241565, 241567, 241569, 282531, 241574, 282537, 298922, 36779, 241581, 282542, 241583, 323504, 241586, 282547, 241588, 290739, 241590, 241592, 241598, 290751, 241600, 241605, 151495, 241610, 298975, 241632, 298984, 241640, 241643, 298988, 241646, 241649, 241652, 323574, 290807, 299003, 241661, 299006, 282623, 315396, 241669, 315397, 282632, 282639, 290835, 282645, 241693, 282654, 241701, 102438, 217127, 282669, 323630, 282681, 290877, 282687, 159811, 315463, 315466, 192589, 307278, 192596, 176213, 307287, 307290, 217179, 315482, 192605, 315483, 233567, 299105, 200801, 217188, 299109, 307303, 315495, 356457, 45163, 307307, 315502, 192624, 307314, 323700, 299126, 233591, 299136, 307329, 315524, 307338, 233613, 241813, 307352, 299164, 241821, 299167, 315552, 184479, 184481, 315557, 184486, 307370, 307372, 184492, 307374, 307376, 299185, 323763, 184503, 176311, 299191, 307386, 258235, 307388, 307385, 307390, 176316, 299200, 184512, 307394, 299204, 307396, 184518, 307399, 323784, 233679, 307409, 307411, 176343, 299225, 233701, 307432, 184572, 282881, 184579, 282893, 323854, 291089, 282906, 291104, 233766, 295583, 176435, 307508, 315701, 332086, 307510, 307512, 168245, 307515, 307518, 282942, 282947, 323917, 110926, 282957, 233808, 323921, 315733, 323926, 233815, 315739, 323932, 299357, 242018, 242024, 299373, 315757, 250231, 242043, 315771, 299388, 299391, 291202, 299398, 242057, 291212, 299405, 291222, 315801, 283033, 242075, 291226, 194654, 61855, 291231, 283042, 291238, 291241, 127403, 127405, 291247, 299440, 127407, 299444, 127413, 283062, 291254, 127417, 291260, 283069, 127421, 127424, 299457, 127429, 127431, 127434, 315856, 176592, 315860, 176597, 127447, 283095, 299481, 176605, 242143, 127457, 291299, 340454, 127463, 242152, 291305, 127466, 176620, 127469, 127474, 291314, 291317, 127480, 135672, 291323, 233979, 127485, 291330, 283142, 127494, 127497, 233994, 135689, 127500, 291341, 233998, 127506, 234003, 234006, 127511, 152087, 283161, 242202, 234010, 135707, 135710, 242206, 242208, 291361, 242220, 291378, 152118, 234038, 234041, 315961, 70213, 242250, 111193, 242275, 299620, 242279, 168562, 184952, 135805, 135808, 291456, 373383, 299655, 135820, 316051, 225941, 316054, 299672, 135834, 373404, 299677, 225948, 135839, 299680, 225954, 299684, 135844, 242343, 209576, 242345, 373421, 135870, 135873, 135876, 135879, 299720, 299723, 299726, 225998, 226002, 119509, 226005, 226008, 299740, 242396, 201444, 299750, 283368, 234219, 283372, 185074, 226037, 283382, 316151, 234231, 234236, 226045, 242431, 234239, 209665, 234242, 299778, 242436, 226053, 234246, 226056, 234248, 291593, 242443, 234252, 242445, 234254, 291601, 234258, 242450, 242452, 234261, 348950, 201496, 234264, 234266, 234269, 283421, 234272, 234274, 152355, 299814, 234278, 283432, 234281, 234284, 234287, 283440, 185138, 242483, 234292, 234296, 234298, 160572, 283452, 234302, 234307, 242499, 234309, 316233, 234313, 316235, 234316, 283468, 234319, 242511, 234321, 234324, 185173, 201557, 234329, 234333, 308063, 234336, 242530, 349027, 234338, 234341, 234344, 234347, 177004, 234350, 324464, 234353, 152435, 177011, 234356, 234358, 234362, 234364, 291711, 234368, 291714, 234370, 291716, 234373, 316294, 201603, 226182, 308105, 234375, 324490, 226185, 234379, 234384, 234388, 234390, 324504, 234393, 209818, 308123, 324508, 234396, 291742, 226200, 234401, 291747, 291748, 234405, 291750, 234407, 324520, 324518, 324522, 234410, 291756, 291754, 226220, 324527, 291760, 234417, 201650, 324531, 234414, 234422, 226230, 324536, 275384, 234428, 291773, 242623, 324544, 234431, 234434, 324546, 324548, 234437, 226245, 234439, 226239, 234443, 291788, 234446, 275406, 193486, 234449, 316370, 193488, 234452, 234455, 234459, 234461, 234464, 234467, 234470, 168935, 5096, 324585, 234475, 234478, 316400, 234481, 316403, 234484, 234485, 234487, 324599, 234490, 234493, 316416, 234496, 308226, 234501, 308231, 234504, 234507, 234510, 234515, 300054, 316439, 234520, 234519, 234523, 234526, 234528, 300066, 234532, 300069, 234535, 234537, 234540, 144430, 234543, 234546, 275508, 300085, 234549, 300088, 234553, 234556, 234558, 316479, 234561, 316483, 160835, 234563, 308291, 234568, 234570, 316491, 234572, 300108, 234574, 300115, 234580, 234581, 242777, 234585, 275545, 234590, 234593, 234595, 234597, 300133, 234601, 300139, 234605, 160879, 234607, 275569, 234610, 316530, 300148, 234614, 398455, 144506, 234618, 234620, 275579, 234623, 226433, 234627, 275588, 234629, 242822, 234634, 234636, 177293, 234640, 275602, 234643, 308373, 226453, 234647, 275606, 275608, 234650, 308379, 324757, 300189, 324766, 119967, 234653, 324768, 283805, 234657, 242852, 300197, 234661, 283813, 234664, 177318, 275626, 234667, 316596, 308414, 234687, 300223, 300226, 308418, 234692, 300229, 308420, 308422, 283844, 226500, 300234, 283850, 300238, 300241, 316625, 300243, 300245, 316630, 300248, 300253, 300256, 300258, 300260, 234726, 300263, 300265, 300267, 161003, 300270, 300272, 120053, 300278, 275703, 316663, 300284, 275710, 300287, 292097, 300289, 161027, 300292, 300294, 275719, 234760, 177419, 300299, 242957, 300301, 283917, 177424, 349451, 275725, 349464, 415009, 283939, 259367, 292143, 283951, 300344, 226617, 243003, 283963, 226628, 300357, 283973, 177482, 283983, 316758, 357722, 316766, 316768, 292192, 218464, 292197, 316774, 243046, 218473, 284010, 136562, 324978, 275834, 333178, 275836, 275840, 316803, 316806, 226696, 316811, 226699, 316814, 226703, 300433, 234899, 300436, 226709, 357783, 316824, 316826, 144796, 300448, 144807, 144810, 144812, 284076, 144814, 227426, 144820, 374196, 284084, 292279, 284087, 144826, 144828, 144830, 144832, 144835, 144837, 38342, 144839, 144841, 144844, 144847, 144852, 144855, 103899, 300507, 333280, 218597, 292329, 300523, 259565, 300527, 308720, 259567, 292338, 226802, 316917, 292343, 308727, 300537, 316933, 316947, 308757, 308762, 284191, 316959, 284194, 284196, 235045, 284199, 284204, 284206, 284209, 284211, 194101, 284213, 316983, 194103, 284215, 308790, 284218, 226877, 292414, 284223, 284226, 284228, 292421, 226886, 284231, 128584, 243268, 284234, 366155, 317004, 276043, 284238, 226895, 284241, 194130, 284243, 300628, 284245, 292433, 284247, 317015, 235097, 243290, 276053, 284249, 284251, 300638, 284253, 284255, 243293, 284258, 292452, 292454, 284263, 177766, 284265, 292458, 284267, 292461, 284272, 284274, 284278, 292470, 276086, 292473, 284283, 276093, 284286, 292479, 284288, 292481, 284290, 325250, 284292, 292485, 276095, 276098, 284297, 317066, 284299, 317068, 284301, 276109, 284303, 284306, 276114, 284308, 284312, 284314, 284316, 276127, 284320, 284322, 284327, 284329, 317098, 284331, 276137, 284333, 284335, 276144, 284337, 284339, 300726, 284343, 284346, 284350, 358080, 276160, 284354, 358083, 284358, 276166, 358089, 284362, 276170, 284365, 276175, 284368, 276177, 284370, 358098, 284372, 317138, 284377, 276187, 284379, 284381, 284384, 358114, 284386, 358116, 276197, 317158, 358119, 284392, 325353, 358122, 284394, 284397, 358126, 276206, 358128, 284399, 358133, 358135, 276216, 358138, 300795, 358140, 284413, 358142, 358146, 317187, 284418, 317189, 317191, 284428, 300816, 300819, 317207, 284440, 300828, 300830, 276255, 300832, 325408, 300834, 317221, 227109, 358183, 186151, 276268, 300845, 243504, 300850, 284469, 276280, 325436, 358206, 276291, 366406, 276295, 300872, 292681, 153417, 358224, 284499, 276308, 178006, 317271, 284502, 276315, 292700, 317279, 284511, 227175, 292715, 300912, 292721, 284529, 300915, 284533, 292729, 317306, 284540, 292734, 325512, 169868, 276365, 317332, 358292, 284564, 399252, 284566, 350106, 284572, 276386, 284579, 276388, 358312, 317353, 284585, 276395, 292776, 292784, 276402, 358326, 161718, 358330, 276410, 276411, 276418, 276425, 301009, 301011, 301013, 292823, 358360, 301017, 301015, 292828, 276446, 153568, 276448, 276452, 292839, 276455, 350186, 292843, 276460, 292845, 276464, 178161, 227314, 276466, 325624, 350200, 276472, 317435, 276476, 276479, 276482, 350210, 276485, 317446, 178181, 276490, 350218, 292876, 350222, 317456, 276496, 317458, 178195, 243733, 243740, 317468, 317472, 325666, 243751, 292904, 276528, 178224, 243762, 309298, 325685, 325689, 235579, 325692, 235581, 178238, 276539, 276544, 243779, 325700, 284739, 292934, 243785, 350293, 350295, 309337, 194649, 227418, 350299, 350302, 227423, 350304, 178273, 309346, 194657, 194660, 350308, 309350, 309348, 292968, 309352, 309354, 301163, 350313, 350316, 227430, 301167, 276583, 350321, 276590, 284786, 276595, 350325, 252022, 227440, 350328, 292985, 301178, 350332, 292989, 301185, 292993, 350339, 317570, 317573, 350342, 350345, 350349, 301199, 317584, 325777, 350354, 350357, 350359, 350362, 350366, 276638, 284837, 153765, 350375, 350379, 350381, 350383, 129200, 350385, 350387, 350389, 350395, 350397, 350399, 227520, 350402, 227522, 301252, 350406, 227529, 301258, 309450, 276685, 309455, 276689, 309462, 301272, 276699, 194780, 309468, 309471, 301283, 317672, 317674, 325867, 243948, 194801, 309491, 227571, 309494, 243960, 276735, 227583, 227587, 276739, 211204, 276742, 227593, 227596, 325910, 309530, 342298, 211232, 317729, 276775, 211241, 325937, 325943, 211260, 260421, 276809, 285002, 276811, 235853, 276816, 235858, 276829, 276833, 391523, 276836, 293227, 276843, 293232, 276848, 186744, 211324, 227709, 285061, 366983, 317833, 178572, 285070, 285077, 178583, 227738, 317853, 276896, 317858, 342434, 285093, 317864, 285098, 276907, 235955, 276917, 293304, 293307, 293314, 309707, 293325, 129486, 317910, 293336, 235996, 317917, 293343, 358880, 276961, 227810, 293346, 276964, 293352, 236013, 293364, 301562, 293370, 317951, 309764, 301575, 121352, 293387, 236043, 342541, 317963, 113167, 55822, 309779, 317971, 309781, 277011, 55837, 227877, 227879, 293417, 227882, 309804, 293421, 105007, 236082, 285236, 23094, 277054, 244288, 219714, 129603, 301636, 318020, 301639, 301643, 277071, 285265, 399955, 309844, 277080, 309849, 285277, 285282, 326244, 318055, 277100, 309871, 121458, 277106, 170618, 170619, 309885, 309888, 277122, 227975, 277128, 285320, 301706, 318092, 326285, 334476, 318094, 277136, 277139, 227992, 334488, 318108, 285340, 318110, 227998, 137889, 383658, 285357, 318128, 277170, 293555, 318132, 342707, 154292, 277173, 277177, 277181, 318144, 277187, 277191, 277194, 277196, 277201, 342745, 137946, 342747, 342749, 113378, 203491, 228069, 277223, 342760, 285417, 56041, 56043, 56045, 277232, 228081, 56059, 310015, 285441, 310020, 285448, 310029, 228113, 285459, 277273, 293659, 326430, 228128, 285474, 293666, 228135, 318248, 277291, 318253, 293677, 285489, 301876, 293685, 285494, 301880, 285499, 301884, 310080, 293696, 277317, 277322, 293706, 277329, 162643, 310100, 301911, 277337, 301913, 301921, 400236, 236397, 162671, 326514, 310134, 236408, 15224, 277368, 416639, 416640, 113538, 310147, 416648, 39817, 187274, 277385, 301972, 424853, 277405, 277411, 310179, 293798, 293802, 236460, 277426, 276579, 293811, 293817, 293820, 203715, 326603, 342994, 276586, 293849, 293861, 228327, 228328, 318442, 228330, 228332, 326638, 277486, 351217, 318450, 293876, 293877, 285686, 302073, 121850, 293882, 302075, 285690, 244731, 293887, 277504, 277507, 277511, 293899, 277519, 293908, 302105, 293917, 293939, 318516, 277561, 277564, 310336, 7232, 293956, 277573, 228422, 293960, 310344, 277577, 277583, 203857, 293971, 310355, 310359, 236632, 277594, 138332, 277598, 203872, 277601, 285792, 310374, 203879, 310376, 228460, 318573, 203886, 187509, 285815, 367737, 285817, 302205, 285821, 392326, 285831, 253064, 294026, 302218, 285835, 162964, 384148, 187542, 302231, 285849, 302233, 285852, 302237, 285854, 285856, 302241, 285862, 277671, 302248, 64682, 277678, 294063, 294065, 302258, 277687, 294072, 318651, 294076, 277695, 318657, 244930, 302275, 130244, 302277, 228550, 302282, 310476, 302285, 302288, 310481, 302290, 203987, 302292, 302294, 310486, 302296, 384222, 310498, 285927, 318698, 302315, 195822, 228592, 294132, 138485, 228601, 204026, 228606, 204031, 64768, 310531, 285958, 138505, 228617, 318742, 204067, 277798, 130345, 277801, 113964, 285997, 384302, 285999, 277804, 113969, 277807, 277811, 318773, 318776, 277816, 286010, 277819, 294204, 417086, 277822, 286016, 302403, 294211, 384328, 277832, 277836, 294221, 146765, 294223, 326991, 277839, 277842, 277847, 277850, 179547, 277853, 146784, 277857, 302436, 277860, 294246, 327015, 310632, 327017, 351594, 277864, 277869, 277872, 351607, 310648, 277880, 310651, 277884, 277888, 310657, 351619, 294276, 310659, 327046, 277892, 253320, 310665, 318858, 277894, 277898, 277903, 310672, 351633, 277905, 277908, 277917, 310689, 277921, 130468, 228776, 277928, 277932, 310703, 277937, 310710, 130486, 310712, 277944, 310715, 277947, 302526, 228799, 277950, 277953, 302534, 310727, 245191, 64966, 163272, 277959, 277963, 302541, 277966, 302543, 310737, 277971, 228825, 163290, 277978, 310749, 277981, 277984, 310755, 277989, 277991, 187880, 277995, 310764, 286188, 278000, 228851, 310772, 278003, 278006, 40440, 212472, 278009, 40443, 286203, 310780, 40448, 228864, 286214, 228871, 302603, 65038, 302614, 302617, 286233, 302621, 286240, 146977, 187936, 187939, 40484, 294435, 40486, 286246, 294440, 40488, 294439, 294443, 40491, 294445, 278057, 310831, 245288, 286248, 40499, 40502, 212538, 40507, 40511, 40513, 228933, 327240, 40521, 286283, 40525, 40527, 212560, 400976, 228944, 40533, 147032, 40537, 40539, 40541, 278109, 40544, 40548, 40550, 40552, 286312, 40554, 286313, 310892, 40557, 40560, 188022, 122488, 294521, 343679, 294537, 310925, 286354, 278163, 302740, 122517, 278168, 179870, 327333, 229030, 212648, 278188, 302764, 278192, 319153, 278196, 302781, 319171, 302789, 294599, 278216, 294601, 302793, 343757, 212690, 319187, 286420, 278227, 229076, 286425, 319194, 278235, 278238, 229086, 286432, 294625, 294634, 302838, 319226, 286460, 278274, 302852, 278277, 302854, 294664, 311048, 352008, 319243, 311053, 302862, 319251, 294682, 278306, 188199, 294701, 319280, 278320, 319290, 229192, 302925, 188247, 188252, 237409, 229233, 294776, 360317, 294785, 327554, 360322, 40840, 40851, 294803, 188312, 294811, 237470, 319390, 40865, 319394, 294817, 294821, 311209, 180142, 343983, 294831, 188340, 40886, 319419, 294844, 294847, 237508, 393177, 294876, 294879, 294883, 393190, 294890, 311279, 278513, 237555, 311283, 278516, 237562 ]
2977b0fb99bdc1d8e91b4c472624b23646c7ac1c
43fc5600e252c474ca836ec2a91bb536c30e53ec
/SoundWave/Classes/Chronometer.swift
107a1b878e86942088d45de74f438912282f8a2a
[ "MIT" ]
permissive
anhnhn/SoundWave
85d492184bd5b0244a9476cb263f35989d226318
e69f4a52e7bd686f3a65e0eec53858e2fbd5783e
refs/heads/master
2023-03-28T22:52:50.489933
2021-03-31T09:27:06
2021-03-31T09:27:06
352,403,425
0
0
MIT
2021-03-31T09:27:07
2021-03-28T18:12:19
Swift
UTF-8
Swift
false
false
1,236
swift
// // Chronometer.swift // Pods // // Created by Bastien Falcou on 12/6/16. // import Foundation public final class Chronometer: NSObject { private var timer: Timer? private var timeInterval: TimeInterval = 1.0 public var isPlaying = false public var timerCurrentValue: TimeInterval = 0.0 public var timerDidUpdate: ((TimeInterval) -> ())? public var timerDidComplete: (() -> ())? public init(withTimeInterval timeInterval: TimeInterval = 0.0) { super.init() self.timeInterval = timeInterval } public func start(shouldFire fire: Bool = true) { self.timer = Timer(timeInterval: self.timeInterval, target: self, selector: #selector(Chronometer.timerDidTrigger), userInfo: nil, repeats: true) RunLoop.main.add(self.timer!, forMode: .common) self.timer?.fire() self.isPlaying = true } public func pause() { self.timer?.invalidate() self.timer = nil self.isPlaying = false } public func stop() { self.isPlaying = false self.timer?.invalidate() self.timer = nil self.timerCurrentValue = 0.0 self.timerDidComplete?() } // MARK: - Private @objc fileprivate func timerDidTrigger() { self.timerDidUpdate?(self.timerCurrentValue) self.timerCurrentValue += self.timeInterval } }
[ -1 ]
3f7ff1c43ee98492afb86f1a7514acdf2e3a88be
9f2478e1e75970a2aa37da4b06161c3a51ac7f73
/Sources/Views/Level/LevelView.swift
873fe9dbb06cd9c0e2ba00402f1caa6c4dddf12e
[]
no_license
theochemel/QuantaPlayground
0dd8f216f8b2b9475ba79a6ff62f9a71dee2e94c
b451d959b7b25249fe88d42d6578c9ef8d6c6a80
refs/heads/master
2023-01-03T10:56:57.452595
2020-10-18T17:46:37
2020-10-18T17:46:37
264,567,994
0
0
null
null
null
null
UTF-8
Swift
false
false
1,001
swift
import SwiftUI public struct LevelView: View { @Binding public var level: Level @Binding public var displayLevelSelector: Bool public var body: some View { VStack { LevelHeaderView(levelNumber: self.level.levelNumber, title: self.level.title, subtitle: self.level.subtitle, displayLevelSelector: self.$displayLevelSelector) QuantumGateStoreView(store: self.$level.circuit.gateCatalog) .padding([.top, .leading, .trailing], 40.0) .zIndex(1.0) Spacer() QuantumCircuitView(circuit: self.level.circuit) .padding([.leading, .trailing], 40.0) Spacer() QuantumCircuitStateProbabilityView(state: self.level.circuit.state, solutionState: self.level.solutionCircuit.state) .padding([.bottom, .leading, .trailing], 40.0) } .background(Color.backgroundColor) .environmentObject(self.level.circuit.gateCatalog) } }
[ -1 ]
06344baf9942935e78675031ba61ea1672913fe6
28a5277b657f0228da6d4060bce5b6d1e21d3bab
/ChuckN/Localization/Localizations.swift
c009a5e6c7d712efe4483a2c376bad218181d9ae
[ "MIT" ]
permissive
konstantints/chuckN
837a6aacaa411f46e9d926cbb2b4e27841a3491b
c8b408b892dac0432f49cbdd02c8df75b5121389
refs/heads/master
2021-10-18T19:26:38.210332
2019-01-17T13:54:37
2019-01-17T13:54:37
166,234,322
0
0
null
null
null
null
UTF-8
Swift
false
false
1,608
swift
// swiftlint:disable all // Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen import Foundation // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length // MARK: - Strings // swiftlint:disable explicit_type_interface function_parameter_count identifier_name line_length // swiftlint:disable nesting type_body_length type_name internal enum Localizations { internal enum General { /// All internal static let all = Localizations.tr("Localizable", "general.all") /// Categories internal static let categories = Localizations.tr("Localizable", "general.categories") /// Facts - %@ internal static func facts(_ p1: String) -> String { return Localizations.tr("Localizable", "general.facts", p1) } /// Favorites internal static let favorites = Localizations.tr("Localizable", "general.favorites") /// New internal static let new = Localizations.tr("Localizable", "general.new") /// Ok internal static let ok = Localizations.tr("Localizable", "general.ok") } } // swiftlint:enable explicit_type_interface function_parameter_count identifier_name line_length // swiftlint:enable nesting type_body_length type_name // MARK: - Implementation Details extension Localizations { private static func tr(_ table: String, _ key: String, _ args: CVarArg...) -> String { let format = NSLocalizedString(key, tableName: table, bundle: Bundle(for: BundleToken.self), comment: "") return String(format: format, locale: Locale.current, arguments: args) } } private final class BundleToken {}
[ 184071, 338895 ]
0b1e483bc16aeb02d3bb3d20b18fb1ab8e36dbb8
91dc18eece1f92722f7c23337bc6e2911c030340
/Yetda_iOS/Source/Views/ResultView/ResultViewController+layout.swift
4d37b5477a1d50db0678341047b6df41dd7fa772
[]
no_license
Nexters/Yetda_iOS
6877dfa02dbe81c8be1110796f4829c473b20ec3
47f3c7b71bd68a6fb9f0cb8f147af8eddd2f2183
refs/heads/develop
2020-12-05T12:29:44.785657
2020-03-05T09:28:06
2020-03-05T09:28:06
232,109,413
15
4
null
2020-03-05T09:28:08
2020-01-06T13:42:58
Swift
UTF-8
Swift
false
false
3,975
swift
// // ResultViewController+layout.swift // Yetda_iOS // // Created by Leon Kong on 2020/02/16. // Copyright © 2020 Yetda. All rights reserved. // import UIKit import SnapKit extension ResultViewController { func setupUI() { setContentView() setButtonUI() setGuideText() setCardView() setImageView() setPresentTextView() setSubTextView() setOtherPresentText() } // 처음으로 돌아가기 버튼 func setButtonUI() { self.contentView.addSubview(backButton) backButton.setNextButton(isEnable: true, title: "처음으로 돌아가기") // setup self view contraints backButton.snp.makeConstraints { (make) in make.centerX.equalTo(self.view) make.left.right.equalTo(self.view).inset(24) make.bottom.equalTo(self.view).inset(50) make.height.equalTo(44) } } // 컨텐츠가 담기는 영역 설정 func setContentView() { self.view.addSubview(contentView) contentView.snp.makeConstraints { (make) in make.leading.trailing.top.bottom.equalToSuperview() } } // 상단 텍스트 func setGuideText() { self.contentView.addSubview(guideText) if let name = answer?.name { guideText.text = "\(name)님을 위한 추천선물" } guideText.numberOfLines = 0 guideText.font = .systemFont(ofSize: 20) guideText.textColor = .brownishGrey guideText.snp.makeConstraints { (make) in make.top.equalToSuperview().inset(150) make.centerX.equalToSuperview() } } // 선물 카드 func setCardView() { contentView.addSubview(cardView) cardView.setCardView() cardView.addSubview(imageView) cardView.snp.makeConstraints { (make) in make.top.equalTo(guideText.snp.bottom).offset(20) make.leading.equalToSuperview().offset(38) make.trailing.equalToSuperview().inset(38) make.width.equalTo(338) make.height.equalTo(460) } } // 선물 텍스트 func setPresentTextView() { self.contentView.addSubview(presentText) presentText.text = present?.present ?? "마카롱과 디저트" presentText.font = .systemFont(ofSize: 30) presentText.textColor = .black presentText.snp.makeConstraints { (make) in make.centerX.equalToSuperview() make.height.equalTo(36) make.top.equalTo(imageView.snp.bottom).offset(28) } } // 선물과 연관된 서브 텍스트 func setSubTextView() { self.contentView.addSubview(subText) subText.text = "술을 좋아한다면 실패 없을 선물이에요" subText.font = .systemFont(ofSize: 18) subText.textColor = .brownishGrey subText.snp.makeConstraints { (make) in make.centerX.equalToSuperview() make.top.equalTo(presentText.snp.bottom).offset(18) } } // 다른 선물 더 보기 버튼(기능 구현은 안됨) func setOtherPresentText() { self.contentView.addSubview(otherPresentText) otherPresentText.text = "또 다른 선물은?" otherPresentText.font = .systemFont(ofSize: 20) otherPresentText.textColor = UIColor(red: 204/255, green: 204/255, blue: 204/255, alpha: 1) otherPresentText.underline() otherPresentText.snp.makeConstraints { (make) in make.centerX.equalToSuperview() make.top.equalTo(cardView.snp.bottom).offset(44) } } // 선물 이미지 뷰 func setImageView() { imageView.snp.makeConstraints { (make) in make.centerX.equalToSuperview() make.top.equalToSuperview().inset(40) } } }
[ -1 ]
48a6b0929704212e9c4a45225ae328110699b518
c660017e6314bd34db846eb8c406c3184f158ca3
/GetInShape/AppDelegate.swift
cdfadd51ba134a77b06b0559d8cf0833c39c54cf
[]
no_license
burmaniac/GetInShape
d252663c20a79db0a7457bb67fe066190eb311d9
0ad93eae39142b0401edf67535061739ae7662fe
refs/heads/master
2020-03-14T07:21:38.872994
2018-04-29T14:58:05
2018-04-29T14:58:05
131,503,267
0
0
null
null
null
null
UTF-8
Swift
false
false
1,989
swift
// // AppDelegate.swift // GetInShape // // Created by Klaas Burmania on 05-04-18. // Copyright © 2018 Klaas Burmania. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? let dataModel = DataModel() func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { let navigationController = window!.rootViewController as! UINavigationController let controller = navigationController.viewControllers[0] as! AllWorkoutsTableViewController controller.dataModel = dataModel 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) { saveData() } 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) { saveData() } func saveData() { dataModel.saveChecklists() } }
[ 350210, 313347, 315396, 315397, 241669, 350218, 294924, 350222, 317458, 243733, 305176, 313371, 317468, 241693, 325666, 102438, 229415, 243751, 223273, 229417, 292904, 294950, 237613, 229422, 327722, 124978, 215090, 124980, 229428, 243762, 309298, 229432, 288824, 319544, 321595, 325685, 290877, 352318, 325689, 325692, 243779, 288836, 315463, 237640, 243785, 311375, 163920, 196692, 350293, 309337, 315482, 217179, 315483, 350302, 149599, 233567, 149601, 178273, 149603, 299105, 299109, 309346, 309348, 309350, 309352, 311400, 45163, 307307, 315495, 315502, 350313, 192624, 350316, 215154, 350321, 350325, 299126, 350328, 292985, 321659, 350332, 237693, 288895, 292993, 301185, 317570, 350339, 321670, 215175, 350342, 303241, 307338, 350345, 303244, 350349, 317584, 325777, 350357, 350362, 286876, 350366, 311460, 184486, 307370, 350379, 311469, 307374, 350381, 32944, 299185, 307376, 288947, 350383, 350389, 321717, 327862, 184503, 350385, 350387, 327866, 258235, 307388, 180413, 307390, 350395, 350397, 350399, 307394, 350402, 299204, 301252, 184518, 295110, 307396, 307399, 286922, 301258, 286924, 321740, 319694, 323784, 131281, 301272, 299225, 309468, 295133, 301283, 338147, 233701, 307432, 317674, 325867, 237807, 303345, 131314, 125171, 286962, 243960, 327930, 237826, 125187, 125191, 319751, 286987, 319757, 325910, 125207, 286999, 125209, 342298, 287003, 287006, 291104, 287009, 125218, 287014, 287016, 211241, 287019, 311598, 287023, 270640, 311601, 325937, 315701, 270646, 332086, 125239, 325943, 307518, 319809, 319814, 311623, 305480, 319818, 235853, 287054, 305485, 233808, 319822, 323917, 323921, 229717, 315733, 233815, 323926, 215387, 315739, 299357, 354653, 242018, 196963, 391523, 242024, 293227, 315757, 190832, 293232, 139638, 213367, 106872, 186744, 223606, 250231, 315771, 299391, 319872, 291202, 366983, 242057, 317833, 291212, 299405, 289166, 240017, 297363, 297365, 291222, 297368, 242075, 297372, 317853, 61855, 291231, 297377, 289186, 317858, 291238, 139689, 127403, 127405, 127407, 291247, 289201, 297391, 235955, 299444, 127413, 291254, 289207, 293304, 127417, 305594, 293307, 291260, 127421, 311741, 127424, 299457, 289218, 293314, 319938, 319945, 309707, 436684, 293325, 315856, 315860, 127447, 293336, 299481, 235996, 176605, 317917, 188895, 242143, 293343, 287202, 293346, 340454, 127463, 242152, 293352, 166378, 319978, 176620, 127469, 305647, 311791, 291314, 174580, 291317, 293364, 319989, 135672, 291323, 233979, 305662, 287230, 305664, 303617, 291330, 305666, 330244, 240132, 317951, 223749, 320007, 172550, 301575, 303623, 127497, 135689, 150025, 233994, 223757, 172558, 113167, 233998, 234003, 234006, 127511, 152087, 234010, 135707, 172572, 242202, 242206, 242208, 172577, 291361, 295459, 172581, 295461, 293417, 227882, 242220, 293421, 172591, 150066, 152118, 234038, 158266, 289342, 322115, 301636, 301639, 301643, 33357, 309844, 111193, 242275, 299620, 242279, 311911, 19053, 172656, 121458, 295538, 172660, 287349, 297594, 287355, 135805, 309885, 135808, 295553, 311942, 352905, 301706, 158347, 311946, 264845, 182926, 318092, 311951, 182929, 318094, 287377, 326285, 334476, 287381, 117398, 334488, 311957, 316054, 135834, 221850, 289436, 318108, 174754, 172707, 287394, 299684, 287398, 242343, 289448, 242345, 172714, 295595, 330404, 383658, 189102, 318128, 172721, 314033, 66227, 293555, 303797, 189114, 287419, 135870, 287423, 314047, 318144, 164546, 328384, 135876, 299720, 158409, 256716, 299726, 295633, 172755, 303827, 289493, 342744, 287450, 303835, 189149, 303838, 113378, 201444, 295654, 299750, 342760, 289513, 234219, 312048, 312050, 316151, 205564, 289532, 242431, 303871, 289537, 230146, 310015, 322303, 234246, 230154, 322314, 310029, 312077, 295695, 322318, 291601, 234258, 295701, 201496, 234264, 234266, 295707, 328476, 326430, 230175, 152355, 322341, 299814, 318248, 215850, 303914, 318253, 322550, 185138, 293685, 375606, 234296, 301880, 230202, 301884, 222018, 316233, 295755, 316235, 377676, 148302, 234319, 287569, 240468, 201557, 322393, 230237, 308063, 234336, 230241, 242530, 234344, 303976, 336744, 162671, 324464, 303985, 303987, 234356, 310134, 303991, 207737, 303997, 295806, 291711, 295808, 416639, 113538, 291714, 183172, 234373, 291716, 338823, 295813, 304005, 304007, 304009, 308105, 304013, 295822, 320391, 322440, 142226, 304019, 301972, 58262, 240535, 289687, 304023, 209818, 308123, 234396, 324504, 289694, 291742, 324508, 291747, 289700, 234405, 291748, 293798, 310179, 324518, 140202, 291754, 213931, 236460, 291756, 293802, 324522, 291760, 324527, 201650, 324531, 189367, 230327, 304055, 324536, 287675, 289724, 291773, 293820, 304063, 324544, 234434, 324546, 156612, 324548, 312272, 342994, 293849, 420829, 234464, 320481, 289762, 168935, 324585, 320490, 312302, 328687, 320496, 351217, 326638, 412659, 316400, 234481, 304114, 316403, 293876, 234485, 285686, 234487, 295928, 121850, 293882, 302075, 320505, 316416, 322563, 295945, 330764, 230413, 320528, 300054, 316439, 140312, 234520, 295961, 238620, 300066, 304170, 234540, 238641, 234546, 293939, 322610, 300085, 238652, 238655, 316479, 234561, 238658, 308291, 293956, 336964, 293960, 320584, 238666, 316491, 234572, 234574, 293971, 310359, 314456, 314461, 416640, 234593, 300133, 296040, 314474, 300139, 234605, 318573, 312432, 234610, 300148, 367737, 144506, 189562, 234620, 337018, 177293, 234640, 162964, 296084, 308373, 234647, 234648, 324757, 285852, 300189, 285854, 119967, 285856, 302237, 351394, 302241, 324766, 324768, 300197, 306341, 222377, 64682, 234667, 337067, 238766, 294063, 230576, 302258, 316596, 350308, 318651, 234687, 318657, 244930, 300226, 130244, 199877, 300229, 289991, 230600, 308420, 300234, 302282, 308422, 289997, 300238, 230607, 302285, 300241, 302288, 300243, 302290, 300245, 302292, 302294, 300248, 316625, 316630, 320727, 363742, 300256, 300258, 296163, 300260, 304354, 310498, 300263, 300265, 300267, 330988, 300270, 216303, 300272, 322801, 294132, 300278, 275703, 316663, 300284, 296189, 388350, 300287, 175360, 64768, 292097, 161027, 300289, 300292, 310531, 320771, 138505, 312585, 349451, 177419, 242957, 275725, 230674, 320786, 230677, 257302, 296215, 318742, 230681, 320792, 349464, 199976, 199978, 312622, 285999, 292143, 314671, 298294, 312630, 216376, 300344, 318776, 243003, 296253, 296255, 312639, 294211, 296259, 300357, 296262, 230727, 238919, 296264, 320840, 224587, 146765, 294223, 296271, 326991, 316758, 312663, 314714, 357722, 222556, 314718, 292192, 316768, 314723, 312676, 292197, 294246, 230760, 310632, 327017, 148843, 230763, 306539, 314732, 314736, 296305, 136562, 312692, 230773, 298358, 290171, 306555, 310651, 290174, 314747, 310657, 310659, 314756, 351619, 316806, 312711, 298377, 318858, 296331, 314763, 316811, 288144, 300433, 310672, 234899, 314768, 306581, 351633, 356457, 316824, 357783, 288154, 314779, 316826, 300448, 310689, 314785, 288164, 314793, 144810, 144814, 241070, 173488, 241072, 288176, 310703, 144820, 312759, 298424, 310712, 144826, 306618, 222652, 144830, 302526, 144832, 144835, 173507, 144837, 302534, 144839, 310727, 144841, 323015, 144844, 230860, 144847, 288208, 230865, 306640, 312783, 222676, 144855, 290263, 329177, 300507, 310749, 239070, 290270, 333280, 290275, 310476, 218597, 320998, 339431, 292329, 300523, 310764, 300527, 308720, 191985, 292338, 296435, 310772, 316917, 292343, 40440, 191992, 290298, 286203, 300537, 290302, 296446, 290305, 296450, 230916, 312518, 286214, 230919, 230923, 302603, 304651, 304653, 241175, 302617, 308762, 284194, 294435, 40484, 196133, 235045, 284196, 245288, 296488, 286246, 294439, 40491, 294440, 157229, 284206, 294443, 239152, 230961, 294445, 40499, 157236, 284211, 40502, 194103, 284215, 290356, 212538, 284218, 40511, 284226, 243268, 288325, 292421, 124489, 284234, 284238, 40527, 212560, 284241, 194130, 288338, 300628, 40533, 284245, 284247, 317015, 284249, 306778, 300638, 239202, 40552, 323176, 224875, 241260, 284274, 284278, 292470, 294521, 284283, 284286, 311728, 284288, 116354, 284290, 284292, 292485, 325250, 315016, 284297, 317066, 284299, 284301, 290445, 284303, 284306, 284308, 284312, 175770, 284314, 284316, 298651, 323229, 298655, 419489, 284322, 327333, 229030, 284327, 350406, 284329, 317098, 284331, 284333, 296622, 284335, 321200, 284337, 319153, 284339, 337585, 300726, 296634, 323260, 296637, 302781, 358080, 323266, 358083, 302789, 294599, 206536, 294601, 284362, 263888, 317138, 358098, 321239, 306904, 319194, 313052, 288478, 52959, 419555, 323304, 325353, 294634, 288494, 288499, 302838, 358135, 319226, 358140, 288510, 358142, 241412, 302852, 317189, 294664, 311048, 319243, 302862, 300816, 323345, 296723, 300819, 319251, 323349, 321304, 321528, 294682, 321311, 300832, 313121, 325408, 313123, 321316, 317221, 323367, 241448, 358183, 306991, 243504, 323376, 321336, 319290, 288576, 307009, 307012, 337732, 366406, 229192, 292681, 173907, 315223, 241496, 241498, 307035, 292700, 305668, 321381, 296809, 292715, 310147, 298860, 229233, 300915, 315253, 315255, 294776, 292729, 292734, 327554, 315267, 305028, 315269, 241544, 325512, 241546, 124817, 399252, 241556, 358292, 241560, 325624, 124827, 241563, 241565, 319390, 241567, 214944, 241569, 319394, 317353, 241581, 241583, 323504, 241586, 290739, 241588, 124853, 241590, 321458, 241592, 296890, 319419, 294844, 241598, 296894, 241600, 337862, 151495, 241610, 411601, 301011, 301013, 292823, 301015, 301017, 358360, 393177, 294876, 354270, 298975, 393190, 298984, 354281, 350186, 241643, 292843, 292845, 241646, 298988, 124913, 241649, 237555, 165876, 241652, 311283, 323574, 350200, 237562, 317435, 313340, 241661, 299006 ]
14aa70a5d8012b0db0c337f8063cf2708d608b1d
d51605288a49a07e93ce5c70b865aadb2b75221e
/adblock/Classes/Sub3/Sub3DataSource.swift
ceb171e3875e23055d685298d959650587e54235
[]
no_license
YukiMorishita/AdBlock
3802cc30a6c67836444af8058e2d1e524716876c
1dfb47f6f2f7542c64d0b72f9735f9e4a7a0e233
refs/heads/master
2020-03-26T15:31:57.032500
2018-12-09T12:03:58
2018-12-09T12:03:58
145,049,088
4
1
null
null
null
null
UTF-8
Swift
false
false
1,813
swift
// // Sub3DataSource.swift // adblock-test // // Created by admin on 2018/11/26. // Copyright © 2018 admin. All rights reserved. // import Foundation import Firebase import FirebaseDatabase final class Sub3DataSource: NSObject { private var jsonManager: JsonManager! private let groupID = "group.jp.ac.osakac.cs.hisalab.adblock" private let key = "TableList4" /// FireBase DataBaseG private var dbRootRef: DatabaseReference! private var dbThisRef: DatabaseReference? private var dbTableData: [DataSnapshot] = [DataSnapshot]() private let groupid = "-LSswgLbGSb6PkNDkBEn" private let group = "group" private let groups = "groups" private let document = "document" private let documents = "documents" private let dbKey1 = "name" private let dbKey2 = "rates" private let dbKey3 = "domains" private var tableData = [DataSnapshot]() func getTableData() -> [DataSnapshot]? { return self.tableData } func ratingAverage() -> String { let group = self.tableData.map { $0.childSnapshot(forPath: "group").key } print(group) // let rates = self.tableData.map { $0.childSnapshot(forPath: "rates") } // // print(rates) return "3" } func tableDataCount() -> Int { return self.tableData.count } func data(at index: Int) -> DataSnapshot? { if self.tableData.count > index { return self.tableData[index] } return nil } func setTableData(tableD: [DataSnapshot]) { self.tableData = tableD } /// Firebase Cloud Storage private var storageRef: StorageReference! }
[ -1 ]
ae13ef15ac5a4c8e79f41a18f40606fa5385b1cf
59dc822680c0a0b79b1e52c96f29f10c2f08b7da
/templat3d-A/AppDelegate.swift
e0c3c4b643344bec7fbd7911720a0117dfbb93e1
[]
no_license
andyhaz/templat3d-A
8b63f85ebe8a693bafe22aa34faae436dba82d19
7b50e5470b55d19df9933eca5166c26a3cda6bfc
refs/heads/main
2023-08-07T04:46:02.275512
2021-09-19T09:05:00
2021-09-19T09:05:00
407,660,591
0
0
null
null
null
null
UTF-8
Swift
false
false
305
swift
// // AppDelegate.swift // templat3d-A // // Created by andyhaz on 9/17/21. // import Cocoa @main class AppDelegate: NSObject, NSApplicationDelegate { func applicationDidFinishLaunching(_ aNotification: Notification) { // Insert code here to initialize your application } }
[ -1 ]
a746f7f29895259a375efcb80d7832ffd4614485
8982bff631ee78b91e59f48a4590b8ede514a0ea
/Sources/StoreKit2/Environment+StoreKit2.swift
6e211cbfd5033e487978c9ec92301a68e85d52d1
[ "MIT" ]
permissive
adaptyteam/AdaptySDK-iOS
11f2d04576f7cf0472d73956f0aaa398784762f5
60360f13276f663cd5bf2f6d0327243ad3c57efc
refs/heads/master
2023-09-01T15:42:07.842840
2023-08-10T15:18:34
2023-08-10T15:18:34
221,430,068
550
41
MIT
2023-01-13T14:31:46
2019-11-13T10:12:17
Swift
UTF-8
Swift
false
false
389
swift
// // Environment+StoreKit2.swift // AdaptySDK // // Created by Aleksei Valiano on 20.03.2023 // import Foundation extension Environment { enum StoreKit2 { static var available: Bool { if #available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8.0, *) { return true } else { return false } } } }
[ -1 ]
3a35a642ecaf6096b4a15af8bd31d38207c0bb3b
84f00588864afa9756d2e620d9e71486bd1c6659
/TelerikUIExamplesInSwift/TelerikUIExamplesInSwift/ListViewVariableHeight.swift
039d0745626fff3c6077b5ad51680f8de1d1f633
[]
no_license
Heeby/ios-sdk
3d3e2f7e5116f3495efaa7773d1df0da871fbdfb
634b6c6e4d73b818d71aa559b4beb5a390e1839c
refs/heads/master
2021-01-17T22:54:22.876080
2016-09-15T13:28:46
2016-09-15T13:28:46
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,397
swift
// // ListViewVariableHeight.swift // TelerikUIExamplesInSwift // // Copyright © 2015 Telerik. All rights reserved. // import UIKit class ListViewVariableHeight: TKExamplesExampleViewController { var items = [String]() var dataSource = TKDataSource() override func viewDidLoad() { super.viewDidLoad() let loremGenerator = LoremIpsumGenerator() for _ in 0..<20 { items.append(loremGenerator.generateString(2 + Int(arc4random()%30)) as String) } dataSource.itemSource = items dataSource.settings.listView.defaultCellClass = ListViewDynamicSizeCell.self dataSource.settings.listView.initCell { (listView:TKListView, indexPath:NSIndexPath, cell:TKListViewCell, item:AnyObject) -> Void in let myCell = cell as! ListViewDynamicSizeCell myCell.label!.text = item as? String } let listView = TKListView(frame:self.view.bounds) listView.autoresizingMask = [ .FlexibleWidth, .FlexibleHeight ] listView.dataSource = dataSource self.view.addSubview(listView) let layout = listView.layout as! TKListViewLinearLayout layout.dynamicItemSize = true } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }
[ -1 ]
38c8dca7b22cfe0ca96687bf1e148f041732c02c
5d0b48909976ff603cff8720f8a38c634021d34a
/EligibilityViewController.swift
9ec0a088ec73a2f5f94c8bda4daf9c1e9d60c5e9
[]
no_license
JudyWu/caspir-motion
0542daf7cfa9cef636fa56565be58b4d49262318
dfbf4aaaf0c6383d57c999207248bd2560396c3c
refs/heads/master
2021-01-10T15:53:55.342155
2016-04-29T19:13:32
2016-04-29T19:13:32
52,014,687
0
0
null
null
null
null
UTF-8
Swift
false
false
2,230
swift
// // EligibilityViewController.swift // motion // // Created by judywu on 3/1/16. // Copyright © 2016 CASPIR. All rights reserved. // import UIKit import ResearchKit class EligibilityViewController: ORKInstructionStepViewController { // override func goForward() { // let consentDocument = ConsentDocument() // let consentStep = ORKVisualConsentStep(identifier: "VisualConsentStep", document: consentDocument) // let healthDataStep = HealthDataStep(identifier: "Health") // // let signature = consentDocument.signatures!.first! // let reviewConsentStep = ORKConsentReviewStep(identifier: "ConsentReviewStep", signature: signature, inDocument: consentDocument) // reviewConsentStep.text = "Review the consent form." // reviewConsentStep.reasonForConsent = "Consent to join the CASPIR Alcohol/Marijuana Abuse Research Study." // let passcodeStep = ORKPasscodeStep(identifier: "Passcode") // passcodeStep.text = "Now you will create a passcode to identify yourself to the app and protect access to information you've entered." // // let completionStep = ORKCompletionStep(identifier: "CompletionStep") // completionStep.title = "Welcome aboard." // completionStep.text = "Thank you for joining this study." // // let orderedTask = ORKOrderedTask(identifier: "Join", steps: [consentStep, reviewConsentStep, healthDataStep, passcodeStep, completionStep]) // // let taskViewController = ORKTaskViewController(task: orderedTask, taskRunUUID: nil) // taskViewController.delegate = self // presentViewController(taskViewController, animated: true, completion: nil) // } } //extension EligibilityViewController: ORKTaskViewControllerDelegate { // func taskViewController(taskViewController: ORKTaskViewController, didFinishWithReason reason: ORKTaskViewControllerFinishReason, error: NSError?) { // switch reason { // case .Completed: // performSegueWithIdentifier("unwindToStudy", sender: nil) // // case .Discarded, .Failed, .Saved: // dismissViewControllerAnimated(true, completion: nil) // } // } //}
[ -1 ]
672eeb86e98c66a2ea4179ec031a73920d53792d
35cc3c8450a755e76f468131c4a1a89bc2290fc3
/Soundboard/NewSoundViewController.swift
8e401ccbeb567836d574556bdd3c3b0a9c61b987
[]
no_license
jacquin5/Soundboard
614d45d4b5c5ff48122490c6370dafd9e2fe6426
c4881446a50f887c3d4f2e6a14773661dc02525c
refs/heads/master
2016-09-05T20:57:28.926681
2015-02-24T02:05:35
2015-02-24T02:05:35
31,240,605
0
0
null
null
null
null
UTF-8
Swift
false
false
2,882
swift
// // NewSoundViewController.swift // Soundboard // // Created by Jacquin Wynn Jr on 2/23/15. // Copyright (c) 2015 JMW. All rights reserved. // import UIKit import AVFoundation class NewSoundViewController : UIViewController { required init(coder aDecoder: NSCoder) { var baseString : String = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)[0] as String var pathComponents = [baseString, "MyAudio.m4a"] self.audioURL = NSURL.fileURLWithPathComponents(pathComponents) var session = AVAudioSession.sharedInstance() session.setCategory(AVAudioSessionCategoryPlayAndRecord, error: nil) var recordSettings: [NSObject : AnyObject] = Dictionary() recordSettings[AVFormatIDKey] = kAudioFormatMPEG4AAC recordSettings[AVSampleRateKey] = 44100.0 recordSettings[AVNumberOfChannelsKey] = 2 self.audioRecorder = AVAudioRecorder(URL: self.audioURL, settings: recordSettings, error: nil) self.audioRecorder.meteringEnabled = true self.audioRecorder.prepareToRecord() //Super init is below super.init(coder: aDecoder) } @IBOutlet weak var soundTextField: UITextField! @IBOutlet weak var recordButton: UIButton! var audioRecorder : AVAudioRecorder var audioURL : NSURL! var previousViewController = SoundListViewController() override func viewDidLoad() { super.viewDidLoad() //Anything is Possible } @IBAction func saveTapped(sender: AnyObject) { //Create a sound object var sound = Sound() sound.name = self.soundTextField.text //sound.URL = self.audioURL //Adds sound to sounds array self.previousViewController.sounds.append(sound) //Dismiss this view controller self.dismissViewControllerAnimated(true, completion: nil) } @IBAction func cancelButton(sender: AnyObject) { //All this does is dismiss the current view controller with an animation self.dismissViewControllerAnimated(true, completion: nil) } @IBAction func recordTapped(sender: AnyObject) { if self.audioRecorder.recording { self.audioRecorder.stop() self.recordButton.setTitle("RECORD", forState: UIControlState.Normal) } else { var session = AVAudioSession.sharedInstance() session.setActive(true, error: nil) self.audioRecorder.record() //Changing the text of the button when tapped self.recordButton.setTitle("DONE RECORDING", forState: UIControlState.Normal) } } }
[ -1 ]
586fa2b28b959e4b55f040b372b5ec5726597dff
c9376dd42329fa8b096a808afd1f23b1856e8b49
/RamenShopApp/View/ShopSearch/Shop/ShopInfo/ReviewData/LatestReviews.swift
edc64b20fe91db7b6b0a770be42fa71f37f7d273
[]
no_license
korosaka/Ramen_shop_searching
6eb62efcffad6362c891e94e3f7ab28a5a3d17c9
e7d1d712c5e1a8874e50c5601c3ad62568d64bd7
refs/heads/develop
2023-03-14T06:39:52.349721
2021-02-27T19:53:12
2021-02-27T19:53:12
306,425,906
1
0
null
2021-02-27T19:53:13
2020-10-22T18:27:45
Swift
UTF-8
Swift
false
false
1,930
swift
// // LatestReviews.swift // RamenShopApp // // Created by Koro Saka on 2021-02-24. // Copyright © 2021 Koro Saka. All rights reserved. // import SwiftUI struct LatestReviews: View { let latestReviews: [Review] let shop: Shop? var body: some View { Text(Constants.LATEST_REVIEWS) .foregroundColor(.white) .wideStyle() .upDownPadding(size: 3) .background(Color.gray) .shadow(color: .black, radius: 1) if latestReviews.count == 0 { Spacer().frame(height: 10) Text(Constants.NO_REVIEW) .foregroundColor(.viridianGreen) .shadow(color: .black, radius: 0.5, x: 0.5, y: 0.5) } if latestReviews.count > 0 { Spacer().frame(height: 10) ReviewHeadline(viewModel: .init(review: latestReviews[0])) .padding(.init(top: 0, leading: 0, bottom: 0, trailing: 15)) } if latestReviews.count > 1 { Spacer().frame(height: 10) ReviewHeadline(viewModel: .init(review: latestReviews[1])) .padding(.init(top: 10, leading: 0, bottom: 0, trailing: 15)) } if latestReviews.count > 0 { Spacer().frame(height: 20) HStack { Spacer() if let _shop = shop { NavigationLink(destination: AllReviewView(viewModel: .init(shop: _shop))) { Text(Constants.ALL_REVIEW_LINK) .foregroundColor(.seaBlue) .underline() .sidePadding(size: 15) } } } } } }
[ -1 ]
f19e0d615ece0f94dd9bcbe61dd45778a6a5b0cb
14101133e326ca52b4460f9f570d39407bb73bc4
/HW212Test/AppDelegate.swift
12e62bda88dc1894449eda72bbf70de27ae39aea
[]
no_license
VerKse/HW212Test
3d9f623f6ce6548d49ece2fe11f997421a990690
ede54396382fb9c18e990b3d0e63ccb4b186bbb8
refs/heads/main
2023-01-29T18:42:03.377444
2020-12-02T10:08:28
2020-12-02T10:08:28
317,822,109
0
0
null
null
null
null
UTF-8
Swift
false
false
1,372
swift
// // AppDelegate.swift // HW212Test // // Created by Вера Ксенофонтова on 02.12.2020. // import UIKit @main class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } // MARK: UISceneSession Lifecycle func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { // Called when a new scene session is being created. // Use this method to select a configuration to create the new scene with. return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) } func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) { // Called when the user discards a scene session. // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. // Use this method to release any resources that were specific to the discarded scenes, as they will not return. } }
[ 393222, 393224, 393230, 393250, 344102, 393261, 393266, 213048, 385081, 376889, 393275, 376905, 254030, 286800, 368727, 180313, 368735, 180320, 376931, 286831, 368752, 286844, 417924, 262283, 286879, 286888, 377012, 377036, 180431, 377046, 418010, 377060, 327914, 205036, 393456, 393460, 418043, 336123, 385280, 262404, 180490, 164106, 368911, 262416, 262422, 377117, 262436, 336180, 262454, 393538, 262472, 344403, 213332, 65880, 262496, 418144, 262499, 213352, 246123, 262507, 262510, 213372, 385419, 393612, 262550, 262552, 385440, 385443, 385451, 262573, 393647, 385458, 262586, 344511, 262592, 360916, 369118, 328177, 328179, 328182, 328189, 328192, 164361, 410128, 393747, 254490, 188958, 385570, 33316, 377383, 197159, 352821, 197177, 418363, 188987, 369223, 385609, 385616, 352864, 369253, 262760, 352874, 352887, 254587, 336512, 377472, 148105, 377484, 352918, 98968, 344744, 361129, 336555, 385713, 434867, 164534, 336567, 328378, 164538, 328386, 352968, 344776, 352971, 418507, 352973, 385742, 385748, 361179, 139997, 189153, 369381, 361195, 418553, 344831, 336643, 344835, 344841, 361230, 336659, 418580, 418585, 434970, 369435, 418589, 262942, 418593, 336675, 328484, 418598, 418605, 336696, 361273, 328515, 336708, 328519, 361288, 336711, 328522, 426841, 254812, 361309, 197468, 361315, 361322, 328573, 377729, 369542, 361360, 222128, 345035, 386003, 345043, 386011, 386018, 386022, 435187, 328702, 328714, 361489, 386069, 386073, 336921, 336925, 345118, 377887, 345133, 345138, 386101, 361536, 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, 337205, 345399, 378169, 369978, 337222, 337234, 402791, 345448, 271730, 378227, 271745, 181638, 353673, 181643, 181649, 181654, 230809, 181681, 337329, 181684, 361917, 337349, 337365, 271839, 329191, 361960, 329194, 116210, 337398, 329226, 419339, 419343, 419349, 345625, 419355, 370205, 419359, 394786, 419362, 370213, 419368, 419376, 206395, 214593, 419400, 419402, 353867, 419406, 419410, 394853, 345701, 222830, 370297, 403070, 403075, 345736, 198280, 403091, 345749, 419483, 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, 370415, 337659, 362247, 395021, 362255, 116509, 345887, 378663, 345905, 354106, 354111, 247617, 354117, 370503, 329544, 345930, 370509, 354130, 337750, 370519, 313180, 354142, 354150, 354156, 345967, 345970, 345974, 403320, 354172, 247691, 337808, 247700, 329623, 436126, 436132, 337833, 362413, 337844, 346057, 247759, 346063, 329697, 354277, 190439, 247789, 354313, 346139, 436289, 378954, 395339, 338004, 100453, 329832, 329855, 329867, 329885, 346272, 362660, 100524, 387249, 379066, 387260, 256191, 395466, 346316, 411861, 411864, 411868, 411873, 379107, 411876, 387301, 346343, 338152, 387306, 387312, 346355, 436473, 321786, 379134, 411903, 411916, 379152, 395538, 387349, 338199, 387352, 338211, 362822, 436555, 190796, 379233, 354673, 321910, 248186, 420236, 379278, 272786, 354727, 330189, 338381, 338386, 338403, 338409, 199164, 330252, 199186, 420376, 330267, 354855, 10828, 199249, 346721, 174695, 248425, 191084, 338543, 191092, 346742, 354974, 150183, 248504, 223934, 355024, 273108, 355028, 264918, 183005, 256734, 338660, 264941, 363251, 207619, 264964, 256786, 199452, 363293, 396066, 346916, 396069, 215853, 355122, 355131, 355140, 355143, 355150, 330580, 355166, 265055, 265058, 355175, 387944, 355179, 330610, 330642, 355218, 412599, 207808, 379848, 396245, 347105, 257008, 183282, 265207, 330748, 265214, 330760, 330768, 248862, 396328, 158761, 347176, 199728, 396336, 330800, 396339, 339001, 388154, 388161, 347205, 248904, 330826, 248914, 412764, 339036, 257120, 265320, 248951, 420984, 330889, 347287, 248985, 339097, 44197, 380070, 126144, 330958, 330965, 265432, 265436, 388319, 388347, 175375, 159005, 175396, 208166, 273708, 347437, 372015, 347441, 372018, 44342, 175415, 396600, 437566, 175423, 437570, 437575, 437583, 331088, 437587, 331093, 396633, 175450, 437595, 175457, 208227, 175460, 175463, 265580, 175477, 249208, 175483, 175486, 249214, 175489, 249227, 175513, 175516, 396705, 175522, 355748, 380332, 396722, 208311, 388542, 372163, 216517, 380360, 216522, 339404, 372176, 208337, 339412, 413141, 339417, 339420, 339424, 339428, 339434, 249328, 69113, 372228, 208398, 380432, 265778, 265795, 396872, 265805, 224853, 224857, 257633, 224870, 372327, 257646, 372337, 224884, 224887, 224890, 224894, 224897, 372353, 216707, 126596, 421508, 224904, 11918, 224913, 126610, 339601, 224916, 224919, 126616, 224922, 208538, 224926, 224929, 224932, 224936, 257704, 224942, 257712, 224947, 257716, 257720, 257724, 224959, 257732, 224965, 224969, 339662, 224975, 257747, 224981, 224986, 257761, 257764, 339695, 225012, 257787, 225020, 339710, 257790, 225025, 257794, 257801, 339721, 257804, 225038, 257807, 225043, 372499, 225048, 257819, 225053, 184094, 225058, 257833, 225066, 257836, 413484, 225070, 225073, 372532, 225079, 397112, 225082, 397115, 225087, 225092, 225096, 323402, 257868, 225103, 257871, 397139, 225108, 225112, 257883, 257886, 225119, 257890, 225127, 257896, 274280, 257901, 225137, 257908, 225141, 257912, 225148, 257916, 257920, 225155, 339844, 225165, 397200, 225170, 380822, 225175, 225180, 118691, 184244, 372664, 372702, 372706, 356335, 372738, 405533, 430129, 266294, 421960, 356439, 430180, 421990, 266350, 356466, 266362, 381068, 225423, 250002, 250004, 225429, 356506, 225437, 135327, 225441, 438433, 225444, 438436, 225447, 438440, 225450, 258222, 225455, 225458, 225461, 225466, 389307, 225470, 381120, 372929, 430274, 225475, 389320, 225484, 225487, 225490, 266453, 225493, 225496, 225499, 225502, 225505, 356578, 225510, 225514, 225518, 372976, 381176, 397571, 389380, 356637, 356640, 356643, 356646, 266536, 356649, 356655, 332080, 340275, 356660, 397622, 225597, 332097, 201028, 348488, 332106, 348502, 250199, 250202, 332125, 250210, 332152, 389502, 250238, 332161, 356740, 332172, 373145, 340379, 389550, 324030, 266687, 340451, 127471, 340472, 324094, 266754, 324111, 340500, 324117, 332324, 381481, 356907, 324142, 356916, 324149, 324155, 348733, 324164, 356934, 348743, 381512, 324173, 324176, 389723, 332380, 381545, 340627, 184982, 373398, 258721, 332453, 332459, 389805, 332463, 381617, 332471, 332483, 332486, 373449, 332493, 357069, 357073, 332511, 332520, 332533, 348924, 389892, 373510, 389926, 348978, 340789, 348982, 398139, 127814, 357201, 357206, 389978, 430939, 357211, 357214, 349040, 340849, 201588, 430965, 381813, 324472, 398201, 340858, 324475, 430972, 340861, 324478, 119674, 324481, 373634, 398211, 324484, 324487, 381833, 324492, 324495, 324498, 430995, 324501, 324510, 422816, 324513, 398245, 201637, 324524, 340909, 324533, 324538, 324541, 398279, 340939, 340941, 209873, 431072, 398306, 340963, 209895, 349172, 381946, 349180, 431106, 357410, 250914, 185380, 357418, 209965, 209968, 209975, 209979, 209987, 209995, 341071, 349267, 250967, 210010, 341091, 210025, 210027, 210030, 210036, 210039, 341113, 349308, 349311, 152703, 160895, 210052, 349319, 210055, 210067, 210071, 210077, 210080, 251044, 210084, 185511, 210088, 210098, 210107, 210115, 332997, 210127, 333009, 210131, 333014, 210138, 210143, 218354, 218360, 251128, 275712, 275715, 275721, 349459, 333078, 251160, 349484, 349491, 251189, 415033, 251210, 357708, 210260, 365911, 259421, 365921, 333154, 251235, 374117, 333162, 234866, 390516, 333175, 357755, 136590, 374160, 112020, 349590, 357792, 259515, 415166, 415185, 366034, 366038, 415191, 415193, 415196, 415199, 423392, 333284, 415207, 366056, 366061, 415216, 210420, 415224, 423423, 415257, 415263, 366117, 415270, 144939, 415278, 415281, 415285, 210487, 415290, 415293, 349761, 415300, 333386, 333399, 366172, 333413, 423528, 423532, 210544, 415353, 333439, 415361, 267909, 210631, 333511, 358099, 153302, 333534, 366307, 366311, 431851, 366318, 210672, 366321, 366325, 210695, 210698, 366348, 210706, 399128, 333594, 210719, 358191, 366387, 210739, 399159, 358200, 325440, 366401, 341829, 325446, 46920, 341834, 341838, 341843, 415573, 341851, 350045, 399199, 259938, 399206, 268143, 358255, 399215, 358259, 341876, 243579, 333698, 333708, 382890, 350146, 333774, 358371, 350189, 350193, 350202, 350206, 350213, 268298, 350224, 350231, 333850, 350237, 350240, 350244, 350248, 178218, 350251, 350256, 350259, 350271, 243781, 350285, 374864, 342111, 374902, 432271, 333997, 334011, 260289, 260298, 350410, 350416, 350422, 211160, 350425, 268507, 334045, 350445, 375026, 358644, 350458, 350461, 350464, 325891, 350467, 350475, 350480, 432405, 350486, 350490, 325914, 325917, 350493, 350498, 194852, 350504, 358700, 391468, 350509, 358704, 358713, 358716, 383306, 383321, 383330, 383333, 391530, 383341, 334203, 268668, 194941, 391563, 366990, 416157, 342430, 268701, 375216, 334262, 334275, 358856, 334304, 334311, 375277, 334321, 350723, 391690, 186897, 342545, 334358, 342550, 342554, 334363, 350761, 252461, 334384, 383536, 358961, 334394, 252482, 219718, 334407, 334420, 350822, 375400, 334465, 334468, 162445, 326290, 342679, 342683, 260766, 342710, 244409, 260797, 260801, 350917, 391894, 154328, 416473, 64230, 375535, 203506, 342776, 391937, 391948, 375568, 326416, 375571, 375574, 162591, 326441, 326451, 326454, 326460, 260924, 375612, 244540, 326467, 244551, 326473, 326477, 326485, 416597, 326490, 342874, 326502, 375656, 433000, 326507, 326510, 211825, 211831, 351097, 392060, 359295, 351104, 342915, 400259, 236430, 342930, 252822, 392091, 400285, 252836, 359334, 400306, 351168, 359361, 326598, 359366, 359382, 359388, 383967, 343015, 359407, 261108, 244726, 261111, 383997, 261129, 359451, 261147, 211998, 261153, 261159, 359470, 359476, 343131, 384098, 384101, 384107, 367723, 187502, 343154, 384114, 212094, 351364, 384143, 351381, 384160, 384168, 367794, 384181, 367800, 384191, 351423, 326855, 244937, 253130, 343244, 146642, 359649, 343270, 351466, 351479, 343306, 261389, 359694, 253200, 261393, 245020, 245029, 351534, 376110, 245040, 425276, 384323, 212291, 343365, 212303, 367965, 343393, 343398, 367980, 425328, 253303, 154999, 343417, 327034, 245127, 384397, 245136, 245142, 245145, 343450, 245148, 245151, 245154, 245157, 245162, 327084, 359865, 384443, 146876, 327107, 327110, 327115, 327117, 359886, 359890, 343507, 368092, 343534, 343539, 368119, 343544, 368122, 409091, 359947, 359955, 359983, 343630, 179802, 327275, 245357, 138864, 155254, 155273, 368288, 245409, 425638, 425649, 155322, 425662, 155327, 155351, 155354, 212699, 155363, 245475, 155371, 245483, 409335, 155393, 155403, 155422, 360223, 155438, 155442, 155447, 417595, 155461, 360261, 376663, 155482, 261981, 425822, 155487, 376671, 155490, 155491, 261996, 376685, 261999, 262002, 327539, 425845, 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, 204784, 393203, 360438, 253943, 393206, 393212, 155646 ]
bf6c809ca1dc553072684315bb0fc1924533f5a8
a4b9f3c33c851eeb9f4f5affb896a7b56a911f6d
/Pin+CoreDataProperties.swift
21a843a2b8090663331aeca5d755922cfd0cce7f
[]
no_license
erikuecke/VirtualFlickrTourist
a4cfc9b93203060207dd6a5b55ae7aeea33fdfeb
9a97d3cb84190b8ece87ea2e3c81b952c941b414
refs/heads/master
2021-01-16T00:09:15.777981
2017-08-15T02:10:14
2017-08-15T02:10:14
99,719,557
0
0
null
null
null
null
UTF-8
Swift
false
false
879
swift
// // Pin+CoreDataProperties.swift // VirtualFlickrTourist // // Created by Erik Uecke on 8/11/17. // Copyright © 2017 Erik Uecke. All rights reserved. // import Foundation import CoreData extension Pin { @nonobjc public class func fetchRequest() -> NSFetchRequest<Pin> { return NSFetchRequest<Pin>(entityName: "Pin") } @NSManaged public var latitude: Double @NSManaged public var longitude: Double @NSManaged public var photos: NSSet? } // MARK: Generated accessors for photos extension Pin { @objc(addPhotosObject:) @NSManaged public func addToPhotos(_ value: Photo) @objc(removePhotosObject:) @NSManaged public func removeFromPhotos(_ value: Photo) @objc(addPhotos:) @NSManaged public func addToPhotos(_ values: NSSet) @objc(removePhotos:) @NSManaged public func removeFromPhotos(_ values: NSSet) }
[ -1 ]
a13df2937c35de30d9a49cd97b18cc8ff9cd251b
38377bc125e0887be46acfa964c8207cf8e178b4
/AnimatedTransitionDemo/TransitionsViewController.swift
0869da65adcf0104104351ba9ac9f6e8ad3a05f8
[]
no_license
dasdom/AnimatedTransitionDemo
b0687b206eb5f5656c4ddde34f23401a9b67ada9
dc95fdb2f72bae873584b5c55e7ad7d2850564c9
refs/heads/main
2023-02-18T07:37:24.035753
2021-01-17T15:31:45
2021-01-17T15:31:45
330,408,720
7
1
null
null
null
null
UTF-8
Swift
false
false
3,509
swift
// Created by dasdom on 15.01.21. // // import UIKit class TransitionsViewController: UITableViewController { override func viewDidLoad() { super.viewDidLoad() tableView.register(UITableViewCell.self, forCellReuseIdentifier: "Cell") } // MARK: - Table view data source override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return Transition.allCases.count } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { guard let transition = Transition(rawValue: indexPath.row) else { return UITableViewCell() } let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) cell.imageView?.image = transition.image cell.textLabel?.text = transition.name return cell } override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { guard let transition = Transition(rawValue: indexPath.row) else { return } let next = transition.nextViewController navigationController?.pushViewController(next, animated: true) } } extension TransitionsViewController: TransitionInfoProtocol { func viewsToAnimate() -> [UIView] { let cell: UITableViewCell if let indexPath = tableView.indexPathForSelectedRow { cell = tableView.cellForRow(at: indexPath)! // } else { // cell = tableView.cellForRow(at: lastSelectedIndexPath!) } else { return [] } guard let imageView = cell.imageView, let label = cell.textLabel else { return [] } return [imageView, label] } func copyForView(_ subView: UIView) -> UIView { let cell = tableView.cellForRow(at: tableView.indexPathForSelectedRow!)! if subView is UIImageView { return UIImageView(image: cell.imageView?.image) } else { let label = UILabel() label.text = cell.textLabel?.text return label } } } extension TransitionsViewController { enum Transition: Int, CaseIterable { case `default` case fromBottom case moveElements case mask case tile case fold var name: String { let name: String switch self { case .default: name = "Default" case .fromBottom: name = "From bottom" case .moveElements: name = "Move elements" case .mask: name = "Mask" case .tile: name = "Tile" case .fold: name = "Fold" } return name } var image: UIImage? { let imageName: String switch self { case .default: imageName = "default" case .fromBottom: imageName = "fromBottom" case .moveElements: imageName = "moveElements" case .mask: imageName = "mask" case .tile: imageName = "tile" case .fold: imageName = "fold" } return UIImage(named: imageName) } var nextViewController: UIViewController { let next: UIViewController switch self { case .default: next = RandomColorViewController() case .fromBottom: next = FromBottomViewController() case .moveElements: next = MoveElementsViewController(name: self.name, image: self.image) case .mask: next = MaskViewController(image: self.image) case .tile: next = TileViewController(name: self.name, image: self.image) case .fold: next = FoldViewController(name: self.name, image: self.image) } return next } } }
[ -1 ]
2a5ed9f7f6ced009e9132a24d1fdc0735275f869
d5b2bb2733b6e47ed83772b737d95d92652a88ab
/Clima/WeatherViewController.swift
5923d0926ad0ae10c68483f8384e875b33486eb8
[]
no_license
Jamey-Dogom/WeatherApp
8b9b260f24c75043f37f45af40fdd6c836f69958
94c1b3666af23962b8064f4f90a47256408ddc8a
refs/heads/master
2020-07-09T19:08:46.178096
2019-08-27T01:41:58
2019-08-27T01:41:58
204,057,978
2
0
null
null
null
null
UTF-8
Swift
false
false
6,476
swift
// // ViewController.swift // WeatherApp // // Created by Angela Yu on 23/08/2015. // Copyright (c) 2015 London App Brewery. All rights reserved. // import UIKit // module that allows us to use gps of iphone import CoreLocation // have to import pods import Alamofire import SwiftyJSON import SVProgressHUD // weather class is a subclass of uiview and it conforms to the rules of CLdelegate class WeatherViewController: UIViewController, CLLocationManagerDelegate, ChangeCityDelegate { @IBAction func cFToggle(_ sender: UISwitch) { if sender.isOn { temperatureLabel.text = (String ((weatherDataModel.temperature - 32) * 5/9)) + "°" } else { temperatureLabel.text = (String (weatherDataModel.temperature)) + "°" } } //Constants /***Get your own App ID at https://openweathermap.org/appid ****/ //TODO: Declare instance variables here let locationManger = CLLocationManager() let weatherDataModel = WeatherDataModel() //Pre-linked IBOutlets @IBOutlet weak var weatherIcon: UIImageView! @IBOutlet weak var cityLabel: UILabel! @IBOutlet weak var temperatureLabel: UILabel! override func viewDidLoad() { super.viewDidLoad() //TODO:Set up the location manager here. locationManger.delegate = self // sets the accuracy of location data // option best for battery locationManger.desiredAccuracy = kCLLocationAccuracyHundredMeters // get location data from the user while app is in use locationManger.requestWhenInUseAuthorization() // find location and gives message when it finds it locationManger.startUpdatingLocation() } //MARK: - Networking /***************************************************************/ //Write the getWeatherData method here: func getWeatherData(url : String, parameters: [String : String]){ // url is weatherurl , get request: retreives data, params from our locationManager // responseJSON contains data we need Alamofire.request(url, method: .get, parameters: parameters).responseJSON { // does this in background response in if response.result.isSuccess { print("Success got the weather data!") let weatherJSON : JSON = JSON(response.result.value!) self.updateWeatherData(json: weatherJSON) } else { // print("Error \(response.result.error)") self.cityLabel.text = "Connection Issues" } } } //MARK: - JSON Parsing /***************************************************************/ //Write the updateWeatherData method here: func updateWeatherData(json: JSON){ // Optional binding to prevent errors when unwrapping using ! if let tempResult = json["main"]["temp"].double { weatherDataModel.temperature = (Int(tempResult - 273.15) * 9/5 + 32) weatherDataModel.city = json["name"].stringValue weatherDataModel.condition = json["weather"][0]["id"].intValue weatherDataModel.weatherIconName = weatherDataModel.updateWeatherIcon(condition: weatherDataModel.condition) updateUIWithWeatherData() } else { cityLabel.text = "Weather Unavailable" } } //MARK: - UI Updates /***************************************************************/ //Write the updateUIWithWeatherData method here: func updateUIWithWeatherData() { // update the weather image weatherIcon.image = UIImage(named: weatherDataModel.weatherIconName) // update the city name cityLabel.text = weatherDataModel.city // update the temperature temperatureLabel.text = (String (weatherDataModel.temperature)) + "°" } //MARK: - Location Manager Delegate Methods /***************************************************************/ //Write the didUpdateLocations method here: // tells delagate that new location data has been received func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { // CLLocation is an array with location data // last value is the most accurate let location = locations[locations.count-1] // if value is less than 0 then location is invalid if location.horizontalAccuracy > 0 { // save the user's battery locationManger.stopUpdatingLocation() // print("longitude = \(location.coordinate.longitude), latitude = \(location.coordinate.latitude)") let latitude = String(location.coordinate.latitude) let longitude = String(location.coordinate.longitude) // combine both lat and long into dictionary let params : [String : String] = ["lat" : latitude, "lon" : longitude, "appid" : APP_ID] getWeatherData(url: WEATHER_URL, parameters: params) } } //Write the didFailWithError method here: func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) { print(error) cityLabel.text = "Location Unavailable" } //MARK: - Change City Delegate methods /***************************************************************/ //Write the userEnteredANewCityName Delegate method here: func userEnteredANewCityName(city: String) { // Weather api says to call city by q let params : [String : String] = ["q" : city, "appid" : APP_ID] getWeatherData(url: WEATHER_URL, parameters: params) } //Write the PrepareForSegue Method here override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "changeCityName" { let destinationVC = segue.destination as! ChangeCityViewController destinationVC.delegate = self } } }
[ -1 ]
b928a94ea0017c8ec587dc12dc6cb3d9a9621cce
8ab4bef9f17acc7e81290b5bf20e56c283405c5e
/Weibo/PostImageCell.swift
d65a45deea5187809a4ec5d58915adc9383ab811
[]
no_license
universe-tong/Weibo
51c0de9192de918318377e6f3845a6acc8f722d0
2686c772a9081870fa01548f017935df8e42bb6b
refs/heads/master
2022-11-16T11:15:19.210794
2020-07-14T17:08:31
2020-07-14T17:08:31
279,648,398
0
0
null
null
null
null
UTF-8
Swift
false
false
2,872
swift
// // PostImageCell.swift // Weibo // // Created by lwnlwn987 on 2020/7/3. // Copyright © 2020 lwn. All rights reserved. // import SwiftUI //私有变量 其他文件不能访问 不必暴露给全局 private let kImageSpace: CGFloat = 6 struct PostImageCell: View { let images: [String] let width: CGFloat var body: some View { Group{ if images.count == 1 { loadImage(name: images[0]) .resizable() .scaledToFill() .frame(width: width, height: width*0.75) .clipped() }else if images.count == 2{ PostImageCellRow(images: images, width: width) }else if images.count == 3{ PostImageCellRow(images: images, width: width) }else if images.count == 4 { VStack(spacing: kImageSpace){ PostImageCellRow(images: Array(images[0...1]), width: width) PostImageCellRow(images: Array(images[2...3]), width: width) } }else if images.count == 5{ PostImageCellRow(images: Array(images[0...1]), width: width) PostImageCellRow(images: Array(images[2...4]), width: width) }else if images.count == 6{ PostImageCellRow(images: Array(images[0...2]), width: width) PostImageCellRow(images: Array(images[3...5]), width: width) } } } } struct PostImageCellRow: View { let images: [String] let width: CGFloat var body: some View { HStack(spacing: kImageSpace){ ForEach(images, id: \.self){image in loadImage(name: image) .resizable() .scaledToFill() .frame(width: (self.width - kImageSpace * CGFloat(self.images.count - 1)) / CGFloat(self.images.count),height: (self.width - kImageSpace * CGFloat(self.images.count - 1)) / CGFloat(self.images.count)) .clipped() } } } } struct PostImageCell_Previews: PreviewProvider { static var previews: some View { let images = postList.list[0].images let width = UIScreen.main.bounds.width return Group{ PostImageCell(images: Array(images[0...0]) , width: width ) PostImageCell(images: Array(images[0...1]) , width: width ) PostImageCell(images: Array(images[0...2]) , width: width ) PostImageCell(images: Array(images[0...3]) , width: width ) PostImageCell(images: Array(images[0...4]) , width: width ) PostImageCell(images: Array(images[0...5]) , width: width ) }.previewLayout(.fixed(width: width, height: 300)) } }
[ -1 ]
bb8eebf884aa4abdc72fb3179182c46244ed365f
4fb8b6f97e3d34c72489af0f6ed0f4d9ccdeeadf
/GameOverScene.swift
dca83e89a194fcbcef97b1707b63af967f9674e1
[]
no_license
maritimerabroad/WAR-game-iOS
5c23f039a8175bb7012d8d227a387dbd50b8da6c
3693ad8240dabc1b313a44b47ede494b98b43aef
refs/heads/master
2021-05-15T23:54:26.199309
2017-10-14T03:24:20
2017-10-14T03:24:20
106,894,566
0
0
null
null
null
null
UTF-8
Swift
false
false
1,367
swift
// // GameOverScene.swift // Oldxcodefirstgame // // Created by Colton Booth on 2017-06-10. // Copyright © 2017 Colton Booth. All rights reserved. // import Foundation import SpriteKit class GameOverScene: SKScene { //var background = SKSpriteNode(imageNamed: "background") init(size: CGSize, won:Bool) { super.init(size: size) if won { let background = SKSpriteNode(imageNamed: "won") background.zPosition = 0 background.position = CGPoint(x: frame.size.width / 2, y: frame.size.height / 2) addChild(background) } else { let background = SKSpriteNode(imageNamed: "lost") background.zPosition = 0 background.position = CGPoint(x: frame.size.width / 2, y: frame.size.height / 2) addChild(background) } run(SKAction.sequence([ SKAction.wait(forDuration: 3.0), SKAction.run() { // 5 let reveal = SKTransition.flipHorizontal(withDuration: 0.5) let scene = GameScene(size: size) self.view?.presentScene(scene, transition:reveal) } ])) } // 6 required init(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } }
[ -1 ]
7017fda90b3fb126c912164f6cdb9f998a1e0599
b4f63566bf579cfb89d38b6451ba787d803747c0
/Pods/CommonDataModelsKit-iOS/CommonDataModelsKit-iOS/CommonDataModelsKit-iOS/Core/enums/CardKitErrorType.swift
9be58bf07ea63a74be8029bcdedc08f5da162add
[ "MIT" ]
permissive
Tap-Payments/TapCardScannerKit-iOS
59a283a70aaece77557d5e3293ad7d9f1c157537
ffb1b48e3d6d1edc7b63d965d05ed71fdd4e094c
refs/heads/master
2023-02-05T17:37:59.604236
2023-01-24T09:56:31
2023-01-24T09:56:31
249,364,221
6
3
null
null
null
null
UTF-8
Swift
false
false
2,033
swift
// // CardKitErrorType.swift // TapCardCheckOutKit // // Created by Osama Rabie on 24/07/2022. // import Foundation /// Enum defining SDK errors. @objc public enum CardKitErrorType: Int, CaseIterable { @objc(Network) case Network @objc(InvalidCardType) case InvalidCardType } // MARK: - CustomStringConvertible extension CardKitErrorType: CustomStringConvertible { public var description: String { switch self { case .Network: return "Network error occured" case .InvalidCardType: return "The user entered a card not matching the given allowed type" } } } /// Enum defining different events passed from card kit @objc public enum CardKitEventType: Int, CaseIterable { @objc(CardNotReady) case CardNotReady @objc(CardReady) case CardReady @objc(TokenizeStarted) case TokenizeStarted @objc(TokenizeEnded) case TokenizeEnded @objc(SaveCardStarted) case SaveCardStarted @objc(SaveCardEnded) case SaveCardEnded @objc(ThreeDSStarter) case ThreeDSStarter @objc(ThreeDSEnded) case ThreeDSEnded } // MARK: - CustomStringConvertible extension CardKitEventType: CustomStringConvertible { public var description: String { switch self { case .CardNotReady: return "Card data is not ready for any action" case .CardReady: return "Card data is ready for tokenize or save when needed" case .TokenizeStarted: return "Tokenize process started" case .TokenizeEnded: return "Tokenize process ended" case .SaveCardStarted: return "Save card process started" case .SaveCardEnded: return "Save card process ended" case .ThreeDSStarter: return "ThreeDS process started" case .ThreeDSEnded: return "ThreeDS process ended" } } }
[ -1 ]
31852595f779d3bce89903d0af052aa2bd4ba0b5
d4c33b3a271f0b65a8c2ad841be479d09f678256
/Week5/ParseChat/ParseChat/AppDelegate.swift
9ed4b0ccba54c41e0105eb168dbe4ae24dbe76f7
[]
no_license
narayanansriram/iOS-University-CP
5cbf0683025ae6e1c4bd9ce3f4fd603c98ce0489
f5ce61f4d8b1e91e601836f678eec0aa8f685168
refs/heads/master
2021-07-17T14:02:35.554465
2020-09-26T00:41:52
2020-09-26T00:41:52
215,697,623
1
0
null
null
null
null
UTF-8
Swift
false
false
3,715
swift
// // AppDelegate.swift // ParseChat // // Created by Sriram Narayanan on 11/9/19. // Copyright © 2019 Sriram Narayanan. All rights reserved. // import UIKit import CoreData @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. } // 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: "ParseChat") 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)") } } } }
[ 199680, 379906, 253443, 418820, 249351, 328199, 384007, 379914, 377866, 372747, 199180, 326668, 329233, 349202, 186387, 350738, 262677, 330774, 324121, 245274, 377371, 345630, 340511, 384032, 362529, 349738, 394795, 404523, 245293, 262701, 349744, 361524, 337975, 343609, 375867, 333373, 418366, 152127, 339009, 413250, 214087, 352840, 377930, 337994, 370253, 330319, 200784, 173647, 436306, 333395, 244308, 374358, 329815, 254042, 402522, 326239, 322658, 340579, 244329, 333422, 349295, 204400, 173169, 339571, 330868, 344693, 268921, 343167, 192639, 344707, 330884, 336516, 266374, 385670, 346768, 268434, 409236, 336548, 333988, 356520, 377001, 379048, 361644, 402614, 361655, 325308, 339132, 343231, 403138, 337092, 244933, 322758, 337606, 367816, 257738, 342736, 245460, 257751, 385242, 366300, 165085, 350433, 345826, 328931, 395495, 363755, 343276, 346348, 338158, 325358, 212722, 251122, 350453, 338679, 393465, 351482, 264961, 115972, 268552, 346890, 362251, 328460, 336139, 333074, 257814, 333592, 397084, 342813, 257824, 362272, 377120, 334631, 336680, 389416, 384298, 254252, 204589, 366383, 328497, 257842, 339768, 326969, 257852, 384828, 386365, 204606, 375615, 339792, 358737, 389970, 361299, 155476, 366931, 330584, 361305, 257880, 362843, 429406, 374112, 353633, 439137, 355184, 361333, 332156, 337277, 245120, 260992, 389506, 380802, 264583, 337290, 155020, 348565, 337813, 250262, 155044, 333221, 373671, 333736, 252845, 356781, 288174, 370610, 268210, 210356, 342452, 370102, 338362, 327612, 358335, 380352, 201157, 333766, 393670, 339400, 349128, 347081, 358347, 187334, 336325, 272848, 379856, 155603, 399317, 249302, 379863, 372697, 155102, 329182, 182754, 360429, 338927, 330224, 379895, 201723, 257020, 254461 ]
9a14f2e3958573e5d7f69453a44da74b11a0c68e
272b43a4df0486cc29477e97ee28c973775a3f76
/MacOS/Browser001/Browser001/Model/DataModel1.swift
db427dd03ec693c26474876619ffb26caefbef84
[ "Apache-2.0" ]
permissive
thierryH91200/MacOS-App-Collection
7518bb69900b761cf40ef1fa9fde84d66f0cb354
597fea3118f427d72d8113b9009ce9bf8b30a3ef
refs/heads/master
2020-03-28T18:56:12.570144
2018-09-07T10:44:35
2018-09-07T10:44:35
null
0
0
null
null
null
null
UTF-8
Swift
false
false
321
swift
// // Branch.swift // OutlineView002 // // Created by Ankit Kumar Bharti on 26/07/18. // Copyright © 2018 Exilant. All rights reserved. // import Foundation struct Branch: Decodable { let title: String let students: [Student] } struct Student: Decodable { let name: String let hobbies: [String] }
[ -1 ]
daeadcf2d05f0c7cde56321cc23ce12886ddaeb3
8485f6c5d174f159418bea5b64a623407264355e
/VaniusikRand/VaniusikRand/ViewController.swift
33dbd9e5159d17ba639d60ae95c96d3c36b315b8
[]
no_license
b0dah/iOS_Apps
8b2b8a7a0203904297cd9d99119a2edc608245cd
2ac89ae0135c3db853057c1cdac84ee1d4f56d04
refs/heads/master
2021-06-23T05:38:41.716766
2020-12-25T21:47:33
2020-12-25T21:47:33
160,718,312
0
0
null
null
null
null
UTF-8
Swift
false
false
554
swift
// // ViewController.swift // VaniusikRand // // Created by Иван on 08/11/2018. // Copyright © 2018 Иван. All rights reserved. // import UIKit class ViewController: UIViewController { @IBOutlet weak var result: UILabel! @IBAction func letsgo(_ sender: UIButton) { //result.text = result.text! + String(sender.tag) result.text = String(55) } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } }
[ -1 ]
ded0344b73632163693d01884ef32cef0f39ed6e
3aa32543c705628c99964e62da836fc1372fc0fa
/Smart Reminder/RemindItem.swift
8d99485bf5a0004b725bb010da21aecf90995542
[]
no_license
HaoyangCui0830/SmartReminder
e8f6d54a7235c5465efb9ee5cc0649dc569469b2
18eadbaf52e50ed55fd2ad5d7588178fdb428437
refs/heads/master
2021-12-14T02:56:25.569173
2021-12-02T07:13:36
2021-12-02T07:16:25
242,283,672
0
0
null
null
null
null
UTF-8
Swift
false
false
2,482
swift
// // RemindItem.swift // Smart Reminder // // Created by Penguin on 2020/1/17. // Copyright © 2020 haoyang. All rights reserved. // import Foundation class RemindItem { let description:String var shouldBeFinishedBy:Int = 1000 var mustBeFinishedBy:Int = 1000 var mustBeCompleted:Bool = false var isPreTask:Bool = false var priorityPoint: Double = 0.0 var startDate:Date = Date() var learningRate = 0.00000001 init(descrip:String) { description = descrip } init(descrip:String, should:String, must:String, essential:String, Pre:String, prioritypoint: Double, startdate: Date){ description = descrip shouldBeFinishedBy = Int(should) ?? 1000 mustBeFinishedBy = Int(must) ?? 1000 if essential == "T"{ mustBeCompleted = true } else{ mustBeCompleted = false } if Pre == "T"{ isPreTask = true } else{ isPreTask = false } self.priorityPoint = prioritypoint self.startDate = startdate } static var remindItems: [RemindItem] = [] static var remindItemDescription:[String] = [] static var shouldBeWeight = 1.0 static var mustBeWeight = 1.0 static var essentialWeight = 10.0 static var preWeight = 20.0 init(desc:String){ self.description = desc RemindItem.remindItems.append(self) } func learn(){ let time_interval = Double(self.startDate.timeIntervalSinceNow) let actualPoint = ( time_interval / ( 60 * 60 * 24 ) + 1000 ) * 2 let diff = actualPoint - self.priorityPoint RemindItem.shouldBeWeight += learningRate * diff * Double(1000 - self.shouldBeFinishedBy) RemindItem.mustBeWeight += learningRate * diff * Double(1000 - self.mustBeFinishedBy) if self.mustBeCompleted == true{ RemindItem.essentialWeight += learningRate * diff * 1 } else{ RemindItem.essentialWeight += learningRate * diff * 0 } if self.isPreTask == true{ RemindItem.preWeight += learningRate * diff * 1 } else{ RemindItem.preWeight += learningRate * diff * 0 } print(RemindItem.shouldBeWeight) print(RemindItem.mustBeWeight) print(RemindItem.essentialWeight) print(RemindItem.preWeight) } }
[ -1 ]
d5825a235ca70c51884959c330498f6e66d66f3b
ba92cefc9ec49a22fda7b5f7600876d3d4f3eb4a
/Sources/NPOKit/Model/Stream/FairPlayStream.swift
37408c2fb144c0fd0937c9cbd7227905135c9447
[ "Apache-2.0" ]
permissive
4np/NPOKit
2d08f8f21bc4b469c987b65f3b271621f37325df
92a11d915b03dbe066ece08c4facae53eebcb88f
refs/heads/master
2021-10-10T08:22:51.442423
2019-01-08T11:58:49
2019-01-08T11:58:49
120,003,426
2
0
null
null
null
null
UTF-8
Swift
false
false
941
swift
// // FairPlayStream.swift // NPO // // Created by Jeroen Wesbeek on 31/10/2017. // Copyright © 2017 Jeroen Wesbeek. All rights reserved. // import Foundation public struct FairPlayStream: Codable { public private(set) var url: URL public private(set) var licenseToken: String public private(set) var licenseServer: URL public private(set) var certificateURL: URL? var profile: String public private(set) var drm: String var ip: String var isLegacy: Bool var isLive: Bool var isCatchupAvailable: Bool var heartbeatUrl: URL? enum CodingKeys: String, CodingKey { case url case licenseToken case licenseServer case certificateURL = "certificateUrl" case profile case drm case ip case isLegacy = "legacy" case isLive = "live" case isCatchupAvailable = "catchupAvailable" case heartbeatUrl } }
[ -1 ]
ed13146990a32b7d4d1dd255a78c0b5608546916
453e7f074e52e716579ba9f8a5c29084ab52e93c
/Maddox/Controller/CreateAccountVC.swift
da933293e3a202c46f6ada960374f3b3f585b879
[]
no_license
vivekraideveloper/Maddox
6666694e31d3f4ec62951012c68e5365f2fbca1b
011a3807f13484f3276a47029ecf1b8818fbe15e
refs/heads/master
2020-03-27T18:29:52.734600
2018-08-31T23:18:48
2018-08-31T23:18:48
146,925,799
0
0
null
null
null
null
UTF-8
Swift
false
false
405
swift
// // CreateAccountVC.swift // Maddox // // Created by Vivek Rai on 01/09/18. // Copyright © 2018 Vivek Rai. All rights reserved. // import UIKit class CreateAccountVC: UIViewController { override func viewDidLoad() { super.viewDidLoad() } @IBAction func closeButtonPressed(_ sender: Any) { performSegue(withIdentifier: unWind, sender: nil) } }
[ -1 ]
5bda797dce1f673fcdef7dc1c512dd13fbc6d7cc
9c48d6a5978bcb40bd29d63ea7508ca023dd3743
/MovieApp/MovieApp/View/MovieViewController.swift
a8c932ae7e3173c66aed849eef0601f648960e5d
[]
no_license
bahadirseyfi/MovieApp-MVVM
cddaee4f6257bf70faa7b87bceaf58c57525a4b1
1a9e0370351f1a3ea436c108cc726b700bd026de
refs/heads/master
2023-08-20T13:47:14.220222
2021-10-22T19:39:45
2021-10-22T19:39:45
375,486,594
1
0
null
null
null
null
UTF-8
Swift
false
false
4,798
swift
// // ViewController.swift // MovieApp // // Created by bahadir on 9.06.2021. // import UIKit final class MovieViewController: UIViewController { @IBOutlet private weak var topRatedCollectionView: UICollectionView! @IBOutlet private weak var popularCollectionView: UICollectionView! @IBOutlet private weak var nowPlayingCollectionView: UICollectionView! var viewModel: MovieViewModelProtocol! { didSet { viewModel.delegate = self } } override func viewDidLoad() { super.viewDidLoad() viewModel.load() title = "Movies" let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 38, height: 38)) imageView.contentMode = .scaleAspectFit let image = UIImage(named: "full_primary") imageView.image = image navigationItem.titleView = imageView } private func redirectTo(movieID: Int) { self.view.endEditing(true) let vc: DetailViewController = DetailViewController.instantiate(storyboards: .detail) vc.viewModel = DetailViewModel(movieID: movieID) self.navigationController?.pushViewController(vc, animated: true) } } extension MovieViewController: UICollectionViewDataSource, UICollectionViewDelegate { func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return viewModel.numberOfItems(section) ?? 0 } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { if collectionView == topRatedCollectionView { let cell = topRatedCollectionView.dequeCell(cellType: TopRatedMovieCell.self, indexPath: indexPath) if let movie = viewModel.topRatedMovie(indexPath.item) { let movieImage = MovieDBBaseAPI.BaseImagePath + movie.backDropPath cell.configureCell(name: movie.title, image: movieImage) } return cell } if collectionView == popularCollectionView { let cell = popularCollectionView.dequeCell(cellType: PopularMovieCell.self, indexPath: indexPath) if let movie = viewModel.popularMovie(indexPath.item) { let movieImage = MovieDBBaseAPI.BaseImagePath + movie.backDropPath cell.configureCell(image: movieImage) } return cell } if collectionView == nowPlayingCollectionView { let cell = nowPlayingCollectionView.dequeCell(cellType: NowPlayingMovieCell.self, indexPath: indexPath) if let movie = viewModel.nowPlayingMovie(indexPath.item) { let movieImage = MovieDBBaseAPI.BaseImagePath + movie.posterPath cell.configure(index: indexPath.item, title: movie.title, image: movieImage) } return cell } return UICollectionViewCell() } func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { if collectionView == topRatedCollectionView { guard let movieID = viewModel.topRatedMovie(indexPath.item)?.movieId else { print("Başarız ID ") return } redirectTo(movieID: movieID) } if collectionView == popularCollectionView { guard let movieID = viewModel.popularMovie(indexPath.item)?.movieId else { print("Başarız ID ") return } redirectTo(movieID: movieID) } if collectionView == nowPlayingCollectionView { guard let movieID = viewModel.nowPlayingMovie(indexPath.item)?.movieId else { print("Başarız ID ") return } redirectTo(movieID: movieID) } } } extension MovieViewController: MovieViewModelDelegate { func prepareCollectionViews() { topRatedCollectionView.register(cellType: TopRatedMovieCell.self) popularCollectionView.register(cellType: PopularMovieCell.self) nowPlayingCollectionView.register(cellType: NowPlayingMovieCell.self) nowPlayingCollectionView.delegate = self nowPlayingCollectionView.dataSource = self popularCollectionView.delegate = self popularCollectionView.dataSource = self topRatedCollectionView.delegate = self topRatedCollectionView.dataSource = self } func reloadTopRated() { topRatedCollectionView.reloadData() } func reloadPopular() { popularCollectionView.reloadData() } func reloadNowPlaying() { nowPlayingCollectionView.reloadData() } }
[ -1 ]
a30ec758266de28b2a069e8201c1154ad20530b4
5ddd63adcd140adfe6e6c49380e4bd08684758ba
/PhotoBrowser/NSDateHelper.swift
8cbb2f4ee84da3210aceb4b02040b27e12f4e766
[]
no_license
paleksandrs/PhotoBrowser
a05edca2013235cd4335660bfaf5f6e8f8129478
346a9de1c1474c3ea839e85c93aa495f04e2fbaf
refs/heads/master
2021-01-11T03:24:24.980986
2016-10-16T11:23:48
2016-10-16T11:23:48
71,009,948
0
0
null
null
null
null
UTF-8
Swift
false
false
754
swift
// // Copyright © 2016 John Lewis. All rights reserved. // import Foundation extension NSDate { func numberOfDaysUntilDateTime(toDateTime: NSDate, inTimeZone timeZone: NSTimeZone? = nil) -> Int { let calendar = NSCalendar.currentCalendar() if let timeZone = timeZone { calendar.timeZone = timeZone } var fromDate: NSDate?, toDate: NSDate? calendar.rangeOfUnit(.Day, startDate: &fromDate, interval: nil, forDate: self) calendar.rangeOfUnit(.Day, startDate: &toDate, interval: nil, forDate: toDateTime) let difference = calendar.components(.Day, fromDate: fromDate!, toDate: toDate!, options: []) return difference.day } }
[ -1 ]
a23f598a467696f3eb14919529b018e300b8ad6e
47601bd8ecd0579ac07cb7c5e716bfdaf2726ab7
/DITFoodDelivery/detailViewController.swift
9138884328c146113f096a8d082b6e7d7218f8d9
[]
no_license
Kimsihwan/DITFoodDelivery
36d641e847c53a8878c5cd7f3cf36de788281594
cbfb7e54b33370b7c08d629fe94219b3543a0775
refs/heads/master
2020-03-17T16:56:12.842806
2018-06-12T06:18:41
2018-06-12T06:18:41
133,768,305
0
0
null
null
null
null
UTF-8
Swift
false
false
2,559
swift
// // detailViewController.swift // DITFoodDelivery // // Created by D7702_10 on 2018. 5. 31.. // Copyright © 2018년 ksh. All rights reserved. // import UIKit class detailViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { @IBOutlet weak var detailImage: UIImageView! @IBOutlet weak var detailTableView: UITableView! var cellName = "" var cellImage = "" var cellAddress = "" var cellType = "" var cellTel = "" var cellMenu = "" override func viewDidLoad() { super.viewDidLoad() //UIViewController와 delegate 객체 연결 detailTableView.dataSource = self detailTableView.delegate = self detailImage.image = UIImage(named: cellImage) self.title = cellName } // tableView delegate 메소드 호출 func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 4 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { switch indexPath.row { case 0: let cell = detailTableView.dequeueReusableCell(withIdentifier: "detailcell", for: indexPath) cell.textLabel?.text = "주소: " + cellAddress return cell case 1: let cell = detailTableView.dequeueReusableCell(withIdentifier: "detailcell", for: indexPath) cell.textLabel?.text = "전화번호: " + cellTel return cell case 2: let cell = detailTableView.dequeueReusableCell(withIdentifier: "detailcell", for: indexPath) cell.textLabel?.text = "메뉴: " + cellMenu return cell default: let cell = detailTableView.dequeueReusableCell(withIdentifier: "mapcell", for: indexPath) as! MapTableViewCell cell.configure(location: cellAddress) return cell } } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "detailMapView" { if detailTableView.indexPathForSelectedRow != nil { let destinationController = segue.destination as! MapViewController destinationController.location = cellAddress destinationController.name = cellName destinationController.tel = cellTel } } } }
[ -1 ]
28828f7b6a7f8cebe212562aa2f6c725c53a7949
46507adf48f70c9268b9b80d9a631a9b1c68e4d6
/Carthage/Checkouts/ProcedureKit/Sources/TestingProcedureKit/ProcedureKitTestCase.swift
4aa3e440c67f64cab331dce9b889ee47e984e4ae
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
yageek/TPGWatch
c52fb79d45387728e12913ba1d05492896940ebc
64c21fa25623c78da37195199750e7ace84dbcd2
refs/heads/master
2020-03-29T20:20:08.064992
2018-01-10T15:26:54
2018-01-10T15:26:54
66,682,359
7
0
null
null
null
null
UTF-8
Swift
false
false
6,796
swift
// // ProcedureKit // // Copyright © 2016 ProcedureKit. All rights reserved. // import Foundation import XCTest import ProcedureKit open class ProcedureKitTestCase: XCTestCase { public var queue: ProcedureQueue! public var delegate: QueueTestDelegate! // swiftlint:disable:this weak_delegate open var procedure: TestProcedure! open override func setUp() { super.setUp() queue = ProcedureQueue() delegate = QueueTestDelegate() queue.delegate = delegate procedure = TestProcedure() } open override func tearDown() { if let procedure = procedure { procedure.cancel() } if let queue = queue { queue.cancelAllOperations() queue.waitUntilAllOperationsAreFinished() } delegate = nil queue = nil procedure = nil LogManager.severity = .warning ExclusivityManager.__tearDownForUnitTesting() super.tearDown() } public func set(queueDelegate delegate: QueueTestDelegate) { self.delegate = delegate queue.delegate = delegate } public func run(operation: Operation) { run(operations: [operation]) } public func run(operations: Operation...) { run(operations: operations) } public func run(operations: [Operation]) { queue.addOperations(operations, waitUntilFinished: false) } public func wait(for procedures: Procedure..., withTimeout timeout: TimeInterval = 3, withExpectationDescription expectationDescription: String = #function, handler: XCWaitCompletionHandler? = nil) { wait(forAll: procedures, withTimeout: timeout, withExpectationDescription: expectationDescription, handler: handler) } public func wait(forAll procedures: [Procedure], withTimeout timeout: TimeInterval = 3, withExpectationDescription expectationDescription: String = #function, handler: XCWaitCompletionHandler? = nil) { addCompletionBlockTo(procedures: procedures) run(operations: procedures) waitForExpectations(timeout: timeout, handler: handler) } /// Runs a Procedure on the queue, waiting until it is complete to return, /// but calls a specified block before the wait. /// /// IMPORTANT: This function calls the specified block immediately after adding /// the Procedure to the queue. This does *not* ensure any specific /// ordering/timing in regards to the block and the Procedure executing. /// /// - Parameters: /// - procedure: a Procedure /// - timeout: (optional) a timeout for the wait /// - expectationDescription: (optional) an expectation description /// - checkBeforeWait: a block to be executed before the wait (see above) public func check<T: Procedure>(procedure: T, withAdditionalProcedures additionalProcedures: Procedure..., withTimeout timeout: TimeInterval = 3, withExpectationDescription expectationDescription: String = #function, checkBeforeWait: (T) -> Void) { var allProcedures = additionalProcedures allProcedures.append(procedure) addCompletionBlockTo(procedures: allProcedures) run(operations: allProcedures) checkBeforeWait(procedure) waitForExpectations(timeout: timeout, handler: nil) } public func checkAfterDidExecute<T>(procedure: T, withTimeout timeout: TimeInterval = 3, withExpectationDescription expectationDescription: String = #function, checkAfterDidExecuteBlock: @escaping (T) -> Void) where T: Procedure { addCompletionBlockTo(procedure: procedure, withExpectationDescription: expectationDescription) procedure.addDidExecuteBlockObserver { (procedure) in checkAfterDidExecuteBlock(procedure) } run(operations: procedure) waitForExpectations(timeout: timeout, handler: nil) } public func addCompletionBlockTo(procedure: Procedure, withExpectationDescription expectationDescription: String = #function) { // Make a finishing procedure, which depends on this target Procedure. let finishingProcedure = makeFinishingProcedure(for: procedure, withExpectationDescription: expectationDescription) // Add the did finish expectation block to the finishing procedure addExpectationCompletionBlockTo(procedure: finishingProcedure, withExpectationDescription: expectationDescription) run(operation: finishingProcedure) } public func addCompletionBlockTo<S: Sequence>(procedures: S, withExpectationDescription expectationDescription: String = #function) where S.Iterator.Element == Procedure { for (i, procedure) in procedures.enumerated() { addCompletionBlockTo(procedure: procedure, withExpectationDescription: "\(i), \(expectationDescription)") } } @discardableResult public func addExpectationCompletionBlockTo(procedure: Procedure, withExpectationDescription expectationDescription: String = #function) -> XCTestExpectation { let expect = expectation(description: "Test: \(expectationDescription), \(UUID())") add(expectation: expect, to: procedure) return expect } public func add(expectation: XCTestExpectation, to procedure: Procedure) { weak var weakExpectation = expectation procedure.addDidFinishBlockObserver { _, _ in DispatchQueue.main.async { weakExpectation?.fulfill() } } } func makeFinishingProcedure(for procedure: Procedure, withExpectationDescription expectationDescription: String = #function) -> Procedure { let finishing = BlockProcedure { } finishing.log.enabled = false finishing.add(dependency: procedure) // Adds a will add operation observer, which adds the produced operation as a dependency // of the finishing procedure. This way, we don't actually finish, until the // procedure, and any produced operations also finish. procedure.addWillAddOperationBlockObserver { [weak weakFinishing = finishing] _, operation in guard let finishing = weakFinishing else { fatalError("Finishing procedure is finished + gone, but a WillAddOperation observer on a dependency was called. This should never happen.") } finishing.add(dependency: operation) } finishing.name = "FinishingBlockProcedure(for: \(procedure.operationName))" return finishing } } public extension ProcedureKitTestCase { func createCancellingProcedure() -> TestProcedure { let procedure = TestProcedure(name: "Cancelling Test Procedure") procedure.addWillExecuteBlockObserver { procedure, _ in procedure.cancel() } return procedure } }
[ -1 ]
3bc494430787b5f106d3eae0ba074f6ccedc07f4
7c931a8827e2f59c20bb10b9d14b7b1145972521
/OauthConnect/OauthConnect/ViewController.swift
ce0fb30073625a34a3642253680672230d4472bf
[]
no_license
trungnguyenthien/oauth-connect
71f9697a31905711a055e25ab2c0c77c076cc10b
860f131927d268de1a1e39e57df5b90814d8d12b
refs/heads/main
2023-08-31T05:31:15.900337
2021-10-23T01:02:07
2021-10-23T01:02:07
414,489,581
0
0
null
null
null
null
UTF-8
Swift
false
false
1,906
swift
// // ViewController.swift // OauthConnect // // Created by Trung on 07/10/2021. // import UIKit private let myInfo = OauthInfo( clientID: "263198911943-fakodv63vh9p5r8gs2mp15gegsfknbvj.apps.googleusercontent.com", clientSecret: "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", redirectUri: "com.googleusercontent.apps.263198911943-fakodv63vh9p5r8gs2mp15gegsfknbvj:localhost", scopes: ["openid"], authEndpoint: "https://accounts.google.com/o/oauth2/v2/auth", tokenEndpoint: "https://www.googleapis.com/oauth2/v4/token" ) import SafariServices class ViewController: UIViewController, SFSafariViewControllerDelegate { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) if let web = loginViewController(info: myInfo) { web.delegate = self present(web, animated: true, completion: nil) } } func safariViewControllerDidFinish(_ controller: SFSafariViewController) { controller.dismiss(animated: true, completion: nil) } } private extension UIView { func addStretchToFit( subview: UIView, left: CGFloat = 0, right: CGFloat = 0, top: CGFloat = 0, bottom: CGFloat = 0 ) { subview.removeFromSuperview() addSubview(subview) subview.translatesAutoresizingMaskIntoConstraints = false leftAnchor.constraint(equalTo: subview.leftAnchor, constant: left).isActive = true rightAnchor.constraint(equalTo: subview.rightAnchor, constant: right).isActive = true topAnchor.constraint(equalTo: subview.topAnchor, constant: top).isActive = true bottomAnchor.constraint(equalTo: subview.bottomAnchor, constant: bottom).isActive = true } }
[ -1 ]
112b8e6a45374bdae086c2c56da56636ca5eb73c
dba5c8fb2baf5d267438b5935b8e412256f2395b
/Postie/AppDelegate.swift
cd924dc2a79fca8325bfd777179cd8056b72b7d1
[ "MIT" ]
permissive
astephensen/Postie
f9071bfe6279aa203b28c567b4ad2ee37e21cdc7
38af6c79b31555fbfdf84eb7a56c77e12fa3f8aa
refs/heads/master
2021-03-16T07:58:41.889467
2017-03-04T00:43:35
2017-03-04T00:43:35
51,686,763
2
0
null
null
null
null
UTF-8
Swift
false
false
511
swift
// // AppDelegate.swift // Postie // // Created by Alan Stephensen on 8/11/2015. // Copyright © 2015 Alan Stephensen. All rights reserved. // import Cocoa @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { func applicationDidFinishLaunching(_ aNotification: Notification) { // Insert code here to initialize your application } func applicationWillTerminate(_ aNotification: Notification) { // Insert code here to tear down your application } }
[ 244352, 200577, 171778, 291459, 293764, 293889, 320774, 333829, 183176, 236425, 336649, 402566, 349069, 242939, 116368, 384017, 349588, 295704, 259353, 361500, 339103, 62112, 113953, 44324, 237861, 253350, 200490, 200746, 333611, 295726, 324654, 358064, 165041, 243768, 38330, 216379, 44610, 229314, 436606, 188997, 349002, 286412, 265420, 193490, 3284, 234965, 327645, 383710, 389981, 144864, 119521, 182625, 302818, 313316, 323173, 327649, 321898, 234731, 287341, 416369, 249844, 288120, 237819, 344700, 313342 ]
90fcd6aca894f778de561b23ee9b05cf574723c8
be2a31aa7a58893fe473ea65e50a9f9ac81813a5
/SwiftSkeleton/JSON.swift
b48f9b496226849be75816c6c3c91b50ad2cefa6
[ "MIT" ]
permissive
deivuh/SwiftSkeleton
d26e6b39dd1455436c6bac750ba947babf9ccc7f
5ecd4beca41f8d867970cc4c4bf0ced8519ac6b7
refs/heads/master
2020-12-11T02:08:53.476145
2014-08-21T19:33:38
2014-08-21T19:33:38
null
0
0
null
null
null
null
UTF-8
Swift
false
false
7,478
swift
// QJSON.swift // AccessControl // // Created by Jameson Quave on 7/25/14. // Copyright (c) 2014 JQ Software. All rights reserved. // import Foundation func parseJSON(data: NSData) -> JSONVal { return JSON(data).parse() } func parseJSON(str: String) -> JSONVal { return JSON(str).parse() } public enum JSONVal : Printable { // Generator protocol, use for `for x in y` // typealias Element /*public func next() -> JSONVal? { return self } typealias GeneratorType = JSONVal */ /* protocol Sequence { typealias GeneratorType : Generator func generate() -> GeneratorType } */ /*typealias GeneratorType = JSONVal func generate() -> GeneratorType { return GeneratorType(0) } func next() -> JSONVal { return JSONVal("hi") } */ public func val() -> Any { switch self { case .Dictionary(let dict): return dict case .JSONDouble(let d): return d case .JSONInt(let i): return i case .JSONArray(let arr): return arr case .JSONStr(let str): return str case .JSONBool(let jbool): return jbool case .Null: return "Null" } } case Dictionary([String : JSONVal]) case JSONDouble(Double) case JSONInt(Int) case JSONArray([JSONVal]) case JSONStr(String) case JSONBool(Bool) case Null // Pretty prints for Dictionary and Array func pp(data : [String : JSONVal]) -> String { return "DICT" } func pp(data : [JSONVal]) -> String { var str = "[\n" var indentation = " " for x : JSONVal in data { str += "\(indentation)\(x)\n" } return str } public var description: String { switch self { case .Dictionary(let dict): var str = "{\n" var indent = " " for (key,val) in dict { str += "\(indent)\(key): \(val)\n" } return "JSONDictionary \(str)" case .JSONDouble(let d): return "\(d)" case .JSONInt(let i): return "\(i)" case .JSONArray(let arr): var str = "[\n" var num = 0 var indent = " " for object in arr { str += "[\(num)]\(indent)\(object.description)\n" num++ } str += "]" return "JSONArray [\(arr.count)]: \(str)" case .JSONStr(let str): return str case .JSONBool(let jbool): return "\(jbool)" case .Null: return "Null" } } subscript(index: String) -> JSONVal { switch self { case .Dictionary(let dict): if dict[index]? != nil { return dict[index]! } return JSONVal("JSON Fault") default: println("Element is not a dictionary") return JSONVal("JSON Fault") } } subscript(index: Int) -> JSONVal { switch self { case .JSONArray(let arr): return arr[index] default: println("Element is not an array") return JSONVal("JSON Fault") } } init(_ json: Int) { self = .JSONInt(json) } init(_ json: AnyObject) { if let jsonDict = json as? NSDictionary { var kvDict = [String : JSONVal]() for (key: AnyObject, value: AnyObject) in jsonDict { if let keyStr = key as? String { kvDict[keyStr] = JSONVal(value) } else { println("Error: key in dictionary is not of type String") } } self = .Dictionary(kvDict) } else if let jsonDouble = json as? Double { self = .JSONDouble(jsonDouble) } else if let jsonInt = json as? Int { self = .JSONInt(jsonInt) } else if let jsonBool = json as? Bool { self = .JSONBool(jsonBool) } else if let jsonStr = json as? String { self = .JSONStr(jsonStr) } else if let jsonArr = json as? NSArray { var arr = [JSONVal]() for val in jsonArr { arr.append(JSONVal(val)) } self = .JSONArray( arr ) } else { println("ERROR: Couldn't convert element \(json)") self = .Null } } } public class JSON { public var json = "" public var data: NSData init(_ json: String) { self.json = json self.data = json.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)! } init(_ data: NSData) { self.json = "" self.data = data //self.data = self.json.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false) } public func parse() -> JSONVal { var err: NSError? = nil var val = JSONVal(NSJSONSerialization.JSONObjectWithData(self.data, options: nil, error: &err)) return val } public class func encodeAsJSON(data: AnyObject!) -> String? { var json = "" if let rootObjectArr = data as? [AnyObject] { // Array json = "\(json)[" for embeddedObject: AnyObject in rootObjectArr { var encodedEmbeddedObject = encodeAsJSON(embeddedObject) if encodedEmbeddedObject? != nil { json = "\(json)\(encodedEmbeddedObject!)," } else { println("Error creating JSON") return nil } } json = "\(json)]" } else if let rootObjectStr = data as? String { // This is a string, just return it return escape(rootObjectStr) } else if let rootObjectDictStrStr = data as? Dictionary<String, String> { json = "\(json){" var numKeys = rootObjectDictStrStr.count var keyIndex = 0 for (key,value) in rootObjectDictStrStr { // This could be a number if(keyIndex==(numKeys-1)) { json = json.stringByAppendingString("\(escape(key)):\(escape(value))") } else { json = json.stringByAppendingString("\(escape(key)):\(escape(value)),") } keyIndex = keyIndex + 1 } json = "\(json)}" } else { println("Failed to write JSON object") return nil } return json } class func escape(str: String) -> String { var newStr = str.stringByReplacingPercentEscapesUsingEncoding(NSUTF8StringEncoding) // Replace already escaped quotes with non-escaped quotes newStr = newStr.stringByReplacingOccurrencesOfString("\\\"", withString: "\"") // Escape all non-escaped quotes newStr = newStr.stringByReplacingOccurrencesOfString("\"", withString: "\\\"") return "\"\(newStr)\"" } }
[ -1 ]
79feea8efa30384a114382fb02aca181cfb96091
7a20cee318a3aba1dd87edebde05d507dd73466f
/Sources/CurlyClient/CURLResponseInfos.swift
095d9326318ca311f5a552a47a89a9cf62e85ff9
[ "MIT" ]
permissive
FredericRuaudel/Curly
e34caf0d8eeed36fe62c57d988f44e0465596f1b
41f4025dfa0858004b0507333b38f5fea0477171
refs/heads/master
2020-05-27T21:44:53.410614
2019-03-18T17:58:41
2019-03-18T17:58:41
188,798,229
0
0
null
2019-05-27T07:58:53
2019-05-27T07:58:53
null
UTF-8
Swift
false
false
3,436
swift
// // CURLResponseInfos.swift // PerfectCURL // // Created by Kyle Jessup on 2017-05-18. // Copyright (C) 2017 PerfectlySoft, Inc. // //===----------------------------------------------------------------------===// // // This source file is part of the Perfect.org open source project // // Copyright (c) 2015 - 2017 PerfectlySoft Inc. and the Perfect project authors // Licensed under Apache License v2.0 // // See http://perfect.org/licensing.html for license information // //===----------------------------------------------------------------------===// // import CCurlyCURL protocol CURLResponseInfo { associatedtype ValueType func get(_ from: CURLResponse) -> ValueType? } extension CURLResponse.Info.StringValue: CURLResponseInfo { typealias ValueType = String private var infoValue: CURLINFO { switch self { case .url: return CURLINFO_EFFECTIVE_URL case .ftpEntryPath: return CURLINFO_FTP_ENTRY_PATH case .redirectURL: return CURLINFO_REDIRECT_URL case .localIP: return CURLINFO_LOCAL_IP case .primaryIP: return CURLINFO_PRIMARY_IP case .contentType: return CURLINFO_CONTENT_TYPE } } func get(_ from: CURLResponse) -> String? { let (i, code): (String, CURLcode) = from.curl.getInfo(infoValue) guard code == CURLE_OK else { return nil } return i } } extension CURLResponse.Info.IntValue: CURLResponseInfo { typealias ValueType = Int private var infoValue: CURLINFO { switch self { case .responseCode: return CURLINFO_RESPONSE_CODE case .headerSize: return CURLINFO_HEADER_SIZE case .requestSize: return CURLINFO_REQUEST_SIZE case .sslVerifyResult: return CURLINFO_SSL_VERIFYRESULT case .fileTime: return CURLINFO_FILETIME case .redirectCount: return CURLINFO_REDIRECT_COUNT case .httpConnectCode: return CURLINFO_HTTP_CONNECTCODE case .httpAuthAvail: return CURLINFO_HTTPAUTH_AVAIL case .proxyAuthAvail: return CURLINFO_PROXYAUTH_AVAIL case .osErrno: return CURLINFO_OS_ERRNO case .numConnects: return CURLINFO_NUM_CONNECTS case .conditionUnmet: return CURLINFO_CONDITION_UNMET case .primaryPort: return CURLINFO_PRIMARY_PORT case .localPort: return CURLINFO_LOCAL_PORT // case .httpVersion: return CURLINFO_HTTP_VERSION } } func get(_ from: CURLResponse) -> Int? { let (i, code): (Int, CURLcode) = from.curl.getInfo(infoValue) guard code == CURLE_OK else { return nil } return i } } extension CURLResponse.Info.DoubleValue: CURLResponseInfo { typealias ValueType = Double private var infoValue: CURLINFO { switch self { case .totalTime: return CURLINFO_TOTAL_TIME case .nameLookupTime: return CURLINFO_NAMELOOKUP_TIME case .connectTime: return CURLINFO_CONNECT_TIME case .preTransferTime: return CURLINFO_PRETRANSFER_TIME case .sizeUpload: return CURLINFO_SIZE_UPLOAD case .sizeDownload: return CURLINFO_SIZE_DOWNLOAD case .speedDownload: return CURLINFO_SPEED_DOWNLOAD case .speedUpload: return CURLINFO_SPEED_UPLOAD case .contentLengthDownload: return CURLINFO_CONTENT_LENGTH_DOWNLOAD case .contentLengthUpload: return CURLINFO_CONTENT_LENGTH_UPLOAD case .startTransferTime: return CURLINFO_STARTTRANSFER_TIME case .redirectTime: return CURLINFO_REDIRECT_TIME case .appConnectTime: return CURLINFO_APPCONNECT_TIME } } func get(_ from: CURLResponse) -> Double? { let (d, code): (Double, CURLcode) = from.curl.getInfo(infoValue) guard code == CURLE_OK else { return nil } return d } }
[ -1 ]
96ebbeb541c5b07b729ab7067c6cdc4b859d3b44
ac6f1e20ecff080e24630ee22318ffea5f3e6afc
/Example/Use Code/Example/AppDelegate.swift
72ea1fd4d30057e01b615f803fd5dc4f82f02830
[ "MIT" ]
permissive
zhourihu5/WMPageController-Swift
17f598c1e4cc0eb4712668575d0913543c4c81e7
3694245bafd55424af13e8efe0338a4178a6a275
refs/heads/master
2021-01-20T05:36:15.282529
2016-03-05T08:13:46
2016-03-05T08:13:46
null
0
0
null
null
null
null
UTF-8
Swift
false
false
4,890
swift
// // AppDelegate.swift // Example // // Created by Mark on 15/12/1. // Copyright © 2015年 Wecan Studio. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. let pageController = customedPageController() window?.rootViewController = UINavigationController(rootViewController: pageController) // reloadPageController(pageController, afterDelay: 5.0) // updatePageController(pageController, title: "hahahahaha", afterDelay: 5.0) return true } func applicationWillResignActive(application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } func applicationDidEnterBackground(application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } // MARK: - An example of `PageController` private func customedPageController() -> PageController { let vcClasses: [UIViewController.Type] = [ViewController.self, TableViewController.self] let titles = ["Hello", "World"] let pageController = PageController(vcClasses: vcClasses, theirTitles: titles) pageController.pageAnimatable = true pageController.menuViewStyle = MenuViewStyle.Line pageController.bounces = true pageController.menuHeight = 44 pageController.titleSizeSelected = 15 pageController.values = ["Hello", "I'm Mark"] // pass values pageController.keys = ["type", "text"] // keys pageController.title = "Test" pageController.menuBGColor = .clearColor() pageController.showOnNavigationBar = true // pageController.selectedIndex = 1 // pageController.progressColor = .blackColor() // pageController.viewFrame = CGRect(x: 50, y: 100, width: 320, height: 500) // pageController.itemsWidths = [100, 50] // pageController.itemsMargins = [50, 10, 100] // pageController.titleSizeNormal = 12 // pageController.titleSizeSelected = 14 // pageController.titleColorNormal = UIColor.brownColor() // pageController.titleColorSelected = UIColor.blackColor() return pageController } private func reloadPageController(pageController: PageController, afterDelay delay: NSTimeInterval) { let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(delay * Double(NSEC_PER_SEC))) dispatch_after(delayTime, dispatch_get_main_queue()) { pageController.titles = ["Hello", "World", "Reload"] pageController.viewControllerClasses = [ViewController.self, TableViewController.self, ViewController.self] pageController.values = ["Hello", "I'm Mark", "Reload"] pageController.keys = ["type", "text", "type"] pageController.reloadData() } } private func updatePageController(pageController: PageController, title: String, afterDelay delay: NSTimeInterval) { let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(delay * Double(NSEC_PER_SEC))) dispatch_after(delayTime, dispatch_get_main_queue()) { pageController.updateTitle(title, atIndex: 1, andWidth: 150) } } }
[ -1 ]
5c0ecfeaec132f26838a9fb06d32d487639d8dfe
129faaaddc7d27af0764f90a65c1bbb7fc9fab20
/Swift Geometry/CanvasViewController.swift
e482fc8d6e0fd8a905acac8f9b7a9270a4e5652f
[]
no_license
ViktorLajos/linesegments
817492cfe3344c7e83d8356206c701694cab4d8a
65fee8837cb73e0125592f91d671bd96a9c48d6b
refs/heads/master
2021-01-22T00:10:04.790998
2015-11-16T21:18:42
2015-11-16T21:18:42
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,335
swift
// // ViewController.swift // Swift Geometry // // Created by Jory Stiefel on 11/6/15. // Copyright © 2015 Jory Stiefel. All rights reserved. // import Cocoa class CanvasViewController: NSViewController { lazy var dataManager = { return CanvasDataManager.sharedManager }() private var startingPoint: CGPoint? = nil @IBOutlet weak var midpointsButton: NSButton! @IBOutlet weak var hintLabel: NSTextField! override func viewDidAppear() { super.viewDidAppear() let seconds = 3.0 let dispatchTime = dispatch_time(DISPATCH_TIME_NOW, Int64(seconds * Double(NSEC_PER_SEC))) hintLabel.wantsLayer = true dispatch_after(dispatchTime, dispatch_get_main_queue(), { let animation = CABasicAnimation(keyPath: "opacity") animation.fromValue = 1.0 animation.toValue = 0.0 animation.duration = 0.35 self.hintLabel.layer?.addAnimation(animation, forKey: "fadeout") self.hintLabel.layer?.opacity = 0.0 }) } override var representedObject: AnyObject? { didSet { // Update the view, if already loaded. } } override func mouseDown(theEvent: NSEvent) { startingPoint = theEvent.locationInWindow } override func mouseDragged(theEvent: NSEvent) { if startingPoint != nil { dataManager.activeSegment = LineSegment(startingPoint!, theEvent.locationInWindow) view.needsDisplay = true } } override func mouseUp(theEvent: NSEvent) { if dataManager.activeSegment != nil { dataManager.testSegments.append(dataManager.activeSegment!) dataManager.activeSegment = nil } } @IBAction func clickedClear(sender: AnyObject) { dataManager.testSegments = [] view.needsDisplay = true } @IBAction func clickedShowMidpoints(sender: AnyObject) { if midpointsButton.title == "Show Midpoints" { dataManager.showMidpoints = true midpointsButton.title = "Hide Midpoints" } else { dataManager.showMidpoints = false midpointsButton.title = "Show Midpoints" } view.needsDisplay = true } }
[ -1 ]
503a156ab711fdfedb5355fad1c37fb4bffb2a1c
8ea53c0f081fc4f4aa2cb01dd35dd78d6d80f71f
/AppleMusicStApp/Player/SimplePlayer.swift
d08e027c18f369ede4f0df81f441a0641cea144f
[]
no_license
KeunHyeong/AppleMusicStApp
f2f85ffe65c4bb0f9317ebf1d61de415b5558cf7
feaa3a01f3dfa3e38934eba423c06ce665bf5324
refs/heads/master
2022-12-29T02:21:46.019981
2020-10-17T04:14:26
2020-10-17T04:14:26
304,020,310
0
0
null
null
null
null
UTF-8
Swift
false
false
1,515
swift
// // SimplePlayer.swift // AppleMusicStApp // // Created by keunhyeong on 2020/10/04. // Copyright © 2020 KeunHyeong. All rights reserved. // import AVFoundation class SimplePlayer { // TODO: 싱글톤 만들기, 왜 만드는가? static let shared = SimplePlayer() private let player = AVPlayer() var currentTime: Double { // TODO: currentTime 구하기 return player.currentItem?.currentTime().seconds ?? 0 } var totalDurationTime: Double { // TODO: totalDurationTime 구하기 return player.currentItem?.duration.seconds ?? 0 } var isPlaying: Bool { // TODO: isPlaying 구하기 return player.isPlaying } var currentItem: AVPlayerItem? { // TODO: currentItem 구하기 return player.currentItem } init() { } func pause() { // TODO: pause구현 player.pause() } func play() { // TODO: play구현 player.play() } func seek(to time:CMTime) { // TODO: seek구현 player.seek(to: time) } func replaceCurrentItem(with item: AVPlayerItem?) { // TODO: replace current item 구현 player.replaceCurrentItem(with: item) } func addPeriodicTimeObserver(forInterval: CMTime, queue: DispatchQueue?, using: @escaping (CMTime) -> Void) { player.addPeriodicTimeObserver(forInterval: forInterval, queue: queue, using: using) } }
[ -1 ]
8d6665adbad228180882e9d2e4a2e5e70c6ca04a
74da583c68d150c0efabca5828d0f4bdbf6f52b7
/SubmissionGame/SubmissionGame/Core/Utils/View/TabItem.swift
eeda66e7ee27281b4fa0afdff6c61635d7b8458b
[]
no_license
muhyidinamin/game-catalogue-expert-modular
e7db8f6a07b1af16c80b0c07ec93938d188cae60
8a0e7428b5187fc0cf0cc08d980405248521d056
refs/heads/master
2023-03-05T16:08:28.354404
2021-02-17T19:14:09
2021-02-17T19:14:09
339,592,141
0
0
null
null
null
null
UTF-8
Swift
false
false
343
swift
// // TabItem.swift // SubmissionGame // // Created by Muhamad Muhyidin Amin on 24/01/21. // Copyright © 2021 Amint Dev Labs. All rights reserved. // import SwiftUI struct TabItem: View { var imageName: String var title: String var body: some View { VStack { Image(systemName: imageName) Text(title) } } }
[ -1 ]
4f29ca0f6481774df59c8438703e04c4e8231a77
84e0080e73bd32fe946e38abeb0f7b7b4d5dd8ab
/SimpleMVVMRestAPI/Resources/AppDelegate.swift
6c37fa00f645411b7de073c8987c5aef178171cc
[]
no_license
davidyoon891122/SimpleMVVMRestAPI
a7ce320de49482cfdbea27efd00bdcd6b5140a66
a2067c4797b2efbcbcaec628642480f1836c9c32
refs/heads/main
2023-06-27T00:22:34.579045
2021-08-03T12:41:00
2021-08-03T12:41:00
391,996,127
0
0
null
null
null
null
UTF-8
Swift
false
false
1,357
swift
// // AppDelegate.swift // SimpleMVVMRestAPI // // Created by David Yoon on 2021/08/02. // import UIKit @main class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } // MARK: UISceneSession Lifecycle func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { // Called when a new scene session is being created. // Use this method to select a configuration to create the new scene with. return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) } func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) { // Called when the user discards a scene session. // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. // Use this method to release any resources that were specific to the discarded scenes, as they will not return. } }
[ 393222, 393224, 393230, 393250, 344102, 393261, 393266, 213048, 385081, 376889, 393275, 376905, 327756, 254030, 286800, 368727, 180313, 368735, 180320, 376931, 286831, 368752, 286844, 417924, 262283, 286879, 286888, 377012, 327871, 377036, 180431, 377046, 418007, 418010, 377060, 327914, 205036, 393456, 393460, 418043, 336123, 385280, 336128, 262404, 180490, 164106, 368911, 262416, 262422, 377117, 262436, 336180, 262454, 393538, 262472, 344403, 213332, 65880, 262496, 418144, 262499, 213352, 246123, 262507, 262510, 213372, 385419, 393612, 262550, 262552, 385440, 385443, 262566, 385451, 262573, 393647, 385458, 262586, 344511, 262592, 360916, 369118, 328177, 328179, 328182, 328189, 328192, 164361, 410128, 393747, 254490, 188958, 385570, 33316, 377383, 197159, 352821, 197177, 418363, 188987, 369223, 385609, 385616, 352864, 369253, 262760, 352874, 352887, 254587, 377472, 148105, 377484, 352918, 98968, 344744, 361129, 336555, 385713, 434867, 164534, 336567, 328378, 164538, 328386, 352968, 344776, 352971, 418507, 352973, 385742, 385748, 361179, 189153, 369381, 361195, 418553, 344831, 336643, 344835, 344841, 361230, 336659, 418580, 418585, 434970, 369435, 418589, 262942, 418593, 336675, 328484, 418598, 418605, 336696, 361273, 328515, 336708, 328519, 361288, 336711, 328522, 336714, 426841, 254812, 361309, 197468, 361315, 361322, 328573, 377729, 369542, 361360, 222128, 345035, 386003, 345043, 386011, 386018, 386022, 435187, 328702, 328714, 361489, 386069, 386073, 336921, 336925, 345118, 377887, 345133, 345138, 386101, 361536, 197707, 189520, 345169, 156761, 361567, 148578, 345199, 386167, 361593, 410745, 361598, 214149, 345222, 386186, 337047, 345246, 214175, 337071, 337075, 386258, 328924, 66782, 222437, 386285, 328941, 386291, 345376, 353570, 345379, 410917, 345382, 337205, 345399, 378169, 369978, 337222, 337229, 337234, 263508, 402791, 345448, 271730, 378227, 271745, 181638, 353673, 181643, 181649, 181654, 230809, 181670, 181673, 181678, 181681, 337329, 181684, 181690, 361917, 181696, 337349, 181703, 337365, 271839, 329191, 361960, 329194, 116210, 337398, 337415, 329226, 419339, 419343, 419349, 345625, 419355, 370205, 419359, 394786, 419362, 370213, 419368, 419376, 206395, 214593, 419400, 419402, 353867, 419406, 419410, 394853, 345701, 222830, 370297, 403070, 403075, 345736, 198280, 403091, 345749, 419483, 345757, 345762, 419491, 345765, 419497, 419501, 370350, 419506, 419509, 419512, 337592, 419517, 337599, 419527, 419530, 419535, 272081, 419542, 394966, 419544, 181977, 345818, 419547, 419550, 419559, 337642, 419563, 337645, 370415, 337659, 141051, 337668, 362247, 395021, 362255, 116509, 345887, 378663, 345905, 354106, 354111, 247617, 354117, 370503, 329544, 345930, 370509, 354130, 247637, 337750, 370519, 313180, 354142, 354150, 354156, 345964, 345967, 345970, 345974, 403320, 354172, 247691, 337808, 247700, 329623, 436126, 436132, 337833, 362413, 337844, 346057, 247759, 346063, 329697, 354277, 190439, 247789, 354313, 346139, 436289, 378954, 395339, 338004, 100453, 329832, 329855, 329867, 329885, 411805, 346272, 362660, 100524, 387249, 379066, 387260, 256191, 395466, 346316, 411861, 411864, 411868, 411873, 379107, 411876, 387301, 346343, 338152, 387306, 387312, 346355, 436473, 321786, 379134, 411903, 411916, 379152, 395538, 387349, 338199, 387352, 182558, 338211, 395566, 248111, 362822, 436555, 190796, 379233, 354673, 321910, 248186, 420236, 379278, 272786, 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, 436962, 338660, 338664, 264941, 363251, 207619, 264964, 338700, 256786, 199452, 363293, 396066, 346916, 396069, 215853, 355122, 355131, 355140, 355143, 338763, 355150, 330580, 355166, 265055, 265058, 355175, 387944, 355179, 330610, 330642, 355218, 412599, 207808, 379848, 396245, 330710, 248792, 248798, 347105, 257008, 183282, 265207, 330748, 265214, 330760, 330768, 248862, 396328, 347176, 158761, 199728, 396336, 330800, 396339, 339001, 388154, 388161, 347205, 248904, 330826, 248914, 412764, 339036, 257120, 265320, 248951, 420984, 330889, 347287, 248985, 339097, 44197, 380070, 339112, 249014, 126144, 330958, 330965, 265432, 265436, 388319, 388347, 175375, 159005, 175396, 208166, 273708, 347437, 372015, 347441, 372018, 199988, 44342, 175415, 396600, 437566, 175423, 437570, 437575, 437583, 331088, 437587, 331093, 396633, 175450, 437595, 175457, 208227, 175460, 175463, 265580, 437620, 175477, 249208, 175483, 175486, 249214, 175489, 249218, 249224, 249227, 249234, 175513, 175516, 396705, 175522, 355748, 380332, 396722, 208311, 388542, 372163, 216517, 380360, 216522, 339404, 372176, 208337, 339412, 413141, 339417, 339420, 249308, 339424, 249312, 339428, 339434, 249328, 69113, 372228, 208398, 380432, 175635, 265778, 265795, 396872, 265805, 224853, 224857, 257633, 224870, 372327, 257646, 372337, 224884, 224887, 224890, 224894, 224897, 372353, 216707, 126596, 421508, 224904, 224909, 11918, 159374, 224913, 126610, 339601, 224916, 224919, 126616, 224922, 208538, 224926, 224929, 224932, 224936, 257704, 224942, 257712, 224947, 257716, 257720, 224953, 257724, 224959, 257732, 224965, 224969, 339662, 224975, 257747, 224981, 224986, 257761, 224993, 257764, 224999, 339695, 225012, 257787, 225020, 339710, 257790, 225025, 257794, 339721, 257801, 257804, 225038, 257807, 225043, 372499, 167700, 225048, 257819, 225053, 184094, 225058, 257833, 225066, 257836, 413484, 225070, 225073, 372532, 257845, 225079, 397112, 225082, 397115, 225087, 225092, 225096, 323402, 257868, 225103, 257871, 397139, 225108, 225112, 257883, 257886, 225119, 257890, 339814, 225127, 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, 372738, 405533, 430129, 266294, 266297, 421960, 356439, 430180, 421990, 266350, 356466, 266362, 381068, 225423, 250002, 250004, 225429, 356506, 225437, 135327, 225441, 438433, 225444, 438436, 225447, 438440, 225450, 258222, 225455, 430256, 225458, 225461, 225466, 389307, 225470, 381120, 372929, 430274, 225475, 389320, 225484, 225487, 225490, 225493, 266453, 225496, 225499, 225502, 225505, 356578, 225510, 217318, 225514, 225518, 372976, 381176, 397571, 389380, 356637, 356640, 356643, 356646, 266536, 356649, 356655, 332080, 340275, 356660, 397622, 332090, 225597, 332097, 201028, 348488, 332106, 332117, 348502, 250199, 250202, 332125, 250210, 348522, 348525, 348527, 332152, 389502, 250238, 332161, 356740, 332172, 373145, 340379, 389550, 324030, 266687, 160234, 127471, 340472, 381436, 324094, 266754, 324099, 324102, 324111, 340500, 324117, 324131, 332324, 381481, 356907, 324139, 324142, 356916, 324149, 324155, 348733, 324164, 356934, 348743, 381512, 324170, 324173, 324176, 389723, 332380, 373343, 381545, 340627, 373398, 184982, 258721, 332453, 332459, 389805, 332463, 381617, 332471, 332483, 332486, 373449, 332493, 357069, 357073, 332511, 332520, 340718, 332533, 348924, 389892, 373510, 389926, 348978, 152370, 340789, 348982, 398139, 127814, 357201, 357206, 389978, 430939, 357211, 357214, 201579, 201582, 349040, 340849, 201588, 430965, 381813, 324472, 398201, 340858, 324475, 430972, 340861, 324478, 119674, 324481, 373634, 398211, 324484, 324487, 381833, 324492, 324495, 324498, 430995, 324501, 324510, 422816, 324513, 398245, 201637, 324524, 340909, 324533, 324538, 324541, 398279, 340939, 340941, 209873, 340957, 431072, 398306, 340963, 209895, 201711, 349172, 381946, 349180, 439294, 431106, 209943, 357410, 250914, 185380, 357418, 209965, 209968, 209971, 209975, 209979, 209987, 209990, 209995, 341071, 349267, 250967, 210010, 341091, 210025, 210027, 210030, 210036, 210039, 349308, 210044, 349311, 160895, 152703, 210052, 349319, 210055, 218247, 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, 349491, 251189, 415033, 251210, 357708, 210260, 365911, 259421, 365921, 333154, 251235, 374117, 333162, 234866, 390516, 333175, 357755, 251271, 136590, 374160, 112020, 349590, 357792, 259515, 415166, 415185, 366034, 366038, 415191, 415193, 415196, 415199, 423392, 333284, 415207, 366056, 366061, 415216, 210420, 415224, 423423, 415257, 415263, 366117, 415270, 144939, 415278, 415281, 415285, 210487, 415290, 415293, 349761, 415300, 333386, 366172, 333413, 423528, 423532, 210544, 415353, 333439, 415361, 267909, 333498, 210631, 333511, 358099, 153302, 333534, 366307, 366311, 431851, 366318, 210672, 366321, 366325, 210695, 268041, 210698, 366348, 210706, 399128, 333594, 210719, 358191, 366387, 210739, 399159, 358200, 325440, 366401, 341829, 325446, 46920, 341834, 341838, 341843, 415573, 358234, 341851, 350045, 399199, 259938, 399206, 268143, 358255, 399215, 358259, 341876, 243579, 325504, 333698, 333708, 333724, 382890, 350146, 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, 375053, 268559, 350480, 432405, 350486, 325914, 350490, 325917, 350493, 325919, 350498, 194852, 350504, 358700, 391468, 350509, 358704, 358713, 358716, 383306, 334161, 383321, 383330, 383333, 391530, 383341, 334203, 268668, 194941, 391563, 366990, 416157, 342430, 268701, 375208, 326058, 375216, 334262, 334275, 326084, 358856, 195039, 334304, 334311, 375277, 334321, 350723, 391690, 186897, 342545, 334358, 342550, 342554, 334363, 350761, 252461, 334384, 383536, 358961, 334394, 252482, 219718, 334407, 334420, 350822, 375400, 334465, 334468, 162445, 326290, 342679, 342683, 260766, 342710, 244409, 260797, 260801, 350917, 154317, 391894, 154328, 416473, 64230, 113388, 342766, 375535, 203506, 342776, 391937, 391948, 375568, 326416, 375571, 375574, 162591, 326441, 383793, 326451, 326454, 326460, 260924, 375612, 244540, 326467, 244551, 326473, 326477, 326485, 416597, 326490, 342874, 326502, 375656, 433000, 326507, 326510, 211825, 211831, 351097, 392060, 359295, 351104, 342915, 400259, 236430, 342930, 252822, 392091, 400285, 252836, 359334, 211884, 400306, 351168, 359361, 326598, 359366, 359382, 359388, 383967, 343015, 359407, 261108, 244726, 261111, 383997, 261129, 359451, 261147, 211998, 261153, 261159, 359470, 359476, 343131, 384098, 384101, 384107, 367723, 187502, 343154, 384114, 212094, 351364, 384135, 384139, 384143, 351381, 384160, 384168, 367794, 384181, 367800, 384191, 351423, 326855, 244937, 253130, 343244, 146642, 359649, 343270, 351466, 351479, 343306, 261389, 359694, 384269, 253200, 261393, 384275, 245020, 245029, 171302, 351534, 376110, 245040, 425276, 384323, 212291, 343365, 212303, 367965, 343393, 343398, 367980, 425328, 343409, 253303, 154999, 343417, 327034, 245127, 384397, 245136, 245142, 245145, 343450, 245148, 245151, 245154, 245157, 245162, 327084, 359865, 384443, 146876, 327107, 384453, 327110, 327115, 327117, 359886, 359890, 343507, 368092, 343534, 343539, 368119, 343544, 368122, 409091, 359947, 359955, 359983, 343630, 179802, 155239, 327275, 245357, 138864, 155254, 155273, 368288, 245409, 425638, 425649, 155322, 425662, 155327, 155351, 155354, 212699, 155363, 245475, 155371, 245483, 409335, 155393, 155403, 155422, 360223, 155438, 155442, 155447, 417595, 360261, 155461, 376663, 155482, 261981, 425822, 155487, 376671, 155490, 155491, 327531, 261996, 376685, 261999, 262002, 327539, 147317, 262005, 425845, 262008, 262011, 155516, 155521, 155525, 360326, 376714, 155531, 262027, 262030, 262033, 262036, 262039, 262042, 155549, 262045, 262048, 262051, 327589, 155559, 155562, 155565, 393150, 393169, 384977, 155611, 155619, 253923, 155621, 253926, 327654, 204784, 393203, 360438, 253943, 393206, 393212, 155646 ]
b6ba082993e2c8e311113820e0de7583f5488cc7
f85e06fcf28562e6911680691f179f8782fb40af
/Shopping List/View Controllers/ShoppingListCollectionViewController.swift
69a006ead3319de67c83f8cbeb1245340840a6a3
[]
no_license
alexnrhodes/ios-sprint-challenge-shopping-list
cde0318ff6d1d0aac222d9666a03fe080fc245b9
2046c5788a740b94e13ec26ef6c972fe874d54de
refs/heads/master
2020-07-09T16:17:59.084552
2019-08-24T19:22:40
2019-08-24T19:22:40
199,039,231
0
0
null
2019-07-26T15:19:42
2019-07-26T15:19:42
null
UTF-8
Swift
false
false
2,434
swift
// // ShoppingListCollectionViewController.swift // Shopping List // // Created by Alex Rhodes on 8/23/19. // Copyright © 2019 Lambda School. All rights reserved. // import UIKit private let reuseIdentifier = "ItemCell" class ShoppingListCollectionViewController: UICollectionViewController { var itemController = ItemController() override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) collectionView?.reloadData() setViews() } func setViews() { } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "CheckoutSegue" { guard let checkoutVC = segue.destination as? CheckoutViewController else {return} checkoutVC.itemController = itemController } } // MARK: UICollectionViewDataSource override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return itemController.items.count } override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath) as? ShoppingItemCollectionViewCell else {return UICollectionViewCell()} cell.item = itemController.items[indexPath.row] switch indexPath.row { case 0: cell.imageView.image = UIImage(named: .apple) case 1: cell.imageView.image = UIImage(named: .grapes) case 2: cell.imageView.image = UIImage(named: .milk) case 3: cell.imageView.image = UIImage(named: .muffin) case 4: cell.imageView.image = UIImage(named: .popcorn) case 5: cell.imageView.image = UIImage(named: .soda) case 6: cell.imageView.image = UIImage(named: .strawberreis) default: return UICollectionViewCell() } return cell } override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { let item = itemController.items[indexPath.row] itemController.updateHasSeen(foritem: item) collectionView.reloadItems(at: [indexPath]) } }
[ -1 ]
b27e91bbaf713eaaa72d43bf9f049bc1e57d15fb
131f887c3875b22517fed9c4fc306295f6ab23a2
/StoreSearch/SearchResultCell.swift
b964eb864f78046a31f1dc97bb6a8d642a215d1e
[]
no_license
boule7ya/storeSearch
5bf36d3ccc013c5233f7f3c91de4255ab7153b0e
e98bff7d54aa8ed028a9089d924426c85ebffe04
refs/heads/master
2020-11-30T19:54:35.525219
2019-12-06T13:48:05
2019-12-06T13:48:05
230,467,176
0
0
null
null
null
null
UTF-8
Swift
false
false
1,601
swift
import UIKit class SearchResultCell: UITableViewCell { var downloadTask: URLSessionDownloadTask? @IBOutlet weak var nameLabel: UILabel! @IBOutlet weak var artistNameLabel: UILabel! @IBOutlet weak var artworkImageView: UIImageView! override func awakeFromNib() { super.awakeFromNib() let selectedView = UIView(frame: CGRect.zero) selectedView.backgroundColor = UIColor(red: 20/255, green: 160/255, blue: 160/255, alpha: 0.5) selectedBackgroundView = selectedView } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } override func prepareForReuse() { super.prepareForReuse() downloadTask?.cancel() downloadTask = nil } // MARK:- Public Methods func configure(for result: SearchResult) { nameLabel.text = result.name if result.artist.isEmpty { artistNameLabel.text = NSLocalizedString("Unknown", comment: "artist is unknown") } else { artistNameLabel.text = String(format: NSLocalizedString("ARTIST_NAME_LABEL_FORMAT", comment: "Format for artist name"), result.artist, result.type) } artworkImageView.image = UIImage(named: "Placeholder") if let smallURL = URL(string: result.imageSmall) { downloadTask = artworkImageView.loadImage(url: smallURL) } } }
[ 295184, 334405 ]
f77f194d67db01cea07668b2fc0981e56fecc82b
d89b732299c4466a9c570773161dc43df410b123
/UserLoginAndRegistration/Database.swift
151a36b7071514c884e819e394669b48ac945d63
[]
no_license
Rittikhun/final_Project
32ed811f4935799b6c71d5e67be001defc07bd23
117cca892906bb970c44e3ea8d4f90d4b41c7f53
refs/heads/master
2021-01-13T11:32:42.308434
2017-06-03T14:05:59
2017-06-03T14:05:59
81,193,414
1
0
null
null
null
null
UTF-8
Swift
false
false
7,025
swift
// // Database.swift // sqlLite // // Created by iOS Dev on 11/14/2559 BE. // Copyright © 2559 iOS Dev. All rights reserved. // import Foundation class Database { fileprivate var databasePathString:String! = nil fileprivate var database:OpaquePointer? = nil struct Memo { var username: String = "" var name: String = "" var password: String = "" } struct friend { var username: String = "" var friendusername: String = "" } struct property { static var shareInstance: Database! = nil } fileprivate init() { } static fileprivate func createDB() -> Bool { let db = Database() var isSuccess:Bool = true; let fm = FileManager.default //Get Documents url do { print("kuyaum") let docsurl = try fm.url( for: FileManager.SearchPathDirectory.documentDirectory, in: FileManager.SearchPathDomainMask.userDomainMask, appropriateFor: nil, create: true) // Creat folder let myFolderUrl = docsurl.appendingPathComponent("Database") try fm.createDirectory(at: myFolderUrl, withIntermediateDirectories: true, attributes: nil) // Create path to database file let myDbFileUrl = myFolderUrl.appendingPathComponent("projectios.sqlite") db.databasePathString = myDbFileUrl.path print(myDbFileUrl) if(!fm.fileExists(atPath: db.databasePathString)){ print("dsadjklasdaskldjasldkasjdklas;djsalkdj") // Db File not exists. Lets make one if(sqlite3_open(db.databasePathString, &db.database) == SQLITE_OK){ var errMSG:UnsafeMutablePointer<Int8>? = nil let text = "CREATE TABLE \"user\" (\"email\" TEXT PRIMARY KEY NOT NULL , \"password\" TEXT, \"name\" TEXT)" let sql_stmt = text.cString(using: String.Encoding.utf8); if(sqlite3_exec(db.database, sql_stmt!, nil, nil, &errMSG) != SQLITE_OK){ isSuccess = false NSLog("Failed to create memo table") } sqlite3_close(db.database); // Store shared when successful property.shareInstance = db; }else{ isSuccess = false NSLog("Failed to open/create database"); } }else{ property.shareInstance = db; } }catch{ } return isSuccess } static func getSharedInstance() -> Database{ if (property.shareInstance == nil) { createDB(); } return property.shareInstance } // Create record and return the record number func addNote(_ name:String, username:String, password:String) -> Int{ var recordNumber:Int = 1; var statement:OpaquePointer? = nil; print("no eiei") if (sqlite3_open(self.databasePathString, &self.database) == SQLITE_OK) { } if (sqlite3_open(self.databasePathString, &self.database) == SQLITE_OK){ print("eiei no") var errMsg:UnsafeMutablePointer<Int8>? = nil let insertSQL = "INSERT INTO USER (EMAIL, PASSWORD, NAME) VALUES (\"" + name + "\",\"" + username + "\",\"" + password + "\")" var sql_stmt = insertSQL.cString(using: String.Encoding.utf8) if (sqlite3_exec(self.database, sql_stmt!, nil, nil, &errMsg) != SQLITE_OK){ NSLog("Failed to insert into memo table "); }else{ // Get the latest record number let lookupSQL = "SELECT MAX(username) FROM user" sql_stmt = lookupSQL.cString(using: String.Encoding.utf8) sqlite3_prepare_v2(self.database, sql_stmt!, -1, &statement, nil); if (sqlite3_step(statement) == SQLITE_ROW) { recordNumber = Int(sqlite3_column_int(statement, 0)); } sqlite3_finalize(statement); sqlite3_close(database); print("ssuv") } } return recordNumber; } // // func countRecords() -> Int{ // var recordNumber:Int = 1; // var statement:OpaquePointer? = nil; // // if (sqlite3_open(self.databasePathString, &self.database) == SQLITE_OK) // { // // Get the latest record number // let lookupSQL = "SELECT count(Record) FROM RecordSet" // let sql_stmt = lookupSQL.cString(using: String.Encoding.utf8) // // sqlite3_prepare_v2(self.database, sql_stmt!,-1, &statement, nil) // if (sqlite3_step(statement) == SQLITE_ROW){ // recordNumber = Int(sqlite3_column_int(statement, 0)); // } // // sqlite3_finalize(statement); // sqlite3_close(database); // // } // return recordNumber; // } func getNote(_ email:String) -> Memo{ print("asds") var result:Memo = Memo(); var statement:OpaquePointer? = nil; print(self.databasePathString) if (sqlite3_open(self.databasePathString, &self.database) == SQLITE_OK) { } if (sqlite3_open(self.databasePathString, &self.database) == SQLITE_OK){ // Get the latest record number print(email) let lookupSQL = "SELECT email, password, name FROM user WHERE email = \"" + email + "\"" let sql_stmt = lookupSQL.cString(using: String.Encoding.utf8) sqlite3_prepare_v2(self.database, sql_stmt!,-1, &statement, nil) if (sqlite3_step(statement) == SQLITE_ROW){ result.username = String(cString: UnsafePointer(sqlite3_column_text(statement, 0))) result.name = String(cString: UnsafePointer(sqlite3_column_text(statement, 2))) result.password = String(cString: UnsafePointer(sqlite3_column_text(statement, 1))) } sqlite3_finalize(statement); sqlite3_close(database); } return result; } }
[ -1 ]
09f424b84ee05d71e0b5aca6bf3439a34c27beed
a44945f0cd276696452b58fe5c528dc83d6c7247
/YourHealthWallet/ReusableInterfaces/Data/HelperFunctions.swift
3d7fb061462fef9121e8ebae49cdfa8222fc777f
[]
no_license
akbarikeyur/YHW
eae91d5f2ed4d2db86612e47720be8038bf8815f
a8fb9149078702bf483092edded6755dfd9def8b
refs/heads/master
2020-08-01T18:54:17.137584
2019-09-26T12:24:54
2019-09-26T12:24:54
211,082,300
0
0
null
null
null
null
UTF-8
Swift
false
false
10,742
swift
// // swift // Juicer // // Created by Shridhar on 2/12/16. // Copyright (c) 2015 Digital Juice. All rights reserved. // import UIKit import Contacts import AddressBook import MessageUI public func installMatchSuperViewWithChildView(superView : UIView, childView : UIView) { superView.addConstraint(NSLayoutConstraint(item: childView, attribute: NSLayoutAttribute.width, relatedBy: NSLayoutRelation.equal, toItem: superView, attribute: NSLayoutAttribute.width, multiplier: 1.0, constant: 0.0)) superView.addConstraint(NSLayoutConstraint(item: childView, attribute: NSLayoutAttribute.height, relatedBy: NSLayoutRelation.equal, toItem: superView, attribute: NSLayoutAttribute.height, multiplier: 1.0, constant: 0.0)) superView.addConstraint(NSLayoutConstraint(item: childView, attribute: NSLayoutAttribute.centerX, relatedBy: NSLayoutRelation.equal, toItem: superView, attribute: NSLayoutAttribute.centerX, multiplier: 1.0, constant: 0.0)) superView.addConstraint(NSLayoutConstraint(item: childView, attribute: NSLayoutAttribute.centerY, relatedBy: NSLayoutRelation.equal, toItem: superView, attribute: NSLayoutAttribute.centerY, multiplier: 1.0, constant: 0.0)) } public func isPortrait() -> Bool{ return UIInterfaceOrientationIsPortrait(UIApplication.shared.statusBarOrientation) } public func isLandscape() -> Bool{ return UIInterfaceOrientationIsLandscape(UIApplication.shared.statusBarOrientation) } public func createFolderAtPathIfNotExists(folderPath : String){ var isDir : ObjCBool = false if( FileManager.default.fileExists(atPath: folderPath, isDirectory: &isDir) == false){ do { try FileManager.default.createDirectory(atPath: folderPath, withIntermediateDirectories: true, attributes: nil) } catch _ { } } } public func isValidEmailID(checkString : String?) -> Bool{ let stricterFilterString : String = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}" let emailTest : NSPredicate = NSPredicate(format: "SELF MATCHES %@", stricterFilterString) return emailTest.evaluate(with: checkString) } public func documentsDirectory() -> String { let documentsFolderPath = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.userDomainMask, true)[0] return documentsFolderPath } // Get path for a file in the directory public func fileInDocumentsDirectory(filename: String) -> String { let writePath = (documentsDirectory() as NSString).appendingPathComponent("Contacts") if (!FileManager.default.fileExists(atPath: writePath)) { do { try FileManager.default.createDirectory(atPath: writePath, withIntermediateDirectories: false, attributes: nil) } catch let error as NSError { print(error.localizedDescription); } } return (writePath as NSString).appendingPathComponent(filename) } public func showNetworkActivityIndicator(){ UIApplication.shared.isNetworkActivityIndicatorVisible = true } public func hideNetworkActivityIndicator(){ UIApplication.shared.isNetworkActivityIndicatorVisible = false } public func failAssert() { assert(0 != 0, "") } public func failAssertWithMsg(msg : String) { assert(0 != 0, msg) } public func intToString(value : Int) -> String{ return String(format: "%d", value) } public func int32ToString(value : Int32) -> String{ return String(format: "%ld", value) } public func floatToString(value : Float) -> String{ return String(format: "%f", value) } public func sizeOfWindowWrtEye() -> CGSize{ return (UIApplication.shared.delegate?.window??.bounds.size)! } public func degreesToRadians(deg : Int) -> CGFloat { return CGFloat(deg) * CGFloat(Double.pi) / 180.0 } public func scaleImageWithRespectToSize(image : UIImage, newSize : CGSize) -> UIImage! { var scaledSize = CGSize.zero; scaledSize.width = ceil(newSize.width); scaledSize.height = ceil(newSize.height); if(Float(fabs((image.size.width / image.size.height) - (scaledSize.width / scaledSize.height))) == Float.ulpOfOne){ return image; } UIGraphicsBeginImageContextWithOptions( scaledSize, false, 0.0 ); let scaledImageRect = CGRect(x: 0, y: 0, width: scaledSize.width, height: scaledSize.height) image.draw(in: scaledImageRect); let scaledImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return scaledImage; } func getImageHeightWithRespectWidth(imageName: String?, maxWidth: CGFloat) -> CGFloat { if isEmptyString(string: imageName) || maxWidth == 0 { return 0 } let image = UIImage(named: imageName!) return getImageHeightWithRespectWidth(image: image, maxWidth: maxWidth) } func getImageHeightWithRespectWidth(image: UIImage?, maxWidth: CGFloat) -> CGFloat { if image == nil { return 0 } let imageSize = image!.size let aspectRatio = imageSize.width / imageSize.height return maxWidth / aspectRatio } func getBase64String(image: UIImage, compressionQuality: CGFloat = 0.5) -> String? { print(image.size) var maxSize = CGSize(width: 414, height: 0) var newImage = image var temp = UIImageJPEGRepresentation(newImage, 1.0) print("Original \(temp!.count/1000)kb") temp = UIImageJPEGRepresentation(newImage, compressionQuality) print("Original size reducing quality \(temp!.count/1000)kb") if newImage.size.width > maxSize.width { maxSize.height = getImageHeightWithRespectWidth(image: newImage, maxWidth: maxSize.width) newImage = scaleImageWithRespectToSize(image: image, newSize: maxSize) let temp = UIImageJPEGRepresentation(newImage, 1.0) print("After reducing size \(temp!.count/1000)kb") print(newImage.size) } let imageData = UIImageJPEGRepresentation(newImage, compressionQuality) print("After resized size reducing quality \(imageData!.count/1000)kb") var base64ImageStr = imageData?.base64EncodedString(options: Data.Base64EncodingOptions.endLineWithLineFeed) if base64ImageStr != nil { base64ImageStr = "data:image/jpeg;base64," + base64ImageStr! } return base64ImageStr } public func printAllFonts() { for fontFamilyNames in UIFont.familyNames { for fontName in UIFont.fontNames(forFamilyName: fontFamilyNames) { print("FONTNAME:\(fontName)") } } } public func isAvailable9Version() -> Bool { if #available(iOS 9, *) { return true } else { return false } } func addHeaderSeperator(tableView: TableView) { let px = 1 / UIScreen.main.scale let frame = CGRect(x: 0, y: 0, width: tableView.frame.size.width, height: px) let line: UIView = UIView(frame: frame) tableView.tableHeaderView = line line.backgroundColor = tableView.separatorColor } public func isEmptyString(string : String?) -> Bool { // if string == nil { // return true // } // // return string!.isEmpty guard string != nil && !(string!.isEmpty) else { return false } return true } func showAlrt(fromController: UIViewController, title: String?, message: String?, cancelText: String?, cancelAction: (()-> ())?, otherText: String?, action: (()-> ())?) { let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert) if isEmptyString(string: cancelText) == false { alert.addAction(UIAlertAction(title: cancelText, style: UIAlertActionStyle.cancel, handler: { (alertAction) in cancelAction?() })) } if isEmptyString(string: otherText) == false { alert.addAction(UIAlertAction(title: otherText, style: UIAlertActionStyle.default, handler: { (alertAction) in action?() })) } fromController.present(alert, animated: true, completion: nil) } func notificationRegisterCheck() ->Bool { if (UIApplication.shared.isRegisteredForRemoteNotifications) == true { return true } else { return false } } func validateUrl (urlString: String?) -> Bool { let urlRegEx = "((\\w)*|([0-9]*)|([-|_])*)+([\\.|/]((\\w)*|([0-9]*)|([-|_])*))+" print(NSPredicate(format: "SELF MATCHES %@", urlRegEx).evaluate(with: urlString)) return NSPredicate(format: "SELF MATCHES %@", urlRegEx).evaluate(with: urlString) } func sizeOfText(string:String , textView:TextView) -> CGFloat{ let fixedWidth = textView.frame.size.width textView.sizeThatFits(CGSize(width: fixedWidth, height: CGFloat.greatestFiniteMagnitude)) let newSize = textView.sizeThatFits(CGSize(width: fixedWidth, height: CGFloat.greatestFiniteMagnitude)) var newFrame = textView.frame newFrame.size = CGSize(width: max(newSize.width, fixedWidth), height: newSize.height) if newFrame.size.height <= 42.0 { return 42.0 }else{ return newFrame.size.height } } func getDateFomateString(_ format:String) -> DateFormatter{ let dateFormmat = DateFormatter() dateFormmat.dateFormat = format return dateFormmat } func statusBarHeight() -> CGFloat { let statusBarSize = UIApplication.shared.statusBarFrame.size return Swift.min(statusBarSize.width, statusBarSize.height) } public func stringFromTimeInterval(interval: TimeInterval) -> String { let ti = NSInteger(interval) let seconds = ti % 60 let minutes = (ti / 60) % 60 let hours = (ti / 3600) return String(format: "%0.2d:%0.2d:%0.2d", hours,minutes,seconds) } public func getHourFromInteval(interval: TimeInterval) -> Int{ let ti = NSInteger(interval) let hours = (ti / 3600) return hours } public func getMinutesFromInteval(interval: TimeInterval) -> Int{ let ti = NSInteger(interval) let minutes = (ti / 60) % 60 return minutes } public func getSecondsFromInteval(interval: TimeInterval) -> Int{ let ti = NSInteger(interval) let seconds = ti % 60 return seconds } public func getTotalMinutesFromInteval(interval: TimeInterval) -> Int{ let ti = NSInteger(interval) let minutes = (ti / 60) return minutes }
[ -1 ]
4cf1b7907ebe23ce0f4ad84f310811e05c607a3b
b0bd13d0a41269b02593fc1d750bc5a51ee72023
/Pod-Chat-iOS-SDK/Chat/CoreDataCache/CacheModels/CMContact+CoreDataClass.swift
72f6ea35694002dc0ac397abd78bd3998e551188
[ "MIT" ]
permissive
FanapSoft/pod-chat-ios-sdk
74417ff75389b9638403e383128068619ebb1fde
32fa9dd1f6e7cfc07950d207e5b712bf43b8a36e
refs/heads/master
2022-10-19T02:00:14.867938
2022-04-28T10:44:22
2022-04-28T10:44:22
215,564,453
0
0
null
null
null
null
UTF-8
Swift
false
false
3,612
swift
// // CMContact+CoreDataClass.swift // FanapPodChatSDK // // Created by Mahyar Zhiani on 11/1/1397 AP. // Copyright © 1397 Mahyar Zhiani. All rights reserved. // // import Foundation import CoreData public class CMContact: NSManagedObject { @available(*,deprecated , message:"Removed in 0.10.5.0 version") public func convertCMObjectToObject() -> Contact { var blocked: Bool? var hasUser: Bool? var id: Int? var notSeenDuration: Int? var userId: Int? var time: UInt? // var linkedUser: LinkedUser? func createVariables() { if let blocked2 = self.blocked as? Bool { blocked = blocked2 } if let hasUser2 = self.hasUser as? Bool { hasUser = hasUser2 } if let id2 = self.id as? Int { id = id2 } if let notSeenDuration2 = self.notSeenDuration as? Int { notSeenDuration = notSeenDuration2 } if let userId2 = self.userId as? Int { userId = userId2 } if let time2 = self.time as? UInt { time = time2 } } func createContactModel() -> Contact { let messageModel = Contact(blocked: blocked, cellphoneNumber: self.cellphoneNumber, email: self.email, firstName: self.firstName, hasUser: hasUser ?? false, id: id, image: self.image, lastName: self.lastName, linkedUser: self.linkedUser?.convertCMObjectToObject(), notSeenDuration: notSeenDuration, timeStamp: time, userId: userId) return messageModel } createVariables() let model = createContactModel() return model } @available(*,deprecated , message:"Removed in 0.10.5.0 version") func updateObject(with contact: Contact) { if let blocked = contact.blocked as NSNumber? { self.blocked = blocked } if let cellphoneNumber = contact.cellphoneNumber { self.cellphoneNumber = cellphoneNumber } if let email = contact.email { self.email = email } if let firstName = contact.firstName { self.firstName = firstName } if let hasUser = contact.hasUser as NSNumber? { self.hasUser = hasUser } if let id = contact.id as NSNumber? { self.id = id } if let image = contact.image { self.image = image } if let lastName = contact.lastName { self.lastName = lastName } if let notSeenDuration = contact.notSeenDuration as NSNumber? { self.notSeenDuration = notSeenDuration } if let userId = contact.userId as NSNumber? { self.userId = userId } self.time = Int(Date().timeIntervalSince1970) as NSNumber? } }
[ -1 ]
9ee0eb583fd59f91b3928c194951f4b933dd89c9
f8ed5e6644d6276157abe052472225b64d2a5cb7
/PalyHigh/PalyHighUITests/PalyHighUITests.swift
dc3d5acc281ae9157eb2b0d268bddcf9e1321538
[]
no_license
SevenSecondMemoryFish/swfit_LateralSpreads
d5bde5dd38c305df22c00ba264088474c8330e8f
c979d8615b05521284da747fe2eec3d27091655e
refs/heads/master
2020-09-28T04:36:44.866587
2016-08-21T13:41:29
2016-08-21T13:41:29
66,200,574
0
0
null
null
null
null
UTF-8
Swift
false
false
1,234
swift
// // PalyHighUITests.swift // PalyHighUITests // // Created by wsj on 16/7/22. // Copyright © 2016年 wsj. All rights reserved. // import XCTest class PalyHighUITests: XCTestCase { override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. // In UI tests it is usually best to stop immediately when a failure occurs. continueAfterFailure = false // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. XCUIApplication().launch() // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } func testExample() { // Use recording to get started writing UI tests. // Use XCTAssert and related functions to verify your tests produce the correct results. } }
[ 333827, 243720, 282634, 313356, 155665, 305173, 237599, 241695, 223269, 229414, 292901, 354342, 315433, 102441, 278571, 313388, 325675, 124974, 282671, 354346, 229425, 102446, 243763, 241717, 180279, 229431, 215095, 319543, 213051, 288829, 325695, 288835, 286787, 307269, 237638, 313415, 285360, 239689, 233548, 311373, 315468, 278607, 333902, 311377, 354386, 196687, 280660, 223317, 329812, 315477, 354394, 200795, 323678, 315488, 321632, 45154, 315489, 280676, 280674, 313446, 227432, 215144, 307306, 233578, 194667, 278637, 288878, 319599, 278642, 284789, 131190, 284790, 288890, 292987, 215165, 131199, 227459, 194692, 280708, 278669, 235661, 241809, 323730, 278676, 311447, 153752, 327834, 284827, 278684, 329884, 299166, 278690, 233635, 311459, 215204, 284840, 299176, 278698, 284843, 184489, 278703, 184498, 278707, 125108, 278713, 223418, 280761, 180409, 295099, 299197, 280767, 258233, 227517, 299202, 139459, 309443, 176325, 131270, 301255, 227525, 299208, 280779, 233678, 227536, 282832, 321744, 301270, 229591, 280792, 301271, 311520, 325857, 334049, 280803, 307431, 182503, 319719, 338151, 295147, 317676, 286957, 125166, 125170, 313595, 125180, 184574, 309504, 125184, 217352, 125192, 125197, 194832, 227601, 325904, 125200, 125204, 278805, 319764, 334104, 282908, 299294, 125215, 282912, 233761, 278817, 311582, 211239, 282920, 125225, 317738, 311596, 321839, 315698, 98611, 125236, 332084, 368949, 282938, 307514, 278843, 168251, 287040, 319812, 280903, 227655, 319816, 323914, 201037, 282959, 229716, 289109, 168280, 379224, 323934, 391521, 239973, 381286, 285031, 313703, 416103, 280938, 242027, 242028, 321901, 278895, 354671, 287089, 199030, 227702, 315768, 291193, 291194, 223611, 248188, 315769, 313726, 311679, 291200, 211327, 139641, 240003, 158087, 313736, 227721, 242059, 311692, 227730, 285074, 240020, 315798, 190872, 291225, 317851, 285083, 293275, 242079, 227743, 285089, 293281, 283039, 305572, 289185, 156069, 301482, 311723, 289195, 377265, 338359, 299449, 311739, 319931, 293309, 278974, 311744, 317889, 291266, 278979, 326083, 278988, 289229, 281038, 326093, 278992, 283089, 281039, 283088, 279000, 176602, 242138, 160224, 279009, 291297, 285152, 195044, 369121, 279014, 242150, 319976, 279017, 188899, 311787, 281071, 319986, 236020, 279030, 311800, 279033, 317949, 279042, 283138, 233987, 287237, 377352, 322057, 309770, 342537, 279053, 283154, 303634, 279060, 279061, 182802, 303635, 279066, 188954, 322077, 291359, 227881, 293420, 236080, 283185, 289328, 279092, 23093, 234037, 244279, 244280, 338491, 301635, 309831, 55880, 322119, 377419, 303693, 281165, 301647, 281170, 326229, 309847, 189016, 115287, 287319, 332379, 111197, 295518, 287327, 283431, 242274, 244326, 279143, 277095, 279150, 281200, 287345, 313970, 287348, 301688, 244345, 189054, 303743, 297600, 287359, 291455, 301702, 164487, 279176, 311944, 334473, 316044, 311948, 184974, 311950, 316048, 311953, 316050, 287379, 326288, 295575, 227991, 289435, 303772, 205469, 221853, 285348, 314020, 279207, 295591, 295598, 279215, 318127, 248494, 285362, 299698, 287412, 166581, 293552, 154295, 164532, 342705, 287418, 314043, 303802, 66243, 291529, 287434, 225996, 363212, 287438, 279249, 303826, 242385, 279253, 158424, 230105, 299737, 322269, 295653, 342757, 289511, 230120, 330473, 234216, 285419, 330476, 289517, 279278, 312046, 170735, 215790, 125683, 230133, 199415, 234233, 242428, 279293, 322302, 205566, 289534, 299777, 291584, 228099, 285443, 291591, 295688, 322312, 285450, 264971, 312076, 326413, 322320, 285457, 295698, 291605, 166677, 283418, 285467, 326428, 221980, 281378, 234276, 318247, 203560, 279337, 262952, 262953, 318251, 289580, 262957, 164655, 301872, 242481, 303921, 234290, 328495, 285493, 230198, 285496, 301883, 201534, 289599, 281407, 295745, 222017, 342846, 293702, 318279, 283466, 281426, 279379, 295769, 234330, 201562, 244569, 281434, 322396, 301919, 230239, 279393, 293729, 230238, 281444, 303973, 275294, 349025, 279398, 351078, 177002, 308075, 242540, 310132, 295797, 228214, 207735, 201590, 295799, 177018, 269179, 279418, 308093, 314240, 291713, 158594, 240517, 287623, 228232, 299912, 279434, 320394, 316299, 416649, 234382, 252812, 308111, 308113, 189327, 293780, 310166, 289691, 209820, 277404, 240543, 283551, 310177, 289699, 189349, 293673, 289704, 279465, 293801, 326571, 177074, 304050, 326580, 289720, 326586, 289723, 189373, 213956, 281541, 19398, 345030, 213961, 279499, 56270, 191445, 304086, 183254, 183258, 234469, 142309, 314343, 304104, 324587, 234476, 183276, 203758, 320495, 289773, 320492, 287730, 277493, 240631, 320504, 214009, 312313, 312315, 312317, 328701, 328705, 234499, 293894, 320520, 322571, 230411, 320526, 330766, 234513, 238611, 140311, 293911, 238617, 197658, 316441, 132140, 113710, 189487, 281647, 322609, 312372, 203829, 238646, 300087, 238650, 320571, 21567, 308288, 160834, 336962, 314437, 349254, 238663, 300109, 234578, 207954, 296023, 205911, 314458, 156763, 234588, 277600, 281698, 281699, 285795, 214116, 230500, 322664, 228457, 318571, 279659, 234606, 300145, 230514, 238706, 187508, 312435, 300147, 279666, 302202, 285819, 314493, 285823, 234626, 279686, 222344, 285834, 234635, 318602, 337037, 228492, 177297, 162962, 187539, 326803, 308375, 324761, 285850, 296091, 119965, 234655, 300192, 302239, 339106, 306339, 330912, 234662, 300200, 302251, 208044, 238764, 322733, 249003, 3243, 279729, 294069, 300215, 294075, 64699, 228541, 283841, 148674, 283846, 312519, 279752, 283849, 148687, 290001, 189651, 316628, 279766, 189656, 279775, 304352, 298209, 304353, 310496, 279780, 228587, 279789, 290030, 302319, 251124, 316661, 283894, 234741, 208123, 292092, 279803, 228608, 320769, 234756, 322826, 242955, 312588, 177420, 318732, 126229, 318746, 245018, 320795, 320802, 130342, 304422, 130344, 292145, 298290, 312628, 300342, 159033, 333114, 222523, 333115, 286012, 181568, 279872, 279874, 300355, 294210, 216387, 286019, 193858, 300354, 304457, 230730, 372039, 294220, 296269, 234830, 224591, 238928, 222542, 296274, 314708, 318804, 283990, 314711, 357720, 300378, 300379, 294236, 316764, 314721, 292194, 230757, 281958, 314727, 134504, 306541, 327023, 234864, 296304, 312688, 316786, 314740, 230772, 327030, 284015, 314742, 314745, 290170, 310650, 224637, 306558, 290176, 306561, 243073, 179586, 314752, 294278, 314759, 296328, 298378, 296330, 318860, 314765, 368012, 304523, 292242, 279955, 306580, 112019, 224662, 234902, 282008, 314776, 314771, 318876, 282013, 290206, 148899, 314788, 298406, 314790, 245160, 333224, 282023, 279979, 279980, 241067, 314797, 286128, 173492, 279988, 286133, 284086, 284090, 302523, 228796, 310714, 54719, 302530, 280003, 228804, 310725, 306630, 292291, 415170, 300488, 306634, 280011, 302539, 234957, 370122, 339403, 329168, 300490, 222674, 327122, 280020, 329170, 312785, 310735, 280025, 310747, 239069, 144862, 286176, 187877, 310758, 320997, 280042, 280043, 191980, 329198, 337391, 300526, 282097, 308722, 296434, 306678, 40439, 288248, 191991, 286201, 300539, 288252, 312830, 286208, 290304, 245249, 228868, 292359, 218632, 323079, 302602, 230922, 323083, 294413, 304655, 323088, 329231, 282132, 230933, 302613, 316951, 282135, 374297, 302620, 313338, 282147, 222754, 306730, 245291, 312879, 230960, 288305, 239159, 290359, 323132, 235069, 157246, 288319, 130622, 288322, 280131, 349764, 310853, 282182, 124486, 288328, 194118, 292426, 286281, 333389, 224848, 224852, 290391, 128600, 235096, 239192, 306777, 230999, 196184, 212574, 345697, 204386, 300643, 300645, 282214, 312937, 224874, 243306, 204394, 312941, 206447, 310896, 314997, 294517, 290425, 288377, 325246, 333438, 235136, 280193, 282244, 239238, 288391, 282248, 286344, 323208, 179853, 286351, 188049, 229011, 239251, 280217, 323226, 179868, 229021, 302751, 282272, 198304, 282279, 298664, 212649, 298666, 317102, 286387, 300725, 337590, 286392, 300729, 302778, 306875, 280252, 296636, 282302, 280253, 286400, 323265, 323262, 280259, 321217, 282309, 321220, 333508, 239305, 296649, 280266, 212684, 306891, 302798, 9935, 241360, 282321, 313042, 286419, 241366, 280279, 278232, 282330, 18139, 294621, 278237, 280285, 282336, 278241, 321250, 294629, 153318, 333543, 181992, 12009, 337638, 282347, 288492, 282349, 34547, 67316, 323315, 286457, 284410, 200444, 288508, 282366, 286463, 319232, 278273, 288515, 280326, 282375, 323335, 284425, 300810, 282379, 216844, 116491, 284430, 280333, 300812, 161553, 124691, 278292, 118549, 278294, 282390, 116502, 284436, 325403, 321308, 321309, 282399, 241440, 282401, 325411, 315172, 186149, 186148, 241447, 333609, 286507, 294699, 284460, 280367, 300849, 282418, 280373, 282424, 280377, 321338, 319289, 282428, 280381, 345918, 413500, 241471, 280386, 315431, 280391, 153416, 315209, 325449, 159563, 280396, 307024, 317268, 237397, 307030, 18263, 241494, 188250, 284508, 300893, 307038, 237411, 284515, 276326, 282471, 296807, 292713, 282476, 292719, 296815, 313200, 325491, 313204, 333687, 317305, 124795, 317308, 339840, 315265, 280451, 327556, 188293, 243590, 282503, 67464, 315272, 325514, 243592, 305032, 315275, 311183, 184207, 124816, 282517, 294806, 214936, 294808, 337816, 239515, 214943, 298912, 319393, 333727, 294820, 333734, 219046, 284584, 294824, 298921, 313257, 310731, 292783, 126896, 200628, 300983, 343993, 288698, 98240, 294849, 214978, 280517, 280518, 214983, 282572, 282573, 153553, 24531, 231382, 329696, 323554, 292835, 6116, 190437, 292838, 294887, 317416, 313322, 278507, 298987, 311277, 296942, 329707, 124912, 327666, 278515, 325620, 239610 ]
efe1260e8faad846579ebe9805b0d782c34523bc
dd1ab4595b675044e361baef6c0bf9cce2da159d
/Spondoolicks/Helpers/Views/SPBorderedPicker.swift
3fb16996d45c26379abef3293f3df6044a5eb043
[]
no_license
ad-johnson/Spondoolicks
88458b03d33304a62981ebd0985b82e6b30e42a6
a6fb92fc63c7e1d95bd52af109a72584736529db
refs/heads/master
2021-05-05T19:52:08.322858
2018-02-15T15:17:55
2018-02-15T15:17:55
117,855,808
0
0
null
null
null
null
UTF-8
Swift
false
false
426
swift
// // SPBorderedPicker.swift // Spondoolicks // // Created by Andrew Johnson on 09/02/2018. // Copyright © 2018 Andrew Johnson. All rights reserved. // import UIKit class SPBorderedPicker: UIPickerView, SPView { override func awakeFromNib() { setViewProperties() } override func prepareForInterfaceBuilder() { super.prepareForInterfaceBuilder() setViewProperties() } }
[ -1 ]
66eb7aafd0cf2e6822f18a9ae2660eb495c7f9dd
e5d0f42fc64ae6a4805d39b0d809f9b74974b1bf
/Package.swift
cd25c23ed02f676b5b65d636d32e671eaeaa69cf
[ "MIT" ]
permissive
tanner0101/hello-vapor-ibm
9675b35c2154188bd399a3cb1d8850a591f2b54c
8a05de16c5856c1868bc78f3e76171d65a55ba36
refs/heads/master
2021-01-22T16:18:02.644244
2017-09-18T18:50:33
2017-09-18T18:50:33
102,393,656
0
1
null
2017-09-18T18:50:34
2017-09-04T19:07:51
Swift
UTF-8
Swift
false
false
469
swift
import PackageDescription let package = Package( name: "HelloVapor", targets: [ Target(name: "App"), Target(name: "Run", dependencies: ["App"]), ], dependencies: [ .Package(url: "https://github.com/vapor/vapor.git", majorVersion: 2), .Package(url: "https://github.com/vapor/leaf-provider.git", majorVersion: 1), ], exclude: [ "Config", "Database", "Public", "Resources", ] )
[ 293174 ]
1846caa036adafe935dcb12d5539477ef6c7ea21
3f3678772e83df77819300bd17642930e4c77454
/BalkaniaiPad/ViewControllers/DictionaryViewController.swift
33c0596382cced68a135a89c590f891cae59ece6
[ "MIT" ]
permissive
alexth/Balkania-iPad
ec6bcdf925aaf4bea6a8bde4dfbeb5557761c2de
e14106e4740653b13c4d097bce7b5c9fe1746584
refs/heads/master
2021-01-23T09:16:22.298729
2017-10-01T17:01:28
2017-10-01T17:01:28
102,576,311
0
0
null
null
null
null
UTF-8
Swift
false
false
4,370
swift
// // DictionaryViewController.swift // BalkaniaiPad // // Created by Alex Golub on 6/6/17. // Copyright © 2017 Alex Golub. All rights reserved. // import UIKit final class DictionaryViewController: UIViewController { @IBOutlet weak var searchBar: UISearchBar! @IBOutlet weak var dictionaryTableView: UITableView! var dictionaryName: String! fileprivate var sourceArray = [String]() fileprivate var displayArray = [String]() fileprivate var displayDictionary: Dictionary = [String: String]() fileprivate let dictionaryCellIdentifier = "dictionaryCell" fileprivate let dictionaryTableViewNumberOfSections: Int = 1 fileprivate let dictionaryTableViewCellHeight: CGFloat = 50.0 fileprivate let dictionaryTableViewHeaderFooterHeight: CGFloat = 0.01 fileprivate let attributedStringUtils = AttributedStringUtils() fileprivate let colors = ColorUtils() override func viewDidLoad() { super.viewDidLoad() if let dictionaryName = dictionaryName { setupData(plistName: dictionaryName) } setupTableView() } } extension DictionaryViewController: UITableViewDataSource { func numberOfSections(in tableView: UITableView) -> Int { return dictionaryTableViewNumberOfSections } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return displayArray.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: dictionaryCellIdentifier, for: indexPath) as! DictionaryCell let word = displayArray[indexPath.row] cell.wordLabel?.text = word cell.translationLabel?.text = displayDictionary[word] setupAttributedString(cell: cell, fullString: word) cell.colorView.backgroundColor = setupColorView(indexPathRow: indexPath.row) return cell } } extension DictionaryViewController: UITableViewDelegate { func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { return dictionaryTableViewHeaderFooterHeight } func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { return dictionaryTableViewHeaderFooterHeight } } extension DictionaryViewController: UISearchBarDelegate { func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) { displayArray.removeAll() if searchText.characters.count == 0 { displayArray.append(contentsOf: sourceArray) } else { for word in sourceArray { if word.range(of: searchText, options: NSString.CompareOptions.caseInsensitive) != nil { displayArray.append(word) } } } dictionaryTableView.reloadData() } func searchBarSearchButtonClicked(_ searchBar: UISearchBar) { searchBar.resignFirstResponder() } func searchBarCancelButtonClicked(_ searchBar: UISearchBar) { searchBar.resignFirstResponder() } } extension DictionaryViewController { // MARK: Utils fileprivate func setupTableView() { dictionaryTableView.rowHeight = UITableViewAutomaticDimension dictionaryTableView.estimatedRowHeight = dictionaryTableViewCellHeight } fileprivate func setupData(plistName: String) { guard let data = PlistReaderUtils().read(plistName) else { return } sourceArray = data.sourceArray displayDictionary = data.displayDictionary displayArray.append(contentsOf: sourceArray) dictionaryTableView.reloadData() } fileprivate func setupAttributedString(cell: DictionaryCell, fullString: String) { if searchBar.text!.characters.count > 0 { if let searchText = searchBar.text { let attributedString = attributedStringUtils.createAttributedString(fullString: fullString, subString: searchText) cell.wordLabel.attributedText = attributedString } } } fileprivate func setupColorView(indexPathRow: Int) -> UIColor { if indexPathRow % 2 == 0 { return colors.yellowColor() } return colors.cellYellowColor().withAlphaComponent(0.3) } }
[ -1 ]
d7cd50e39fd8e212459bea415b01d4c7971151dc
4f301bb97e5b1c72b8a624eaca771a80ba8e4b40
/PikMap/CustomTextField.swift
fcc0b43697901683a14db57ca344082d3c51acf2
[]
no_license
jdleo/PikMap
ea879542ad649ddc949bdc086a349cbbc0fbaebf
47de484a0691451dc83f73a607cd5b5fce582110
refs/heads/master
2020-12-03T03:06:45.633379
2016-09-05T03:12:41
2016-09-05T03:12:41
66,889,600
0
0
null
null
null
null
UTF-8
Swift
false
false
2,340
swift
// // CustomTextField.swift // PikMap // // Created by John Leonardo on 8/30/16. // Copyright © 2016 John Leonardo. All rights reserved. // import UIKit /** extension to UIColor to allow setting the color value by hex value */ extension UIColor { convenience init(red: Int, green: Int, blue: Int) { /** Verify that we have valid values */ assert(red >= 0 && red <= 255, "Invalid red component") assert(green >= 0 && green <= 255, "Invalid green component") assert(blue >= 0 && blue <= 255, "Invalid blue component") self.init(red: CGFloat(red) / 255.0, green: CGFloat(green) / 255.0, blue: CGFloat(blue) / 255.0, alpha: 1.0) } /** Initializes and sets color by hex value */ convenience init(netHex:Int) { self.init(red:(netHex >> 16) & 0xff, green:(netHex >> 8) & 0xff, blue:netHex & 0xff) } } @IBDesignable class CustomTextField: UITextField { // MARK: - IBInspectable @IBInspectable var tintCol: UIColor = UIColor(netHex: 0x707070) @IBInspectable var fontCol: UIColor = UIColor(netHex: 0x707070) @IBInspectable var shadowCol: UIColor = UIColor(netHex: 0x707070) // MARK: - Properties var textFont = UIFont(name: "Helvetica Neue", size: 14.0) override func draw(_ rect: CGRect) { self.layer.masksToBounds = false self.backgroundColor = UIColor(red: 230, green: 230, blue: 230) self.layer.cornerRadius = 3.0 self.tintColor = tintCol self.textColor = fontCol self.layer.borderWidth = 1 self.layer.borderColor = UIColor(red: 255, green: 255, blue: 255).cgColor if let phText = self.placeholder { self.attributedPlaceholder = NSAttributedString(string: phText, attributes: [NSForegroundColorAttributeName: UIColor(netHex: 0xB3B3B3)]) } if let fnt = textFont { self.font = fnt } else { self.font = UIFont(name: "Helvetica Neue", size: 14.0) } } // Placeholder text override func textRect(forBounds bounds: CGRect) -> CGRect { return bounds.insetBy(dx: 10, dy: 0) } // Editable text override func editingRect(forBounds bounds: CGRect) -> CGRect { return bounds.insetBy(dx: 10, dy: 0) } }
[ 286892 ]
1b3baad32b26cd9d9fcaae7acd3eca3a486e46ed
0084e6652623f7ab4d4f87fd5b73a88311fc09d3
/Start Traveling/Plans/SightCityTableViewCell.swift
74953a744040af46b3f0d0c9217e3d37cdf56c48
[]
no_license
xlii0064/start-travelling
e8e0fc064a5812951723712227c9ff072f4c44fb
ff77df231e439105b946fcd124955e567de9452b
refs/heads/master
2020-08-29T05:22:21.762299
2019-11-01T00:35:39
2019-11-01T00:35:39
217,941,516
0
0
null
null
null
null
UTF-8
Swift
false
false
541
swift
// // SightCityTableViewCell.swift // Start Traveling // // Created by Xinbei Li on 6/6/19. // Copyright © 2019 Xinbei Li. All rights reserved. // import UIKit class SightCityTableViewCell: UITableViewCell { @IBOutlet weak var name: UILabel! override func awakeFromNib() { super.awakeFromNib() // Initialization code } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } }
[ 172545, 322306, 211843, 230522, 225159, 418826, 302475, 277904, 230545, 307218, 227219, 320404, 320793, 336158, 123678, 366111, 123681, 349477, 276390, 278567, 293674, 199212, 287022, 300206, 327344, 110387, 281014, 282934, 289336, 292919, 276406, 123451, 228599, 66109, 299965, 306623, 299968, 200513, 306625, 306626, 306627, 317377, 317378, 317379, 379078, 313546, 311755, 278220, 311756, 311757, 311759, 228602, 273105, 310778, 332882, 278231, 290007, 291544, 298746, 228188, 200542, 155614, 176228, 375532, 115313, 113524, 244599, 244602, 196093 ]
1621c4f86e462d175116b4bfa34d9058810cf35a
821cc1af1e1d4142a6bebf8c587ae971277b9059
/Artsy/View_Controllers/Live_Auctions/ViewModels/LiveAuctionEventViewModel.swift
d010695213966604391434f5dbcee3f3682aa707
[ "MIT" ]
permissive
grubern/eigen
5e10aae9889bd9a9879ff9cfbccd54ccaaf5c291
d6526fe7cd4b8c01e2ac7e7f1f6ae2b5a481c182
refs/heads/master
2018-05-13T09:50:30.179449
2016-04-22T11:06:44
2016-04-22T11:06:44
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,617
swift
import Foundation class LiveAuctionEventViewModel : NSObject { let event: LiveEvent var isBid: Bool { return event.eventType() == .Bid } var eventTitle: NSAttributedString { switch event.eventType() { case .Bid: guard let event = event as? LiveEventBid else { return attributify("BID", .blackColor()) } return attributify(event.source.uppercaseString, .blackColor()) case .Closed: return attributify("CLOSED", .blackColor()) case .Warning: return attributify("WARNING", yellow()) case .FinalCall: return attributify("FINAL CALL", orange()) case .LotOpen: return attributify("LOT OPEN FOR BIDDING", purple()) case .Unknown: return attributify("", orange()) } } var eventSubtitle: NSAttributedString { switch event.eventType() { case .Bid: guard let event = event as? LiveEventBid else { return attributify("BID", .blackColor()) } return attributify("\(event.amountCents / 10)", .blackColor()) case .Closed: return NSAttributedString() case .Warning: return attributifyImage("live_auction_bid_warning_yellow") case .FinalCall: return attributifyImage("live_auction_bid_warning_orange") case .LotOpen: return attributifyImage("live_auction_bid_hammer") case .Unknown: return NSAttributedString() } } func attributify(string: String, _ color: UIColor) -> NSAttributedString { return NSAttributedString(string: string, attributes: [NSForegroundColorAttributeName : color]) } func attributifyImage(name: String) -> NSAttributedString { let textAttachment = NSTextAttachment() textAttachment.image = UIImage(named: name) return NSAttributedString(attachment: textAttachment) } // HACK: Temporary func yellow() -> UIColor { return UIColor(red:0.909804, green:0.701961, blue:0.0, alpha:1.0) } func orange() -> UIColor { return UIColor(red:0.937255, green:0.454902, blue:0.290196, alpha:1.0) } func red() -> UIColor { return UIColor(red:0.945098, green:0.294118, blue:0.27451, alpha:1.0) } func purple() -> UIColor { return UIColor(red:0.305882, green:0.0, blue:0.92549, alpha:1.0) } func green() -> UIColor { return UIColor(red:0.0823529, green:0.803922, blue:0.184314, alpha:1.0) } func grey() -> UIColor { return UIColor(red:0.423529, green:0.423529, blue:0.423529, alpha:1.0) } init(event:LiveEvent) { self.event = event } }
[ -1 ]
cf548b805ae969b996337e5aa0bfc3d8d1268d37
a50eace08e4be477c4033565fe4cfe5abfb0daa0
/farmatodo/viewModel/CharacterViewModel.swift
7e9f3ee81be87197d005e3e246fe6de487d44bd4
[]
no_license
danissch/marvel_ios_demo
5611307ced0b7a8405c53d233a1808b75e295d39
6596697f483d9cf09cb699233c7f58b8c52932bd
refs/heads/master
2022-01-22T04:03:27.875833
2019-07-05T20:58:27
2019-07-05T20:58:27
null
0
0
null
null
null
null
UTF-8
Swift
false
false
4,732
swift
// // CharacterViewModel.swift // farmatodo // // Created by Daniel Duran Schutz on 7/1/19. // Copyright © 2019 OsSource. All rights reserved. // import Foundation class CharacterViewModel: CharacterViewModelProtocol { var networkService: NetworkServiceProtocol? init() { print("init :: CharacterViewModel") privCurrentCharacter = CharacterModel(id: 0, name: "", thumbnail: ThumbnailModel(path: "", ext: ""), description: "") } private let pageSize = 20 private var privCurrentCharacter: CharacterModel var currentCharacter: CharacterModel { get { return privCurrentCharacter } set { privCurrentCharacter = newValue } } private var privCharacterList = [CharacterModel]() var characterList: [CharacterModel] { get { return privCharacterList } } private var privComicList = [ComicModel]() var comicList: [ComicModel] { get { return privComicList } } func getCharacters( page: Int, complete: @escaping ( ServiceResult<[CharacterModel]?> ) -> Void ) { print("init :: getCharacters") let offset = page * pageSize guard let networkService = networkService else { return complete(.Error("Missing network service", 0)) } let baseUrl = networkService.baseUrl let hash = networkService.apiKeyTsHash //let url = "\(baseUrl)characters?\(hash)&offset=\(offset)&nameStartsWith=Spi" let url = "\(baseUrl)characters?\(hash)&offset=\(offset)" // TODO: filter: &nameStartsWith=Spi networkService.request( url: url, method: .get, parameters: nil ) { [weak self] (result) in if page == 0 { self?.privCharacterList.removeAll() } switch result { case .Success(let json, let statusCode): do { print("case .Success :: getCharacters") if let data = json?.data(using: .utf8) { let decoder = JSONDecoder() let characterResponse = try decoder.decode(CharacterResponse.self, from: data) self?.privCharacterList.append(contentsOf: characterResponse.data.results) return complete(.Success(self?.privCharacterList, statusCode)) } return complete(.Error("Error parsing data", statusCode)) } catch { print("error:\(error)") return complete(.Error("Error decoding JSON", statusCode)) } case .Error(let message, let statusCode): print("case .Error :: getCharacters") return complete(.Error(message, statusCode)) } } } func getCharacterComics( page: Int, character: Int, complete: @escaping ( ServiceResult<[ComicModel]?> ) -> Void ) { print("getCharacterComics :: CharacterViewModel") let offset = page * pageSize guard let networkService = networkService else { return complete(.Error("Missing network service", 0)) } let baseUrl = networkService.baseUrl let hash = networkService.apiKeyTsHash let url = "\(baseUrl)characters/\(character)/comics?\(hash)&offset=\(offset)" networkService.request( url: url, method: .get, parameters: nil ) { [weak self] (result) in if page == 0 { self?.privComicList.removeAll() } switch result { case .Success(let json, let statusCode): do { print("case .Success getCharacterComics :: CharacterViewModel") if let data = json?.data(using: .utf8) { let decoder = JSONDecoder() let comicResponse = try decoder.decode(ComicResponse.self, from: data) self?.privComicList.append(contentsOf: comicResponse.data.results) return complete(.Success(self?.privComicList, statusCode)) } return complete(.Error("Error parsing data", statusCode)) } catch { print("error:\(error)") return complete(.Error("Error decoding JSON", statusCode)) } case .Error(let message, let statusCode): print("case .Error getCharacterComics :: CharacterViewModel") return complete(.Error(message, statusCode)) } } } }
[ -1 ]
814e1aabff3c82a04e168fff12a0e92e226de782
a7b417fa5c0e27b20990dcc2271e2f885ee5c241
/FromScratch/StarWarsApp/StarWarsApp/Helpers/Extensions/String+Utilities.swift
e0b3fb2a4d891c0544c2d9b8d352ed410974bd06
[]
no_license
JosueCuberoSanchez/iOS_Swift_Examples
5b57b71260f78bbcd4ef671e4c4a6aae0656cc19
e8d3e8092e14250a8292713185f0886fef82d49e
refs/heads/master
2020-04-14T21:00:08.235176
2019-02-01T19:33:54
2019-02-01T19:33:54
164,113,923
0
0
null
null
null
null
UTF-8
Swift
false
false
523
swift
// // String+Resource.swift // StarWarsApp // // Created by Josue on 1/18/19. // Copyright © 2019 Josue. All rights reserved. // import Foundation extension String { /** Gets the resource of a url. Ex: https://swapi.com/planets/12 -> planets/12 */ var resourcePath: String { let components = self.dropLast().components(separatedBy: "/") let resource = components[components.count-2] let index = components[components.count-1] return "\(resource)/\(index)" } }
[ -1 ]
f900441966c22ac37837fac92023420ec6d853c1
ed61674d61f00e6c7a66c38d64b6c86ad5cb9487
/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/Networking/API/ApiClient.swift
6f577795a31260b45f3e441ecf965e58f7ae03ec
[ "MIT" ]
permissive
morgan-legal/iOS-project-template
8271900a15352c2ce07d950ae0efc09d8436bf2b
f09f26c5772b4d36b8a0d8bc2b342b6005ecd8c3
refs/heads/master
2023-03-08T16:14:41.172961
2021-02-25T16:58:50
2021-02-25T16:58:50
269,021,209
0
0
MIT
2020-06-05T12:42:41
2020-06-03T07:36:33
null
UTF-8
Swift
false
false
238
swift
// // ApiClient.swift // {{cookiecutter.app_name}} // // Copyright © {{cookiecutter.company_name}}. All rights reserved. // import Foundation final class ApiClient: Api { private(set) var router = Router<EndPoint>() }
[ -1 ]
06b28c5c1c6e502e431bcb33ea84bed426f5230e
237ff328909eb5ab3634a4f47ab2e4ea6c139c41
/MVVMSwiftExampleUITests/MVVMSwiftExampleUITests.swift
c60c2b0e965647122be25adeb9ee4bbb94db350f
[]
no_license
dasoga/MVVMSwiftExample
1317f4d27980180abbcd76fcfc71b405bc207d7f
b2018b2ba60cc8a1ab395f47a26287be997c5889
refs/heads/master
2020-06-28T04:37:31.894852
2017-06-13T21:25:30
2017-06-13T21:25:30
94,259,383
2
0
null
null
null
null
UTF-8
Swift
false
false
1,270
swift
// // MVVMSwiftExampleUITests.swift // MVVMSwiftExampleUITests // // Created by Dino Bartosak on 25/09/16. // Copyright © 2016 Toptal. All rights reserved. // import XCTest class MVVMSwiftExampleUITests: XCTestCase { override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. // In UI tests it is usually best to stop immediately when a failure occurs. continueAfterFailure = false // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. XCUIApplication().launch() // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } func testExample() { // Use recording to get started writing UI tests. // Use XCTAssert and related functions to verify your tests produce the correct results. } }
[ 333827, 243720, 282634, 313356, 155665, 237599, 241695, 292901, 223269, 229414, 354342, 102441, 315433, 278571, 325675, 354346, 102446, 124974, 282671, 229425, 243763, 241717, 319543, 180279, 215095, 229431, 288829, 325695, 286787, 288835, 237638, 313415, 239689, 233548, 311373, 315468, 278607, 196687, 311377, 354386, 315477, 223317, 323678, 315488, 321632, 45154, 280676, 313446, 215144, 307306, 194667, 233578, 278637, 288878, 319599, 278642, 284789, 131190, 288890, 131199, 194692, 235661, 323730, 278676, 311447, 153752, 327834, 284827, 299166, 278690, 311459, 215204, 284840, 184489, 278698, 284843, 278703, 184498, 278707, 125108, 278713, 180409, 223418, 258233, 295099, 227517, 299197, 280767, 299202, 139459, 309443, 176325, 227525, 301255, 131270, 280779, 282832, 227536, 229591, 301271, 280792, 311520, 325857, 182503, 319719, 295147, 317676, 286957, 125166, 125170, 313595, 125180, 184574, 125184, 309504, 125192, 125197, 125200, 227601, 125204, 278805, 319764, 334104, 282908, 311582, 299294, 125215, 282912, 278817, 211239, 282920, 125225, 317738, 321839, 315698, 98611, 125236, 307514, 278843, 282938, 168251, 319812, 280903, 227655, 323914, 201037, 282959, 289109, 168280, 379224, 323934, 391521, 239973, 381286, 285031, 313703, 280938, 242027, 321901, 278895, 354671, 199030, 139641, 291193, 291194, 248188, 313726, 311679, 211327, 240003, 158087, 227721, 242059, 311692, 285074, 227730, 240020, 190870, 315798, 190872, 291225, 285083, 317851, 293275, 242079, 227743, 289185, 285089, 293281, 305572, 156069, 283039, 289195, 377265, 299449, 311739, 293309, 278974, 311744, 317889, 291266, 326083, 278979, 278988, 326093, 281038, 281039, 283088, 278992, 283089, 289229, 279000, 176602, 285152, 279009, 291297, 188899, 195044, 279014, 242150, 319976, 279017, 311787, 281071, 319986, 279030, 311800, 317949, 283138, 279042, 233987, 287237, 322057, 309770, 342537, 279053, 283154, 303634, 182802, 279061, 303635, 188954, 279066, 322077, 291359, 227881, 293420, 289328, 283185, 279092, 234037, 23093, 244279, 244280, 338491, 301635, 309831, 55880, 377419, 281165, 303693, 281170, 326229, 309847, 189016, 115287, 111197, 295518, 287327, 242274, 244326, 279150, 281200, 287345, 287348, 301688, 189054, 287359, 297600, 303743, 291455, 301702, 279176, 311944, 311948, 184974, 316048, 311953, 227991, 295575, 289435, 303772, 205469, 221853, 314020, 285348, 279207, 295598, 279215, 285360, 342705, 299698, 285362, 287412, 166581, 318127, 154295, 293552, 303802, 314043, 287418, 66243, 291529, 287434, 225996, 363212, 287438, 242385, 279249, 303826, 279253, 158424, 299737, 230105, 322269, 342757, 295653, 289511, 230120, 234216, 330473, 285419, 289517, 215790, 170735, 312046, 125683, 230133, 199415, 234233, 279293, 205566, 322302, 289534, 299777, 291584, 285443, 228099, 291591, 295688, 322312, 285450, 264971, 312076, 295698, 291605, 166677, 283418, 285467, 221980, 281378, 283431, 262952, 262953, 279337, 293673, 289580, 262957, 318247, 164655, 301872, 242481, 234290, 303921, 318251, 285493, 230198, 285496, 201534, 281407, 222017, 295745, 293702, 318279, 283466, 281426, 279379, 295769, 201562, 234330, 281434, 322396, 230238, 230239, 301919, 279393, 293729, 349025, 281444, 303973, 279398, 177002, 242540, 310132, 295797, 207735, 295799, 279418, 269179, 177018, 314240, 291713, 158594, 240517, 287623, 228232, 416649, 279434, 320394, 316299, 299912, 234382, 308111, 308113, 293780, 310166, 289691, 209820, 240543, 283551, 310177, 289699, 189349, 289704, 279465, 293801, 304050, 289720, 289723, 189373, 213956, 345030, 213961, 279499, 56270, 191445, 183254, 304086, 314343, 304104, 324587, 183276, 289773, 320492, 203758, 287730, 312313, 328701, 312317, 234499, 293894, 320520, 230411, 320526, 234513, 238611, 140311, 316441, 197658, 132140, 113710, 189487, 281647, 322609, 312372, 203829, 300087, 238650, 320571, 21567, 336962, 160834, 314437, 349254, 238663, 300109, 207954, 234578, 296023, 205911, 314458, 281699, 230500, 285795, 322664, 228457, 279659, 318571, 234606, 300145, 238706, 279666, 230514, 312435, 302202, 285819, 314493, 150656, 279686, 222344, 285833, 285834, 318602, 228492, 337037, 177297, 308375, 324761, 285850, 296091, 119965, 234655, 330912, 300192, 339106, 306339, 234662, 300200, 249003, 238764, 3243, 322733, 294069, 300215, 64699, 294075, 228541, 283841, 283846, 312519, 279752, 283849, 148687, 290001, 189651, 316628, 279766, 189656, 279775, 304352, 298209, 304353, 279780, 228587, 279789, 290030, 302319, 316661, 283894, 208123, 292092, 279803, 228608, 322826, 242955, 177420, 312588, 318732, 126229, 318746, 320795, 320802, 130342, 304422, 130344, 298290, 312628, 300342, 222523, 286012, 279872, 181568, 279874, 300355, 193858, 294210, 300354, 372039, 304457, 230730, 296269, 222542, 234830, 238928, 224591, 296274, 318804, 314708, 283990, 357720, 300378, 300379, 316764, 294236, 292194, 230757, 281958, 134504, 306541, 284015, 296304, 327023, 230772, 314742, 310650, 224637, 306558, 290176, 314752, 179586, 243073, 306561, 294278, 314759, 296328, 296330, 298378, 368012, 304523, 314771, 306580, 224662, 234902, 282008, 318876, 290206, 148899, 298406, 282023, 314790, 241067, 279979, 314797, 279980, 286128, 279988, 173492, 286133, 284090, 302523, 228796, 310714, 302530, 280003, 228804, 292291, 306630, 310725, 300488, 370122, 310731, 300490, 302539, 306634, 310735, 234957, 312785, 222674, 280020, 280025, 310747, 239069, 144862, 286176, 187877, 320997, 310758, 280042, 280043, 191980, 300526, 337391, 282097, 308722, 296434, 306678, 191991, 288248, 40439, 286201, 300539, 288252, 312830, 290304, 228868, 292359, 218632, 302602, 230922, 323083, 294413, 323088, 282132, 230933, 282135, 316951, 374297, 222754, 313338, 306730, 312879, 230960, 288305, 239159, 290359, 323132, 157246, 288319, 288322, 280131, 349764, 310853, 282182, 124486, 288328, 194118, 224848, 224852, 290391, 128600, 235096, 306777, 239192, 212574, 345697, 204386, 300643, 300645, 282214, 312937, 224874, 243306, 312941, 310896, 294517, 288377, 290425, 325246, 333438, 235136, 280193, 282244, 239238, 288391, 282248, 286344, 323208, 179853, 286351, 188049, 229011, 239251, 323226, 179868, 229021, 302751, 282272, 198304, 282279, 298664, 298666, 317102, 286387, 286392, 302778, 306875, 280252, 280253, 282302, 296636, 286400, 323265, 323262, 280259, 321217, 282309, 239305, 280266, 306891, 296649, 212684, 302798, 241360, 282321, 286419, 241366, 282330, 18139, 280285, 294621, 282336, 294629, 153318, 12009, 282347, 288492, 282349, 323315, 67316, 34547, 288508, 200444, 282366, 286463, 319232, 288515, 280326, 282375, 323335, 284425, 300810, 116491, 282379, 280333, 216844, 284430, 161553, 321298, 124691, 284436, 118549, 116502, 278294, 282390, 321308, 321309, 282399, 241440, 282401, 315172, 241447, 333609, 286507, 294699, 284460, 280367, 282418, 280373, 282424, 280377, 319289, 321338, 282428, 280381, 413500, 241471, 280386, 280391, 153416, 315209, 159563, 280396, 307024, 317268, 237397, 307030, 18263, 241494, 284508, 300893, 237411, 284515, 276326, 282471, 296807, 292713, 282476, 292719, 296815, 313200, 313204, 317305, 124795, 317308, 339840, 315265, 280451, 327556, 188293, 282503, 67464, 243592, 315272, 315275, 325514, 311183, 184207, 124816, 282517, 294806, 214936, 294808, 124826, 239515, 333727, 214943, 319393, 219046, 333734, 284584, 294824, 298921, 313257, 292783, 126896, 200628, 300983, 343993, 288698, 98240, 294849, 214978, 280517, 280518, 214983, 153553, 231382, 323554, 292835, 190437, 292838, 294887, 317416, 278507, 311277, 296942, 124912, 278515, 325620, 239610 ]
f58278037b7f983f11524b963b1b851f6b5b3301
8dbfb0d430569b6063810aca85f9fddd9bc18272
/test/FixCode/fixits-switch-nonfrozen.swift
0542ee2d63e8581e7b8ef29a7718afea87db5967
[ "Apache-2.0", "Swift-exception" ]
permissive
ye-man/swift
008587e308f9490e638e27961194fece438824cc
9cb7ab18961b6f2c93feba4b71d3c12cfacbcbba
refs/heads/master
2020-05-26T14:30:12.275094
2019-05-23T15:38:33
2019-05-23T15:38:33
188,264,993
1
1
Apache-2.0
2019-05-23T15:54:11
2019-05-23T15:54:11
null
UTF-8
Swift
false
false
5,822
swift
// RUN: not %target-swift-frontend -emit-sil %s -emit-fixits-path %t.remap -enable-library-evolution -enable-nonfrozen-enum-exhaustivity-diagnostics -diagnostics-editor-mode // RUN: c-arcmt-test %t.remap | arcmt-test -verify-transformed-files %s.result enum Runcible { case spoon case hat case fork } func checkDiagnosticMinimality(x: Runcible?) { switch (x!, x!) { case (.spoon, .spoon): break case (.spoon, .hat): break case (.hat, .spoon): break } switch (x!, x!) { case (.spoon, .spoon): break case (.hat, .hat): break } } enum LargeSpaceEnum { case case0 case case1 case case2 case case3 case case4 case case5 case case6 case case7 case case8 case case9 case case10 } func notQuiteBigEnough() -> Bool { switch (LargeSpaceEnum.case1, LargeSpaceEnum.case2) { case (.case0, .case0): return true case (.case1, .case1): return true case (.case2, .case2): return true case (.case3, .case3): return true case (.case4, .case4): return true case (.case5, .case5): return true case (.case6, .case6): return true case (.case7, .case7): return true case (.case8, .case8): return true case (.case9, .case9): return true case (.case10, .case10): return true } } enum OverlyLargeSpaceEnum { case case0 case case1 case case2 case case3 case case4 case case5 case case6 case case7 case case8 case case9 case case10 case case11 } enum ContainsOverlyLargeEnum { case one(OverlyLargeSpaceEnum) case two(OverlyLargeSpaceEnum) case three(OverlyLargeSpaceEnum, OverlyLargeSpaceEnum) } func quiteBigEnough() -> Bool { switch (OverlyLargeSpaceEnum.case1, OverlyLargeSpaceEnum.case2) { case (.case0, .case0): return true case (.case1, .case1): return true case (.case2, .case2): return true case (.case3, .case3): return true case (.case4, .case4): return true case (.case5, .case5): return true case (.case6, .case6): return true case (.case7, .case7): return true case (.case8, .case8): return true case (.case9, .case9): return true case (.case10, .case10): return true case (.case11, .case11): return true } switch (OverlyLargeSpaceEnum.case1, OverlyLargeSpaceEnum.case2) { case (.case0, _): return true case (.case1, _): return true case (.case2, _): return true case (.case3, _): return true case (.case4, _): return true case (.case5, _): return true case (.case6, _): return true case (.case7, _): return true case (.case8, _): return true case (.case9, _): return true case (.case10, _): return true } } indirect enum InfinitelySized { case one case two case recur(InfinitelySized) case mutualRecur(MutuallyRecursive, InfinitelySized) } indirect enum MutuallyRecursive { case one case two case recur(MutuallyRecursive) case mutualRecur(InfinitelySized, MutuallyRecursive) } func infinitelySized() -> Bool { switch (InfinitelySized.one, InfinitelySized.one) { case (.one, .one): return true case (.two, .two): return true } switch (MutuallyRecursive.one, MutuallyRecursive.one) { case (.one, .one): return true case (.two, .two): return true } } public enum NonExhaustive { case a, b } public enum NonExhaustivePayload { case a(Int), b(Bool) } @_frozen public enum TemporalProxy { case seconds(Int) case milliseconds(Int) case microseconds(Int) case nanoseconds(Int) case never } // Inlineable code is considered "outside" the module and must include a default // case. @inlinable public func testNonExhaustive(_ value: NonExhaustive, _ payload: NonExhaustivePayload, for interval: TemporalProxy, flag: Bool) { switch value { case .a: break } switch value { case .a: break case .b: break } switch value { case .a: break case .b: break default: break // no-warning } switch value { case .a: break case .b: break @unknown case _: break // no-warning } switch value { case .a: break @unknown case _: break } switch value { @unknown case _: break } // Test being part of other spaces. switch value as Optional { case .a?: break case .b?: break case nil: break } switch value as Optional { case .a?: break case .b?: break case nil: break @unknown case _: break } // no-warning switch value as Optional { case _?: break case nil: break } // no-warning switch (value, flag) { case (.a, _): break case (.b, false): break case (_, true): break } switch (value, flag) { case (.a, _): break case (.b, false): break case (_, true): break @unknown case _: break } // no-warning switch (flag, value) { case (_, .a): break case (false, .b): break case (true, _): break } switch (flag, value) { case (_, .a): break case (false, .b): break case (true, _): break @unknown case _: break } // no-warning switch (value, value) { case (.a, _), (_, .a): break case (.b, _), (_, .b): break } switch (value, value) { case (.a, _), (_, .a): break case (.b, _), (_, .b): break @unknown case _: break } // no-warning switch (value, interval) { case (_, .seconds): break case (.a, _): break case (.b, _): break } switch (value, interval) { case (_, .never): break case (.a, _): break case (.b, _): break } // Test payloaded enums. switch payload { case .a: break } switch payload { case .a: break case .b: break } switch payload { case .a: break case .b: break default: break // no-warning } switch payload { case .a: break case .b: break @unknown case _: break // no-warning } switch payload { case .a: break @unknown case _: break } switch payload { case .a: break case .b(false): break } switch payload { case .a: break case .b(false): break @unknown case _: break } }
[ 84634, 84635 ]
a16349936abf7918cc2028b08b31010197ffcefb
a309e07d56d1efba9482479111de5d58a2acda50
/SimpleCoordinator/SimpleCoordinator/View Controllers/SettingsViewController.swift
ce70c33b1d17522c55db5d863fe62c377bb6f111
[]
no_license
runrunrun/DesignPatterns-iOS
298a213a8edd49d31ca25838fdfbbfa358b950ed
46f3cac09b075edb60d1e29de5d0982e7ccc25d6
refs/heads/main
2023-08-17T13:22:09.700869
2021-10-16T02:40:23
2021-10-16T02:40:23
309,087,768
0
0
null
null
null
null
UTF-8
Swift
false
false
534
swift
// // SettingsViewController.swift // SimpleCoordinator // // Created by Kunwar, Hari on 11/1/20. // Copyright © 2020 Learning. All rights reserved. // import UIKit final class SettingsViewController: UIViewController, Storyboarded { weak var coordinator: MainCoordinator? override func viewDidLoad() { super.viewDidLoad() } @IBAction func presentGeneralInfo(_ sender: Any) { coordinator?.presentGeneralInfo() } @IBAction func presentAboutInfo(_ sender: Any) { coordinator?.presentAboutInfo() } }
[ -1 ]
928e98dc86bcc3f83c04d48cdf2e1c7c71a07268
331eeb88b6c5f7c732ca0cc745cda6d93fe2658b
/Native/Oliver Binns/Model/Post.swift
fc888fa9ea7ddc097c6f2a3ec25b3f6873d79d94
[]
no_license
Williamarnoclement/Oliver-Binns
f0ed5cb8b10ff5ca75068fa9e9e2761de29a52c4
08cbfcab90fe69763b6e27c84d81442fdf0596f2
refs/heads/main
2023-03-28T13:21:08.968236
2021-04-02T11:49:56
2021-04-02T11:49:56
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,230
swift
// // Post.swift // Oliver Binns // // Created by Oliver Binns on 12/09/2020. // import SwiftSoup import SwiftUI final class Post: NSObject, Decodable, Identifiable { let id: Int let slug: String let title: String private(set) var excerpt: NSAttributedString? let link: URL let imageURL: URL? let publishedDate: Date var content: [PostContent] = [] enum CodingKeys: String, CodingKey { case id, slug, link, title, excerpt, content case publishedDate = "date_gmt" case imageURL = "jetpack_featured_media_url" } init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) id = try values.decode(Int.self, forKey: .id) slug = try values.decode(String.self, forKey: .slug) title = try values.decode(RenderedContent.self, forKey: .title).rendered link = try values.decode(URL.self, forKey: .link) imageURL = try? values.decode(URL.self, forKey: .imageURL) publishedDate = try values.decode(Date.self, forKey: .publishedDate) let excerptHTML = try values.decode(RenderedContent.self, forKey: .excerpt).rendered let contentHTML = try values.decode(RenderedContent.self, forKey: .content).rendered super.init() guard let queue = decoder.userInfo[.dispatchQueue] as? DispatchQueue, let group = decoder.userInfo[.dispatchGroup] as? DispatchGroup else { assertionFailure("Dispatch Group and Queue should be given") return } queue.async { group.wait() group.enter() self.excerpt = try? NSMutableAttributedString(data: Data(excerptHTML.utf8), options: [.documentType: NSAttributedString.DocumentType.html], documentAttributes: nil) let xml = try? SwiftSoup.parse(contentHTML) self.content = xml?.body()?.children().compactMap { try? PostContent(element: $0) } ?? [] group.leave() } } } struct RenderedContent: Decodable { let rendered: String }
[ -1 ]
6a48dacbb0e7f569f863a5d1532cf0cbc873ce2d
8bbeb7b5721a9dbf40caa47a96e6961ceabb0128
/swift/541.Reverse String II(反转字符串 II).swift
d1940f42e2328f9f6d03285cc684eedee4f31d23
[ "MIT" ]
permissive
lishulongVI/leetcode
bb5b75642f69dfaec0c2ee3e06369c715125b1ba
6731e128be0fd3c0bdfe885c1a409ac54b929597
refs/heads/master
2020-03-23T22:17:40.335970
2018-07-23T14:46:06
2018-07-23T14:46:06
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,993
swift
/* </p> Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, reverse all of them. If there are less than 2k but greater than or equal to k characters, then reverse the first k characters and left the other as original. </p> <p><b>Example:</b><br /> <pre> <b>Input:</b> s = "abcdefg", k = 2 <b>Output:</b> "bacdfeg" </pre> </p> <b>Restrictions:</b> </b> <ol> <li> The string consists of lower English letters only.</li> <li> Length of the given string and k will in the range [1, 10000]</li> </ol><p>给定一个字符串和一个整数 k,你需要对从字符串开头算起的每个 2k 个字符的前k个字符进行反转。如果剩余少于 k 个字符,则将剩余的所有全部反转。如果有小于 2k 但大于或等于 k 个字符,则反转前 k 个字符,并将剩余的字符保持原样。</p> <p><strong>示例:</strong></p> <pre> <strong>输入:</strong> s = &quot;abcdefg&quot;, k = 2 <strong>输出:</strong> &quot;bacdfeg&quot; </pre> <p><strong>要求:</strong></p> <ol> <li>该字符串只包含小写的英文字母。</li> <li>给定字符串的长度和 k 在[1, 10000]范围内。</li> </ol> <p>给定一个字符串和一个整数 k,你需要对从字符串开头算起的每个 2k 个字符的前k个字符进行反转。如果剩余少于 k 个字符,则将剩余的所有全部反转。如果有小于 2k 但大于或等于 k 个字符,则反转前 k 个字符,并将剩余的字符保持原样。</p> <p><strong>示例:</strong></p> <pre> <strong>输入:</strong> s = &quot;abcdefg&quot;, k = 2 <strong>输出:</strong> &quot;bacdfeg&quot; </pre> <p><strong>要求:</strong></p> <ol> <li>该字符串只包含小写的英文字母。</li> <li>给定字符串的长度和 k 在[1, 10000]范围内。</li> </ol> */ class Solution { func reverseStr(_ s: String, _ k: Int) -> String { } }
[ -1 ]
d994a1941a6ab4c4c45f7918dd73094a59916ddf
fee2217e205c6b8bced4ae2d67c058ff3b63aa56
/EatBy/View/RestaurantDetailIconTextCell.swift
0f9cc71fee229d8ab283c6438de1374f446d725a
[]
no_license
MitaliK/EatBy
744e36fabc9899f2ae5edfd5c80cc777ac7adeca
a31b44142c5bf00606d106874857a53fbbed768c
refs/heads/master
2020-03-25T22:20:02.812060
2019-01-29T17:45:38
2019-01-29T17:45:38
144,217,145
1
0
null
2018-09-13T23:12:39
2018-08-10T00:31:03
Swift
UTF-8
Swift
false
false
732
swift
// // RestaurantDetailIconTextCell.swift // FoodPin // // Created by Mitali Kulkarni on 07/07/18. // Copyright © 2018 Mitali Kulkarni. All rights reserved. // import UIKit class RestaurantDetailIconTextCell: UITableViewCell { // MARK: - Properties @IBOutlet weak var iconImageView: UIImageView! @IBOutlet weak var shortTextLabel: UILabel! { didSet { shortTextLabel.numberOfLines = 0 } } override func awakeFromNib() { super.awakeFromNib() // Initialization code } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } }
[ 266376, 418826, 328211, 158740, 345633, 345634, 328228, 349477, 337321, 110387, 64691, 303540, 312761, 300988, 311755, 317020, 213098, 179567, 213105, 14578, 244599, 213115, 242301, 201727 ]
c4a2dd922524bbbef2fac03ef0160801bec73bd1
5f8458762d577f99067d4fd3d50ad392536f18d7
/IBAnimatable/PresenterManager.swift
044a4b07d355010f922a0e73c110ce4ea55afefd
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
mohsinalimat/IBAnimatable
b1173eef681c3551b7265fd7b44f05ee47d8307f
5cbddcbcba8b8f7556cfe72cd10e062d53356a63
refs/heads/master
2020-12-11T08:01:40.974407
2016-05-09T06:37:59
2016-05-09T06:37:59
58,358,438
1
0
null
2016-05-09T07:50:06
2016-05-09T07:50:06
null
UTF-8
Swift
false
false
1,477
swift
// // Created by Jake Lin on 2/29/16. // Copyright © 2016 Jake Lin. All rights reserved. // import Foundation /** Presenter Manager: Used to cache the Presenters for Present and Dismiss transitions */ class PresenterManager { // MARK: - Singleton Constructor private init() {} private struct Shared { static let instance = PresenterManager() } internal static func sharedManager() -> PresenterManager { return Shared.instance } // MARK: - Private private var cache = [String: Presenter]() // MARK: Internal Interface func retrievePresenter(transitionAnimationType: TransitionAnimationType, transitionDuration: Duration = defaultTransitionDuration, interactiveGestureType: InteractiveGestureType? = nil) -> Presenter { // Get the cached presenter let presenter = cache[transitionAnimationType.stringValue] if let presenter = presenter { // Update the `transitionDuration` and `interactiveGestureType` every time to reuse the same presenter with the same type presenter.transitionDuration = transitionDuration presenter.interactiveGestureType = interactiveGestureType return presenter } // Create a new if cache doesn't exist let newPresenter = Presenter(transitionAnimationType: transitionAnimationType, transitionDuration: transitionDuration, interactiveGestureType: interactiveGestureType) cache[transitionAnimationType.stringValue] = newPresenter return newPresenter } }
[ 289808, 239417 ]
fbc05360dc7fb7b8236146c9aedd2240b7fac024
922f86c06d0f6f1afb8a39fcb467c9a709fc4e87
/ClassUp-iOS/SubjectSelectionCellTVC.swift
b4d2e5efe4f52aa0c93d8ded37ac579e9723b672
[]
no_license
atulmala/iOS-Code
29e2236030c0672952c48dfdfb98f832e1032aa5
305291344495c939ee9eeb39b50e9015f45dd0be
refs/heads/master
2021-06-01T16:37:33.481459
2018-10-02T14:35:12
2018-10-02T14:35:12
37,502,330
0
0
null
null
null
null
UTF-8
Swift
false
false
532
swift
// // SubjectSelectionTVC.swift // ClassUp-iOS // // Created by Atul Gupta on 27/03/16. // Copyright © 2016 EmergeTech Mobile Products & Services Pvt Ltd. All rights reserved. // import UIKit class SubjectSelectionTVC: UITableViewCell { override func awakeFromNib() { super.awakeFromNib() // Initialization code } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } }
[ 168324, 115300, 213105, 115315, 115316, 177014, 213115, 115324, 201727 ]
b84b871d42b291d4aef01294b57d0f9b53a28865
e9f87eb248b4688873af04af9aeaf9f9aa85178f
/SampleTimerApp/TimerView.swift
2f8795b9a28b0f6793ba6e64d41c1ae0ac78d9bd
[]
no_license
kurisu-seima/TimerApp
534a23bb948c0c81b7606d05db2945eb3efcdbd1
66cf1c5499d9dcdfd984ca0ff9a647e9c19f12d6
refs/heads/master
2023-04-12T23:00:57.907904
2021-04-21T07:52:03
2021-04-21T07:52:03
320,872,462
0
0
null
null
null
null
UTF-8
Swift
false
false
2,270
swift
// // TimerView.swift // SampleTimerApp // // Created by くりすせいま on 2020/12/06. // Copyright © 2020 星舞. All rights reserved. // import UIKit protocol TimerViewDelegate { func setTImer() -> Int func endTimer() } class TimerView: UIView { @IBOutlet weak var countDwonLabel: UILabel! @IBOutlet weak var timerActionLabel: UIButton! var timer = Timer() var timerCount = 0 var delegate: TimerViewDelegate? { didSet { guard let count = self.delegate?.setTImer() else { return } timerCount = count countDwonLabel.text = String(count) } } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) self.nibInit() } fileprivate func nibInit() { guard let view = UINib(nibName: "TimerView", bundle: nil).instantiate(withOwner: self, options: nil).first as? UIView else { return } view.frame = self.bounds view.autoresizingMask = [.flexibleHeight, .flexibleWidth] self.addSubview(view) } @IBAction func startButtonDidTapped(_ sender: Any) { if !timer.isValid { startTimer() timerActionLabel.setTitle("ストップ", for: .normal) } else { pause() timerActionLabel.setTitle("スタート", for: .normal) } } func startTimer() { if timerCount != 0 { timer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(timerAction), userInfo: nil, repeats: true) } } func pause() { timer.invalidate() } func reloadData() { guard let count = self.delegate?.setTImer() else { return } timerCount = count countDwonLabel.text = String(count) } @objc func timerAction() { timerCount -= 1 if timerCount == 0 { self.delegate?.endTimer() timer.invalidate() timerCount = 0 timerActionLabel.setTitle("スタート", for: .normal) } countDwonLabel.text = String(timerCount) } }
[ -1 ]
9b3f846f096f4d7d2594b0cf23019a3c62d3d4e5
2969bb9ec36fb1bd5181734e15be50ebddcb13ba
/Darkhorse-iOS/Scenes/LibraryViewController.swift
637327104ee11b1248219a0b46bbcc7f02156451
[]
no_license
redroostertech/Darkhorse-IOS
ad83ca464ca5fb632180e3d1684cd1aecb2a8375
d34e7d17b4e01823952dde6b4487691856208848
refs/heads/master
2023-02-21T07:06:50.953948
2021-01-25T19:16:10
2021-01-25T19:16:10
331,039,415
0
0
null
null
null
null
UTF-8
Swift
false
false
3,597
swift
// // LibraryViewController.swift // Darkhorse-iOS // // Created by Michael Westbrooks on 1/22/21. // Copyright © 2021 Nuracode. All rights reserved. // import UIKit import EachNavigationBar import Parchment class LibraryViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { @IBOutlet weak var mainTableView: UITableView! private var navigationBar: EachNavigationBar? private var navBarHeight: CGFloat = kNavBarHeight private var navBar: EachNavigationBar { let navbar = EachNavigationBar(viewController: self) navbar.frame = CGRect(x: .zero, y: kTopOfScreenPlusStatusBar, width: kWidthOfScreen, height: navBarHeight) navbar.barTintColor = .white navbar.prefersLargeTitles = true navbar.isShadowHidden = true navbar.items = [ navItem ] navbar.tintColor = .black navbar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.black] navbar.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.black] return navbar } private var navItem: UINavigationItem { let navitem = UINavigationItem() // let menuButton = UIBarButtonItem(image: UIImage(named: kImageMenu)!.maskWithColor(color: .black), // style: .plain, // target: self, // action: #selector(HomeViewController.showMenu)) // menuButton.tintColor = .white // let userProfileButton = UIBarButtonItem(image: UIImage(named: kImageHistory)!.maskWithColor(color: .black), // style: .plain, // target: self, // action: #selector(HomeViewController.showFilterOptions)) // navitem.leftBarButtonItems = [ // menuButton // ] // navitem.rightBarButtonItems = [ // userProfileButton // ] navitem.largeTitleDisplayMode = .always return navitem } override func viewDidLoad() { super.viewDidLoad() mainTableView.delegate = self mainTableView.dataSource = self mainTableView.register(WelcomeCell.nib, forCellReuseIdentifier: WelcomeCell.identifier) mainTableView.register(SearchCell.nib, forCellReuseIdentifier: SearchCell.identifier) mainTableView.register(PodcastCollectionViewCell.nib, forCellReuseIdentifier: PodcastCollectionViewCell.identifier) mainTableView.register(SearchCell.nib, forCellReuseIdentifier: SearchCell.identifier) mainTableView.register(TagCellView.nib, forCellReuseIdentifier: TagCellView.identifier) // mainTableView.register(BaseSectionHeader.loadNib(), forHeaderFooterViewReuseIdentifier: BaseSectionHeader.identifier) } func numberOfSections(in tableView: UITableView) -> Int { return 2 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { switch section { case 0: return 2 default: return 5 } } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { switch indexPath.section { case 0: return UITableViewCell() default: return UITableViewCell() } } }
[ -1 ]
5108122e78ce47049346fb32c0a11ad77b8db382
7117a6050fe363a662f4573c0571c8d2b51cd07a
/TowkDemo/Cell/ShimmerTableViewCell/ShimmerTableViewCell.swift
b145dbf9f015dfda855ad642642f478872229ce8
[]
no_license
arsh6666/TowkDemo
b9fa0b2c69e8b21e1c719907910e0ea334fcb3c5
f4db06544f4c173b7830d7abe5da15c310adeeb4
refs/heads/main
2023-07-07T10:10:46.990519
2021-08-13T15:28:31
2021-08-13T15:28:31
395,702,707
0
0
null
null
null
null
UTF-8
Swift
false
false
448
swift
// // NormalTableViewCell.swift // TowkDemo // // Created by Arshdeep Singh on 11/08/21. // import UIKit class ShimmerTableViewCell: UITableViewCell { override func awakeFromNib() { super.awakeFromNib() // Initialization code } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } }
[ 300800, 300802, 418824, 266376, 287242, 418826, 327181, 131725, 398865, 328211, 158740, 351386, 345633, 345634, 328228, 349477, 131748, 49959, 337321, 311212, 327344, 110387, 64691, 282933, 303540, 312761, 300986, 300988, 257858, 311755, 315351, 315354, 302555, 317020, 336738, 213098, 155243, 217069, 163949, 179567, 115311, 213105, 14578, 113524, 430197, 244599, 213115, 242301, 201727 ]
57bb4cedc43e92a561d7bf61cea958caca9fae9b
6a83dcfcf7cb0e5193aff6642a66c6d9979004f5
/Sources/PBBase32/Encoder/DataEncoder.swift
21029d73fe5b434c8efd263705145b510c1237c2
[ "MIT" ]
permissive
websurgeon/swift-pbBase32
2e637a21fd78cb9e32395039ba9ae2ff7e3a1169
95bb832521b3ab2fb331f92c7dd860305d5f8c64
refs/heads/master
2021-07-16T23:10:34.265814
2020-06-11T19:11:00
2020-06-11T19:11:00
174,112,825
0
0
null
null
null
null
UTF-8
Swift
false
false
170
swift
// // Copyright © 2018 Peter Barclay. All rights reserved. // import Foundation public protocol DataEncoder { func encode(data: Data) throws -> Data }
[ -1 ]
2ba0c5addb1d6aac8f3ad4fa3354f2bd3e62e6d2
4f52b4b76ed4b08f9e8bb6fc8124d4bdd8304c13
/Ikea/ViewController.swift
c0c73add52a01d7be2a37add363b88518dc93c04
[]
no_license
tewodroswondimu/Ikea
8596ce99ab04d2b53c8d02b48e1cc82dd0c4a37c
fb3c3ccfb0374911467857cc5116c5de15268ae4
refs/heads/master
2021-07-25T10:36:35.956334
2017-10-31T06:18:45
2017-10-31T06:18:45
108,897,625
2
0
null
null
null
null
UTF-8
Swift
false
false
4,484
swift
// // ViewController.swift // Ikea // // Created by Tewodros Wondimu on 10/30/17. // Copyright © 2017 Tewodros Wondimu. All rights reserved. // import UIKit import ARKit class ViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, ARSCNViewDelegate { let configuration = ARWorldTrackingConfiguration() let itemsArray: [String] = ["cup", "vase", "boxing", "table"] @IBOutlet weak var itemCollectionView: UICollectionView! @IBOutlet weak var sceneView: ARSCNView! var selecteditem: String? override func viewDidLoad() { super.viewDidLoad() self.sceneView.debugOptions = [ARSCNDebugOptions.showFeaturePoints, ARSCNDebugOptions.showWorldOrigin] self.itemCollectionView.dataSource = self self.itemCollectionView.delegate = self // enable horizontal plane detection self.configuration.planeDetection = .horizontal self.sceneView.session.run(configuration) // only show tapped planes self.registerGestureRecognizer() // 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. } func registerGestureRecognizer() { let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(tapped)) self.sceneView.addGestureRecognizer(tapGestureRecognizer) } @objc func tapped(sender: UITapGestureRecognizer) { let sceneView = sender.view as! ARSCNView let tapLocation = sender.location(in: sceneView) let hitTest = sceneView.hitTest(tapLocation, types: .existingPlaneUsingExtent) if (!hitTest.isEmpty) { print("touched a horizontal surface") addItem(hitTestResult: hitTest.first!) } else { print("No match") } } func addItem(hitTestResult: ARHitTestResult) { // find out the item is currently selected if let selectedItem = self.selecteditem { let scene = SCNScene(named: "Model.scnassets/\(selectedItem).scn") let node = (scene?.rootNode.childNode(withName: selecteditem!, recursively: false))! // encodes information let transform = hitTestResult.worldTransform // position of the horizontal surface let thirdColumn = transform.columns.3 node.position = SCNVector3(thirdColumn.x, thirdColumn.y, thirdColumn.z) self.sceneView.scene.rootNode.addChildNode(node) } } // returns how many cells that the collection view will display func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return itemsArray.count } // the contents of the collection view cell // a data source function every single view in the collection func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { // deque returns a cell type based on the identifier item // indexpath is concerned with which cell we're configuring let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "item", for: indexPath) as! ItemCell // Sets the label of the uicollection view to the name in the items array cell.itemLabel.text = self.itemsArray[indexPath.row] return cell } // When ever a button is pressed you change the background to the color green func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { let cell = collectionView.cellForItem(at: indexPath) cell?.backgroundColor = UIColor.green self.selecteditem = itemsArray[indexPath.row] } // Change the color of the collection view back to orange when deslected func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) { let cell = collectionView.cellForItem(at: indexPath) cell?.backgroundColor = UIColor.orange } func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) { guard anchor is ARPlaneAnchor else {return} } }
[ -1 ]
beab5e21144307fbd63e83495d7c382933a8955d
8623f5bb0e256e27b3c1178c40209e490f6f1b01
/SampleMVVM+RxSwift/ViewModel/WeatherTableViewModel.swift
f4eae657e6bae27fb587fcb6afbda577f9c24910
[]
no_license
yarmolchuk/SampleMVVM-RxSwift
c895fd2e7c44f7a27ebc7779bbf0c7d4e259e47a
66d639c38a26690765a115981a6b4913a724a6e3
refs/heads/master
2021-01-09T21:49:48.367589
2016-04-05T07:22:46
2016-04-05T07:22:46
55,123,701
1
0
null
null
null
null
UTF-8
Swift
false
false
4,903
swift
// // WeatherTableViewModel.swift // SampleMVVM+RxSwift // // Created by Dima Yarmolchuk on 31.03.16. // Copyright © 2016 Dima Yarmolchuk. All rights reserved. // import UIKit import RxCocoa import RxSwift import SwiftyJSON import Alamofire extension NSDate { var dayString:String { let formatter = NSDateFormatter() formatter.setLocalizedDateFormatFromTemplate("d M") return formatter.stringFromDate(self) } } class WeatherTableViewModel { struct Constants { static let baseURL = "http://api.openweathermap.org/data/2.5/forecast?q=" static let urlExtension = "&type=like&APPID=6a700a1e919dc96b0a98901c9f4bec47&units=metric" static let baseImageURL = "http://openweathermap.org/img/w/" static let imageExtension = ".png" } var disposeBag = DisposeBag() //MARK: Model var weather: Weather? { didSet { if weather?.cityName != nil { updateModel() } } } //MARK: UI var cityName = PublishSubject<String?>() var degrees = PublishSubject<String?>() var weatherDescription = PublishSubject<String?>() private var forecast:[WeatherForecast]? var weatherImage = PublishSubject<UIImage?>() var backgroundImage = PublishSubject<UIImage?>() var tableViewData = PublishSubject<[(String, [WeatherForecast])]>() var errorAlertController = PublishSubject<UIAlertController>() func updateModel() { cityName.on(.Next(weather?.cityName)) if let temp = weather?.currentWeather?.temp { degrees.on(.Next(String(temp))) } weatherDescription.on(.Next(weather?.currentWeather?.description)) if let id = weather?.currentWeather?.imageID { setWeatherImageForImageID(id) // setBackgroundImageForImageID(id) } forecast = weather?.forecast if forecast != nil { sendTableViewData() } } func setWeatherImageForImageID(imageID: String) { dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0)) { () -> Void in if let url = NSURL(string: Constants.baseImageURL + imageID + Constants.imageExtension) { if let data = NSData(contentsOfURL: url) { dispatch_async(dispatch_get_main_queue()) { () -> Void in self.weatherImage.on(.Next(UIImage(data: data))) } } } } } //Parses the forecast data into an array of (date, forecasts for that day) tuple func sendTableViewData() { if let currentForecast = forecast { var forecasts = [[WeatherForecast]]() var days = [String]() days.append(NSDate(timeIntervalSinceNow: 0).dayString) var tempForecasts = [WeatherForecast]() for forecast in currentForecast { if days.contains(forecast.date.dayString) { tempForecasts.append(forecast) } else { days.append(forecast.date.dayString) forecasts.append(tempForecasts) tempForecasts.removeAll() tempForecasts.append(forecast) } } tableViewData.on(.Next(Array(zip(days, forecasts)))) } } //MARK: Weather fetching var searchText:String? { didSet { if let text = searchText { let urlString = Constants.baseURL + text.stringByReplacingOccurrencesOfString(" ", withString: "%20") + Constants.urlExtension getWeatherForRequest(urlString) } } } func getWeatherForRequest(urlString: String) { Alamofire.request(Method.GET, urlString).rx_responseJSON() .observeOn(MainScheduler.instance) .subscribe( onNext: { json in let jsonForValidation = JSON(json) if let error = jsonForValidation["message"].string { print("got error \(error)") self.postError("Error", message: error) return } self.weather = Weather(jsonObject: json) }, onError: { error in print("Got error") let gotError = error as NSError print(gotError.domain) self.postError("\(gotError.code)", message: gotError.domain) }) .addDisposableTo(disposeBag) } func postError(title: String, message: String) { errorAlertController.on(.Next(UIAlertController(title: title, message: message, preferredStyle: .Alert))) } }
[ -1 ]
0ca470b20c38f0b7a03d2252cf4e9e7ba41ca87e
bf52acef5ad40bcd0d24f79022996ac5c1ddaae5
/test/SILGen/statements.swift
894d092583cb355f9185542e1b8dd4dfc9c4c777
[ "Apache-2.0", "Swift-exception" ]
permissive
Viewtiful/swift
506828785197d225d66e53f80a81716593d5af81
6f16056032574918d8873d6ec96acdfd11ffd562
refs/heads/master
2021-01-18T02:23:08.617470
2018-03-16T22:58:46
2018-03-16T22:58:46
47,425,413
0
1
Apache-2.0
2018-03-16T22:58:47
2015-12-04T19:47:01
C++
UTF-8
Swift
false
false
20,506
swift
// REQUIRES: plus_one_runtime // RUN: %target-swift-frontend -module-name statements -Xllvm -sil-full-demangle -parse-as-library -emit-silgen -enable-sil-ownership -verify %s | %FileCheck %s class MyClass { func foo() { } } func markUsed<T>(_ t: T) {} func marker_1() {} func marker_2() {} func marker_3() {} class BaseClass {} class DerivedClass : BaseClass {} var global_cond: Bool = false func bar(_ x: Int) {} func foo(_ x: Int, _ y: Bool) {} func abort() -> Never { abort() } func assignment(_ x: Int, y: Int) { var x = x var y = y x = 42 y = 57 _ = x _ = y (x, y) = (1,2) } // CHECK-LABEL: sil hidden @{{.*}}assignment // CHECK: integer_literal $Builtin.Int2048, 42 // CHECK: assign // CHECK: integer_literal $Builtin.Int2048, 57 // CHECK: assign func if_test(_ x: Int, y: Bool) { if (y) { bar(x); } bar(x); } // CHECK-LABEL: sil hidden @$S10statements7if_test{{[_0-9a-zA-Z]*}}F func if_else(_ x: Int, y: Bool) { if (y) { bar(x); } else { foo(x, y); } bar(x); } // CHECK-LABEL: sil hidden @$S10statements7if_else{{[_0-9a-zA-Z]*}}F func nested_if(_ x: Int, y: Bool, z: Bool) { if (y) { if (z) { bar(x); } } else { if (z) { foo(x, y); } } bar(x); } // CHECK-LABEL: sil hidden @$S10statements9nested_if{{[_0-9a-zA-Z]*}}F func nested_if_merge_noret(_ x: Int, y: Bool, z: Bool) { if (y) { if (z) { bar(x); } } else { if (z) { foo(x, y); } } } // CHECK-LABEL: sil hidden @$S10statements21nested_if_merge_noret{{[_0-9a-zA-Z]*}}F func nested_if_merge_ret(_ x: Int, y: Bool, z: Bool) -> Int { if (y) { if (z) { bar(x); } return 1 } else { if (z) { foo(x, y); } } return 2 } // CHECK-LABEL: sil hidden @$S10statements19nested_if_merge_ret{{[_0-9a-zA-Z]*}}F func else_break(_ x: Int, y: Bool, z: Bool) { while z { if y { } else { break } } } // CHECK-LABEL: sil hidden @$S10statements10else_break{{[_0-9a-zA-Z]*}}F func loop_with_break(_ x: Int, _ y: Bool, _ z: Bool) -> Int { while (x > 2) { if (y) { bar(x); break } } } // CHECK-LABEL: sil hidden @$S10statements15loop_with_break{{[_0-9a-zA-Z]*}}F func loop_with_continue(_ x: Int, y: Bool, z: Bool) -> Int { while (x > 2) { if (y) { bar(x); continue } _ = loop_with_break(x, y, z); } bar(x); } // CHECK-LABEL: sil hidden @$S10statements18loop_with_continue{{[_0-9a-zA-Z]*}}F func do_loop_with_continue(_ x: Int, y: Bool, z: Bool) -> Int { repeat { if (x < 42) { bar(x); continue } _ = loop_with_break(x, y, z); } while (x > 2); bar(x); } // CHECK-LABEL: sil hidden @$S10statements21do_loop_with_continue{{[_0-9a-zA-Z]*}}F // CHECK-LABEL: sil hidden @{{.*}}for_loops1 func for_loops1(_ x: Int, c: Bool) { for i in 1..<100 { markUsed(i) } } // CHECK-LABEL: sil hidden @{{.*}}for_loops2 func for_loops2() { // rdar://problem/19316670 // CHECK: alloc_stack $Optional<MyClass> // CHECK-NEXT: [[WRITE:%.*]] = begin_access [modify] [unknown] // CHECK: [[NEXT:%[0-9]+]] = function_ref @$Ss16IndexingIteratorV4next{{[_0-9a-zA-Z]*}}F // CHECK-NEXT: apply [[NEXT]]<[MyClass]> // CHECK: class_method [[OBJ:%[0-9]+]] : $MyClass, #MyClass.foo!1 let objects = [MyClass(), MyClass() ] for obj in objects { obj.foo() } return } func void_return() { let b:Bool if b { return } } // CHECK-LABEL: sil hidden @$S10statements11void_return{{[_0-9a-zA-Z]*}}F // CHECK: cond_br {{%[0-9]+}}, [[BB1:bb[0-9]+]], [[BB2:bb[0-9]+]] // CHECK: [[BB1]]: // CHECK: br [[EPILOG:bb[0-9]+]] // CHECK: [[BB2]]: // CHECK: br [[EPILOG]] // CHECK: [[EPILOG]]: // CHECK: [[R:%[0-9]+]] = tuple () // CHECK: return [[R]] func foo() {} // <rdar://problem/13549626> // CHECK-LABEL: sil hidden @$S10statements14return_from_if{{[_0-9a-zA-Z]*}}F func return_from_if(_ a: Bool) -> Int { // CHECK: bb0(%0 : @trivial $Bool): // CHECK: cond_br {{.*}}, [[THEN:bb[0-9]+]], [[ELSE:bb[0-9]+]] if a { // CHECK: [[THEN]]: // CHECK: br [[EPILOG:bb[0-9]+]]({{%.*}}) return 1 } else { // CHECK: [[ELSE]]: // CHECK: br [[EPILOG]]({{%.*}}) return 0 } // CHECK-NOT: function_ref @foo // CHECK: [[EPILOG]]([[RET:%.*]] : @trivial $Int): // CHECK: return [[RET]] foo() // expected-warning {{will never be executed}} } class C {} func use(_ c: C) {} func for_each_loop(_ x: [C]) { for i in x { use(i) } _ = 0 } // CHECK-LABEL: sil hidden @{{.*}}test_break func test_break(_ i : Int) { switch i { case (let x) where x != 17: if x == 42 { break } markUsed(x) default: break } } // <rdar://problem/19150249> Allow labeled "break" from an "if" statement // CHECK-LABEL: sil hidden @$S10statements13test_if_breakyyAA1CCSgF : $@convention(thin) (@owned Optional<C>) -> () { func test_if_break(_ c : C?) { // CHECK: bb0([[ARG:%.*]] : @owned $Optional<C>): label1: // CHECK: [[BORROWED_ARG:%.*]] = begin_borrow [[ARG]] // CHECK: [[ARG_COPY:%.*]] = copy_value [[BORROWED_ARG]] // CHECK: switch_enum [[ARG_COPY]] : $Optional<C>, case #Optional.some!enumelt.1: [[TRUE:bb[0-9]+]], case #Optional.none!enumelt: [[FALSE:bb[0-9]+]] if let x = c { // CHECK: [[TRUE]]({{.*}} : @owned $C): // CHECK: apply foo() // CHECK: destroy_value // CHECK: br [[FALSE:bb[0-9]+]] break label1 use(x) // expected-warning {{will never be executed}} } // CHECK: [[FALSE]]: // CHECK: return } // CHECK-LABEL: sil hidden @$S10statements18test_if_else_breakyyAA1CCSgF : $@convention(thin) (@owned Optional<C>) -> () { func test_if_else_break(_ c : C?) { // CHECK: bb0([[ARG:%.*]] : @owned $Optional<C>): label2: // CHECK: [[BORROWED_ARG:%.*]] = begin_borrow [[ARG]] // CHECK: [[ARG_COPY:%.*]] = copy_value [[BORROWED_ARG]] // CHECK: switch_enum [[ARG_COPY]] : $Optional<C>, case #Optional.some!enumelt.1: [[TRUE:bb[0-9]+]], case #Optional.none!enumelt: [[FALSE:bb[0-9]+]] // CHECK: [[FALSE]]: // CHECK: end_borrow [[BORROWED_ARG]] from [[ARG]] // CHECK: br [[AFTER_FALSE:bb[0-9]+]] if let x = c { // CHECK: [[TRUE]]({{.*}} : @owned $C): use(x) // CHECK: br [[CONT:bb[0-9]+]] // CHECK: [[CONT]]: // CHECK: br [[EPILOG:bb[0-9]+]] } else { // CHECK: [[AFTER_FALSE]]: // CHECK: apply // CHECK: br [[EPILOG]] foo() break label2 foo() // expected-warning {{will never be executed}} } // CHECK: [[EPILOG]]: // CHECK: return } // CHECK-LABEL: sil hidden @$S10statements23test_if_else_then_breakyySb_AA1CCSgtF func test_if_else_then_break(_ a : Bool, _ c : C?) { label3: // CHECK: bb0({{.*}}, [[ARG2:%.*]] : @owned $Optional<C>): // CHECK: [[BORROWED_ARG2:%.*]] = begin_borrow [[ARG2]] // CHECK: [[ARG2_COPY:%.*]] = copy_value [[BORROWED_ARG2]] // CHECK: switch_enum [[ARG2_COPY]] : $Optional<C>, case #Optional.some!enumelt.1: [[TRUE:bb[0-9]+]], case #Optional.none!enumelt: [[FALSE:bb[0-9]+]] // CHECK: [[FALSE]]: // CHECK: end_borrow [[BORROWED_ARG2]] from [[ARG2]] // CHECK: br [[COND2:bb[0-9]+]] if let x = c { // CHECK: [[TRUE]]({{.*}} : @owned $C): use(x) // CHECK: br [[TRUE_TRAMPOLINE:bb[0-9]+]] // // CHECK: [[TRUE_TRAMPOLINE]]: // CHECK: br [[EPILOG_BB:bb[0-9]+]] } else if a { // CHECK: [[COND2]]: // CHECK: cond_br {{.*}}, [[TRUE2:bb[0-9]+]], [[FALSE2:bb[0-9]+]] // // CHECK: [[TRUE2]]: // CHECK: apply // CHECK: br [[EPILOG_BB]] foo() break label3 foo() // expected-warning {{will never be executed}} } // CHECK: [[FALSE2]]: // CHECK: br [[EPILOG_BB]] // CHECK: [[EPILOG_BB]]: // CHECK: return } // CHECK-LABEL: sil hidden @$S10statements13test_if_breakyySbF func test_if_break(_ a : Bool) { // CHECK: br [[LOOP:bb[0-9]+]] // CHECK: [[LOOP]]: // CHECK: function_ref @$SSb21_getBuiltinLogicValue{{[_0-9a-zA-Z]*}}F // CHECK-NEXT: apply // CHECK-NEXT: cond_br {{.*}}, [[LOOPTRUE:bb[0-9]+]], [[OUT:bb[0-9]+]] while a { if a { foo() break // breaks out of while, not if. } foo() } // CHECK: [[LOOPTRUE]]: // CHECK: function_ref @$SSb21_getBuiltinLogicValue{{[_0-9a-zA-Z]*}}F // CHECK-NEXT: apply // CHECK-NEXT: cond_br {{.*}}, [[IFTRUE:bb[0-9]+]], [[IFFALSE:bb[0-9]+]] // [[IFTRUE]]: // CHECK: function_ref statements.foo // CHECK: br [[OUT]] // CHECK: [[IFFALSE]]: // CHECK: function_ref statements.foo // CHECK: br [[LOOP]] // CHECK: [[OUT]]: // CHECK: return } // CHECK-LABEL: sil hidden @$S10statements7test_doyyF func test_do() { // CHECK: integer_literal $Builtin.Int2048, 0 // CHECK: [[BAR:%.*]] = function_ref @$S10statements3baryySiF // CHECK: apply [[BAR]]( bar(0) // CHECK-NOT: br bb do { // CHECK: [[CTOR:%.*]] = function_ref @$S10statements7MyClassC{{[_0-9a-zA-Z]*}}fC // CHECK: [[OBJ:%.*]] = apply [[CTOR]]( let obj = MyClass() _ = obj // CHECK: integer_literal $Builtin.Int2048, 1 // CHECK: [[BAR:%.*]] = function_ref @$S10statements3baryySiF // CHECK: apply [[BAR]]( bar(1) // CHECK-NOT: br bb // CHECK: destroy_value [[OBJ]] // CHECK-NOT: br bb } // CHECK: integer_literal $Builtin.Int2048, 2 // CHECK: [[BAR:%.*]] = function_ref @$S10statements3baryySiF // CHECK: apply [[BAR]]( bar(2) } // CHECK-LABEL: sil hidden @$S10statements15test_do_labeledyyF func test_do_labeled() { // CHECK: integer_literal $Builtin.Int2048, 0 // CHECK: [[BAR:%.*]] = function_ref @$S10statements3baryySiF // CHECK: apply [[BAR]]( bar(0) // CHECK: br bb1 // CHECK: bb1: lbl: do { // CHECK: [[CTOR:%.*]] = function_ref @$S10statements7MyClassC{{[_0-9a-zA-Z]*}}fC // CHECK: [[OBJ:%.*]] = apply [[CTOR]]( let obj = MyClass() _ = obj // CHECK: integer_literal $Builtin.Int2048, 1 // CHECK: [[BAR:%.*]] = function_ref @$S10statements3baryySiF // CHECK: apply [[BAR]]( bar(1) // CHECK: [[GLOBAL:%.*]] = function_ref @$S10statements11global_condSbvau // CHECK: cond_br {{%.*}}, bb2, bb3 if (global_cond) { // CHECK: bb2: // CHECK: destroy_value [[OBJ]] // CHECK: br bb1 continue lbl } // CHECK: bb3: // CHECK: integer_literal $Builtin.Int2048, 2 // CHECK: [[BAR:%.*]] = function_ref @$S10statements3baryySiF // CHECK: apply [[BAR]]( bar(2) // CHECK: [[GLOBAL:%.*]] = function_ref @$S10statements11global_condSbvau // CHECK: cond_br {{%.*}}, bb4, bb5 if (global_cond) { // CHECK: bb4: // CHECK: destroy_value [[OBJ]] // CHECK: br bb6 break lbl } // CHECK: bb5: // CHECK: integer_literal $Builtin.Int2048, 3 // CHECK: [[BAR:%.*]] = function_ref @$S10statements3baryySiF // CHECK: apply [[BAR]]( bar(3) // CHECK: destroy_value [[OBJ]] // CHECK: br bb6 } // CHECK: integer_literal $Builtin.Int2048, 4 // CHECK: [[BAR:%.*]] = function_ref @$S10statements3baryySiF // CHECK: apply [[BAR]]( bar(4) } func callee1() {} func callee2() {} func callee3() {} // CHECK-LABEL: sil hidden @$S10statements11defer_test1yyF func defer_test1() { defer { callee1() } defer { callee2() } callee3() // CHECK: [[C3:%.*]] = function_ref @$S10statements7callee3yyF // CHECK: apply [[C3]] // CHECK: [[C2:%.*]] = function_ref @$S10statements11defer_test1yyF6 // CHECK: apply [[C2]] // CHECK: [[C1:%.*]] = function_ref @$S10statements11defer_test1yyF6 // CHECK: apply [[C1]] } // CHECK: sil private @$S10statements11defer_test1yyF6 // CHECK: function_ref @{{.*}}callee1yyF // CHECK: sil private @$S10statements11defer_test1yyF6 // CHECK: function_ref @{{.*}}callee2yyF // CHECK-LABEL: sil hidden @$S10statements11defer_test2yySbF func defer_test2(_ cond : Bool) { // CHECK: [[C3:%.*]] = function_ref @{{.*}}callee3yyF // CHECK: apply [[C3]] // CHECK: br [[LOOP:bb[0-9]+]] callee3() // CHECK: [[LOOP]]: // test the condition. // CHECK: [[CONDTRUE:%.*]] = apply {{.*}}(%0) // CHECK: cond_br [[CONDTRUE]], [[BODY:bb[0-9]+]], [[EXIT:bb[0-9]+]] while cond { // CHECK: [[BODY]]: // CHECK: [[C2:%.*]] = function_ref @{{.*}}callee2yyF // CHECK: apply [[C2]] // CHECK: [[C1:%.*]] = function_ref @$S10statements11defer_test2yySbF6 // CHECK: apply [[C1]] // CHECK: br [[EXIT]] defer { callee1() } callee2() break } // CHECK: [[EXIT]]: // CHECK: [[C3:%.*]] = function_ref @{{.*}}callee3yyF // CHECK: apply [[C3]] callee3() } func generic_callee_1<T>(_: T) {} func generic_callee_2<T>(_: T) {} func generic_callee_3<T>(_: T) {} // CHECK-LABEL: sil hidden @$S10statements16defer_in_generic{{[_0-9a-zA-Z]*}}F func defer_in_generic<T>(_ x: T) { // CHECK: [[C3:%.*]] = function_ref @$S10statements16generic_callee_3{{[_0-9a-zA-Z]*}}F // CHECK: apply [[C3]]<T> // CHECK: [[C2:%.*]] = function_ref @$S10statements16defer_in_genericyyxlF6 // CHECK: apply [[C2]]<T> // CHECK: [[C1:%.*]] = function_ref @$S10statements16defer_in_genericyyxlF6 // CHECK: apply [[C1]]<T> defer { generic_callee_1(x) } defer { generic_callee_2(x) } generic_callee_3(x) } // CHECK-LABEL: sil hidden @$S10statements017defer_in_closure_C8_genericyyxlF : $@convention(thin) <T> (@in T) -> () func defer_in_closure_in_generic<T>(_ x: T) { // CHECK-LABEL: sil private @$S10statements017defer_in_closure_C8_genericyyxlFyycfU_ : $@convention(thin) <T> () -> () _ = { // CHECK-LABEL: sil private @$S10statements017defer_in_closure_C8_genericyyxlFyycfU_6$deferL_yylF : $@convention(thin) <T> () -> () defer { generic_callee_1(T.self) } } } // CHECK-LABEL: sil hidden @$S10statements13defer_mutableyySiF func defer_mutable(_ x: Int) { var x = x // CHECK: [[BOX:%.*]] = alloc_box ${ var Int } // CHECK-NEXT: project_box [[BOX]] // CHECK-NOT: [[BOX]] // CHECK: function_ref @$S10statements13defer_mutableyySiF6$deferL_yyF : $@convention(thin) (@inout_aliasable Int) -> () // CHECK-NOT: [[BOX]] // CHECK: destroy_value [[BOX]] defer { _ = x } } protocol StaticFooProtocol { static func foo() } func testDeferOpenExistential(_ b: Bool, type: StaticFooProtocol.Type) { defer { type.foo() } if b { return } return } // CHECK-LABEL: sil hidden @$S10statements22testRequireExprPatternyySiF func testRequireExprPattern(_ a : Int) { marker_1() // CHECK: [[M1:%[0-9]+]] = function_ref @$S10statements8marker_1yyF : $@convention(thin) () -> () // CHECK-NEXT: apply [[M1]]() : $@convention(thin) () -> () // CHECK: function_ref Swift.~= infix<A where A: Swift.Equatable>(A, A) -> Swift.Bool // CHECK: cond_br {{.*}}, bb1, bb2 guard case 4 = a else { marker_2(); return } // Fall through case comes first. // CHECK: bb1: // CHECK: [[M3:%[0-9]+]] = function_ref @$S10statements8marker_3yyF : $@convention(thin) () -> () // CHECK-NEXT: apply [[M3]]() : $@convention(thin) () -> () // CHECK-NEXT: br bb3 marker_3() // CHECK: bb2: // CHECK: [[M2:%[0-9]+]] = function_ref @$S10statements8marker_2yyF : $@convention(thin) () -> () // CHECK-NEXT: apply [[M2]]() : $@convention(thin) () -> () // CHECK-NEXT: br bb3 // CHECK: bb3: // CHECK-NEXT: tuple () // CHECK-NEXT: return } // CHECK-LABEL: sil hidden @$S10statements20testRequireOptional1yS2iSgF // CHECK: bb0([[ARG:%.*]] : @trivial $Optional<Int>): // CHECK-NEXT: debug_value [[ARG]] : $Optional<Int>, let, name "a" // CHECK-NEXT: switch_enum [[ARG]] : $Optional<Int>, case #Optional.some!enumelt.1: [[SOME:bb[0-9]+]], case #Optional.none!enumelt: [[NONE:bb[0-9]+]] func testRequireOptional1(_ a : Int?) -> Int { // CHECK: [[NONE]]: // CHECK: br [[ABORT:bb[0-9]+]] // CHECK: [[SOME]]([[PAYLOAD:%.*]] : @trivial $Int): // CHECK-NEXT: debug_value [[PAYLOAD]] : $Int, let, name "t" // CHECK-NEXT: br [[EPILOG:bb[0-9]+]] // // CHECK: [[EPILOG]]: // CHECK-NEXT: return [[PAYLOAD]] : $Int guard let t = a else { abort() } // CHECK: [[ABORT]]: // CHECK-NEXT: // function_ref statements.abort() -> Swift.Never // CHECK-NEXT: [[FUNC_REF:%.*]] = function_ref @$S10statements5aborts5NeverOyF // CHECK-NEXT: apply [[FUNC_REF]]() : $@convention(thin) () -> Never // CHECK-NEXT: unreachable return t } // CHECK-LABEL: sil hidden @$S10statements20testRequireOptional2yS2SSgF // CHECK: bb0([[ARG:%.*]] : @owned $Optional<String>): // CHECK-NEXT: debug_value [[ARG]] : $Optional<String>, let, name "a" // CHECK-NEXT: [[BORROWED_ARG:%.*]] = begin_borrow [[ARG]] // CHECK-NEXT: [[ARG_COPY:%.*]] = copy_value [[BORROWED_ARG]] : $Optional<String> // CHECK-NEXT: switch_enum [[ARG_COPY]] : $Optional<String>, case #Optional.some!enumelt.1: [[SOME_BB:bb[0-9]+]], case #Optional.none!enumelt: [[NONE_BB:bb[0-9]+]] func testRequireOptional2(_ a : String?) -> String { guard let t = a else { abort() } // CHECK: [[NONE_BB]]: // CHECK-NEXT: end_borrow [[BORROWED_ARG]] from [[ARG]] // CHECK-NEXT: br [[ABORT_BB:bb[0-9]+]] // CHECK: [[SOME_BB]]([[STR:%.*]] : @owned $String): // CHECK-NEXT: debug_value [[STR]] : $String, let, name "t" // CHECK-NEXT: br [[CONT_BB:bb[0-9]+]] // CHECK: [[CONT_BB]]: // CHECK-NEXT: end_borrow [[BORROWED_ARG]] from [[ARG]] // CHECK-NEXT: [[BORROWED_STR:%.*]] = begin_borrow [[STR]] // CHECK-NEXT: [[RETURN:%.*]] = copy_value [[BORROWED_STR]] // CHECK-NEXT: end_borrow [[BORROWED_STR]] from [[STR]] // CHECK-NEXT: destroy_value [[STR]] : $String // CHECK-NEXT: destroy_value [[ARG]] // CHECK-NEXT: return [[RETURN]] : $String // CHECK: [[ABORT_BB]]: // CHECK-NEXT: // function_ref statements.abort() -> Swift.Never // CHECK-NEXT: [[ABORT_FUNC:%.*]] = function_ref @$S10statements5aborts5NeverOyF // CHECK-NEXT: [[NEVER:%.*]] = apply [[ABORT_FUNC]]() // CHECK-NEXT: unreachable return t } // CHECK-LABEL: sil hidden @$S10statements19testCleanupEmission{{[_0-9a-zA-Z]*}}F // <rdar://problem/20563234> let-else problem: cleanups for bound patterns shouldn't be run in the else block protocol MyProtocol {} func testCleanupEmission<T>(_ x: T) { // SILGen shouldn't crash/verify abort on this example. guard let x2 = x as? MyProtocol else { return } _ = x2 } // CHECK-LABEL: sil hidden @$S10statements15test_is_patternyyAA9BaseClassCF func test_is_pattern(_ y : BaseClass) { // checked_cast_br %0 : $BaseClass to $DerivedClass guard case is DerivedClass = y else { marker_1(); return } marker_2() } // CHECK-LABEL: sil hidden @$S10statements15test_as_patternyAA12DerivedClassCAA04BaseF0CF func test_as_pattern(_ y : BaseClass) -> DerivedClass { // CHECK: bb0([[ARG:%.*]] : @owned $BaseClass): // CHECK: [[BORROWED_ARG:%.*]] = begin_borrow [[ARG]] // CHECK: [[ARG_COPY:%.*]] = copy_value [[BORROWED_ARG]] // CHECK: checked_cast_br [[ARG_COPY]] : $BaseClass to $DerivedClass guard case let result as DerivedClass = y else { } // CHECK: bb{{.*}}({{.*}} : @owned $DerivedClass): // CHECK: bb{{.*}}([[PTR:%[0-9]+]] : @owned $DerivedClass): // CHECK-NEXT: debug_value [[PTR]] : $DerivedClass, let, name "result" // CHECK-NEXT: br [[CONT_BB:bb[0-9]+]] // CHECK: [[CONT_BB]]: // CHECK-NEXT: end_borrow [[BORROWED_ARG]] from [[ARG]] // CHECK-NEXT: [[BORROWED_PTR:%.*]] = begin_borrow [[PTR]] // CHECK-NEXT: [[RESULT:%.*]] = copy_value [[BORROWED_PTR]] // CHECK-NEXT: end_borrow [[BORROWED_PTR]] from [[PTR]] // CHECK-NEXT: destroy_value [[PTR]] : $DerivedClass // CHECK-NEXT: destroy_value [[ARG]] : $BaseClass // CHECK-NEXT: return [[RESULT]] : $DerivedClass return result } // CHECK-LABEL: sil hidden @$S10statements22let_else_tuple_bindingyS2i_SitSgF func let_else_tuple_binding(_ a : (Int, Int)?) -> Int { // CHECK: bb0([[ARG:%.*]] : @trivial $Optional<(Int, Int)>): // CHECK-NEXT: debug_value [[ARG]] : $Optional<(Int, Int)>, let, name "a" // CHECK-NEXT: switch_enum [[ARG]] : $Optional<(Int, Int)>, case #Optional.some!enumelt.1: [[SOME_BB:bb[0-9]+]], case #Optional.none!enumelt: [[NONE_BB:bb[0-9]+]] guard let (x, y) = a else { } _ = y return x // CHECK: [[SOME_BB]]([[PAYLOAD:%.*]] : @trivial $(Int, Int)): // CHECK-NEXT: [[PAYLOAD_1:%.*]] = tuple_extract [[PAYLOAD]] : $(Int, Int), 0 // CHECK-NEXT: debug_value [[PAYLOAD_1]] : $Int, let, name "x" // CHECK-NEXT: [[PAYLOAD_2:%.*]] = tuple_extract [[PAYLOAD]] : $(Int, Int), 1 // CHECK-NEXT: debug_value [[PAYLOAD_2]] : $Int, let, name "y" // CHECK-NEXT: br [[CONT_BB:bb[0-9]+]] // CHECK: [[CONT_BB]]: // CHECK-NEXT: return [[PAYLOAD_1]] : $Int }
[ 85691, 72692, 90397 ]
2ca9b05e605d957e7c5061dd10c02d6040dc31c5
fc2c45ee8c3035031dd75526e7ccc2b657d2c3cf
/iPizza para iPhone/AppDelegate.swift
b7f0e3b345dfd343fad1a62885112b63c7f6b27e
[]
no_license
luiseduardo3004/iPizza-para-iPhone
43ee036775723748ac508640a541e32526d049fb
56670518089de9f8459616cad7cf84102b83d1ac
refs/heads/master
2021-01-19T21:00:27.957458
2017-04-18T06:10:00
2017-04-18T06:10:00
88,588,231
0
0
null
null
null
null
UTF-8
Swift
false
false
2,170
swift
// // AppDelegate.swift // iPizza para iPhone // // Created by Luis Santamaría on 4/17/17. // Copyright © 2017 Santamaria Technologies. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } func applicationDidEnterBackground(application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } }
[ 229380, 229383, 229385, 278539, 229388, 294924, 278542, 229391, 327695, 278545, 229394, 278548, 229397, 229399, 229402, 278556, 229405, 352284, 278559, 229408, 278564, 294950, 229415, 229417, 327722, 237613, 229422, 229426, 237618, 229428, 286774, 229432, 286776, 286778, 319544, 204856, 286791, 237640, 278605, 237646, 311375, 163920, 196692, 319573, 311383, 278623, 278626, 319590, 311400, 278635, 303212, 278639, 131192, 278648, 237693, 327814, 131209, 303241, 417930, 303244, 311436, 319633, 286873, 286876, 311460, 311469, 32944, 327862, 286906, 327866, 180413, 286910, 131264, 286916, 286922, 286924, 286926, 319694, 286928, 131281, 278743, 278747, 295133, 155872, 319716, 278760, 237807, 303345, 286962, 131314, 229622, 327930, 278781, 278783, 278785, 237826, 319751, 278792, 286987, 319757, 311569, 286999, 287003, 287006, 287009, 287012, 287014, 287016, 287019, 311598, 287023, 262448, 311601, 287032, 155966, 319809, 319810, 278849, 319814, 311623, 319818, 311628, 229709, 287054, 319822, 278865, 229717, 196963, 196969, 139638, 213367, 106872, 319872, 311683, 319879, 65943, 319898, 311719, 278952, 139689, 278957, 311728, 278967, 180668, 311741, 278975, 319938, 278980, 98756, 278983, 319945, 278986, 319947, 278990, 278994, 311767, 279003, 279006, 188895, 172512, 279010, 287202, 279015, 172520, 319978, 279020, 172526, 279023, 311791, 172529, 279027, 319989, 164343, 180727, 279035, 311804, 287230, 279040, 303617, 287234, 279045, 172550, 287238, 172552, 303623, 320007, 279051, 172558, 279055, 303632, 279058, 303637, 279063, 279067, 172572, 279072, 172577, 295459, 172581, 295461, 279082, 311850, 279084, 172591, 172598, 279095, 172607, 172612, 377413, 172614, 172618, 303690, 33357, 287309, 279124, 172634, 262752, 172644, 311911, 189034, 295533, 172655, 172656, 189039, 295538, 189040, 172660, 189044, 287349, 352880, 287355, 287360, 295553, 287365, 311942, 303751, 352905, 279178, 287371, 311946, 311951, 287377, 172691, 287381, 311957, 221850, 287386, 164509, 303773, 295583, 172702, 230045, 287394, 287390, 303780, 172705, 287398, 172707, 279208, 287400, 172714, 295595, 279212, 189102, 172721, 287409, 66227, 303797, 189114, 287419, 303804, 328381, 287423, 328384, 279231, 287427, 312006, 279241, 172748, 287436, 107212, 172751, 295633, 172755, 303827, 279255, 172760, 279258, 303835, 213724, 189149, 303838, 287450, 279267, 312035, 295654, 279272, 230128, 312048, 312050, 230131, 205564, 303871, 230146, 328453, 295685, 230154, 33548, 312077, 295695, 369433, 295707, 328476, 295710, 303914, 279340, 205613, 279353, 230202, 312124, 222018, 295755, 377676, 148302, 287569, 279383, 303959, 279390, 230241, 279394, 303976, 336744, 303985, 328563, 303987, 279413, 303991, 303997, 295806, 295808, 295813, 304005, 213895, 320391, 304007, 304009, 304011, 230284, 304013, 279438, 213902, 295822, 189329, 304019, 189331, 279445, 58262, 279452, 410526, 279461, 279462, 304042, 213931, 230327, 304055, 287675, 197564, 304063, 304065, 213954, 189378, 156612, 295873, 213963, 312272, 304084, 304090, 320481, 304106, 320490, 312302, 328687, 320496, 304114, 295928, 320505, 312321, 295945, 295949, 197645, 230413, 320528, 140312, 295961, 238620, 197663, 304164, 189479, 304170, 238641, 312374, 238652, 238655, 230465, 238658, 336964, 296004, 205895, 320584, 238666, 296021, 402518, 336987, 230497, 296036, 296040, 361576, 205931, 279661, 205934, 164973, 312432, 279669, 337018, 279679, 279683, 222340, 205968, 296084, 238745, 304285, 238756, 205991, 222377, 165035, 337067, 238766, 165038, 230576, 238770, 304311, 230592, 279750, 230600, 230607, 148690, 320727, 279769, 304348, 279777, 304354, 296163, 320740, 279781, 304360, 320748, 279788, 279790, 296189, 320771, 312585, 296205, 230674, 320786, 230677, 296213, 296215, 320792, 230681, 230689, 173350, 312622, 296243, 312630, 222522, 222525, 296253, 312639, 296255, 230718, 296259, 378181, 230727, 238919, 320840, 296264, 296267, 296271, 222545, 230739, 312663, 337244, 222556, 230752, 312676, 230760, 173418, 410987, 230763, 230768, 296305, 312692, 230773, 279929, 304506, 304505, 181626, 181631, 312711, 312712, 296331, 288140, 288144, 230800, 304533, 337306, 288154, 288160, 288162, 288164, 279975, 304555, 370092, 279983, 288176, 279985, 173488, 312755, 296373, 279991, 312759, 288185, 337335, 222652, 312766, 173507, 296389, 222665, 230860, 280014, 288208, 230865, 288210, 370130, 288212, 280021, 288214, 222676, 239064, 288217, 329177, 280027, 288220, 288218, 239070, 288224, 280034, 288226, 280036, 288229, 280038, 288230, 288232, 370146, 288234, 320998, 288236, 288238, 288240, 291754, 288242, 296435, 288244, 288250, 402942, 148990, 296446, 206336, 321022, 296450, 230916, 230919, 214535, 304651, 370187, 304653, 230940, 222752, 108066, 296486, 296488, 157229, 230961, 288320, 288325, 124489, 280140, 280145, 288338, 280149, 280152, 288344, 239194, 280158, 403039, 370272, 181854, 239202, 312938, 280183, 280185, 280188, 280191, 280194, 116354, 280208, 280211, 288408, 280218, 280222, 190118, 321195, 321200, 337585, 296626, 296634, 313027, 280260, 206536, 280264, 206539, 206541, 206543, 280276, 313044, 321239, 280283, 313052, 288478, 313055, 321252, 313066, 280302, 288494, 280304, 313073, 321266, 419570, 288499, 288502, 280314, 288510, 67330, 280324, 198405, 288519, 280331, 198416, 280337, 296723, 116503, 321304, 329498, 296731, 321311, 313121, 313123, 304932, 321316, 280363, 141101, 165678, 280375, 321336, 296767, 345921, 280388, 304968, 280393, 280402, 313176, 42842, 280419, 321381, 296812, 313201, 1920, 255873, 305028, 280454, 247688, 280464, 124817, 280468, 280473, 124827, 214940, 247709, 214944, 280487, 313258, 321458, 296883, 124853, 214966, 10170, 296890, 288700, 296894, 190403, 296900, 280515, 337862, 165831, 280521, 231379, 296921, 239586, 313320, 231404, 124913, 165876, 321528, 239612, 313340, 288764, 239617, 313347, 288773, 313358, 321560, 305176, 313371, 354338, 305191, 223273, 313386, 354348, 124978, 215090, 124980, 288824, 288826, 321595, 313406, 288831, 288836, 67654, 280651, 354382, 288848, 280658, 215123, 354390, 288855, 288859, 280669, 313438, 280671, 223327, 149599, 321634, 149601, 149603, 329830, 280681, 313451, 223341, 280687, 313458, 280691, 215154, 313464, 329850, 321659, 280702, 288895, 321670, 215175, 141446, 141455, 141459, 280725, 313498, 100520, 288936, 280747, 288940, 280755, 288947, 321717, 280759, 280764, 280769, 280771, 280774, 280776, 313548, 321740, 280783, 280786, 280788, 313557, 280793, 280796, 280798, 338147, 280804, 280807, 157930, 280811, 280817, 125171, 157940, 280819, 280823, 280825, 280827, 280830, 280831, 280833, 125187, 280835, 125191, 125207, 125209, 321817, 125218, 321842, 223539, 125239, 280888, 280891, 289087, 280897, 280900, 239944, 305480, 280906, 239947, 305485, 305489, 379218, 280919, 354653, 313700, 280937, 280940, 190832, 280946, 223606, 313720, 280956, 239997, 280959, 313731, 199051, 240011, 289166, 240017, 190868, 297365, 297368, 297372, 141725, 297377, 289186, 297391, 289201, 240052, 289207, 305594, 289210, 281024, 289218, 289221, 289227, 281045, 281047, 215526, 166378, 305647, 281075, 174580, 240124, 281084, 305662, 305664, 240129, 305666, 305668, 240132, 223749, 281095, 338440, 150025, 223752, 223757, 281102, 223763, 223765, 281113, 322074, 281116, 281121, 182819, 281127, 281135, 150066, 158262, 158266, 289342, 281154, 322115, 158283, 281163, 281179, 199262, 338528, 338532, 281190, 199273, 281196, 158317, 19053, 313973, 281210, 297594, 158347, 133776, 314003, 117398, 314007, 289436, 174754, 330404, 289448, 133801, 174764, 314029, 314033, 240309, 133817, 314045, 314047, 314051, 199364, 297671, 199367, 158409, 289493, 363234, 289513, 289522, 289525, 289532, 322303, 289537, 322310, 264969, 322314, 322318, 281361, 281372, 322341, 215850, 281388, 289593, 281401, 289601, 281410, 281413, 281414, 240458, 281420, 240468, 281430, 322393, 297818, 281435, 281438, 281442, 174955, 224110, 207733, 207737, 183172, 158596, 240519, 322440, 338823, 314249, 289687, 240535, 297883, 289694, 289696, 289700, 281529, 289724, 52163, 183260, 281567, 289762, 322534, 297961, 183277, 281581, 322550, 134142, 322563, 175134, 322599, 322610, 314421, 281654, 314427, 207937, 314433, 314441, 207949, 322642, 314456, 281691, 314461, 281702, 281704, 314474, 281708, 281711, 289912, 248995, 306341, 306344, 306347, 306354, 142531, 199877, 289991, 289997, 249045, 363742, 363745, 298216, 330988, 126190, 216303, 322801, 257302, 363802, 199976, 199978, 314671, 298292, 298294, 257334, 298306, 380226, 281923, 224584, 224587, 224594, 216404, 306517, 150870, 314714, 224603, 159068, 265568, 314723, 281960, 150890, 306539, 314732, 314736, 290161, 216436, 306549, 298358, 314743, 306552, 290171, 314747, 306555, 290174, 298365, 224641, 281987, 298372, 265604, 281990, 298377, 314763, 142733, 298381, 224657, 306581, 314785, 282025, 314793, 282027, 241068, 241070, 241072, 282034, 241077, 150966, 298424, 306618, 282044, 323015, 306635, 306640, 290263, 290270, 290275, 339431, 282089, 191985, 282098, 290291, 282101, 191992, 290298, 151036, 290302, 282111, 290305, 175621, 192008, 323084, 257550, 282127, 290321, 282130, 323090, 282133, 290325, 241175, 290328, 282137, 290332, 241181, 282142, 282144, 290344, 306731, 290349, 290351, 290356, 282186, 224849, 282195, 282199, 282201, 306778, 159324, 159330, 314979, 323176, 224875, 241260, 323181, 257658, 315016, 282249, 290445, 324757, 282261, 298651, 282269, 323229, 298655, 323231, 61092, 282277, 306856, 282295, 282300, 323260, 323266, 282310, 323273, 282319, 306897, 241362, 282328, 298714, 52959, 216801, 282337, 241380, 216806, 323304, 282345, 12011, 282356, 323318, 282364, 282367, 306945, 241412, 323333, 282376, 216842, 323345, 282388, 323349, 282392, 184090, 315167, 315169, 282402, 315174, 323367, 241448, 315176, 241450, 282410, 306988, 306991, 315184, 323376, 315190, 241464, 159545, 282425, 307009, 241475, 307012, 148946, 315211, 282446, 307027, 315221, 282454, 315223, 241496, 323414, 241498, 307035, 307040, 282465, 110433, 241509, 110438, 298860, 110445, 282478, 315249, 110450, 315251, 282481, 315253, 315255, 339838, 282499, 315267, 315269, 241544, 282505, 241546, 241548, 298896, 298898, 282514, 44948, 298901, 241556, 282520, 241560, 241563, 241565, 241567, 241569, 282531, 241574, 282537, 298922, 36779, 241581, 282542, 241583, 323504, 241586, 282547, 241588, 290739, 241590, 241592, 241598, 290751, 241600, 241605, 151495, 241610, 298975, 241632, 298984, 241640, 241643, 298988, 241646, 241649, 241652, 323574, 290807, 241661, 299006, 282623, 315396, 241669, 315397, 282632, 282639, 290835, 282645, 241693, 282654, 241701, 102438, 217127, 282669, 323630, 282681, 290877, 282687, 159811, 315463, 315466, 192589, 307278, 192596, 176213, 307287, 315482, 217179, 315483, 192605, 233567, 200801, 299105, 217188, 299109, 307303, 315495, 356457, 45163, 307307, 315502, 192624, 307314, 323700, 299126, 233591, 299136, 307329, 307338, 233613, 241813, 307352, 299164, 184479, 299167, 184481, 315557, 184486, 307370, 307372, 184492, 307374, 307376, 323763, 176311, 299191, 307385, 307386, 258235, 176316, 307388, 307390, 184503, 299200, 184512, 307394, 307396, 299204, 184518, 307399, 323784, 307409, 307411, 176343, 299225, 233701, 307432, 184572, 282881, 184579, 282893, 291089, 282906, 291104, 233766, 282931, 307508, 315701, 307510, 332086, 307512, 151864, 176435, 307515, 168245, 282942, 307518, 151874, 282947, 323917, 110926, 282957, 233808, 323921, 315733, 323926, 233815, 315739, 323932, 299357, 242018, 242024, 299373, 315757, 250231, 242043, 315771, 299388, 291202, 299398, 242057, 291212, 299405, 291222, 283033, 291226, 242075, 315801, 291231, 61855, 283042, 291238, 291241, 127403, 127405, 291247, 127407, 299444, 127413, 283062, 291254, 127417, 291260, 283069, 127421, 127424, 299457, 127429, 283080, 176592, 315856, 315860, 176597, 127447, 283095, 299481, 176605, 242143, 291299, 127463, 242152, 291305, 176620, 127474, 291314, 291317, 135672, 233979, 291323, 291330, 283142, 127497, 233994, 135689, 291341, 233998, 234003, 234006, 152087, 127511, 283161, 242202, 234010, 135707, 242206, 135710, 242208, 291361, 242220, 291378, 234038, 152118, 234041, 70213, 242250, 111193, 242275, 299620, 242279, 168562, 184952, 135805, 291456, 135808, 373383, 299655, 316051, 225941, 316054, 299672, 135834, 373404, 299677, 225948, 135839, 299680, 225954, 299684, 242343, 209576, 242345, 373421, 135870, 135873, 135876, 135879, 299720, 299723, 225998, 299726, 226002, 226005, 119509, 226008, 242396, 299740, 201444, 299750, 283368, 234219, 283372, 381677, 226037, 283382, 234231, 316151, 234236, 226045, 234239, 242431, 209665, 234242, 299778, 242436, 226053, 234246, 226056, 234248, 291593, 242443, 234252, 242445, 234254, 291601, 234258, 242450, 242452, 234261, 201496, 234264, 234266, 234269, 283421, 234272, 234274, 152355, 234278, 299814, 283432, 234281, 234284, 234287, 283440, 185138, 242483, 234292, 234296, 234298, 283452, 160572, 234302, 234307, 242499, 234309, 234313, 316233, 316235, 234316, 283468, 242511, 234319, 234321, 234324, 185173, 201557, 234329, 234333, 308063, 234336, 234338, 242530, 349027, 234341, 234344, 234347, 177004, 234350, 324464, 234353, 152435, 177011, 234356, 234358, 234362, 226171, 234364, 291711, 234368, 234370, 201603, 291714, 234373, 226182, 234375, 291716, 226185, 308105, 234379, 234384, 234388, 234390, 324504, 234393, 209818, 308123, 324508, 226200, 234398, 234396, 291742, 234401, 291748, 234405, 291750, 234407, 324518, 324520, 234410, 324522, 226220, 291756, 234414, 324527, 291760, 234417, 201650, 324531, 234422, 226230, 275384, 324536, 234428, 291773, 234431, 242623, 324544, 324546, 226239, 324548, 226245, 234437, 234439, 234434, 234443, 291788, 234446, 275406, 193486, 234449, 316370, 193488, 234452, 234455, 234459, 234461, 234464, 234467, 234470, 168935, 5096, 324585, 234475, 234478, 316400, 234481, 316403, 234484, 234485, 324599, 234487, 234490, 234493, 234496, 316416, 234501, 275462, 308231, 234504, 234507, 234510, 234515, 300054, 234519, 316439, 234520, 234523, 234526, 234528, 300066, 234532, 234535, 234537, 234540, 144430, 234543, 234546, 275508, 234549, 300085, 300088, 234553, 234556, 234558, 316479, 234561, 316483, 234563, 234568, 234570, 316491, 300108, 234572, 234574, 300115, 234580, 234581, 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, 275594, 234636, 177293, 234640, 275602, 234643, 226453, 275606, 234647, 275608, 308373, 234650, 234648, 308379, 234653, 324766, 119967, 283805, 234657, 300189, 324768, 242852, 234661, 283813, 300197, 234664, 275626, 234667, 316596, 234687, 300226, 226500, 234692, 300229, 308420, 283844, 283850, 300234, 300238, 300241, 316625, 300243, 300245, 316630, 300248, 300253, 300256, 300258, 300260, 234726, 300263, 300265, 161003, 300267, 300270, 300272, 120053, 300278, 316663, 275703, 300284, 275710, 300287, 283904, 300289, 292097, 300292, 300294, 275719, 300299, 177419, 283917, 300301, 242957, 177424, 275725, 349464, 283939, 259367, 283951, 292143, 300344, 226617, 243003, 283963, 226628, 283973, 300357, 177482, 283983, 316758, 357722, 316766, 292192, 316768, 218464, 292197, 316774, 243046, 218473, 284010, 136562, 275834, 333178, 275836, 275840, 316803, 316806, 226696, 316811, 226699, 226703, 300433, 234899, 226709, 357783, 316824, 316826, 144796, 300448, 144807, 144810, 144812, 284076, 144814, 144820, 284084, 284087, 292279, 144826, 144828, 144830, 144832, 144835, 284099, 144837, 38342, 144839, 144841, 144844, 144847, 144852, 144855, 103899, 300507, 333280, 226787, 218597, 292329, 300523, 259565, 300527, 259567, 226802, 316917, 308727, 292343, 300537, 316947, 308757, 308762, 284191, 284194, 284196, 235045, 284199, 284204, 284206, 284209, 284211, 284213, 194101, 284215, 194103, 284218, 226877, 284223, 284226, 243268, 292421, 226886, 284231, 128584, 284228, 284234, 276043, 317004, 366155, 284238, 226895, 284241, 194130, 284243, 276052, 284245, 276053, 284247, 317015, 284249, 243290, 284251, 300628, 284253, 235097, 284255, 243293, 300638, 284258, 292452, 177766, 284263, 292454, 284265, 292458, 284267, 292461, 284272, 284274, 276086, 284278, 292470, 292473, 284283, 276093, 284286, 276095, 284288, 292481, 284290, 325250, 284292, 276098, 292479, 292485, 284297, 317066, 284299, 317068, 276109, 284301, 284303, 276114, 284306, 284308, 284312, 284314, 284316, 276127, 284320, 284322, 284327, 276137, 284329, 284331, 317098, 284333, 284335, 284337, 284339, 300726, 284343, 284346, 284350, 276160, 358080, 284354, 358083, 276166, 284358, 358089, 276170, 284362, 276175, 284368, 276177, 284370, 317138, 284372, 358098, 284377, 276187, 284379, 284381, 284384, 284386, 358114, 358116, 276197, 358119, 284392, 325353, 284394, 358122, 284397, 358126, 276206, 358128, 284399, 358133, 358135, 276216, 358138, 300795, 358140, 284413, 358142, 358146, 317187, 284418, 317189, 317191, 284428, 300816, 300819, 317207, 284440, 186139, 300828, 300830, 276255, 325408, 284449, 300834, 300832, 317221, 227109, 358183, 186151, 276268, 194351, 243504, 284469, 276280, 325436, 358206, 276291, 366406, 276295, 300872, 153417, 284499, 276308, 284502, 317271, 178006, 276315, 292700, 284511, 227175, 292715, 284529, 292721, 300915, 284533, 292729, 317306, 284540, 292734, 325512, 169868, 276365, 284564, 358292, 284566, 350106, 284572, 276386, 284579, 276388, 358312, 284585, 317353, 276395, 292776, 276402, 358326, 161718, 276410, 276411, 358330, 276418, 276425, 301009, 301011, 301013, 292823, 301015, 301017, 358360, 292828, 276446, 153568, 276448, 276452, 276455, 292839, 292843, 276460, 276464, 227314, 276466, 276472, 325624, 317435, 276476, 276479, 276482, 276485, 317446, 276490, 292876, 276496, 317456, 317458, 243733, 243740, 317468, 317472, 325666, 243751, 292904, 276528, 243762, 309298, 325685, 325689, 235579, 276539, 235581, 325692, 178238, 276544, 284739, 243785, 276553, 350293, 350295, 194649, 227418, 309337, 350302, 227423, 194654, 178273, 227426, 194657, 194660, 276579, 227430, 276583, 309346, 309348, 309350, 309352, 309354, 350308, 276590, 350313, 350316, 350321, 284786, 276595, 227440, 301167, 350325, 350328, 292985, 301178, 292989, 292993, 301185, 350339, 317573, 350342, 350345, 350349, 301199, 317584, 325777, 350354, 350357, 350359, 350362, 276638, 350366, 284837, 153765, 350375, 350379, 350381, 350383, 350385, 350387, 350389, 350395, 350397, 350399, 227520, 350402, 227522, 301252, 350406, 227529, 309450, 301258, 276685, 276689, 227540, 309462, 301272, 276699, 309468, 194780, 301283, 317672, 276713, 317674, 243948, 194801, 227571, 309494, 243960, 276735, 227583, 227587, 276739, 211204, 276742, 227593, 227596, 325910, 309530, 342298, 276766, 211232, 276775, 211241, 325937, 276789, 325943, 260421, 276809, 285002, 276811, 235853, 276816, 235858, 276829, 276833, 391523, 276836, 276843, 293227, 276848, 293232, 186744, 211324, 227709, 285061, 317833, 178572, 285070, 178575, 285077, 178583, 227738, 317853, 276896, 317858, 342434, 285093, 317864, 285098, 276907, 276917, 293304, 293307, 293314, 309707, 293325, 317910, 293336, 235996, 317917, 293343, 358880, 276961, 227810, 293346, 276964, 293352, 236013, 293364, 317951, 309764, 121352, 236043, 317963, 342541, 55822, 113167, 317971, 309779, 309781, 277011, 55837, 227877, 227879, 293417, 227882, 309804, 293421, 105007, 236082, 285236, 23094, 277054, 244288, 129603, 318020, 301636, 301639, 301643, 277071, 285265, 309844, 277080, 309849, 285277, 285282, 326244, 277100, 121458, 277106, 170618, 170619, 309885, 309888, 277122, 227975, 277128, 285320, 301706, 318092, 326285, 318094, 334476, 277136, 277139, 227992, 285340, 318108, 227998, 318110, 383658, 285357, 318128, 277170, 342707, 154292, 277173, 293555, 285368, 277177, 277181, 318144, 277187, 277191, 277194, 277196, 277201, 137946, 113378, 203491, 228069, 277223, 342760, 285417, 56041, 56043, 277232, 228081, 56059, 310015, 285441, 310020, 285448, 310029, 285453, 228113, 285459, 277273, 326430, 228128, 228135, 318248, 277291, 293677, 318253, 285489, 293685, 285494, 301880, 285499, 301884, 310080, 293696, 277314, 277317, 277322, 277329, 162643, 310100, 301911, 277337, 301913, 301921, 400236, 236397, 162671, 326514, 310134, 15224, 236408, 277368, 416639, 416640, 113538, 310147, 416648, 39817, 187274, 277385, 301972, 424853, 277405, 277411, 310179, 293798, 293802, 236460, 277426, 293811, 293817, 293820, 203715, 326603, 276586, 293849, 293861, 228327, 228328, 228330, 318442, 228332, 277486, 326638, 318450, 293876, 293877, 285686, 302073, 285690, 121850, 302075, 293882, 293887, 277504, 277507, 277511, 277519, 293908, 277526, 293917, 293939, 318516, 277561, 277564, 310336, 7232, 293956, 277573, 228422, 310344, 277577, 293960, 277583, 203857, 310355, 293971, 310359, 236632, 277594, 138332, 277598, 285792, 277601, 203872, 310374, 203879, 277608, 310376, 228460, 318573, 203886, 187509, 285815, 285817, 367737, 285821, 302205, 285824, 392326, 285831, 302218, 285835, 294026, 384148, 162964, 187542, 302231, 302233, 285852, 302237, 285854, 285856, 285862, 277671, 302248, 64682, 277678, 228526, 294063, 294065, 302258, 277687, 294072, 318651, 277695, 318657, 244930, 302275, 302277, 228550, 302282, 310476, 302285, 302288, 310481, 302290, 203987, 302292, 302294, 302296, 384222, 310498, 285927, 318698, 302315, 195822, 228592, 294132, 138485, 204023, 228601, 204026, 228606, 204031, 64768, 310531, 285958, 228617, 138505, 318742, 204067, 277798, 130345, 277801, 113964, 285997, 277804, 285999, 277807, 113969, 277811, 318773, 318776, 277816, 286010, 277819, 294204, 417086, 277822, 286016, 294211, 302403, 277832, 277836, 294221, 326991, 294223, 277839, 277842, 277847, 277850, 179547, 277853, 146784, 277857, 302436, 277860, 294246, 327015, 310632, 327017, 351594, 277864, 277869, 277872, 351607, 310648, 277880, 310651, 277884, 277888, 310657, 351619, 294276, 310659, 277892, 277894, 253320, 310665, 318858, 327046, 277898, 277903, 310672, 351633, 277905, 277908, 277917, 310689, 277921, 130468, 277928, 277932, 310703, 277937, 310710, 130486, 310712, 277944, 310715, 277947, 302526, 228799, 277950, 277953, 64966, 245191, 163272, 302534, 310727, 277959, 292968, 277963, 277966, 302543, 310737, 277971, 228825, 277978, 310749, 277981, 277984, 310755, 277989, 277991, 187880, 277995, 310764, 286188, 278000, 228851, 310772, 278003, 278006, 40440, 212472, 278009, 40443, 286203, 40448, 228864, 286214, 228871, 302603, 65038, 302614, 286233, 302617, 302621, 286240, 146977, 187939, 294435, 40484, 286246, 294439, 286248, 278057, 294440, 294443, 40486, 294445, 40488, 310831, 40491, 212538, 40507, 40511, 40513, 228933, 40521, 286283, 40525, 40527, 212560, 228944, 400976, 40533, 147032, 40537, 40539, 278109, 40541, 40544, 40548, 40550, 286312, 286313, 40554, 40552, 310892, 40557, 40560, 188022, 122488, 294521, 343679, 278150, 310925, 286354, 278163, 302740, 278168, 327333, 229030, 212648, 278188, 302764, 278192, 319153, 278196, 302781, 319171, 302789, 294599, 278216, 294601, 343757, 212690, 278227, 286420, 319187, 229076, 286425, 319194, 278235, 301163, 278238, 229086, 286432, 294625, 294634, 302838, 319226, 286460, 171774, 278274, 302852, 278277, 302854, 294664, 311048, 319243, 311053, 302862, 294682, 278306, 294701, 278320, 319280, 319290, 229192, 302925, 237409, 360317, 327554, 40840, 40851, 294803, 188312, 294811, 319390, 294817, 319394, 40865, 294821, 311209, 180142, 188340, 40886, 319419, 294844, 294847, 393177, 294876, 294879, 294883, 294890, 311279, 278513, 237555, 278516, 311283, 278519, 237562 ]
afe4e7d93ca856a651ea85fcc2c5d2322efeab0e
86295eb04c8646b5ee929f114d67c895b37e0d9c
/Sources/MAVSDK-Swift/Generated/Mission.swift
dfce04f15ca6f8cbc4c4cebe2d084abc502a4737
[ "BSD-3-Clause" ]
permissive
unipheas/MAVSDK-Swift
2a79916ec01358716da4a97ea5b723d7af6641e4
a3bb47e83353a3711c7503ed5d408f8b858d5268
refs/heads/master
2021-07-16T03:53:42.916754
2020-07-01T06:21:40
2020-07-01T06:21:40
183,993,750
1
0
BSD-3-Clause
2019-11-15T11:37:24
2019-04-29T03:30:24
Swift
UTF-8
Swift
false
false
25,465
swift
import Foundation import RxSwift import SwiftGRPC public class Mission { private let service: Mavsdk_Rpc_Mission_MissionServiceService private let scheduler: SchedulerType public convenience init(address: String = "localhost", port: Int32 = 50051, scheduler: SchedulerType = ConcurrentDispatchQueueScheduler(qos: .background)) { let service = Mavsdk_Rpc_Mission_MissionServiceServiceClient(address: "\(address):\(port)", secure: false) self.init(service: service, scheduler: scheduler) } init(service: Mavsdk_Rpc_Mission_MissionServiceService, scheduler: SchedulerType) { self.service = service self.scheduler = scheduler } public struct RuntimeMissionError: Error { public let description: String init(_ description: String) { self.description = description } } public struct MissionError: Error { public let code: Mission.MissionResult.Result public let description: String } public struct MissionItem: Equatable { public let latitudeDeg: Double public let longitudeDeg: Double public let relativeAltitudeM: Float public let speedMS: Float public let isFlyThrough: Bool public let gimbalPitchDeg: Float public let gimbalYawDeg: Float public let cameraAction: CameraAction public let loiterTimeS: Float public let cameraPhotoIntervalS: Double public enum CameraAction: Equatable { case none case takePhoto case startPhotoInterval case stopPhotoInterval case startVideo case stopVideo case UNRECOGNIZED(Int) internal var rpcCameraAction: Mavsdk_Rpc_Mission_MissionItem.CameraAction { switch self { case .none: return .none case .takePhoto: return .takePhoto case .startPhotoInterval: return .startPhotoInterval case .stopPhotoInterval: return .stopPhotoInterval case .startVideo: return .startVideo case .stopVideo: return .stopVideo case .UNRECOGNIZED(let i): return .UNRECOGNIZED(i) } } internal static func translateFromRpc(_ rpcCameraAction: Mavsdk_Rpc_Mission_MissionItem.CameraAction) -> CameraAction { switch rpcCameraAction { case .none: return .none case .takePhoto: return .takePhoto case .startPhotoInterval: return .startPhotoInterval case .stopPhotoInterval: return .stopPhotoInterval case .startVideo: return .startVideo case .stopVideo: return .stopVideo case .UNRECOGNIZED(let i): return .UNRECOGNIZED(i) } } } public init(latitudeDeg: Double, longitudeDeg: Double, relativeAltitudeM: Float, speedMS: Float, isFlyThrough: Bool, gimbalPitchDeg: Float, gimbalYawDeg: Float, cameraAction: CameraAction, loiterTimeS: Float, cameraPhotoIntervalS: Double) { self.latitudeDeg = latitudeDeg self.longitudeDeg = longitudeDeg self.relativeAltitudeM = relativeAltitudeM self.speedMS = speedMS self.isFlyThrough = isFlyThrough self.gimbalPitchDeg = gimbalPitchDeg self.gimbalYawDeg = gimbalYawDeg self.cameraAction = cameraAction self.loiterTimeS = loiterTimeS self.cameraPhotoIntervalS = cameraPhotoIntervalS } internal var rpcMissionItem: Mavsdk_Rpc_Mission_MissionItem { var rpcMissionItem = Mavsdk_Rpc_Mission_MissionItem() rpcMissionItem.latitudeDeg = latitudeDeg rpcMissionItem.longitudeDeg = longitudeDeg rpcMissionItem.relativeAltitudeM = relativeAltitudeM rpcMissionItem.speedMS = speedMS rpcMissionItem.isFlyThrough = isFlyThrough rpcMissionItem.gimbalPitchDeg = gimbalPitchDeg rpcMissionItem.gimbalYawDeg = gimbalYawDeg rpcMissionItem.cameraAction = cameraAction.rpcCameraAction rpcMissionItem.loiterTimeS = loiterTimeS rpcMissionItem.cameraPhotoIntervalS = cameraPhotoIntervalS return rpcMissionItem } internal static func translateFromRpc(_ rpcMissionItem: Mavsdk_Rpc_Mission_MissionItem) -> MissionItem { return MissionItem(latitudeDeg: rpcMissionItem.latitudeDeg, longitudeDeg: rpcMissionItem.longitudeDeg, relativeAltitudeM: rpcMissionItem.relativeAltitudeM, speedMS: rpcMissionItem.speedMS, isFlyThrough: rpcMissionItem.isFlyThrough, gimbalPitchDeg: rpcMissionItem.gimbalPitchDeg, gimbalYawDeg: rpcMissionItem.gimbalYawDeg, cameraAction: CameraAction.translateFromRpc(rpcMissionItem.cameraAction), loiterTimeS: rpcMissionItem.loiterTimeS, cameraPhotoIntervalS: rpcMissionItem.cameraPhotoIntervalS) } public static func == (lhs: MissionItem, rhs: MissionItem) -> Bool { return lhs.latitudeDeg == rhs.latitudeDeg && lhs.longitudeDeg == rhs.longitudeDeg && lhs.relativeAltitudeM == rhs.relativeAltitudeM && lhs.speedMS == rhs.speedMS && lhs.isFlyThrough == rhs.isFlyThrough && lhs.gimbalPitchDeg == rhs.gimbalPitchDeg && lhs.gimbalYawDeg == rhs.gimbalYawDeg && lhs.cameraAction == rhs.cameraAction && lhs.loiterTimeS == rhs.loiterTimeS && lhs.cameraPhotoIntervalS == rhs.cameraPhotoIntervalS } } public struct MissionPlan: Equatable { public let missionItems: [MissionItem] public init(missionItems: [MissionItem]) { self.missionItems = missionItems } internal var rpcMissionPlan: Mavsdk_Rpc_Mission_MissionPlan { var rpcMissionPlan = Mavsdk_Rpc_Mission_MissionPlan() rpcMissionPlan.missionItems = missionItems.map{ $0.rpcMissionItem } return rpcMissionPlan } internal static func translateFromRpc(_ rpcMissionPlan: Mavsdk_Rpc_Mission_MissionPlan) -> MissionPlan { return MissionPlan(missionItems: rpcMissionPlan.missionItems.map{ MissionItem.translateFromRpc($0) }) } public static func == (lhs: MissionPlan, rhs: MissionPlan) -> Bool { return lhs.missionItems == rhs.missionItems } } public struct MissionProgress: Equatable { public let current: Int32 public let total: Int32 public init(current: Int32, total: Int32) { self.current = current self.total = total } internal var rpcMissionProgress: Mavsdk_Rpc_Mission_MissionProgress { var rpcMissionProgress = Mavsdk_Rpc_Mission_MissionProgress() rpcMissionProgress.current = current rpcMissionProgress.total = total return rpcMissionProgress } internal static func translateFromRpc(_ rpcMissionProgress: Mavsdk_Rpc_Mission_MissionProgress) -> MissionProgress { return MissionProgress(current: rpcMissionProgress.current, total: rpcMissionProgress.total) } public static func == (lhs: MissionProgress, rhs: MissionProgress) -> Bool { return lhs.current == rhs.current && lhs.total == rhs.total } } public struct MissionResult: Equatable { public let result: Result public let resultStr: String public enum Result: Equatable { case unknown case success case error case tooManyMissionItems case busy case timeout case invalidArgument case unsupported case noMissionAvailable case failedToOpenQgcPlan case failedToParseQgcPlan case unsupportedMissionCmd case transferCancelled case UNRECOGNIZED(Int) internal var rpcResult: Mavsdk_Rpc_Mission_MissionResult.Result { switch self { case .unknown: return .unknown case .success: return .success case .error: return .error case .tooManyMissionItems: return .tooManyMissionItems case .busy: return .busy case .timeout: return .timeout case .invalidArgument: return .invalidArgument case .unsupported: return .unsupported case .noMissionAvailable: return .noMissionAvailable case .failedToOpenQgcPlan: return .failedToOpenQgcPlan case .failedToParseQgcPlan: return .failedToParseQgcPlan case .unsupportedMissionCmd: return .unsupportedMissionCmd case .transferCancelled: return .transferCancelled case .UNRECOGNIZED(let i): return .UNRECOGNIZED(i) } } internal static func translateFromRpc(_ rpcResult: Mavsdk_Rpc_Mission_MissionResult.Result) -> Result { switch rpcResult { case .unknown: return .unknown case .success: return .success case .error: return .error case .tooManyMissionItems: return .tooManyMissionItems case .busy: return .busy case .timeout: return .timeout case .invalidArgument: return .invalidArgument case .unsupported: return .unsupported case .noMissionAvailable: return .noMissionAvailable case .failedToOpenQgcPlan: return .failedToOpenQgcPlan case .failedToParseQgcPlan: return .failedToParseQgcPlan case .unsupportedMissionCmd: return .unsupportedMissionCmd case .transferCancelled: return .transferCancelled case .UNRECOGNIZED(let i): return .UNRECOGNIZED(i) } } } public init(result: Result, resultStr: String) { self.result = result self.resultStr = resultStr } internal var rpcMissionResult: Mavsdk_Rpc_Mission_MissionResult { var rpcMissionResult = Mavsdk_Rpc_Mission_MissionResult() rpcMissionResult.result = result.rpcResult rpcMissionResult.resultStr = resultStr return rpcMissionResult } internal static func translateFromRpc(_ rpcMissionResult: Mavsdk_Rpc_Mission_MissionResult) -> MissionResult { return MissionResult(result: Result.translateFromRpc(rpcMissionResult.result), resultStr: rpcMissionResult.resultStr) } public static func == (lhs: MissionResult, rhs: MissionResult) -> Bool { return lhs.result == rhs.result && lhs.resultStr == rhs.resultStr } } public func uploadMission(missionPlan: MissionPlan) -> Completable { return Completable.create { completable in var request = Mavsdk_Rpc_Mission_UploadMissionRequest() request.missionPlan = missionPlan.rpcMissionPlan do { let response = try self.service.uploadMission(request) if (response.missionResult.result == Mavsdk_Rpc_Mission_MissionResult.Result.success) { completable(.completed) } else { completable(.error(MissionError(code: MissionResult.Result.translateFromRpc(response.missionResult.result), description: response.missionResult.resultStr))) } } catch { completable(.error(error)) } return Disposables.create() } } public func cancelMissionUpload() -> Completable { return Completable.create { completable in let request = Mavsdk_Rpc_Mission_CancelMissionUploadRequest() do { let response = try self.service.cancelMissionUpload(request) if (response.missionResult.result == Mavsdk_Rpc_Mission_MissionResult.Result.success) { completable(.completed) } else { completable(.error(MissionError(code: MissionResult.Result.translateFromRpc(response.missionResult.result), description: response.missionResult.resultStr))) } } catch { completable(.error(error)) } return Disposables.create() } } public func downloadMission() -> Single<MissionPlan> { return Single<MissionPlan>.create { single in let request = Mavsdk_Rpc_Mission_DownloadMissionRequest() do { let response = try self.service.downloadMission(request) if (response.missionResult.result != Mavsdk_Rpc_Mission_MissionResult.Result.success) { single(.error(MissionError(code: MissionResult.Result.translateFromRpc(response.missionResult.result), description: response.missionResult.resultStr))) return Disposables.create() } let missionPlan = MissionPlan.translateFromRpc(response.missionPlan) single(.success(missionPlan)) } catch { single(.error(error)) } return Disposables.create() } } public func cancelMissionDownload() -> Completable { return Completable.create { completable in let request = Mavsdk_Rpc_Mission_CancelMissionDownloadRequest() do { let response = try self.service.cancelMissionDownload(request) if (response.missionResult.result == Mavsdk_Rpc_Mission_MissionResult.Result.success) { completable(.completed) } else { completable(.error(MissionError(code: MissionResult.Result.translateFromRpc(response.missionResult.result), description: response.missionResult.resultStr))) } } catch { completable(.error(error)) } return Disposables.create() } } public func startMission() -> Completable { return Completable.create { completable in let request = Mavsdk_Rpc_Mission_StartMissionRequest() do { let response = try self.service.startMission(request) if (response.missionResult.result == Mavsdk_Rpc_Mission_MissionResult.Result.success) { completable(.completed) } else { completable(.error(MissionError(code: MissionResult.Result.translateFromRpc(response.missionResult.result), description: response.missionResult.resultStr))) } } catch { completable(.error(error)) } return Disposables.create() } } public func pauseMission() -> Completable { return Completable.create { completable in let request = Mavsdk_Rpc_Mission_PauseMissionRequest() do { let response = try self.service.pauseMission(request) if (response.missionResult.result == Mavsdk_Rpc_Mission_MissionResult.Result.success) { completable(.completed) } else { completable(.error(MissionError(code: MissionResult.Result.translateFromRpc(response.missionResult.result), description: response.missionResult.resultStr))) } } catch { completable(.error(error)) } return Disposables.create() } } public func clearMission() -> Completable { return Completable.create { completable in let request = Mavsdk_Rpc_Mission_ClearMissionRequest() do { let response = try self.service.clearMission(request) if (response.missionResult.result == Mavsdk_Rpc_Mission_MissionResult.Result.success) { completable(.completed) } else { completable(.error(MissionError(code: MissionResult.Result.translateFromRpc(response.missionResult.result), description: response.missionResult.resultStr))) } } catch { completable(.error(error)) } return Disposables.create() } } public func setCurrentMissionItem(index: Int32) -> Completable { return Completable.create { completable in var request = Mavsdk_Rpc_Mission_SetCurrentMissionItemRequest() request.index = index do { let response = try self.service.setCurrentMissionItem(request) if (response.missionResult.result == Mavsdk_Rpc_Mission_MissionResult.Result.success) { completable(.completed) } else { completable(.error(MissionError(code: MissionResult.Result.translateFromRpc(response.missionResult.result), description: response.missionResult.resultStr))) } } catch { completable(.error(error)) } return Disposables.create() } } public func isMissionFinished() -> Single<Bool> { return Single<Bool>.create { single in let request = Mavsdk_Rpc_Mission_IsMissionFinishedRequest() do { let response = try self.service.isMissionFinished(request) if (response.missionResult.result != Mavsdk_Rpc_Mission_MissionResult.Result.success) { single(.error(MissionError(code: MissionResult.Result.translateFromRpc(response.missionResult.result), description: response.missionResult.resultStr))) return Disposables.create() } let isFinished = response.isFinished single(.success(isFinished)) } catch { single(.error(error)) } return Disposables.create() } } public lazy var missionProgress: Observable<MissionProgress> = createMissionProgressObservable() private func createMissionProgressObservable() -> Observable<MissionProgress> { return Observable.create { observer in let request = Mavsdk_Rpc_Mission_SubscribeMissionProgressRequest() do { let call = try self.service.subscribeMissionProgress(request, completion: { (callResult) in if callResult.statusCode == .ok || callResult.statusCode == .cancelled { observer.onCompleted() } else { observer.onError(RuntimeMissionError(callResult.statusMessage!)) } }) let disposable = self.scheduler.schedule(0, action: { _ in while let response = try? call.receive() { let missionProgress = MissionProgress.translateFromRpc(response.missionProgress) observer.onNext(missionProgress) } return Disposables.create() }) return Disposables.create { call.cancel() disposable.dispose() } } catch { observer.onError(error) return Disposables.create() } } .retryWhen { error in error.map { guard $0 is RuntimeMissionError else { throw $0 } } } .share(replay: 1) } public func getReturnToLaunchAfterMission() -> Single<Bool> { return Single<Bool>.create { single in let request = Mavsdk_Rpc_Mission_GetReturnToLaunchAfterMissionRequest() do { let response = try self.service.getReturnToLaunchAfterMission(request) if (response.missionResult.result != Mavsdk_Rpc_Mission_MissionResult.Result.success) { single(.error(MissionError(code: MissionResult.Result.translateFromRpc(response.missionResult.result), description: response.missionResult.resultStr))) return Disposables.create() } let enable = response.enable single(.success(enable)) } catch { single(.error(error)) } return Disposables.create() } } public func setReturnToLaunchAfterMission(enable: Bool) -> Completable { return Completable.create { completable in var request = Mavsdk_Rpc_Mission_SetReturnToLaunchAfterMissionRequest() request.enable = enable do { let response = try self.service.setReturnToLaunchAfterMission(request) if (response.missionResult.result == Mavsdk_Rpc_Mission_MissionResult.Result.success) { completable(.completed) } else { completable(.error(MissionError(code: MissionResult.Result.translateFromRpc(response.missionResult.result), description: response.missionResult.resultStr))) } } catch { completable(.error(error)) } return Disposables.create() } } public func importQgroundcontrolMission(qgcPlanPath: String) -> Single<MissionPlan> { return Single<MissionPlan>.create { single in var request = Mavsdk_Rpc_Mission_ImportQgroundcontrolMissionRequest() request.qgcPlanPath = qgcPlanPath do { let response = try self.service.importQgroundcontrolMission(request) if (response.missionResult.result != Mavsdk_Rpc_Mission_MissionResult.Result.success) { single(.error(MissionError(code: MissionResult.Result.translateFromRpc(response.missionResult.result), description: response.missionResult.resultStr))) return Disposables.create() } let missionPlan = MissionPlan.translateFromRpc(response.missionPlan) single(.success(missionPlan)) } catch { single(.error(error)) } return Disposables.create() } } }
[ -1 ]
f2afba1a90ae330af2ba0fc8f51de714ff0f7213
739aeaf475a98cc70f37ceb4d0f27a8f7db21379
/MycameraApp/MycameraApp/SecondViewController.swift
6bb1f916949223e1aa517c35b34a4e38d97f4415
[]
no_license
kanepin/IOSapp
c30e7e0f4a2bfa5ed2518bf4c996438bcd113e1f
7f8e3940a89189510a91ea83ac20b14425d5f687
refs/heads/master
2020-03-14T06:50:42.996705
2018-04-30T14:20:20
2018-04-30T14:20:20
131,491,520
0
0
null
null
null
null
UTF-8
Swift
false
false
307
swift
// // SecondViewController.swift // MycameraApp // // Created by 会社② on 2018/04/29. // Copyright © 2018年 会社②. All rights reserved. // import Foundation import UIKit class SecondViewCotroller: UIViewController { override func viewDidLoad() { super.viewDidLoad() } }
[ -1 ]