blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
625
content_id
stringlengths
40
40
detected_licenses
listlengths
0
47
license_type
stringclasses
2 values
repo_name
stringlengths
5
116
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
643 values
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
80.4k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
16 values
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_language
stringclasses
85 values
src_encoding
stringclasses
7 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
1 class
length_bytes
int64
4
6.44M
extension
stringclasses
17 values
content
stringlengths
4
6.44M
duplicates
listlengths
1
9.02k
a8027055ad93ebf5bf85afb1c9c1d3c4964f1afe
92dcee3389bf6c559be2bc64ec83648ea0e153ce
/CryptoPrice/CurrencySelection/CurrencyViewController+DataSource.swift
b2d9fccf14005c700b605ec3bacdb46a9740fdf8
[]
no_license
iSadist/crypto-price-tv
59e90e7cd68c5c1cb7ca0aea949c9415798c819f
3cbeb99941fdfd70e896b4c35cf072d5166ef71e
refs/heads/master
2023-02-08T03:19:59.624384
2023-02-04T12:14:25
2023-02-04T12:14:25
263,362,302
0
0
null
null
null
null
UTF-8
Swift
false
false
1,183
swift
// // CurrencyViewController+DataSource.swift // CryptoPrice // // Created by Jan Svensson on 2020-05-29. // Copyright © 2020 Jan Svensson. All rights reserved. // import UIKit extension CurrencyViewController: UICollectionViewDataSource { func numberOfSections(in collectionView: UICollectionView) -> Int { 1 } func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return filtered.count } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "standardCell", for: indexPath) as? CollectionViewCell { let currency = filtered[indexPath.row] cell.label.text = currency.name cell.codeLabel.text = currency.symbol let isSelected = selectedCurrencies?.contains(currency) ?? false cell.checkmark.isHidden = !isSelected return cell } return collectionView.dequeueReusableCell(withReuseIdentifier: "standardCell", for: indexPath) } }
[ -1 ]
b9025ddab26aea8684d5fe439ddb20bfebaa758b
1e53abf09e173fbd825a596a2d1f4d2a8edfc611
/Dingo/BaseCommon/LaunchTheme.swift
a4b407b99c5a57f25a316007732ac9afab664af1
[]
no_license
lforme/Dingo
3ec6d97d6a3a585e5ec6ea5a59169fe26feb92e1
cb175e691308b38455a34123f9f3427c2291d1d0
refs/heads/master
2020-05-19T18:09:39.799681
2019-05-17T10:10:59
2019-05-17T10:10:59
185,149,341
0
0
null
null
null
null
UTF-8
Swift
false
false
3,201
swift
// // LaunchTheme.swift // Dingo // // Created by mugua on 2019/5/5. // Copyright © 2019 mugua. All rights reserved. // import Foundation import UIKit import IQKeyboardManagerSwift import ChameleonFramework import EasyAnimation import UserNotifications enum LaunchTheme: Int { case dark = 0 case light var mainColor: UIColor { switch self { case .dark: return UIColor.flatSkyBlue case .light: return UIColor.flatSkyBlue } } var secondaryRed: UIColor { return #colorLiteral(red: 0.8509803922, green: 0.3294117647, blue: 0.3490196078, alpha: 1) } var textWhiteColor: UIColor { return UIColor.white } var textBlackColor: UIColor { return #colorLiteral(red: 0.1490196078, green: 0.1490196078, blue: 0.1490196078, alpha: 1) } var iconColor: UIColor { switch self { case .dark: return UIColor.flatWhite case .light: return UIColor.flatBlack } } func getProjectColor(index: Int) -> UIColor { return [LaunchThemeManager.currentTheme().secondaryRed, LaunchThemeManager.currentTheme().textBlackColor, LaunchThemeManager.currentTheme().mainColor][index] } } struct LaunchThemeManager { private static let selectedThemeKey = "SelectedTheme" @discardableResult static func launchInit() -> Bool { IQKeyboardManager.shared.enable = true IQKeyboardManager.shared.shouldPlayInputClicks = true IQKeyboardManager.shared.shouldResignOnTouchOutside = true IQKeyboardManager.shared.shouldShowToolbarPlaceholder = true EasyAnimation.enable() AVOSCloud.setApplicationId("fI1sUJD8N9y9VgmmSV0OL1PB-gzGzoHsz", clientKey: "3qqQwnHfMSFj3soa8q4b9sYr") AMapServices.shared()?.apiKey = "9ec4ddb24a585ce24cf9137466759964" AMapServices.shared().enableHTTPS = true UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { (granted, error) in if granted { print("Notifications permission granted.") } else { print("Notifications permission denied because: \(error?.localizedDescription ?? "错误").") } } return true } static func currentTheme() -> LaunchTheme { if let storedTheme = UserDefaults.standard.value(forKey: selectedThemeKey) as? Int { return LaunchTheme(rawValue: storedTheme) ?? .light } else { return .light } } static func applyTheme(theme: LaunchTheme) { // 1 switch theme { case .dark: UserDefaults.standard.set(0, forKey: selectedThemeKey) case .light: UserDefaults.standard.set(1, forKey: selectedThemeKey) } UserDefaults.standard.synchronize() } static func changeStatusBarStyle(_ style: UIStatusBarStyle) { NotificationCenter.default.post(name: .statuBarDidChnage, object: style) } }
[ -1 ]
0e2b1eb1567937082ab84849c64da7be568decd2
5a1c3113c78146207082c2fe781ff7e823f2f1e0
/iOSCore/QwertyKeyboardLayout.swift
ee1011f87ec676381acac9f196b50fa97fefa53f
[ "BSD-2-Clause" ]
permissive
sujinnaljin/gureum
5e6681d93d21e399664c4675302cc0d4e593f2cf
3d4435c844868ffd1d5760f81f66c01824b5616e
refs/heads/master
2020-03-28T01:12:18.260018
2018-09-05T07:39:45
2018-09-05T07:39:45
null
0
0
null
null
null
null
UTF-8
Swift
false
false
17,574
swift
// // QwertyKeyboardLayout.swift // iOS // // Created by Jeong YunWon on 2014. 8. 6.. // Copyright (c) 2014년 youknowone.org. All rights reserved. // import UIKit class QwertyKeyboardView: KeyboardView { // @IBOutlet var spaceButton: GRInputButton! @IBOutlet var leftSpaceButton: GRInputButton! @IBOutlet var rightSpaceButton: GRInputButton! required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } override init(frame: CGRect) { super.init(frame: frame) } } func getKey(keylines: [String], position: GRKeyboardLayoutHelper.Position) -> UnicodeScalar { let keyline = keylines[position.row] // let idx = advance(keyline.startIndex, position.column) let idx = keyline.index(keyline.startIndex, offsetBy: position.column) let key = keyline[idx] return key.unicodeScalars.first! } class QwertyKeyboardLayout: KeyboardLayout { var qwertyView: QwertyKeyboardView { get { return self.view as! QwertyKeyboardView } } func keyForPosition(position: GRKeyboardLayoutHelper.Position, shift: Bool) -> UnicodeScalar { let keylines = ["qwertyuiop", "asdfghjkl", "zxcvbnm", " "] let key = getKey(keylines: keylines, position: position) if !shift || position.row == 3 { return key } else { return UnicodeScalar(key.value - 32)! } } func captionThemeForTrait(trait: ThemeTraitConfiguration, position: GRKeyboardLayoutHelper.Position) -> ThemeCaptionConfiguration { let chr = self.keyForPosition(position: position, shift: false) let altkey = "qwerty-key-\(chr)" let theme1 = trait.captionForKey(key: altkey, fallback: trait.qwertyCaptionForRow(row: position.row + 1)) let title = self.helper(helper: self.helper, titleForPosition: position) let theme2 = trait.captionForKey(key: "qwerty-key-" + title, fallback: theme1) return theme2 } override class func loadView() -> QwertyKeyboardView { let view = QwertyKeyboardView(frame: CGRect(x : 0, y : 0, width : 320, height : 216)) view.nextKeyboardButton = GRInputButton() view.nextKeyboardButton.captionLabel.text = "🌐" view.deleteButton = GRInputButton() view.deleteButton.captionLabel.text = "⌫" view.doneButton = GRInputButton() view.toggleKeyboardButton = GRInputButton() view.toggleKeyboardButton.captionLabel.text = "123" view.shiftButton = GRInputButton() view.shiftButton.captionLabel.text = "⬆︎" // view.spaceButton = GRInputButton() // view.spaceButton.captionLabel.text = "간격" view.leftSpaceButton = GRInputButton() view.rightSpaceButton = GRInputButton() for subview in [view.nextKeyboardButton, view.deleteButton, view.doneButton, view.toggleKeyboardButton, view.shiftButton/*, view.spaceButton*/] { view.addSubview(subview!) } return view } override class func loadContext() -> UnsafeMutableRawPointer { // FIXME: return context_create(ksx5002_from_qwerty_handler(), ksx5002_combinator(), ksx5002_decoder()) // return context_create(bypass_phase(), bypass_decoder()) } override func layoutWillLoad(helper: GRKeyboardLayoutHelper) { // self.qwertyView.spaceButton.tag = 32 // self.qwertyView.spaceButton.addTarget(nil, action: "input:", forControlEvents: .TouchUpInside) self.qwertyView.doneButton.tag = 13 self.qwertyView.doneButton.addTarget(nil, action: Selector(("done:")), for: .touchUpInside) self.qwertyView.shiftButton.addTarget(nil, action: Selector(("shift:")), for: .touchUpInside) self.qwertyView.toggleKeyboardButton.addTarget(nil, action: Selector(("toggle:")), for: .touchUpInside) } override func layoutDidLoad(helper: GRKeyboardLayoutHelper) { } override func layoutWillLayout(helper: GRKeyboardLayoutHelper, forRect rect: CGRect) { let trait = self.theme(helper: self.helper).traitForSize(size: rect.size) for (position, button) in self.helper.buttons { let captionTheme = self.captionThemeForTrait(trait: trait, position: position) captionTheme.appealButton(button: button) } let map = [ self.qwertyView.shiftButton!: trait.qwertyShiftCaption, self.qwertyView.deleteButton!: trait.qwertyDeleteCaption, self.qwertyView.toggleKeyboardButton!: trait.qwerty123Caption, self.qwertyView.nextKeyboardButton!: trait.qwertyGlobeCaption, // self.qwertyView.spaceButton!: trait.qwertySpaceCaption, self.qwertyView.doneButton!: trait.qwertyDoneCaption, ] for (button, captionTheme) in map { captionTheme.appealButton(button: button) } let size = rect.size for button in [self.qwertyView.shiftButton!, self.qwertyView.deleteButton!] { button.frame.size = CGSize(width: size.width * 3 / 20, height: size.height / 4) } for button in [self.qwertyView.toggleKeyboardButton!, self.qwertyView.nextKeyboardButton!] { button.frame.size = CGSize(width: size.width / 8, height: size.height / 4) } // for button in [self.qwertyView.spaceButton!] { // button.frame.size = CGSizeMake(size.width / 2, size.height / 4) // } for button in [self.qwertyView.doneButton!] { button.frame.size = CGSize(width: size.width / 4, height: size.height / 4) } for button in [self.qwertyView.leftSpaceButton!, self.qwertyView.rightSpaceButton!] { button.frame.size = CGSize(width: size.width / 20, height: size.height / 4) } } override func layoutDidLayout(helper: GRKeyboardLayoutHelper, forRect rect: CGRect) { let trait = self.theme(helper: self.helper).traitForSize(size: rect.size) for (position, button) in self.helper.buttons { let captionTheme = self.captionThemeForTrait(trait: trait, position: position) captionTheme.arrangeButton(button: button) } let map = [ self.qwertyView.shiftButton!: trait.qwertyShiftCaption, self.qwertyView.deleteButton!: trait.qwertyDeleteCaption, self.qwertyView.toggleKeyboardButton!: trait.qwerty123Caption, self.qwertyView.nextKeyboardButton!: trait.qwertyGlobeCaption, // self.qwertyView.spaceButton!: trait.qwertySpaceCaption, self.qwertyView.doneButton!: trait.qwertyDoneCaption, ] for (button, captionTheme) in map { captionTheme.arrangeButton(button: button) } } override func numberOfRowsForHelper(helper: GRKeyboardLayoutHelper) -> Int { return 4 } override func helper(helper: GRKeyboardLayoutHelper, numberOfColumnsInRow row: Int) -> Int { switch row { case 0: return 10 case 1: return 9 case 2: return 7 case 3: return 1 default: return 0 } } override func helper(helper: GRKeyboardLayoutHelper, heightOfRow: Int, forSize size: CGSize) -> CGFloat { return size.height / 4 } override func helper(helper: GRKeyboardLayoutHelper, columnWidthInRow row: Int, forSize size: CGSize) -> CGFloat { if row == 3 { return size.width / 2 } else { return size.width / 10 } } override func helper(helper: GRKeyboardLayoutHelper, leftButtonsForRow row: Int) -> Array<UIButton> { switch row { case 1: return [self.qwertyView.leftSpaceButton] case 2: assert(self.qwertyView.shiftButton != nil) return [self.qwertyView.shiftButton] case 3: assert(self.view.toggleKeyboardButton != nil) assert(self.view.nextKeyboardButton != nil) return [self.view.toggleKeyboardButton, self.view.nextKeyboardButton] default: return [] } } override func helper(helper: GRKeyboardLayoutHelper, rightButtonsForRow row: Int) -> Array<UIButton> { switch row { case 1: return [self.qwertyView.rightSpaceButton] case 2: assert(self.view.deleteButton != nil) return [self.view.deleteButton] case 3: // assert(self.qwertyView.spaceButton != nil) assert(self.view.doneButton != nil) return [/*self.qwertyView.spaceButton, */self.view.doneButton] default: return [] } } override func helper(helper: GRKeyboardLayoutHelper, buttonForPosition position: GRKeyboardLayoutHelper.Position) -> GRInputButton { let button = GRInputButton(type: .system) as GRInputButton let key1 = self.keyForPosition(position: position, shift: false) let key2 = self.keyForPosition(position: position, shift: true) button.tag = Int(((key2.value) << 15) + key1.value) button.sizeToFit() button.addTarget(nil, action: Selector(("input:")), for: .touchUpInside) return button } override func helper(helper: GRKeyboardLayoutHelper, titleForPosition position: GRKeyboardLayoutHelper.Position) -> String { let key = self.keyForPosition(position: position, shift: true) return "\(Character(key))" } override func correspondingButtonForPoint(point: CGPoint, size: CGSize) -> GRInputButton { var newPoint = point if point.x < size.width / 2 { newPoint.x += 2 } else { newPoint.x -= 2 } var button = super.correspondingButtonForPoint(point: point, size: size) if button == self.qwertyView.leftSpaceButton { button = self.helper.buttons[GRKeyboardLayoutHelper.Position(row: 1, column: 0)]! } else if button == self.qwertyView.rightSpaceButton { button = self.helper.buttons[GRKeyboardLayoutHelper.Position(row: 1, column: 8)]! } return button } } class QwertySymbolKeyboardLayout: QwertyKeyboardLayout { override func keyForPosition(position: GRKeyboardLayoutHelper.Position, shift: Bool) -> UnicodeScalar { let keylines = !shift ? ["1234567890", "-/:;()$&@\"", ".,?!'\"₩", " "] : ["[]{}#%^*+=", "_\\|~<>XXXX", ".,?!'\"₩", " "] let key = getKey(keylines: keylines, position: position) return key } override func helper(helper: GRKeyboardLayoutHelper, numberOfColumnsInRow row: Int) -> Int { switch row { case 0: return 10 case 1: return 10 case 2: return 5 case 3: return 1 default: return 0 } } override func helper(helper: GRKeyboardLayoutHelper, leftButtonsForRow row: Int) -> Array<UIButton> { switch row { case 1: return [] case 2: assert(self.qwertyView.shiftButton != nil) return [self.qwertyView.shiftButton] case 3: assert(self.view.toggleKeyboardButton != nil) assert(self.view.nextKeyboardButton != nil) return [self.view.toggleKeyboardButton, self.view.nextKeyboardButton] default: return [] } } override func helper(helper: GRKeyboardLayoutHelper, rightButtonsForRow row: Int) -> Array<UIButton> { switch row { case 1: return [] case 2: assert(self.view.deleteButton != nil) return [self.view.deleteButton] case 3: // assert(self.qwertyView.spaceButton != nil) assert(self.view.doneButton != nil) return [/*self.qwertyView.spaceButton, */self.view.doneButton] default: return [] } } override func helper(helper: GRKeyboardLayoutHelper, columnWidthInRow row: Int, forSize size: CGSize) -> CGFloat { if row == 3 { return size.width / 2 } else if row == 2 { return size.width * 7 / 5 / 10 } else { return size.width / 10 } } override func helper(helper: GRKeyboardLayoutHelper, buttonForPosition position: GRKeyboardLayoutHelper.Position) -> GRInputButton { let key1 = self.keyForPosition(position: position, shift: false) let key2 = self.keyForPosition(position: position, shift: true) let button = GRInputButton(type: .system) as GRInputButton button.tag = Int(key2.value << 15) + Int(key1.value) button.sizeToFit() //button.backgroundColor = UIColor(white: 1.0 - 72.0/255.0, alpha: 1.0) button.addTarget(nil, action: Selector(("input:")), for: .touchUpInside) //println("button: \(button.tag)"); // button.tag = 0 return button } override func helper(helper: GRKeyboardLayoutHelper, titleForPosition position: GRKeyboardLayoutHelper.Position) -> String { let key = self.keyForPosition(position: position, shift: self.qwertyView.shiftButton.isSelected) let text = "\(Character(UnicodeScalar(key.value)!))" return text } } class KSX5002KeyboardLayout: QwertyKeyboardLayout { override class func loadContext() -> UnsafeMutableRawPointer { return context_create(ksx5002_from_qwerty_handler(), ksx5002_combinator(), ksx5002_decoder()) } override func helper(helper: GRKeyboardLayoutHelper, titleForPosition position: GRKeyboardLayoutHelper.Position) -> String { let key = self.keyForPosition(position: position, shift: self.qwertyView.shiftButton.isSelected) let keycode = key.value let label = ksx5002_label(Int8(keycode)) let text = "\(Character(UnicodeScalar(label)!))" return text } } class DanmoumKeyboardLayout: KSX5002KeyboardLayout { override func keyForPosition(position: GRKeyboardLayoutHelper.Position, shift: Bool) -> UnicodeScalar { let keylines = !shift ? ["qwerthop", "asdfgjkl", "zxcvnm", " "] : ["QWERTyOP", "asdfguil", "zxcvbm", " "] let key = getKey(keylines: keylines, position: position) return key } override class func loadContext() -> UnsafeMutableRawPointer { return context_create(danmoum_from_qwerty_handler(), danmoum_combinator(), ksx5002_decoder()) } override func layoutWillLayout(helper: GRKeyboardLayoutHelper, forRect rect: CGRect) { let trait = self.theme(helper: self.helper).traitForSize(size: rect.size) for (position, button) in self.helper.buttons { let captionTheme = self.captionThemeForTrait(trait: trait, position: position) captionTheme.appealButton(button: button) } let map = [ self.qwertyView.shiftButton!: trait.qwertyShiftCaption, self.qwertyView.deleteButton!: trait.qwertyDeleteCaption, self.qwertyView.toggleKeyboardButton!: trait.qwerty123Caption, self.qwertyView.nextKeyboardButton!: trait.qwertyGlobeCaption, // self.qwertyView.spaceButton!: trait.qwertySpaceCaption, self.qwertyView.doneButton!: trait.qwertyDoneCaption, ] for (button, captionTheme) in map { captionTheme.appealButton(button: button) } let size = rect.size for button in [self.qwertyView.shiftButton!, self.qwertyView.deleteButton!] { button.frame.size = CGSize(width: size.width / 8, height: size.height / 4) } for button in [self.qwertyView.toggleKeyboardButton!, self.qwertyView.nextKeyboardButton!] { button.frame.size = CGSize(width: size.width / 8, height: size.height / 4) } for button in [self.qwertyView.doneButton!] { button.frame.size = CGSize(width: size.width / 4, height: size.height / 4) } } override func helper(helper: GRKeyboardLayoutHelper, numberOfColumnsInRow row: Int) -> Int { switch row { case 0: return 8 case 1: return 8 case 2: return 6 case 3: return 1 default: return 0 } } override func helper(helper: GRKeyboardLayoutHelper, columnWidthInRow row: Int, forSize size: CGSize) -> CGFloat { if row == 3 { return size.width / 2 } else { return size.width / 8 } } override func helper(helper: GRKeyboardLayoutHelper, leftButtonsForRow row: Int) -> Array<UIButton> { switch row { case 2: assert(self.qwertyView.shiftButton != nil) return [self.qwertyView.shiftButton] case 3: assert(self.view.toggleKeyboardButton != nil) assert(self.view.nextKeyboardButton != nil) return [self.view.toggleKeyboardButton, self.view.nextKeyboardButton] default: return [] } } override func helper(helper: GRKeyboardLayoutHelper, rightButtonsForRow row: Int) -> Array<UIButton> { switch row { case 2: assert(self.view.deleteButton != nil) return [self.view.deleteButton] case 3: // assert(self.qwertyView.spaceButton != nil) assert(self.view.doneButton != nil) return [/*self.qwertyView.spaceButton, */self.view.doneButton] default: return [] } } }
[ -1 ]
2e50a1e25c1969824517a9df1b628a86e96dc492
ec57222208a29e046f9bca8cc9b8668985a0e025
/kizouTests/kizouTests.swift
108220a1f9611916da859a0eb0fabeb48e73e386
[]
no_license
Wacha303/kizou1
dd2c4372531b08307fdf757e995908d091980e0c
0f9a141a29ec896acb5d781cc0c6caa9710d806a
refs/heads/master
2020-04-24T20:20:11.445819
2019-02-21T19:05:38
2019-02-21T19:05:38
null
0
0
null
null
null
null
UTF-8
Swift
false
false
902
swift
// // kizouTests.swift // kizouTests // // Created by 中原雄太 on 2019/01/17. // Copyright © 2019年 中原雄太. All rights reserved. // import XCTest @testable import kizou class kizouTests: XCTestCase { override func setUp() { // Put setup code here. This method is called before the invocation of each test method in the class. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. } func testExample() { // This is an example of a functional test case. // Use XCTAssert and related functions to verify your tests produce the correct results. } func testPerformanceExample() { // This is an example of a performance test case. self.measure { // Put the code you want to measure the time of here. } } }
[ 360462, 98333, 16419, 229413, 204840, 278570, 344107, 155694, 253999, 229424, 229430, 319542, 163896, 180280, 352315, 376894, 352326, 254027, 311372, 311374, 196691, 278615, 180311, 180312, 385116, 237663, 254048, 319591, 221290, 278634, 131178, 319598, 352368, 204916, 131191, 237689, 131198, 278655, 319629, 311438, 278677, 196760, 426138, 278685, 311458, 278691, 49316, 32941, 278704, 377009, 278708, 131256, 180408, 295098, 139479, 254170, 229597, 311519, 327904, 205035, 385262, 286958, 327929, 344313, 147717, 368905, 180493, 278797, 254226, 319763, 368916, 262421, 377114, 237856, 237857, 278816, 311597, 98610, 180535, 336183, 278842, 287041, 319813, 139589, 319821, 254286, 344401, 377169, 368981, 155990, 368984, 106847, 98657, 270701, 246127, 270706, 246136, 139640, 246137, 106874, 311681, 311685, 106888, 385417, 311691, 385422, 213403, 246178, 385454, 311727, 377264, 319930, 311738, 33211, 336317, 278970, 336320, 311745, 278978, 254406, 188871, 278989, 278993, 278999, 328152, 369116, 287198, 279008, 279013, 279018, 311786, 319981, 319987, 279029, 254456, 279032, 377338, 279039, 377343, 254465, 287241, 279050, 139792, 303636, 279062, 393751, 254488, 279065, 377376, 377386, 197167, 385588, 352829, 115270, 377418, 385615, 426576, 369235, 295519, 139872, 66150, 344680, 279146, 295536, 287346, 139892, 287352, 344696, 279164, 189057, 311941, 336518, 311945, 369289, 344715, 279177, 311949, 287374, 377489, 311954, 352917, 230040, 271000, 377497, 303771, 377500, 295576, 221852, 205471, 344738, 139939, 279206, 295590, 287404, 295599, 205487, 303793, 336564, 164533, 230072, 287417, 287422, 66242, 377539, 164560, 385747, 279252, 361176, 418520, 287452, 295652, 279269, 246503, 369385, 418546, 312052, 172792, 344827, 221948, 279294, 205568, 295682, 197386, 434957, 312079, 295697, 426774, 197399, 426775, 336671, 344865, 197411, 279336, 295724, 312108, 197422, 353070, 164656, 295729, 353069, 328499, 353078, 197431, 230199, 353079, 336702, 279362, 295746, 353094, 353095, 353109, 377686, 230234, 189275, 435039, 295776, 303972, 385893, 230248, 246641, 246643, 295798, 246648, 361337, 279417, 254850, 369538, 287622, 58253, 426895, 295824, 189348, 353195, 140204, 377772, 353197, 304051, 230332, 377790, 353215, 353216, 189374, 213957, 213960, 345033, 279498, 386006, 418776, 50143, 123881, 304110, 320494, 287731, 271350, 295927, 304122, 320507, 328700, 312314, 328706, 410627, 320516, 295942, 386056, 353290, 230410, 377869, 320527, 238610, 418837, 140310, 320536, 197657, 336929, 189474, 369701, 345132, 238639, 312373, 238651, 377926, 361543, 238664, 214086, 296019, 353367, 156764, 156765, 304222, 230499, 173166, 312434, 377972, 353397, 337017, 377983, 402565, 279685, 222343, 386189, 296086, 238743, 296092, 238765, 279728, 238769, 402613, 230588, 353479, 353481, 402634, 353482, 189652, 189653, 419029, 279765, 148696, 296153, 279774, 304351, 304356, 222440, 328940, 279792, 353523, 386294, 386301, 320770, 386306, 279814, 312587, 328971, 353551, 320796, 222494, 115998, 369956, 279854, 353584, 345396, 386359, 116026, 312634, 378172, 222524, 312635, 279875, 312648, 337225, 304456, 230729, 238927, 353616, 296273, 222559, 378209, 230756, 386412, 230765, 296303, 279920, 312689, 296307, 116084, 181625, 337281, 148867, 378244, 296329, 304524, 296335, 9619, 370071, 279974, 173491, 304564, 279989, 353719, 280004, 361927, 296392, 280010, 370123, 148940, 280013, 312782, 222675, 329173, 353750, 239068, 280032, 271843, 280041, 361963, 329197, 329200, 296433, 321009, 280055, 288249, 230913, 230921, 329225, 296461, 304656, 329232, 370197, 230943, 402985, 394794, 230959, 312880, 288309, 312889, 288318, 280130, 124485, 288326, 288327, 280147, 239198, 157281, 99938, 312940, 222832, 247416, 288378, 337534, 337535, 263809, 312965, 288392, 239250, 419478, 345752, 255649, 206504, 321199, 337591, 321207, 296632, 280251, 280257, 321219, 280267, 403148, 9936, 313041, 9937, 370388, 272085, 345814, 181975, 280278, 280280, 18138, 345821, 321247, 321249, 345833, 345834, 280300, 239341, 67315, 173814, 313081, 124669, 288512, 288516, 280327, 280329, 321295, 321302, 345879, 116505, 321310, 255776, 313120, 247590, 362283, 378668, 296755, 321337, 345919, 436031, 403267, 280392, 345929, 337745, 18262, 362327, 280410, 370522, 345951, 362337, 345955, 296806, 288619, 280430, 214895, 313199, 362352, 296814, 313203, 124798, 182144, 305026, 67463, 329622, 337815, 124824, 214937, 436131, 354212, 313254, 436137, 362417, 124852, 288697, 362431, 214977, 280514, 214984, 321480, 362443, 247757, 231375, 280541, 329695, 436191, 313319, 337895, 247785, 296941, 436205, 329712, 362480, 223218, 313339, 43014, 354316, 313357, 182296, 239650, 329765, 354343, 354345, 223274, 321583, 124975, 346162, 124984, 288828, 436285, 288833, 288834, 436292, 403525, 313416, 436301, 354385, 338001, 338003, 280661, 329814, 338007, 354393, 280675, 280677, 43110, 321637, 329829, 436329, 313447, 288879, 280694, 223350, 288889, 215164, 313469, 215166, 280712, 215178, 346271, 436383, 362659, 239793, 125109, 182456, 280762, 379071, 280768, 149703, 338119, 346314, 321745, 280795, 387296, 280802, 379106, 338150, 346346, 321772, 125169, 338164, 436470, 125183, 149760, 411906, 125188, 313608, 125193, 321800, 125198, 125199, 272658, 125203, 338197, 125208, 305440, 125217, 338218, 321840, 379186, 125235, 280887, 125240, 321860, 182597, 280902, 182598, 289110, 215385, 272729, 379225, 354655, 321894, 280939, 313713, 354676, 313727, 436608, 362881, 248194, 240002, 436611, 395659, 395661, 240016, 108944, 190871, 149916, 420253, 141728, 289189, 289194, 108972, 272813, 338356, 436661, 281037, 289232, 281040, 256477, 330218, 281072, 109042, 174593, 420369, 289304, 322078, 207393, 182817, 289332, 174648, 338489, 338490, 322120, 281166, 281171, 297560, 354911, 436832, 436834, 191082, 313966, 420463, 281199, 346737, 313971, 346740, 420471, 330379, 330387, 117396, 346772, 330388, 117397, 264856, 289434, 346779, 363163, 338613, 166582, 289462, 314040, 109241, 158394, 248517, 363211, 363230, 289502, 264928, 338662, 330474, 346858, 289518, 199414, 35583, 363263, 191235, 264968, 322313, 322316, 117517, 322319, 166676, 207640, 281377, 289576, 191283, 273207, 355130, 289598, 355139, 420677, 355146, 355154, 281427, 281433, 322395, 355165, 109409, 355178, 330609, 174963, 207732, 109428, 158593, 240518, 109447, 224145, 355217, 256922, 289690, 289698, 420773, 289703, 256935, 240552, 363438, 347055, 289722, 289727, 273344, 330689, 363458, 379844, 19399, 338899, 330708, 248796, 248797, 207838, 347103, 314342, 52200, 289774, 183279, 347123, 240630, 314362, 257024, 330754, 134150, 330763, 330772, 322582, 281626, 175132, 248872, 322612, 314436, 314448, 339030, 281697, 314467, 281700, 257125, 322663, 281706, 273515, 207979, 404593, 363641, 363644, 150657, 248961, 330888, 363669, 339100, 380061, 339102, 199839, 429214, 265379, 249002, 306346, 3246, 421048, 208058, 339130, 322749, 265412, 290000, 298208, 298212, 298213, 290022, 330984, 298221, 298228, 216315, 208124, 388349, 363771, 437505, 322824, 257305, 126237, 339234, 208164, 109861, 372009, 412971, 298291, 306494, 216386, 224586, 372043, 331090, 314709, 314710, 372054, 159066, 134491, 314720, 134506, 306542, 380271, 314739, 208244, 249204, 314741, 249205, 290169, 290173, 306559, 224640, 314751, 306560, 314758, 298374, 314760, 142729, 388487, 314766, 306579, 224661, 282007, 290207, 314783, 314789, 282022, 314791, 396711, 396712, 282024, 241066, 314798, 380337, 380338, 150965, 380357, 339398, 306631, 306639, 413137, 429542, 191981, 282096, 306673, 191990, 290301, 282114, 372227, 323080, 323087, 323089, 175639, 388632, 396827, 282141, 134686, 282146, 306723, 347694, 290358, 265798, 282183, 265804, 224847, 118353, 396882, 224851, 290390, 306776, 44635, 396895, 323172, 282213, 323178, 224883, 314998, 323196, 175741, 339584, 282245, 224901, 282246, 290443, 323217, 282259, 282271, 282273, 257699, 282276, 298661, 323236, 282280, 298667, 61101, 364207, 224946, 110268, 224958, 323263, 323264, 282303, 274115, 306890, 282318, 241361, 241365, 298712, 298720, 282339, 12010, 282348, 282358, 175873, 323331, 323332, 339715, 216839, 339720, 372496, 323346, 249626, 282400, 339745, 241441, 315171, 257830, 421672, 282417, 200498, 282427, 315202, 307011, 282434, 282438, 339783, 159562, 323406, 413521, 216918, 241495, 282474, 282480, 241528, 315264, 339841, 241540, 282504, 315273, 315274, 110480, 372626, 380821, 282518, 282519, 298909, 118685, 200627, 323507, 282549, 290745, 290746, 274371, 151497, 372701, 298980, 380908, 282612, 282633, 241692, 102437, 315432, 315434, 102445, 233517, 176175, 282672, 241716, 241720, 225351, 315465, 315476, 307289, 200794, 315487, 356447, 307299, 315497, 315498, 438377, 299121, 233589, 266357, 233590, 422019, 241808, 323729, 381073, 233636, 299174, 323762, 299187, 405687, 184505, 299198, 258239, 389313, 299203, 299209, 372941, 282831, 266449, 356576, 176362, 307435, 438511, 381172, 356602, 184570, 184575, 381208, 315673, 299293, 151839, 233762, 217380, 282919, 151847, 332083, 332085, 332089, 315706, 282939, 241986, 438596, 332101, 323913, 348492, 323916, 323920, 250192, 282960, 348500, 168281, 332123, 332127, 323935, 242023, 242029, 160110, 242033, 291192, 315773, 291198, 340357, 225670, 332167, 242058, 373134, 291224, 242078, 283038, 61857, 315810, 315811, 381347, 61859, 340398, 61873, 299441, 61880, 283064, 291265, 127427, 127428, 283075, 291267, 324039, 373197, 176601, 242139, 160225, 242148, 127465, 291311, 233978, 291333, 340490, 348682, 283153, 258581, 291358, 283184, 234036, 315960, 348732, 242237, 70209, 348742, 70215, 348749, 381517, 332378, 201308, 242277, 111208, 184940, 373358, 389745, 209530, 291454, 373375, 152195, 348806, 184973, 316049, 111253, 316053, 111258, 111259, 176808, 299699, 299700, 422596, 422599, 291530, 225995, 242386, 422617, 422626, 299746, 234217, 299759, 299776, 291585, 430849, 242433, 291592, 62220, 422673, 430865, 291604, 422680, 283419, 291612, 152365, 422703, 422709, 152374, 242485, 160571, 430910, 160575, 160580, 299849, 283467, 381773, 201549, 201551, 242529, 349026, 357218, 275303, 201577, 177001, 308076, 242541, 209783, 209785, 177019, 185211, 308092, 398206, 291712, 381829, 316298, 349067, 308107, 308112, 349072, 209817, 324506, 324507, 390045, 127902, 185250, 324517, 185254, 316333, 373687, 316343, 349121, 373706, 316364, 340955, 340961, 324586, 340974, 316405, 349175, 201720, 127992, 357379, 324625, 308243, 316437, 201755, 300068, 357414, 300084, 324666, 324667, 308287, 21569, 218186, 300111, 341073, 439384, 250981, 300135, 300136, 316520, 357486, 316526, 144496, 300150, 291959, 300151, 160891, 341115, 300158, 349316, 349318, 373903, 169104, 177296, 308372, 185493, 119962, 300187, 300188, 283802, 300201, 300202, 373945, 259268, 283847, 62665, 283852, 283853, 259280, 316627, 333011, 357595, 333022, 234733, 234742, 128251, 292091, 316669, 234755, 439562, 292107, 242954, 414990, 251153, 177428, 349462, 333090, 382258, 300343, 382269, 333117, 193859, 300359, 177484, 406861, 259406, 234831, 251213, 120148, 283991, 357719, 374109, 316765, 234850, 292195, 333160, 243056, 316787, 111993, 357762, 112017, 234898, 259475, 275859, 112018, 357786, 251298, 333220, 316842, 374191, 210358, 284089, 292283, 415171, 292292, 300487, 300489, 284107, 366037, 210390, 210391, 210392, 210393, 144867, 103909, 316902, 54765, 251378, 308723, 333300, 333303, 300536, 300542, 210433, 366083, 292356, 259599, 316946, 308756, 398869, 374296, 374299, 308764, 349726, 333343, 431649, 349741, 169518, 431663, 194110, 235070, 349763, 292423, 218696, 292425, 243274, 128587, 333388, 333393, 300630, 128599, 235095, 333408, 300644, 374372, 415338, 243307, 54893, 325231, 333430, 366203, 325245, 235135, 194180, 415375, 153251, 300714, 210603, 415420, 333503, 218819, 259781, 333509, 333517, 333520, 333521, 333523, 325346, 153319, 325352, 284401, 325371, 194303, 194304, 284429, 284431, 243472, 161554, 366360, 284442, 325404, 325410, 341796, 333610, 399147, 431916, 284459, 300848, 317232, 259899, 325439, 325445, 153415, 341836, 415567, 325457, 317269, 341847, 284507, 350044, 128862, 300894, 284514, 276327, 292712, 325484, 423789, 292720, 325492, 276341, 300918, 341879, 317304, 333688, 112509, 194429, 55167, 325503, 333701, 243591, 325515, 243597, 325518, 333722, 350109, 292771, 300963, 415655, 333735, 284587, 292782, 317360, 243637, 284619, 301008, 153554, 219101, 292836, 292837, 317415, 325619, 432116, 333817, 292858, 415741, 333828, 358410, 399373, 317467, 145435, 292902, 325674, 309295, 243759, 129076, 243767, 358456, 325694, 309345, 227428, 194666, 260207, 432240, 333940, 284788, 292988, 292992, 194691, 333955, 415881, 104587, 235662, 325776, 317587, 284826, 333991, 333992, 284842, 333996, 227513, 301251, 309444, 227524, 194782, 301279, 317664, 243962, 375039, 309503, 194820, 375051, 325905, 334103, 325912, 309529, 227616, 211235, 432421, 211238, 358703, 358709, 260418, 325968, 6481, 366930, 366929, 6489, 334171, 391520, 383332, 383336, 317820, 211326, 317831, 227725, 252308, 178582, 293274, 39324, 121245, 317852, 285084, 285090, 375207, 342450, 293303, 293310, 342466, 416197, 129483, 342476, 317901, 6606, 334290, 326100, 285150, 358882, 342498, 334309, 195045, 391655, 432618, 375276, 301571, 342536, 342553, 416286, 375333, 293419, 244269, 375343, 23092, 375351, 244281, 301638, 309830, 293448, 55881, 416341, 309846, 244310, 416351, 268899, 244327, 39530, 301689, 244347, 326287, 375440, 334481, 227990, 318106, 318107, 342682, 318130, 383667, 293556, 342706, 342713, 285373, 39614, 154316, 334547, 318173, 375526, 285415, 342762, 342763, 293612, 129773, 154359, 228088, 432893, 162561, 285444, 383754, 326414, 285458, 310036, 285466, 326429, 293664, 326433, 400166, 293672, 318250, 318252, 285487, 301871, 375609, 285497, 293693, 342847, 252741, 318278, 293711, 244568, 244570, 301918, 293730, 351077, 342887, 326505, 400239, 310131, 228215, 269178, 400252, 359298, 359299, 260996, 113542, 416646, 228233, 392074, 228234, 236428, 56208, 293781, 318364, 310176, 310178, 310182, 293800, 236461, 293806, 252847, 326581, 326587, 326601, 359381, 433115, 343005, 130016, 64485, 326635, 203757, 187374, 383983, 383982, 277492, 318461, 293886, 293893, 433165, 384016, 146448, 433174, 326685, 252958, 252980, 203830, 359478, 302139, 359495, 277597, 113760, 392290, 253029, 285798, 228458, 318572, 15471, 351344, 187506, 285814, 285820, 392318, 187521, 384131, 302213, 302216, 228491, 228493, 285838, 162961, 326804, 187544, 285851, 351390, 302240, 343203, 253099, 253100, 318639, 367799, 113850, 294074, 64700, 228540, 228542, 302274, 367810, 343234, 244940, 228563, 359647, 195808, 310497, 228588, 253167, 302325, 228600, 228609, 261377, 245019, 253216, 130338, 130343, 130348, 261425, 351537, 171317, 326966, 318775, 286013, 286018, 146762, 294218, 294219, 318805, 425304, 294243, 163175, 327024, 327025, 327031, 318848, 179587, 294275, 253317, 384393, 368011, 318864, 318868, 318875, 310692, 245161, 286129, 286132, 228795, 425405, 302529, 302531, 163268, 425418, 310732, 302540, 64975, 310736, 327121, 228827, 286172, 310757, 187878, 245223, 343542, 343543, 286202, 359930, 286205, 302590, 228867, 253451, 253452, 359950, 146964, 253463, 187938, 286244, 245287, 245292, 286254, 425535, 196164, 56902, 228943, 286288, 179801, 196187, 343647, 286306, 310889, 204397, 138863, 188016, 294529, 286343, 229001, 310923, 188048, 302739, 425626, 229020, 302754, 245412, 229029, 40614, 40613, 40615, 384695, 319162, 327358, 286399, 319177, 212685, 384720, 245457, 302802, 286423, 278233, 278234, 294622, 278240, 229088, 212716, 212717, 294638, 360177, 229113, 286459, 278272, 319233, 360195, 278291, 294678, 286494, 294700, 409394, 319292, 360252, 360264, 188251, 376669, 245599, 237408, 425825, 302946, 425833, 417654, 188292, 327557, 253829, 294807, 294809, 376732, 311199, 319392, 253856, 294823, 327596, 294843, 188348, 237504, 294850, 384964, 163781, 344013, 212942, 212946, 24532, 212951, 360417, 294886, 253929, 327661, 278512, 311281, 311282 ]
8522e73f3063124f668a55eb9ebf715bdcd0eff8
9071f60b2a8e03a603410bd0f65f9270f1d9405e
/Tatangga/View Controller/Akun/AkunViewController.swift
9223706e7d5ccbc12ebc8f1636be3ddc2cbfa9b5
[]
no_license
csu-anzai/Tatangga-v2
e600196760bf5fed32cd2eb23efc1a24752a325e
7f78b88a6f3480742d7b4e0571adda7653a0d7af
refs/heads/master
2020-07-16T22:33:53.233326
2019-09-02T14:07:42
2019-09-02T14:07:42
null
0
0
null
null
null
null
UTF-8
Swift
false
false
8,006
swift
// // AkunViewController.swift // Tatangga // // Created by Mirza Fachreza 2 on 23/08/19. // Copyright © 2019 Mirza Fachreza. All rights reserved. // import UIKit import CloudKit class AkunViewController: UIViewController { var userRecord = [CKRecord]() let islogin = false let profilePhoto: UIButton = { let button = UIButton(type: .system) button.setImage(#imageLiteral(resourceName: "camera").withRenderingMode(.alwaysOriginal), for: .normal) return button }() let userNameText: UILabel = { let label = UILabel() label.text = "Username" label.textAlignment = .center label.font = UIFont.systemFont(ofSize: 16) label.textColor = .black return label }() let statusText: UILabel = { let label = UILabel() label.text = "status" label.textAlignment = .center label.font = UIFont.systemFont(ofSize: 16) label.textColor = UIColor.lightGray return label }() let ubahProfile: UIButton = { let button = UIButton(type: .system) button.setTitle("Ubah Profil", for: .normal) button.setTitleColor(.black, for: .normal) button.backgroundColor = .clear button.layer.borderWidth = 1 button.layer.borderColor = UIColor.black.cgColor button.layer.cornerRadius = 8 button.addTarget(self, action: #selector(handleEditProfile), for: .touchUpInside) return button }() let segmentedControl: UISegmentedControl = { let items = ["Laporan Saya" , "Grup Saya","Alamat Saya"] let segmentedControl = UISegmentedControl(items : items) segmentedControl.selectedSegmentIndex = 0 segmentedControl.addTarget(self, action: #selector(AkunViewController.indexChanged(_:)), for: .valueChanged) segmentedControl.layer.cornerRadius = 5.0 segmentedControl.backgroundColor = .clear segmentedControl.tintColor = .blue return segmentedControl }() override func viewDidLoad() { super.viewDidLoad() if islogin { } else { let login = LoginVC() navigationController?.pushViewController(login, animated: true) } // Do any additional setup after loading the view. navigationItem.title = "Akun" configureLogoutButton() view.addSubview(profilePhoto) profilePhoto.anchor(top: view.topAnchor, left: nil, bottom: nil, right: nil, paddingTop: 112, paddingLeft: 0, paddingBottom: 0, paddingRight: 0, width: 140, height: 140) profilePhoto.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true view.addSubview(userNameText) userNameText.anchor(top: profilePhoto.bottomAnchor, left: nil, bottom: nil, right: nil, paddingTop: 20, paddingLeft: 0, paddingBottom: 0, paddingRight: 0, width: 100, height: 30) userNameText.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true view.addSubview(statusText) statusText.anchor(top: userNameText.bottomAnchor, left: nil, bottom: nil, right: nil, paddingTop: 2, paddingLeft: 0, paddingBottom: 0, paddingRight: 0, width: 100, height: 30) statusText.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true view.addSubview(ubahProfile) ubahProfile.anchor(top: statusText.bottomAnchor, left: nil, bottom: nil, right: nil, paddingTop: 5, paddingLeft: 0, paddingBottom: 0, paddingRight: 0, width: 150, height: 35) ubahProfile.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true view.addSubview(segmentedControl) segmentedControl.anchor(top: ubahProfile.bottomAnchor, left: view.leftAnchor, bottom: nil, right: view.rightAnchor, paddingTop: 5, paddingLeft: 0, paddingBottom: 0, paddingRight: 0, width: 416, height: 35) segmentedControl.centerXAnchor.constraint(equalTo: view.rightAnchor).isActive = true } @objc func indexChanged(_ sender: UISegmentedControl) { switch sender.selectedSegmentIndex{ case 0: print("Laporan saya"); case 1: print("Grup Saya") case 2: print("Alamat Saya") default: break } } @objc func handleEditProfile(){ let editVC = EditProfileController() self.navigationController?.pushViewController(editVC, animated: true) } @objc func handleCancel() { let cancel = AkunViewController() self.navigationController?.pushViewController(cancel, animated: true) _ = navigationController?.popViewController(animated: true) } @objc func handleDone() { view.endEditing(true) // if usernameChanged { // updateUsername() // } // // if imageChanged { // updateProfileImage() // } } @objc func handleLogout(){ let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) alertController.addAction(UIAlertAction(title: "Keluar", style: .destructive, handler: { (_) in // do { // //try Auth.auth().signOut() //// let loginVC = LoginVC() //// let navController = UINavigationController(rootViewController: loginVC) //// self.present(navController, animated: true, completion: nil) // let loginVC = LoginVC() self.navigationController?.pushViewController(loginVC, animated: true) } catch { print("Failed to sign out") } })) alertController.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil)) present(alertController, animated: true, completion: nil) } func configureLogoutButton() { self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Keluar", style: .plain, target: self, action: #selector(handleLogout)) } func authentication() { for index in 1...userRecord.count { let user = userRecord[index - 1] let email = user[RemoteUser.email] as! String let password = user[RemoteUser.password] as! String OperationQueue.main.addOperation { // if (email == self.edtEmail.text && password == self.edtPassword.text) { // When Data Email & Password Input == Database data // Success // let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil) // let viewCon = storyBoard.instantiateViewController(withIdentifier: "mainTabBar") // self.present(viewCon, animated: true, completion: nil) // UserDefaults.standard.set(true, forKey: "isLogin") // UserDefaults.standard.set(String(user.recordID.recordName), forKey: "recordNameUser") // let archivedData = NSMutableData() // do { // let archiver = try NSKeyedArchiver.archivedData(withRootObject: user, requiringSecureCoding: true) // let userDefaults = UserDefaults.standard // userDefaults.set(archiver, forKey: "use rRecord") // userDefaults.synchronize() // } catch { // print(error) // } // } else { // Error Login // } } } let login = LoginVC() navigationController?.pushViewController(login, animated: true) } }
[ -1 ]
a21030460ff3629cb4c375f4ec30b19ad7dc8c60
9d65a1c3f7f00747fa98cffa7496a1930de729ef
/Tests/NIOTransportServicesTests/NIOTSConnectionChannelTests.swift
4af147cc2b9c8e843c2be3c757c9cc7b6b39a11a
[ "Apache-2.0" ]
permissive
Yasumoto/swift-nio-transport-services
244928d9922d0093b7487df45920e039f41ce7e9
80b11dc13261e0e52f75ea3a0b2e04f24e925019
refs/heads/master
2020-09-12T19:52:15.283840
2019-10-24T01:25:18
2019-10-24T01:25:18
222,533,088
0
0
Apache-2.0
2019-11-18T19:59:42
2019-11-18T19:59:39
null
UTF-8
Swift
false
false
29,337
swift
//===----------------------------------------------------------------------===// // // This source file is part of the SwiftNIO open source project // // Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information // See CONTRIBUTORS.txt for the list of SwiftNIO project authors // swift-tools-version:4.0 // // swift-tools-version:4.0 // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// #if canImport(Network) import XCTest import Network import NIO import NIOTransportServices import Foundation @available(OSX 10.14, iOS 12.0, tvOS 12.0, *) final class ConnectRecordingHandler: ChannelOutboundHandler { typealias OutboundIn = Any typealias OutboundOut = Any var connectTargets: [SocketAddress] = [] var endpointTargets: [NWEndpoint] = [] func connect(context: ChannelHandlerContext, to address: SocketAddress, promise: EventLoopPromise<Void>?) { self.connectTargets.append(address) context.connect(to: address, promise: promise) } func triggerUserOutboundEvent(context: ChannelHandlerContext, event: Any, promise: EventLoopPromise<Void>?) { switch event { case let evt as NIOTSNetworkEvents.ConnectToNWEndpoint: self.endpointTargets.append(evt.endpoint) default: break } context.triggerUserOutboundEvent(event, promise: promise) } } final class FailOnReadHandler: ChannelInboundHandler { typealias InboundIn = Any func channelRead(context: ChannelHandlerContext, data: NIOAny) { XCTFail("Must not read") context.fireChannelRead(data) } } final class WritabilityChangedHandler: ChannelInboundHandler { typealias InboundIn = Any private let cb: (Bool) -> Void init(_ cb: @escaping (Bool) -> Void) { self.cb = cb } func channelWritabilityChanged(context: ChannelHandlerContext) { self.cb(context.channel.isWritable) } } @available(OSX 10.14, iOS 12.0, tvOS 12.0, *) final class DisableWaitingAfterConnect: ChannelOutboundHandler { typealias OutboundIn = Any typealias OutboundOut = Any func connect(context: ChannelHandlerContext, to address: SocketAddress, promise: EventLoopPromise<Void>?) { let f = context.channel.setOption(NIOTSChannelOptions.waitForActivity, value: false).flatMap { context.connect(to: address) } if let promise = promise { f.cascade(to: promise) } } } final class PromiseOnActiveHandler: ChannelInboundHandler { typealias InboundIn = Any typealias InboudOut = Any private let promise: EventLoopPromise<Void> init(_ promise: EventLoopPromise<Void>) { self.promise = promise } func channelActive(context: ChannelHandlerContext) { self.promise.succeed(()) } } @available(OSX 10.14, iOS 12.0, tvOS 12.0, *) class NIOTSConnectionChannelTests: XCTestCase { private var group: NIOTSEventLoopGroup! override func setUp() { self.group = NIOTSEventLoopGroup() } override func tearDown() { XCTAssertNoThrow(try self.group.syncShutdownGracefully()) } func testConnectingToSocketAddressTraversesPipeline() throws { let connectRecordingHandler = ConnectRecordingHandler() let listener = try NIOTSListenerBootstrap(group: self.group) .bind(host: "localhost", port: 0).wait() defer { XCTAssertNoThrow(try listener.close().wait()) } let connectBootstrap = NIOTSConnectionBootstrap(group: self.group) .channelInitializer { channel in channel.pipeline.addHandler(connectRecordingHandler) } XCTAssertEqual(connectRecordingHandler.connectTargets, []) XCTAssertEqual(connectRecordingHandler.endpointTargets, []) let connection = try connectBootstrap.connect(to: listener.localAddress!).wait() defer { XCTAssertNoThrow(try connection.close().wait()) } try connection.eventLoop.submit { XCTAssertEqual(connectRecordingHandler.connectTargets, [listener.localAddress!]) XCTAssertEqual(connectRecordingHandler.endpointTargets, []) }.wait() } func testConnectingToHostPortSkipsPipeline() throws { let connectRecordingHandler = ConnectRecordingHandler() let listener = try NIOTSListenerBootstrap(group: self.group) .bind(host: "localhost", port: 0).wait() defer { XCTAssertNoThrow(try listener.close().wait()) } let connectBootstrap = NIOTSConnectionBootstrap(group: self.group) .channelInitializer { channel in channel.pipeline.addHandler(connectRecordingHandler) } XCTAssertEqual(connectRecordingHandler.connectTargets, []) XCTAssertEqual(connectRecordingHandler.endpointTargets, []) let connection = try connectBootstrap.connect(host: "localhost", port: Int(listener.localAddress!.port!)).wait() defer { XCTAssertNoThrow(try connection.close().wait()) } try connection.eventLoop.submit { XCTAssertEqual(connectRecordingHandler.connectTargets, []) XCTAssertEqual(connectRecordingHandler.endpointTargets, [NWEndpoint.hostPort(host: "localhost", port: NWEndpoint.Port(rawValue: UInt16(listener.localAddress!.port!))!)]) }.wait() } func testConnectingToEndpointSkipsPipeline() throws { let connectRecordingHandler = ConnectRecordingHandler() let listener = try NIOTSListenerBootstrap(group: self.group) .bind(host: "localhost", port: 0).wait() defer { XCTAssertNoThrow(try listener.close().wait()) } let connectBootstrap = NIOTSConnectionBootstrap(group: self.group) .channelInitializer { channel in channel.pipeline.addHandler(connectRecordingHandler) } XCTAssertEqual(connectRecordingHandler.connectTargets, []) XCTAssertEqual(connectRecordingHandler.endpointTargets, []) let target = NWEndpoint.hostPort(host: "localhost", port: NWEndpoint.Port(rawValue: UInt16(listener.localAddress!.port!))!) let connection = try connectBootstrap.connect(endpoint: target).wait() defer { XCTAssertNoThrow(try connection.close().wait()) } try connection.eventLoop.submit { XCTAssertEqual(connectRecordingHandler.connectTargets, []) XCTAssertEqual(connectRecordingHandler.endpointTargets, [target]) }.wait() } func testZeroLengthWritesHaveSatisfiedPromises() throws { let listener = try NIOTSListenerBootstrap(group: self.group) .childChannelInitializer { channel in channel.pipeline.addHandler(FailOnReadHandler())} .bind(host: "localhost", port: 0).wait() defer { XCTAssertNoThrow(try listener.close().wait()) } let connection = try NIOTSConnectionBootstrap(group: self.group).connect(to: listener.localAddress!).wait() defer { XCTAssertNoThrow(try connection.close().wait()) } let buffer = connection.allocator.buffer(capacity: 0) XCTAssertNoThrow(try connection.writeAndFlush(buffer).wait()) } func testSettingTCPOptionsWholesale() throws { let tcpOptions = NWProtocolTCP.Options() tcpOptions.disableAckStretching = true let listener = try NIOTSListenerBootstrap(group: self.group) .tcpOptions(tcpOptions) .serverChannelInitializer { channel in channel.getOption(ChannelOptions.socket(IPPROTO_TCP, TCP_SENDMOREACKS)).map { value in XCTAssertEqual(value, 1) } } .childChannelInitializer { channel in channel.getOption(ChannelOptions.socket(IPPROTO_TCP, TCP_SENDMOREACKS)).map { value in XCTAssertEqual(value, 1) } } .bind(host: "localhost", port: 0).wait() defer { XCTAssertNoThrow(try listener.close().wait()) } let connection = try NIOTSConnectionBootstrap(group: self.group) .tcpOptions(tcpOptions) .channelInitializer { channel in channel.getOption(ChannelOptions.socket(IPPROTO_TCP, TCP_SENDMOREACKS)).map { value in XCTAssertEqual(value, 1) } } .connect(to: listener.localAddress!).wait() defer { XCTAssertNoThrow(try connection.close().wait()) } let buffer = connection.allocator.buffer(capacity: 0) XCTAssertNoThrow(try connection.writeAndFlush(buffer).wait()) } func testWatermarkSettingGetting() throws { let listener = try NIOTSListenerBootstrap(group: self.group) .bind(host: "localhost", port: 0).wait() defer { XCTAssertNoThrow(try listener.close().wait()) } let connection = try NIOTSConnectionBootstrap(group: self.group) .connect(to: listener.localAddress!) .wait() defer { XCTAssertNoThrow(try connection.close().wait()) } try connection.getOption(ChannelOptions.writeBufferWaterMark).flatMap { option -> EventLoopFuture<Void> in XCTAssertEqual(option.high, 64 * 1024) XCTAssertEqual(option.low, 32 * 1024) return connection.setOption(ChannelOptions.writeBufferWaterMark, value: ChannelOptions.Types.WriteBufferWaterMark(low: 1, high: 101)) }.flatMap { connection.getOption(ChannelOptions.writeBufferWaterMark) }.map { XCTAssertEqual($0.high, 101) XCTAssertEqual($0.low, 1) }.wait() } func testWritabilityChangesAfterExceedingWatermarks() throws { let listener = try NIOTSListenerBootstrap(group: self.group) .bind(host: "localhost", port: 0).wait() defer { XCTAssertNoThrow(try listener.close().wait()) } var writabilities = [Bool]() let handler = WritabilityChangedHandler { newValue in writabilities.append(newValue) } let connection = try NIOTSConnectionBootstrap(group: self.group) .channelInitializer { channel in channel.pipeline.addHandler(handler) } .connect(to: listener.localAddress!) .wait() // We're going to set some helpful watermarks, and allocate a big buffer. XCTAssertNoThrow(try connection.setOption(ChannelOptions.writeBufferWaterMark, value: ChannelOptions.Types.WriteBufferWaterMark(low: 2, high: 2048)).wait()) var buffer = connection.allocator.buffer(capacity: 2048) buffer.writeBytes(repeatElement(UInt8(4), count: 2048)) // We're going to issue the following pattern of writes: // a: 1 byte // b: 1 byte // c: 2045 bytes // d: 1 byte // e: 1 byte // // We will begin by issuing the writes and checking the writeability status of the channel. // The channel will remain writable until after the write of e, at which point the channel will // become non-writable. // // Then we will issue a flush. The writes will succeed in order. The channel will remain non-writable // until after the promise for d has fired: by the time the promise for e has fired it will be writable // again. try connection.eventLoop.submit { // Pre writing. XCTAssertEqual(writabilities, []) XCTAssertTrue(connection.isWritable) // Write a. After this write, we are still writable. When this write // succeeds, we'll still be not writable. connection.write(buffer.getSlice(at: 0, length: 1)).whenComplete { (_: Result<Void, Error>) in XCTAssertEqual(writabilities, [false]) XCTAssertFalse(connection.isWritable) } XCTAssertEqual(writabilities, []) XCTAssertTrue(connection.isWritable) // Write b. After this write we are still writable. When this write // succeeds we'll still be not writable. connection.write(buffer.getSlice(at: 0, length: 1)).whenComplete { (_: Result<Void, Error>) in XCTAssertEqual(writabilities, [false]) XCTAssertFalse(connection.isWritable) } XCTAssertEqual(writabilities, []) XCTAssertTrue(connection.isWritable) // Write c. After this write we are still writable (2047 bytes written). // When this write succeeds we'll still be not writable (2 bytes outstanding). connection.write(buffer.getSlice(at: 0, length: 2045)).whenComplete { (_: Result<Void, Error>) in XCTAssertEqual(writabilities, [false]) XCTAssertFalse(connection.isWritable) } XCTAssertEqual(writabilities, []) XCTAssertTrue(connection.isWritable) // Write d. After this write we are still writable (2048 bytes written). // When this write succeeds we'll become writable, but critically the promise fires before // the state change, so we'll *appear* to be unwritable. connection.write(buffer.getSlice(at: 0, length: 1)).whenComplete { (_: Result<Void, Error>) in XCTAssertEqual(writabilities, [false]) XCTAssertFalse(connection.isWritable) } XCTAssertEqual(writabilities, []) XCTAssertTrue(connection.isWritable) // Write e. After this write we are now not writable (2049 bytes written). // When this write succeeds we'll have already been writable, thanks to the previous // write. connection.write(buffer.getSlice(at: 0, length: 1)).whenComplete { (_: Result<Void, Error>) in XCTAssertEqual(writabilities, [false, true]) XCTAssertTrue(connection.isWritable) // We close after this succeeds. connection.close(promise: nil) } XCTAssertEqual(writabilities, [false]) XCTAssertFalse(connection.isWritable) }.wait() // Now we're going to flush. This should fire all the writes. connection.flush() XCTAssertNoThrow(try connection.closeFuture.wait()) // Ok, check that the writability changes worked. XCTAssertEqual(writabilities, [false, true]) } func testWritabilityChangesAfterChangingWatermarks() throws { let listener = try NIOTSListenerBootstrap(group: self.group) .bind(host: "localhost", port: 0).wait() defer { XCTAssertNoThrow(try listener.close().wait()) } var writabilities = [Bool]() let handler = WritabilityChangedHandler { newValue in writabilities.append(newValue) } let connection = try NIOTSConnectionBootstrap(group: self.group) .channelInitializer { channel in channel.pipeline.addHandler(handler) } .connect(to: listener.localAddress!) .wait() defer { XCTAssertNoThrow(try connection.close().wait()) } // We're going to allocate a buffer. var buffer = connection.allocator.buffer(capacity: 256) buffer.writeBytes(repeatElement(UInt8(4), count: 256)) // We're going to issue a 256-byte write. This write will not cause any change in channel writability // state. // // Then we're going to set the high watermark to 256, and the low to 128. This will not change channel // writability state. // // Then we're going to set the high watermark to 255 and the low to 128. This will make the channel // not writable. // // Then we're going to set the high watermark to 256, and the low to 128. This will not change the // channel writability state. // // Then we're going to set the high watermark to 1024, and the low to 256. This will not change the // channel writability state. // // Then we're going to set the high watermark to 1024, and the low to 257. This will make the channel // writable again. // // Then we're going to set the high watermark to 1024, and the low to 256. This will change nothing. try connection.eventLoop.submit { // Pre changes. XCTAssertEqual(writabilities, []) XCTAssertTrue(connection.isWritable) // Write. No writability change. connection.write(buffer, promise: nil) XCTAssertEqual(writabilities, []) XCTAssertTrue(connection.isWritable) }.wait() try connection.setOption(ChannelOptions.writeBufferWaterMark, value: ChannelOptions.Types.WriteBufferWaterMark(low: 128, high: 256)).flatMap { // High to 256, low to 128. No writability change. XCTAssertEqual(writabilities, []) XCTAssertTrue(connection.isWritable) return connection.setOption(ChannelOptions.writeBufferWaterMark, value: ChannelOptions.Types.WriteBufferWaterMark(low: 128, high: 255)) }.flatMap { // High to 255, low to 127. Channel becomes not writable. XCTAssertEqual(writabilities, [false]) XCTAssertFalse(connection.isWritable) return connection.setOption(ChannelOptions.writeBufferWaterMark, value: ChannelOptions.Types.WriteBufferWaterMark(low: 128, high: 256)) }.flatMap { // High back to 256, low to 128. No writability change. XCTAssertEqual(writabilities, [false]) XCTAssertFalse(connection.isWritable) return connection.setOption(ChannelOptions.writeBufferWaterMark, value: ChannelOptions.Types.WriteBufferWaterMark(low: 256, high: 1024)) }.flatMap { // High to 1024, low to 128. No writability change. XCTAssertEqual(writabilities, [false]) XCTAssertFalse(connection.isWritable) return connection.setOption(ChannelOptions.writeBufferWaterMark, value: ChannelOptions.Types.WriteBufferWaterMark(low: 257, high: 1024)) }.flatMap { // Low to 257, channel becomes writable again. XCTAssertEqual(writabilities, [false, true]) XCTAssertTrue(connection.isWritable) return connection.setOption(ChannelOptions.writeBufferWaterMark, value: ChannelOptions.Types.WriteBufferWaterMark(low: 256, high: 1024)) }.map { // Low back to 256, no writability change. XCTAssertEqual(writabilities, [false, true]) XCTAssertTrue(connection.isWritable) }.wait() } func testSettingGettingReuseaddr() throws { let listener = try NIOTSListenerBootstrap(group: self.group).bind(host: "localhost", port: 0).wait() defer { XCTAssertNoThrow(try listener.close().wait()) } let connection = try NIOTSConnectionBootstrap(group: self.group) .connect(to: listener.localAddress!) .wait() defer { XCTAssertNoThrow(try connection.close().wait()) } XCTAssertEqual(0, try connection.getOption(ChannelOptions.socket(SOL_SOCKET, SO_REUSEADDR)).wait()) XCTAssertNoThrow(try connection.setOption(ChannelOptions.socket(SOL_SOCKET, SO_REUSEADDR), value: 5).wait()) XCTAssertEqual(1, try connection.getOption(ChannelOptions.socket(SOL_SOCKET, SO_REUSEADDR)).wait()) XCTAssertNoThrow(try connection.setOption(ChannelOptions.socket(SOL_SOCKET, SO_REUSEADDR), value: 0).wait()) XCTAssertEqual(0, try connection.getOption(ChannelOptions.socket(SOL_SOCKET, SO_REUSEADDR)).wait()) } func testSettingGettingReuseport() throws { let listener = try NIOTSListenerBootstrap(group: self.group).bind(host: "localhost", port: 0).wait() defer { XCTAssertNoThrow(try listener.close().wait()) } let connection = try NIOTSConnectionBootstrap(group: self.group) .connect(to: listener.localAddress!) .wait() defer { XCTAssertNoThrow(try connection.close().wait()) } XCTAssertEqual(0, try connection.getOption(ChannelOptions.socket(SOL_SOCKET, SO_REUSEPORT)).wait()) XCTAssertNoThrow(try connection.setOption(ChannelOptions.socket(SOL_SOCKET, SO_REUSEPORT), value: 5).wait()) XCTAssertEqual(1, try connection.getOption(ChannelOptions.socket(SOL_SOCKET, SO_REUSEPORT)).wait()) XCTAssertNoThrow(try connection.setOption(ChannelOptions.socket(SOL_SOCKET, SO_REUSEPORT), value: 0).wait()) XCTAssertEqual(0, try connection.getOption(ChannelOptions.socket(SOL_SOCKET, SO_REUSEPORT)).wait()) } func testErrorsInChannelSetupAreFine() throws { struct MyError: Error { } let listener = try NIOTSListenerBootstrap(group: self.group) .bind(host: "localhost", port: 0).wait() defer { XCTAssertNoThrow(try listener.close().wait()) } let connectFuture = NIOTSConnectionBootstrap(group: self.group) .channelInitializer { channel in channel.eventLoop.makeFailedFuture(MyError()) } .connect(to: listener.localAddress!) do { let conn = try connectFuture.wait() XCTAssertNoThrow(try conn.close().wait()) XCTFail("Did not throw") } catch is MyError { // fine } catch { XCTFail("Unexpected error") } } func testEarlyExitForWaitingChannel() throws { let connectFuture = NIOTSConnectionBootstrap(group: self.group) .channelOption(NIOTSChannelOptions.waitForActivity, value: false) .connect(to: try SocketAddress(unixDomainSocketPath: "/this/path/definitely/doesnt/exist")) do { let conn = try connectFuture.wait() XCTAssertNoThrow(try conn.close().wait()) XCTFail("Did not throw") } catch is NWError { // fine } catch { XCTFail("Unexpected error \(error)") } } func testEarlyExitCanBeSetInWaitingState() throws { let connectFuture = NIOTSConnectionBootstrap(group: self.group) .channelInitializer { channel in channel.pipeline.addHandler(DisableWaitingAfterConnect()) }.connect(to: try SocketAddress(unixDomainSocketPath: "/this/path/definitely/doesnt/exist")) do { let conn = try connectFuture.wait() XCTAssertNoThrow(try conn.close().wait()) XCTFail("Did not throw") } catch is NWError { // fine } catch { XCTFail("Unexpected error \(error)") } } func testCanObserveValueOfDisableWaiting() throws { let listener = try NIOTSListenerBootstrap(group: self.group) .bind(host: "localhost", port: 0).wait() defer { XCTAssertNoThrow(try listener.close().wait()) } let connectFuture = NIOTSConnectionBootstrap(group: self.group) .channelInitializer { channel in return channel.getOption(NIOTSChannelOptions.waitForActivity).map { value in XCTAssertTrue(value) }.flatMap { channel.setOption(NIOTSChannelOptions.waitForActivity, value: false) }.flatMap { channel.getOption(NIOTSChannelOptions.waitForActivity) }.map { value in XCTAssertFalse(value) } }.connect(to: listener.localAddress!) let conn = try connectFuture.wait() XCTAssertNoThrow(try conn.close().wait()) } func testCanObserveValueOfEnablePeerToPeer() throws { let listener = try NIOTSListenerBootstrap(group: self.group) .bind(host: "localhost", port: 0).wait() defer { XCTAssertNoThrow(try listener.close().wait()) } let connectFuture = NIOTSConnectionBootstrap(group: self.group) .channelInitializer { channel in return channel.getOption(NIOTSChannelOptions.enablePeerToPeer).map { value in XCTAssertFalse(value) }.flatMap { channel.setOption(NIOTSChannelOptions.enablePeerToPeer, value: true) }.flatMap { channel.getOption(NIOTSChannelOptions.enablePeerToPeer) }.map { value in XCTAssertTrue(value) } }.connect(to: listener.localAddress!) let conn = try connectFuture.wait() XCTAssertNoThrow(try conn.close().wait()) } func testCanSafelyInvokeActiveFromMultipleThreads() throws { // This test exists to trigger TSAN violations if we screw things up. let listener = try NIOTSListenerBootstrap(group: self.group) .bind(host: "localhost", port: 0).wait() defer { XCTAssertNoThrow(try listener.close().wait()) } let activePromise: EventLoopPromise<Void> = self.group.next().makePromise() let channel = try NIOTSConnectionBootstrap(group: self.group) .channelInitializer { channel in channel.pipeline.addHandler(PromiseOnActiveHandler(activePromise)) }.connect(to: listener.localAddress!).wait() XCTAssertNoThrow(try activePromise.futureResult.wait()) XCTAssertTrue(channel.isActive) XCTAssertNoThrow(try channel.close().wait()) } func testConnectingChannelsOnShutdownEventLoopsFails() throws { let temporaryGroup = NIOTSEventLoopGroup() XCTAssertNoThrow(try temporaryGroup.syncShutdownGracefully()) let bootstrap = NIOTSConnectionBootstrap(group: temporaryGroup) do { _ = try bootstrap.connect(host: "localhost", port: 12345).wait() } catch EventLoopError.shutdown { // Expected } catch { XCTFail("Unexpected error: \(error)") } } func testAutoReadTraversesThePipeline() throws { // This test is driven entirely by a channel handler inserted into the client channel. final class TestHandler: ChannelDuplexHandler { typealias InboundIn = ByteBuffer typealias OutboundIn = ByteBuffer typealias OutboundOut = ByteBuffer var readCount = 0 private let testCompletePromise: EventLoopPromise<Void> init(testCompletePromise: EventLoopPromise<Void>) { self.testCompletePromise = testCompletePromise } func read(context: ChannelHandlerContext) { self.readCount += 1 context.read() } func channelActive(context: ChannelHandlerContext) { var buffer = context.channel.allocator.buffer(capacity: 12) buffer.writeString("Hello, world!") context.writeAndFlush(self.wrapOutboundOut(buffer), promise: nil) } func channelRead(context: ChannelHandlerContext, data: NIOAny) { var buffer = self.unwrapInboundIn(data) if buffer.readString(length: buffer.readableBytes) == "Hello, world!" { self.testCompletePromise.succeed(()) } } } let testCompletePromise = self.group.next().makePromise(of: Void.self) let testHandler = TestHandler(testCompletePromise: testCompletePromise) let listener = try assertNoThrowWithValue(NIOTSListenerBootstrap(group: self.group) .childChannelInitializer { channel in channel.pipeline.addHandler(EchoHandler()) } .bind(host: "localhost", port: 0).wait()) defer { XCTAssertNoThrow(try listener.close().wait()) } let connectBootstrap = NIOTSConnectionBootstrap(group: self.group) .channelInitializer { channel in channel.pipeline.addHandler(testHandler) } let connection = try assertNoThrowWithValue(connectBootstrap.connect(to: listener.localAddress!).wait()) defer { XCTAssertNoThrow(try connection.close().wait()) } // Let the test run. XCTAssertNoThrow(try testCompletePromise.futureResult.wait()) // When the test is completed, we expect the following: // // 1. channelActive, which leads to a write and flush. // 2. read, triggered by autoRead. // 3. channelRead, enabled by the read above, which completes our promise. // 4. IN THE SAME EVENT LOOP TICK, read(), triggered by autoRead. // // Thus, once the test has completed we can enter the event loop and check the read count. // We expect 2. XCTAssertNoThrow(try connection.eventLoop.submit { XCTAssertEqual(testHandler.readCount, 2) }.wait()) } } #endif
[ -1 ]
f57d65648a4ab5f73d055c7d878a98e981e193dc
f84892d6b93c9ad78e160d88e627f2e6174f002f
/iOS/Bloom/Bloom/Components/Add Card/Cells/AddCardSmallHeaderTableViewCell.swift
dc46087b5084b9a4938eeeb0c197cb1978d17282
[ "MIT" ]
permissive
aleckretch/Bloom
b6fa4ac31955c122c9cdc61f3dfa967976211a0a
9f962b1d99231c8c25a3648a09f8d7578d6a5c30
refs/heads/master
2021-07-15T22:46:41.895952
2017-10-22T17:57:01
2017-10-22T17:57:01
107,807,995
1
0
null
null
null
null
UTF-8
Swift
false
false
744
swift
// // AddCardSmallHeaderTableViewCell.swift // Bloom // // Created by Alec Kretch on 10/22/17. // Copyright © 2017 Alec Kretch. All rights reserved. // import Foundation import UIKit class AddCardSmallHeaderTableViewCell: UITableViewCell { @IBOutlet weak var titleLabel: UILabel! { didSet { titleLabel.font = UIFont.boldSystemFont(ofSize: 20.0) titleLabel.textColor = UIColor.darkGray titleLabel.numberOfLines = 1 } } override func awakeFromNib() { super.awakeFromNib() selectionStyle = .none separatorInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: UIScreen.main.bounds.size.width * 2) // Initialization code } }
[ -1 ]
de929c0cd5257abe134e925698d73d789768313d
08250d84ece9c4cb1c5b2163168f75c56211435e
/fearlessTests/Modules/Staking/SelectValidatorsFlow/SelectedValidators/SelectedValidatorListTests.swift
96fc22aac1dc89288495a4213bffcc89878893a7
[ "Apache-2.0" ]
permissive
DiamondNetwork/fearless-iOS
c20f302d3cc42c4c6daaa8e089eb17f41c7ea5bd
e625de6f60aedf3d9aa9fa74648e787fac5e1212
refs/heads/master
2023-09-06T07:19:57.048043
2021-09-23T12:59:00
2021-09-23T12:59:00
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,853
swift
import XCTest @testable import fearless import Cuckoo import FearlessUtils import SoraFoundation class SelectedValidatorListTests: XCTestCase { func testSetup() { // given let view = MockSelectedValidatorListViewProtocol() let wireframe = MockSelectedValidatorListWireframeProtocol() let viewModelFactory = SelectedValidatorListViewModelFactory() let generator = CustomValidatorListTestDataGenerator.self let selectedvalidatorList = generator.createSelectedValidators( from: generator.goodValidators ) let presenter = SelectedValidatorListPresenter( wireframe: wireframe, viewModelFactory: viewModelFactory, localizationManager: LocalizationManager.shared, selectedValidatorList: selectedvalidatorList, maxTargets: 16) presenter.view = view // when let reloadExpectation = XCTestExpectation() let removeLastExpectation = XCTestExpectation() stub(view) { stub in when(stub).didReload(any()).then { viewModel in XCTAssertEqual(viewModel.cellViewModels.count, selectedvalidatorList.count) reloadExpectation.fulfill() } } presenter.setup() stub(view) { stub in when(stub).didChangeViewModel( any(), byRemovingItemAt: any() ).then { viewModel, index in XCTAssertEqual(index, viewModel.cellViewModels.count) removeLastExpectation.fulfill() } } presenter.removeItem(at: selectedvalidatorList.count - 1) // then wait( for: [reloadExpectation, removeLastExpectation], timeout: Constants.defaultExpectationDuration ) } }
[ -1 ]
2fb5f4003f3a694312c9c26a2eb4c7cbb3e4657b
fcac9f03598e2426d070bd3f7975a3e915a2a6d4
/concrete-swift/concrete-swift/view/ShotCollectionViewCell.swift
ba790402b048c7e353d2c254a33db68b224adf38
[]
no_license
kosicki123/concrete-ios
dc4a2c1ec249e5aeebbaf3d465d4fc56177bb306
6cfebabb24692b51090e93b21cbaf00ba44e4955
refs/heads/master
2021-01-10T08:35:03.618613
2015-10-02T20:55:30
2015-10-02T20:55:30
43,386,703
1
0
null
null
null
null
UTF-8
Swift
false
false
653
swift
// // ShotCollectionViewCell.swift // concrete-swift // // Created by Renan Kosicki on 9/29/15. // Copyright © 2015 Renan Kosicki | K-Mobi. All rights reserved. // import Foundation import UIKit import SDWebImage class ShotCollectionViewCell: UICollectionViewCell { @IBOutlet var titleLabel:UILabel! @IBOutlet weak var viewCountLabel: UILabel! @IBOutlet var thumbnailImageView:UIImageView! var shot: Shot! { didSet { titleLabel.text = shot!.title! viewCountLabel.text = "\(shot!.viewsCount!)" thumbnailImageView.sd_setImageWithURL(NSURL(string: shot!.imageUrl!)) } } }
[ -1 ]
95f9df5965a806ec4b4c3e5c33537e4652c8493c
f81d9cdc95c29c2618895c4bc5cd6d19f3d29b9f
/Sources/NotenikLib/fields/FieldDefinition.swift
8758a4d7f899dfa94e57c3112b0255348add7d14
[ "MIT" ]
permissive
hbowie/NotenikLib
394a7e95ec51b830a25e0e1cc256a4257849ef73
ca52ea4a6d8791b504e6f788292bf7a41cc69ad4
refs/heads/master
2023-08-31T06:35:54.695072
2023-08-29T16:44:28
2023-08-29T16:44:28
256,044,584
3
0
null
null
null
null
UTF-8
Swift
false
false
3,700
swift
// // FieldDefinition.swift // Notenik // // Created by Herb Bowie on 11/30/18. // Copyright © 2019 Herb Bowie (https://hbowie.net) // // This programming code is published as open source software under the // terms of the MIT License (https://opensource.org/licenses/MIT). // import Foundation /// The label used to identify this field, along with the field type. public class FieldDefinition: Comparable, CustomStringConvertible { var typeCatalog: AllTypes! public var fieldLabel: FieldLabel = FieldLabel() public var fieldType: AnyType = StringType() public var pickList: PickList? public var comboList: ComboList? public var lookupFrom: String = "" /// Initialize with no parameters, defaulting to a simple String type. init() { } init(typeCatalog: AllTypes) { self.typeCatalog = typeCatalog fieldLabel.set("unknown") fieldType = typeCatalog.assignType(label: fieldLabel, type: nil) } /// Initialize with a string label and guess the type convenience init(typeCatalog: AllTypes, label: String) { self.init(typeCatalog: typeCatalog) fieldLabel.set(label) fieldType = typeCatalog.assignType(label: fieldLabel, type: nil) pickList = fieldType.genPickList() comboList = fieldType.genComboList() } /// Initialize with a FieldLabel object convenience init (typeCatalog: AllTypes, label: FieldLabel) { self.init(typeCatalog: typeCatalog) self.fieldLabel = label fieldType = typeCatalog.assignType(label: label, type: nil) pickList = fieldType.genPickList() comboList = fieldType.genComboList() } /// Initialize with a string label and an integer type convenience init (typeCatalog: AllTypes, label: String, type: String) { self.init(typeCatalog: typeCatalog) fieldLabel.set(label) fieldType = typeCatalog.assignType(label: fieldLabel, type: type) pickList = fieldType.genPickList() comboList = fieldType.genComboList() } var isBody: Bool { return fieldType.isBody } public func copy() -> FieldDefinition { let copy = FieldDefinition(typeCatalog: typeCatalog) copy.fieldLabel = self.fieldLabel.copy() copy.fieldType = self.fieldType copy.pickList = self.pickList copy.comboList = self.comboList return copy } public var description: String { return("Proper: \(fieldLabel.properForm), Common: \(fieldLabel.commonForm), type: \(fieldType.typeString)") } /// Should a field of this type be initialized from an optional class template, when /// one is available? /// - Parameter typeString: The field type. /// - Returns: True if copying from the class template is ok, false otherwise. public var shouldInitFromKlassTemplate: Bool { return typeCatalog.shouldInitFromKlassTemplate(typeString: fieldType.typeString) } public func display() { print("FieldDefinition") fieldLabel.display() print("Field Type String: \(fieldType.typeString)") print("Lookup from: \(lookupFrom)") } /// See if one field label is less than another, using the common form of the label. public static func < (lhs: FieldDefinition, rhs: FieldDefinition) -> Bool { return lhs.fieldLabel < rhs.fieldLabel } /// See if one field label is equal to another, using the common form of the label. public static func == (lhs: FieldDefinition, rhs: FieldDefinition) -> Bool { return lhs.fieldLabel == rhs.fieldLabel } }
[ -1 ]
363e05f76f80f621a35d464c11396448a885a405
a4d96c039a26f0fd5364e4ba638c84271c5a6c4a
/ios/Runner/AppDelegate.swift
d6eb3d231e72f9b97986517f5b69faf01f62ad1c
[]
no_license
gilangpersada/attendance_app
01f9c3f87f9966ec865153f2e15ee5fb8d5b205f
cb774c633d0741e1b10590df998d1c3c46477447
refs/heads/main
2023-05-13T22:37:12.927804
2021-06-04T03:38:39
2021-06-04T03:38:39
373,710,664
2
0
null
null
null
null
UTF-8
Swift
false
false
541
swift
import UIKit import Flutter import GoogleMaps @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { GMSServices.provideAPIKey("AIzaSyA4W_CWTupNmqaU_T7wHgA-zl3vMg0-0ts") GeneratedPluginRegistrant.register(with: self) // Use Firebase library to configure APIs return super.application(application, didFinishLaunchingWithOptions: launchOptions) } }
[ 1170, 346341, 435030 ]
7dda3fb8ac1ca693e73efd36cbb2a1834b4720da
686c464cfcdcf6a5e8851a7e54485ab76e43a0c0
/GHFollowers/Managers/PersistenceManager.swift
37e96d3f7a98efe5e245407681b748507a93adc9
[]
no_license
mohammedbalegh/GitHub_Followers
0b830562c75099a811c4956e9482c3b7aea9e842
5142f2065777b10c7d476a8092e92d5aaa445a73
refs/heads/master
2022-12-04T23:44:36.150200
2020-08-14T09:40:05
2020-08-14T09:40:05
287,497,048
0
0
null
null
null
null
UTF-8
Swift
false
false
2,220
swift
// // PersistenceManager.swift // GHFollowers // // Created by mohammed balegh on 8/14/20. // Copyright © 2020 mohammed balegh. All rights reserved. // import Foundation enum PersistenceActionType { case add, remove } enum PersistenceManager { static private let defaults = UserDefaults.standard enum keys { static let favorites = "favorites" } static func updateWith(favorite: Follower, actionType: PersistenceActionType, completed: @escaping(GFError?) -> Void) { retrieveFavorites { result in switch result { case .success(let favorites): var retrievedFavorites = favorites switch actionType { case .add: guard !retrievedFavorites.contains(favorite) else { completed(.alreadyInFavorites) return } retrievedFavorites.append(favorite) case .remove: retrievedFavorites.removeAll { $0.login == favorite.login} } completed(save(favorites: retrievedFavorites)) case .failure(let error): completed(error) } } } static func retrieveFavorites(completed: @escaping (Result<[Follower],GFError>) -> Void ){ guard let favoritesData = defaults.object(forKey: keys.favorites) as? Data else { completed(.success([])) return } do { let decoder = JSONDecoder() let favorites = try decoder.decode([Follower].self, from: favoritesData) completed(.success(favorites)) } catch { completed(.failure(.unableToFavorite)) } } static func save(favorites: [Follower]) -> GFError? { do { let encoder = JSONEncoder() let encodedFavorites = try encoder.encode(favorites) defaults.set(encodedFavorites, forKey: keys.favorites) return nil } catch { return .unableToFavorite } } }
[ 334268 ]
6bcb01a63c5e8f40cf65939aadba8c00926cc3b1
57cbbcda7a99b7cde65be66a02393e892d1928c6
/godtools/App/Features/ToolSettings/Presentation/ToolSettings/Subviews/ToolSettingsSeparatorView/ToolSettingsSeparatorView.swift
77f65de84b16456f5cd23828b4b2c1587937f65d
[]
no_license
CruGlobal/godtools-swift
073fece8add4dd198d47af95e2e4280c5337e9ea
7fe69de64d53b3b6e6321d986a1dbb33feda158f
refs/heads/develop
2023-09-03T23:33:44.262200
2023-08-28T02:17:21
2023-08-29T13:17:29
72,448,605
10
0
null
2023-09-14T17:22:55
2016-10-31T15:12:36
Swift
UTF-8
Swift
false
false
1,238
swift
// // ToolSettingsSeparator.swift // ToolSettings // // Created by Levi Eggert on 5/10/22. // import SwiftUI struct ToolSettingsSeparatorView: View { let separatorSpacing: CGFloat let separatorLeadingInset: CGFloat let separatorTrailingInset: CGFloat var body: some View { VStack(alignment: .leading, spacing: 0) { Rectangle() .frame(maxWidth: .infinity, minHeight: separatorSpacing, maxHeight: separatorSpacing) .foregroundColor(.clear) Rectangle() .foregroundColor(Color(.sRGB, red: 226 / 256, green: 226 / 256, blue: 226 / 256, opacity: 1)) .frame(maxWidth: .infinity, maxHeight: 1) Rectangle() .frame(maxWidth: .infinity, minHeight: separatorSpacing, maxHeight: separatorSpacing) .foregroundColor(.clear) } .padding(EdgeInsets(top: 0, leading: separatorLeadingInset, bottom: 0, trailing: separatorTrailingInset)) } } struct ToolSettingsSeparatorView_Preview: PreviewProvider { static var previews: some View { ToolSettingsSeparatorView(separatorSpacing: 25, separatorLeadingInset: 20, separatorTrailingInset: 20) } }
[ -1 ]
a9d9f251564346ebc5f0d4e5a51ea1da36ff6ecf
c119bb604de9d0c9ab617931a35f6bd8dc5212dc
/Tests/PlaybookTests.swift
abb931a28abd1d89bad92a7e695566bc9e0a31d2
[ "Apache-2.0" ]
permissive
playbook-ui/playbook-ios
c3008c9646740b6e6344e1a7e60f28265ada52bd
3320069508e677858a5dbfac72622b885f3b351e
refs/heads/master
2023-06-07T03:18:45.795504
2023-02-17T05:34:36
2023-02-17T05:34:36
243,712,144
1,060
65
Apache-2.0
2023-08-16T09:03:31
2020-02-28T08:18:52
Swift
UTF-8
Swift
false
false
2,519
swift
import Playbook import XCTest final class PlaybookTests: XCTestCase { func testScenarios() { let playbook = Playbook() let first = playbook.scenarios(of: "kind") let second = playbook.scenarios(of: "kind") XCTAssertEqual(ObjectIdentifier(first), ObjectIdentifier(second)) } func testScenariosOrder() { let playbook = Playbook() let first = playbook.scenarios(of: "first") let second = playbook.scenarios(of: "second") let third = playbook.scenarios(of: "third") XCTAssertEqual( playbook.stores.map { $0.kind }, [ first.kind, second.kind, third.kind, ] ) } func testAddProvider() { struct TestProvider: ScenarioProvider { static func addScenarios(into playbook: Playbook) { playbook .scenarios(of: "kind") .add(Scenario("name", layout: .fill) { UIView() }) } } let playbook = Playbook() playbook.add(TestProvider.self) let scenario = playbook.scenarios(of: "kind").scenarios.first XCTAssertEqual(scenario?.name, "name") } func testAddScenarios() { let playbook = Playbook() let scenario0 = Scenario("0", layout: .fill) { UIView() } let scenario1 = Scenario("1", layout: .fill) { UIView() } playbook.addScenarios(of: "kind") { scenario0 scenario1 } let store = playbook.scenarios(of: "kind") XCTAssertEqual(store.scenarios.count, 2) XCTAssertEqual(store.scenarios[0].name, scenario0.name) XCTAssertEqual(store.scenarios[1].name, scenario1.name) } func testRunTestTools() throws { final class TestTestTool: TestTool { var playbookIdentifier: ObjectIdentifier? func run(with playbook: Playbook) throws { playbookIdentifier = ObjectIdentifier(playbook) } } let playbook = Playbook() let playbookIdentifier = ObjectIdentifier(playbook) let tool0 = TestTestTool() let tool1 = TestTestTool() let tool2 = TestTestTool() try playbook.run(tool0, tool1, tool2) XCTAssertEqual(tool0.playbookIdentifier, playbookIdentifier) XCTAssertEqual(tool1.playbookIdentifier, playbookIdentifier) XCTAssertEqual(tool2.playbookIdentifier, playbookIdentifier) } }
[ -1 ]
078e2d3be95f51e52e05a906eacfaf8756500ade
444daad59f284313ccf8b83db723f34c1fd13506
/OperationMaintenance_Assistant_ZN/OperationMaintenance_Assistant_ZN/Module/Home/AllOrders/myOrdersVC.swift
9cfc34cdca075a0c357998ccd3b9d6f7ff5cd701
[]
no_license
Chen-organization/OperationMaintenance_Assistant_ZN
5cacebaf481f79c8970047fb0ebea5178fa76441
4ba75845c85371e7354c08354e38804b23eaf112
refs/heads/master
2020-04-11T04:54:22.166001
2019-01-25T11:29:17
2019-01-25T11:29:17
161,530,831
0
0
null
null
null
null
UTF-8
Swift
false
false
15,762
swift
// // myOrdersVC.swift // OperationMaintenance_Assistant_ZN // // Created by Chen on 2019/1/1. // Copyright © 2019年 Chen. All rights reserved. // enum ordersTableViewType : Int { case repair=0, repairing, repaired } import UIKit class myOrdersVC:UIViewController,MXSegmentedPagerDelegate, MXSegmentedPagerDataSource,UITableViewDelegate,UITableViewDataSource,PullTableViewDelegate { var selectedIndex : ordersTableViewType = ordersTableViewType.repair var nowPage = 1 let segmentedPager = MXSegmentedPager() var repairTableview = BasePullTableView() var repairingTableview = BasePullTableView() var repairedTableview = BasePullTableView() var repairArr = [myOrdersReturnObjModel]() var repairingArr = [myOrdersReturnObjModel]() var repairedArr = [myOrdersReturnObjModel]() override func viewDidLoad() { super.viewDidLoad() self.title = "我的工单" self.view.backgroundColor = .white self.edgesForExtendedLayout = [] segmentedPager.delegate = self segmentedPager.dataSource = self segmentedPager.backgroundColor = .white self.view.addSubview(segmentedPager) // Segmented Control customization segmentedPager.segmentedControl.selectionIndicatorLocation = .down segmentedPager.segmentedControl.backgroundColor = .white segmentedPager.segmentedControl.titleTextAttributes = [NSAttributedString.Key.foregroundColor : UIColor.gray, NSAttributedString.Key.font : UIFont.systemFont(ofSize: 16)] segmentedPager.segmentedControl.selectedTitleTextAttributes = [NSAttributedString.Key.foregroundColor : RGBCOLOR(r: 24, 151, 138), NSAttributedString.Key.font : UIFont.systemFont(ofSize: 16)] segmentedPager.segmentedControl.selectionStyle = .textWidthStripe segmentedPager.segmentedControl.selectionIndicatorColor = RGBCOLOR(r: 24, 151, 138) segmentedPager.segmentedControl.selectionIndicatorHeight = 2 segmentedPager.segmentedControl.borderType = .bottom segmentedPager.segmentedControl.borderColor = RGBCOLOR(r: 245, 245, 245) segmentedPager.segmentedControl.borderWidth = -10 segmentedPager.segmentedControlEdgeInsets = UIEdgeInsets.init(top: 0, left: 0, bottom: 10, right: 0) self.repairTableview.tag = ordersTableViewType.repair.rawValue self.repairingTableview.tag = ordersTableViewType.repairing.rawValue self.repairedTableview.tag = ordersTableViewType.repaired.rawValue self.repairTableview.delegate = self self.repairingTableview.delegate = self self.repairedTableview.delegate = self self.repairTableview.dataSource = self self.repairingTableview.dataSource = self self.repairedTableview.dataSource = self self.repairTableview.pullDelegate = self self.repairingTableview.pullDelegate = self self.repairedTableview.pullDelegate = self self.repairTableview.separatorStyle = UITableViewCell.SeparatorStyle.singleLine self.repairingTableview.separatorStyle = UITableViewCell.SeparatorStyle.singleLine self.repairingTableview.separatorStyle = UITableViewCell.SeparatorStyle.singleLine self.repairTableview.separatorColor = RGBCOLOR(r: 240, 240, 240) self.repairingTableview.separatorColor = RGBCOLOR(r: 240, 240, 240) self.repairedTableview.separatorColor = RGBCOLOR(r: 240, 240, 240) let line = UIView() line.backgroundColor = RGBCOLOR(r: 240, 240, 240) line.height = 0.5 self.repairTableview.tableFooterView = line let line1 = UIView() line1.backgroundColor = RGBCOLOR(r: 240, 240, 240) line1.height = 0.5 self.repairingTableview.tableFooterView = line1 let line2 = UIView() line2.backgroundColor = RGBCOLOR(r: 240, 240, 240) line2.height = 0.5 self.repairedTableview.tableFooterView = line self.repairTableview.register(UINib.init(nibName: "MyOrdersCell", bundle: nil), forCellReuseIdentifier: MyOrdersCell_id) self.repairingTableview.register(UINib.init(nibName: "MyOrdersCell", bundle: nil), forCellReuseIdentifier: MyOrdersCell_id) self.repairedTableview.register(UINib.init(nibName: "MyOrdersCell", bundle: nil), forCellReuseIdentifier: MyOrdersCell_id) self.getDataWith(page: 1, type: self.selectedIndex) // Do any additional setup after loading the view. } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) view.setNeedsLayout() view.layoutIfNeeded() self.segmentedPager.pager.showPage(at: selectedIndex.rawValue, animated: false) self.segmentedPager.reloadData() } override func viewWillLayoutSubviews() { super.viewWillLayoutSubviews() self.segmentedPager.frame = self.view.bounds } //MARK: - 数据 func getDataWith(page:Int , type:ordersTableViewType) { UserCenter.shared.userInfo { (islogin, user) in var para = [ "empName":user.empName, "orgCode":user.companyCode, "companyCode":user.companyCode, "start":page.description, "ord": "10", "state":"0", "id":user.empNo ] switch (type){ case ordersTableViewType.repair : para["code"] = "3" break case ordersTableViewType.repairing : para["code"] = "4" break case ordersTableViewType.repaired: para["code"] = "5" break default : break } NetworkService.networkPostrequest(currentView: self.view, parameters: para as [String : Any], requestApi: getWorkFristUrl, modelClass: "myOrdersModel", response: { (obj) in let model : myOrdersModel = obj as! myOrdersModel if model.statusCode == 800 { self.nowPage = page if page == 1 { switch (type){ case ordersTableViewType.repair : self.repairArr = model.returnObj ?? [] break case ordersTableViewType.repairing : self.repairingArr = model.returnObj ?? [] break case ordersTableViewType.repaired: self.repairedArr = model.returnObj ?? [] break default : break } }else{ switch (type){ case ordersTableViewType.repair : self.repairArr += model.returnObj ?? [] break case ordersTableViewType.repairing : self.repairingArr += model.returnObj ?? [] break case ordersTableViewType.repaired: self.repairedArr += model.returnObj ?? [] break default : break } } self.repairTableview.configBlankPage(EaseBlankPageType.view, hasData: self.repairArr.count > 0, hasError: false, reloadButtonBlock: { (sure) in }) self.repairingTableview.configBlankPage(EaseBlankPageType.view, hasData: self.repairingArr.count > 0, hasError: false, reloadButtonBlock: { (sure) in }) self.repairedTableview.configBlankPage(EaseBlankPageType.view, hasData: self.repairedArr.count > 0, hasError: false, reloadButtonBlock: { (sure) in }) self.repairTableview.reloadData() self.repairTableview.mj_header.endRefreshing() self.repairTableview.mj_footer.endRefreshing() self.repairingTableview.reloadData() self.repairingTableview.mj_header.endRefreshing() self.repairingTableview.mj_footer.endRefreshing() self.repairedTableview.reloadData() self.repairedTableview.mj_header.endRefreshing() self.repairedTableview.mj_footer.endRefreshing() } }, failture: { (error) in }) } } //MARK: - SEGMENT func segmentedPager(_ segmentedPager: MXSegmentedPager, titleForSectionAt index: Int) -> String { return ["待维修", "维修中", "已完成"][index] } func segmentedPager(_ segmentedPager: MXSegmentedPager, didScrollWith parallaxHeader: MXParallaxHeader) { print("progress \(parallaxHeader.progress)") } func numberOfPages(in segmentedPager: MXSegmentedPager) -> Int { return 3 } func segmentedPager(_ segmentedPager: MXSegmentedPager, viewForPageAt index: Int) -> UIView { return [repairTableview,repairingTableview,repairedTableview][index] } func segmentedPager(_ segmentedPager: MXSegmentedPager, didSelect view: UIView) { self.selectedIndex = ordersTableViewType(rawValue: segmentedPager.pager.indexForSelectedPage)! if segmentedPager.pager.indexForSelectedPage == ordersTableViewType.repair.rawValue { if !(self.repairArr.count > 0){ self.getDataWith(page: 1, type: ordersTableViewType.repair) } }else if segmentedPager.pager.indexForSelectedPage == ordersTableViewType.repairing.rawValue { if !(self.repairingArr.count > 0){ self.getDataWith(page: 1, type: ordersTableViewType.repairing) } }else { if !(self.repairedArr.count > 0){ self.getDataWith(page: 1, type: ordersTableViewType.repaired) } } } // MARK: - TableView Delegate DataSource func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { switch (tableView.tag){ case 0 : return self.repairArr.count case 1 : return self.repairingArr.count case 2: return self.repairedArr.count default : break } return 0 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell : MyOrdersCell = tableView.dequeueReusableCell(withIdentifier: MyOrdersCell_id, for: indexPath) as! MyOrdersCell var model = myOrdersReturnObjModel() if tableView.tag == ordersTableViewType.repair.rawValue { model = self.repairArr[indexPath.row] } else if tableView.tag == ordersTableViewType.repairing.rawValue { model = self.repairingArr[indexPath.row] }else if tableView.tag == ordersTableViewType.repaired.rawValue { model = self.repairedArr[indexPath.row] } cell.imgView.kf.setImage(with: URL.init(string:model.imgs ?? ""), placeholder: UIImage.init(named: "站位图"), options: nil, progressBlock: { (a, b) in }, completionHandler: { (img) in }) cell.titleL.text = (model.zc ?? "") + "|" + (model.zg ?? "") cell.orderNoL.text = model.id ?? "" cell.contentL.text = model.zv ?? "" cell.addressL.text = model.zb ?? "" cell.bottom1.text = model.zu ?? "" cell.bottom2.text = model.zd ?? "" if let distance = model.distance{ cell.distanceL.text = String(format:"%.1f", Double(distance/1000)) + "km" }else{ cell.distanceL.text = "0.0km" } let hourStr = ((model.timedifference ?? 0) / 1000 / 60 / 60 ).description + "小时" let minStr = ((model.timedifference ?? 0) / 1000 / 60 % 60 ).description + "分钟" cell.TimeL.text = hourStr + minStr return cell } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 115 } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { tableView.deselectRow(at: indexPath, animated: true) let vc = orderDetailVC.getOrderDetailVC() var model : myOrdersReturnObjModel = myOrdersReturnObjModel() if tableView.tag == ordersTableViewType.repair.rawValue{ model = self.repairArr[indexPath.row] vc.repairType = orderDetailType.repair }else if tableView.tag == ordersTableViewType.repairing.rawValue{ model = self.repairingArr[indexPath.row] vc.repairType = orderDetailType.repairing }else if tableView.tag == ordersTableViewType.repaired.rawValue{ model = self.repairedArr[indexPath.row] vc.repairType = orderDetailType.repaired } vc.orderNo = model.id ?? "" self.navigationController?.pushViewController(vc, animated: true) } func pullTableViewDidTriggerRefresh(_ pullTableView: BasePullTableView!) { self.getDataWith(page: 1, type: ordersTableViewType(rawValue: (pullTableView!.tag)) ?? ordersTableViewType(rawValue: 0)!) } func pullTableViewDidTriggerLoadMore(_ pullTableView: BasePullTableView!) { self.getDataWith(page: self.nowPage + 1, type: ordersTableViewType(rawValue: (pullTableView?.tag)!)!) } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destination. // Pass the selected object to the new view controller. } */ }
[ -1 ]
407a68553691fffe186721b7c10ef4afe32ff0fb
a2906bb84ae3c959addbe5b64b86148df8a5975c
/Example/TRUNetworking/ViewController.swift
9cbc82a09b64b43c113cf75f1fbd90dd3c03ff47
[ "MIT" ]
permissive
LucyBenYing/TRUNetworking
09a34bf0df3a58979ef9c92ae5578b4b088e574e
2023cf91a420b557926aae3ab68fc40ff6c7de96
refs/heads/master
2020-06-03T18:28:55.268895
2019-06-13T03:13:47
2019-06-13T03:13:47
191,682,494
0
0
null
null
null
null
UTF-8
Swift
false
false
520
swift
// // ViewController.swift // TRUNetworking // // Created by lby on 06/13/2019. // Copyright (c) 2019 lby. All rights reserved. // import UIKit //import TRUNetworking class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }
[ 275842, 226055, 215562, 284298, 329499, 276256, 209577, 277171, 337336, 276412, 226878, 276167, 277192, 311624, 302286, 226896, 276054, 277602, 276580, 277612, 276597, 120054, 276087 ]
e16b3e7efe5a8153f55f7e4a454d1c46f870024d
9f9bb47867a5ac9a207af0a4132d54f4b988f79d
/Herd/Herd/AudioKit/AudioKit/Common/Playgrounds/Filters.playground/Pages/Parametric Equalizer.xcplaygroundpage/Contents.swift
2f686bde18e50b39fd7d328bd1809393ac6eae62
[ "MIT" ]
permissive
FrozenFireStudios/herd
eb403c49a18fd13057c47ddaad56d560b1813cbc
8c59ee92a91e40f586faf612ff786dac965ce812
refs/heads/master
2020-09-19T12:19:32.569675
2016-08-24T15:18:46
2016-08-24T15:18:46
66,424,268
2
0
null
null
null
null
UTF-8
Swift
false
false
2,217
swift
//: ## Parametric Equalizer //: #### A parametric equalizer can be used to raise or lower specific frequencies //: ### or frequency bands. Live sound engineers often use parametric equalizers //: ### during a concert in order to keep feedback from occuring, as they allow //: ### much more precise control over the frequency spectrum than other //: ### types of equalizers. Acoustic engineers will also use them to tune a room. //: ### This node may be useful if you're building an app to do audio analysis. import XCPlayground import AudioKit let file = try AKAudioFile(readFileName: filtersPlaygroundFiles[0], baseDir: .Resources) let player = try AKAudioPlayer(file: file) player.looping = true var parametricEQ = AKParametricEQ(player) parametricEQ.centerFrequency = 4000 // Hz parametricEQ.q = 1.0 // Hz parametricEQ.gain = 10 // dB AudioKit.output = parametricEQ AudioKit.start() player.play() //: User Interface Set up class PlaygroundView: AKPlaygroundView { override func setup() { addTitle("Parametric EQ") addSubview(AKResourcesAudioFileLoaderView( player: player, filenames: filtersPlaygroundFiles)) addSubview(AKBypassButton(node: parametricEQ)) addSubview(AKPropertySlider( property: "Center Frequency", format: "%0.3f Hz", value: parametricEQ.centerFrequency, maximum: 22050, color: AKColor.greenColor() ) { sliderValue in parametricEQ.centerFrequency = sliderValue }) addSubview(AKPropertySlider( property: "Q", value: parametricEQ.q, maximum: 20, color: AKColor.redColor() ) { sliderValue in parametricEQ.q = sliderValue }) addSubview(AKPropertySlider( property: "Gain", format: "%0.1f dB", value: parametricEQ.gain, minimum: -20, maximum: 20, color: AKColor.cyanColor() ) { sliderValue in parametricEQ.gain = sliderValue }) } } XCPlaygroundPage.currentPage.needsIndefiniteExecution = true XCPlaygroundPage.currentPage.liveView = PlaygroundView()
[ -1 ]
f035b5aac436205e9bcce3da762ede7d6961eb40
c23fc1b42fe5482465e8fdf7127bb7f0894a7bed
/Todoy/Controllers/ListViewController.swift
4e0125d0461aaa20a4927a99a4b5537447a0d0f9
[]
no_license
nishantshahuci/Todoy
b564f7f3e9be0db54af2dd83ea4f3429b3d5d4e8
230a1f6d676d3b36cac674550dc1b80829d277c3
refs/heads/master
2020-03-31T22:32:52.638095
2018-10-18T15:16:44
2018-10-18T15:16:44
null
0
0
null
null
null
null
UTF-8
Swift
false
false
4,923
swift
// // CategoryViewController.swift // Todoy // // Created by Nishant Shah on 10/11/18. // Copyright © 2018 Nishant Shah. All rights reserved. // import UIKit import RealmSwift class ListViewController: SwipeTableViewController { // Search bar outlet @IBOutlet weak var searchBar: UISearchBar! // Initialize Realm let realm = try! Realm() // Array of lists var lists: Results<List>? override func viewDidLoad() { super.viewDidLoad() loadItems() } override func viewWillAppear(_ animated: Bool) { super.customizeView(withSearchBar: searchBar) } // MARK: - TableView data source override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { // return number of rows return lists?.count ?? 0 } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { // return new cell let cell = super.tableView(tableView, cellForRowAt: indexPath) if let listName = lists?[indexPath.row].name { cell.textLabel?.text = listName } return cell } // MARK: - TableView delegate methods override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { // handle user selecting an item in the list performSegue(withIdentifier: "goToItems", sender: self) tableView.deselectRow(at: indexPath, animated: true); } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { let destination = segue.destination as! ItemViewController guard let indexPath = tableView.indexPathForSelectedRow else { fatalError("Error getting index path for selected row") } destination.selectedList = lists?[indexPath.row] } // MARK: - Add new items @IBAction func addButtonPressed(_ sender: UIBarButtonItem) { // handle user pressing add button let alert = UIAlertController(title: "Create new list", message: "", preferredStyle: .alert) // text field var textField = UITextField(); alert.addTextField { (alertTextField) in alertTextField.placeholder = "Create new list" textField = alertTextField } // action to create new list let addAction = UIAlertAction(title: "Create", style: .default) { (action) in // handle user pressing "Create" button on alert // handle case where the text is null guard let text = textField.text else { return } if !text.isEmpty { let newList = List() newList.name = text do { try self.realm.write { self.realm.add(newList) } } catch { print("Error saving context: \(error)") } } self.tableView.reloadData() } alert.addAction(addAction) // action to cancel let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil) alert.addAction(cancelAction) present(alert, animated: true, completion: nil) } // MARK: - Read items func loadItems() { // retrieve lists from Realm lists = realm.objects(List.self) tableView.reloadData() } // MARK: - Delete item override func updateModel(at indexPath: IndexPath) { // delete item when swiped if let list = self.lists?[indexPath.row] { do { try self.realm.write { self.realm.delete(list) } } catch { print("Error deleting list: \(error)") } } } } // MARK: - SearchBar methods extension ListViewController: UISearchBarDelegate { func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) { // handle user search if searchBar.text?.count == 0 { // reset view loadItems() DispatchQueue.main.async { searchBar.resignFirstResponder() } } else { // filter lists guard let searchText = searchBar.text else { return } lists = realm.objects(List.self).filter("name CONTAINS[cd] %@", searchText).sorted(byKeyPath: "name", ascending: true) tableView.reloadData() } } }
[ -1 ]
9334102242139848e862289c7967a5ef241f201a
6d0120b3e037ad3fa1035c29a05a6a561b55b150
/PokeMatch/PokeMatch/PokéMatchUITests/Poke_MatchUITests.swift
8bd4bc38bcb6457ef479c12bec0e99a3692d33e3
[]
no_license
AllenBoynton/PokeMatchOld
e6101e131dff19085a007bda71d1d114994dd99a
b51543edb97abb4a1c3f44cc30dd25a199bdfb74
refs/heads/master
2021-09-20T17:07:20.227988
2018-08-12T22:42:29
2018-08-12T22:42:29
104,613,687
0
0
null
null
null
null
UTF-8
Swift
false
false
1,253
swift
// // Poke_MatchUITests.swift // PokéMatchUITests // // Created by Allen Boynton on 9/23/17. // Copyright © 2017 Allen Boynton. All rights reserved. // import XCTest class Poke_MatchUITests: 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, 223269, 229414, 292901, 354342, 102441, 315433, 325675, 354346, 278571, 124974, 282671, 102446, 229425, 243763, 241717, 229431, 180279, 215095, 213051, 288829, 325695, 288835, 286787, 237638, 313415, 239689, 315468, 311373, 333902, 278607, 196687, 311377, 354386, 329812, 223317, 315477, 354394, 200795, 180317, 323678, 321632, 315489, 315488, 45154, 280676, 313446, 227432, 215144, 233578, 194667, 307306, 278637, 288878, 319599, 278642, 284789, 131190, 284790, 288890, 292987, 215165, 131199, 227459, 194692, 235661, 278669, 241809, 323730, 278676, 311447, 153752, 327834, 284827, 278684, 329884, 299166, 278690, 311459, 215204, 233635, 284840, 184489, 278698, 284843, 299176, 278703, 323761, 184498, 278707, 125108, 180409, 278713, 295099, 258233, 299197, 280761, 280767, 223418, 227517, 299202, 139459, 309443, 176325, 131270, 301255, 299208, 227525, 280779, 233678, 227536, 282832, 321744, 301270, 229591, 280792, 301271, 385240, 311520, 325857, 334049, 280803, 182503, 319719, 307431, 338151, 295147, 317676, 286957, 125166, 125170, 313595, 125180, 125184, 309504, 217352, 125197, 194832, 227601, 325904, 338196, 125204, 319764, 278805, 282908, 311582, 299294, 282912, 233761, 125215, 278817, 211239, 282920, 334121, 125225, 317738, 311596, 321839, 315698, 98611, 125236, 332084, 307514, 282938, 278843, 287040, 319812, 227655, 280903, 319816, 323914, 368969, 201037, 282959, 229716, 289109, 168280, 379224, 323934, 391521, 239973, 381286, 313703, 285031, 416103, 280938, 242027, 242028, 321901, 354671, 278895, 287089, 199030, 227702, 315768, 315769, 291194, 223611, 248188, 139641, 313726, 211327, 291200, 311679, 291193, 240003, 158087, 313736, 227721, 242059, 311692, 227730, 285074, 240020, 190872, 291225, 317851, 293275, 285083, 227743, 242079, 293281, 283039, 285089, 305572, 289185, 301482, 289195, 311723, 377265, 338359, 299449, 311739, 319931, 293309, 278974, 311744, 317889, 291266, 278979, 326083, 278988, 289229, 281038, 326093, 281039, 278992, 283088, 283089, 279000, 242138, 285152, 291297, 279009, 369121, 195044, 160224, 242150, 279014, 319976, 279017, 188899, 311787, 281071, 319986, 236020, 279030, 293368, 311800, 279033, 317949, 279042, 283138, 233987, 287237, 377352, 322057, 309770, 342537, 279053, 303634, 182802, 283154, 303635, 279061, 279066, 188954, 322077, 291359, 227881, 293420, 289328, 283185, 236080, 279092, 23093, 234037, 244279, 338491, 234044, 301635, 309831, 55880, 322119, 377419, 303693, 281165, 301647, 281170, 326229, 244311, 309847, 189016, 115287, 332379, 111197, 295518, 287327, 242274, 244326, 279143, 279150, 281200, 287345, 313970, 301688, 244345, 189054, 287359, 297600, 303743, 301702, 164487, 311944, 334473, 279176, 316044, 311948, 184974, 311950, 316048, 311953, 316050, 287379, 326288, 227991, 295575, 289435, 303772, 205469, 221853, 285348, 314020, 279207, 295591, 295598, 279215, 318127, 342705, 248494, 293552, 287412, 166581, 299698, 154295, 164532, 285360, 303802, 287418, 314043, 66243, 291529, 225996, 363212, 287438, 242385, 303826, 279253, 158424, 230105, 299737, 322269, 295653, 342757, 289511, 234216, 330473, 230120, 285419, 330476, 289517, 215790, 279278, 312046, 170735, 125683, 230133, 199415, 234233, 279293, 289534, 322302, 205566, 299777, 291584, 228099, 285443, 291591, 295688, 322312, 285450, 264971, 312076, 326413, 322320, 285457, 295698, 166677, 283418, 285467, 326428, 281378, 234276, 318247, 262952, 262953, 279337, 318251, 289580, 262957, 283431, 293673, 301872, 242481, 303921, 164655, 234290, 285493, 230198, 328495, 301883, 201534, 281407, 289599, 295745, 222017, 342846, 293702, 318279, 283466, 281426, 279379, 295769, 201562, 244569, 281434, 322396, 230238, 301919, 230239, 349025, 293729, 275294, 279393, 281444, 303973, 279398, 351078, 177002, 308075, 242540, 310132, 295797, 201590, 295799, 228214, 279418, 269179, 177018, 308093, 314240, 291713, 158594, 240517, 287623, 299912, 416649, 279434, 316299, 252812, 228232, 320394, 308111, 189327, 308113, 234382, 293780, 310166, 289691, 209820, 277404, 240543, 283551, 310177, 289699, 189349, 289704, 279465, 293801, 326571, 177074, 304050, 326580, 289720, 326586, 289723, 189373, 213956, 281541, 19398, 213961, 279499, 56270, 191445, 304086, 183254, 183258, 234469, 314343, 304104, 324587, 183276, 234476, 203758, 320495, 320492, 289773, 287730, 277493, 240631, 320504, 312313, 312315, 312317, 328701, 328705, 234499, 293894, 320520, 230411, 320526, 330766, 234513, 238611, 293911, 140311, 316441, 238617, 197658, 326684, 113710, 189487, 281647, 322609, 312372, 203829, 238646, 300087, 238650, 320571, 21567, 308288, 336962, 160834, 314437, 349254, 238663, 300109, 207954, 234578, 296023, 205911, 314458, 156763, 277600, 281698, 281699, 285795, 214116, 322664, 228457, 318571, 279659, 234606, 300145, 238706, 312435, 187508, 279666, 230514, 300147, 302202, 285819, 314493, 285823, 234626, 279686, 222344, 285834, 318602, 228492, 337037, 234635, 177297, 162962, 187539, 326803, 308375, 324761, 285850, 296091, 119965, 302239, 300192, 234655, 339106, 234662, 300200, 249003, 238764, 322733, 208044, 3243, 279729, 294069, 300215, 294075, 64699, 228541, 148674, 283846, 312519, 283849, 148687, 290001, 189651, 316628, 279766, 189656, 279775, 304352, 298209, 304353, 310496, 279780, 228587, 279789, 290030, 302319, 251124, 234741, 283894, 316661, 208123, 292092, 279803, 228608, 320769, 234756, 322826, 242955, 177420, 312588, 318732, 126229, 318746, 245018, 320795, 320802, 130342, 304422, 130344, 292145, 298290, 312628, 300342, 159033, 333114, 333115, 286012, 222523, 181568, 279872, 294210, 216387, 286019, 193858, 279874, 300354, 300355, 304457, 230730, 372039, 294220, 296269, 234830, 224591, 238928, 296274, 314708, 318804, 283990, 314711, 357720, 300378, 300379, 294236, 234330, 314721, 292194, 230757, 281958, 314727, 134504, 306541, 327023, 234864, 296304, 312688, 316786, 230772, 314740, 327030, 284015, 314745, 290170, 310650, 224637, 306558, 290176, 243073, 179586, 306561, 294278, 314759, 296328, 298378, 296330, 318860, 314765, 368012, 292242, 112019, 306580, 279955, 234902, 224662, 282008, 314776, 318876, 282013, 290206, 148899, 314788, 298406, 314790, 245160, 333224, 282023, 241067, 279979, 314797, 279980, 286128, 173492, 286133, 284086, 284090, 302523, 228796, 310714, 54719, 302530, 280003, 228804, 310725, 306630, 292291, 300488, 415170, 306634, 280011, 302539, 234957, 370122, 339403, 329168, 300490, 222674, 327122, 280020, 329170, 312785, 280025, 310747, 239069, 144862, 286176, 187877, 320997, 310758, 280042, 280043, 191980, 300526, 329198, 337391, 282097, 296434, 308722, 306678, 40439, 288248, 191991, 286201, 300539, 288252, 312830, 290304, 286208, 245249, 228868, 292359, 323079, 218632, 230922, 302602, 323083, 294413, 304655, 323088, 329231, 282132, 230933, 302613, 316951, 282135, 374297, 302620, 313338, 282147, 222754, 306730, 245291, 312879, 230960, 288305, 290359, 239159, 323132, 235069, 157246, 288319, 288322, 280131, 349764, 310853, 124486, 282182, 292424, 288328, 194118, 286281, 292426, 333389, 224848, 224852, 290391, 235096, 306777, 128600, 196184, 239192, 230999, 212574, 204386, 300643, 300645, 282214, 312937, 224874, 243306, 204394, 312941, 206447, 310896, 314997, 294517, 288377, 290425, 325246, 333438, 235136, 280193, 282244, 239238, 288391, 286344, 323208, 282248, 286351, 188049, 239251, 229011, 280217, 323226, 229021, 302751, 282272, 198304, 282279, 298664, 212649, 298666, 317102, 286387, 300725, 337590, 286392, 300729, 302778, 306875, 296636, 280252, 282302, 280253, 286400, 323265, 323262, 280259, 321217, 321220, 333508, 296649, 239305, 212684, 9935, 241360, 282321, 313042, 286419, 241366, 280279, 18139, 294621, 280285, 282336, 321250, 294629, 153318, 333543, 181992, 12009, 337638, 282347, 288492, 282349, 34547, 67316, 286457, 313082, 284410, 288508, 282366, 286463, 319232, 278273, 288515, 280326, 282375, 323335, 300810, 282379, 116491, 216844, 280333, 300812, 284430, 161553, 124691, 278292, 118549, 116502, 282390, 278294, 284436, 325403, 321308, 321309, 282399, 241440, 282401, 325411, 315172, 186149, 186148, 241447, 333609, 294699, 286507, 284460, 280367, 300849, 282418, 280373, 282424, 319289, 280377, 321338, 282428, 280381, 345918, 413500, 241471, 280386, 315431, 280391, 153416, 315209, 325449, 159563, 280396, 307024, 317268, 237397, 307030, 241494, 18263, 188250, 284508, 300893, 307038, 284515, 237411, 276326, 296807, 282471, 292713, 282476, 292719, 296815, 362351, 313200, 325491, 313204, 333687, 317305, 124795, 317308, 339840, 315265, 280451, 327556, 188293, 243590, 282503, 315272, 67464, 325514, 315275, 305032, 243592, 184207, 124816, 311183, 282517, 294806, 214936, 294808, 337816, 239515, 214943, 298912, 319393, 333727, 294820, 333734, 284584, 294824, 313257, 310731, 292783, 126896, 200628, 300983, 343993, 288698, 98240, 294849, 214978, 280517, 280518, 214983, 282572, 282573, 153553, 24531, 231382, 329696, 292835, 6116, 190437, 292838, 294887, 317416, 313322, 298987, 329707, 311277, 296942, 278507, 124912, 327666, 278515, 325620, 239610 ]
cc8b2f9af28cf61dd542befb8e8204ea3ca956fa
ec1c368029444a529ddf29853d7aa29e038feaef
/Sources/SwiftAST/SwiftType.swift
04b77cc7af701814749a3fb1e5208c450890c245
[]
no_license
woshiccm/TS2Swift
ce7834cc47b04849a1c914ec23d943d129862f12
0920d57adf808a9593031d0cdb80ca0d8ea9c477
refs/heads/master
2023-08-29T19:10:54.701983
2021-11-11T15:18:29
2021-11-11T15:18:29
423,075,113
0
0
null
2021-11-11T15:18:29
2021-10-31T06:49:09
Swift
UTF-8
Swift
false
false
22,857
swift
/// Represents a Swift type structure indirect public enum SwiftType: Hashable { case nested(NestedSwiftType) case nominal(NominalSwiftType) case protocolComposition(ProtocolCompositionSwiftType) case tuple(TupleSwiftType) case block(returnType: SwiftType, parameters: [SwiftType], attributes: Set<BlockTypeAttribute>) case metatype(for: SwiftType) case optional(SwiftType) case implicitUnwrappedOptional(SwiftType) case nullabilityUnspecified(SwiftType) case array(SwiftType) case dictionary(key: SwiftType, value: SwiftType) } extension SwiftType: ExpressibleByStringLiteral { public init(stringLiteral value: String) { self = .nominal(.typeName(value)) } } /// A nominal Swift type, which is either a plain typename or a generic type. public enum NominalSwiftType: Hashable { case typeName(String) case generic(String, parameters: GenericArgumentSwiftType) } extension NominalSwiftType: ExpressibleByStringLiteral { public init(stringLiteral value: String) { self = .typeName(value) } } /// A component for a protocol composition public enum ProtocolCompositionComponent: Hashable { case nominal(NominalSwiftType) case nested(NestedSwiftType) } /// A tuple swift type, which either represents an empty tuple or two or more /// Swift types. public enum TupleSwiftType: Hashable { case types(TwoOrMore<SwiftType>) case empty } /// An attribute for block types. public enum BlockTypeAttribute: Hashable, CustomStringConvertible { public var description: String { switch self { case .autoclosure: return "@autoclosure" case .escaping: return "@escaping" case .convention(let c): return "@convention(\(c.rawValue))" } } case autoclosure case escaping case convention(Convention) public enum Convention: String, Hashable { case block case c } } public typealias ProtocolCompositionSwiftType = TwoOrMore<ProtocolCompositionComponent> public typealias NestedSwiftType = TwoOrMore<NominalSwiftType> public typealias GenericArgumentSwiftType = OneOrMore<SwiftType> public extension SwiftType { /// If this Swift type is a nominal typename, returns the inner type name as /// a string, otherwise returns nil. var typeName: String? { switch self { case .nominal(.typeName(let name)): return name default: return nil } } /// If this Swift type is a nominal typename, returns the inner type name as /// a string, and if it's a nested type, returns the last nominal type's name var lastNominalTypeName: String? { switch self { case .nominal(.typeName(let name)): return name case .nested(let names): return names.last.typeNameValue default: return nil } } /// Whether this type requires surrounding parenthesis when this type is used /// within an optional or metatype. var requiresSurroundingParens: Bool { switch self { case .protocolComposition, .block: return true default: return false } } /// Returns `true` if this type is a block type var isBlock: Bool { switch self { case .block: return true default: return false } } /// Returns `true` if this type is either an optional, an implicitly unwrapped /// optional, or a 'nullability-unspecified' optional. var isOptional: Bool { switch self { case .optional, .implicitUnwrappedOptional, .nullabilityUnspecified: return true default: return false } } var isMetatype: Bool { switch self { case .metatype: return true default: return false } } var isImplicitlyUnwrapped: Bool { switch self { case .implicitUnwrappedOptional: return true default: return false } } var canBeImplicitlyUnwrapped: Bool { switch self { case .implicitUnwrappedOptional, .nullabilityUnspecified: return true default: return false } } var isNullabilityUnspecified: Bool { switch self { case .nullabilityUnspecified: return true default: return false } } /// Returns `true` if this type represents a nominal type. /// Except for blocks, metatypes and tuples, all types are considered nominal /// types. var isNominal: Bool { switch self { case .block, .metatype, .tuple: return false default: return true } } /// Returns `true` iff this SwiftType is a `.protocolComposition` case. var isProtocolComposition: Bool { switch self { case .protocolComposition: return true default: return false } } /// Returns `true` if this type is a `.typeName`, a `.genericTypeName`, or a /// `.protocolComposition` type. var isProtocolComposable: Bool { switch self { case .nominal(.typeName), .nominal(.generic), .protocolComposition: return true default: return false } } /// If this type is an `.optional` or `.implicitUnwrappedOptional` type, returns /// an unwrapped version of self. /// The return is unwrapped only once. var unwrapped: SwiftType { switch self { case .optional(let type), .implicitUnwrappedOptional(let type), .nullabilityUnspecified(let type): return type default: return self } } /// If this type is an `.optional` or `.implicitUnwrappedOptional` type, /// returns an unwrapped version of self. /// The return is then recursively unwrapped again until a non-optional base /// type is reached. var deepUnwrapped: SwiftType { switch self { case .optional(let type), .implicitUnwrappedOptional(let type), .nullabilityUnspecified(let type): return type.deepUnwrapped default: return self } } /// Returns `self` wrapped over an `.optional` case. var asOptional: SwiftType { .optional(self) } /// Returns `self` wrapped over an `.implicitUnwrappedOptional` case. var asImplicitUnwrapped: SwiftType { .implicitUnwrappedOptional(self) } /// Returns `self` wrapped over an `.nullabilityUnspecified` case. var asNullabilityUnspecified: SwiftType { .nullabilityUnspecified(self) } /// Returns a greater than zero number that indicates how many layers of /// optional types this type contains until the first non-optional type. var optionalityDepth: Int { return isOptional ? 1 + unwrapped.optionalityDepth : 0 } /// Returns this type, wrapped in the same optionality depth as another given /// type. /// /// In case the other type is not an optional type, returns this type with /// no optionality. func withSameOptionalityAs(_ type: SwiftType) -> SwiftType { type.wrappingOther(self.deepUnwrapped) } /// In case this type represents an optional value, returns a new optional /// type with the same optionality as this type, but wrapping over a given /// type. /// /// If this type is not optional, `type` is returned, instead. /// /// Lookup is deep, and returns the same optionality chain as this type's. func wrappingOther(_ type: SwiftType) -> SwiftType { switch self { case .optional(let inner): return .optional(inner.wrappingOther(type)) case .implicitUnwrappedOptional(let inner): return .implicitUnwrappedOptional(inner.wrappingOther(type)) case .nullabilityUnspecified(let inner): return .nullabilityUnspecified(inner.wrappingOther(type)) default: return type } } static let void = SwiftType.tuple(.empty) static let int = SwiftType.typeName("Int") static let uint = SwiftType.typeName("UInt") static let string = SwiftType.typeName("String") static let bool = SwiftType.typeName("Bool") static let float = SwiftType.typeName("Float") static let double = SwiftType.typeName("Double") static let cgFloat = SwiftType.typeName("CGFloat") static let any = SwiftType.typeName("Any") static let anyObject = SwiftType.typeName("AnyObject") static let selector = SwiftType.typeName("Selector") static let nsArray = SwiftType.typeName("NSArray") static let nsDictionary = SwiftType.typeName("NSDictionary") /// A special type name to use to represent instancetype's from Objective-C. static let instancetype = SwiftType.typeName("__instancetype") /// A special type used in place of definitions with improper typing static let errorType = SwiftType.typeName("<<error type>>") static func openRange(_ operand: SwiftType) -> SwiftType { .nominal(.generic("Range", parameters: .one(operand))) } static func closedRange(_ operand: SwiftType) -> SwiftType { .nominal(.generic("ClosedRange", parameters: .one(operand))) } static func typeName(_ name: String) -> SwiftType { .nominal(.typeName(name)) } static func generic(_ name: String, parameters: GenericArgumentSwiftType) -> SwiftType { .nominal(.generic(name, parameters: parameters)) } static func swiftBlock(returnType: SwiftType, parameters: [SwiftType] = []) -> SwiftType { .block(returnType: returnType, parameters: parameters, attributes: []) } /// Returns a type that is the same as the input, but with any .optional or /// .implicitUnwrappedOptional types unwrapped to non optional, inclusing /// block parameters. /// /// - Parameters: /// - type: The input type /// - removeImplicitsOnly: Whether to only remove implicit unwrapped optionals, /// keeping optionals in place. /// - Returns: The deeply unwrapped version of the input type. static func asNonnullDeep(_ type: SwiftType, removeUnspecifiedsOnly: Bool = false) -> SwiftType { var result: SwiftType = type if removeUnspecifiedsOnly { if case .nullabilityUnspecified(let inner) = type { result = inner } } else { result = type.deepUnwrapped } switch result { case let .block(returnType, parameters, attributes): let returnType = asNonnullDeep(returnType, removeUnspecifiedsOnly: removeUnspecifiedsOnly) let parameters = parameters.map { asNonnullDeep($0, removeUnspecifiedsOnly: removeUnspecifiedsOnly) } result = .block(returnType: returnType, parameters: parameters, attributes: attributes) default: break } return result } } extension NominalSwiftType: CustomStringConvertible { public var description: String { switch self { case .typeName(let name): return name case let .generic(name, params): return name + "<" + params.map(\.description).joined(separator: ", ") + ">" } } public var typeNameValue: String { switch self { case .typeName(let typeName), .generic(let typeName, _): return typeName } } } extension ProtocolCompositionComponent: CustomStringConvertible { public var description: String { switch self { case .nested(let items): return items.map(\.description).joined(separator: ".") case .nominal(let nominal): return nominal.description } } public static func typeName(_ name: String) -> ProtocolCompositionComponent { .nominal(.typeName(name)) } } extension SwiftType: CustomStringConvertible { public var description: String { switch self { case .nominal(let type): return type.description case let .block(returnType, parameters, attributes): let sortedAttributes = attributes.sorted { $0.description < $1.description } let attributeString = sortedAttributes.map(\.description).joined(separator: " ") return (attributeString.isEmpty ? "" : attributeString + " ") + "(" + parameters.map(\.description).joined(separator: ", ") + ") -> " + returnType.description case .optional(let type): return type.descriptionWithParens + "?" case .implicitUnwrappedOptional(let type): return type.descriptionWithParens + "!" case .nullabilityUnspecified(let type): return type.descriptionWithParens + "!" case let .protocolComposition(types): return types.map(\.description).joined(separator: " & ") case let .metatype(innerType): return innerType.descriptionWithParens + ".Type" case .tuple(.empty): return "Void" case let .tuple(.types(inner)): return "(" + inner.map(\.description).joined(separator: ", ") + ")" case .nested(let items): return items.map(\.description).joined(separator: ".") case .array(let type): return "[\(type)]" case let .dictionary(key, value): return "[\(key): \(value)]" } } private var descriptionWithParens: String { if requiresSurroundingParens { return "(\(self))" } return self.description } } // MARK: - Codable conformance extension SwiftType: Codable { public init(from decoder: Decoder) throws { let string: String if decoder.codingPath.isEmpty { let container = try decoder.container(keyedBy: CodingKeys.self) string = try container.decode(String.self, forKey: .type) } else { let container = try decoder.singleValueContainer() string = try container.decode(String.self) } self = try SwiftTypeParser.parse(from: string) } public func encode(to encoder: Encoder) throws { if encoder.codingPath.isEmpty { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(description, forKey: .type) } else { var container = encoder.singleValueContainer() try container.encode(description) } } private enum CodingKeys: String, CodingKey { case type } } // MARK: - Building structures public struct OneOrMore<T> { public var first: T var remaining: [T] /// Returns the number of items on this `OneOrMore` list. /// /// Due to semantics of this list type, this value is always `>= 1`. public var count: Int { remaining.count + 1 } public var last: T { remaining.last ?? first } public init(first: T, remaining: [T]) { self.first = first self.remaining = remaining } /// Creates a `OneOrMore` enum list with a given collection. /// The collection must have at least two elements. /// /// - precondition: `collection.count >= 1` public static func fromCollection<C>(_ collection: C) -> OneOrMore where C: BidirectionalCollection, C.Element == T, C.Index == Int { precondition(collection.count >= 1) return OneOrMore(first: collection[0], remaining: Array(collection.dropFirst(1))) } /// Shortcut for creating a `OneOrMore` list with a given item public static func one(_ value: T) -> OneOrMore { OneOrMore(first: value, remaining: []) } } public struct TwoOrMore<T> { public var first: T public var second: T var remaining: [T] /// Returns the number of items on this `TwoOrMore` list. /// /// Due to semantics of this list type, this value is always `>= 2`. public var count: Int { remaining.count + 2 } public var last: T { remaining.last ?? second } public init(first: T, second: T, remaining: [T]) { self.first = first self.second = second self.remaining = remaining } /// Creates a `TwoOrMore` enum list with a given collection. /// The collection must have at least two elements. /// /// - precondition: `collection.count >= 2` public static func fromCollection<C>(_ collection: C) -> TwoOrMore where C: BidirectionalCollection, C.Element == T, C.Index == Int { precondition(collection.count >= 2) return TwoOrMore(first: collection[0], second: collection[1], remaining: Array(collection.dropFirst(2))) } /// Shortcut for creating a `TwoOrMore` list with two given items public static func two(_ value1: T, _ value2: T) -> TwoOrMore { TwoOrMore(first: value1, second: value2, remaining: []) } } // MARK: Sequence protocol conformances extension OneOrMore: Sequence { public func makeIterator() -> Iterator { Iterator(current: self) } public struct Iterator: IteratorProtocol { private var current: OneOrMore private var index: Index = 0 init(current: OneOrMore) { self.current = current } public mutating func next() -> T? { defer { index += 1 } return index < current.endIndex ? current[index] : nil } } } extension TwoOrMore: Sequence { public func makeIterator() -> Iterator { Iterator(current: self) } public struct Iterator: IteratorProtocol { private var current: TwoOrMore private var index: Index = 0 init(current: TwoOrMore) { self.current = current } public mutating func next() -> T? { defer { index += 1 } return index < current.endIndex ? current[index] : nil } } } // MARK: Collection conformance extension OneOrMore: Collection { public var startIndex: Int { return 0 } public var endIndex: Int { remaining.count + 1 } public subscript(index: Int) -> T { switch index { case 0: return first case let rem: return remaining[rem - 1] } } public func index(after i: Int) -> Int { return i + 1 } } extension TwoOrMore: Collection { public var startIndex: Int { return 0 } public var endIndex: Int { return remaining.count + 2 } public subscript(index: Int) -> T { switch index { case 0: return first case 1: return second case let rem: return remaining[rem - 2] } } public func index(after i: Int) -> Int { i + 1 } } // MARK: Equatable conditional conformance extension OneOrMore: Equatable where T: Equatable { } extension OneOrMore: Hashable where T: Hashable { } extension TwoOrMore: Equatable where T: Equatable { } extension TwoOrMore: Hashable where T: Hashable { } // MARK: Array initialization extension OneOrMore: ExpressibleByArrayLiteral { /// Initializes a OneOrMore list with a given array of items. /// /// - Parameter elements: Elements to create the array out of. /// - precondition: At least one array element must be provided public init(arrayLiteral elements: T...) { self = .fromCollection(elements) } } extension TwoOrMore: ExpressibleByArrayLiteral { /// Initializes a TwoOrMore list with a given array of items. /// /// - Parameter elements: Elements to create the list out of. /// - precondition: At least two array elements must be provided. public init(arrayLiteral elements: T...) { self = .fromCollection(elements) } } // MARK: Operators public extension OneOrMore { static func + (lhs: OneOrMore, rhs: OneOrMore) -> OneOrMore { let remaining = lhs.remaining + [rhs.first] + rhs.remaining return .init(first: lhs.first, remaining: remaining) } static func + (lhs: [T], rhs: OneOrMore) -> OneOrMore { let remaining = [rhs.first] + rhs.remaining if lhs.count > 1 { return .init(first: lhs[0], remaining: [lhs[1]] + remaining) } if lhs.count == 1 { return .init(first: lhs[0], remaining: remaining) } return rhs } static func + (lhs: OneOrMore, rhs: [T]) -> OneOrMore { return .init(first: lhs.first, remaining: lhs.remaining + rhs) } } public extension TwoOrMore { static func + (lhs: TwoOrMore, rhs: TwoOrMore) -> TwoOrMore { let remaining = lhs.remaining + [rhs.first, rhs.second] + rhs.remaining return .init(first: lhs.first, second: lhs.second, remaining: remaining) } static func + (lhs: [T], rhs: TwoOrMore) -> TwoOrMore { let remaining = [rhs.first, rhs.second] + rhs.remaining if lhs.count >= 2 { return .init(first: lhs[0], second: lhs[1], remaining: remaining) } if lhs.count == 1 { return .init(first: lhs[0], second: remaining[0], remaining: Array(remaining.dropFirst())) } return rhs } static func + (lhs: TwoOrMore, rhs: [T]) -> TwoOrMore { return .init(first: lhs.first, second: lhs.second, remaining: lhs.remaining + rhs) } }
[ -1 ]
7d8a56c2e82c6ba97ee6571e460d0b1feddab2e4
ca497aa8b2057c6f42882e1fee65ec4697b0a11d
/UnstoppableWallet/UnstoppableWallet/Core/Providers/AppConfigProvider.swift
0abf289ab46486f7f3a2b76361c480629546a816
[]
no_license
adhnan-e/Crypto-wallet-ios
0cca0490987afa974d0694e7ebbe8cb5ce4ecd5c
c336abcda9b7423e79469826d5006d6fafe07c9e
refs/heads/main
2023-07-19T02:51:44.497419
2021-09-21T08:08:46
2021-09-21T08:08:46
408,520,442
0
0
null
null
null
null
UTF-8
Swift
false
false
35,227
swift
import Foundation class AppConfigProvider: IAppConfigProvider { let companyWebPageLink = "http://cornerit.io" let appWebPageLink = "http://cornerit.io" let appGitHubLink = "http://cornerit.io/" let reportEmail = "[email protected]" let telegramWalletHelpAccount = "cornenwallet" var guidesIndexUrl: URL { URL(string: (Bundle.main.object(forInfoDictionaryKey: "GuidesIndexUrl") as! String))! } var testMode: Bool { Bundle.main.object(forInfoDictionaryKey: "TestMode") as? String == "true" } var officeMode: Bool { Bundle.main.object(forInfoDictionaryKey: "OfficeMode") as? String == "true" } var sandbox: Bool { Bundle.main.object(forInfoDictionaryKey: "Sandbox") as? String == "true" } func defaultWords(count: Int) -> [String] { guard let wordsString = Bundle.main.object(forInfoDictionaryKey: "DefaultWords\(count)") as? String else { return [] } return wordsString.split(separator: " ", omittingEmptySubsequences: true).map(String.init) } var defaultEosCredentials: (String, String) { guard let account = Bundle.main.object(forInfoDictionaryKey: "DefaultEosAccount") as? String, let privateKey = Bundle.main.object(forInfoDictionaryKey: "DefaultEosPrivateKey") as? String else { return ("", "") } return (account, privateKey) } var infuraCredentials: (id: String, secret: String?) { let id = (Bundle.main.object(forInfoDictionaryKey: "InfuraProjectId") as? String) ?? "" let secret = Bundle.main.object(forInfoDictionaryKey: "InfuraProjectSecret") as? String return (id: id, secret: secret) } var btcCoreRpcUrl: String { (Bundle.main.object(forInfoDictionaryKey: "BtcCoreRpcUrl") as? String) ?? "" } var etherscanKey: String { (Bundle.main.object(forInfoDictionaryKey: "EtherscanApiKey") as? String) ?? "" } var coinMarketCapApiKey: String { (Bundle.main.object(forInfoDictionaryKey: "CoinMarketCapKey") as? String) ?? "" } var pnsUrl: String { let development = "https://pns-dev.horizontalsystems.xyz/api/v1/" let production = "https://pns.horizontalsystems.xyz/api/v1/" return sandbox ? development : production } var pnsUsername: String { (Bundle.main.object(forInfoDictionaryKey: "PnsUsername") as? String) ?? "" } var pnsPassword: String { (Bundle.main.object(forInfoDictionaryKey: "PnsPassword") as? String) ?? "" } let currencyCodes: [String] = ["USD", "EUR", "GBP", "JPY"] private static let ethereumCoin = Coin(id: "ETH", title: "Ethereum", code: "ETH", decimal: 18, type: .ethereum) var ethereumCoin: Coin { Self.ethereumCoin } var featuredCoins: [Coin] { [ defaultCoins[0], defaultCoins[1], ] } var defaultCoins: [Coin] { testMode ? testNetCoins : mainNetCoins } private let mainNetCoins = [ Coin(id: "BTC", title: "Bitcoin", code: "BTC", decimal: 8, type: .bitcoin), Coin(id: "LTC", title: "Litecoin", code: "LTC", decimal: 8, type: .litecoin), ethereumCoin, Coin(id: "LTC", title: "Litecoin", code: "LTC", decimal: 8, type: .litecoin), Coin(id: "BCH", title: "Bitcoin Cash", code: "BCH", decimal: 8, type: .bitcoinCash), Coin(id: "DASH", title: "Dash", code: "DASH", decimal: 8, type: .dash), Coin(id: "USDT", title: "Tether USD", code: "USDT", decimal: 6, type: CoinType(erc20Address: "0xdAC17F958D2ee523a2206206994597C13D831ec7")), Coin(id: "BNB", title: "Binance Chain", code: "BNB", decimal: 8, type: .binance(symbol: "BNB")), Coin(id: "XRP", title: "Ripple", code: "XRP", decimal: 8, type: .binance(symbol: "XRP-BF2")), Coin(id: "EOS", title: "EOS", code: "EOS", decimal: 4, type: .eos(token: "eosio.token", symbol: "EOS")), Coin(id: "ZRX", title: "0x Protocol", code: "ZRX", decimal: 18, type: CoinType(erc20Address: "0xE41d2489571d322189246DaFA5ebDe1F4699F498")), Coin(id: "KNC", title: "Kyber Network Crystal", code: "KNC", decimal: 18, type: CoinType(erc20Address: "0xdd974D5C2e2928deA5F71b9825b8b646686BD200")), Coin(id: "SNT", title: "Status", code: "SNT", decimal: 18, type: CoinType(erc20Address: "0x744d70FDBE2Ba4CF95131626614a1763DF805B9E")), Coin(id: "REN", title: "Ren", code: "REN", decimal: 18, type: CoinType(erc20Address: "0x408e41876cccdc0f92210600ef50372656052a38")), Coin(id: "TKN", title: "Monolith", code: "TKN", decimal: 8, type: CoinType(erc20Address: "0xaaaf91d9b90df800df4f55c205fd6989c977e73a")), Coin(id: "NUT", title: "Native Utility Token", code: "NUT", decimal: 9, type: .eos(token: "eosdtnutoken", symbol: "NUT")), Coin(id: "NDX", title: "Newdex", code: "NDX", decimal: 4, type: .eos(token: "newdexissuer", symbol: "NDX")), Coin(id: "NEXO", title: "Nexo", code: "NEXO", decimal: 18, type: CoinType(erc20Address: "0xB62132e35a6c13ee1EE0f84dC5d40bad8d815206")), Coin(id: "NMR", title: "Numeraire", code: "NMR", decimal: 18, type: CoinType(erc20Address: "0x1776e1f26f98b1a5df9cd347953a26dd3cb46671")), Coin(id: "OCEAN", title: "Ocean Token", code: "OCEAN", decimal: 18, type: CoinType(erc20Address: "0x967da4048cD07aB37855c090aAF366e4ce1b9F48")), Coin(id: "LINK", title: "Chainlink", code: "LINK", decimal: 18, type: CoinType(erc20Address: "0x514910771AF9Ca656af840dff83E8264EcF986CA")), //Coin(id: "DASH", title: "Dash", code: "DASH", decimal: 8, type: .dash), /*Coin(id: "BTC", title: "Bitcoin", code: "BTC", decimal: 8, type: .bitcoin), Coin(id: "LTC", title: "Litecoin", code: "LTC", decimal: 8, type: .litecoin), ethereumCoin, Coin(id: "BCH", title: "Bitcoin Cash", code: "BCH", decimal: 8, type: .bitcoinCash), Coin(id: "DASH", title: "Dash", code: "DASH", decimal: 8, type: .dash), Coin(id: "BNB", title: "Binance Chain", code: "BNB", decimal: 8, type: .binance(symbol: "BNB")), Coin(id: "EOS", title: "EOS", code: "EOS", decimal: 4, type: .eos(token: "eosio.token", symbol: "EOS")), Coin(id: "ZRX", title: "0x Protocol", code: "ZRX", decimal: 18, type: CoinType(erc20Address: "0xE41d2489571d322189246DaFA5ebDe1F4699F498")), Coin(id: "LEND", title: "Aave", code: "LEND", decimal: 18, type: CoinType(erc20Address: "0x80fB784B7eD66730e8b1DBd9820aFD29931aab03")), Coin(id: "AAVE", title: "Aave Token", code: "AAVE", decimal: 18, type: CoinType(erc20Address: "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9")), Coin(id: "AAVEDAI", title: "Aave DAI", code: "ADAI", decimal: 18, type: CoinType(erc20Address: "0xfC1E690f61EFd961294b3e1Ce3313fBD8aa4f85d")), Coin(id: "ELF", title: "Aelf", code: "ELF", decimal: 18, type: CoinType(erc20Address: "0xbf2179859fc6D5BEE9Bf9158632Dc51678a4100e")), Coin(id: "AST", title: "AirSwap", code: "AST", decimal: 4, type: CoinType(erc20Address: "0x27054b13b1b798b345b591a4d22e6562d47ea75a")), Coin(id: "AKRO", title: "Akropolis", code: "AKRO", decimal: 18, type: CoinType(erc20Address: "0x8ab7404063ec4dbcfd4598215992dc3f8ec853d7")), Coin(id: "AMON", title: "Amon", code: "AMN", decimal: 18, type: CoinType(erc20Address: "0x737f98ac8ca59f2c68ad658e3c3d8c8963e40a4c")), Coin(id: "AMPL", title: "Ampleforth", code: "AMPL", decimal: 9, type: CoinType(erc20Address: "0xd46ba6d942050d489dbd938a2c909a5d5039a161")), Coin(id: "ANKR", title: "Ankr Network", code: "ANKR", decimal: 8, type: .binance(symbol: "ANKR-E97")), Coin(id: "ANT", title: "Aragon", code: "ANT", decimal: 18, type: CoinType(erc20Address: "0x960b236A07cf122663c4303350609A66A7B288C0")), Coin(id: "ANJ", title: "Aragon Network Juror", code: "ANJ", decimal: 18, type: CoinType(erc20Address: "0xcD62b1C403fa761BAadFC74C525ce2B51780b184")), Coin(id: "REP", title: "Augur", code: "REP", decimal: 18, type: CoinType(erc20Address: "0x1985365e9f78359a9B6AD760e32412f4a445E862")), Coin(id: "BAL", title: "Balancer", code: "BAL", decimal: 18, type: CoinType(erc20Address: "0xba100000625a3754423978a60c9317c58a424e3D")), Coin(id: "BNT", title: "Bancor", code: "BNT", decimal: 18, type: CoinType(erc20Address: "0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C")), Coin(id: "BAND", title: "BandToken", code: "BAND", decimal: 18, type: CoinType(erc20Address: "0xba11d00c5f74255f56a5e366f4f77f5a186d7f55")), Coin(id: "BAT", title: "Basic Attention Token", code: "BAT", decimal: 18, type: CoinType(erc20Address: "0x0D8775F648430679A709E98d2b0Cb6250d2887EF")), Coin(id: "TRYB", title: "BiLira", code: "TRYB", decimal: 6, type: CoinType(erc20Address: "0x2c537e5624e4af88a7ae4060c022609376c8d0eb")), Coin(id: "BNB-ERC20", title: "Binance ERC20", code: "BNB", decimal: 18, type: CoinType(erc20Address: "0xB8c77482e45F1F44dE1745F52C74426C631bDD52")), Coin(id: "BUSD", title: "Binance USD", code: "BUSD", decimal: 8, type: .binance(symbol: "BUSD-BD1")), Coin(id: "BTCB", title: "Bitcoin BEP2", code: "BTCB", decimal: 8, type: .binance(symbol: "BTCB-1DE")), Coin(id: "BLT", title: "Bloom", code: "BLT", decimal: 18, type: CoinType(erc20Address: "0x107c4504cd79c5d2696ea0030a8dd4e92601b82e")), Coin(id: "BZRX", title: "bZx Protocol Token", code: "BZRX", decimal: 18, type: CoinType(erc20Address: "0x56d811088235F11C8920698a204A5010a788f4b3")), Coin(id: "CAS", title: "Cashaa", code: "CAS", decimal: 8, type: .binance(symbol: "CAS-167")), Coin(id: "CELR", title: "CelerToken", code: "CELR", decimal: 18, type: CoinType(erc20Address: "0x4f9254c83eb525f9fcf346490bbb3ed28a81c667")), Coin(id: "CEL", title: "Celsius", code: "CEL", decimal: 4, type: CoinType(erc20Address: "0xaaaebe6fe48e54f431b0c390cfaf0b017d09d42d")), Coin(id: "LINK", title: "Chainlink", code: "LINK", decimal: 18, type: CoinType(erc20Address: "0x514910771AF9Ca656af840dff83E8264EcF986CA")), Coin(id: "CVC", title: "Civic", code: "CVC", decimal: 8, type: CoinType(erc20Address: "0x41e5560054824ea6b0732e656e3ad64e20e94e45")), Coin(id: "COMP", title: "Compound", code: "COMP", decimal: 18, type: CoinType(erc20Address: "0xc00e94cb662c3520282e6f5717214004a7f26888")), Coin(id: "CDAI", title: "Compound Dai", code: "CDAI", decimal: 8, type: CoinType(erc20Address: "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643")), Coin(id: "CSAI", title: "Compound Sai", code: "CSAI", decimal: 8, type: CoinType(erc20Address: "0xf5dce57282a584d2746faf1593d3121fcac444dc")), Coin(id: "CUSDC", title: "Compound USDC", code: "CUSDC", decimal: 8, type: CoinType(erc20Address: "0x39aa39c021dfbae8fac545936693ac917d5e7563")), Coin(id: "CRPT", title: "Crypterium", code: "CRPT", decimal: 8, type: .binance(symbol: "CRPT-8C9")), Coin(id: "CRO", title: "Crypto.com Coin", code: "CRO", decimal: 8, type: CoinType(erc20Address: "0xA0b73E1Ff0B80914AB6fe0444E65848C4C34450b")), Coin(id: "CRV", title: "Curve DAO Token", code: "CRV", decimal: 18, type: CoinType(erc20Address: "0xD533a949740bb3306d119CC777fa900bA034cd52")), Coin(id: "DAI", title: "Dai", code: "DAI", decimal: 18, type: CoinType(erc20Address: "0x6b175474e89094c44da98b954eedeac495271d0f")), Coin(id: "RING", title: "Darwinia Network Native Token", code: "RING", decimal: 18, type: CoinType(erc20Address: "0x9469d013805bffb7d3debe5e7839237e535ec483")), Coin(id: "GEN", title: "DAOstack", code: "GEN", decimal: 18, type: CoinType(erc20Address: "0x543ff227f64aa17ea132bf9886cab5db55dcaddf")), Coin(id: "DATA", title: "DATACoin", code: "DATA", decimal: 18, type: CoinType(erc20Address: "0x0cf0ee63788a0849fe5297f3407f701e122cc023")), Coin(id: "MANA", title: "Decentraland", code: "MANA", decimal: 18, type: CoinType(erc20Address: "0x0F5D2fB29fb7d3CFeE444a200298f468908cC942")), Coin(id: "DIA", title: "DIA", code: "DIA", decimal: 18, type: CoinType(erc20Address: "0x84ca8bc7997272c7cfb4d0cd3d55cd942b3c9419")), Coin(id: "DGD", title: "DigixDAO", code: "DGD", decimal: 9, type: CoinType(erc20Address: "0xE0B7927c4aF23765Cb51314A0E0521A9645F0E2A")), Coin(id: "DGX", title: "Digix Gold Token", code: "DGX", decimal: 9, type: CoinType(erc20Address: "0x4f3AfEC4E5a3F2A6a1A411DEF7D7dFe50eE057bF", minimumSpendableAmount: 0.001)), Coin(id: "DNT", title: "District0x", code: "DNT", decimal: 18, type: CoinType(erc20Address: "0x0abdace70d3790235af448c88547603b945604ea")), Coin(id: "DONUT", title: "Donut", code: "DONUT", decimal: 18, type: CoinType(erc20Address: "0xc0f9bd5fa5698b6505f643900ffa515ea5df54a9")), Coin(id: "DOS", title: "DOS Network", code: "DOS", decimal: 8, type: .binance(symbol: "DOS-120")), Coin(id: "DOS-ERC20", title: "DOS Network", code: "DOS", decimal: 18, type: CoinType(erc20Address: "0x0A913beaD80F321E7Ac35285Ee10d9d922659cB7")), Coin(id: "ENJ", title: "Enjin Coin", code: "ENJ", decimal: 18, type: CoinType(erc20Address: "0xF629cBd94d3791C9250152BD8dfBDF380E2a3B9c")), Coin(id: "EOSDT", title: "EOSDT", code: "EOSDT", decimal: 9, type: .eos(token: "eosdtsttoken", symbol: "EOSDT")), Coin(id: "DIP", title: "Etherisc", code: "DIP", decimal: 18, type: CoinType(erc20Address: "0xc719d010b63e5bbf2c0551872cd5316ed26acd83")), Coin(id: "IQ", title: "Everipedia", code: "IQ", decimal: 3, type: .eos(token: "everipediaiq", symbol: "IQ")), Coin(id: "EBASE", title: "EURBASE Stablecoin V2", code: "EBASE", decimal: 18, type: CoinType(erc20Address: "0xa689dcea8f7ad59fb213be4bc624ba5500458dc6")), Coin(id: "FXC", title: "Flexacoin", code: "FXC", decimal: 18, type: CoinType(erc20Address: "0x4a57e687b9126435a9b19e4a802113e266adebde")), Coin(id: "FOAM", title: "FOAM Token", code: "FOAM", decimal: 18, type: CoinType(erc20Address: "0x4946fcea7c692606e8908002e55a582af44ac121")), Coin(id: "FUN", title: "FunFair", code: "FUN", decimal: 8, type: CoinType(erc20Address: "0x419d0d8bdd9af5e606ae2232ed285aff190e711b")), Coin(id: "GST2", title: "Gas Token Two", code: "GST2", decimal: 2, type: CoinType(erc20Address: "0x0000000000b3f879cb30fe243b4dfee438691c04")), Coin(id: "GUSD", title: "Gemini Dollar", code: "GUSD", decimal: 2, type: CoinType(erc20Address: "0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd")), Coin(id: "GTO", title: "Gifto", code: "GTO", decimal: 8, type: .binance(symbol: "GTO-908")), Coin(id: "GNO", title: "Gnosis", code: "DATA", decimal: 18, type: CoinType(erc20Address: "0x6810e776880c02933d47db1b9fc05908e5386b96")), Coin(id: "GNT", title: "Golem", code: "GNT", decimal: 18, type: CoinType(erc20Address: "0xa74476443119A942dE498590Fe1f2454d7D4aC0d")), Coin(id: "GRID", title: "Grid", code: "GRID", decimal: 12, type: CoinType(erc20Address: "0x12b19d3e2ccc14da04fae33e63652ce469b3f2fd")), Coin(id: "XCHF", title: "GryptoFranc", code: "XCHF", decimal: 18, type: CoinType(erc20Address: "0xb4272071ecadd69d933adcd19ca99fe80664fc08")), Coin(id: "HEDG", title: "HEDG", code: "HEDG", decimal: 18, type: CoinType(erc20Address: "0xf1290473e210b2108a85237fbcd7b6eb42cc654f")), Coin(id: "HOT", title: "Holo", code: "HOT", decimal: 18, type: CoinType(erc20Address: "0x6c6EE5e31d828De241282B9606C8e98Ea48526E2")), Coin(id: "HT", title: "Huobi Token", code: "HT", decimal: 18, type: CoinType(erc20Address: "0x6f259637dcD74C767781E37Bc6133cd6A68aa161")), Coin(id: "HUSD", title: "HUSD", code: "HUSD", decimal: 8, type: CoinType(erc20Address: "0xdf574c24545e5ffecb9a659c229253d4111d87e1")), Coin(id: "IDXM", title: "IDEX Membership", code: "IDXM", decimal: 8, type: CoinType(erc20Address: "0xCc13Fc627EFfd6E35D2D2706Ea3C4D7396c610ea")), Coin(id: "IDEX", title: "IDEX", code: "IDEX", decimal: 18, type: CoinType(erc20Address: "0xB705268213D593B8FD88d3FDEFF93AFF5CbDcfAE")), Coin(id: "IOTX", title: "IoTeX", code: "IOTX", decimal: 18, type: CoinType(erc20Address: "0x6fb3e0a217407efff7ca062d46c26e5d60a14d69")), Coin(id: "KCS", title: "KuCoin Shares", code: "KCS", decimal: 6, type: CoinType(erc20Address: "0x039B5649A59967e3e936D7471f9c3700100Ee1ab", minimumRequiredBalance: 0.001)), Coin(id: "KNC", title: "Kyber Network Crystal", code: "KNC", decimal: 18, type: CoinType(erc20Address: "0xdd974D5C2e2928deA5F71b9825b8b646686BD200")), Coin(id: "LPT", title: "Livepeer Token", code: "LPT", decimal: 18, type: CoinType(erc20Address: "0x58b6a8a3302369daec383334672404ee733ab239")), Coin(id: "LQD", title: "Liquidity Network", code: "LQD", decimal: 18, type: CoinType(erc20Address: "0xd29f0b5b3f50b07fe9a9511f7d86f4f4bac3f8c4")), Coin(id: "LOOM", title: "Loom Network", code: "LOOM", decimal: 18, type: CoinType(erc20Address: "0xA4e8C3Ec456107eA67d3075bF9e3DF3A75823DB0")), Coin(id: "LRC", title: "Loopring", code: "LRC", decimal: 18, type: CoinType(erc20Address: "0xEF68e7C694F40c8202821eDF525dE3782458639f")), Coin(id: "MCX", title: "MachiX Token", code: "MCX", decimal: 18, type: CoinType(erc20Address: "0xd15ecdcf5ea68e3995b2d0527a0ae0a3258302f8")), Coin(id: "MBC", title: "Marblecoin", code: "MBC", decimal: 18, type: CoinType(erc20Address: "0x8888889213dd4da823ebdd1e235b09590633c150")), Coin(id: "MATIC", title: "Matic Token", code: "MATIC", decimal: 18, type: CoinType(erc20Address: "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0")), Coin(id: "MKR", title: "Maker", code: "MKR", decimal: 18, type: CoinType(erc20Address: "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2")), Coin(id: "MLN", title: "Melon Token", code: "MLN", decimal: 18, type: CoinType(erc20Address: "0xec67005c4e498ec7f55e092bd1d35cbc47c91892")), Coin(id: "MET", title: "Metronome", code: "MET", decimal: 18, type: CoinType(erc20Address: "0xa3d58c4e56fedcae3a7c43a725aee9a71f0ece4e")), Coin(id: "MCO", title: "MCO", code: "MCO", decimal: 8, type: CoinType(erc20Address: "0xB63B606Ac810a52cCa15e44bB630fd42D8d1d83d")), Coin(id: "MEETONE", title: "MEET.ONE", code: "MEETONE", decimal: 4, type: .eos(token: "eosiomeetone", symbol: "MEETONE")), Coin(id: "MTA", title: "Meta", code: "MTA", decimal: 18, type: CoinType(erc20Address: "0xa3BeD4E1c75D00fa6f4E5E6922DB7261B5E9AcD2")), Coin(id: "MITH", title: "Mithril", code: "MITH", decimal: 18, type: CoinType(erc20Address: "0x3893b9422Cd5D70a81eDeFfe3d5A1c6A978310BB")), Coin(id: "MOD", title: "Modum Token", code: "MOD", decimal: 0, type: CoinType(erc20Address: "0x957c30ab0426e0c93cd8241e2c60392d08c6ac8e")), Coin(id: "MUSD", title: "mStable USD", code: "MUSD", decimal: 18, type: CoinType(erc20Address: "0xe2f2a5c287993345a840db3b0845fbc70f5935a5")), Coin(id: "TKN", title: "Monolith", code: "TKN", decimal: 8, type: CoinType(erc20Address: "0xaaaf91d9b90df800df4f55c205fd6989c977e73a")), Coin(id: "NUT", title: "Native Utility Token", code: "NUT", decimal: 9, type: .eos(token: "eosdtnutoken", symbol: "NUT")), Coin(id: "NDX", title: "Newdex", code: "NDX", decimal: 4, type: .eos(token: "newdexissuer", symbol: "NDX")), Coin(id: "NEXO", title: "Nexo", code: "NEXO", decimal: 18, type: CoinType(erc20Address: "0xB62132e35a6c13ee1EE0f84dC5d40bad8d815206")), Coin(id: "NMR", title: "Numeraire", code: "NMR", decimal: 18, type: CoinType(erc20Address: "0x1776e1f26f98b1a5df9cd347953a26dd3cb46671")), Coin(id: "OCEAN", title: "Ocean Token", code: "OCEAN", decimal: 18, type: CoinType(erc20Address: "0x967da4048cD07aB37855c090aAF366e4ce1b9F48")), Coin(id: "OMG", title: "OmiseGO", code: "OMG", decimal: 18, type: CoinType(erc20Address: "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07")), Coin(id: "ORBS", title: "Orbs", code: "ORBS", decimal: 18, type: CoinType(erc20Address: "0xff56Cc6b1E6dEd347aA0B7676C85AB0B3D08B0FA")), Coin(id: "OXT", title: "Orchid", code: "OXT", decimal: 18, type: CoinType(erc20Address: "0x4575f41308EC1483f3d399aa9a2826d74Da13Deb")), Coin(id: "PAR", title: "Parachute", code: "PAR", decimal: 18, type: CoinType(erc20Address: "0x1beef31946fbbb40b877a72e4ae04a8d1a5cee06")), Coin(id: "PAX", title: "Paxos Standard", code: "PAX", decimal: 18, type: CoinType(erc20Address: "0x8E870D67F660D95d5be530380D0eC0bd388289E1")), Coin(id: "PAXG", title: "PAX Gold", code: "PAXG", decimal: 18, type: CoinType(erc20Address: "0x45804880De22913dAFE09f4980848ECE6EcbAf78")), Coin(id: "PTI", title: "Paytomat", code: "PTI", decimal: 4, type: .eos(token: "ptitokenhome", symbol: "PTI")), Coin(id: "PNK", title: "Pinakion", code: "PNK", decimal: 18, type: CoinType(erc20Address: "0x93ed3fbe21207ec2e8f2d3c3de6e058cb73bc04d")), Coin(id: "POA20", title: "POA ERC20 on Foundation", code: "POA", decimal: 18, type: CoinType(erc20Address: "0x6758b7d441a9739b98552b373703d8d3d14f9e62")), Coin(id: "POLY", title: "Polymath", code: "POLY", decimal: 18, type: CoinType(erc20Address: "0x9992eC3cF6A55b00978cdDF2b27BC6882d88D1eC")), Coin(id: "PPT", title: "Populous", code: "PPT", decimal: 8, type: CoinType(erc20Address: "0xd4fa1460F537bb9085d22C7bcCB5DD450Ef28e3a")), Coin(id: "PGL", title: "Prospectors Gold", code: "PGL", decimal: 4, type: .eos(token: "prospectorsg", symbol: "PGL")), Coin(id: "NPXS", title: "Pundi X", code: "NPXS", decimal: 18, type: CoinType(erc20Address: "0xA15C7Ebe1f07CaF6bFF097D8a589fb8AC49Ae5B3")), Coin(id: "QCH", title: "QChi", code: "QCH", decimal: 18, type: CoinType(erc20Address: "0x687bfc3e73f6af55f0ccca8450114d107e781a0e")), Coin(id: "QNT", title: "Quant", code: "QNT", decimal: 18, type: CoinType(erc20Address: "0x4a220e6096b25eadb88358cb44068a3248254675")), Coin(id: "QSP", title: "Quantstamp", code: "QSP", decimal: 18, type: CoinType(erc20Address: "0x99ea4db9ee77acd40b119bd1dc4e33e1c070b80d")), Coin(id: "RDN", title: "Raiden", code: "RDN", decimal: 18, type: CoinType(erc20Address: "0x255aa6df07540cb5d3d297f0d0d4d84cb52bc8e6")), Coin(id: "REN", title: "Ren", code: "REN", decimal: 18, type: CoinType(erc20Address: "0x408e41876cccdc0f92210600ef50372656052a38")), Coin(id: "RENBTC", title: "renBTC", code: "renBTC", decimal: 8, type: CoinType(erc20Address: "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d")), Coin(id: "RENBCH", title: "renBCH", code: "renBCH", decimal: 8, type: CoinType(erc20Address: "0x459086f2376525bdceba5bdda135e4e9d3fef5bf")), Coin(id: "RENZEC", title: "renZEC", code: "renZEC", decimal: 8, type: CoinType(erc20Address: "0x1c5db575e2ff833e46a2e9864c22f4b22e0b37c2")), Coin(id: "RARI", title: "Rarible", code: "RARI", decimal: 18, type: CoinType(erc20Address: "0xfca59cd816ab1ead66534d82bc21e7515ce441cf")), Coin(id: "REPv2", title: "Reputation", code: "REPv2", decimal: 8, type: CoinType(erc20Address: "0x221657776846890989a759ba2973e427dff5c9bb")), Coin(id: "R", title: "Revain", code: "R", decimal: 0, type: CoinType(erc20Address: "0x48f775EFBE4F5EcE6e0DF2f7b5932dF56823B990")), Coin(id: "RCN", title: "RipioCreditNetwork", code: "RCN", decimal: 18, type: CoinType(erc20Address: "0xf970b8e36e23f7fc3fd752eea86f8be8d83375a6")), Coin(id: "XRP", title: "Ripple", code: "XRP", decimal: 8, type: .binance(symbol: "XRP-BF2")), Coin(id: "RLC", title: "RLC", code: "RLC", decimal: 9, type: CoinType(erc20Address: "0x607F4C5BB672230e8672085532f7e901544a7375")), Coin(id: "RPL", title: "Rocket Pool", code: "RPL", decimal: 18, type: CoinType(erc20Address: "0xb4efd85c19999d84251304bda99e90b92300bd93")), Coin(id: "SAI", title: "Sai", code: "SAI", decimal: 18, type: CoinType(erc20Address: "0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359")), Coin(id: "SALT", title: "Salt", code: "SALT", decimal: 8, type: CoinType(erc20Address: "0x4156D3342D5c385a87D264F90653733592000581")), Coin(id: "SAN", title: "SAN", code: "SAN", decimal: 18, type: CoinType(erc20Address: "0x7c5a0ce9267ed19b22f8cae653f198e3e8daf098")), Coin(id: "KEY", title: "SelfKey", code: "KEY", decimal: 18, type: CoinType(erc20Address: "0x4cc19356f2d37338b9802aa8e8fc58b0373296e7")), Coin(id: "SRM", title: "Serum", code: "SRM", decimal: 6, type: CoinType(erc20Address: "0x476c5E26a75bd202a9683ffD34359C0CC15be0fF")), Coin(id: "SHUF", title: "Shuffle.Monster V3", code: "SHUF", decimal: 18, type: CoinType(erc20Address: "0x3a9fff453d50d4ac52a6890647b823379ba36b9e")), Coin(id: "SNX", title: "Synthetix", code: "SNX", decimal: 18, type: CoinType(erc20Address: "0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F")), Coin(id: "SPANK", title: "SPANK", code: "SPANK", decimal: 18, type: CoinType(erc20Address: "0x42d6622dece394b54999fbd73d108123806f6a18")), Coin(id: "USDS", title: "StableUSD", code: "USDS", decimal: 6, type: CoinType(erc20Address: "0xa4bdb11dc0a2bec88d24a3aa1e6bb17201112ebe")), Coin(id: "STAKE", title: "STAKE", code: "STAKE", decimal: 18, type: CoinType(erc20Address: "0x0Ae055097C6d159879521C384F1D2123D1f195e6")), Coin(id: "EURS", title: "STASIS EURO", code: "EURS", decimal: 2, type: CoinType(erc20Address: "0xdB25f211AB05b1c97D595516F45794528a807ad8")), Coin(id: "SNT", title: "Status", code: "SNT", decimal: 18, type: CoinType(erc20Address: "0x744d70FDBE2Ba4CF95131626614a1763DF805B9E")), Coin(id: "STORJ", title: "Storj", code: "STORJ", decimal: 8, type: CoinType(erc20Address: "0xb64ef51c888972c908cfacf59b47c1afbc0ab8ac")), Coin(id: "SXP", title: "Swipe", code: "SXP", decimal: 18, type: CoinType(erc20Address: "0x8ce9137d39326ad0cd6491fb5cc0cba0e089b6a9")), Coin(id: "CHSB", title: "SwissBorg", code: "CHSB", decimal: 8, type: CoinType(erc20Address: "0xba9d4199fab4f26efe3551d490e3821486f135ba")), Coin(id: "TRB", title: "Tellor Tributes", code: "TRB", decimal: 18, type: CoinType(erc20Address: "0x0ba45a8b5d5575935b8158a88c631e9f9c95a2e5")), Coin(id: "USDT", title: "Tether USD", code: "USDT", decimal: 6, type: CoinType(erc20Address: "0xdAC17F958D2ee523a2206206994597C13D831ec7")), Coin(id: "TAUD", title: "TrueAUD", code: "TAUD", decimal: 18, type: CoinType(erc20Address: "0x00006100F7090010005F1bd7aE6122c3C2CF0090")), Coin(id: "TCAD", title: "TrueCAD", code: "TCAD", decimal: 18, type: CoinType(erc20Address: "0x00000100F2A2bd000715001920eB70D229700085")), Coin(id: "TGBP", title: "TrueGBP", code: "TGBP", decimal: 18, type: CoinType(erc20Address: "0x00000000441378008ea67f4284a57932b1c000a5")), Coin(id: "THKD", title: "TrueHKD", code: "THKD", decimal: 18, type: CoinType(erc20Address: "0x0000852600ceb001e08e00bc008be620d60031f2")), Coin(id: "TUSD", title: "TrueUSD", code: "TUSD", decimal: 18, type: CoinType(erc20Address: "0x0000000000085d4780B73119b644AE5ecd22b376")), Coin(id: "TRST", title: "Trustcoin", code: "TRST", decimal: 6, type: CoinType(erc20Address: "0xcb94be6f13a1182e4a4b6140cb7bf2025d28e41b")), Coin(id: "SWAP", title: "TrustSwap", code: "SWAP", decimal: 18, type: CoinType(erc20Address: "0xCC4304A31d09258b0029eA7FE63d032f52e44EFe")), Coin(id: "UBT", title: "UniBright", code: "UBT", decimal: 6, type: CoinType(erc20Address: "0x8400d94a5cb0fa0d041a3788e395285d61c9ee5e")), Coin(id: "SOCKS", title: "Unisocks Edition 0", code: "SOCKS", decimal: 18, type: CoinType(erc20Address: "0x23b608675a2b2fb1890d3abbd85c5775c51691d5")), Coin(id: "UMA", title: "UMA Voting Token v1", code: "UMA", decimal: 18, type: CoinType(erc20Address: "0x04Fa0d235C4abf4BcF4787aF4CF447DE572eF828")), Coin(id: "UNI", title: "Uniswap", code: "UNI", decimal: 18, type: CoinType(erc20Address: "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984")), Coin(id: "USDC", title: "USD Coin", code: "USDC", decimal: 6, type: CoinType(erc20Address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48")), Coin(id: "VERI", title: "Veritaseum", code: "VERI", decimal: 18, type: CoinType(erc20Address: "0x8f3470A7388c05eE4e7AF3d01D8C722b0FF52374")), Coin(id: "WTC", title: "Waltonchain", code: "WTC", decimal: 18, type: CoinType(erc20Address: "0xb7cB1C96dB6B22b0D3d9536E0108d062BD488F74")), Coin(id: "WBTC", title: "Wrapped Bitcoin", code: "WBTC", decimal: 8, type: CoinType(erc20Address: "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599")), Coin(id: "WETH", title: "Wrapped Ethereum", code: "WETH", decimal: 18, type: CoinType(erc20Address: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2")), Coin(id: "XIO", title: "XIO Network", code: "XIO", decimal: 18, type: CoinType(erc20Address: "0x0f7F961648aE6Db43C75663aC7E5414Eb79b5704")),*/ ] private let testNetCoins = [ Coin(id: "BTC", title: "Bitcoin", code: "BTC", decimal: 8, type: .bitcoin), Coin(id: "LTC", title: "Litecoin", code: "LTC", decimal: 8, type: .litecoin), ethereumCoin, Coin(id: "BCH", title: "Bitcoin Cash", code: "BCH", decimal: 8, type: .bitcoinCash), Coin(id: "DASH", title: "Dash", code: "DASH", decimal: 8, type: .dash), Coin(id: "BNB", title: "Binance Chain", code: "BNB", decimal: 8, type: .binance(symbol: "BNB")), Coin(id: "EOS", title: "EOS", code: "EOS", decimal: 4, type: .eos(token: "eosio.token", symbol: "EOS")), Coin(id: "DAI", title: "Dai", code: "DAI", decimal: 18, type: CoinType(erc20Address: "0xad6d458402f60fd3bd25163575031acdce07538d")), Coin(id: "WEENUS", title: "WEENUS", code: "WEENUS", decimal: 18, type: CoinType(erc20Address: "0x101848D5C5bBca18E6b4431eEdF6B95E9ADF82FA")), ] }
[ -1 ]
7bc1414ca7fc1851286e1149b04a2d92943377c2
9ad0526e49b052bd9fe7da32a393610d031b4c8c
/Autolayout/Autolayout/User.swift
260ba40230b645bdf53e426d2c5356781638a057
[]
no_license
chaitanchun/StanfordiOS
a1884d14ad411ca6a2180aba38520655de8ebe2b
19088880630d2d3e3452eda62569cb226953b10e
refs/heads/master
2016-09-06T06:09:34.709124
2015-04-22T11:29:40
2015-04-22T11:29:40
33,196,131
0
0
null
null
null
null
UTF-8
Swift
false
false
1,159
swift
// // User.swift // Autolayout // // Created by Tristan Chai on 10/4/15. // Copyright (c) 2015 Tanchun Chai. All rights reserved. // import Foundation struct User { let name: String let company: String let login: String let password: String static func login(login: String, password: String) -> User? { if let user = database[login] { if user.password == password { return user } } return nil } static let database: Dictionary<String, User> = { var theDatabase = Dictionary<String, User>() for user in [ User(name: "John Appleseed", company: "Apple", login: "japple", password: "foo"), User(name: "Madison Bumgarner", company: "World Champion San Francisco Giants", login: "madbum", password: "foo"), User(name: "John Hennessy", company: "Stanford", login: "hennessy", password: "foo"), User(name: "Bad Guy", company: "Criminals, Inc.", login: "baddie", password: "foo"), ] { theDatabase[user.login] = user } return theDatabase }() }
[ 279396, 419366 ]
240b7a7820db3bc2c20fbbf014ee0f5e599d8350
90274d5074201d782754971bb905c22818505bd8
/UMPY/VC/SignInVC.swift
7859958d40890b4f12fc8d5be9ad619405161dfc
[]
no_license
talentdeveloper511/umpy
c2beb7b8a7b56c6a7d14343a5c6842765648ce9c
91b3709fa7ced8750e91e318186a1dc4cab2935d
refs/heads/main
2023-05-17T01:48:26.422960
2021-06-02T01:52:48
2021-06-02T01:52:48
372,970,450
0
0
null
null
null
null
UTF-8
Swift
false
false
6,179
swift
// // SignInVC.swift // UMPY // // Created by CBDev on 3/11/19. // Copyright © 2019 CBDev. All rights reserved. // import UIKit import SVProgressHUD import Toast_Swift class SignInVC: UIViewController { @IBOutlet weak var usernameText: UITextField! @IBOutlet weak var passwordText: UITextField! @IBOutlet weak var signInBtn: UIButton! @IBOutlet weak var signInFBBtn: UIButton! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. signInBtn.layer.cornerRadius = 4 signInFBBtn.layer.cornerRadius = 4 self.view.createGradientLayer() } @IBAction func signIn(_ sender: Any) { } @IBAction func logIn(_ sender: Any) { if(getValidate()){ SVProgressHUD.show() ApiManager.sharedInstance().login(email: usernameText.text!, password: passwordText.text!, completion: {(userModel, strErr) in if let strErr = strErr{ SVProgressHUD.showError(withStatus: strErr) }else{ SVProgressHUD.dismiss() if let userModel = userModel{ if(userModel.status!){ UserDefaults.standard.set(true, forKey: "IS_LOGIN") UserDefaults.standard.set(userModel.id, forKey: "user_id") UserDefaults.standard.set(userModel.firstName, forKey: "first_name") UserDefaults.standard.set(userModel.secName, forKey: "sec_name") UserDefaults.standard.set(userModel.email, forKey: "email") UserDefaults.standard.set(userModel.country, forKey: "country") UserDefaults.standard.set(userModel.home_city, forKey: "home_city") UserDefaults.standard.set(userModel.phoneNum, forKey: "phone") UserDefaults.standard.set(userModel.user_type, forKey: "user_type") self.getSetting() }else{ let alert = UIAlertController(title: "Umpity", message: "Login Failed, Please input correct info.", preferredStyle: .alert) alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) self.present(alert, animated: true) } } } }) }else{ let alert = UIAlertController(title: "Sign In Failed", message: "Please fill Out your forms.", preferredStyle: .alert) alert.addAction(UIAlertAction(title: "OK", style: .default)) self.present(alert, animated: true, completion: nil) } } func getSetting(){ let video_resolution = UserDefaults.standard.string(forKey: "video_resolution") if(video_resolution != nil && video_resolution != ""){ self.goToMain() }else{ SVProgressHUD.show() let userID = UserDefaults.standard.string(forKey: "user_id") ApiManager.sharedInstance().getSetting(userID: userID!, completion: {(settingModel, strErr) in if let strErr = strErr{ SVProgressHUD.showError(withStatus: strErr) }else{ SVProgressHUD.dismiss() if let settingInfo = settingModel{ if(settingInfo.status!){ UserDefaults.standard.set(settingInfo.videoResolution, forKey: "video_resolution") UserDefaults.standard.set(settingInfo.videoDuration, forKey: "video_duration") UserDefaults.standard.set(settingInfo.enableAudio, forKey: "enable_audio") UserDefaults.standard.set(settingInfo.videoPermission, forKey: "video_permission") self.goToMain() }else{ self.view.makeToast("Can't get setting information") } } } }) } } @IBAction func signInWithFB(_ sender: Any) { goToMain() } func goToMain(){ let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil) let newViewController = storyBoard.instantiateViewController(withIdentifier: "MainVC") as! MainVC self.present(newViewController, animated: true, completion: nil) } func getValidate() -> Bool{ if(!isValidEmail(testStr: usernameText.text ?? "")){ return false } if(passwordText.text == nil || passwordText.text == ""){ return false } return true } func isValidEmail(testStr:String) -> Bool { let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}" let emailTest = NSPredicate(format:"SELF MATCHES %@", emailRegEx) return emailTest.evaluate(with: testStr) } @IBAction func goToPrivacy(_ sender: Any) { let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil) let newViewController = storyBoard.instantiateViewController(withIdentifier: "WebVC") as! WebVC newViewController.type = 2 self.present(newViewController, animated: true, completion: nil) } @IBAction func goToTerms(_ sender: Any) { let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil) let newViewController = storyBoard.instantiateViewController(withIdentifier: "WebVC") as! WebVC newViewController.type = 1 self.present(newViewController, animated: true, completion: nil) } }
[ -1 ]
cccbd878ae9e7dab586387fa4e778cf2f4333c1d
6d91155eab45f687ab9496a56d7d1ca51a2fc751
/ValidationSwiftUI/ValidationSwiftUI/Extensions/Validation+Extensions.swift
78fbe48b2ba6a3390965a0fa273cc429981d7dee
[]
no_license
eertaah/AzamSharp-Weekly
7f4d9bce8826c962db4dbc4796ea2b2bb4493a12
c212e0add35acf8fbc7e974b4347b108d8070603
refs/heads/master
2022-08-02T07:11:04.192174
2020-05-23T16:09:57
2020-05-23T16:09:57
null
0
0
null
null
null
null
UTF-8
Swift
false
false
482
swift
// // Validation+Extensions.swift // ValidationSwiftUI // // Created by Mohammad Azam on 3/16/20. // Copyright © 2020 Mohammad Azam. All rights reserved. // import Foundation import ValidatedPropertyKit extension Validation where Value == String { static func required(errorMessage: String = "Is Empty") -> Validation { return .init { value in value.isEmpty ? .failure(.init(message: errorMessage)) : .success(()) } } }
[ -1 ]
e2ff4c0960fa82bb1c077c00add5cebe1d87e216
3d144a23e67c839a4df1c073c6a2c842508f16b2
/validation-test/Runtime/ConcurrentMetadata.swift
ad52270b4befa4411b2f0f8af3a3d4c5c0f602b6
[ "Apache-2.0", "Swift-exception" ]
permissive
apple/swift
c2724e388959f6623cf6e4ad6dc1cdd875fd0592
98ada1b200a43d090311b72eb45fe8ecebc97f81
refs/heads/main
2023-08-16T10:48:25.985330
2023-08-16T09:00:42
2023-08-16T09:00:42
44,838,949
78,897
15,074
Apache-2.0
2023-09-14T21:19:23
2015-10-23T21:15:07
C++
UTF-8
Swift
false
false
1,381
swift
// RUN: %target-run-simple-swift // REQUIRES: executable_test // UNSUPPORTED: single_threaded_runtime // UNSUPPORTED: threading_none // Exercise the metadata cache from multiple threads to shake out any // concurrency bugs. import StdlibUnittest import SwiftPrivateThreadExtras struct One {} struct Two {} struct Cat<T, U> {} protocol Growable {} extension Growable { func grow() -> (Growable, Growable) { return (Cat<Self, One>(), Cat<Self, Two>()) } } extension One: Growable {} extension Two: Growable {} extension Cat: Growable {} var ConcurrentMetadataTestSuite = TestSuite("ConcurrentMetadata") ConcurrentMetadataTestSuite.test("ConcurrentMetadata") { let threadCount = 16 let iterationCount = 10000 func threadFunc() { var array: [Growable] = [One(), Two()] for i in 0..<iterationCount { // Each call to grow() creates a new generic metadata specialization which // will race with creating that same metadata on the other threads. let (a, b) = array[i].grow() array.append(a) array.append(b) } } let threadIDs = (0..<16).map { _ -> ThreadHandle in let (ret, threadID) = _stdlib_thread_create_block(threadFunc, ()) expectEqual(0, ret) return threadID! } for threadID in threadIDs { let (ret, _) = _stdlib_thread_join(threadID, Void.self) expectEqual(0, ret) } } runAllTests()
[ 88939 ]
50fe183cb6ffbc053d2a29af1fc0af49e0dfd877
a2ada0462d59632a396f9046c6c1403b921ddc06
/Notes/AppDelegate.swift
3ea5b275609e77eae61936ac1460052cf0b9da97
[]
no_license
redsubmarine/Notes
bc0cde5824cb87d8177fc7f8c942ce52bf4ce63d
0bfff62af9cfc66a04db27a485d4942c35886468
refs/heads/master
2021-09-02T00:05:59.368051
2017-12-26T11:35:33
2017-12-26T11:35:33
115,405,436
0
0
null
null
null
null
UTF-8
Swift
false
false
2,168
swift
// // AppDelegate.swift // Notes // // Created by 양원석 on 2017. 12. 26.. // Copyright © 2017년 red. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(_ application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. } func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } }
[ 229380, 229383, 229385, 278539, 294924, 229388, 278542, 229391, 327695, 229394, 278548, 229397, 229399, 229402, 352284, 229405, 278556, 278559, 229408, 278564, 294950, 229415, 229417, 327722, 237613, 229422, 229426, 237618, 229428, 286774, 286776, 319544, 286778, 204856, 229432, 352318, 286791, 237640, 286797, 278605, 311375, 163920, 237646, 196692, 319573, 311383, 278623, 278626, 319590, 311400, 278635, 303212, 278639, 131192, 278648, 237693, 303230, 327814, 303241, 131209, 417930, 303244, 311436, 319633, 286873, 286876, 311460, 311469, 32944, 327862, 286906, 327866, 180413, 286910, 286916, 295110, 286922, 286924, 286926, 319694, 286928, 131281, 278743, 278747, 295133, 155872, 319716, 237807, 303345, 286962, 131314, 229622, 327930, 278781, 278783, 278785, 237826, 319751, 286987, 319757, 286999, 319770, 287003, 287006, 287009, 287012, 287014, 287016, 287019, 311598, 287023, 262448, 311601, 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, 311728, 278967, 180668, 311741, 278975, 319938, 278980, 278983, 319945, 278986, 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, 172618, 303690, 33357, 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, 328381, 287423, 328384, 172737, 287427, 312005, 312006, 172748, 287436, 107212, 172751, 287440, 295633, 172755, 303827, 279255, 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, 295707, 328476, 295710, 230175, 295720, 303914, 279340, 279353, 230202, 312124, 328508, 222018, 295755, 377676, 148302, 287569, 303959, 230237, 279390, 230241, 279394, 303976, 336744, 303985, 303987, 328563, 303991, 303997, 295806, 295808, 295813, 304005, 320391, 304007, 213895, 304009, 304011, 304013, 295822, 279438, 213902, 189329, 295825, 304019, 189331, 58262, 304023, 304027, 279452, 279461, 279462, 304042, 213931, 230327, 304055, 287675, 230334, 304063, 304065, 213954, 189378, 156612, 197580, 312272, 304084, 304090, 320481, 304106, 320490, 312302, 328687, 320496, 304114, 295928, 320505, 295945, 230413, 295949, 197645, 320528, 140312, 295961, 238620, 304164, 304170, 238641, 238652, 238655, 230465, 238658, 336964, 132165, 296004, 205895, 320584, 238666, 296021, 402518, 336987, 230497, 296036, 296040, 361576, 205931, 279661, 205934, 312432, 279669, 337018, 189562, 279679, 66690, 279683, 222340, 205968, 296084, 238745, 304285, 238756, 222377, 165035, 337067, 238766, 165038, 230576, 238770, 304311, 230592, 312518, 279750, 230600, 230607, 148690, 320727, 279769, 304348, 279777, 304354, 296163, 320740, 279781, 304360, 320748, 279790, 304370, 296189, 320771, 312585, 296202, 296205, 230674, 320786, 230677, 296213, 296215, 320792, 230681, 230689, 312622, 312630, 222522, 296253, 222525, 296255, 312639, 230718, 296259, 378181, 296262, 230727, 238919, 296264, 320840, 296267, 296271, 222545, 230739, 312663, 222556, 337244, 230752, 312676, 230760, 173418, 148843, 410987, 230763, 230768, 296305, 312692, 230773, 304505, 304506, 181626, 279929, 181631, 312711, 312712, 296331, 288140, 288144, 304533, 337306, 288154, 288160, 288162, 288164, 279975, 304555, 370092, 279983, 173488, 288176, 279985, 312755, 296373, 312759, 337335, 288185, 279991, 222652, 312766, 173507, 222665, 230860, 312783, 288208, 230865, 288210, 370130, 288212, 222676, 148946, 288214, 239064, 329177, 288217, 280027, 288220, 288218, 239070, 288224, 280034, 288226, 280036, 288229, 280038, 288230, 288232, 370146, 288234, 320998, 288236, 288238, 288240, 288242, 296435, 288244, 288250, 296446, 321022, 402942, 148990, 296450, 206336, 230916, 230919, 230923, 304651, 304653, 370187, 230940, 222752, 108066, 296486, 296488, 157229, 239152, 230961, 157236, 288320, 288325, 124489, 280145, 288338, 280149, 288344, 239194, 280158, 403039, 239202, 312938, 280183, 280185, 280191, 116354, 280194, 280208, 280211, 288408, 280222, 419489, 190118, 198310, 321195, 296622, 321200, 337585, 296634, 296637, 419522, 313027, 419525, 206536, 280264, 206539, 206541, 206543, 263888, 313044, 280276, 321239, 280283, 313052, 18140, 288478, 313055, 419555, 321252, 313066, 288494, 280302, 313073, 321266, 419570, 288499, 288502, 280314, 288510, 124671, 67330, 280324, 198405, 288519, 280331, 198416, 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, 42842, 280419, 321381, 296809, 296812, 313201, 1920, 305028, 280454, 247688, 124817, 280468, 239510, 280473, 124827, 214940, 247709, 214944, 321458, 296883, 124853, 214966, 296890, 10170, 288700, 296894, 190403, 296900, 280515, 337862, 165831, 280521, 231379, 296921, 354265, 354270, 239586, 313320, 354281, 124913, 165876, 321528, 239612, 313340, 288764, 239617, 313347, 288773, 313358, 305176, 321560, 313371, 354338, 305191, 223273, 313386, 354348, 124978, 215090, 124980, 288824, 288826, 321595, 313406, 288831, 288836, 67654, 354382, 288848, 280658, 215123, 354390, 288855, 288859, 280669, 313438, 149599, 280671, 149601, 321634, 149603, 313451, 223341, 280687, 149618, 215154, 313458, 280691, 313464, 329850, 321659, 288895, 321670, 215175, 288909, 141455, 141459, 313498, 100520, 288936, 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, 305464, 289087, 280897, 280900, 305480, 239944, 280906, 239947, 305485, 305489, 280919, 248153, 354653, 354656, 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, 289227, 281047, 215526, 166378, 305647, 281075, 174580, 240124, 305662, 305664, 240129, 305666, 305668, 223749, 240132, 281095, 223752, 150025, 338440, 330244, 223757, 281102, 223763, 223765, 281113, 322074, 281116, 281121, 182819, 281127, 281135, 150066, 158262, 158266, 289342, 281154, 322115, 158283, 338528, 338532, 281190, 199273, 281196, 19053, 158317, 313973, 297594, 281210, 158347, 264845, 182926, 133776, 314003, 117398, 314007, 289436, 174754, 330404, 289448, 133801, 174764, 314029, 314033, 240309, 133817, 314045, 314047, 314051, 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, 174955, 224110, 207733, 207737, 158596, 183172, 338823, 322440, 314249, 240519, 183184, 142226, 289687, 240535, 297883, 289694, 289696, 289700, 289712, 281529, 289724, 52163, 183260, 281567, 289762, 322534, 297961, 183277, 281581, 322550, 322563, 314372, 330764, 175134, 322599, 322610, 314421, 281654, 314427, 314433, 207937, 314441, 322642, 314456, 281691, 314461, 281702, 281704, 314474, 281711, 289912, 248995, 306341, 306344, 306347, 322734, 306354, 142531, 199877, 289991, 289997, 249045, 363742, 363745, 298216, 330988, 216303, 322801, 388350, 257302, 363802, 199976, 199978, 314671, 298292, 298294, 216376, 380226, 298306, 224587, 224594, 216404, 306517, 150870, 314714, 224603, 159068, 314718, 314723, 281960, 150890, 306539, 314732, 314736, 290161, 216436, 306549, 298358, 314743, 306552, 290171, 314747, 306555, 298365, 290174, 224641, 281987, 298372, 314756, 281990, 224647, 298377, 314763, 314768, 224657, 306581, 314773, 314779, 314785, 314793, 282025, 282027, 241068, 241070, 241072, 282034, 150966, 298424, 306618, 282044, 323015, 306635, 306640, 290263, 290270, 290275, 339431, 191985, 290291, 282101, 241142, 191992, 290298, 151036, 290302, 290305, 306694, 192008, 323084, 257550, 282127, 290321, 282130, 290325, 282133, 241175, 290328, 290332, 241181, 282142, 282144, 290344, 306731, 290349, 290351, 290356, 28219, 282186, 224849, 282195, 282201, 306778, 159324, 159330, 314979, 298598, 323176, 224875, 241260, 323181, 257658, 315016, 282249, 290445, 324757, 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, 315211, 307027, 315221, 315223, 241496, 241498, 307035, 307040, 110433, 282465, 110438, 298860, 110445, 282478, 315249, 110450, 315251, 315253, 315255, 339838, 315267, 315269, 241544, 282505, 241546, 241548, 298896, 298898, 282514, 241556, 298901, 44948, 241560, 282520, 241563, 241565, 241567, 241569, 282531, 241574, 282537, 298922, 241581, 241583, 323504, 241586, 282547, 241588, 290739, 241590, 241592, 241598, 290751, 241600, 241605, 151495, 241610, 298975, 241632, 298984, 241643, 298988, 241646, 241649, 241652, 323574, 290807, 299003, 241661, 299006, 282623, 315396, 241669, 315397, 282632, 307211, 282639, 290835, 282645, 241693, 241701, 102438, 217127, 282669, 323630, 282681, 290877, 282687, 159811, 315463, 315466, 192589, 307278, 192596, 307287, 307290, 217179, 315482, 192605, 315483, 233567, 299105, 200801, 217188, 299109, 307303, 315495, 356457, 45163, 307307, 315502, 192624, 307314, 323700, 299126, 233591, 299136, 307329, 307338, 233613, 241813, 307352, 299164, 241821, 299167, 315552, 184479, 184481, 184486, 307370, 307372, 307374, 307376, 299185, 323763, 184503, 176311, 299191, 307386, 258235, 307388, 307385, 307390, 176316, 299200, 307394, 299204, 307396, 184518, 307399, 323784, 233679, 307409, 307411, 299225, 233701, 307432, 282881, 282893, 291089, 282906, 291104, 233766, 307508, 315701, 332086, 307510, 307512, 307515, 307518, 282942, 282947, 323917, 110926, 282957, 233808, 323921, 315733, 323926, 233815, 276052, 315739, 323932, 299357, 242018, 242024, 299373, 315757, 250231, 242043, 315771, 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, 127434, 315856, 176592, 127440, 315860, 127447, 283095, 299481, 127449, 176605, 242143, 127455, 291299, 340454, 127463, 242152, 291305, 127466, 176620, 127469, 127474, 291314, 291317, 127480, 135672, 291323, 233979, 127485, 291330, 127490, 283142, 127494, 135689, 233994, 127497, 127500, 233998, 127506, 234003, 127509, 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, 135839, 299680, 225954, 299684, 135844, 242343, 209576, 242345, 373421, 135870, 135873, 135876, 135879, 299720, 299723, 299726, 299740, 201444, 299750, 283368, 234219, 283372, 283382, 316151, 234231, 234236, 226045, 242431, 234239, 209665, 234242, 299778, 242436, 226053, 234246, 226056, 234248, 291593, 242443, 234252, 242445, 234254, 291601, 234258, 242450, 242452, 234261, 201496, 234264, 234266, 234269, 283421, 234272, 234274, 152355, 299814, 234278, 283432, 234281, 234284, 234287, 283440, 185138, 242483, 234292, 234296, 234298, 160572, 283452, 234302, 234307, 242499, 234309, 316233, 234313, 316235, 234316, 234319, 242511, 234321, 234324, 185173, 201557, 234329, 234333, 308063, 234336, 242530, 349027, 234338, 234341, 234344, 234347, 177004, 234350, 324464, 234353, 152435, 177011, 234356, 234358, 234362, 226171, 234364, 291711, 234368, 291714, 234370, 291716, 234373, 316294, 201603, 226182, 308105, 234375, 226185, 234379, 234384, 234388, 234390, 324504, 234393, 209818, 308123, 324508, 234396, 291742, 226200, 234398, 234401, 291747, 291748, 234405, 291750, 234407, 324520, 324518, 324522, 234410, 291756, 291754, 226220, 324527, 291760, 234417, 201650, 324531, 234414, 234422, 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, 168935, 5096, 324585, 234475, 234478, 316400, 234481, 316403, 234484, 234485, 234487, 324599, 234490, 234493, 316416, 234496, 308226, 234501, 275462, 308231, 234504, 234507, 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, 234648, 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, 300263, 300265, 300267, 161003, 300270, 300272, 120053, 300278, 275703, 316663, 300284, 275710, 300287, 292097, 300289, 161027, 300292, 300294, 275719, 234760, 177419, 300299, 242957, 300301, 283917, 177424, 275725, 349451, 349464, 415009, 283939, 259367, 292143, 283951, 300344, 243003, 283963, 226628, 300357, 283973, 283983, 316758, 357722, 316766, 316768, 292192, 292197, 316774, 218473, 284010, 136562, 324978, 275834, 333178, 275836, 275840, 316803, 316806, 316811, 316814, 226703, 300433, 234899, 300436, 226709, 357783, 316824, 316826, 144796, 300448, 144807, 144810, 144812, 144814, 227426, 144820, 374196, 284084, 292279, 284087, 144826, 144828, 144830, 144832, 144835, 144837, 38342, 144839, 144841, 144844, 144847, 144852, 144855, 103899, 300507, 333280, 226787, 218597, 292329, 300523, 300527, 308720, 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, 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, 284258, 292452, 292454, 284263, 284265, 292458, 292461, 284272, 284274, 284278, 292470, 276086, 292473, 284283, 276093, 284286, 292479, 284288, 292481, 284290, 325250, 284292, 292485, 325251, 276095, 276098, 284297, 317066, 284299, 317068, 284301, 276109, 284303, 284306, 276114, 284308, 284312, 284314, 284316, 276127, 284320, 284322, 284327, 284329, 317098, 284331, 276137, 284333, 284335, 284337, 284339, 300726, 284343, 284346, 284350, 358080, 276160, 284354, 358083, 284358, 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, 284399, 358128, 358133, 358135, 276216, 358138, 300795, 358140, 284413, 358142, 358146, 317187, 284418, 317189, 317191, 300816, 300819, 317207, 284440, 300828, 300830, 276255, 300832, 325408, 300834, 317221, 227109, 358183, 276268, 300845, 243504, 300850, 284469, 276280, 325436, 358206, 276291, 366406, 276295, 292681, 153417, 358224, 276308, 317271, 276315, 292700, 317279, 284511, 227175, 292715, 300912, 292721, 284529, 300915, 292729, 317306, 284540, 292734, 325512, 276365, 317332, 358292, 284564, 284566, 399252, 350106, 284572, 276386, 284579, 276388, 358312, 317353, 284585, 292784, 358326, 358330, 276410, 276411, 276418, 301009, 301011, 301013, 292823, 358360, 301017, 301015, 292828, 276446, 153568, 276452, 292839, 276455, 292843, 292845, 276464, 178161, 227314, 325624, 317435, 276479, 276482, 276485, 317446, 276490, 350218, 292876, 350222, 317456, 276496, 317458, 178195, 243733, 243740, 317468, 317472, 325666, 243751, 292904, 276528, 243762, 309298, 325685, 325689, 235579, 325692, 235581, 178238, 276539, 276544, 284739, 325700, 243779, 292934, 243785, 276553, 350293, 350295, 309337, 194649, 227418, 350299, 350302, 227423, 350304, 178273, 309346, 194657, 194660, 350308, 309350, 309348, 292968, 309352, 309354, 301163, 350313, 350316, 227430, 301167, 276583, 350321, 276590, 284786, 276595, 350325, 252022, 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, 350385, 350387, 350389, 350395, 350397, 350399, 227520, 350402, 301252, 350406, 227529, 301258, 309450, 276685, 309455, 276689, 309462, 301272, 194780, 309468, 309471, 301283, 317672, 317674, 325867, 243948, 309494, 243960, 276735, 227587, 276739, 276742, 227593, 227596, 325910, 309530, 342298, 211232, 317729, 276775, 211241, 325937, 325943, 211260, 260421, 276811, 235853, 235858, 276829, 276833, 391523, 276836, 293227, 276843, 293232, 276848, 186744, 211324, 227709, 285061, 366983, 317833, 178572, 285070, 285077, 317853, 276896, 317858, 342434, 285093, 317864, 276907, 235955, 276917, 293304, 293307, 293314, 309707, 293325, 317910, 293336, 235996, 317917, 293343, 358880, 227810, 293346, 293352, 236013, 293364, 301562, 317951, 309764, 301575, 121352, 293387, 236043, 342541, 113167, 309779, 317971, 309781, 227877, 227879, 293417, 227882, 309804, 293421, 105007, 236082, 23094, 277054, 129603, 301636, 318020, 301639, 301643, 277071, 285265, 309844, 277080, 309849, 285277, 285282, 326244, 318055, 277100, 309871, 121458, 277106, 170619, 309885, 309888, 277122, 277128, 285320, 301706, 318092, 326285, 334476, 318094, 277136, 277139, 227992, 334488, 318108, 285340, 318110, 227998, 137889, 383658, 285357, 318128, 277170, 293555, 318132, 342707, 154292, 277177, 277181, 318144, 277187, 277191, 277194, 277196, 277201, 342745, 137946, 342747, 342749, 113378, 228069, 277223, 342760, 285417, 56043, 277232, 228081, 56059, 310015, 285441, 310020, 285448, 310029, 228113, 285459, 277273, 293659, 326430, 228128, 285474, 293666, 228135, 318248, 277291, 318253, 293677, 285489, 301876, 293685, 285494, 301880, 301884, 310080, 293696, 277317, 277322, 310100, 301911, 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, 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, 293917, 293939, 318516, 277561, 277564, 310336, 293956, 277573, 228422, 293960, 310344, 277577, 277583, 203857, 293971, 310355, 310359, 236632, 277594, 138332, 277598, 203872, 277601, 310374, 203879, 310376, 228460, 318573, 203886, 187509, 285815, 367737, 285817, 302205, 285821, 392326, 285831, 294026, 302218, 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, 64768, 310531, 285958, 138505, 228617, 318742, 130345, 113964, 285999, 113969, 318773, 318776, 286010, 417086, 286016, 302403, 294211, 384328, 294221, 294223, 326991, 179547, 302436, 294246, 327015, 310632, 327017, 351594, 351607, 310648, 310651, 310657, 351619, 294276, 310659, 327046, 253320, 310665, 318858, 310672, 351633, 310689, 130468, 277932, 310703, 310710, 130486, 310712, 310715, 302526, 228799, 302534, 310727, 245191, 64966, 163272, 302541, 302543, 310737, 228825, 310749, 310755, 187880, 310764, 286188, 310772, 40440, 212472, 40443, 286203, 310780, 40448, 228864, 286214, 228871, 302603, 65038, 302614, 302617, 286233, 302621, 286240, 146977, 187939, 40484, 294435, 40486, 286246, 294440, 40488, 294439, 294443, 40491, 294445, 278057, 310831, 245288, 40499, 40502, 212538, 40507, 40511, 40513, 228933, 40521, 286283, 40525, 40527, 212560, 400976, 228944, 40533, 147032, 40537, 40539, 40541, 278109, 40544, 40548, 40550, 40552, 286312, 40554, 286313, 310892, 40557, 40560, 294521, 343679, 294537, 310925, 286354, 278163, 302740, 278168, 179870, 327333, 229030, 212648, 278188, 278192, 319153, 278196, 302781, 319171, 302789, 294599, 278216, 294601, 302793, 343757, 212690, 319187, 286420, 278227, 286425, 319194, 278235, 278238, 229086, 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, 294785, 327554, 360322, 40851, 294811, 237470, 319390, 40865, 319394, 294817, 294821, 311209, 180142, 343983, 188340, 319419, 294844, 294847, 237508, 393177, 294876, 294879, 294883, 393190, 294890, 311279, 278513, 237555, 311283, 278516, 278519, 237562 ]
1332032bec76545cf0f98071ba7fcadf22a1fc72
9a655b1dd6053e948486d77973d30f2078517fb5
/SwiftUITutorials/SwiftUITutorials/Views/PageView/PageView.swift
da8e4bd44e536aac8a6e656412120e655275b1f5
[]
no_license
mmospta/SwiftUITutorials
35a566e1f0af212e9c3cb3e8d37837f24c975347
b37313838b6fa85e4a472e44ad48c85a9d952835
refs/heads/main
2023-08-17T16:04:24.000958
2021-09-13T19:49:13
2021-09-13T19:49:13
403,502,607
1
0
null
null
null
null
UTF-8
Swift
false
false
786
swift
// // PageView.swift // SwiftUITutorials // // Created by Phonthep Aungkanukulwit on 12/9/2564 BE. // import SwiftUI struct PageView<Page: View>: View { var pages: [Page] @State private var currentPage = 0 var body: some View { ZStack(alignment: .bottomTrailing) { PageViewController(pages: pages, currentPage: $currentPage) PageControl(numberOfPage: pages.count, currentPage: $currentPage) .frame(width: CGFloat(pages.count * 18)) .padding(.trailing) } } } struct PageView_Previews: PreviewProvider { static var previews: some View { PageView(pages: ModelData().features.map { FeatureCard(landmark: $0) }) .aspectRatio(3 / 2, contentMode: .fit) } }
[ 363393, 421187, 372808, 372874, 377518, 372852 ]
b03986bd57d59ed52139acf192ded86923981e29
3c78af02268fefcfc3b95267d946cfca74d2cfb3
/BudgetTrackeriOS/Models/Employee.swift
a8d03da2ad58e49917e65d85d80ff2101bba3466
[]
no_license
Ge-Ne-On/My-Budget-Tracker
007fc8aaab1257cbfd824361f2a9395fbb27511a
e06cfe1d7a52947b1677927175613d54ffd0c87d
refs/heads/master
2023-07-15T08:32:16.021544
2021-01-23T03:14:09
2021-01-23T03:14:09
402,486,037
1
0
null
null
null
null
UTF-8
Swift
false
false
889
swift
// // Employee.swift // BudgetTrackeriOS // // Created by Jonathan Wong on 4/16/19. // Copyright © 2019 fatty waffles. All rights reserved. // import Foundation class Employee: Codable, CustomStringConvertible { var id: Int? var firstName: String var lastName: String init(firstName: String, lastName: String) { self.firstName = firstName self.lastName = lastName } init(id: Int, firstName: String, lastName: String) { self.id = id self.firstName = firstName self.lastName = lastName } final class WithTraining: Codable { var employee: Employee var trainings: [Training] init(employee: Employee, trainings: [Training]) { self.employee = employee self.trainings = trainings } } var description: String { return "\(String(describing: id)) \(firstName) \(lastName)" } }
[ -1 ]
a8779ad6ab508a0672bacee7922d42642da4239e
d2d33c32d0409649ba94692f73eea5156b410b0b
/Aklaty/ViewModels/TodayOfferViewModel.swift
5b88171330146f83e5323a3fef3a98020efbcd19
[]
no_license
AmmarAliSayed/Aklaty
b8d6ac28a28afdff59b748b28fcd25bda3b5ff29
0c5b97b57d39f653ea73cc933209dcf40aa51385
refs/heads/main
2023-08-06T21:03:18.691359
2021-09-15T07:23:52
2021-09-15T07:23:52
406,480,970
0
0
null
null
null
null
UTF-8
Swift
false
false
897
swift
// // TodayOfferViewModel.swift // Aklaty // // Created by Macbook on 21/08/2021. // import Foundation class TodayOfferViewModel: NSObject { //property from model var fireStoreService : FireStoreService! //property to get the data when success var offersData : [Offer]!{ didSet{ self.bindOfferViewModelToView() } } var bindOfferViewModelToView : (()->()) = {} //inilizer override init() { super.init() self.fireStoreService = FireStoreService() self.fetchOffersDataFromApi() } func fetchOffersDataFromApi(){ fireStoreService.retrieveTodayOffersFromFirebase { (offers) in self.offersData = offers } } func getOfferDetailsViewModel(index : Int) -> TodayOfferDetailsViewModel { return TodayOfferDetailsViewModel(item: offersData[index]) } }
[ -1 ]
41186165a9cab77119a36128b5a3530eb142c8e3
c9899eed4bef7ff4f3d6d21550f121c34a1c2b60
/iCook/Services/Protocols/RecipeService.swift
8e8d101dd1ab6ee7daf65cadcdf424c3e1844c05
[]
no_license
yalishanda42/iCook
014a5bff786fe97354fa7a9cd58355cd732c35ca
7fd9522eaec8ddfa4787540ab96596d384a420cb
refs/heads/master
2023-07-17T21:43:22.114553
2021-08-24T18:49:55
2021-08-24T18:49:55
245,258,032
1
0
null
null
null
null
UTF-8
Swift
false
false
379
swift
// // RecipeService.swift // iCook // // Created by Alexander Ignatov on 21.04.20. // Copyright © 2020 Alexander Ignatov. All rights reserved. // import Foundation import RxSwift protocol RecipeService { func fetchRecipeInfo(for recipeId: Int) -> Observable<Recipe> func submitNewRecipe(for dishId: Int, withStepsText: String) -> Observable<Void> }
[ -1 ]
2ceea825517637a186d466d76a51610736d18dee
ae3cb275a3387f028a99f641a3335c661dc8d1ab
/Physics/Interaction.swift
c5f48ebfe35a2dffa7fd592cead4e2a233de5df3
[]
no_license
gviegas/of-witches-and-mazes
5e8bc8147ea99042ffdac5c0773529f147a2cd9b
52530f4e14d2a508f6ec57710eaad6a89781d2d0
refs/heads/main
2023-02-27T07:00:08.838569
2021-02-01T04:31:00
2021-02-01T04:31:00
334,824,742
0
0
null
null
null
null
UTF-8
Swift
false
false
9,792
swift
// // Interaction.swift // Of Witches and Mazes // // Created by Gustavo C. Viegas on 11/1/17. // Copyright © 2017 Gustavo C. Viegas. All rights reserved. // import SpriteKit /// An enum that specifies the available groups to interact with. /// enum InteractionGroup: UInt32 { case none = 0 case protagonist = 0x01 case monster = 0x02 case npc = 0x04 case companion = 0x08 case destructible = 0x10 case trap = 0x20 case obstacle = 0x40 case loot = 0x80 case effect = 0x100 case all = 0xffffffff } /// A class that defines which collisions and contacts should be considered for a group /// of related objects. /// class Interaction { /// The interaction for a protagonist entity. /// static let protagonist = Interaction(category: .protagonist, collisionGroups: [.monster, .npc, .destructible, .trap, .obstacle], contactGroups: [.monster, .destructible]) /// The interaction for a monster entity. /// static let monster = Interaction(category: .monster, collisionGroups: [.protagonist, .companion, .npc, .destructible, .trap, .obstacle], contactGroups: [.protagonist, .companion, .destructible]) /// The interaction for a npc entity. /// static let npc = Interaction(category: .npc, collisionGroups: [.none], contactGroups: [.none]) /// The interaction for a companion entity. /// static let companion = Interaction(category: .companion, collisionGroups: [.monster, .npc, .destructible, .trap, .obstacle], contactGroups: [.monster, .destructible]) /// The interaction for things that can be destroyed. /// static let destructible = Interaction(category: .destructible, collisionGroups: [.npc, .destructible, .trap, .obstacle], contactGroups: [.none]) /// The interaction for impassable/immovable traps. /// static let trap = Interaction(category: .trap, collisionGroups: [.none], contactGroups: [.none]) /// The interaction for impassable/immovable things, like obstacle tiles and some inanimate object entities. /// static let obstacle = Interaction(category: .obstacle, collisionGroups: [.none], contactGroups: [.none]) /// The interaction for dropped loot. /// static let loot = Interaction(category: .loot, collisionGroups: [.none], contactGroups: [.none]) /// The interaction for protagonist's effects. /// static let protagonistEffect = Interaction(category: .effect, contactGroups: [.monster, .destructible]) /// The interaction for protagonist's effects that must contact obstacles. /// static let protagonistEffectOnObstacle = Interaction(category: .effect, contactGroups: [.monster, .destructible, .trap, .obstacle]) /// The interaction for protagonist's effects that must contact other effects. /// static let protagonistEffectOnEffect = Interaction(category: .effect, contactGroups: [.monster, .destructible, .effect]) /// The interaction for protagonist's effects that must contact other effects and obstacles. /// static let protagonistEffectOnEffectAndObstacle = Interaction(category: .effect, contactGroups: [.monster, .destructible, .trap, .effect, .obstacle]) /// The interaction for monster's effects. /// static let monsterEffect = Interaction(category: .effect, contactGroups: [.protagonist, .companion, .destructible]) /// The interaction for monster's effects that must contact obstacles. /// static let monsterEffectOnObstacle = Interaction(category: .effect, contactGroups: [.protagonist, .companion, .destructible, .trap, .obstacle]) /// The interaction for companion's effects. /// static let companionEffect = Interaction(category: .effect, contactGroups: [.monster, .destructible]) /// The interaction for companion's effect that must contact obstacles. /// static let companionEffectOnObstacle = Interaction(category: .effect, contactGroups: [.monster, .destructible, .trap, .obstacle]) /// The interaction for neutral effects. /// static let neutralEffect = Interaction(category: .effect, contactGroups: [.protagonist, .companion, .monster, .destructible]) /// The interaction for neutral effects that must contact obstacles. /// static let neutralEffectOnObstacle = Interaction(category: .effect, contactGroups: [.protagonist, .companion, .monster, .destructible, .trap, .obstacle]) /// The interaction for neutral effects that must contact other effects. /// static let neutralEffectOnEffect = Interaction(category: .effect, contactGroups: [.protagonist, .companion, .monster, .destructible, .effect]) /// The interaction for neutral effects that must contact obstacles but not traps. /// static let neutralEffectOnObstacleExcludingTrap = Interaction(category: .effect, contactGroups: [.protagonist, .companion, .monster, .destructible, .obstacle]) /// The category to which the object belongs. /// let category: InteractionGroup /// The groups which the object wants to collide with. /// let collisionGroups: Set<InteractionGroup> /// The groups which the object wants to contact. /// let contactGroups: Set<InteractionGroup> /// Creates a new instance from the given values. /// /// - Parameters: /// - category: The `InteractionGroup` that the interaction belongs to. The default value is `.none`. /// - collisionGroups: A set of `InteractionGroup`s to collide with. The default value is `[.none]`. /// - contactGroups: A set of `InteractionGroup`s to contact. The default value is `[.none]`. /// init(category: InteractionGroup = .none, collisionGroups: Set<InteractionGroup> = [.none], contactGroups: Set<InteractionGroup> = [.none]) { self.category = category self.collisionGroups = collisionGroups self.contactGroups = contactGroups } /// Applies the current interaction configuration on a physics body. /// /// - Parameter physicsBody: The physics body to update. /// func updateInteractions(onPhysicsBody physicsBody: SKPhysicsBody) { let convert = { (groups: Set<InteractionGroup>) -> UInt32 in var bitmask: UInt32 = 0 for group in groups { bitmask |= group.rawValue } return bitmask } physicsBody.categoryBitMask = category.rawValue physicsBody.collisionBitMask = convert(collisionGroups) physicsBody.contactTestBitMask = convert(contactGroups) } /// Checks if a given physics body is an obstacle. /// /// - Parameter physicsBody: The `PhysicsBody` to check. /// - Returns: `true` if the physics body is an obstacle, `false` otherwise. /// static func isObstacle(physicsBody: SKPhysicsBody) -> Bool { return (physicsBody.categoryBitMask & InteractionGroup.obstacle.rawValue) != 0 } /// Checks if a given physics body is an effect. /// /// - Parameter physicsBody: The `PhysicsBody` to check. /// - Returns: `true` if the physics body is an effect, `false` otherwise. /// static func isEffect(physicsBody: SKPhysicsBody) -> Bool { return (physicsBody.categoryBitMask & InteractionGroup.effect.rawValue) != 0 } /// Checks if a given physics body has interest in another one. /// /// This method checks if the `otherBody`s category is presented in the `physicsBody`'s /// contact groups, which can be useful when deciding to who a contact notification must be sent. /// /// - Parameters: /// - physicsBody: The physics body whose interest must be checked. /// - otherBody: The physics body to check as a possible source of interest. /// - Returns: `true` if `physicsBody` has interest in `otherBody`, `false` otherwise. /// static func hasInterest(_ physicsBody: SKPhysicsBody, in otherBody: SKPhysicsBody) -> Bool { return (physicsBody.contactTestBitMask & otherBody.categoryBitMask) != 0 } }
[ -1 ]
a5f3c85d441be6c76e4efe3828a0599fd6c18364
7cb21e848b1cfcb4bd639045fa813d987fe03be5
/Contacts/Orders/OrderTableViewCell.swift
012048fb28e8c52153b2b5153e87b93c4dc1afaf
[]
no_license
rolcsi/Contacts
8b108278c768875f1ce7532a2575726d54f399a5
50e1c477fee79ed1686c127bb50c71a45d3e09ae
refs/heads/master
2021-01-01T18:40:03.334010
2017-07-26T08:27:55
2017-07-26T08:27:55
98,398,644
0
0
null
null
null
null
UTF-8
Swift
false
false
352
swift
// // OrderTableViewCell.swift // Contacts // // Created by Roland Beke on 25.7.17. // Copyright © 2017 Roland Beke. All rights reserved. // import UIKit class OrderTableViewCell: UITableViewCell { @IBOutlet weak var photoImageView: UIImageView! @IBOutlet weak var nameLabel: UILabel! @IBOutlet weak var phoneLabel: UILabel! }
[ -1 ]
df29ac0317e4239340b417dc26d47ab93e4f7a08
c342bfb4ea36bb654e0dfeda529acdcd7ee11c1c
/Onboarding/Scans/ScanResultViewController.swift
5ab6e2a3b73f258daae1be7be79bd72cfdaed94c
[ "MIT" ]
permissive
DariusPri/Cyber
38bb6ef4ef94020f7f716d88c3048de6408f1dcc
8bd32b8da861f36a4a139033cb062d4d9d9f6ba2
refs/heads/main
2023-08-21T19:48:59.578026
2021-10-13T07:54:41
2021-10-13T07:54:41
416,627,680
0
0
null
null
null
null
UTF-8
Swift
false
false
10,084
swift
// // ScanResultViewController.swift // Xpert // // Created by Darius on 01/08/2018. // Copyright © 2018. All rights reserved. // import UIKit enum ScanType : String { case vulnerability = "Vulnerability Scan" case dataBreach = "Dark Web Scan" case security = "Security Scans" case router = "Router Scans" case scamEmails = "Scam Emails" func localized() -> String { switch self { case .vulnerability: return Localization.shared.vulnerability_scan case .dataBreach: return Localization.shared.data_breach_scanner case .security: return Localization.shared.dashboard_security_scans case .router: return Localization.shared.router_scan case .scamEmails: return Localization.shared.dashboard_scam_emails } } func getDescription() -> String { switch self { case .vulnerability: return Localization.shared.dashboard_vulnerability_scans_popup_desc_missing case .dataBreach: return Localization.shared.dashboard_data_breach_popup_description_text_missing case .security: return Localization.shared.dashboard_security_popup_description_text_missing case .router: return Localization.shared.dashboard_router_popup_description_text_missing case .scamEmails: return Localization.shared.dashboard_scam_emails_desc_text_missing } } init?(name: String) { switch name { case "vulnerability_scan": self = .vulnerability case "data_breach_scanner": self = .dataBreach case "security_scan": self = .security case "router_scan": self = .router case "scan_emails": self = .scamEmails default: self = .vulnerability } } } class ScanResultViewController: UIViewController { struct ScanData { var scanType : ScanType var problemCount : Int var image : UIImage func fullProblemString() -> String { if scanType == .router { return "Router security scan scheduled" } if scanType == .scamEmails { return "Scam emails scheduled for sending" } return problemCount > 0 ? "\(problemCount) problems" : "No Problems found" } func hasProblems() -> Bool { return problemCount > 0 } } let dashboardButton = SquareButton(title: Localization.shared.continue_to_dashboard.uppercased(), image: nil, backgroundColor: UIColor.primaryButtonColor, textColor: .white) let scoreLabel : DefaultLabel let scanDetailsView : ScanDetailsView init(score : Int, scanDataArray : [ScanData]) { scoreLabel = DefaultLabel(text: String(score)) scanDetailsView = ScanDetailsView(scanDataArray: scanDataArray) super.init(nibName: nil, bundle: nil) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = UIColor.bgColor addNextButton() setupElements() } func setupElements() { scoreLabel.font = UIFont(name: "Muli-Regular", size: view.getCorrectSize(62, 62, 86)) let header = DefaultLabel(text: "Security Issues Found") header.font = UIFont(name: "Muli-Regular", size: view.getCorrectSize(17, 17, 24)) let subHeader = IndicatorLabel(text: "Sign up and continue to your dashboard to get your Cyber Security Score and tailored improvement plan", attatchmentImage: #imageLiteral(resourceName: "indicator_red"), attachmentSpacing : 0) subHeader.font = subHeader.font.withSize(view.getCorrectSize(12.2, 13, 15)) let infoStack = UIStackView(arrangedSubviews: [scoreLabel, header, subHeader]) infoStack.axis = .vertical infoStack.spacing = view.getCorrectSize(0, 0, 10) infoStack.setCustomSpacing(view.getCorrectSize(10, 10, 16), after: header) view.addSubview(infoStack) view.addSubview(scanDetailsView) view.addConstraintsWithFormat(format: "V:|-\(view.getCorrectSize(80, 136, 160))-[v0]-\(view.getCorrectSize(50, 50, 84))-[v1]", views: infoStack, scanDetailsView) view.addConstraintsWithFormat(format: "H:|-(>=74,==74@900)-[v0(<=500)]-(>=74,==74@900)-|", views: infoStack) view.addConstraintsWithFormat(format: "H:|-(>=30,==30@900)-[v0(<=500)]-(>=30,==30@900)-|", views: scanDetailsView) NSLayoutConstraint(item: infoStack, attribute: .centerX, relatedBy: .equal, toItem: view, attribute: .centerX, multiplier: 1, constant: view.getCorrectSize(0, 0, -80)).isActive = true NSLayoutConstraint(item: scanDetailsView, attribute: .centerX, relatedBy: .equal, toItem: view, attribute: .centerX, multiplier: 1, constant: view.getCorrectSize(0, 0, -80)).isActive = true } func addNextButton() { dashboardButton.addTarget(self, action: #selector(dashboardButtonAction), for: .touchUpInside) view.addSubview(dashboardButton) let guide = self.view.safeAreaLayoutGuide dashboardButton.bottomAnchor.constraint(equalTo: guide.bottomAnchor, constant: getBottomSafeAreaHeight() == 0 ? view.getCorrectSize(-20, -40, -50) : 0).isActive = true dashboardButton.heightAnchor.constraint(equalToConstant: view.getCorrectSize(55, 55, 80)).isActive = true dashboardButton.titleLabel?.font = UIFont(name: "Muli-ExtraBold", size: view.getCorrectSize(15, 15, 21)) if view.isSmallScreenSize == true { view.addConstraintsWithFormat(format: "H:|-(>=20,==20@900)-[v0(<=500)]-(>=20,==20@900)-|", views: dashboardButton) } else { view.addConstraintsWithFormat(format: "H:[v0(\(view.calculatedNewScreenWidth))]", views: dashboardButton) } NSLayoutConstraint(item: dashboardButton, attribute: .centerX, relatedBy: .equal, toItem: view, attribute: .centerX, multiplier: 1, constant: 0).isActive = true } @objc func dashboardButtonAction() { self.navigationController?.pushViewController(BeginAssessmentViewController(), animated: true) } } class ScanDetailsView : UIView { init(scanDataArray : [ScanResultViewController.ScanData]) { super.init(frame: .zero) var views : [SingleScanDetailView] = [] for (index, scanData) in scanDataArray.enumerated() { views.append(SingleScanDetailView(scanData: scanData, isDotted: scanDataArray.count != index + 1)) } let mainStack = UIStackView(arrangedSubviews: views) mainStack.spacing = 10 mainStack.axis = .vertical addSubview(mainStack) addConstraintsWithFormat(format: "H:|[v0]|", views: mainStack) addConstraintsWithFormat(format: "V:|[v0]|", views: mainStack) backgroundColor = .clear } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } } class SingleScanDetailView: UIView { let path = UIBezierPath() let detailLabel : DefaultLabel let problemLabel : IndicatorLabel let dotted : Bool let iconImageView : UIImageView = { let view = UIImageView() view.translatesAutoresizingMaskIntoConstraints = false view.contentMode = .scaleAspectFit return view }() init(scanData : ScanResultViewController.ScanData, isDotted : Bool = true) { detailLabel = DefaultLabel(text: scanData.scanType.rawValue) detailLabel.font = UIFont(name: "Muli-Regular", size: 15) detailLabel.sizeToFit() problemLabel = IndicatorLabel(text: scanData.fullProblemString(), attatchmentImage: scanData.hasProblems() == true ? #imageLiteral(resourceName: "indicator_red") : #imageLiteral(resourceName: "indicator_green"), attachmentSpacing : 0) problemLabel.sizeToFit() detailLabel.sizeToFit() iconImageView.image = scanData.image dotted = isDotted super.init(frame: .zero) iconImageView.heightAnchor.constraint(equalToConstant: getCorrectSize(26, 26, 32)).isActive = true iconImageView.widthAnchor.constraint(equalToConstant: getCorrectSize(26, 26, 32)).isActive = true detailLabel.font = detailLabel.font.withSize(getCorrectSize(15, 15, 19)) problemLabel.font = problemLabel.font.withSize(getCorrectSize(13, 13, 16)) addSubview(iconImageView) addSubview(detailLabel) addSubview(problemLabel) translatesAutoresizingMaskIntoConstraints = false heightAnchor.constraint(equalToConstant: getCorrectSize(80, 80, 120)).isActive = true addConstraintsWithFormat(format: "H:|[v0]", views: iconImageView) addConstraintsWithFormat(format: "H:[v0]-\(getCorrectSize(24, 24, 34))-[v1]-10-|", views: iconImageView, detailLabel) addConstraintsWithFormat(format: "V:|[v0]", views: iconImageView) addConstraintsWithFormat(format: "V:|-4-[v0]-8-[v1]-(>=\(getCorrectSize(10, 10, 50)))-|", views: detailLabel, problemLabel) NSLayoutConstraint(item: problemLabel, attribute: .left, relatedBy: .equal, toItem: detailLabel, attribute: .left, multiplier: 1, constant: 0).isActive = true backgroundColor = .clear } override func draw(_ rect: CGRect) { if dotted == false { return } path.move(to: CGPoint(x: 13, y: 36)) path.addLine(to: CGPoint(x: 13, y: rect.size.height)) UIColor(red: 110/255, green: 125/255, blue: 135/255, alpha: 1).setStroke() path.lineWidth = 1 let dashPattern : [CGFloat] = [1, 4] path.setLineDash(dashPattern, count: 2, phase: 0) path.lineCapStyle = CGLineCap.round path.stroke() } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } }
[ -1 ]
52de057ad61c9f04651cac6133a2a8bfb747acde
a587207dbbc79140e15d34038e9924103510638f
/praca_magisterska_swift/VC/ChooseCategoryVC.swift
d3a857f3be6718af280ba2c5201aa4627fd72737
[]
no_license
Taangh/Master-Thesis
bee7d5d79e754432d9d0984ecb40942a39a371b1
b18ad962308f43751818bf385318f2b6e4d57f88
refs/heads/master
2023-01-22T07:29:30.113624
2020-12-02T18:55:31
2020-12-02T18:55:31
271,881,236
0
0
null
null
null
null
UTF-8
Swift
false
false
1,226
swift
// // chooseCategoryVC.swift // praca_magisterska_swift // // Created by Damian Szczygielski on 25/05/2020. // Copyright © 2020 Damian Szczygielski. All rights reserved. // import UIKit class ChooseCategoryVC: UIViewController { var emotionsItemsMode = AppSettings.GameEmotionsItemsMode.Items override func viewDidLoad() { super.viewDidLoad() } override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } @IBAction func itemGameClick(_ sender: UIButton) { emotionsItemsMode = AppSettings.GameEmotionsItemsMode.Items performSegue(withIdentifier: Constants.ItemGameSegue, sender: nil) } @IBAction func emotionsGameClick(_ sender: UIButton) { emotionsItemsMode = AppSettings.GameEmotionsItemsMode.Emotions performSegue(withIdentifier: Constants.ItemGameSegue, sender: nil) } @IBAction func back(_ sender: UIButton) { self.dismiss(animated: true, completion: nil) } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if let target = segue.destination as? GameVC { target.emotionsItemsMode = emotionsItemsMode } } }
[ -1 ]
90109c6e537e9a3949c8678e273e93d7e99cdffe
71b0c3467f1069578a0d21365e9377ac1d306464
/Pods/SKCore/Sources/Bot.swift
a6c5d55fd9db5544d8e6717fa580a0e1b2f874ba
[ "MIT" ]
permissive
WataruSuzuki/iOS-Slack-API-Example
44bf8c540d4a493671ed5398e8fcd0d1558222bb
289d85e26c5e49e26ae542a5dc6c2e02c8dd4e29
refs/heads/master
2021-01-21T14:48:18.781297
2017-07-02T12:06:22
2017-07-02T12:06:22
95,334,470
0
0
null
null
null
null
UTF-8
Swift
false
false
1,638
swift
// // Bot.swift // // Copyright © 2017 Peter Zignego. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. public struct Bot { public let id: String? public var botToken: String? public var name: String? public var icons: [String: Any]? public init(bot: [String: Any]?) { id = bot?["id"] as? String name = bot?["name"] as? String icons = bot?["icons"] as? [String: Any] } public init(botUser: [String: Any]?) { id = botUser?["bot_user_id"] as? String botToken = botUser?["bot_access_token"] as? String } }
[ 194560, 407569, 98344, 354359, 174135, 174139, 124988, 229441, 229443, 174148, 229444, 395334, 378951, 174152, 229449, 106580, 106584, 106586, 106587, 112730, 125048, 229504, 125057, 125064, 125065, 125066, 235658, 125087, 215205, 215206, 215208, 215211, 215212, 215215, 241862, 317638, 317640, 203, 241868, 241873, 262353, 241878, 262359, 241879, 106713, 106714, 262366, 106720, 106725, 241904, 176370, 241907, 176373, 260342, 106742, 176378, 141566, 141569, 141576, 241928, 241931, 141583, 241937, 141588, 12565, 227607, 227608, 141593, 141594, 227609, 227610, 227612, 141598, 141599, 141600, 227613, 241952, 241955, 227614, 141606, 141607, 141609, 241961, 241963, 141612, 289068, 12592, 141629, 141632, 141634, 213320, 141641, 141642, 262475, 141646, 241998, 141650, 141655, 282967, 282969, 168285, 172391, 141674, 141677, 141679, 141681, 375154, 190842, 430458, 190844, 375165, 375168, 375172, 141701, 430471, 430475, 141711, 197016, 197018, 197019, 197021, 197029, 303550, 160208, 305638, 272872, 223741, 191007, 272931, 57893, 272934, 57896, 420394, 57899, 57900, 57903, 57904, 57905, 57906, 158257, 336445, 336450, 336451, 55890, 336466, 336470, 336472, 336473, 336480, 336481, 111202, 272994, 336482, 336488, 273003, 273021, 273023, 297615, 297625, 135854, 135861, 242361, 244421, 244430, 66257, 66261, 62174, 127727, 127729, 244469, 244470, 164601, 316155, 142076, 334590, 334591, 142083, 142087, 318218, 334602, 318220, 334604, 334606, 142095, 318223, 334607, 318228, 318233, 318234, 318239, 187173, 318246, 187175, 187178, 396095, 396098, 396104, 396114, 396118, 396119, 396120, 396123, 396126, 396127, 299880, 60304, 60318, 60322, 60323, 60331, 213935, 60337, 185280, 281538, 185286, 203755, 23559, 23560, 437256, 437258, 437269, 437273, 437281, 3119, 187442, 144435, 187444, 437305, 97339, 341054, 437310, 341055, 341057, 341058, 97347, 341060, 437314, 222278, 341062, 341063, 341066, 437326, 185428, 285781, 312407, 312413, 437349, 185446, 312423, 115817, 115819, 242796, 312427, 437356, 115825, 437364, 437371, 294012, 294016, 437390, 437392, 437396, 40089, 312473, 40092, 312476, 228510, 40095, 40096, 228512, 40098, 312478, 312479, 40101, 312480, 437415, 437416, 40105, 312489, 189612, 40109, 40110, 437424, 437426, 437428, 189621, 312501, 312502, 312504, 437431, 437433, 437436, 322751, 437440, 38081, 437443, 437445, 292041, 292042, 437451, 38092, 437453, 437458, 203990, 203991, 152795, 204000, 204003, 339176, 339177, 208117, 152821, 294138, 279818, 206094, 279823, 294162, 206108, 206109, 425247, 27948, 181559, 173368, 173379, 173394, 378206, 171366, 222566, 222573, 222577, 222579, 222581, 222582, 54655, 222591, 222597, 222601, 54666, 222604, 222605, 222606, 54673, 54678, 54680, 279969, 153009, 298431, 212420, 370118, 153037, 153049, 153051, 112111, 112115, 112117, 112120, 40451, 112131, 40453, 280068, 40455, 40458, 40460, 40463, 112144, 112145, 40466, 40469, 40471, 40475, 40477, 40479, 40482, 316993, 173634, 173635, 173639, 319085, 319088, 319089, 319094, 319098, 319101, 319103, 394899, 52886, 52887, 394908, 394910, 52896, 52899, 52900, 151218, 394935, 321210, 292544, 108234, 34516, 108245, 212694, 296660, 34522, 34531, 296679, 34538, 296682, 296687, 296691, 151285, 296694, 108279, 108281, 216826, 216828, 296700, 296701, 296703, 296704, 216834, 296708, 296710, 276232, 313099, 276236, 313102, 313108, 313111, 159518, 321342, 120655, 120656, 218959, 218962, 223064, 223069, 292705, 223075, 223076, 237413, 180070, 292709, 128874, 128875, 227180, 223087, 227183, 128881, 128884, 227188, 116608, 141189, 141202, 141208, 141220, 108460, 108462, 319426, 141253, 319432, 59349, 141272, 141273, 174063, 174066, 174067, 174074, 395259, 194559 ]
84031d13259c174ba2fa57e35e2635c83db5b82f
8b4a5f61caa0d985873acd57b8b84a8df6d7b765
/Day7/Day7Project/Day7Project/Addition.swift
eaa21042fc74940d48174a05904e71d19a6c97c3
[]
no_license
forampanchal1992/MAD3004w18
e002de8a17d4a35cf522550990d0a3ff31ea84de
2d772436cb2d41c6afda4ec104940efd3f77fb6d
refs/heads/master
2021-05-09T08:24:20.476134
2018-02-14T16:29:08
2018-02-14T16:29:08
119,391,243
0
0
null
null
null
null
UTF-8
Swift
false
false
573
swift
// // Addition.swift // Day7Project // // Created by MacStudent on 2018-02-06. // Copyright © 2018 MacStudent. All rights reserved. // import Foundation class Operation: Airthmetic{ var oper: Character? /* init(oper: Character) { self.oper = oper } */ override required init(n1: Int, n2: Int, n3: Int){ super.init(n1: n1, n2: n2, n3: n3) } func calculate(){ let resultcal = self.n1 + self.n2 + self.n3 print("Calling Function \(resultcal)") } }
[ -1 ]
0864ded1f638b76ce38f176029bc9089799d08c1
577cd90cb030bd7c4eca5d0d29683879b5881c7a
/LPConvenientUI/UIButton+Convenient.swift
86128d58ffcfeeb0cef291de008ed4be31840d7e
[ "MIT" ]
permissive
litt1e-p/LPConvenientUI
add70e017d5fe14862274c081ad6e6fc7fb4a88a
1e4b3b7a84af38ac1a1a616c2b08afdadc0f76dd
refs/heads/master
2021-06-09T16:04:50.120065
2019-02-12T08:01:58
2019-02-12T08:01:58
96,276,223
1
0
null
null
null
null
UTF-8
Swift
false
false
3,125
swift
// The MIT License (MIT) // // Copyright (c) 2015-2019 litt1e-p ( https://github.com/litt1e-p ) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. import Foundation import UIKit public extension UIButton { public convenience init(image aImage: UIImage?) { self.init(image: aImage, title: nil) } public convenience init(image aImage: UIImage?, title aTitle: String?) { self.init(image: aImage, title: aTitle, font: nil) } public convenience init(image aImage: UIImage?, title aTitle: String?, font aFont: UIFont?) { self.init(image: aImage, titleColor: .black, title: aTitle, font: aFont) } public convenience init(image aImage: UIImage?, titleColor aTitleColor: UIColor?, title aTitle: String?, font aFont: UIFont?) { self.init(type: .custom) self.setImage(aImage, for: .normal) self.setTitle(aTitle, for: .normal) self.setTitleColor(aTitleColor, for: .normal) self.titleLabel?.font = aFont } public convenience init(titleColor aTitleColor: UIColor?, title aTitle: String?, font aFont: UIFont?) { self.init(backgroundColor: .clear, titleColor: aTitleColor, title: aTitle, font: aFont) } public convenience init(backgroundColor aBackgroundColor: UIColor?, titleColor aTitleColor: UIColor?, title aTitle: String?, font aFont: UIFont?) { self.init(backgroundColor: aBackgroundColor, titleColor: aTitleColor, titleHighlightColor: aTitleColor, title: aTitle, font: aFont) } public convenience init(backgroundColor aBackgroundColor: UIColor?, titleColor aTitleColor: UIColor?, titleHighlightColor aTitleHighlightColor: UIColor?, title aTitle: String?, font aFont: UIFont?) { self.init(type: .custom) self.backgroundColor = aBackgroundColor self.setTitleColor(aTitleColor, for: .normal) self.setTitleColor(aTitleHighlightColor, for: .highlighted) self.setTitle(aTitle, for: .normal) self.titleLabel?.font = aFont self.adjustsImageWhenHighlighted = false } }
[ 395267, 196612, 395271, 395274, 395278, 395280, 395281, 395282, 395283, 395286, 395287, 395289, 395290, 196638, 395295, 395296, 196641, 98341, 61478, 98344, 98345, 98349, 124987, 174139, 354364, 229438, 229440, 229441, 395328, 174148, 229444, 395332, 327751, 174152, 395333, 395334, 174159, 229456, 112721, 106580, 106582, 106585, 106586, 106587, 112730, 174171, 235658, 229524, 303255, 303256, 125087, 215205, 215211, 215212, 241846, 241852, 241859, 241862, 241864, 317640, 241866, 241870, 241877, 241894, 241897, 241901, 241903, 241904, 241907, 241908, 241910, 260342, 241916, 141565, 141569, 241923, 241928, 141577, 141578, 241930, 241934, 241936, 241937, 141586, 141588, 12565, 227604, 241944, 227608, 12569, 141593, 141594, 141595, 141596, 141597, 141598, 141599, 141600, 227610, 141603, 241952, 241957, 141606, 141607, 141608, 289062, 241962, 289067, 141612, 289068, 12592, 289074, 289078, 141627, 141629, 141632, 241989, 213319, 141640, 141641, 141642, 141643, 213320, 241992, 241996, 241998, 241999, 242002, 141651, 242006, 141655, 215384, 282967, 141660, 168285, 141663, 141664, 141670, 141677, 141681, 190840, 190841, 430456, 190843, 190844, 430458, 375168, 141700, 141702, 141707, 430476, 141711, 430483, 217492, 217494, 197018, 197019, 197021, 295330, 295331, 197029, 430502, 168359, 303550, 160205, 381398, 305638, 223741, 61971, 191006, 191007, 57893, 57896, 328232, 57899, 57900, 295467, 57905, 57906, 336445, 336446, 336450, 336451, 336454, 336455, 336457, 336460, 336465, 336469, 336471, 336472, 336473, 336474, 336478, 336479, 336480, 336482, 336483, 336489, 297620, 297636, 135861, 242361, 244419, 66247, 244427, 248524, 127693, 244430, 66261, 127702, 127703, 334562, 127716, 334564, 62183, 127727, 127729, 318199, 318200, 142073, 164601, 334590, 318207, 244480, 334591, 334596, 334600, 318218, 334603, 318220, 334602, 334606, 318223, 334607, 318231, 318233, 318234, 318236, 318237, 318241, 187174, 187175, 318246, 187177, 187179, 187180, 314167, 316216, 396088, 396089, 396091, 396092, 396094, 148287, 316224, 396098, 314179, 279367, 396104, 396110, 396112, 396114, 396115, 396118, 396119, 396120, 396122, 396123, 396125, 396126, 396127, 396128, 396129, 299880, 396137, 162668, 299884, 187248, 396147, 396151, 248696, 396153, 187258, 187259, 322430, 185258, 185259, 23469, 185262, 23470, 23472, 23473, 23474, 23475, 23476, 185267, 23479, 287674, 23483, 23487, 281539, 23492, 23494, 228306, 23508, 23515, 23517, 23523, 23531, 23533, 152560, 23552, 171008, 23559, 23561, 23572, 23574, 23575, 23580, 23581, 23585, 23590, 23591, 23594, 23596, 23599, 189488, 97327, 187442, 189490, 187444, 189492, 189493, 187447, 189491, 23601, 97329, 144435, 23607, 144437, 144438, 144441, 97339, 23612, 144442, 144443, 144444, 23616, 144445, 341057, 341060, 222278, 341062, 341063, 341066, 341068, 203862, 285782, 285785, 115805, 115806, 115807, 293982, 115809, 115810, 185446, 115817, 242794, 115819, 115820, 185452, 185454, 115823, 185455, 115825, 115827, 242803, 115829, 242807, 294016, 205959, 40088, 312473, 189594, 208026, 40092, 208027, 189598, 40095, 208029, 208033, 27810, 228512, 228513, 312476, 312478, 189607, 312479, 189609, 189610, 312482, 189612, 312489, 312493, 189617, 312497, 189619, 312498, 189621, 312501, 189623, 189626, 322751, 292041, 292042, 181455, 292049, 152789, 152821, 152825, 294137, 294138, 206094, 206097, 206098, 294162, 206102, 206104, 206108, 206109, 181533, 294181, 27943, 181544, 294183, 27948, 181553, 173368, 206138, 173379, 312480, 152906, 152907, 152908, 152909, 152910, 290123, 290125, 290126, 290127, 290130, 312483, 290135, 290136, 245081, 290137, 290139, 378208, 222562, 222563, 222566, 228717, 228721, 222587, 222590, 222591, 222596, 177543, 222599, 222601, 222603, 222604, 54669, 222605, 222606, 222607, 54673, 54692, 152998, 54698, 54701, 54703, 298431, 370118, 157151, 222689, 222692, 222693, 112111, 112115, 112120, 362020, 362022, 116267, 282156, 34362, 173634, 173635, 316995, 316997, 106085, 319081, 319085, 319088, 300660, 300661, 300662, 300663, 394905, 394908, 394910, 394912, 339622, 147115, 292544, 108230, 341052, 108240, 108245, 212694, 34531, 192230, 192231, 192232, 296681, 34538, 34540, 34541, 216812, 216814, 216815, 216816, 216818, 216819, 296684, 296687, 216822, 296688, 296691, 296692, 216826, 296698, 216828, 216829, 296699, 296700, 216832, 216833, 216834, 296703, 216836, 216837, 216838, 296707, 296708, 296710, 296712, 296713, 313101, 313104, 313108, 313111, 313112, 149274, 149275, 149280, 159523, 321342, 210755, 210756, 210757, 210758, 321353, 218959, 218963, 218964, 223065, 180058, 229209, 223069, 229213, 169824, 229217, 169826, 237413, 169830, 292709, 128873, 169835, 128876, 169837, 128878, 223086, 223087, 128881, 128882, 128883, 128884, 141181, 327550, 108419, 141198, 108431, 108432, 219033, 108448, 219040, 141219, 219043, 219044, 141223, 141228, 141229, 108460, 108462, 229294, 229295, 141235, 141264, 40931, 40932, 141284, 141290, 40940, 40941, 141293, 141295, 174063, 231406, 174066, 174067, 237559, 174074 ]
1b76eb6f4ec59cc1151d3ad4060583aac9213772
eebd2a4876af4c2d6a945cd2ec0a2d22678062ea
/zhnbilibili/zhnbilibili/Main/controllers/MainCustomNaViController.swift
a93a9ff0da0b0bc369b98c8f4907580958d99fe1
[ "Apache-2.0" ]
permissive
XY-Wing/-bilibili
b20f4ce1269e7dfee06cccc341a3159020bd204a
ac54f88181998a52321a8fd22a8a8934fd8a864e
refs/heads/master
2021-01-20T04:26:02.047524
2017-04-28T09:47:10
2017-04-28T09:47:10
89,691,179
0
0
null
null
null
null
UTF-8
Swift
false
false
625
swift
// // MainCustomNaViController.swift // zhnbilibili // // Created by zhn on 16/11/21. // Copyright © 2016年 zhn. All rights reserved. // import UIKit class MainCustomNaViController: UINavigationController { override func viewDidLoad() { super.viewDidLoad() self.isNavigationBarHidden = true } override func pushViewController(_ viewController: UIViewController, animated: Bool) { if childViewControllers.count > 0 { viewController.hidesBottomBarWhenPushed = true } super.pushViewController(viewController, animated: animated) } }
[ -1 ]
e4292f58ed89291c2841e5e36bca01d005d33143
5f401b7a14ff8dffe899193d7bdd6bc6a9681a4a
/satanAnt/Break/Bucket.swift
99daf4c76b5ebb54b0026c55f1980800160a68b9
[]
no_license
murraykkkeed06/satanAnt
c1e7a7c720c49260690e20800a61d6024ecd4e31
e7b82de0a1f391de6e2fa9052821ca48589e4d22
refs/heads/master
2023-04-18T21:06:01.519901
2021-04-28T07:39:05
2021-04-28T07:39:05
350,995,792
0
0
null
null
null
null
UTF-8
Swift
false
false
812
swift
// // Stone.swift // satanAnt // // Created by 劉孟學 on 2021/4/14. // import Foundation import SpriteKit class Bucket: Break { var bucketSize = CGSize(width: 20, height: 20) init(){ let texture = SKTexture(imageNamed: "bucket") super.init(texture: texture, color: .clear, size: bucketSize) self.zPosition = 1 self.physicsBody = SKPhysicsBody(rectangleOf: bucketSize) self.physicsBody?.affectedByGravity = false self.physicsBody?.allowsRotation = false self.physicsBody?.pinned = true self.physicsBody?.contactTestBitMask = 16 self.physicsBody?.categoryBitMask = 2 self.name = "bucket" } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } }
[ -1 ]
9c0f23fa0cee9226b01ec89be7fdfc478f581cbb
b01ca439a2e2ff580b7b4d33b38d0a325f69163f
/Ryd/MVC/Controllers/RegisterVC/CompleteRegistrationVC.swift
88a05b578c0eb1a593e4b04f911bdba9bf1d96b1
[]
no_license
harshkumar861/ryd
ec2ed5b44b4da48863806146a65b25e2bbdb9456
0f2a3b568ee494fcde5e839ff6dd209bf82ac086
refs/heads/main
2023-08-03T13:36:11.607467
2021-10-02T10:22:23
2021-10-02T10:22:23
412,761,355
0
0
null
null
null
null
UTF-8
Swift
false
false
2,044
swift
// // CompleteRegistrationVC.swift // DriverApp // // Created by Harsh on 12/04/21. // Copyright © 2021 Harsh. All rights reserved. // import UIKit class CompleteRegistrationVC: UIViewController { @IBOutlet weak var lblCompleteText: UILabel! @IBOutlet weak var btnClose: UIButton! @IBOutlet weak var imgVwCompelte: UIImageView! override func viewDidLoad() { super.viewDidLoad() self.addBackButton() makeborder(sender: btnClose) } @IBAction func cancelBtnAction(_ sender: Any) { self.navigationController?.viewControllers.remove(at: 0) let vc = ViewController.getVC(.main) self.navigationController?.pushViewController(vc, animated: true) } } extension CompleteRegistrationVC { @objc func addBackButton() { let backButton = UIButton(type: .roundedRect) backButton.setImage(UIImage(named: Asset.NdBackBtn.rawValue), for: .normal) // Image can be downloaded from here below link backButton.imageView?.tintColor = UIColor.appColor backButton.titleLabel?.lineBreakMode = .byTruncatingTail backButton.setTitle("" , for: .normal) backButton.tintColor = UIColor.white backButton.titleLabel?.font = UIFont(name: Fonts.NunitoSans.Bold, size: 16) backButton.setTitleColor(backButton.tintColor, for: .normal) // You can change the TitleColor backButton.addTarget(self, action: #selector(self.backAction(_:)), for: .touchUpInside) self.navigationController?.navigationBar.shadowImage = UIImage() self.navigationController?.navigationBar.barTintColor = UIColor.appColor self.navigationController?.navigationBar.isHidden = false self.navigationController?.navigationBar.isTranslucent = false self.navigationController?.navigationBar.backgroundColor = UIColor.appColor self.navigationItem.leftBarButtonItem = UIBarButtonItem(customView: backButton) self.navigationItem.leftBarButtonItem?.tintColor = UIColor.appColor } }
[ -1 ]
87945964bac8fbafe225a9eb5f5fca0865fd574c
f54715ee3ce672da3ca996cfc7baec13565da351
/Sources/Reflections/Variable/Extensions/Variable+Extensions/Variable+Equatable.swift
a8e250317987651d28afbe7eae846ff9860b02f2
[ "MIT" ]
permissive
BSFishy/Reflections
6a020e7d3d3f5e3d136b438ada4c12bf38746b46
880535b96be3461bf6f9922d2b0364bd5aa0a9a7
refs/heads/master
2020-06-20T22:17:44.517387
2019-07-23T13:04:52
2019-07-23T13:04:52
197,269,615
1
0
null
null
null
null
UTF-8
Swift
false
false
1,170
swift
// // Variable+Equatable.swift // Reflections // // Created by Matt Provost on 7/18/19. // Copyright © 2019 Matt Provost. All rights reserved. // extension _Variable: Equatable { public static func == <LType, LPointer, RType, RPointer>(lhs: _Variable<LType, LPointer>, rhs: _Variable<RType, RPointer>) -> Bool { guard let rhsPointer: LPointer = rhs.pointer as? LPointer else { return false } return lhs.pointer == rhsPointer } } public func == <LType: Equatable, LPointer, RType>(lhs: _Variable<LType, LPointer>, rhs: RType) -> Bool { guard let rhsValue: LType = rhs as? LType else { return false } return lhs.typedValue == rhsValue } public func == <LType: Equatable, LPointer, RType>(lhs: RType, rhs: _Variable<LType, LPointer>) -> Bool { return rhs == lhs } public func == <LType, LPointer, RType: HashablePointer>(lhs: _Variable<LType, LPointer>, rhs: RType) -> Bool { guard let rhsPointer: LPointer = rhs as? LPointer else { return false } return lhs.pointer == rhsPointer } public func == <LType, LPointer, RType: HashablePointer>(lhs: RType, rhs: _Variable<LType, LPointer>) -> Bool { return rhs == lhs }
[ -1 ]
ea1a9dfd6ab97e2b7f267d688a00103213ca46e6
be349d209781a72d5e710baa975b2613a519a338
/CuraTech/Utility/AppConstant.swift
9198f1be1162d4f2f39eb531215c7070b56d8643
[]
no_license
BhumiTripathi/Dynamic_Question_Answer-
fed62d21431a1c024cd2b2c72de6ab1fd2639136
e40081119b5b47175704f5ec95b630433410e75d
refs/heads/master
2020-04-08T22:39:01.072501
2018-11-30T09:04:24
2018-11-30T09:04:24
159,795,610
0
0
null
null
null
null
UTF-8
Swift
false
false
2,320
swift
// // AppDelegate.swift // CuraTech // // Created by Bhumika tripathi on 8/11/18. // Copyright © 2018 Bhumika tripathi. All rights reserved. // import Foundation import UIKit let FRAME_WIDTH = UIScreen.main.bounds.size.width let FRAME_HEIGHT = UIScreen.main.bounds.size.height struct AppConstant { //ScreenSize static let FRAME_WIDTH = UIScreen.main.bounds.size.width static let FRAME_HEIGHT = UIScreen.main.bounds.size.height static var FRAME_MAX_LENGTH : CGFloat { get{ return max(AppConstant.FRAME_WIDTH, FRAME_HEIGHT) } } static var FRAME_MIN_LENGTH : CGFloat { get{ return min(AppConstant.FRAME_WIDTH, FRAME_HEIGHT) } } //DeviceType static var IS_IPHONE_4_OR_LESS : Bool { get{ return UIDevice.current.userInterfaceIdiom == .phone && AppConstant.FRAME_MAX_LENGTH < 568.0 } } static var IS_IPHONE_5 : Bool { get{ return UIDevice.current.userInterfaceIdiom == .phone && AppConstant.FRAME_MAX_LENGTH == 568.0} } static var IS_IPHONE_6 : Bool { get{ return UIDevice.current.userInterfaceIdiom == .phone && AppConstant.FRAME_MAX_LENGTH == 667.0 } } static var IS_IPHONE_6P : Bool { get{ return UIDevice.current.userInterfaceIdiom == .phone && AppConstant.FRAME_MAX_LENGTH == 736.0} } static var IS_IPHONE_X : Bool { get{ return UIDevice.current.userInterfaceIdiom == .phone && AppConstant.FRAME_MAX_LENGTH == 812.0} } static var IS_IPAD_AIR : Bool { get{ return UIDevice.current.userInterfaceIdiom == .pad && AppConstant.FRAME_MAX_LENGTH == 1024.0} } static var IS_IPAD_PRO : Bool { get{ return UIDevice.current.userInterfaceIdiom == .pad && AppConstant.FRAME_MAX_LENGTH == 1366.0} } static let IS_IPAD = UIDevice.current.userInterfaceIdiom == .pad static let IS_IPHONE = UIDevice.current.userInterfaceIdiom == .phone static let IS_LANDSCAPE = UIApplication.shared.statusBarOrientation == .landscapeLeft || UIApplication.shared.statusBarOrientation == .landscapeRight static let IS_POTRAIT = UIApplication.shared.statusBarOrientation == .portrait static let cardSpacing : CGFloat = 32.0 }
[ -1 ]
143f3ee8ceedfd71c12ea0751453f7b6b3a919c5
58e007e0dc67d9c72be5867d6619e67e0f3fd45c
/Transitor/Classes/TransitorFadeInPresentation.swift
1a5a3f2d0d9831d2abb2da21f4acfe4ca03f764b
[ "MIT" ]
permissive
sambhav7890/Transitor
08682cff59641820eb8e5cc75c8e43f414668c79
b52bb7c2fc76927961dacd4149581a08542950a1
refs/heads/master
2021-05-02T04:21:13.590406
2016-12-14T09:40:11
2016-12-14T09:40:11
76,445,763
0
0
null
null
null
null
UTF-8
Swift
false
false
2,113
swift
// // TransitorFadeInPresentation.swift // Created by Sambhav Shah on 14/12/2016 // import Foundation public struct TransitorFadeInPresentation: TransitorPresentation, AlignablePresentation { // Transitor Presentation Protocol conformance public private(set) var dismissCurve: TransitorConstants.TransitorCurve = .linear public private(set) var presentationCurve: TransitorConstants.TransitorCurve = .linear public private(set) var cornerRadius: Double = 0.0 public private(set) var backgroundStyle: TransitorConstants.BackgroundStyle = .dimmed public private(set) var duration : TransitorConstants.Duration = .normal // Duration the ViewController needs to kick in public private(set) var widthForViewController: TransitorConstants.Size = .fullscreen public private(set) var heightForViewController: TransitorConstants.Size = .fullscreen public private(set) var marginGuards: UIEdgeInsets = .zero // Alginable public private(set) var horizontalAlignment: TransitorConstants.HorizontalAlignment = .center public private(set) var verticalAlignemt: TransitorConstants.VerticalAlignment = .center public init(dismissCurve: TransitorConstants.TransitorCurve = .linear, presentationCurve: TransitorConstants.TransitorCurve = .linear, cornerRadius: Double = 0.0, backgroundStyle: TransitorConstants.BackgroundStyle = .dimmed, duration: TransitorConstants.Duration = .normal, widthForViewController: TransitorConstants.Size = .fullscreen, heightForViewController: TransitorConstants.Size = .fullscreen, marginGuards: UIEdgeInsets = .zero) { self.dismissCurve = dismissCurve self.presentationCurve = presentationCurve self.cornerRadius = cornerRadius self.backgroundStyle = backgroundStyle self.duration = duration self.widthForViewController = widthForViewController self.heightForViewController = heightForViewController self.marginGuards = marginGuards } }
[ -1 ]
84cba0eb503e30eaec7579ade7e28548147bb4bd
83c83d9a3abe462210f2e9f1185fc31ec6d8f77e
/test/SILGen/runtime_attributes.swift
ae1a57adb876b9d2952e1af879f5e23a28b40263
[ "Apache-2.0", "Swift-exception" ]
permissive
monolithic-adam/swift
55f0920c2d0fde4bade35333d0a87ab38fdd5491
6991319a3d85b79970b21b111f52793788330e07
refs/heads/main
2023-01-20T00:18:58.676197
2023-01-16T00:43:16
2023-01-16T00:43:16
null
0
0
null
null
null
null
UTF-8
Swift
false
false
5,044
swift
// RUN: %empty-directory(%t) // RUN: %target-swift-frontend -enable-experimental-feature RuntimeDiscoverableAttrs -emit-module -o %t -enable-library-evolution %S/Inputs/runtime_metadata_defs.swift // This uses '-primary-file' to ensure we're conservative with lazy SIL emission. // RUN: %target-swift-emit-silgen -enable-experimental-feature RuntimeDiscoverableAttrs -primary-file %s -I %t | %FileCheck %s // REQUIRES: asserts import runtime_metadata_defs /// Test that generator has source locations for both explicit and inferred attributes. // CHECK-LABEL: sil hidden [runtime_accessible] [ossa] @$s18runtime_attributes4TestAaBVmvpfa0A14_metadata_defs6Ignore : $@convention(thin) () -> @out Optional<Ignore> // CHECK: [[FILE_ID:%.*]] = string_literal utf8 "runtime_attributes/runtime_attributes.swift" // CHECK: [[STRING_INIT:%.*]] = function_ref @$sSS21_builtinStringLiteral17utf8CodeUnitCount7isASCIISSBp_BwBi1_tcfC // CHECK-NEXT: [[FILE_STR:%.*]] = apply [[STRING_INIT]]([[FILE_ID]], {{.*}}) // CHECK: [[LINE_RAW:%.*]] = integer_literal $Builtin.IntLiteral, 25 // CHECK: [[INT_INIT:%.*]] = function_ref @$sSi22_builtinIntegerLiteralSiBI_tcfC // CHECK-NEXT: [[LINE:%.*]] = apply [[INT_INIT]]([[LINE_RAW]], {{.*}}) // CHECK: [[COLUMN_RAW:%.*]] = integer_literal $Builtin.IntLiteral, 1 // CHECK: [[INT_INIT:%.*]] = function_ref @$sSi22_builtinIntegerLiteralSiBI_tcfC // CHECK-NEXT: [[COLUMN:%.*]] = apply [[INT_INIT]]([[COLUMN_RAW]], {{.*}}) // CHECK: [[IGNORE_INIT:%.*]] = function_ref @$s21runtime_metadata_defs6IgnoreV10attachedTo6fileID4line6columnACx_SSS2itclufC // CHECK-NEXT: {{.*}} = apply [[IGNORE_INIT]]<Test.Type>({{.*}}, {{.*}}, [[FILE_STR]], [[LINE]], [[COLUMN]], {{.*}}) struct Test : Ignorable {} // CHECK-LABEL: sil hidden [runtime_accessible] [ossa] @$s18runtime_attributes8globalFnyycvpfa0A14_metadata_defs6Ignore : $@convention(thin) () -> @out Optional<Ignore> // CHECK: {{.*}} = string_literal utf8 "runtime_attributes/runtime_attributes.swift" // CHECK: {{.*}} = integer_literal $Builtin.IntLiteral, 33 // CHECK: {{.*}} = integer_literal $Builtin.IntLiteral, 2 // CHECK: [[IGNORE_INIT:%.*]] = function_ref @$s21runtime_metadata_defs6IgnoreV10attachedTo6fileID4line6columnACx_SSS2itclufC // CHECK-NEXT: {{.*}} = apply [[IGNORE_INIT]]<() -> ()>({{.*}}) @Ignore func globalFn() {} struct MemberTests { // CHECK-LABEL: sil hidden [runtime_accessible] [ossa] @$s18runtime_attributes11MemberTestsV1xSivpfa0A14_metadata_defs6Ignore : $@convention(thin) () -> @out Optional<Ignore> // CHECK: {{.*}} = string_literal utf8 "runtime_attributes/runtime_attributes.swift" // CHECK: {{.*}} = integer_literal $Builtin.IntLiteral, 42 // CHECK: {{.*}} = integer_literal $Builtin.IntLiteral, 4 // CHECK: [[IGNORE_INIT:%.*]] = function_ref @$s21runtime_metadata_defs6IgnoreV10attachedTo6fileID4line6columnACx_SSS2itclufC // CHECK-NEXT: {{.*}} = apply [[IGNORE_INIT]]<WritableKeyPath<MemberTests, Int>>({{.*}}) @Ignore var x: Int = 42 // CHECK-LABEL: sil hidden [runtime_accessible] [ossa] @$s18runtime_attributes11MemberTestsV6instFn_1xSSSi_SaySiGtcvpfa0A14_metadata_defs6Ignore : $@convention(thin) () -> @out Optional<Ignore> // CHECK: {{.*}} = string_literal utf8 "runtime_attributes/runtime_attributes.swift" // CHECK: {{.*}} = integer_literal $Builtin.IntLiteral, 50 // CHECK: {{.*}} = integer_literal $Builtin.IntLiteral, 4 // CHECK: [[IGNORE_INIT:%.*]] = function_ref @$s21runtime_metadata_defs6IgnoreV10attachedTo6fileID4line6columnACx_SSS2itclufC // CHECK-NEXT: {{.*}} = apply [[IGNORE_INIT]]<(MemberTests, Int, [Int]) -> String>({{.*}}) @Ignore func instFn(_: Int, x: [Int]) -> String { "" } // CHECK-LABEL: sil hidden [runtime_accessible] [ossa] @$s18runtime_attributes11MemberTestsV8staticFn_1ySi_SStSS_SiztcvpZfa0A14_metadata_defs6Ignore : $@convention(thin) () -> @out Optional<Ignore> // CHECK: {{.*}} = string_literal utf8 "runtime_attributes/runtime_attributes.swift" // CHECK: {{.*}} = integer_literal $Builtin.IntLiteral, 58 // CHECK: {{.*}} = integer_literal $Builtin.IntLiteral, 4 // CHECK: [[IGNORE_INIT:%.*]] = function_ref @$s21runtime_metadata_defs6IgnoreV10attachedTo6fileID4line6columnACx_SSS2itclufC // CHECK-NEXT: {{.*}} = apply [[IGNORE_INIT]]<(MemberTests.Type, String, inout Int) -> (Int, String)>({{.*}}) @Ignore static func staticFn(_ x: String, y: inout Int) -> (Int, String) { (42, "") } // CHECK-LABEL: sil hidden [runtime_accessible] [ossa] @$s18runtime_attributes11MemberTestsV10mutatingFnSiycvpfa0A14_metadata_defs6Ignore : $@convention(thin) () -> @out Optional<Ignore> // CHECK: {{.*}} = string_literal utf8 "runtime_attributes/runtime_attributes.swift" // CHECK: {{.*}} = integer_literal $Builtin.IntLiteral, 66 // CHECK: {{.*}} = integer_literal $Builtin.IntLiteral, 4 // CHECK: [[IGNORE_INIT:%.*]] = function_ref @$s21runtime_metadata_defs6IgnoreV10attachedTo6fileID4line6columnACx_SSS2itclufC // CHECK-NEXT: {{.*}} = apply [[IGNORE_INIT]]<(inout MemberTests) -> Int>({{.*}}) @Ignore mutating func mutatingFn() -> Int { 42 } }
[ -1 ]
eb33d5e1e63c9949bdd494854a834681eb7f9195
f39810fc8c6acc5477bb1f2283af96e794702072
/TestAPIApp/Model/Session.swift
4b6ac1f362805c641e2ca93a711650ed8fec38f8
[]
no_license
vsevolod997/TestAPIApp
0902ac337fe72fb804b678646a7596ed87152bce
8d0754e0503d70970612731f099303213e5efb68
refs/heads/master
2020-08-29T10:33:34.434330
2019-10-28T09:10:29
2019-10-28T09:10:29
218,007,264
0
0
null
null
null
null
UTF-8
Swift
false
false
343
swift
// // Session.swift // TestAPIApp // // Created by Всеволод Андрющенко on 18.10.2019. // Copyright © 2019 Всеволод Андрющенко. All rights reserved. // import Foundation class SessionSingeltone{ static let session = SessionSingeltone() var tokenStrings:String = "" private init(){} }
[ -1 ]
70b7798c8f6b1f06c93f9d22bc742dde489412b2
7d8bcab2a50cdb415e8a3d003b2a95d09556e196
/Charts-Tutorial/Charts-Tutorial/ViewController.swift
ac7dba575d5513f8d4268503ea8ff10c3446a4b5
[]
no_license
aalicechan/iOS-Charts-Tutorial
bd238b3c95436652bef6f1b55f9ee3b00a51898e
deb7281985e234c9d0ede72e668665f9944f2d78
refs/heads/main
2023-06-03T21:30:20.272990
2021-06-21T09:55:56
2021-06-21T09:55:56
377,416,544
0
0
null
null
null
null
UTF-8
Swift
false
false
6,291
swift
// // ViewController.swift // Charts-Tutorial // // Created by INTENG CHAN on 16/06/2021. // import UIKit import Charts class ViewController: UIViewController { @IBOutlet weak var lineChartBox: LineChartView! @IBOutlet weak var pieChartBox: PieChartView! @IBOutlet weak var barChartBox: BarChartView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. let data = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3] graphLineChart(dataArray: data) graphPieChart(dataArray: data) graphBarChart(dataArray: data) } func graphLineChart(dataArray: [Int]){ // Make lineChartBox size have width and height both equal to width of screen lineChartBox.frame = CGRect(x: 0, y:0, width: self.view.frame.size.width, height: self.view.frame.size.width / 2) // Make lineChartBox center to be horizontally centered, but // offset towards the top of the screen lineChartBox.center.x = self.view.center.x lineChartBox.center.y = self.view.center.y - 240 // Settings when chart has no data lineChartBox.noDataText = "No Data Available." lineChartBox.noDataTextColor = UIColor.black // Initialize Array that will eventually be displayed on the graph. var entries = [ChartDataEntry]() // For every element in given dataset // Set the X and Y coordinated in a data chart entry // and add to the entries list for i in 0..<dataArray.count { let value = ChartDataEntry(x: Double(i), y: Double(dataArray[i])) entries.append(value) } // Use the entries object and a label string to make a LineChartDataSet object let dataSet = LineChartDataSet(entries: entries, label: "Line Chart") // Customize graph settings to your liking dataSet.colors = ChartColorTemplates.joyful() // Make object that will be added to the chart // and set it to the variable in the Storyboard let data = LineChartData(dataSet: dataSet) lineChartBox.data = data // Add settings for the chartBox lineChartBox.chartDescription?.text = "Pi Values" // Amimations lineChartBox.animate(xAxisDuration: 2.0, yAxisDuration: 2.0, easingOption: .linear) } func graphPieChart(dataArray: [Int]){ // Make lineChartBox size have width and height both equal to width of screen pieChartBox.frame = CGRect(x: 0, y:0, width: self.view.frame.size.width, height: self.view.frame.size.width / 2) // Make lineChartBox center to be horizontally centered, but // offset towards the top of the screen pieChartBox.center.x = self.view.center.x pieChartBox.center.y = self.view.center.y // Settings when chart has no data pieChartBox.noDataText = "No Data Available." pieChartBox.noDataTextColor = UIColor.black // Initialize Array that will eventually be displayed on the graph. var entries = [ChartDataEntry]() // For every element in given dataset // Set the X and Y coordinated in a data chart entry // and add to the entries list for i in 0..<dataArray.count { let value = ChartDataEntry(x: Double(i), y: Double(dataArray[i])) entries.append(value) } // Use the entries object and a label string to make a LineChartDataSet object let dataSet = PieChartDataSet(entries: entries, label: "Pie Chart") // Customize graph settings to your liking dataSet.colors = ChartColorTemplates.colorful() // Make object that will be added to the chart // and set it to the variable in the Storyboard let data = PieChartData(dataSet: dataSet) pieChartBox.data = data // Add settings for the chartBox pieChartBox.chartDescription?.text = "Pi Values" // Amimations pieChartBox.animate(xAxisDuration: 2.0, yAxisDuration: 2.0, easingOption: .linear) } func graphBarChart(dataArray: [Int]){ // Make lineChartBox size have width and height both equal to width of screen barChartBox.frame = CGRect(x: 0, y:0, width: self.view.frame.size.width, height: self.view.frame.size.width / 2) // Make lineChartBox center to be horizontally centered, but // offset towards the top of the screen barChartBox.center.x = self.view.center.x barChartBox.center.y = self.view.center.y + 240 // Settings when chart has no data barChartBox.noDataText = "No Data Available." barChartBox.noDataTextColor = UIColor.black // Initialize Array that will eventually be displayed on the graph. var entries = [BarChartDataEntry]() // For every element in given dataset // Set the X and Y coordinated in a data chart entry // and add to the entries list for i in 0..<dataArray.count { let value = BarChartDataEntry(x: Double(i), y: Double(dataArray[i])) entries.append(value) } // Use the entries object and a label string to make a LineChartDataSet object let dataSet = BarChartDataSet(entries: entries, label: "Bar Chart") // Customize graph settings to your liking dataSet.colors = ChartColorTemplates.joyful() // Make object that will be added to the chart // and set it to the variable in the Storyboard let data = BarChartData(dataSet: dataSet) barChartBox.data = data // Add settings for the chartBox barChartBox.chartDescription?.text = "Pi Values" // Amimations barChartBox.animate(xAxisDuration: 2.0, yAxisDuration: 2.0, easingOption: .linear) } }
[ -1 ]
0743544e1e1f78f3c89ce7faaedc2204dc6e6a88
c948193b5942e104513aa7e7df5dd9951eb08464
/Sources/SourceControl/Repository.swift
a6108e59a3e9b06f79da8e6032e77cc64bc24eda
[ "Apache-2.0", "BSD-3-Clause", "MIT", "LicenseRef-scancode-unknown-license-reference", "Swift-exception" ]
permissive
tonyarnold/swift-package-manager
57750b313c384d0d83020ffa81bdb749d412df4a
57004732380a97ee919635f4772855176761d051
refs/heads/master
2022-12-10T15:45:14.928176
2022-12-08T00:32:28
2022-12-08T00:32:28
275,718,611
0
0
Apache-2.0
2020-06-29T03:13:31
2020-06-29T03:13:30
null
UTF-8
Swift
false
false
11,682
swift
//===----------------------------------------------------------------------===// // // This source file is part of the Swift open source project // // Copyright (c) 2014-2020 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See http://swift.org/LICENSE.txt for license information // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// import Foundation import TSCBasic import Basics /// Specifies a repository address. public struct RepositorySpecifier: Hashable { public let location: Location public init(location: Location) { self.location = location } /// Create a specifier based on a path. public init(path: AbsolutePath) { self.init(location: .path(path)) } /// Create a specifier on a URL. public init(url: URL) { self.init(location: .url(url)) } /// The location of the repository as URL. public var url: URL { switch self.location { case .path(let path): return URL(fileURLWithPath: path.pathString) case .url(let url): return url } } /// Returns the cleaned basename for the specifier. public var basename: String { var basename = self.url.pathComponents.dropFirst(1).last(where: { !$0.isEmpty }) ?? "" if basename.hasSuffix(".git") { basename = String(basename.dropLast(4)) } return basename } public enum Location: Hashable, CustomStringConvertible { case path(AbsolutePath) case url(URL) public var description: String { switch self { case .path(let path): return path.pathString case .url(let url): return url.absoluteString } } } } extension RepositorySpecifier: CustomStringConvertible { public var description: String { return self.location.description } } /// A repository provider. /// /// This protocol defines the lower level interface used to to access /// repositories. High-level clients should access repositories via a /// `RepositoryManager`. public protocol RepositoryProvider: Cancellable { /// Fetch the complete repository at the given location to `path`. /// /// - Parameters: /// - repository: The specifier of the repository to fetch. /// - path: The destination path for the fetch. /// - progress: Reports the progress of the current fetch operation. /// - Throws: If there is any error fetching the repository. func fetch(repository: RepositorySpecifier, to path: AbsolutePath, progressHandler: FetchProgress.Handler?) throws /// Returns true if a repository exists at `path` func repositoryExists(at path: AbsolutePath) throws -> Bool /// Open the given repository. /// /// - Parameters: /// - repository: The specifier of the original repository from which the /// local clone repository was created. /// - path: The location of the repository on disk, at which the /// repository has previously been created via `fetch`. /// /// - Throws: If the repository is unable to be opened. func open(repository: RepositorySpecifier, at path: AbsolutePath) throws -> Repository /// Create a working copy from a managed repository. /// /// Once complete, the repository can be opened using `openWorkingCopy`. Note /// that there is no requirement that the files have been materialized into /// the file system at the completion of this call, since it will always be /// followed by checking out the cloned working copy at a particular ref. /// /// - Parameters: /// - repository: The specifier of the original repository from which the /// local clone repository was created. /// - sourcePath: The location of the repository on disk, at which the /// repository has previously been created via `fetch`. /// - destinationPath: The path at which to create the working copy; it is /// expected to be non-existent when called. /// - editable: The checkout is expected to be edited by users. /// /// - Throws: If there is any error cloning the repository. func createWorkingCopy( repository: RepositorySpecifier, sourcePath: AbsolutePath, at destinationPath: AbsolutePath, editable: Bool) throws -> WorkingCheckout /// Returns true if a working repository exists at `path` func workingCopyExists(at path: AbsolutePath) throws -> Bool /// Open a working repository copy. /// /// - Parameters: /// - path: The location of the repository on disk, at which the repository /// has previously been created via `copyToWorkingDirectory`. func openWorkingCopy(at path: AbsolutePath) throws -> WorkingCheckout /// Copies the repository at path `from` to path `to`. /// - Parameters: /// - sourcePath: the source path. /// - destinationPath: the destination path. func copy(from sourcePath: AbsolutePath, to destinationPath: AbsolutePath) throws /// Returns true if the directory is valid git location. func isValidDirectory(_ directory: AbsolutePath) -> Bool /// Returns true if the git reference name is well formed. func isValidRefFormat(_ ref: String) -> Bool } /// Abstract repository operations. /// /// This interface provides access to an abstracted representation of a /// repository which is ultimately owned by a `RepositoryManager`. This interface /// is designed in such a way as to provide the minimal facilities required by /// the package manager to gather basic information about a repository, but it /// does not aim to provide all of the interfaces one might want for working /// with an editable checkout of a repository on disk. /// /// The goal of this design is to allow the `RepositoryManager` a large degree of /// flexibility in the storage and maintenance of its underlying repositories. /// /// This protocol is designed under the assumption that the repository can only /// be mutated via the functions provided here; thus, e.g., `tags` is expected /// to be unchanged through the lifetime of an instance except as otherwise /// documented. The behavior when this assumption is violated is undefined, /// although the expectation is that implementations should throw or crash when /// an inconsistency can be detected. public protocol Repository { /// Get the list of tags in the repository. func getTags() throws -> [String] /// Resolve the revision for a specific tag. /// /// - Precondition: The `tag` should be a member of `tags`. /// - Throws: If a error occurs accessing the named tag. func resolveRevision(tag: String) throws -> Revision /// Resolve the revision for an identifier. /// /// The identifier can be a branch name or a revision identifier. /// /// - Throws: If the identifier can not be resolved. func resolveRevision(identifier: String) throws -> Revision /// Fetch and update the repository from its remote. /// /// - Throws: If an error occurs while performing the fetch operation. func fetch() throws /// Fetch and update the repository from its remote. /// /// - Throws: If an error occurs while performing the fetch operation. func fetch(progress: FetchProgress.Handler?) throws /// Returns true if the given revision exists. func exists(revision: Revision) -> Bool /// Open an immutable file system view for a particular revision. /// /// This view exposes the contents of the repository at the given revision /// as a file system rooted inside the repository. The repository must /// support opening multiple views concurrently, but the expectation is that /// clients should be prepared for this to be inefficient when performing /// interleaved accesses across separate views (i.e., the repository may /// back the view by an actual file system representation of the /// repository). /// /// It is expected behavior that attempts to mutate the given FileSystem /// will fail or crash. /// /// - Throws: If an error occurs accessing the revision. func openFileView(revision: Revision) throws -> FileSystem /// Open an immutable file system view for a particular tag. /// /// This view exposes the contents of the repository at the given revision /// as a file system rooted inside the repository. The repository must /// support opening multiple views concurrently, but the expectation is that /// clients should be prepared for this to be inefficient when performing /// interleaved accesses across separate views (i.e., the repository may /// back the view by an actual file system representation of the /// repository). /// /// It is expected behavior that attempts to mutate the given FileSystem /// will fail or crash. /// /// - Throws: If an error occurs accessing the revision. func openFileView(tag: String) throws -> FileSystem } extension Repository { public func fetch(progress: FetchProgress.Handler?) throws { try fetch() } } /// An editable checkout of a repository (i.e. a working copy) on the local file /// system. public protocol WorkingCheckout { /// Get the list of tags in the repository. func getTags() throws -> [String] /// Get the current revision. func getCurrentRevision() throws -> Revision /// Fetch and update the repository from its remote. /// /// - Throws: If an error occurs while performing the fetch operation. func fetch() throws /// Query whether the checkout has any commits which are not pushed to its remote. func hasUnpushedCommits() throws -> Bool /// This check for any modified state of the repository and returns true /// if there are uncommited changes. func hasUncommittedChanges() -> Bool /// Check out the given tag. func checkout(tag: String) throws /// Check out the given revision. func checkout(revision: Revision) throws /// Returns true if the given revision exists. func exists(revision: Revision) -> Bool /// Create a new branch and checkout HEAD to it. /// /// Note: It is an error to provide a branch name which already exists. func checkout(newBranch: String) throws /// Returns true if there is an alternative store in the checkout and it is valid. func isAlternateObjectStoreValid() -> Bool /// Returns true if the file at `path` is ignored by `git` func areIgnored(_ paths: [AbsolutePath]) throws -> [Bool] } /// A single repository revision. public struct Revision: Hashable { /// A precise identifier for a single repository revision, in a repository-specified manner. /// /// This string is intended to be opaque to the client, but understandable /// by a user. For example, a Git repository might supply the SHA1 of a /// commit, or an SVN repository might supply a string such as 'r123'. public let identifier: String public init(identifier: String) { self.identifier = identifier } } public protocol FetchProgress { typealias Handler = (FetchProgress) -> Void var message: String { get } var step: Int { get } var totalSteps: Int? { get } /// The current download progress including the unit var downloadProgress: String? { get } /// The current download speed including the unit var downloadSpeed: String? { get } }
[ -1 ]
24b720e86b8a069a11aea0129e3a8841e358c832
80dedcc80ab0b855fece98aa7e03a65d501c8196
/MyViewIntroTests/MyViewIntroTests.swift
9f5e12f19e471f0fdcd3d8f09b1f343284148c4a
[]
no_license
Jamlx/MyViewIntro
83c606563e046be95cdef10833805d77d12d4ef2
93829386da28bb17616dfdabb173f2743de5a72e
refs/heads/master
2020-09-01T01:27:31.488687
2019-10-31T19:16:30
2019-10-31T19:16:30
218,842,095
0
0
null
null
null
null
UTF-8
Swift
false
false
927
swift
// // MyViewIntroTests.swift // MyViewIntroTests // // Created by James Cavanaugh on 10/31/19. // Copyright © 2019 James Cavanaugh. All rights reserved. // import XCTest @testable import MyViewIntro class MyViewIntroTests: XCTestCase { override func setUp() { // Put setup code here. This method is called before the invocation of each test method in the class. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. } func testExample() { // This is an example of a functional test case. // Use XCTAssert and related functions to verify your tests produce the correct results. } func testPerformanceExample() { // This is an example of a performance test case. self.measure { // Put the code you want to measure the time of here. } } }
[ 360462, 98333, 16419, 229413, 204840, 278570, 344107, 155694, 253999, 229430, 319542, 163896, 180280, 376894, 352326, 311372, 196691, 278615, 385116, 237663, 254048, 319591, 221290, 278634, 319598, 352368, 204916, 131191, 237689, 278655, 278677, 196760, 426138, 278685, 311458, 278691, 49316, 32941, 278704, 377009, 278708, 180408, 131256, 295098, 139479, 254170, 229597, 311519, 205035, 286958, 327929, 344313, 147717, 368905, 180493, 254226, 319763, 368916, 262421, 377114, 237856, 237857, 278816, 311597, 98610, 336183, 180535, 278842, 287041, 319821, 254286, 344401, 377169, 368981, 155990, 368984, 106847, 98657, 270701, 246127, 270706, 246136, 139640, 246137, 311685, 106888, 385417, 311691, 385422, 213403, 246178, 385454, 311727, 377264, 319930, 311738, 33211, 336317, 278970, 336320, 311745, 278978, 254406, 188871, 278993, 278999, 328152, 369116, 287198, 279008, 279013, 279018, 319981, 319987, 279029, 254456, 279032, 377338, 377343, 279039, 254465, 287241, 279050, 139792, 303636, 393751, 279065, 377376, 377386, 197167, 385588, 352829, 115270, 385615, 426576, 369235, 139872, 66150, 344680, 139892, 287352, 344696, 279164, 189057, 311941, 336518, 311945, 369289, 344715, 279177, 311949, 287374, 377489, 311954, 352917, 230040, 271000, 377497, 303771, 377500, 205471, 344738, 139939, 279206, 295590, 287404, 205487, 303793, 336564, 164533, 287417, 287422, 66242, 377539, 164560, 385747, 279252, 361176, 418520, 287452, 295652, 246503, 369385, 312052, 312053, 172792, 344827, 221948, 205568, 295682, 336648, 197386, 434957, 312079, 426774, 197399, 426775, 336671, 344865, 197411, 279336, 295724, 353069, 197422, 353070, 164656, 295729, 312108, 328499, 353078, 197431, 230199, 353079, 336702, 353094, 353095, 353109, 377686, 230234, 189275, 435039, 295776, 303972, 385893, 246641, 246643, 295798, 246648, 361337, 279417, 254850, 369538, 287622, 295824, 189348, 353195, 140204, 377772, 353197, 304051, 230332, 377790, 353215, 353216, 213957, 213960, 345033, 279498, 386006, 418776, 50143, 123881, 304110, 320494, 271350, 295927, 304122, 320507, 328700, 328706, 410627, 320516, 295942, 386056, 353290, 230410, 377869, 320527, 238610, 418837, 140310, 320536, 197657, 336929, 369701, 345132, 238639, 312373, 238651, 336960, 377926, 238664, 353367, 156764, 156765, 304222, 173166, 377972, 353397, 337017, 377983, 402565, 279685, 222343, 386189, 296086, 238743, 296092, 238765, 279728, 238769, 402613, 353479, 353481, 402634, 353482, 189653, 419029, 148696, 296153, 279774, 304351, 304356, 222440, 328940, 279792, 353523, 386294, 386301, 320770, 386306, 279814, 328971, 312587, 353551, 320796, 222494, 353584, 345396, 386359, 312634, 116026, 378172, 222524, 279875, 345415, 312648, 337225, 304456, 230729, 238927, 353616, 296273, 222559, 378209, 230756, 386412, 230765, 279920, 312689, 296307, 116084, 337281, 148867, 378244, 296329, 296335, 9619, 370071, 279974, 173491, 304564, 353719, 361927, 370123, 148940, 280013, 312782, 222675, 353750, 271843, 280041, 361963, 296433, 321009, 280055, 288249, 329225, 230921, 296461, 304656, 329232, 370197, 402985, 394794, 230959, 312880, 288309, 312889, 288318, 124485, 288326, 288327, 239198, 99938, 345700, 312940, 222832, 247416, 337534, 337535, 263809, 288392, 239250, 419478, 345752, 255649, 321199, 337591, 321207, 296632, 280251, 321219, 280267, 403148, 9936, 9937, 370388, 272085, 345814, 181975, 280278, 280280, 18138, 345821, 321247, 321249, 345833, 345834, 280300, 67315, 173814, 313081, 124669, 288512, 288516, 280329, 321302, 345879, 116505, 321310, 255776, 247590, 362283, 378668, 296755, 321337, 345919, 436031, 403267, 345929, 18262, 362327, 370522, 345951, 362337, 345955, 296806, 288619, 214895, 313199, 362352, 313203, 124798, 182144, 305026, 247686, 67463, 329622, 337815, 124824, 214937, 436131, 354212, 436137, 362417, 124852, 288697, 362431, 214977, 174019, 214984, 321480, 362443, 247757, 280541, 329695, 436191, 313319, 337895, 174057, 247785, 436205, 329712, 362480, 313339, 43014, 354316, 313357, 182296, 223268, 329765, 354345, 223274, 124975, 346162, 124984, 288828, 436285, 288833, 288834, 436292, 403525, 436301, 338001, 354385, 338003, 280661, 329814, 338007, 354393, 280675, 321637, 280677, 43110, 313447, 436329, 288879, 280694, 215164, 313469, 215166, 329859, 280712, 215178, 346271, 436383, 362659, 239793, 125109, 182456, 379071, 338119, 149703, 346314, 321745, 387296, 280802, 379106, 338150, 346346, 321772, 125169, 338164, 436470, 125183, 149760, 411906, 125188, 313608, 125193, 125198, 272658, 125203, 338197, 125208, 305440, 125217, 338218, 321840, 379186, 125235, 280887, 125240, 321860, 182598, 289110, 215385, 272729, 379225, 354655, 321894, 280939, 354676, 436608, 362881, 240002, 436611, 248194, 395659, 395661, 108944, 240016, 190871, 149916, 420253, 141728, 289189, 108972, 272813, 338356, 436661, 289232, 281040, 256477, 330218, 281072, 109042, 174593, 240131, 420369, 289304, 322078, 207393, 182817, 289332, 174648, 338489, 338490, 322120, 281166, 297560, 354911, 436832, 436834, 191082, 313966, 420463, 281199, 346737, 313971, 346740, 420471, 330379, 330387, 117396, 346772, 330388, 264856, 289434, 346779, 338613, 314040, 109241, 158394, 248517, 363211, 363230, 289502, 264928, 338662, 330474, 346858, 289518, 322291, 199414, 35583, 363263, 191235, 322316, 117517, 322319, 166676, 207640, 289576, 191283, 273207, 289598, 420677, 281427, 281433, 109409, 330609, 207732, 158593, 240518, 109447, 224145, 355217, 256922, 289690, 420773, 289703, 363438, 347055, 289727, 273344, 330689, 363458, 379844, 19399, 338899, 248796, 248797, 207838, 347103, 314342, 289774, 347123, 240630, 314362, 257024, 330754, 330763, 322582, 281626, 248872, 322612, 314448, 339030, 314467, 281700, 257125, 322663, 273515, 207979, 404593, 363641, 363644, 150657, 248961, 330888, 363669, 339100, 380061, 429214, 199839, 339102, 265379, 249002, 306346, 3246, 421048, 339130, 322749, 265412, 290000, 298208, 298212, 298213, 330984, 298221, 298228, 216315, 208124, 363771, 388349, 437505, 322824, 257305, 126237, 339234, 208164, 372009, 412971, 306494, 216386, 224586, 372043, 331090, 314710, 372054, 159066, 314720, 314726, 380271, 314739, 208244, 249204, 249205, 290173, 306559, 314751, 298374, 314758, 314760, 142729, 388487, 314766, 306579, 282007, 290207, 314783, 314789, 314791, 396711, 396712, 241066, 282024, 314798, 380337, 380338, 150965, 380357, 339398, 306639, 413137, 429542, 191981, 290301, 282114, 372227, 323080, 323087, 175639, 388632, 396827, 134686, 282146, 306723, 347694, 290358, 265798, 265804, 396882, 290390, 44635, 396895, 323172, 282213, 323178, 224883, 314998, 323196, 175741, 339584, 224901, 282245, 282246, 323217, 282259, 323236, 298661, 282280, 224946, 110268, 224958, 323263, 282303, 274115, 306890, 241361, 241365, 298712, 298720, 12010, 282348, 282358, 175873, 339715, 323332, 323331, 339720, 372496, 323346, 249626, 282400, 339745, 241442, 241441, 257830, 421672, 282417, 282427, 315202, 307011, 159562, 216918, 241495, 241528, 339841, 315273, 315274, 372626, 380821, 282518, 282519, 118685, 298909, 323507, 290745, 274371, 151497, 372701, 298980, 380908, 282633, 241692, 102437, 315432, 315434, 102445, 233517, 176175, 241716, 241720, 225351, 315465, 315476, 307289, 200794, 315487, 356447, 438377, 315498, 299121, 233589, 266357, 422019, 241808, 381073, 323729, 233636, 299174, 405687, 184505, 299198, 258239, 389313, 299203, 299209, 372941, 282831, 266449, 356576, 176362, 307435, 438511, 381172, 184570, 12542, 184575, 381208, 299293, 151839, 233762, 217380, 151847, 282919, 332083, 127284, 332085, 332089, 315706, 282939, 241986, 438596, 332101, 323913, 348492, 323916, 323920, 250192, 348500, 168281, 332123, 332127, 323935, 242023, 242029, 160110, 242033, 250226, 291192, 340357, 225670, 242058, 373134, 291224, 242078, 283038, 61857, 315810, 315811, 381347, 61859, 340398, 61873, 61880, 283064, 127427, 127428, 283075, 324039, 373197, 176601, 242139, 160225, 242148, 127465, 291311, 233978, 324097, 291333, 340490, 258581, 291358, 283184, 234036, 315960, 348732, 242237, 70209, 348742, 70215, 348749, 340558, 381517, 332378, 201308, 242277, 111208, 184940, 373358, 389745, 209530, 373375, 152195, 348806, 184973, 316049, 111253, 316053, 111258, 111259, 176808, 299699, 299700, 422596, 422599, 291530, 225995, 242386, 422617, 422626, 234217, 299759, 299776, 291585, 430849, 291592, 62220, 422673, 430865, 291604, 422680, 152365, 422703, 422709, 152374, 242485, 160571, 430910, 160575, 160580, 299849, 283467, 381773, 201551, 242529, 349026, 357218, 275303, 308076, 242541, 209785, 177019, 185211, 308092, 398206, 291712, 381829, 316298, 308107, 349072, 308112, 209817, 324506, 324507, 390045, 127902, 185250, 324517, 185254, 373687, 349121, 373706, 316364, 340955, 340961, 324586, 340974, 316405, 349175, 201720, 127992, 357379, 324625, 308243, 316437, 201755, 300068, 357414, 300084, 324666, 308287, 21569, 218186, 250956, 300111, 341073, 439384, 250981, 300135, 316520, 300136, 357486, 316526, 144496, 300150, 291959, 300151, 160891, 341115, 300158, 349316, 349318, 373903, 169104, 177296, 308372, 324760, 119962, 300187, 300188, 300201, 300202, 373945, 259268, 283847, 62665, 283852, 283853, 259280, 316627, 333011, 357595, 234733, 234742, 128251, 316669, 439562, 292107, 242954, 414990, 251153, 177428, 349462, 382258, 300343, 382269, 193859, 177484, 406861, 259406, 234831, 251213, 120148, 283991, 374109, 292195, 333160, 243056, 316787, 357762, 112017, 112018, 234898, 259475, 275859, 357786, 251298, 333220, 316842, 374191, 210358, 284089, 292283, 415171, 300487, 300489, 366037, 210390, 210391, 210392, 210393, 144867, 103909, 54765, 251378, 308723, 300536, 210433, 366083, 259599, 316946, 308756, 398869, 374296, 374299, 308764, 349726, 431649, 349741, 169518, 431663, 194110, 235070, 349763, 218696, 292425, 243274, 128587, 333388, 333393, 300630, 128599, 235095, 333408, 300644, 374372, 415338, 120427, 243307, 54893, 325231, 333430, 366203, 325245, 194180, 415375, 153251, 300714, 210603, 415420, 333503, 218819, 259781, 333517, 333520, 333521, 333523, 325346, 333542, 153319, 325352, 284401, 325371, 194303, 284429, 243472, 366360, 284442, 325404, 325410, 341796, 399147, 431916, 300848, 317232, 259899, 325439, 325445, 153415, 341836, 415567, 325457, 317269, 341847, 350044, 128862, 284514, 292712, 325484, 423789, 292720, 325492, 276341, 341879, 317304, 333688, 112509, 194429, 325503, 55167, 333701, 243591, 325515, 243597, 325518, 333722, 350109, 292771, 415655, 333735, 284587, 317360, 243637, 301008, 153554, 219101, 292836, 292837, 317415, 325619, 432116, 333817, 292858, 415741, 333828, 358410, 399373, 317467, 145435, 292902, 325674, 129076, 243767, 358456, 309345, 194666, 260207, 432240, 284788, 333940, 292992, 333955, 415881, 104587, 235662, 325776, 317587, 284826, 333991, 333992, 284842, 333996, 301251, 309444, 334042, 194782, 301279, 317664, 243962, 375039, 309503, 375051, 325905, 325912, 211235, 432421, 211238, 325931, 358703, 358709, 260418, 6481, 366930, 366929, 6489, 391520, 383332, 383336, 317820, 211326, 317831, 227725, 252308, 317852, 121245, 285090, 375207, 342450, 334260, 293303, 293310, 416197, 129483, 342476, 317901, 326100, 285150, 342498, 358882, 195045, 334309, 391655, 432618, 375276, 342536, 342553, 416286, 375333, 244269, 375343, 23092, 375351, 244281, 301638, 309830, 293448, 55881, 416341, 244310, 416351, 268899, 39530, 244347, 326287, 375440, 334481, 227990, 318106, 318107, 342682, 318130, 383667, 293556, 342713, 285373, 39614, 334547, 318173, 375526, 285415, 342762, 342763, 293612, 154359, 432893, 162561, 285444, 383754, 326414, 310036, 326429, 293664, 326433, 400166, 293672, 318250, 318252, 375609, 342847, 252741, 293711, 244568, 244570, 293730, 351077, 342887, 269178, 400252, 359298, 359299, 260996, 113542, 228233, 392074, 228234, 56208, 326553, 318364, 310176, 310178, 293800, 236461, 326581, 326587, 326601, 359381, 433115, 343005, 130016, 64485, 326635, 187374, 383983, 318461, 293886, 293893, 433165, 384016, 146448, 433174, 326685, 252958, 252980, 203830, 359478, 302139, 359495, 392290, 253029, 228458, 318572, 351344, 187506, 285814, 392318, 187521, 384131, 302216, 228491, 228493, 285838, 162961, 326804, 351390, 302240, 343203, 253099, 253100, 318639, 367799, 113850, 294074, 64700, 302274, 367810, 343234, 244940, 228563, 195808, 310497, 228588, 253167, 302325, 261377, 228609, 245019, 253216, 130338, 130343, 130348, 261425, 351537, 318775, 286013, 286018, 146762, 294218, 294219, 318805, 425304, 294243, 163175, 327024, 327025, 327031, 318848, 253317, 384393, 368011, 318864, 318868, 212375, 212382, 310692, 245161, 286129, 286132, 228795, 425405, 302529, 302531, 163268, 425418, 310732, 64975, 327121, 228827, 310748, 286172, 310757, 187878, 245223, 343542, 343543, 286202, 359930, 286205, 302590, 228867, 253451, 253452, 359950, 146964, 253463, 286244, 245287, 245292, 286254, 196164, 56902, 179801, 196187, 343647, 310889, 204397, 138863, 188016, 294529, 229001, 310923, 188048, 425626, 229020, 302754, 245412, 40613, 40614, 40615, 229029, 384695, 319162, 327358, 286399, 212685, 384720, 245457, 302802, 278234, 294622, 278240, 212716, 212717, 360177, 286459, 278272, 319233, 360195, 278291, 294678, 286494, 409394, 319288, 319292, 360252, 360264, 188251, 376669, 245599, 425825, 425833, 417654, 188292, 253829, 294807, 376732, 311199, 319392, 294823, 327596, 294843, 188348, 237504, 294850, 384964, 163781, 344013, 212942, 212946, 24532, 294886, 253929, 327661, 311281, 311282 ]
bb1bb6e976b0c64673c9908d5d7ffa67e316fc13
f95eb83c4987226dc587ae6b64fa529b2dd0cad9
/KodiRemote/KodiRemote/utils/Downloader.swift
610f734fff73d0e39e519b3a003082bfb0ab8815
[ "Apache-2.0" ]
permissive
dipen30/Qmote
df5caadc2b22eb0b56b96340c55db88a11c52b18
e89e745bf34912ee84a8ee46c75e5921874e6b44
refs/heads/master
2021-01-10T12:05:48.165956
2017-02-20T15:39:00
2017-02-20T15:39:00
50,826,334
2
2
null
2017-02-20T15:39:01
2016-02-01T08:44:23
Objective-C
UTF-8
Swift
false
false
3,182
swift
// // Downloader.swift // Kodi Remote // // Created by Quixom Technology on 05/09/16. // Copyright © 2016 Quixom Technology. All rights reserved. // import Foundation class Downloader : NSObject, URLSessionDownloadDelegate { var progress: Float! var destpath: String var filename: String var button: UIButton! init(destdirname:String) { let dir = NSHomeDirectory() self.destpath = dir + "/\(destdirname)/" if !FileManager().fileExists(atPath: self.destpath) { do{ try FileManager().createDirectory(atPath: self.destpath, withIntermediateDirectories: false, attributes: nil) } catch let err as NSError{ print(err) } } self.filename = "" } func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL){ let fileManager = FileManager.default let fileURL = URL(fileURLWithPath: self.destpath) do { try fileManager.moveItem(at: location, to: fileURL) } catch let error as NSError { print("Error while moving downloaded file to destination path:\(error)") } } func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didWriteData bytesWritten: Int64, totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64){ //progressView.setProgress(Float(totalBytesWritten)/Float(totalBytesExpectedToWrite), animated: true) progress = Float(totalBytesWritten)/Float(totalBytesExpectedToWrite) print("Progress : \(progress)") } func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?){ //progressView.setProgress(0.0, animated: true) progress = 0.0 if (error != nil) { print(error) }else{ print("The task finished transferring data successfully") let file_hash = md5(string: self.filename) self.button = downloadQueue[file_hash] as! UIButton self.button.tintColor = UIColor(red:0.01, green:0.66, blue:0.96, alpha:1.0) self.button.isEnabled = true downloadQueue.removeObject(forKey: file_hash) } } //method to be called to download func download(_ url: URL) { self.filename = url.lastPathComponent self.destpath = self.destpath + self.filename let file_hash = md5(string: self.filename) print(self.destpath) let backgroundSessionConfiguration = URLSessionConfiguration.background(withIdentifier: file_hash) let backgroundSession = Foundation.URLSession(configuration: backgroundSessionConfiguration, delegate: self, delegateQueue: OperationQueue.main) let downloadTask = backgroundSession.downloadTask(with: url) downloadTask.resume() } }
[ -1 ]
0e0da85863f95eb77478da2772ffd8b874968d76
9f0961dd4803fee30725b94ddb41f0731c7b4f84
/TableBNB/BrowseMealsTableViewController.swift
5204057073c1e43e523731918d166a8cfe6bce4c
[]
no_license
keyhoffman/TableBNB
efb258f00b5afc87f23e8ebedd0b548d7d670aa5
9305f99a13e4ee0724ecb83c1549eefba0053595
refs/heads/master
2021-06-02T13:26:35.104901
2016-07-26T19:01:16
2016-07-26T19:01:16
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,073
swift
// // BrowseMealsTableViewController.swift // TableBNB // // Created by Key Hoffman on 7/21/16. // Copyright © 2016 Key Hoffman. All rights reserved. // import Foundation import UIKit // MARK: - BrowseMealsTableViewController final class BrowseMealsTableViewController: TableViewController<MealTableViewCell>, BrowseMealsViewModelViewDelegate, MealTableViewCellDelegate { private var mealImages: [UIImage?] = [] // MARK: - BrowseMealsViewModelType Declaration weak var viewModel: BrowseMealsViewModelType? { didSet { viewModel?.viewDelegate = self } } // MARK: - BrowseMealsTableViewController Lifecycle override func viewDidLoad() { super.viewDidLoad() BrowseMealsStyleSheet.prepare(self) } // MARK: - BrowseMealsViewModelViewDelegate Required Methods func appendMeal(meal: Meal) { self.data.append(meal) } func appendMealImage(image: UIImage) { mealImages.append(image) } func anErrorHasOccured(errorMessage: String) { title = title ?? String.emptyString() + errorMessage } // MARK: - MealTableViewCellDelegate Required Methods func showChefDescriptionPopup(forMeal meal: Meal) { viewModel?.showChefDescriptionPopup(forMeal: meal) } func showMealDescriptionPopup(forMeal meal: Meal) { viewModel?.showMealDescriptionPopup(forMeal: meal) } override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("MealTableViewCell", forIndexPath: indexPath) as! MealTableViewCell cell.cellDelegate = self cell.configure(withItem: data[indexPath.row]) cell.mealImageView.image = mealImages[indexPath.row] return cell } // MARK: - Optional TableViewDelegate Methods override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool { return false } }
[ -1 ]
b29b42367b1da60763ed824fddbcbfd62d91f348
131d033f368396d52899ca0125c3b52a318a626a
/Student Resources/2 - Introduction to UIKit/3 - Structures/lab/Lab - Structures.playground/Pages/9. Exercise - Type Properties and Methods.xcplaygroundpage/Contents.swift
b40c9b2bd781c00f1f618db9eb3633857e81fa1e
[]
no_license
carocaro22/app-dev-with-swift
ebec17a74c9ff393f88fe2454862ea389dde8132
12d713b72a30996c75181e2de0a95f0ab022c8cc
refs/heads/main
2023-08-24T19:34:08.521349
2021-09-26T10:17:29
2021-09-26T10:17:29
362,523,784
0
0
null
null
null
null
UTF-8
Swift
false
false
1,636
swift
/*: ## Exercise - Type Properties and Methods Imagine you have an app that requires the user to log in. You may have a `User` struct similar to that shown below. However, in addition to keeping track of specific user information, you might want to have a way of knowing who the current logged in user is. Create a `currentUser` type property on the `User` struct below and assign it to a `user` object representing you. Now you can access the current user through the `User` struct. Print out the properties of `currentUser`. */ struct User { var userName: String var email: String var age: Int static var currentUser: String = "caro" static func logIn(user: User) { currentUser = user.userName print("The user \(user.userName) has logged in") } } print(User.currentUser) /*: There are other properties and actions associated with a `User` struct that might be good candidates for a type property or method. One might be a method for logging in. Go back and create a type method called `logIn(user:)` where `user` is of type `User`. In the body of the method, assign the passed in user to the `currentUser` property, and print out a statement using the user's userName saying that the user has logged in. Below, call the `logIn(user:)` method and pass in a different `User` instance than what you assigned to currentUser above. Observe the printout in the console. */ User.logIn(user: User(userName: "med", email: "[email protected]", age: 31)) print(User.currentUser) //: [Previous](@previous) | page 9 of 10 | [Next: App Exercise - Type Properties and Methods](@next)
[ -1 ]
ac00aaa6da634feeb7906bd4fb7ac7b018357608
fe9a4a5e83d5b63129b529356cf0393fe178690d
/UnitTestingLab/UnitTestingLabTests/TriviaTest.swift
3a671b7e114e82935409f719f32b0cb05a72febb
[]
no_license
DavidLin91/Pursuit-Core-iOS-Introduction-to-Unit-Testing-Lab
2b25b06039558d770c9f016c6af11f1d61195eae
cf2cd7ed944aac9cc863c635486ac638ea57ac9c
refs/heads/master
2020-09-23T09:52:01.819394
2019-12-11T22:13:48
2019-12-11T22:13:48
225,470,356
0
0
null
2019-12-02T21:16:41
2019-12-02T21:16:40
null
UTF-8
Swift
false
false
607
swift
// // TriviaTest.swift // UnitTestingLabTests // // Created by David Lin on 12/11/19. // Copyright © 2019 David Lin (Passion Proj). All rights reserved. // import XCTest @testable import UnitTestingLab class TriviaTest: XCTestCase { override func setUp() { // Put setup code here. This method is called before the invocation of each test method in the class. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. } func testTriviaCount() { } }
[ -1 ]
23afba5d69b9f9505116ea7caf99b55b885b925a
a7dbbb6581973e58e994e059d63bbcf16bfdcf29
/CO2_iOS/CO2/UI/Co2MeterBackgroundView.swift
4be19ab4071488664c9f7ea18dbf9642115d97f2
[]
no_license
ilyasemenow90/CO2Meter
55ad66489b2cf2de86e056943ec81af894089960
71493d5c16aa74e4a6e32a7da679f409146e08e5
refs/heads/master
2021-06-01T05:29:13.719089
2016-06-17T07:56:51
2016-06-17T07:56:51
null
0
0
null
null
null
null
UTF-8
Swift
false
false
209
swift
// // Co2MeterBackgroundView.swift // CO2 // // Created by Alex Kantaev on 6/16/16. // Copyright © 2016 Intellectsoft. All rights reserved. // import UIKit class Co2MeterBackgroundView: UIView { }
[ -1 ]
983ab52fdc693b3bf138817a9d07ea6f7feba873
b870ff2632fa330544dfd6481a7a21f3aa3dcc77
/Sources/FigmaExport/Subcommands/ExportColors.swift
b0502d9f0e3b88b4b0bd2f2a30e359648c4a2411
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
ttoxa-xa/figma-export
fa36cfe78cf1142f184eadf456542feb37237800
3ffa36e76be541cd4520f47739f05da18fb4ad07
refs/heads/master
2023-07-11T07:21:56.911042
2021-08-06T18:32:58
2021-08-06T18:32:58
395,411,011
0
0
null
null
null
null
UTF-8
Swift
false
false
5,872
swift
import ArgumentParser import Foundation import FigmaAPI import XcodeExport import AndroidExport import FigmaExportCore import Logging extension FigmaExportCommand { struct ExportColors: ParsableCommand { static let configuration = CommandConfiguration( commandName: "colors", abstract: "Exports colors from Figma", discussion: "Exports light and dark color palette from Figma to Xcode / Android Studio project") @OptionGroup var options: FigmaExportOptions func run() throws { let logger = Logger(label: "com.redmadrobot.figma-export") let client = FigmaClient(accessToken: options.accessToken, timeout: options.params.figma.timeout) logger.info("Using FigmaExport \(FigmaExportCommand.version) to export colors.") logger.info("Fetching colors. Please wait...") let loader = ColorsLoader(client: client, figmaParams: options.params.figma, colorParams: options.params.common?.colors) let colors = try loader.load() if let ios = options.params.ios { logger.info("Processing colors...") let processor = ColorsProcessor( platform: .ios, nameValidateRegexp: options.params.common?.colors?.nameValidateRegexp, nameReplaceRegexp: options.params.common?.colors?.nameReplaceRegexp, nameStyle: options.params.ios?.colors?.nameStyle ) let colorPairs = processor.process(light: colors.light, dark: colors.dark) if let warning = colorPairs.warning?.errorDescription { logger.warning("\(warning)") } logger.info("Exporting colors to Xcode project...") try exportXcodeColors(colorPairs: colorPairs.get(), iosParams: ios, logger: logger) checkForUpdate(logger: logger) logger.info("Done!") } if let android = options.params.android { logger.info("Processing colors...") let processor = ColorsProcessor( platform: .android, nameValidateRegexp: options.params.common?.colors?.nameValidateRegexp, nameReplaceRegexp: options.params.common?.colors?.nameReplaceRegexp, nameStyle: .snakeCase ) let colorPairs = processor.process(light: colors.light, dark: colors.dark) if let warning = colorPairs.warning?.errorDescription { logger.warning("\(warning)") } logger.info("Exporting colors to Android Studio project...") try exportAndroidColors(colorPairs: colorPairs.get(), androidParams: android) checkForUpdate(logger: logger) logger.info("Done!") } } private func exportXcodeColors(colorPairs: [AssetPair<Color>], iosParams: Params.iOS, logger: Logger) throws { guard let colorParams = iosParams.colors else { logger.error("Nothing to do. Add ios.colors parameters to the config file.") return } var colorsURL: URL? if colorParams.useColorAssets { if let folder = colorParams.assetsFolder { colorsURL = iosParams.xcassetsPath.appendingPathComponent(folder) } else { throw FigmaExportError.colorsAssetsFolderNotSpecified } } let output = XcodeColorsOutput( assetsColorsURL: colorsURL, assetsInMainBundle: iosParams.xcassetsInMainBundle, assetsInSwiftPackage: iosParams.xcassetsInSwiftPackage, addObjcAttribute: iosParams.addObjcAttribute, colorSwiftURL: colorParams.colorSwift, swiftuiColorSwiftURL: colorParams.swiftuiColorSwift, groupUsingNamespace: colorParams.groupUsingNamespace) let exporter = XcodeColorExporter(output: output) let files = exporter.export(colorPairs: colorPairs) if colorParams.useColorAssets, let url = colorsURL { try? FileManager.default.removeItem(atPath: url.path) } try fileWritter.write(files: files) do { let xcodeProject = try XcodeProjectWritter(xcodeProjPath: iosParams.xcodeprojPath, target: iosParams.target) try files.forEach { file in if file.destination.file.pathExtension == "swift" { try xcodeProject.addFileReferenceToXcodeProj(file.destination.url) } } try xcodeProject.save() } catch { logger.error("Unable to add some file references to Xcode project") } } private func exportAndroidColors(colorPairs: [AssetPair<Color>], androidParams: Params.Android) throws { let exporter = AndroidColorExporter(outputDirectory: androidParams.mainRes) let files = exporter.export(colorPairs: colorPairs) let lightColorsFileURL = androidParams.mainRes.appendingPathComponent("values/colors.xml") let darkColorsFileURL = androidParams.mainRes.appendingPathComponent("values-night/colors.xml") try? FileManager.default.removeItem(atPath: lightColorsFileURL.path) try? FileManager.default.removeItem(atPath: darkColorsFileURL.path) try fileWritter.write(files: files) } } }
[ -1 ]
4557014455a4f422af29f1c7edbf9ac1bdef8ae8
287e0f5e7db54ce87b5e4ee7b2f76faf819dcc01
/CoffeeGuild/Components/Shared/SuccessLog.swift
fdb69dd5c93d228829a24d83c8ad8d25e8d450fd
[]
no_license
Pizzu/CoffeeGuild
976aeacecd6d3e16a351d7a33d4b9b0009c29f82
ed1fdb31227dd54b12a595a1b91eba78de8ed831
refs/heads/main
2023-04-30T09:35:32.323938
2021-05-05T19:01:14
2021-05-05T19:01:14
346,736,681
0
0
null
null
null
null
UTF-8
Swift
false
false
1,750
swift
// // SuccessLog.swift // CoffeeGuild // // Created by Luca Lo Forte on 16/4/21. // import SwiftUI struct SuccessLog: View { @State private var show : Bool = false var body: some View { VStack { VStack(spacing: 0) { Text("Logging you...") .font(.title).bold() .opacity(self.show ? 1 : 0) .animation(Animation.linear(duration: 1).delay(0.2), value: self.show) LottieView(fileName: "success") .frame(width: 300, height: 300) .opacity(self.show ? 1 : 0) .animation(Animation.linear(duration: 1).delay(0.4), value: self.show) } .padding(.top, 30) .background(VisualEffectBlur(blurStyle: .systemMaterial)) .clipShape(RoundedRectangle(cornerRadius: 30, style: .continuous)) .shadow(color: Color.black.opacity(0.2), radius: 30, x: 0, y: 30) .scaleEffect(self.show ? 1 : 0.5) .animation(.spring(response: 0.5, dampingFraction: 0.6, blendDuration: 0), value: self.show) } .frame(maxWidth: .infinity, maxHeight: .infinity) .background(Color.black.opacity(self.show ? 0.5 : 0)) .animation(.linear(duration: 0.5), value: self.show) .edgesIgnoringSafeArea(.all) .onAppear { self.show = true } .onDisappear { self.show = false } } } struct SuccessLog_Previews: PreviewProvider { static var previews: some View { SuccessLog() } }
[ -1 ]
dca632ac089415fb582471d6475c411caf7afd43
67bfd6b9f2e0a1add40a57c6e00f147299e867e6
/Sources/Extensions/Shared/ColorExtensions.swift
ed4926e17903f36ef6fde24f9663900fa0775881
[ "MIT" ]
permissive
LeLuckyVint/SwifterSwift
ae018b5abbc5a6c74ff5d0c7f86662aa4142a584
c3f0df7cce5d4bd5c7777e7377b5102e90608d13
refs/heads/master
2021-07-08T22:15:21.499968
2017-10-07T14:18:21
2017-10-07T14:18:21
105,147,556
0
0
null
2017-09-28T12:50:24
2017-09-28T12:50:24
null
UTF-8
Swift
false
false
52,678
swift
// // ColorExtensions.swift // SwifterSwift-iOS // // Created by Omar Albeik on 9/27/17. // #if os(macOS) import Cocoa public typealias Color = NSColor #else import UIKit public typealias Color = UIColor #endif #if !os(watchOS) import CoreImage #endif // MARK: - Properties public extension Color { /// SwifterSwift: Random color. public static var random: Color { let r = Int(arc4random_uniform(255)) let g = Int(arc4random_uniform(255)) let b = Int(arc4random_uniform(255)) #if os(macOS) return NSColor(red: r, green: g, blue: b)! #else return UIColor(red: r, green: g, blue: b)! #endif } /// SwifterSwift: RGB components for a Color (between 0 and 255). /// /// UIColor.red.rgbComponents.red -> 255 /// NSColor.green.rgbComponents.green -> 255 /// UIColor.blue.rgbComponents.blue -> 255 /// public var rgbComponents: (red: Int, green: Int, blue: Int) { var components: [CGFloat] { let c = cgColor.components! if c.count == 4 { return c } return [c[0], c[0], c[0], c[1]] } let r = components[0] let g = components[1] let b = components[2] return (red: Int(r * 255.0), green: Int(g * 255.0), blue: Int(b * 255.0)) } /// SwifterSwift: RGB components for a Color represented as CGFloat numbers (between 0 and 1) /// /// UIColor.red.rgbComponents.red -> 1.0 /// NSColor.green.rgbComponents.green -> 1.0 /// UIColor.blue.rgbComponents.blue -> 1.0 /// public var cgFloatComponents: (red: CGFloat, green: CGFloat, blue: CGFloat) { var components: [CGFloat] { let c = cgColor.components! if c.count == 4 { return c } return [c[0], c[0], c[0], c[1]] } let r = components[0] let g = components[1] let b = components[2] return (red: r, green: g, blue: b) } /// SwifterSwift: Get components of hue, saturation, and brightness, and alpha (read-only). public var hsbaComponents: (hue: CGFloat, saturation: CGFloat, brightness: CGFloat, alpha: CGFloat) { var h: CGFloat = 0.0 var s: CGFloat = 0.0 var b: CGFloat = 0.0 var a: CGFloat = 0.0 self.getHue(&h, saturation: &s, brightness: &b, alpha: &a) return (hue: h, saturation: s, brightness: b, alpha: a) } /// SwifterSwift: Hexadecimal value string (read-only). public var hexString: String { let r = rgbComponents.red let g = rgbComponents.green let b = rgbComponents.blue return String(format: "#%02X%02X%02X", r, g, b) } /// SwifterSwift: Short hexadecimal value string (read-only, if applicable). public var shortHexString: String? { let string = hexString.replacingOccurrences(of: "#", with: "") let chrs = Array(string.characters) guard chrs[0] == chrs[1], chrs[2] == chrs[3], chrs[4] == chrs[5] else { return nil } return "#\(chrs[0])\(chrs[2])\(chrs[4])" } /// SwifterSwift: Short hexadecimal value string, or full hexadecimal string if not possible (read-only). public var shortHexOrHexString: String { return shortHexString ?? hexString } /// SwifterSwift: Alpha of Color (read-only). public var alpha: CGFloat { return cgColor.alpha } #if !os(watchOS) /// SwifterSwift: CoreImage.CIColor (read-only) public var coreImageColor: CoreImage.CIColor? { return CoreImage.CIColor(color: self) } #endif /// SwifterSwift: Get UInt representation of a Color (read-only). public var uInt: UInt { let c = self.cgFloatComponents var colorAsUInt32: UInt32 = 0 colorAsUInt32 += UInt32(c.red * 255.0) << 16 colorAsUInt32 += UInt32(c.green * 255.0) << 8 colorAsUInt32 += UInt32(c.blue * 255.0) return UInt(colorAsUInt32) } /// SwifterSwift: Get color complementary (read-only, if applicable). public var complementary: Color? { return Color.init(complementaryFor: self) } } // MARK: - Methods public extension Color { /// SwifterSwift: Blend two Colors /// /// - Parameters: /// - color1: first color to blend /// - intensity1: intensity of first color (default is 0.5) /// - color2: second color to blend /// - intensity2: intensity of second color (default is 0.5) /// - Returns: Color created by blending first and seond colors. public static func blend(_ color1: Color, intensity1: CGFloat = 0.5, with color2: Color, intensity2: CGFloat = 0.5) -> Color { // http://stackoverflow.com/questions/27342715/blend-uicolors-in-swift let total = intensity1 + intensity2 let level1 = intensity1/total let level2 = intensity2/total guard level1 > 0 else { return color2 } guard level2 > 0 else { return color1 } let components1 = color1.cgFloatComponents let components2 = color2.cgFloatComponents let r1 = components1.red let r2 = components2.red let g1 = components1.green let g2 = components2.green let b1 = components1.blue let b2 = components2.blue let a1 = color1.alpha let a2 = color2.alpha let r = level1*r1 + level2*r2 let g = level1*g1 + level2*g2 let b = level1*b1 + level2*b2 let a = level1*a1 + level2*a2 return Color(red: r, green: g, blue: b, alpha: a) } } // MARK: - Initializers public extension Color { /// SwifterSwift: Create NSColor from RGB values with optional transparency. /// /// - Parameters: /// - red: red component. /// - green: green component. /// - blue: blue component. /// - transparency: optional transparency value (default is 1). public convenience init?(red: Int, green: Int, blue: Int, transparency: CGFloat = 1) { guard red >= 0 && red <= 255 else { return nil } guard green >= 0 && green <= 255 else { return nil } guard blue >= 0 && blue <= 255 else { return nil } var trans = transparency if trans < 0 { trans = 0 } if trans > 1 { trans = 1 } self.init(red: CGFloat(red) / 255.0, green: CGFloat(green) / 255.0, blue: CGFloat(blue) / 255.0, alpha: trans) } /// SwifterSwift: Create NSColor from hexadecimal value with optional transparency. /// /// - Parameters: /// - hex: hex Int (example: 0xDECEB5). /// - transparency: optional transparency value (default is 1). public convenience init?(hex: Int, transparency: CGFloat = 1) { var trans = transparency if trans < 0 { trans = 0 } if trans > 1 { trans = 1 } let red = (hex >> 16) & 0xff let green = (hex >> 8) & 0xff let blue = hex & 0xff self.init(red: red, green: green, blue: blue, transparency: trans) } /// SwifterSwift: Create UIColor from hexadecimal string with optional transparency (if applicable). /// /// - Parameters: /// - hexString: hexadecimal string (examples: EDE7F6, 0xEDE7F6, #EDE7F6, #0ff, 0xF0F, ..). /// - transparency: optional transparency value (default is 1). public convenience init?(hexString: String, transparency: CGFloat = 1) { var string = "" if hexString.lowercased().hasPrefix("0x") { string = hexString.replacingOccurrences(of: "0x", with: "") } else if hexString.hasPrefix("#") { string = hexString.replacingOccurrences(of: "#", with: "") } else { string = hexString } if string.characters.count == 3 { // convert hex to 6 digit format if in short format var str = "" string.characters.forEach { str.append(String(repeating: String($0), count: 2)) } string = str } guard let hexValue = Int(string, radix: 16) else { return nil } var trans = transparency if trans < 0 { trans = 0 } if trans > 1 { trans = 1 } self.init(hex: Int(hexValue), transparency: trans) } /// SwifterSwift: Create UIColor from a complementary of a UIColor (if applicable). /// /// - Parameter color: color of which opposite color is desired. public convenience init?(complementaryFor color: Color) { let colorSpaceRGB = CGColorSpaceCreateDeviceRGB() let convertColorToRGBSpace: ((_ color: Color) -> Color?) = { color -> Color? in if color.cgColor.colorSpace!.model == CGColorSpaceModel.monochrome { let oldComponents = color.cgColor.components let components: [CGFloat] = [ oldComponents![0], oldComponents![0], oldComponents![0], oldComponents![1]] let colorRef = CGColor(colorSpace: colorSpaceRGB, components: components) let colorOut = Color(cgColor: colorRef!) return colorOut } else { return color } } let c = convertColorToRGBSpace(color) guard let componentColors = c?.cgColor.components else { return nil } let r: CGFloat = sqrt(pow(255.0, 2.0) - pow((componentColors[0]*255), 2.0))/255 let g: CGFloat = sqrt(pow(255.0, 2.0) - pow((componentColors[1]*255), 2.0))/255 let b: CGFloat = sqrt(pow(255.0, 2.0) - pow((componentColors[2]*255), 2.0))/255 self.init(red: r, green: g, blue: b, alpha: 1.0) } } // MARK: - Social public extension Color { /// SwifterSwift: Brand identity color of popular social media platform. public struct Social { // https://www.lockedowndesign.com/social-media-colors/ /// red: 59, green: 89, blue: 152 public static let facebook = Color(red: 59, green: 89, blue: 152)! /// red: 0, green: 182, blue: 241 public static let twitter = Color(red: 0, green: 182, blue: 241)! /// red: 223, green: 74, blue: 50 public static let googlePlus = Color(red: 223, green: 74, blue: 50)! /// red: 0, green: 123, blue: 182 public static let linkedIn = Color(red: 0, green: 123, blue: 182)! /// red: 69, green: 187, blue: 255 public static let vimeo = Color(red: 69, green: 187, blue: 255)! /// red: 179, green: 18, blue: 23 public static let youtube = Color(red: 179, green: 18, blue: 23)! /// red: 195, green: 42, blue: 163 public static let instagram = Color(red: 195, green: 42, blue: 163)! /// red: 203, green: 32, blue: 39 public static let pinterest = Color(red: 203, green: 32, blue: 39)! /// red: 244, green: 0, blue: 131 public static let flickr = Color(red: 244, green: 0, blue: 131)! /// red: 67, green: 2, blue: 151 public static let yahoo = Color(red: 67, green: 2, blue: 151)! /// red: 67, green: 2, blue: 151 public static let soundCloud = Color(red: 67, green: 2, blue: 151)! /// red: 44, green: 71, blue: 98 public static let tumblr = Color(red: 44, green: 71, blue: 98)! /// red: 252, green: 69, blue: 117 public static let foursquare = Color(red: 252, green: 69, blue: 117)! /// red: 255, green: 176, blue: 0 public static let swarm = Color(red: 255, green: 176, blue: 0)! /// red: 234, green: 76, blue: 137 public static let dribbble = Color(red: 234, green: 76, blue: 137)! /// red: 255, green: 87, blue: 0 public static let reddit = Color(red: 255, green: 87, blue: 0)! /// red: 74, green: 93, blue: 78 public static let devianArt = Color(red: 74, green: 93, blue: 78)! /// red: 238, green: 64, blue: 86 public static let pocket = Color(red: 238, green: 64, blue: 86)! /// red: 170, green: 34, blue: 182 public static let quora = Color(red: 170, green: 34, blue: 182)! /// red: 247, green: 146, blue: 30 public static let slideShare = Color(red: 247, green: 146, blue: 30)! /// red: 0, green: 153, blue: 229 public static let px500 = Color(red: 0, green: 153, blue: 229)! /// red: 223, green: 109, blue: 70 public static let listly = Color(red: 223, green: 109, blue: 70)! /// red: 0, green: 180, blue: 137 public static let vine = Color(red: 0, green: 180, blue: 137)! /// red: 0, green: 175, blue: 240 public static let skype = Color(red: 0, green: 175, blue: 240)! /// red: 235, green: 73, blue: 36 public static let stumbleUpon = Color(red: 235, green: 73, blue: 36)! /// red: 255, green: 252, blue: 0 public static let snapchat = Color(red: 255, green: 252, blue: 0)! } } // MARK: - Material colors public extension Color { /// SwifterSwift: Google Material design colors palette. public struct Material { // https://material.google.com/style/color.html /// SwifterSwift: color red500 public static let red = red500 /// SwifterSwift: hex #FFEBEE public static let red50 = Color(hex: 0xFFEBEE)! /// SwifterSwift: hex #FFCDD2 public static let red100 = Color(hex: 0xFFCDD2)! /// SwifterSwift: hex #EF9A9A public static let red200 = Color(hex: 0xEF9A9A)! /// SwifterSwift: hex #E57373 public static let red300 = Color(hex: 0xE57373)! /// SwifterSwift: hex #EF5350 public static let red400 = Color(hex: 0xEF5350)! /// SwifterSwift: hex #F44336 public static let red500 = Color(hex: 0xF44336)! /// SwifterSwift: hex #E53935 public static let red600 = Color(hex: 0xE53935)! /// SwifterSwift: hex #D32F2F public static let red700 = Color(hex: 0xD32F2F)! /// SwifterSwift: hex #C62828 public static let red800 = Color(hex: 0xC62828)! /// SwifterSwift: hex #B71C1C public static let red900 = Color(hex: 0xB71C1C)! /// SwifterSwift: hex #FF8A80 public static let redA100 = Color(hex: 0xFF8A80)! /// SwifterSwift: hex #FF5252 public static let redA200 = Color(hex: 0xFF5252)! /// SwifterSwift: hex #FF1744 public static let redA400 = Color(hex: 0xFF1744)! /// SwifterSwift: hex #D50000 public static let redA700 = Color(hex: 0xD50000)! /// SwifterSwift: color pink500 public static let pink = pink500 /// SwifterSwift: hex #FCE4EC public static let pink50 = Color(hex: 0xFCE4EC)! /// SwifterSwift: hex #F8BBD0 public static let pink100 = Color(hex: 0xF8BBD0)! /// SwifterSwift: hex #F48FB1 public static let pink200 = Color(hex: 0xF48FB1)! /// SwifterSwift: hex #F06292 public static let pink300 = Color(hex: 0xF06292)! /// SwifterSwift: hex #EC407A public static let pink400 = Color(hex: 0xEC407A)! /// SwifterSwift: hex #E91E63 public static let pink500 = Color(hex: 0xE91E63)! /// SwifterSwift: hex #D81B60 public static let pink600 = Color(hex: 0xD81B60)! /// SwifterSwift: hex #C2185B public static let pink700 = Color(hex: 0xC2185B)! /// SwifterSwift: hex #AD1457 public static let pink800 = Color(hex: 0xAD1457)! /// SwifterSwift: hex #880E4F public static let pink900 = Color(hex: 0x880E4F)! /// SwifterSwift: hex #FF80AB public static let pinkA100 = Color(hex: 0xFF80AB)! /// SwifterSwift: hex #FF4081 public static let pinkA200 = Color(hex: 0xFF4081)! /// SwifterSwift: hex #F50057 public static let pinkA400 = Color(hex: 0xF50057)! /// SwifterSwift: hex #C51162 public static let pinkA700 = Color(hex: 0xC51162)! /// SwifterSwift: color purple500 public static let purple = purple500 /// SwifterSwift: hex #F3E5F5 public static let purple50 = Color(hex: 0xF3E5F5)! /// SwifterSwift: hex #E1BEE7 public static let purple100 = Color(hex: 0xE1BEE7)! /// SwifterSwift: hex #CE93D8 public static let purple200 = Color(hex: 0xCE93D8)! /// SwifterSwift: hex #BA68C8 public static let purple300 = Color(hex: 0xBA68C8)! /// SwifterSwift: hex #AB47BC public static let purple400 = Color(hex: 0xAB47BC)! /// SwifterSwift: hex #9C27B0 public static let purple500 = Color(hex: 0x9C27B0)! /// SwifterSwift: hex #8E24AA public static let purple600 = Color(hex: 0x8E24AA)! /// SwifterSwift: hex #7B1FA2 public static let purple700 = Color(hex: 0x7B1FA2)! /// SwifterSwift: hex #6A1B9A public static let purple800 = Color(hex: 0x6A1B9A)! /// SwifterSwift: hex #4A148C public static let purple900 = Color(hex: 0x4A148C)! /// SwifterSwift: hex #EA80FC public static let purpleA100 = Color(hex: 0xEA80FC)! /// SwifterSwift: hex #E040FB public static let purpleA200 = Color(hex: 0xE040FB)! /// SwifterSwift: hex #D500F9 public static let purpleA400 = Color(hex: 0xD500F9)! /// SwifterSwift: hex #AA00FF public static let purpleA700 = Color(hex: 0xAA00FF)! /// SwifterSwift: color deepPurple500 public static let deepPurple = deepPurple500 /// SwifterSwift: hex #EDE7F6 public static let deepPurple50 = Color(hex: 0xEDE7F6)! /// SwifterSwift: hex #D1C4E9 public static let deepPurple100 = Color(hex: 0xD1C4E9)! /// SwifterSwift: hex #B39DDB public static let deepPurple200 = Color(hex: 0xB39DDB)! /// SwifterSwift: hex #9575CD public static let deepPurple300 = Color(hex: 0x9575CD)! /// SwifterSwift: hex #7E57C2 public static let deepPurple400 = Color(hex: 0x7E57C2)! /// SwifterSwift: hex #673AB7 public static let deepPurple500 = Color(hex: 0x673AB7)! /// SwifterSwift: hex #5E35B1 public static let deepPurple600 = Color(hex: 0x5E35B1)! /// SwifterSwift: hex #512DA8 public static let deepPurple700 = Color(hex: 0x512DA8)! /// SwifterSwift: hex #4527A0 public static let deepPurple800 = Color(hex: 0x4527A0)! /// SwifterSwift: hex #311B92 public static let deepPurple900 = Color(hex: 0x311B92)! /// SwifterSwift: hex #B388FF public static let deepPurpleA100 = Color(hex: 0xB388FF)! /// SwifterSwift: hex #7C4DFF public static let deepPurpleA200 = Color(hex: 0x7C4DFF)! /// SwifterSwift: hex #651FFF public static let deepPurpleA400 = Color(hex: 0x651FFF)! /// SwifterSwift: hex #6200EA public static let deepPurpleA700 = Color(hex: 0x6200EA)! /// SwifterSwift: color indigo500 public static let indigo = indigo500 /// SwifterSwift: hex #E8EAF6 public static let indigo50 = Color(hex: 0xE8EAF6)! /// SwifterSwift: hex #C5CAE9 public static let indigo100 = Color(hex: 0xC5CAE9)! /// SwifterSwift: hex #9FA8DA public static let indigo200 = Color(hex: 0x9FA8DA)! /// SwifterSwift: hex #7986CB public static let indigo300 = Color(hex: 0x7986CB)! /// SwifterSwift: hex #5C6BC0 public static let indigo400 = Color(hex: 0x5C6BC0)! /// SwifterSwift: hex #3F51B5 public static let indigo500 = Color(hex: 0x3F51B5)! /// SwifterSwift: hex #3949AB public static let indigo600 = Color(hex: 0x3949AB)! /// SwifterSwift: hex #303F9F public static let indigo700 = Color(hex: 0x303F9F)! /// SwifterSwift: hex #283593 public static let indigo800 = Color(hex: 0x283593)! /// SwifterSwift: hex #1A237E public static let indigo900 = Color(hex: 0x1A237E)! /// SwifterSwift: hex #8C9EFF public static let indigoA100 = Color(hex: 0x8C9EFF)! /// SwifterSwift: hex #536DFE public static let indigoA200 = Color(hex: 0x536DFE)! /// SwifterSwift: hex #3D5AFE public static let indigoA400 = Color(hex: 0x3D5AFE)! /// SwifterSwift: hex #304FFE public static let indigoA700 = Color(hex: 0x304FFE)! /// SwifterSwift: color blue500 public static let blue = blue500 /// SwifterSwift: hex #E3F2FD public static let blue50 = Color(hex: 0xE3F2FD)! /// SwifterSwift: hex #BBDEFB public static let blue100 = Color(hex: 0xBBDEFB)! /// SwifterSwift: hex #90CAF9 public static let blue200 = Color(hex: 0x90CAF9)! /// SwifterSwift: hex #64B5F6 public static let blue300 = Color(hex: 0x64B5F6)! /// SwifterSwift: hex #42A5F5 public static let blue400 = Color(hex: 0x42A5F5)! /// SwifterSwift: hex #2196F3 public static let blue500 = Color(hex: 0x2196F3)! /// SwifterSwift: hex #1E88E5 public static let blue600 = Color(hex: 0x1E88E5)! /// SwifterSwift: hex #1976D2 public static let blue700 = Color(hex: 0x1976D2)! /// SwifterSwift: hex #1565C0 public static let blue800 = Color(hex: 0x1565C0)! /// SwifterSwift: hex #0D47A1 public static let blue900 = Color(hex: 0x0D47A1)! /// SwifterSwift: hex #82B1FF public static let blueA100 = Color(hex: 0x82B1FF)! /// SwifterSwift: hex #448AFF public static let blueA200 = Color(hex: 0x448AFF)! /// SwifterSwift: hex #2979FF public static let blueA400 = Color(hex: 0x2979FF)! /// SwifterSwift: hex #2962FF public static let blueA700 = Color(hex: 0x2962FF)! /// SwifterSwift: color lightBlue500 public static let lightBlue = lightBlue500 /// SwifterSwift: hex #E1F5FE public static let lightBlue50 = Color(hex: 0xE1F5FE)! /// SwifterSwift: hex #B3E5FC public static let lightBlue100 = Color(hex: 0xB3E5FC)! /// SwifterSwift: hex #81D4FA public static let lightBlue200 = Color(hex: 0x81D4FA)! /// SwifterSwift: hex #4FC3F7 public static let lightBlue300 = Color(hex: 0x4FC3F7)! /// SwifterSwift: hex #29B6F6 public static let lightBlue400 = Color(hex: 0x29B6F6)! /// SwifterSwift: hex #03A9F4 public static let lightBlue500 = Color(hex: 0x03A9F4)! /// SwifterSwift: hex #039BE5 public static let lightBlue600 = Color(hex: 0x039BE5)! /// SwifterSwift: hex #0288D1 public static let lightBlue700 = Color(hex: 0x0288D1)! /// SwifterSwift: hex #0277BD public static let lightBlue800 = Color(hex: 0x0277BD)! /// SwifterSwift: hex #01579B public static let lightBlue900 = Color(hex: 0x01579B)! /// SwifterSwift: hex #80D8FF public static let lightBlueA100 = Color(hex: 0x80D8FF)! /// SwifterSwift: hex #40C4FF public static let lightBlueA200 = Color(hex: 0x40C4FF)! /// SwifterSwift: hex #00B0FF public static let lightBlueA400 = Color(hex: 0x00B0FF)! /// SwifterSwift: hex #0091EA public static let lightBlueA700 = Color(hex: 0x0091EA)! /// SwifterSwift: color cyan500 public static let cyan = cyan500 /// SwifterSwift: hex #E0F7FA public static let cyan50 = Color(hex: 0xE0F7FA)! /// SwifterSwift: hex #B2EBF2 public static let cyan100 = Color(hex: 0xB2EBF2)! /// SwifterSwift: hex #80DEEA public static let cyan200 = Color(hex: 0x80DEEA)! /// SwifterSwift: hex #4DD0E1 public static let cyan300 = Color(hex: 0x4DD0E1)! /// SwifterSwift: hex #26C6DA public static let cyan400 = Color(hex: 0x26C6DA)! /// SwifterSwift: hex #00BCD4 public static let cyan500 = Color(hex: 0x00BCD4)! /// SwifterSwift: hex #00ACC1 public static let cyan600 = Color(hex: 0x00ACC1)! /// SwifterSwift: hex #0097A7 public static let cyan700 = Color(hex: 0x0097A7)! /// SwifterSwift: hex #00838F public static let cyan800 = Color(hex: 0x00838F)! /// SwifterSwift: hex #006064 public static let cyan900 = Color(hex: 0x006064)! /// SwifterSwift: hex #84FFFF public static let cyanA100 = Color(hex: 0x84FFFF)! /// SwifterSwift: hex #18FFFF public static let cyanA200 = Color(hex: 0x18FFFF)! /// SwifterSwift: hex #00E5FF public static let cyanA400 = Color(hex: 0x00E5FF)! /// SwifterSwift: hex #00B8D4 public static let cyanA700 = Color(hex: 0x00B8D4)! /// SwifterSwift: color teal500 public static let teal = teal500 /// SwifterSwift: hex #E0F2F1 public static let teal50 = Color(hex: 0xE0F2F1)! /// SwifterSwift: hex #B2DFDB public static let teal100 = Color(hex: 0xB2DFDB)! /// SwifterSwift: hex #80CBC4 public static let teal200 = Color(hex: 0x80CBC4)! /// SwifterSwift: hex #4DB6AC public static let teal300 = Color(hex: 0x4DB6AC)! /// SwifterSwift: hex #26A69A public static let teal400 = Color(hex: 0x26A69A)! /// SwifterSwift: hex #009688 public static let teal500 = Color(hex: 0x009688)! /// SwifterSwift: hex #00897B public static let teal600 = Color(hex: 0x00897B)! /// SwifterSwift: hex #00796B public static let teal700 = Color(hex: 0x00796B)! /// SwifterSwift: hex #00695C public static let teal800 = Color(hex: 0x00695C)! /// SwifterSwift: hex #004D40 public static let teal900 = Color(hex: 0x004D40)! /// SwifterSwift: hex #A7FFEB public static let tealA100 = Color(hex: 0xA7FFEB)! /// SwifterSwift: hex #64FFDA public static let tealA200 = Color(hex: 0x64FFDA)! /// SwifterSwift: hex #1DE9B6 public static let tealA400 = Color(hex: 0x1DE9B6)! /// SwifterSwift: hex #00BFA5 public static let tealA700 = Color(hex: 0x00BFA5)! /// SwifterSwift: color green500 public static let green = green500 /// SwifterSwift: hex #E8F5E9 public static let green50 = Color(hex: 0xE8F5E9)! /// SwifterSwift: hex #C8E6C9 public static let green100 = Color(hex: 0xC8E6C9)! /// SwifterSwift: hex #A5D6A7 public static let green200 = Color(hex: 0xA5D6A7)! /// SwifterSwift: hex #81C784 public static let green300 = Color(hex: 0x81C784)! /// SwifterSwift: hex #66BB6A public static let green400 = Color(hex: 0x66BB6A)! /// SwifterSwift: hex #4CAF50 public static let green500 = Color(hex: 0x4CAF50)! /// SwifterSwift: hex #43A047 public static let green600 = Color(hex: 0x43A047)! /// SwifterSwift: hex #388E3C public static let green700 = Color(hex: 0x388E3C)! /// SwifterSwift: hex #2E7D32 public static let green800 = Color(hex: 0x2E7D32)! /// SwifterSwift: hex #1B5E20 public static let green900 = Color(hex: 0x1B5E20)! /// SwifterSwift: hex #B9F6CA public static let greenA100 = Color(hex: 0xB9F6CA)! /// SwifterSwift: hex #69F0AE public static let greenA200 = Color(hex: 0x69F0AE)! /// SwifterSwift: hex #00E676 public static let greenA400 = Color(hex: 0x00E676)! /// SwifterSwift: hex #00C853 public static let greenA700 = Color(hex: 0x00C853)! /// SwifterSwift: color lightGreen500 public static let lightGreen = lightGreen500 /// SwifterSwift: hex #F1F8E9 public static let lightGreen50 = Color(hex: 0xF1F8E9)! /// SwifterSwift: hex #DCEDC8 public static let lightGreen100 = Color(hex: 0xDCEDC8)! /// SwifterSwift: hex #C5E1A5 public static let lightGreen200 = Color(hex: 0xC5E1A5)! /// SwifterSwift: hex #AED581 public static let lightGreen300 = Color(hex: 0xAED581)! /// SwifterSwift: hex #9CCC65 public static let lightGreen400 = Color(hex: 0x9CCC65)! /// SwifterSwift: hex #8BC34A public static let lightGreen500 = Color(hex: 0x8BC34A)! /// SwifterSwift: hex #7CB342 public static let lightGreen600 = Color(hex: 0x7CB342)! /// SwifterSwift: hex #689F38 public static let lightGreen700 = Color(hex: 0x689F38)! /// SwifterSwift: hex #558B2F public static let lightGreen800 = Color(hex: 0x558B2F)! /// SwifterSwift: hex #33691E public static let lightGreen900 = Color(hex: 0x33691E)! /// SwifterSwift: hex #CCFF90 public static let lightGreenA100 = Color(hex: 0xCCFF90)! /// SwifterSwift: hex #B2FF59 public static let lightGreenA200 = Color(hex: 0xB2FF59)! /// SwifterSwift: hex #76FF03 public static let lightGreenA400 = Color(hex: 0x76FF03)! /// SwifterSwift: hex #64DD17 public static let lightGreenA700 = Color(hex: 0x64DD17)! /// SwifterSwift: color lime500 public static let lime = lime500 /// SwifterSwift: hex #F9FBE7 public static let lime50 = Color(hex: 0xF9FBE7)! /// SwifterSwift: hex #F0F4C3 public static let lime100 = Color(hex: 0xF0F4C3)! /// SwifterSwift: hex #E6EE9C public static let lime200 = Color(hex: 0xE6EE9C)! /// SwifterSwift: hex #DCE775 public static let lime300 = Color(hex: 0xDCE775)! /// SwifterSwift: hex #D4E157 public static let lime400 = Color(hex: 0xD4E157)! /// SwifterSwift: hex #CDDC39 public static let lime500 = Color(hex: 0xCDDC39)! /// SwifterSwift: hex #C0CA33 public static let lime600 = Color(hex: 0xC0CA33)! /// SwifterSwift: hex #AFB42B public static let lime700 = Color(hex: 0xAFB42B)! /// SwifterSwift: hex #9E9D24 public static let lime800 = Color(hex: 0x9E9D24)! /// SwifterSwift: hex #827717 public static let lime900 = Color(hex: 0x827717)! /// SwifterSwift: hex #F4FF81 public static let limeA100 = Color(hex: 0xF4FF81)! /// SwifterSwift: hex #EEFF41 public static let limeA200 = Color(hex: 0xEEFF41)! /// SwifterSwift: hex #C6FF00 public static let limeA400 = Color(hex: 0xC6FF00)! /// SwifterSwift: hex #AEEA00 public static let limeA700 = Color(hex: 0xAEEA00)! /// SwifterSwift: color yellow500 public static let yellow = yellow500 /// SwifterSwift: hex #FFFDE7 public static let yellow50 = Color(hex: 0xFFFDE7)! /// SwifterSwift: hex #FFF9C4 public static let yellow100 = Color(hex: 0xFFF9C4)! /// SwifterSwift: hex #FFF59D public static let yellow200 = Color(hex: 0xFFF59D)! /// SwifterSwift: hex #FFF176 public static let yellow300 = Color(hex: 0xFFF176)! /// SwifterSwift: hex #FFEE58 public static let yellow400 = Color(hex: 0xFFEE58)! /// SwifterSwift: hex #FFEB3B public static let yellow500 = Color(hex: 0xFFEB3B)! /// SwifterSwift: hex #FDD835 public static let yellow600 = Color(hex: 0xFDD835)! /// SwifterSwift: hex #FBC02D public static let yellow700 = Color(hex: 0xFBC02D)! /// SwifterSwift: hex #F9A825 public static let yellow800 = Color(hex: 0xF9A825)! /// SwifterSwift: hex #F57F17 public static let yellow900 = Color(hex: 0xF57F17)! /// SwifterSwift: hex #FFFF8D public static let yellowA100 = Color(hex: 0xFFFF8D)! /// SwifterSwift: hex #FFFF00 public static let yellowA200 = Color(hex: 0xFFFF00)! /// SwifterSwift: hex #FFEA00 public static let yellowA400 = Color(hex: 0xFFEA00)! /// SwifterSwift: hex #FFD600 public static let yellowA700 = Color(hex: 0xFFD600)! /// SwifterSwift: color amber500 public static let amber = amber500 /// SwifterSwift: hex #FFF8E1 public static let amber50 = Color(hex: 0xFFF8E1)! /// SwifterSwift: hex #FFECB3 public static let amber100 = Color(hex: 0xFFECB3)! /// SwifterSwift: hex #FFE082 public static let amber200 = Color(hex: 0xFFE082)! /// SwifterSwift: hex #FFD54F public static let amber300 = Color(hex: 0xFFD54F)! /// SwifterSwift: hex #FFCA28 public static let amber400 = Color(hex: 0xFFCA28)! /// SwifterSwift: hex #FFC107 public static let amber500 = Color(hex: 0xFFC107)! /// SwifterSwift: hex #FFB300 public static let amber600 = Color(hex: 0xFFB300)! /// SwifterSwift: hex #FFA000 public static let amber700 = Color(hex: 0xFFA000)! /// SwifterSwift: hex #FF8F00 public static let amber800 = Color(hex: 0xFF8F00)! /// SwifterSwift: hex #FF6F00 public static let amber900 = Color(hex: 0xFF6F00)! /// SwifterSwift: hex #FFE57F public static let amberA100 = Color(hex: 0xFFE57F)! /// SwifterSwift: hex #FFD740 public static let amberA200 = Color(hex: 0xFFD740)! /// SwifterSwift: hex #FFC400 public static let amberA400 = Color(hex: 0xFFC400)! /// SwifterSwift: hex #FFAB00 public static let amberA700 = Color(hex: 0xFFAB00)! /// SwifterSwift: color orange500 public static let orange = orange500 /// SwifterSwift: hex #FFF3E0 public static let orange50 = Color(hex: 0xFFF3E0)! /// SwifterSwift: hex #FFE0B2 public static let orange100 = Color(hex: 0xFFE0B2)! /// SwifterSwift: hex #FFCC80 public static let orange200 = Color(hex: 0xFFCC80)! /// SwifterSwift: hex #FFB74D public static let orange300 = Color(hex: 0xFFB74D)! /// SwifterSwift: hex #FFA726 public static let orange400 = Color(hex: 0xFFA726)! /// SwifterSwift: hex #FF9800 public static let orange500 = Color(hex: 0xFF9800)! /// SwifterSwift: hex #FB8C00 public static let orange600 = Color(hex: 0xFB8C00)! /// SwifterSwift: hex #F57C00 public static let orange700 = Color(hex: 0xF57C00)! /// SwifterSwift: hex #EF6C00 public static let orange800 = Color(hex: 0xEF6C00)! /// SwifterSwift: hex #E65100 public static let orange900 = Color(hex: 0xE65100)! /// SwifterSwift: hex #FFD180 public static let orangeA100 = Color(hex: 0xFFD180)! /// SwifterSwift: hex #FFAB40 public static let orangeA200 = Color(hex: 0xFFAB40)! /// SwifterSwift: hex #FF9100 public static let orangeA400 = Color(hex: 0xFF9100)! /// SwifterSwift: hex #FF6D00 public static let orangeA700 = Color(hex: 0xFF6D00)! /// SwifterSwift: color deepOrange500 public static let deepOrange = deepOrange500 /// SwifterSwift: hex #FBE9E7 public static let deepOrange50 = Color(hex: 0xFBE9E7)! /// SwifterSwift: hex #FFCCBC public static let deepOrange100 = Color(hex: 0xFFCCBC)! /// SwifterSwift: hex #FFAB91 public static let deepOrange200 = Color(hex: 0xFFAB91)! /// SwifterSwift: hex #FF8A65 public static let deepOrange300 = Color(hex: 0xFF8A65)! /// SwifterSwift: hex #FF7043 public static let deepOrange400 = Color(hex: 0xFF7043)! /// SwifterSwift: hex #FF5722 public static let deepOrange500 = Color(hex: 0xFF5722)! /// SwifterSwift: hex #F4511E public static let deepOrange600 = Color(hex: 0xF4511E)! /// SwifterSwift: hex #E64A19 public static let deepOrange700 = Color(hex: 0xE64A19)! /// SwifterSwift: hex #D84315 public static let deepOrange800 = Color(hex: 0xD84315)! /// SwifterSwift: hex #BF360C public static let deepOrange900 = Color(hex: 0xBF360C)! /// SwifterSwift: hex #FF9E80 public static let deepOrangeA100 = Color(hex: 0xFF9E80)! /// SwifterSwift: hex #FF6E40 public static let deepOrangeA200 = Color(hex: 0xFF6E40)! /// SwifterSwift: hex #FF3D00 public static let deepOrangeA400 = Color(hex: 0xFF3D00)! /// SwifterSwift: hex #DD2C00 public static let deepOrangeA700 = Color(hex: 0xDD2C00)! /// SwifterSwift: color brown500 public static let brown = brown500 /// SwifterSwift: hex #EFEBE9 public static let brown50 = Color(hex: 0xEFEBE9)! /// SwifterSwift: hex #D7CCC8 public static let brown100 = Color(hex: 0xD7CCC8)! /// SwifterSwift: hex #BCAAA4 public static let brown200 = Color(hex: 0xBCAAA4)! /// SwifterSwift: hex #A1887F public static let brown300 = Color(hex: 0xA1887F)! /// SwifterSwift: hex #8D6E63 public static let brown400 = Color(hex: 0x8D6E63)! /// SwifterSwift: hex #795548 public static let brown500 = Color(hex: 0x795548)! /// SwifterSwift: hex #6D4C41 public static let brown600 = Color(hex: 0x6D4C41)! /// SwifterSwift: hex #5D4037 public static let brown700 = Color(hex: 0x5D4037)! /// SwifterSwift: hex #4E342E public static let brown800 = Color(hex: 0x4E342E)! /// SwifterSwift: hex #3E2723 public static let brown900 = Color(hex: 0x3E2723)! /// SwifterSwift: color grey500 public static let grey = grey500 /// SwifterSwift: hex #FAFAFA public static let grey50 = Color(hex: 0xFAFAFA)! /// SwifterSwift: hex #F5F5F5 public static let grey100 = Color(hex: 0xF5F5F5)! /// SwifterSwift: hex #EEEEEE public static let grey200 = Color(hex: 0xEEEEEE)! /// SwifterSwift: hex #E0E0E0 public static let grey300 = Color(hex: 0xE0E0E0)! /// SwifterSwift: hex #BDBDBD public static let grey400 = Color(hex: 0xBDBDBD)! /// SwifterSwift: hex #9E9E9E public static let grey500 = Color(hex: 0x9E9E9E)! /// SwifterSwift: hex #757575 public static let grey600 = Color(hex: 0x757575)! /// SwifterSwift: hex #616161 public static let grey700 = Color(hex: 0x616161)! /// SwifterSwift: hex #424242 public static let grey800 = Color(hex: 0x424242)! /// SwifterSwift: hex #212121 public static let grey900 = Color(hex: 0x212121)! /// SwifterSwift: color blueGrey500 public static let blueGrey = blueGrey500 /// SwifterSwift: hex #ECEFF1 public static let blueGrey50 = Color(hex: 0xECEFF1)! /// SwifterSwift: hex #CFD8DC public static let blueGrey100 = Color(hex: 0xCFD8DC)! /// SwifterSwift: hex #B0BEC5 public static let blueGrey200 = Color(hex: 0xB0BEC5)! /// SwifterSwift: hex #90A4AE public static let blueGrey300 = Color(hex: 0x90A4AE)! /// SwifterSwift: hex #78909C public static let blueGrey400 = Color(hex: 0x78909C)! /// SwifterSwift: hex #607D8B public static let blueGrey500 = Color(hex: 0x607D8B)! /// SwifterSwift: hex #546E7A public static let blueGrey600 = Color(hex: 0x546E7A)! /// SwifterSwift: hex #455A64 public static let blueGrey700 = Color(hex: 0x455A64)! /// SwifterSwift: hex #37474F public static let blueGrey800 = Color(hex: 0x37474F)! /// SwifterSwift: hex #263238 public static let blueGrey900 = Color(hex: 0x263238)! /// SwifterSwift: hex #000000 public static let black = Color(hex: 0x000000)! /// SwifterSwift: hex #FFFFFF public static let white = Color(hex: 0xFFFFFF)! } } // MARK: - CSS colors public extension Color { /// SwifterSwift: CSS colors. public struct CSS { // http://www.w3schools.com/colors/colors_names.asp /// SwifterSwift: hex #F0F8FF public static let aliceBlue = Color(hex: 0xF0F8FF)! /// SwifterSwift: hex #FAEBD7 public static let antiqueWhite = Color(hex: 0xFAEBD7)! /// SwifterSwift: hex #00FFFF public static let aqua = Color(hex: 0x00FFFF)! /// SwifterSwift: hex #7FFFD4 public static let aquamarine = Color(hex: 0x7FFFD4)! /// SwifterSwift: hex #F0FFFF public static let azure = Color(hex: 0xF0FFFF)! /// SwifterSwift: hex #F5F5DC public static let beige = Color(hex: 0xF5F5DC)! /// SwifterSwift: hex #FFE4C4 public static let bisque = Color(hex: 0xFFE4C4)! /// SwifterSwift: hex #000000 public static let black = Color(hex: 0x000000)! /// SwifterSwift: hex #FFEBCD public static let blanchedAlmond = Color(hex: 0xFFEBCD)! /// SwifterSwift: hex #0000FF public static let blue = Color(hex: 0x0000FF)! /// SwifterSwift: hex #8A2BE2 public static let blueViolet = Color(hex: 0x8A2BE2)! /// SwifterSwift: hex #A52A2A public static let brown = Color(hex: 0xA52A2A)! /// SwifterSwift: hex #DEB887 public static let burlyWood = Color(hex: 0xDEB887)! /// SwifterSwift: hex #5F9EA0 public static let cadetBlue = Color(hex: 0x5F9EA0)! /// SwifterSwift: hex #7FFF00 public static let chartreuse = Color(hex: 0x7FFF00)! /// SwifterSwift: hex #D2691E public static let chocolate = Color(hex: 0xD2691E)! /// SwifterSwift: hex #FF7F50 public static let coral = Color(hex: 0xFF7F50)! /// SwifterSwift: hex #6495ED public static let cornflowerBlue = Color(hex: 0x6495ED)! /// SwifterSwift: hex #FFF8DC public static let cornsilk = Color(hex: 0xFFF8DC)! /// SwifterSwift: hex #DC143C public static let crimson = Color(hex: 0xDC143C)! /// SwifterSwift: hex #00FFFF public static let cyan = Color(hex: 0x00FFFF)! /// SwifterSwift: hex #00008B public static let darkBlue = Color(hex: 0x00008B)! /// SwifterSwift: hex #008B8B public static let darkCyan = Color(hex: 0x008B8B)! /// SwifterSwift: hex #B8860B public static let darkGoldenRod = Color(hex: 0xB8860B)! /// SwifterSwift: hex #A9A9A9 public static let darkGray = Color(hex: 0xA9A9A9)! /// SwifterSwift: hex #A9A9A9 public static let darkGrey = Color(hex: 0xA9A9A9)! /// SwifterSwift: hex #006400 public static let darkGreen = Color(hex: 0x006400)! /// SwifterSwift: hex #BDB76B public static let darkKhaki = Color(hex: 0xBDB76B)! /// SwifterSwift: hex #8B008B public static let darkMagenta = Color(hex: 0x8B008B)! /// SwifterSwift: hex #556B2F public static let darkOliveGreen = Color(hex: 0x556B2F)! /// SwifterSwift: hex #FF8C00 public static let darkOrange = Color(hex: 0xFF8C00)! /// SwifterSwift: hex #9932CC public static let darkOrchid = Color(hex: 0x9932CC)! /// SwifterSwift: hex #8B0000 public static let darkRed = Color(hex: 0x8B0000)! /// SwifterSwift: hex #E9967A public static let darkSalmon = Color(hex: 0xE9967A)! /// SwifterSwift: hex #8FBC8F public static let darkSeaGreen = Color(hex: 0x8FBC8F)! /// SwifterSwift: hex #483D8B public static let darkSlateBlue = Color(hex: 0x483D8B)! /// SwifterSwift: hex #2F4F4F public static let darkSlateGray = Color(hex: 0x2F4F4F)! /// SwifterSwift: hex #2F4F4F public static let darkSlateGrey = Color(hex: 0x2F4F4F)! /// SwifterSwift: hex #00CED1 public static let darkTurquoise = Color(hex: 0x00CED1)! /// SwifterSwift: hex #9400D3 public static let darkViolet = Color(hex: 0x9400D3)! /// SwifterSwift: hex #FF1493 public static let deepPink = Color(hex: 0xFF1493)! /// SwifterSwift: hex #00BFFF public static let deepSkyBlue = Color(hex: 0x00BFFF)! /// SwifterSwift: hex #696969 public static let dimGray = Color(hex: 0x696969)! /// SwifterSwift: hex #696969 public static let dimGrey = Color(hex: 0x696969)! /// SwifterSwift: hex #1E90FF public static let dodgerBlue = Color(hex: 0x1E90FF)! /// SwifterSwift: hex #B22222 public static let fireBrick = Color(hex: 0xB22222)! /// SwifterSwift: hex #FFFAF0 public static let floralWhite = Color(hex: 0xFFFAF0)! /// SwifterSwift: hex #228B22 public static let forestGreen = Color(hex: 0x228B22)! /// SwifterSwift: hex #FF00FF public static let fuchsia = Color(hex: 0xFF00FF)! /// SwifterSwift: hex #DCDCDC public static let gainsboro = Color(hex: 0xDCDCDC)! /// SwifterSwift: hex #F8F8FF public static let ghostWhite = Color(hex: 0xF8F8FF)! /// SwifterSwift: hex #FFD700 public static let gold = Color(hex: 0xFFD700)! /// SwifterSwift: hex #DAA520 public static let goldenRod = Color(hex: 0xDAA520)! /// SwifterSwift: hex #808080 public static let gray = Color(hex: 0x808080)! /// SwifterSwift: hex #808080 public static let grey = Color(hex: 0x808080)! /// SwifterSwift: hex #008000 public static let green = Color(hex: 0x008000)! /// SwifterSwift: hex #ADFF2F public static let greenYellow = Color(hex: 0xADFF2F)! /// SwifterSwift: hex #F0FFF0 public static let honeyDew = Color(hex: 0xF0FFF0)! /// SwifterSwift: hex #FF69B4 public static let hotPink = Color(hex: 0xFF69B4)! /// SwifterSwift: hex #CD5C5C public static let indianRed = Color(hex: 0xCD5C5C)! /// SwifterSwift: hex #4B0082 public static let indigo = Color(hex: 0x4B0082)! /// SwifterSwift: hex #FFFFF0 public static let ivory = Color(hex: 0xFFFFF0)! /// SwifterSwift: hex #F0E68C public static let khaki = Color(hex: 0xF0E68C)! /// SwifterSwift: hex #E6E6FA public static let lavender = Color(hex: 0xE6E6FA)! /// SwifterSwift: hex #FFF0F5 public static let lavenderBlush = Color(hex: 0xFFF0F5)! /// SwifterSwift: hex #7CFC00 public static let lawnGreen = Color(hex: 0x7CFC00)! /// SwifterSwift: hex #FFFACD public static let lemonChiffon = Color(hex: 0xFFFACD)! /// SwifterSwift: hex #ADD8E6 public static let lightBlue = Color(hex: 0xADD8E6)! /// SwifterSwift: hex #F08080 public static let lightCoral = Color(hex: 0xF08080)! /// SwifterSwift: hex #E0FFFF public static let lightCyan = Color(hex: 0xE0FFFF)! /// SwifterSwift: hex #FAFAD2 public static let lightGoldenRodYellow = Color(hex: 0xFAFAD2)! /// SwifterSwift: hex #D3D3D3 public static let lightGray = Color(hex: 0xD3D3D3)! /// SwifterSwift: hex #D3D3D3 public static let lightGrey = Color(hex: 0xD3D3D3)! /// SwifterSwift: hex #90EE90 public static let lightGreen = Color(hex: 0x90EE90)! /// SwifterSwift: hex #FFB6C1 public static let lightPink = Color(hex: 0xFFB6C1)! /// SwifterSwift: hex #FFA07A public static let lightSalmon = Color(hex: 0xFFA07A)! /// SwifterSwift: hex #20B2AA public static let lightSeaGreen = Color(hex: 0x20B2AA)! /// SwifterSwift: hex #87CEFA public static let lightSkyBlue = Color(hex: 0x87CEFA)! /// SwifterSwift: hex #778899 public static let lightSlateGray = Color(hex: 0x778899)! /// SwifterSwift: hex #778899 public static let lightSlateGrey = Color(hex: 0x778899)! /// SwifterSwift: hex #B0C4DE public static let lightSteelBlue = Color(hex: 0xB0C4DE)! /// SwifterSwift: hex #FFFFE0 public static let lightYellow = Color(hex: 0xFFFFE0)! /// SwifterSwift: hex #00FF00 public static let lime = Color(hex: 0x00FF00)! /// SwifterSwift: hex #32CD32 public static let limeGreen = Color(hex: 0x32CD32)! /// SwifterSwift: hex #FAF0E6 public static let linen = Color(hex: 0xFAF0E6)! /// SwifterSwift: hex #FF00FF public static let magenta = Color(hex: 0xFF00FF)! /// SwifterSwift: hex #800000 public static let maroon = Color(hex: 0x800000)! /// SwifterSwift: hex #66CDAA public static let mediumAquaMarine = Color(hex: 0x66CDAA)! /// SwifterSwift: hex #0000CD public static let mediumBlue = Color(hex: 0x0000CD)! /// SwifterSwift: hex #BA55D3 public static let mediumOrchid = Color(hex: 0xBA55D3)! /// SwifterSwift: hex #9370DB public static let mediumPurple = Color(hex: 0x9370DB)! /// SwifterSwift: hex #3CB371 public static let mediumSeaGreen = Color(hex: 0x3CB371)! /// SwifterSwift: hex #7B68EE public static let mediumSlateBlue = Color(hex: 0x7B68EE)! /// SwifterSwift: hex #00FA9A public static let mediumSpringGreen = Color(hex: 0x00FA9A)! /// SwifterSwift: hex #48D1CC public static let mediumTurquoise = Color(hex: 0x48D1CC)! /// SwifterSwift: hex #C71585 public static let mediumVioletRed = Color(hex: 0xC71585)! /// SwifterSwift: hex #191970 public static let midnightBlue = Color(hex: 0x191970)! /// SwifterSwift: hex #F5FFFA public static let mintCream = Color(hex: 0xF5FFFA)! /// SwifterSwift: hex #FFE4E1 public static let mistyRose = Color(hex: 0xFFE4E1)! /// SwifterSwift: hex #FFE4B5 public static let moccasin = Color(hex: 0xFFE4B5)! /// SwifterSwift: hex #FFDEAD public static let navajoWhite = Color(hex: 0xFFDEAD)! /// SwifterSwift: hex #000080 public static let navy = Color(hex: 0x000080)! /// SwifterSwift: hex #FDF5E6 public static let oldLace = Color(hex: 0xFDF5E6)! /// SwifterSwift: hex #808000 public static let olive = Color(hex: 0x808000)! /// SwifterSwift: hex #6B8E23 public static let oliveDrab = Color(hex: 0x6B8E23)! /// SwifterSwift: hex #FFA500 public static let orange = Color(hex: 0xFFA500)! /// SwifterSwift: hex #FF4500 public static let orangeRed = Color(hex: 0xFF4500)! /// SwifterSwift: hex #DA70D6 public static let orchid = Color(hex: 0xDA70D6)! /// SwifterSwift: hex #EEE8AA public static let paleGoldenRod = Color(hex: 0xEEE8AA)! /// SwifterSwift: hex #98FB98 public static let paleGreen = Color(hex: 0x98FB98)! /// SwifterSwift: hex #AFEEEE public static let paleTurquoise = Color(hex: 0xAFEEEE)! /// SwifterSwift: hex #DB7093 public static let paleVioletRed = Color(hex: 0xDB7093)! /// SwifterSwift: hex #FFEFD5 public static let papayaWhip = Color(hex: 0xFFEFD5)! /// SwifterSwift: hex #FFDAB9 public static let peachPuff = Color(hex: 0xFFDAB9)! /// SwifterSwift: hex #CD853F public static let peru = Color(hex: 0xCD853F)! /// SwifterSwift: hex #FFC0CB public static let pink = Color(hex: 0xFFC0CB)! /// SwifterSwift: hex #DDA0DD public static let plum = Color(hex: 0xDDA0DD)! /// SwifterSwift: hex #B0E0E6 public static let powderBlue = Color(hex: 0xB0E0E6)! /// SwifterSwift: hex #800080 public static let purple = Color(hex: 0x800080)! /// SwifterSwift: hex #663399 public static let rebeccaPurple = Color(hex: 0x663399)! /// SwifterSwift: hex #FF0000 public static let red = Color(hex: 0xFF0000)! /// SwifterSwift: hex #BC8F8F public static let rosyBrown = Color(hex: 0xBC8F8F)! /// SwifterSwift: hex #4169E1 public static let royalBlue = Color(hex: 0x4169E1)! /// SwifterSwift: hex #8B4513 public static let saddleBrown = Color(hex: 0x8B4513)! /// SwifterSwift: hex #FA8072 public static let salmon = Color(hex: 0xFA8072)! /// SwifterSwift: hex #F4A460 public static let sandyBrown = Color(hex: 0xF4A460)! /// SwifterSwift: hex #2E8B57 public static let seaGreen = Color(hex: 0x2E8B57)! /// SwifterSwift: hex #FFF5EE public static let seaShell = Color(hex: 0xFFF5EE)! /// SwifterSwift: hex #A0522D public static let sienna = Color(hex: 0xA0522D)! /// SwifterSwift: hex #C0C0C0 public static let silver = Color(hex: 0xC0C0C0)! /// SwifterSwift: hex #87CEEB public static let skyBlue = Color(hex: 0x87CEEB)! /// SwifterSwift: hex #6A5ACD public static let slateBlue = Color(hex: 0x6A5ACD)! /// SwifterSwift: hex #708090 public static let slateGray = Color(hex: 0x708090)! /// SwifterSwift: hex #708090 public static let slateGrey = Color(hex: 0x708090)! /// SwifterSwift: hex #FFFAFA public static let snow = Color(hex: 0xFFFAFA)! /// SwifterSwift: hex #00FF7F public static let springGreen = Color(hex: 0x00FF7F)! /// SwifterSwift: hex #4682B4 public static let steelBlue = Color(hex: 0x4682B4)! /// SwifterSwift: hex #D2B48C public static let tan = Color(hex: 0xD2B48C)! /// SwifterSwift: hex #008080 public static let teal = Color(hex: 0x008080)! /// SwifterSwift: hex #D8BFD8 public static let thistle = Color(hex: 0xD8BFD8)! /// SwifterSwift: hex #FF6347 public static let tomato = Color(hex: 0xFF6347)! /// SwifterSwift: hex #40E0D0 public static let turquoise = Color(hex: 0x40E0D0)! /// SwifterSwift: hex #EE82EE public static let violet = Color(hex: 0xEE82EE)! /// SwifterSwift: hex #F5DEB3 public static let wheat = Color(hex: 0xF5DEB3)! /// SwifterSwift: hex #FFFFFF public static let white = Color(hex: 0xFFFFFF)! /// SwifterSwift: hex #F5F5F5 public static let whiteSmoke = Color(hex: 0xF5F5F5)! /// SwifterSwift: hex #FFFF00 public static let yellow = Color(hex: 0xFFFF00)! /// SwifterSwift: hex #9ACD32 public static let yellowGreen = Color(hex: 0x9ACD32)! } } // MARK: - Flat UI colors public extension Color { /// SwifterSwift: Flat UI colors public struct FlatUI { // http://flatuicolors.com. /// SwifterSwift: hex #1ABC9C public static let turquoise = Color(hex: 0x1abc9c)! /// SwifterSwift: hex #16A085 public static let greenSea = Color(hex: 0x16a085)! /// SwifterSwift: hex #2ECC71 public static let emerald = Color(hex: 0x2ecc71)! /// SwifterSwift: hex #27AE60 public static let nephritis = Color(hex: 0x27ae60)! /// SwifterSwift: hex #3498DB public static let peterRiver = Color(hex: 0x3498db)! /// SwifterSwift: hex #2980B9 public static let belizeHole = Color(hex: 0x2980b9)! /// SwifterSwift: hex #9B59B6 public static let amethyst = Color(hex: 0x9b59b6)! /// SwifterSwift: hex #8E44AD public static let wisteria = Color(hex: 0x8e44ad)! /// SwifterSwift: hex #34495E public static let wetAsphalt = Color(hex: 0x34495e)! /// SwifterSwift: hex #2C3E50 public static let midnightBlue = Color(hex: 0x2c3e50)! /// SwifterSwift: hex #F1C40F public static let sunFlower = Color(hex: 0xf1c40f)! /// SwifterSwift: hex #F39C12 public static let flatOrange = Color(hex: 0xf39c12)! /// SwifterSwift: hex #E67E22 public static let carrot = Color(hex: 0xe67e22)! /// SwifterSwift: hex #D35400 public static let pumkin = Color(hex: 0xd35400)! /// SwifterSwift: hex #E74C3C public static let alizarin = Color(hex: 0xe74c3c)! /// SwifterSwift: hex #C0392B public static let pomegranate = Color(hex: 0xc0392b)! /// SwifterSwift: hex #ECF0F1 public static let clouds = Color(hex: 0xecf0f1)! /// SwifterSwift: hex #BDC3C7 public static let silver = Color(hex: 0xbdc3c7)! /// SwifterSwift: hex #7F8C8D public static let asbestos = Color(hex: 0x7f8c8d)! /// SwifterSwift: hex #95A5A6 public static let concerte = Color(hex: 0x95a5a6)! } }
[ 199494 ]
9c32a133d7f7d535c376e0f146ca4621736e9681
e18dcf3c24f0dda9d6b389cc63f958a5ad8ec3f7
/SodexoPass/ViewController.swift
512eb49322f97342a875cd19bbf3145a2c3c69ce
[ "MIT" ]
permissive
andart/SodexoPass
4ecdb701a0a0e7c6270138803ec8b4c982f4ded5
7afe1911ab4c8bee4e1cf640d2638b86a0271e60
refs/heads/master
2021-01-19T14:18:38.939773
2017-04-17T22:41:10
2017-04-17T22:41:10
88,144,668
1
0
null
null
null
null
UTF-8
Swift
false
false
4,694
swift
// // ViewController.swift // SodexoPass // // Created by Andrey Artemenko on 13/04/2017. // Copyright © 2017 Andrey Artemenko. All rights reserved. // import UIKit import Eureka import TesseractOCR import BarcodeScanner let cardStoreKey = "cardStoreKey" class ViewController: FormViewController, G8TesseractDelegate, BarcodeScannerCodeDelegate, BarcodeScannerErrorDelegate, BarcodeScannerDismissalDelegate { let store = UserDefaults.standard weak var captchaImageView: UIImageView? weak var captchaTextField: UITextField? weak var cardNumberRow: IntRow? override func viewDidLoad() { super.viewDidLoad() var cardNumber = store.object(forKey: cardStoreKey) as! Int? form +++ Section("Проверка баланса карты") <<< IntRow() { $0.title = "Номер карты" $0.placeholder = "Укажите номер" $0.add(rule: RuleRequired()) self.cardNumberRow = $0 if cardNumber != nil { $0.value = cardNumber } }.onCellHighlightChanged({ (cell, row) in if !row.isHighlighted, row.value != nil { cardNumber = row.value self.store.set(cardNumber, forKey: cardStoreKey) } }) <<< ButtonRow() { $0.title = "Сканировать" }.onCellSelection({ (cell, row) in let controller = BarcodeScannerController() controller.codeDelegate = self controller.errorDelegate = self controller.dismissalDelegate = self self.present(controller, animated: true, completion: nil) }) <<< CaptchaRow() { self.captchaImageView = $0.cell.captchaImageView self.captchaTextField = $0.cell.textField $0.cell.textField.placeholder = "Введите символы с картинки" $0.cell.button.addTarget(self, action: #selector(ViewController.reloadCaptcha), for: .touchUpInside) } <<< ButtonRow() { $0.title = "Проверить" }.onCellSelection({ (cell, row) in if cardNumber != nil, let captchaCode = self.captchaTextField?.text { API.shared.checkBalance(cardNumber: "\(cardNumber!)", captchaCode: captchaCode) { summ in let alert = UIAlertController(title: "Доступно", message: "\((summ as! Int) / 100)", preferredStyle: .alert) alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) self.present(alert, animated: true, completion: nil) } } }) API.shared.getCookie() { self.reloadCaptcha() } } func reloadCaptcha() { API.shared.getCaptcha() { (image) in if image != nil { self.captchaImageView?.image = image self.recognizeImage(image!) } } } fileprivate func recognizeImage(_ image: UIImage) { DispatchQueue.global(qos: .userInitiated).async { let tesseract:G8Tesseract = G8Tesseract(language:"eng") tesseract.delegate = self tesseract.image = image.g8_grayScale() tesseract.recognize() DispatchQueue.main.async { self.captchaTextField?.text = tesseract.recognizedText.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) } } } func shouldCancelImageRecognitionForTesseract(tesseract: G8Tesseract!) -> Bool { return false; // return true if you need to interrupt tesseract before it finishes } func barcodeScanner(_ controller: BarcodeScannerController, didCaptureCode code: String, type: String) { controller.dismiss(animated: true, completion: nil) self.cardNumberRow?.value = Int(code) self.cardNumberRow?.cell.textField.text = code self.reloadCaptcha() } func barcodeScanner(_ controller: BarcodeScannerController, didReceiveError error: Error) { print(error) } func barcodeScannerDidDismiss(_ controller: BarcodeScannerController) { controller.dismiss(animated: true, completion: nil) } }
[ -1 ]
f0336cd3a95647c2833dba6769bb3b3d7e55e2f6
bbb79f2f447a1c108a33764550f3b7f35f6f8073
/WebServiceExample/ViewController.swift
bac40ce23fff81d69df97078069e38fe19480af6
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
ProVir/WebServiceSwift
607d58e8c1aee6aced93e0ba65ab3da79ac96fbd
69b872dc6098dd341dec33ac6da8dd90e0137f0f
refs/heads/master
2021-06-06T08:31:19.891834
2020-04-19T14:40:59
2020-04-19T14:40:59
101,470,694
1
0
null
null
null
null
UTF-8
Swift
false
false
6,979
swift
// // ViewController.swift // WebServiceExample // // Created by Короткий Виталий on 24.08.17. // Copyright © 2017 ProVir. All rights reserved. // import UIKit import WebServiceSwift class ViewController: UIViewController { @IBOutlet weak var rawTextView: UITextView! @IBOutlet weak var webView: UIWebView! @IBOutlet weak var rawSwitch: UISwitch! let siteWebProvider: SiteWebProvider = WebService.createDefault().createProvider() let siteYouTubeProvider: WebServiceRequestProvider<SiteWebServiceRequests.SiteYouTube> = WebService.default.createProvider() override func viewDidLoad() { super.viewDidLoad() let rawLabel = UILabel(frame: .zero) rawLabel.text = "Raw mode: " rawLabel.sizeToFit() let rawItem = UIBarButtonItem(customView: rawLabel) navigationItem.rightBarButtonItems?.append(rawItem) siteWebProvider.delegate = self siteYouTubeProvider.excludeDuplicateDefault = true } @IBAction func actionChangeRaw() { if rawSwitch.isOn { rawTextView.isHidden = false webView.isHidden = true } else { rawTextView.isHidden = true webView.isHidden = false } } @IBAction func actionSelect(_ sender: Any) { let alert = UIAlertController(title: "Site select", message: "Select site to go, please:", preferredStyle: .actionSheet) alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil)) alert.addAction(UIAlertAction(title: "Google.com", style: .default, handler: { _ in self.requestSiteSearch(.init(site: .google, domain: "com")) })) alert.addAction(UIAlertAction(title: "Google.ru", style: .default, handler: { _ in self.requestSiteSearch(.init(site: .google, domain: "ru")) })) alert.addAction(UIAlertAction(title: "Yandex.ru", style: .default, handler: { _ in self.requestSiteSearch(.init(site: .yandex, domain: "ru")) })) alert.addAction(UIAlertAction(title: "GMail", style: .default, handler: { _ in self.requestSiteMail(.init(site: .google)) })) alert.addAction(UIAlertAction(title: "Mail.ru", style: .default, handler: { _ in self.requestSiteMail(.init(site: .mail)) })) alert.addAction(UIAlertAction(title: "YouTube", style: .default, handler: { _ in self.requestSiteYouTube() })) present(alert, animated: true, completion: nil) } @IBAction func actionDeleteAll(_ sender: UIBarButtonItem) { WebService.default.deleteAllInStorages() } //MARK: Requests func requestSiteSearch(_ request: SiteWebServiceRequests.SiteSearch) { siteWebProvider.cancelAllRequests() siteYouTubeProvider.cancelRequests() siteWebProvider.requestHtmlDataFromSiteSearch(request, dataFromStorage: { [weak self] html in self?.rawTextView.text = html self?.webView.loadHTMLString(html, baseURL: request.urlSite) }) { [weak self] response in switch response { case .data(let html): self?.webServiceResponse(request: request, isStorageRequest: false, html: html) case .error(let error): self?.webServiceResponse(isStorageRequest: false, error: error) case .canceledRequest: break } } } func requestSiteMail(_ request: SiteWebServiceRequests.SiteMail) { siteYouTubeProvider.cancelRequests() siteWebProvider.requestHtmlDataFromSiteMail(request, includeResponseStorage: true) } func requestSiteYouTube() { siteWebProvider.cancelAllRequests() siteYouTubeProvider.readStorage(dependencyNextRequest: .dependFull) { [weak self] (timeStamp, response) in if case .data(let html) = response { if let timeStamp = timeStamp { print("Data from storage timeStamp = \(timeStamp)") } self?.webServiceResponse(request: SiteWebServiceRequests.SiteYouTube(), isStorageRequest: true, html: html) } } siteYouTubeProvider.performRequest { [weak self] response in switch response { case .data(let html): self?.webServiceResponse(request: SiteWebServiceRequests.SiteYouTube(), isStorageRequest: false, html: html) case .error(let error): self?.webServiceResponse(isStorageRequest: false, error: error) case .canceledRequest: break } } } } //MARK: Responses extension ViewController: SiteWebProviderDelegate { func webServiceResponse(request: WebServiceBaseRequesting, isStorageRequest: Bool, html: String) { let baseUrl: URL if let request = request as? SiteWebServiceRequests.SiteSearch { baseUrl = request.urlSite } else if let request = request as? SiteWebServiceRequests.SiteMail { baseUrl = request.urlSite } else if let request = request as? SiteWebServiceRequests.SiteYouTube { baseUrl = request.urlSite } else { return } rawTextView.text = html webView.loadHTMLString(html, baseURL: baseUrl) } func webServiceResponse(request: WebServiceBaseRequesting, isStorageRequest: Bool, error: Error) { webServiceResponse(isStorageRequest: isStorageRequest, error: error) } func webServiceResponse(isStorageRequest: Bool, error: Error) { if isStorageRequest { print("Error read from storage: \(error)") return } let text = (error as NSError).localizedDescription let alert = UIAlertController(title: "Error", message: text, preferredStyle: .alert) alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) present(alert, animated: true, completion: nil) } }
[ -1 ]
1c7654d8ea30a94e96c29836d77968282cd722d7
c28fa12db577e4a7f5405ffe2dfa074e2d04c0ee
/Sources/XcodesKit/Version+.swift
c4ecec3963fe22c8029558728a823955d025c403
[ "MIT" ]
permissive
DaLopezPapa/xcodes
d95b4e491270bcdf781af82b8bc39eb01ba764f7
1ee0d5b2c5b9b9acd5e8f10eafa3b50634b4bab4
refs/heads/master
2022-12-16T09:23:53.741620
2020-08-29T04:19:00
2020-08-29T04:19:00
292,405,317
1
0
null
2020-09-02T22:11:23
2020-09-02T22:11:22
null
UTF-8
Swift
false
false
2,085
swift
import Version public extension Version { func isEqualWithoutBuildMetadataIdentifiers(to other: Version) -> Bool { return major == other.major && minor == other.minor && patch == other.patch && prereleaseIdentifiers == other.prereleaseIdentifiers } /// If release versions, don't compare build metadata because that's not provided in the /downloads/more list /// if beta versions, compare build metadata because it's available in versions.plist func isEquivalentForDeterminingIfInstalled(toInstalled installed: Version) -> Bool { let isBeta = !prereleaseIdentifiers.isEmpty let otherIsBeta = !installed.prereleaseIdentifiers.isEmpty if isBeta && otherIsBeta { if buildMetadataIdentifiers.isEmpty { return major == installed.major && minor == installed.minor && patch == installed.patch && prereleaseIdentifiers == installed.prereleaseIdentifiers } else { return major == installed.major && minor == installed.minor && patch == installed.patch && prereleaseIdentifiers == installed.prereleaseIdentifiers && buildMetadataIdentifiers.map { $0.lowercased() } == installed.buildMetadataIdentifiers.map { $0.lowercased() } } } else if !isBeta && !otherIsBeta { return major == installed.major && minor == installed.minor && patch == installed.patch } return false } var descriptionWithoutBuildMetadata: String { var base = "\(major).\(minor).\(patch)" if !prereleaseIdentifiers.isEmpty { base += "-" + prereleaseIdentifiers.joined(separator: ".") } return base } var isPrerelease: Bool { prereleaseIdentifiers.isEmpty == false } var isNotPrerelease: Bool { prereleaseIdentifiers.isEmpty == true } }
[ -1 ]
c5b1da3148db9ea35f4c3d69f0f1fee23001adb1
823274052279fca125b1987c378b2764a6d0c1a3
/AttackBox.swift
720979a64f55dae54e5d50268eced260beb842a1
[]
no_license
heat200/FriendlyBashers
e409a81577f78b442638e0036a7f14a303ddd931
422aa917f1116fd4f9e2acb77ad5a68b42bba5c0
refs/heads/master
2021-01-25T04:48:57.836669
2017-06-06T06:12:19
2017-06-06T06:12:19
93,482,897
0
0
null
null
null
null
UTF-8
Swift
false
false
2,703
swift
// // AttackBox.swift // Friendly Bashers // // Created by Bryan Mazariegos on 12/8/16. // Copyright © 2016 Bryan Mazariegos. All rights reserved. // import SpriteKit class AttackBox:SKSpriteNode { var damage:CGFloat = 0 var owner = "" var active = false var ownerChar = "" func setUp(owner:String) { self.owner = owner self.physicsBody = SKPhysicsBody(rectangleOf: self.size) self.physicsBody?.pinned = true self.physicsBody?.affectedByGravity = false self.physicsBody?.allowsRotation = false self.physicsBody?.mass = 0 self.physicsBody?.collisionBitMask = 0 self.physicsBody?.categoryBitMask = AttackBoxCategory self.physicsBody?.contactTestBitMask = CharacterCategory | ItemCategory self.clearPos() gameScene?.run(SKAction.wait(forDuration: 0.15),completion:{ self.ownerChar = (self.parent as! Character).characterName }) } func activateFor(time:Double,damage:CGFloat) { update(0) self.damage = damage active = true gameScene?.run(SKAction.wait(forDuration: time),completion:{ self.damage = 0 self.active = false self.clearPos() }) } func resetPos() { if self.name == "Skill3_Box" { if ownerChar == "Jack-O" { self.position = CGPoint(x: 35, y: -30) } else if ownerChar == "Sarah" { self.position = CGPoint(x: 25, y: -30) } else { self.position = CGPoint(x: 40, y: -30) } } else { if ownerChar == "Jack-O" { self.position = CGPoint(x: 35, y: -25) } else if ownerChar == "Silva" { self.position = CGPoint(x: 35, y: -25) } else if ownerChar == "Sarah" { self.position = CGPoint(x: 25, y: -7) } else if ownerChar == "Cog" { self.position = CGPoint(x: 40, y: -30) } else { self.position = CGPoint(x: 35, y: -7) } } } func clearPos() { self.position = CGPoint(x: 0, y: 5000) } func update(_ iteration:Int) { if iteration < 10 { let newI = iteration + 1 gameScene?.run(SKAction.wait(forDuration: 0.05),completion:{ if self.active { self.resetPos() self.update(newI) } else { self.clearPos() } }) } else { if !self.active { self.clearPos() } } } }
[ -1 ]
143a6f5d9c829effaf39b2236e152788a8763470
c2cc538d931a906fba4bded128304074ee48defd
/tes 2 git/AppDelegate.swift
4fe30bda282c8934fd988791ce08b5be92884b51
[]
no_license
ayyathullahahmad/tes-2-git
2d9f49d770457c15fb9d7953d734f67782c63e54
5870b5905930d1c79e2380da2367e13772764605
refs/heads/main
2023-05-25T23:46:21.627540
2021-06-11T02:07:53
2021-06-11T02:07:53
375,878,921
0
0
null
null
null
null
UTF-8
Swift
false
false
1,354
swift
// // AppDelegate.swift // tes 2 git // // Created by Ayyathullah Ahmad on 11/06/21. // import UIKit @main class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } // MARK: UISceneSession Lifecycle func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { // Called when a new scene session is being created. // Use this method to select a configuration to create the new scene with. return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) } func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) { // Called when the user discards a scene session. // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. // Use this method to release any resources that were specific to the discarded scenes, as they will not return. } }
[ 393222, 393224, 393230, 393250, 344102, 393261, 393266, 213048, 385081, 376889, 393275, 376905, 327756, 254030, 286800, 368727, 180313, 368735, 180320, 376931, 286831, 368752, 286844, 417924, 262283, 286879, 286888, 377012, 164028, 327871, 180416, 377036, 180431, 377046, 418010, 377060, 327914, 205036, 393456, 393460, 418043, 336123, 385280, 336128, 262404, 164106, 180490, 368911, 262416, 262422, 377117, 262436, 336180, 262454, 393538, 262472, 344403, 213332, 65880, 262496, 418144, 262499, 213352, 262507, 246123, 262510, 213372, 385419, 393612, 262550, 262552, 385440, 385443, 385451, 262573, 393647, 385458, 262586, 344511, 262592, 360916, 369118, 328177, 328179, 328182, 328189, 328192, 164361, 410128, 393747, 254490, 188958, 385570, 33316, 377383, 197159, 352821, 197177, 418363, 188987, 369223, 385609, 385616, 352864, 369253, 262760, 352874, 352887, 254587, 377472, 148105, 377484, 352918, 98968, 344744, 361129, 336555, 385713, 434867, 164534, 336567, 164538, 328378, 328386, 344776, 352968, 352971, 418507, 352973, 385742, 385748, 361179, 189153, 369381, 361195, 418553, 344831, 344835, 336643, 344841, 361230, 336659, 418580, 418585, 434970, 369435, 418589, 262942, 418593, 336675, 328484, 418598, 418605, 336696, 361273, 328515, 328519, 361288, 336711, 328522, 426841, 197468, 254812, 361309, 361315, 361322, 328573, 377729, 369542, 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, 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, 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, 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, 370509, 354130, 247637, 337750, 370519, 313180, 354142, 354150, 354156, 345964, 345967, 345970, 345974, 403320, 354172, 247691, 337808, 247700, 329623, 436126, 436132, 337833, 362413, 337844, 346057, 346063, 247759, 329697, 354277, 190439, 247789, 354313, 346139, 436289, 378954, 395339, 338004, 100453, 329832, 329855, 329885, 411805, 346272, 362660, 100524, 387249, 379066, 387260, 256191, 395466, 346316, 411861, 411864, 411868, 411873, 379107, 411876, 387301, 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, 330267, 354855, 10828, 199249, 346721, 174695, 248425, 191084, 338543, 191092, 346742, 330383, 354974, 150183, 174774, 248504, 174777, 223934, 355024, 273108, 355028, 264918, 183005, 256734, 436962, 338660, 338664, 264941, 363251, 207619, 264964, 338700, 256786, 199452, 363293, 396066, 346916, 396069, 215853, 355122, 355131, 355140, 355143, 338763, 355150, 330580, 355166, 265055, 265058, 355175, 387944, 355179, 330610, 355218, 330642, 412599, 207808, 379848, 396245, 330710, 248792, 248798, 347105, 257008, 183282, 265207, 330748, 265214, 330760, 330768, 248862, 396328, 158761, 347176, 199728, 396336, 330800, 396339, 339001, 388154, 388161, 347205, 248904, 330826, 248914, 412764, 339036, 257120, 265320, 248951, 420984, 330889, 347287, 339097, 248985, 44197, 380070, 339112, 249014, 330958, 330965, 265432, 265436, 388319, 388347, 175375, 159005, 175396, 208166, 273708, 347437, 372015, 347441, 372018, 199988, 44342, 175415, 396600, 437566, 175423, 437570, 437575, 437583, 331088, 437587, 331093, 396633, 175450, 437595, 175457, 208227, 175460, 175463, 265580, 437620, 175477, 249208, 175483, 175486, 249214, 175489, 249218, 249224, 249227, 249234, 175513, 175516, 396705, 175522, 355748, 380332, 396722, 208311, 372163, 216517, 380360, 216522, 339404, 372176, 208337, 339412, 413141, 339417, 339420, 249308, 339424, 249312, 339428, 339434, 249328, 69113, 372228, 208398, 380432, 175635, 265778, 265795, 396872, 265805, 224853, 224857, 257633, 224870, 372327, 257646, 372337, 224884, 224887, 224890, 224894, 372353, 224897, 216707, 421508, 126596, 224904, 224909, 11918, 159374, 224913, 126610, 224916, 224919, 126616, 208538, 224922, 224926, 224929, 224932, 257704, 224936, 224942, 257712, 224947, 257716, 257720, 224953, 257724, 224959, 257732, 224965, 224969, 339662, 224975, 257747, 224981, 224986, 257761, 224993, 257764, 224999, 339695, 225012, 257787, 225020, 257790, 339710, 225025, 257794, 339721, 257801, 257804, 225038, 257807, 225043, 372499, 167700, 225048, 257819, 225053, 184094, 225058, 257833, 225066, 257836, 413484, 225070, 225073, 372532, 257845, 225079, 397112, 225082, 397115, 225087, 225092, 225096, 323402, 257868, 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, 430256, 225458, 225461, 225466, 389307, 225470, 381120, 372929, 430274, 225475, 389320, 225484, 225487, 225490, 266453, 225493, 225496, 225499, 225502, 225505, 356578, 217318, 225510, 225514, 225518, 372976, 381176, 397571, 389380, 61722, 356637, 356640, 356643, 356646, 266536, 356649, 356655, 332080, 340275, 356660, 397622, 332090, 225597, 332097, 201028, 348488, 332117, 250199, 250202, 332125, 250210, 348522, 348525, 348527, 332152, 389502, 250238, 332161, 356740, 332172, 373145, 340379, 389550, 324030, 266687, 160234, 127471, 340472, 324094, 266754, 324099, 324102, 324111, 340500, 324117, 324131, 332324, 381481, 356907, 324139, 324142, 356916, 324149, 324155, 348733, 324164, 356934, 348743, 381512, 324170, 324173, 324176, 389723, 332380, 373343, 381545, 340627, 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, 340861, 324478, 340858, 324481, 373634, 398211, 324484, 324487, 381833, 324492, 324495, 430995, 324501, 324510, 422816, 324513, 398245, 201637, 324524, 340909, 324533, 324538, 324541, 398279, 340939, 340941, 209873, 340957, 431072, 398306, 340963, 209895, 201711, 349172, 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, 160895, 349311, 152703, 210052, 210055, 349319, 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, 153227, 333498, 210631, 333511, 259788, 358099, 333534, 366307, 366311, 431851, 366318, 210672, 366321, 366325, 210695, 268041, 210698, 366348, 210706, 399128, 333594, 210719, 358191, 210739, 366387, 399159, 358200, 325440, 366401, 341829, 325446, 46920, 341834, 341838, 341843, 415573, 358234, 341851, 350045, 399199, 259938, 399206, 399215, 358255, 268143, 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, 334045, 350445, 375026, 358644, 350458, 350461, 350464, 350467, 325891, 350475, 375053, 268559, 350480, 432405, 350486, 325914, 350490, 325917, 350493, 350498, 194852, 350504, 358700, 391468, 350509, 358704, 358713, 358716, 383306, 334161, 383321, 383330, 383333, 391530, 383341, 334203, 268668, 194941, 391563, 366990, 416157, 268701, 342430, 375208, 326058, 375216, 334262, 334275, 326084, 358856, 195039, 334304, 334311, 375277, 334321, 350723, 391690, 186897, 342545, 334358, 342550, 342554, 334363, 358941, 350761, 252461, 383536, 358961, 334384, 334394, 252482, 219718, 334407, 334420, 350822, 375400, 334465, 334468, 162445, 326290, 342679, 342683, 260766, 342710, 244409, 260797, 260801, 350917, 154317, 391894, 154328, 416473, 64230, 113388, 342766, 375535, 203506, 342776, 391937, 391948, 375568, 326416, 375571, 375574, 162591, 326441, 383793, 326451, 326454, 375612, 260924, 244540, 326460, 326467, 244551, 326473, 326477, 416597, 326485, 342874, 326490, 326502, 375656, 433000, 326507, 326510, 211825, 211831, 351097, 392060, 359295, 351104, 342915, 400259, 236430, 342930, 252822, 392091, 400285, 252836, 359334, 211884, 400306, 351168, 359361, 359366, 326598, 359382, 359388, 383967, 343015, 359407, 261108, 244726, 261111, 383997, 261129, 261147, 359451, 211998, 261153, 261159, 359470, 359476, 343131, 384098, 384101, 367723, 384107, 187502, 343154, 384114, 212094, 351364, 384135, 384139, 384143, 351381, 384160, 384168, 367794, 384181, 367800, 351423, 384191, 384198, 326855, 253130, 343244, 146642, 359649, 343270, 351466, 351479, 384249, 343306, 261389, 359694, 253200, 261393, 384275, 245020, 245029, 171302, 351534, 376110, 245040, 384314, 425276, 212291, 384323, 343365, 212303, 367965, 343393, 343398, 367980, 425328, 343409, 253303, 154999, 343417, 327034, 245127, 384397, 245136, 245142, 245145, 343450, 245148, 245151, 245154, 245157, 245162, 327084, 359865, 384443, 146876, 327107, 384453, 327110, 327115, 327117, 359886, 359890, 343507, 368092, 343534, 343539, 368119, 343544, 368122, 409091, 359947, 359955, 359983, 343630, 179802, 327275, 245357, 138864, 155254, 155273, 368288, 245409, 425638, 425649, 155322, 425662, 155327, 155351, 155354, 212699, 155363, 155371, 245483, 409335, 155393, 155403, 155422, 360223, 155438, 155442, 155447, 417595, 360261, 155461, 376663, 155482, 261981, 425822, 376671, 155487, 155490, 155491, 327531, 261996, 376685, 261999, 262002, 327539, 147317, 262005, 425845, 262008, 262011, 155516, 155521, 155525, 360326, 155531, 262027, 262030, 262033, 262036, 262039, 262042, 155549, 262045, 262048, 262051, 327589, 155559, 155562, 155565, 393150, 393169, 384977, 155611, 155619, 253923, 155621, 253926, 327654, 204784, 393203, 360438, 253943, 393206, 393212, 155646 ]
867f1f051994842d2c2004deaf084f795abbfe7c
ccbb39484d0e0f4747162897b0506885b63b7792
/EasyChat/Views/NewConversationCell.swift
4ce0c8a1691e1328790ae029d8857a971fc58e11
[]
no_license
atulya22/easychat
23c5ec885515352e876b672ff479a20010928269
2f94b4a695e5e6028f2aa2e9be987711f7088a7f
refs/heads/master
2022-11-15T14:41:16.716091
2020-07-16T03:07:39
2020-07-16T03:07:39
275,039,079
0
0
null
null
null
null
UTF-8
Swift
false
false
2,239
swift
// // NewConversationCell.swift // EasyChat // // Created by Atulya Shetty on 7/8/20. // Copyright © 2020 Atulya Shetty. All rights reserved. // import Foundation import UIKit import SDWebImage class NewConversationTableViewCell: UITableViewCell { static let identifier = "NewConversationTableViewCell" private let userImageView: UIImageView = { let imageView = UIImageView() imageView.contentMode = .scaleAspectFill imageView.layer.cornerRadius = 35 imageView.layer.masksToBounds = true return imageView }() private let userNameLabel: UILabel = { let label = UILabel() label.font = .systemFont(ofSize: 21, weight: .semibold) return label }() override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) contentView.addSubview(userImageView) contentView.addSubview(userNameLabel) } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func layoutSubviews() { super.layoutSubviews() userImageView.frame = CGRect(x: 10, y: 10, width: 70, height: 70) userNameLabel.frame = CGRect(x: userImageView.right + 10, y: 20, width: contentView.width - 20 - userImageView.width, height: 50) } public func configure(with model: SearchResult ) { userNameLabel.text = model.name let path = "images/\(model.email)_profile_picture.png" print(path) StorageManager.shared.downloadURL(for: path, completion: { [weak self] result in switch result { case .success(let url): DispatchQueue.main.async { self?.userImageView.sd_setImage(with: url, completed: nil) } case .failure(let error): print("Failed ot download image:\(error)") } }) } }
[ 348534, 348535 ]
bee28e5a51f1fa457e0fdf202bb7f8fd545377c5
dfec862d5753f8de87fd4147f4931d9ac1dc2a9f
/Sources/Asteroids/Components/Gun.swift
0a1cb82a88ad328221c6973a3bf1124a1234d700
[ "MIT" ]
permissive
fireblade-engine/ecs-demo
c087aeb8ef400012a9b61d331c2aa39eb4d6e69f
dfe5be7fe4fc387db5aee4dc2298b6a8370e99a3
refs/heads/master
2023-09-02T05:25:57.705563
2023-04-20T11:58:14
2023-04-20T11:58:14
116,500,311
22
6
MIT
2023-09-06T22:31:24
2018-01-06T17:03:02
Swift
UTF-8
Swift
false
false
761
swift
// // Gun.swift // FirebladeECSDemo // // Created by Igor Kravchenko on 18.11.2020. // import FirebladeECS import AsteroidsGameLibrary final class Gun: ComponentInitializable { var shooting = false var offsetFromParent: Vector var timeSinceLastShot = 0.0 var minimumShotInterval = 0.0 var bulletLifetime = 0.0 init(offsetX: Double, offsetY: Double, minimumShotInterval: Double, bulletLifetime: Double) { offsetFromParent = [offsetX, offsetY] self.minimumShotInterval = minimumShotInterval self.bulletLifetime = bulletLifetime } required init() { shooting = false offsetFromParent = [] timeSinceLastShot = 0 minimumShotInterval = 0 bulletLifetime = 0 } }
[ -1 ]
5141cc70735c880b5a805fc2fea2fb7aa8b91f62
d6a9bfa281283ac87ad129b2422104df68caa428
/memeMe-V1.0/Meme.swift
dc59ee68bd95a64ef6cb3c22cc5be3fc70e63bf8
[]
no_license
renadnasser1/memeMe-V1.0
44ceb9c847e6eada0fe638797f8d47b52d405182
bb21f84a2b0642fe11fa4528fd24f34e47f4399b
refs/heads/master
2022-09-20T23:42:59.316844
2020-06-06T10:55:01
2020-06-06T10:55:01
269,355,070
0
0
null
null
null
null
UTF-8
Swift
false
false
340
swift
// // Meme.swift // memeMe-V1.0 //updated // Created by Renad nasser on 04/06/2020. // Copyright © 2020 Renad nasser. All rights reserved. // import Foundation import Foundation import UIKit struct Meme{ var topText: String var bottomText: String var originalImage: UIImage var memedImage: UIImage }
[ -1 ]
682238bd8b9c447652a9f8480a54d68497ff5504
8e28fe6bea83b5cba89683c8d6976899cf723476
/Test-444-1/Test-444-1Tests/Test_444_1Tests.swift
b894e78342957e407cc46dba6031059f20d2dc59
[]
no_license
zma1014/Coding-Assignment-01
4b1074c4e9ee2b36a025d54becb0086760c43ccc
9dd16c6012326750c5bb550f80889fb484194d91
refs/heads/master
2020-12-23T08:09:08.471004
2020-01-29T22:25:17
2020-01-29T22:25:17
237,094,122
0
0
null
2020-01-29T22:22:08
2020-01-29T22:22:08
null
UTF-8
Swift
false
false
917
swift
// // Test_444_1Tests.swift // Test-444-1Tests // // Created by Rebecca Slatkin on 1/13/20. // Copyright © 2020 June Life. All rights reserved. // import XCTest @testable import Test_444_1 class Test_444_1Tests: XCTestCase { override func setUp() { // Put setup code here. This method is called before the invocation of each test method in the class. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. } func testExample() { // This is an example of a functional test case. // Use XCTAssert and related functions to verify your tests produce the correct results. } func testPerformanceExample() { // This is an example of a performance test case. self.measure { // Put the code you want to measure the time of here. } } }
[ 282633, 313357, 182296, 241692, 98333, 16419, 223268, 329765, 102437, 229413, 315432, 292902, 325674, 315434, 204840, 354345, 223274, 243759, 278570, 344107, 233517, 124975, 241716, 253999, 319542, 243767, 346162, 229430, 124984, 358456, 325694, 288833, 352326, 313416, 254027, 311372, 354385, 196691, 315476, 280661, 329814, 338007, 278615, 307289, 200794, 354393, 309345, 280675, 321637, 329829, 319591, 280677, 313447, 315498, 278634, 319598, 288879, 352368, 299121, 284788, 233589, 280694, 333940, 237689, 215164, 313469, 215166, 278655, 292992, 333955, 280712, 215178, 241808, 323729, 325776, 317587, 278677, 284826, 278685, 346271, 311458, 278691, 49316, 233636, 333991, 333992, 284842, 32941, 278704, 239793, 241843, 278708, 125109, 131256, 182456, 184505, 299198, 379071, 299203, 301251, 309444, 338119, 282831, 321745, 334042, 254170, 356576, 317664, 338150, 176362, 321772, 286958, 125169, 338164, 327929, 184570, 243962, 12542, 125183, 309503, 194820, 125188, 313608, 321800, 125193, 375051, 180493, 125198, 325905, 254226, 125203, 338197, 334103, 325912, 315673, 125208, 299293, 237856, 278816, 125217, 233762, 211235, 217380, 305440, 151847, 282919, 325931, 321840, 332083, 127284, 332085, 125235, 336183, 280887, 125240, 332089, 278842, 282939, 315706, 287041, 241986, 260418, 332101, 182598, 323916, 319821, 254286, 348492, 325968, 323920, 250192, 6481, 344401, 348500, 366929, 155990, 366930, 6489, 272729, 332123, 379225, 354655, 391520, 106847, 323935, 321894, 242023, 280939, 242029, 246127, 250226, 354676, 246136, 139640, 246137, 291192, 317820, 211326, 313727, 362881, 240002, 248194, 225670, 332167, 242058, 311691, 395659, 227725, 395661, 108944, 240016, 291224, 317852, 121245, 283038, 141728, 61857, 246178, 315810, 285090, 61859, 289189, 375207, 108972, 340398, 311727, 377264, 61873, 334260, 61880, 283064, 319930, 311738, 278970, 336317, 293310, 311745, 278978, 127427, 127428, 283075, 324039, 188871, 129483, 317901, 281040, 278993, 326100, 278999, 328152, 176601, 242139, 369116, 285150, 287198, 279008, 342498, 242148, 242149, 195045, 279013, 127465, 330218, 279018, 319981, 281072, 109042, 279029, 279032, 233978, 279039, 324097, 342536, 287241, 279050, 340490, 289304, 279065, 342553, 322078, 291358, 182817, 375333, 377386, 283184, 23092, 315960, 242237, 352829, 301638, 348742, 322120, 55881, 348749, 340558, 281166, 244310, 332378, 354911, 436832, 242277, 66150, 244327, 344680, 111208, 191082, 313966, 281199, 313971, 244347, 279164, 189057, 311941, 348806, 279177, 369289, 330379, 344715, 184973, 311949, 326287, 316049, 311954, 334481, 330387, 111253, 330388, 352917, 227990, 230040, 111258, 111259, 318107, 271000, 342682, 279206, 295590, 287404, 303793, 318130, 299699, 299700, 164533, 338613, 314040, 109241, 287417, 158394, 342713, 285373, 66242, 248517, 363211, 334547, 279252, 318173, 289502, 363230, 295652, 338662, 285415, 330474, 346858, 129773, 289518, 322291, 312052, 312053, 199414, 154359, 35583, 205568, 162561, 299776, 191235, 363263, 285444, 336648, 264968, 322316, 117517, 326414, 312079, 322319, 166676, 207640, 326429, 336671, 326433, 344865, 279336, 318250, 295724, 353069, 152365, 312108, 318252, 328499, 242485, 353078, 230199, 353079, 336702, 342847, 420677, 353094, 353095, 299849, 283467, 293711, 281427, 353109, 244568, 281433, 244570, 230234, 109409, 293730, 303972, 351077, 275303, 342887, 201577, 326505, 242541, 246641, 330609, 246648, 209785, 269178, 177019, 279417, 361337, 254850, 359298, 240518, 109447, 287622, 228233, 316298, 228234, 236428, 58253, 308107, 56208, 295824, 308112, 326553, 209817, 324506, 318364, 324507, 127902, 240544, 189348, 324517, 289703, 353195, 140204, 316333, 353197, 347055, 326581, 316343, 353216, 330689, 349121, 363458, 213960, 279498, 316364, 338899, 340955, 248796, 248797, 207838, 50143, 130016, 340961, 64485, 314342, 123881, 324586, 340974, 289774, 304110, 320494, 316405, 240630, 295927, 201720, 304122, 320507, 328700, 314362, 330754, 328706, 320516, 230410, 330763, 320527, 146448, 324625, 316437, 322582, 418837, 320536, 197657, 281626, 201755, 326685, 336929, 300068, 357414, 248872, 345132, 238639, 252980, 300084, 322612, 359478, 324666, 238651, 302139, 336960, 21569, 214086, 359495, 238664, 250956, 300111, 314448, 341073, 339030, 353367, 156764, 156765, 314467, 281700, 250981, 322663, 300136, 316520, 228458, 207979, 318572, 316526, 357486, 187506, 353397, 337017, 160891, 341115, 363644, 150657, 187521, 248961, 349316, 279685, 349318, 222343, 228491, 228493, 285838, 177296, 169104, 162961, 326804, 308372, 296086, 324760, 119962, 300187, 296092, 300188, 339102, 302240, 343203, 300201, 300202, 253099, 238765, 3246, 318639, 279728, 337077, 367799, 339130, 64700, 343234, 367810, 259268, 353479, 353480, 283847, 62665, 353481, 244940, 283853, 353482, 283852, 290000, 316627, 228563, 296153, 357595, 279774, 298212, 304356, 330984, 328940, 228588, 234733, 253167, 279792, 353523, 353524, 298228, 128251, 216315, 316669, 208124, 363771, 388349, 228609, 320770, 279814, 322824, 242954, 328971, 292107, 318733, 312587, 353551, 251153, 245019, 320796, 126237, 333090, 130338, 208164, 130343, 130348, 351537, 345396, 318775, 300343, 312634, 116026, 222524, 216386, 193859, 286018, 279875, 345415, 312648, 230729, 224586, 372043, 177484, 251213, 238927, 296273, 331090, 120148, 318805, 283991, 222559, 314720, 292195, 230756, 294243, 314726, 314728, 333160, 230765, 327024, 327025, 243056, 316787, 116084, 314741, 312689, 314739, 327031, 279920, 314751, 318848, 306559, 378244, 314758, 298374, 314760, 388487, 368011, 304524, 314766, 296335, 112017, 112018, 9619, 234898, 306579, 282007, 357786, 314783, 290207, 333220, 314789, 279974, 314791, 282024, 245161, 316842, 241066, 314798, 286129, 173491, 150965, 210358, 284089, 228795, 292283, 302529, 302531, 163268, 380357, 415171, 300487, 361927, 300489, 370123, 148940, 280013, 310732, 64975, 312782, 327121, 222675, 366037, 210390, 210391, 210392, 353750, 210393, 228827, 310748, 286172, 103909, 310757, 245223, 187878, 280041, 361963, 191981, 54765, 321009, 251378, 333300, 191990, 343542, 280055, 300536, 288249, 343543, 286205, 290301, 210433, 282114, 228867, 366083, 323080, 329225, 230921, 253452, 323087, 329232, 304656, 316946, 146964, 398869, 175639, 374296, 308764, 349726, 282146, 306723, 245287, 245292, 349741, 169518, 230959, 312880, 286254, 288309, 290358, 312889, 235070, 288318, 349763, 124485, 56902, 288326, 288327, 292425, 243274, 128587, 333388, 333393, 290390, 235095, 300630, 196187, 343647, 345700, 374372, 282213, 323178, 243307, 312940, 120427, 204397, 138863, 325231, 54893, 222832, 224883, 314998, 247416, 366203, 323196, 325245, 175741, 337535, 339584, 294529, 312965, 224901, 282245, 282246, 288392, 229001, 310923, 188048, 323217, 239250, 282259, 345752, 229020, 255649, 245412, 323236, 40613, 40614, 206504, 40615, 229029, 282280, 298661, 61101, 321199, 337591, 321207, 296632, 319162, 280251, 323263, 323264, 282303, 286399, 321219, 218819, 319177, 306890, 280267, 212685, 333517, 333520, 245457, 241361, 313041, 333521, 241365, 302802, 181975, 333523, 280278, 280280, 298712, 18138, 278234, 294622, 321247, 278240, 325346, 333542, 12010, 212716, 212717, 280300, 282348, 284401, 282358, 313081, 286459, 325371, 124669, 194303, 278272, 319233, 175873, 323331, 323332, 280329, 284429, 323346, 278291, 321302, 294678, 366360, 116505, 249626, 284442, 325404, 321310, 282400, 241441, 241442, 325410, 339745, 341796, 247590, 257830, 317232, 282417, 321337, 282427, 319292, 360252, 325439, 315202, 307011, 325445, 153415, 345929, 159562, 341836, 325457, 18262, 370522, 188251, 307039, 345951, 362337, 284514, 345955, 296806, 292712, 288619, 325484, 313199, 292720, 362352, 313203, 325492, 317304, 333688, 241528, 194429, 124798, 325503, 182144, 339841, 305026, 327557, 247686, 243591, 253829, 333701, 67463, 325515, 243597, 325518, 329622, 337815, 282518, 282519, 124824, 214937, 118685, 298909, 319392, 292771, 354212, 313254, 333735, 294823, 284587, 124852, 243637, 288697, 214977, 174019, 163781, 247757, 344013, 212946, 219101, 280541, 292836, 298980, 294886, 337895, 174057, 247785, 253929, 327661, 362480, 329712, 325619, 333817, 313339 ]
a0e3eccfecca7e6ffb0d20d44ad39f87a6de7e02
8afcaf709ff5f26b9b0d4ee65ebc146b00a2c7ab
/PeevedPenguins2017/MainMenu.swift
2c8272ca7dcf7c65663e37293a9f81d954b0ad34
[]
no_license
BrandonTroche/iOS-Game---Angry-Birds-Clone-2017-Swift-
0af8a8e9fac5886bdfa8d844c19fa49b6b3d2b65
445f02e4edc042a33a61d2a964951ea75982c893
refs/heads/master
2021-01-25T09:14:49.516771
2017-06-09T08:05:42
2017-06-09T08:05:42
93,803,668
1
0
null
null
null
null
UTF-8
Swift
false
false
1,156
swift
import SpriteKit class MainMenu: SKScene { /* UI Connections */ var buttonPlay: MSButtonNode! override func didMove(to view: SKView) { /* Setup your scene here */ /* Set UI connections */ buttonPlay = self.childNode(withName: "buttonPlay") as! MSButtonNode buttonPlay.selectedHandler = { self.loadGame() } } func loadGame() { /* 1) Grab reference to our SpriteKit view */ guard let skView = self.view as SKView! else { print("Could not get Skview") return } /* 2) Load Game scene */ /* Load Game scene */ guard let scene = GameScene.level(1) else { print("Could not load GameScene with level 1") return } /* 3) Ensure correct aspect mode */ scene.scaleMode = .aspectFit /* Show debug */ skView.showsPhysics = true skView.showsDrawCount = true skView.showsFPS = true /* 4) Start game scene */ skView.presentScene(scene) } }
[ -1 ]
9df6809588728ac3fbf407e017031466221f0ed7
06f50d9319a6a6a90cb9c8198313a609a0ef9f41
/Photage/Photage/ViewController.swift
1567f007e7a83a15b77ace30d5f1f564b663ba5b
[]
no_license
klkelvinlin/Photage
a7d3a8b7dea07adbbd77ce6c24bf0fc31984031d
c48559046816cb7eb69dfe55ae8a6631d5384da1
refs/heads/master
2021-05-31T21:05:29.535315
2016-05-01T22:48:27
2016-05-01T22:48:27
null
0
0
null
null
null
null
UTF-8
Swift
false
false
14,589
swift
// // ViewController.swift // Photage // // Created by Kelvin Lam on 4/29/16. // Copyright © 2016 Lins. All rights reserved. // import UIKit import InstagramKit import SDWebImage import TOCropViewController import FillableLoaders import Zip import AFNetworking class ViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, TOCropViewControllerDelegate { @IBOutlet weak var headerView: UIView! @IBOutlet weak var profileImageView: UIImageView! @IBOutlet weak var zipButton: UIButton! @IBOutlet weak var nameLabel: UILabel! @IBOutlet weak var collectionView: UICollectionView! @IBOutlet weak var welcomeLabel: UILabel! @IBOutlet weak var signButton: UIButton! private var imageArray:[AnyObject]! private var loader: FillableLoader = FillableLoader() private var isLoggedIn = false private var progress:Double! = 0.0 override func viewDidLoad() { super.viewDidLoad() collectionView.delegate = self collectionView.dataSource = self imageArray = [] zipButton.enabled = false NSNotificationCenter.defaultCenter().addObserver(self, selector: "updateAuthStatus", name: "InstaAuthed", object: nil) updateUI() } override func viewDidAppear(animated: Bool) { } func updateAuthStatus() { isLoggedIn = User.instance.isLoggedIn() if isLoggedIn{ fetchProfile() fetchImages() updateUI() } } func updateUI(){ //Hide components if a user has not signed in yet. headerView.hidden = !isLoggedIn collectionView.hidden = !isLoggedIn zipButton.hidden = !isLoggedIn welcomeLabel.hidden = isLoggedIn signButton.hidden = isLoggedIn } //Fetch current user's profile(name, profile photo url) func fetchProfile(){ InstagramEngine.sharedEngine().getSelfUserDetailsWithSuccess( {(instagramUser) in if let u:InstagramUser = instagramUser { self.nameLabel.text = u.username self.profileImageView.sd_setImageWithURL(u.profilePictureURL) } }) {(err, serverStatusCode) in print("Error[getSelfUserDetailsWithSuccess]: \(err.localizedDescription)") } } //Fetch current user's recent feeds func fetchImages() { InstagramEngine.sharedEngine().getSelfRecentMediaWithSuccess( {(medias, pagination) in if let mediaArray:[InstagramMedia] = medias{ for media in mediaArray{ if self.imageArray.count<10{ self.imageArray.append(media.standardResolutionImageURL) } } self.collectionView.reloadData() } }) { (err, statusCode) in print("Error[getSelfFeedWithSuccess]: \(err.localizedDescription)") } } //Count of images func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int{ return imageArray.count } //Fill cells func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell{ let cell = collectionView.dequeueReusableCellWithReuseIdentifier("imageCell", forIndexPath: indexPath) as! ImageCell if let url = imageArray[indexPath.item] as? NSURL{ cell.load(url) }else if let image = imageArray[indexPath.item] as? UIImage{ cell.imageView.image = image }else{ print("Wrong element type in image array") } return cell } //Tap a cell to present cropping view func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) { let cropViewController = TOCropViewController.init(image: User.instance.images[indexPath.item]) cropViewController.delegate = self self.presentViewController(cropViewController, animated: true, completion: nil) } //Process cropping func cropViewController(cropViewController: TOCropViewController!, didCropToImage image: UIImage!, withRect cropRect: CGRect, angle: Int) { imageArray.append(image) User.instance.images.append(image) let indexPath = NSIndexPath(forRow: imageArray.count-1, inSection: 0) collectionView.insertItemsAtIndexPaths([indexPath]) zipButton.enabled = true cropViewController.dismissViewControllerAnimated(true, completion: nil) } //Save images, zip and upload @IBAction func didTapZip(sender: AnyObject) { loader = WavesLoader.showProgressBasedLoaderWithPath(githubPath()) updateProgress(0.0) var paths:[NSURL] = [] //Save images to a directory for(var i = 0; i<User.instance.images.count;i++){ if let data = UIImageJPEGRepresentation(User.instance.images[i] , 0.95) { let filename = getDocumentsDirectory().stringByAppendingPathComponent("\(i).jpg") let url:NSURL = NSURL(fileURLWithPath: filename) data.writeToURL(url, atomically: true) paths.append(url) updateProgress(0.02) } } //Zip the directory do { let zipFilePath = try Zip.quickZipFiles(paths, fileName: "archive") updateProgress(0.2) //Upload let data:NSData = NSData(contentsOfURL:zipFilePath)!//UIImageJPEGRepresentation(User.instance.images[0] , 0.8)! let url = "http://www.linsapp.com/api/messages/zip" let request = AFHTTPRequestSerializer().multipartFormRequestWithMethod("POST", URLString: url, parameters: nil, constructingBodyWithBlock: { (formData) -> Void in //print(data) print(data.length) formData.appendPartWithFileData(data, name: "imageZip", fileName: "archive.zip", mimeType: "application/zip") }, error: nil) let configuration = NSURLSessionConfiguration.defaultSessionConfiguration() let manager = AFURLSessionManager.init(sessionConfiguration: configuration) let uploadTask:NSURLSessionUploadTask = manager.uploadTaskWithStreamedRequest(request, progress: { uploadProgress -> Void in let progress:NSProgress = uploadProgress print(progress.fractionCompleted) self.updateProgress(progress.fractionCompleted/2.0) }, completionHandler: { (response, responseObject, error) -> Void in let resp = response as! NSHTTPURLResponse let code:NSInteger = resp.statusCode self.loader.removeLoader() if code != 201{ self.showAlert("Error",message: "\(code)") }else{ self.showAlert("Success", message: "The zip file has been uploaded.") } print(resp.statusCode) print(responseObject) }) uploadTask.resume() } catch let error as NSError{ print("Error[didTapZip]: \(error.localizedDescription)") } } func updateProgress(delta:Double){ progress = progress + delta loader.progress = CGFloat(progress) } func showAlert(title:String, message:String) { let alertController = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.Alert) alertController.addAction(UIAlertAction(title: "Dismiss", style: UIAlertActionStyle.Default,handler: nil)) self.presentViewController(alertController, animated: true, completion: nil) } func getDocumentsDirectory() -> NSString { let paths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true) let documentsDirectory = paths[0] return documentsDirectory } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } deinit{ NSNotificationCenter.defaultCenter().removeObserver(self) } func githubPath() -> CGPath { //Created with PaintCode let bezierPath = UIBezierPath() bezierPath.moveToPoint(CGPointMake(114.86, 69.09)) bezierPath.addCurveToPoint(CGPointMake(115.66, 59.2), controlPoint1: CGPointMake(115.31, 66.12), controlPoint2: CGPointMake(115.59, 62.86)) bezierPath.addCurveToPoint(CGPointMake(107, 35.39), controlPoint1: CGPointMake(115.64, 43.53), controlPoint2: CGPointMake(108.4, 37.99)) bezierPath.addCurveToPoint(CGPointMake(105.55, 16.26), controlPoint1: CGPointMake(109.05, 23.51), controlPoint2: CGPointMake(106.66, 18.11)) bezierPath.addCurveToPoint(CGPointMake(85.72, 23.96), controlPoint1: CGPointMake(101.45, 14.75), controlPoint2: CGPointMake(91.27, 20.15)) bezierPath.addCurveToPoint(CGPointMake(50.32, 24.67), controlPoint1: CGPointMake(76.66, 21.21), controlPoint2: CGPointMake(57.51, 21.48)) bezierPath.addCurveToPoint(CGPointMake(30.07, 16.34), controlPoint1: CGPointMake(37.07, 14.84), controlPoint2: CGPointMake(30.07, 16.34)) bezierPath.addCurveToPoint(CGPointMake(28.87, 37.07), controlPoint1: CGPointMake(30.07, 16.34), controlPoint2: CGPointMake(25.54, 24.76)) bezierPath.addCurveToPoint(CGPointMake(21.26, 57.69), controlPoint1: CGPointMake(24.51, 42.83), controlPoint2: CGPointMake(21.26, 46.9)) bezierPath.addCurveToPoint(CGPointMake(21.68, 65.07), controlPoint1: CGPointMake(21.26, 60.28), controlPoint2: CGPointMake(21.41, 62.72)) bezierPath.addCurveToPoint(CGPointMake(56.44, 95.87), controlPoint1: CGPointMake(25.43, 85.52), controlPoint2: CGPointMake(41.07, 94.35)) bezierPath.addCurveToPoint(CGPointMake(50.97, 105.13), controlPoint1: CGPointMake(54.13, 97.69), controlPoint2: CGPointMake(51.35, 101.13)) bezierPath.addCurveToPoint(CGPointMake(37.67, 106.24), controlPoint1: CGPointMake(48.06, 107.07), controlPoint2: CGPointMake(42.22, 107.72)) bezierPath.addCurveToPoint(CGPointMake(19.33, 92.95), controlPoint1: CGPointMake(31.31, 104.15), controlPoint2: CGPointMake(28.87, 91.09)) bezierPath.addCurveToPoint(CGPointMake(19.47, 95.96), controlPoint1: CGPointMake(17.27, 93.35), controlPoint2: CGPointMake(17.68, 94.76)) bezierPath.addCurveToPoint(CGPointMake(27.22, 105.53), controlPoint1: CGPointMake(22.37, 97.91), controlPoint2: CGPointMake(25.11, 100.34)) bezierPath.addCurveToPoint(CGPointMake(43.01, 116.64), controlPoint1: CGPointMake(28.84, 109.52), controlPoint2: CGPointMake(32.24, 116.64)) bezierPath.addCurveToPoint(CGPointMake(50.28, 116.12), controlPoint1: CGPointMake(47.29, 116.64), controlPoint2: CGPointMake(50.28, 116.12)) bezierPath.addCurveToPoint(CGPointMake(50.37, 130.24), controlPoint1: CGPointMake(50.28, 116.12), controlPoint2: CGPointMake(50.37, 126.28)) bezierPath.addCurveToPoint(CGPointMake(44.43, 138.27), controlPoint1: CGPointMake(50.37, 134.8), controlPoint2: CGPointMake(44.43, 136.08)) bezierPath.addCurveToPoint(CGPointMake(47.97, 139.22), controlPoint1: CGPointMake(44.43, 139.14), controlPoint2: CGPointMake(46.39, 139.22)) bezierPath.addCurveToPoint(CGPointMake(57.59, 131.79), controlPoint1: CGPointMake(51.09, 139.22), controlPoint2: CGPointMake(57.59, 136.53)) bezierPath.addCurveToPoint(CGPointMake(57.65, 113.15), controlPoint1: CGPointMake(57.59, 128.02), controlPoint2: CGPointMake(57.65, 115.36)) bezierPath.addCurveToPoint(CGPointMake(60.15, 106.76), controlPoint1: CGPointMake(57.65, 108.3), controlPoint2: CGPointMake(60.15, 106.76)) bezierPath.addCurveToPoint(CGPointMake(59.55, 136.08), controlPoint1: CGPointMake(60.15, 106.76), controlPoint2: CGPointMake(60.46, 132.61)) bezierPath.addCurveToPoint(CGPointMake(56.55, 141.39), controlPoint1: CGPointMake(58.48, 140.16), controlPoint2: CGPointMake(56.55, 139.58)) bezierPath.addCurveToPoint(CGPointMake(66.95, 136.13), controlPoint1: CGPointMake(56.55, 144.1), controlPoint2: CGPointMake(64.36, 142.05)) bezierPath.addCurveToPoint(CGPointMake(68.06, 106.15), controlPoint1: CGPointMake(68.96, 131.5), controlPoint2: CGPointMake(68.06, 106.15)) bezierPath.addLineToPoint(CGPointMake(70.15, 106.1)) bezierPath.addCurveToPoint(CGPointMake(70.1, 123.02), controlPoint1: CGPointMake(70.15, 106.1), controlPoint2: CGPointMake(70.17, 117.71)) bezierPath.addCurveToPoint(CGPointMake(72.63, 138.73), controlPoint1: CGPointMake(70.03, 128.51), controlPoint2: CGPointMake(69.48, 135.46)) bezierPath.addCurveToPoint(CGPointMake(81.03, 141.22), controlPoint1: CGPointMake(74.7, 140.89), controlPoint2: CGPointMake(81.03, 144.67)) bezierPath.addCurveToPoint(CGPointMake(76.59, 132.13), controlPoint1: CGPointMake(81.03, 139.21), controlPoint2: CGPointMake(76.59, 137.56)) bezierPath.addLineToPoint(CGPointMake(76.59, 107.12)) bezierPath.addCurveToPoint(CGPointMake(79.85, 115.34), controlPoint1: CGPointMake(79.29, 107.12), controlPoint2: CGPointMake(79.85, 115.34)) bezierPath.addLineToPoint(CGPointMake(80.82, 130.61)) bezierPath.addCurveToPoint(CGPointMake(86.63, 138.51), controlPoint1: CGPointMake(80.82, 130.61), controlPoint2: CGPointMake(80.17, 136.19)) bezierPath.addCurveToPoint(CGPointMake(94.01, 138.17), controlPoint1: CGPointMake(88.91, 139.34), controlPoint2: CGPointMake(93.78, 139.56)) bezierPath.addCurveToPoint(CGPointMake(88.08, 130.41), controlPoint1: CGPointMake(94.24, 136.78), controlPoint2: CGPointMake(88.14, 134.73)) bezierPath.addCurveToPoint(CGPointMake(88.19, 114.82), controlPoint1: CGPointMake(88.05, 127.79), controlPoint2: CGPointMake(88.19, 126.25)) bezierPath.addCurveToPoint(CGPointMake(81.55, 95.81), controlPoint1: CGPointMake(88.19, 103.4), controlPoint2: CGPointMake(86.71, 99.18)) bezierPath.addCurveToPoint(CGPointMake(114.86, 69.09), controlPoint1: CGPointMake(96.52, 94.22), controlPoint2: CGPointMake(112.06, 87.3)) bezierPath.closePath() bezierPath.miterLimit = 4; return bezierPath.CGPath } }
[ -1 ]
85985308a421536f917d1e837ca9ad4ddaa3a19a
05f63ccac723a01297b37bd6628d1d4939e0193f
/Data/UseCases/RemoteFetchReferences/PokeAPIRequest.swift
68fd97e813810e8795ea496a8ea0f9ab5d8c8fe2
[ "MIT" ]
permissive
genalex25/VIP-Oxxo
cbc4a7bb056175b69f9d8c98210eb31d174716cd
4ee70cf7a112da8db49ad7486ad3521223088a2a
refs/heads/main
2023-07-08T01:40:21.611920
2021-08-20T08:17:57
2021-08-20T08:17:57
398,196,040
0
0
null
null
null
null
UTF-8
Swift
false
false
864
swift
import Foundation public protocol PokeAPIRequest { var resource: String { get } var method: String { get } var queryItems: [URLQueryItem]? { get } } public extension PokeAPIRequest { var scheme: String { return "https" } var baseURL: String { return "pokeapi.co" } var path: String { return "/api/v2/" + resource } var serviceURL: URL { var components = URLComponents() components.scheme = scheme components.host = baseURL components.path = path components.queryItems = queryItems return components.url! } var request: URLRequest { var request = URLRequest(url: serviceURL) request.httpMethod = method return request } var queryItems: [URLQueryItem]? { return nil } }
[ -1 ]
4a535026b85a765e47a7d5457df8230b657aa638
554ec91552bda32d9ef53c8e15188e8adbefcfeb
/Model/LGYear.swift
1d4e7cfc9d2951cbc9f40ce05b65b37e91ab4ddf
[]
no_license
lina0611/Sample
79a18fd5fc03922f7cb783f91c8b961db632551a
0dae94a9b91a033f74e2205c1b4841b717f91895
refs/heads/master
2020-07-23T01:45:57.976520
2019-09-09T21:24:09
2019-09-12T15:54:11
178,981,169
0
0
null
2019-08-12T02:16:00
2019-04-02T02:13:42
Swift
UTF-8
Swift
false
false
4,157
swift
// // LGYear.swift // ExpenseTracker // // Created by Lina Gao on 7/17/19. // Copyright © 2019 Lina Gao. All rights reserved. // import Foundation class LGYear { /// An array of month. Start from January to December. var monthArray = [LGMonth]() var yearInStringFormat = "" // MARK: - Public functions /// Store all records in this year func store(allRecords: [LGRecord]) { divideRecordsIntoTwelveMonth(allRecords) } /// Store all incomes in this year func store(allIncomes: [Income]) { divideIncomesIntoTwelveMonth(allIncomes) } init() { generateEmptyMonths() } init(year: String, dictionary: [String: AnyObject]) { generateEmptyMonths() yearInStringFormat = year // Get Spending if let spendings = dictionary["spending"] as? [String: AnyObject] { // Convert dictionary to LGRecord let spendingArray = spendings.compactMap { record -> LGRecord in guard let value = record.value as? [String: AnyObject] else { preconditionFailure("No value in Record") } return LGRecord(spendingDic: value, uid: record.key) } store(allRecords: spendingArray) } // Get Income if let incomes = dictionary["income"] as? [String: AnyObject] { let incomeArray = incomes.compactMap { income -> Income in guard let value = income.value as? [String: AnyObject] else { preconditionFailure("No value in Record") } return Income(incomeDic: value, uid: income.key) } store(allIncomes: incomeArray) } } // MARK: - Public functions /// Total Income func totalIncome() -> Float { return monthArray.reduce(0) { $0 + $1.totalIncome() } } func totalIncomeInStringFormat() -> String { return String.doubleDigit(totalIncome()) } /// Total Spending func totalSpending() -> Float { return monthArray.reduce(0) { $0 + $1.totalSpending() } } func totalSpendingInStringFormat() -> String { return String.doubleDigit(totalSpending()) } /// Remaining Balance func totalBalance() -> Float { return totalIncome() - totalSpending() } // MARK: - Pivate functions /// Generate empty months private func generateEmptyMonths() { var monthCollector = [LGMonth]() for index in 0...11 { guard let monthType = MonthType(rawValue: index) else { preconditionFailure("Unable to get MonthType") } let month = LGMonth(monthType: monthType) monthCollector.append(month) } monthArray = monthCollector } /// Divide records into 12 months private func divideRecordsIntoTwelveMonth(_ allRecords: [LGRecord]) { monthArray.forEach { month in let filteredRecords = allRecords.filter { month.monthType == getMonthTypeFrom(date: $0.date) } month.store(records: filteredRecords) } } /// Divide incomes into 12 months private func divideIncomesIntoTwelveMonth(_ incomes: [Income]) { monthArray.forEach { month in let filteredIncomes = incomes.filter { month.monthType == getMonthTypeFrom(date: $0.date) } month.incomeArray = filteredIncomes.sorted { DateFormatter.fullDateFormatter().string(from: $0.date) > DateFormatter.fullDateFormatter().string(from: $1.date) } } } /// Get the Month type from a given date /// /// - Parameter date: Target Date e.g. 12/25/2019 /// - Returns: Month type belongs to this date e.g. December private func getMonthTypeFrom(date: Date) -> MonthType { let month = Calendar.current.component(.month, from: date) let index = month - 1 guard let monthType = MonthType(rawValue: index) else { preconditionFailure("Unable to get MonthType Enum") } return monthType } }
[ -1 ]
7f2513fa6295141e2624e37371c5c92e749ed701
b22e18fb320daa3b0902a32be2c637f005dd1a30
/Project11/Bookworn/Bookworn/DetailView.swift
1a4d724b6a85ea1c563e59e2bc1650236fbea3b5
[]
no_license
IanJoeMcDonald/100DaysOfSwiftUI
82f4e41fea84565af7c885b64b4aecee39712505
38e7bc1d3e92795bc17019344fadddfce604288f
refs/heads/master
2020-12-03T09:02:03.014752
2020-03-06T11:54:43
2020-03-06T11:54:43
216,101,255
0
0
null
null
null
null
UTF-8
Swift
false
false
3,053
swift
// // DetailView.swift // Bookworn // // Created by Ian McDonald on 25/01/20. // Copyright © 2020 Ian McDonald. All rights reserved. // import SwiftUI import CoreData struct DetailView: View { @Environment(\.managedObjectContext) var moc @Environment(\.presentationMode) var presentationMode @State private var showingDeleteAlert = false let book: Book var formattedDate: String { let formatter = DateFormatter() formatter.dateStyle = .long if let date = book.date { return formatter.string(from: date) } else { return formatter.string(from: Date()) } } var body: some View { GeometryReader { geometry in VStack { ZStack(alignment: .bottomTrailing) { Image(self.book.genre ?? "Fantasy") .frame(maxWidth: geometry.size.width) Text(self.book.genre?.uppercased() ?? "FANTASY") .font(.caption) .fontWeight(.black) .padding(8) .foregroundColor(.white) .background(Color.black.opacity(0.75)) .clipShape(Capsule()) .offset(x: -5, y: -5) } Text(self.book.author ?? "Unknown author") .font(.title) .foregroundColor(.secondary) Text(self.book.review ?? "No review") .padding() Text(self.formattedDate) .padding() RatingView(rating: .constant(Int(self.book.rating))) .font(.largeTitle) Spacer() } } .navigationBarTitle(Text(book.title ?? "Unknown Book"), displayMode: .inline) .navigationBarItems(trailing: Button(action: { self.showingDeleteAlert = true }) { Image(systemName: "trash") }) .alert(isPresented: $showingDeleteAlert) { Alert(title: Text("Delete book"), message: Text("Are you sure?"), primaryButton: .destructive(Text("Delete")) { self.deleteBook() }, secondaryButton: .cancel() ) } } func deleteBook() { moc.delete(book) try? self.moc.save() presentationMode.wrappedValue.dismiss() } } struct DetailView_Previews: PreviewProvider { static let moc = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType) static var previews: some View { let book = Book(context: moc) book.title = "Test book" book.author = "Test author" book.genre = "Fantasy" book.rating = 4 book.review = "This was a great book; I really enjoyed it." return NavigationView { DetailView(book: book) } } }
[ 350451, 359838 ]
6d6805e208216f64ef6ada1aa7487b1aa2f1d7ec
3159907ac2215e1c70ef2052d8012e16cd374ed2
/TechStreetbees/Utils/ImageView+extension.swift
203442c9aff53899aafced773366ff85b338a420
[]
no_license
Picosu/technicalTestSB
d1d4cbfd699df2f92c1065bfe1292a916f9ae8a3
b9b9b64eb808e96a2e891fb4fa80b714c5248a8e
refs/heads/master
2020-03-27T21:38:17.945074
2018-09-03T07:03:08
2018-09-03T07:03:08
147,162,986
0
0
null
null
null
null
UTF-8
Swift
false
false
1,728
swift
// // ImageView+extension.swift // TechStreetbees // // Created by Maxence de Cussac on 31/08/2018. // Copyright © 2018 Maxence de Cussac. All rights reserved. // import UIKit extension UIImageView { public func imageFromServerURL(urlString: String, PlaceHolderImage: UIImage = UIImage(named: "background")!) { if self.image == nil { self.image = PlaceHolderImage } guard !urlString.isEmpty else { return } URLSession.shared.dataTask(with: NSURL(string: urlString)! as URL, completionHandler: { (data, response, error) -> Void in if error != nil { print(error ?? "No Error") return } DispatchQueue.main.async(execute: { () -> Void in let image = UIImage(data: data!) self.image = image }) }).resume() } public func imageFromServerURL(url: URL?, PlaceHolderImage: UIImage = UIImage(named: "background")!) { guard let unwrappedUrl = url else { print("erreur concernant l'url : \(String(describing: url))") return } URLSession.shared.dataTask(with: unwrappedUrl, completionHandler: { (data, response, error) -> Void in if error != nil { print(error ?? "No Error") return } DispatchQueue.main.async(execute: { () -> Void in let image = UIImage(data: data!) self.image = image }) }).resume() } func setRounded() { let radius = self.frame.width / 2 self.layer.cornerRadius = radius self.layer.masksToBounds = true } }
[ -1 ]
82b5f5003e977b3c8c332ac34e7b676a0053301b
7ce950cf44e9d7d784d69442b7cbccee18528b43
/01. SourceCode/IOS/swipesafe/swipesafe/Controllers/Home/CallDialogViewController.swift
489c839937882e1fdb76375cc587b90d9a009531
[]
no_license
TamDao97/ChildFund
692ef9c18e04beb316b79da2f569232e51c539b0
3b3eba2eb543ae310ff4a9880a2f4d7b1221c3ce
refs/heads/master
2023-05-06T03:16:46.190074
2021-06-09T14:57:28
2021-06-09T14:57:28
375,392,972
0
0
null
null
null
null
UTF-8
Swift
false
false
837
swift
// // ListContentViewController.swift // swipesafe // // Created by Thanh Luu on 3/31/19. // Copyright © 2019 childfund. All rights reserved. // import UIKit class CallDialogViewController: BaseViewController { weak var containerViewController: HomeViewController? @IBAction func backAction(_ sender: Any) { containerViewController?.popViewController() } @IBAction func call111Action(_ sender: Any) { call(number: Constants.childSOSNumber) } @IBAction func call113Action(_ sender: Any) { call(number: Constants.policeNumber) } @IBAction func call115Action(_ sender: Any) { call(number: Constants.ambulanceNumber) } private func call(number: String) { let url = URL(string: "tel://\(number)") url?.open() } }
[ -1 ]
833d6ac0b0a23ad63aacfc5c177fb4168fb8113b
fab297e3290fa07201a177c409fc96387b516909
/pomboo_ios/Views/SignUp_View.swift
9340e368b008905ebdf9a7f953b2baeb7066174a
[]
no_license
Raiu1210/pomboo_ios
6cef3cdd705b53b3286b543cc95f25919287465b
6b395a366f2f114c1afc879f3df5907aa92f26c3
refs/heads/master
2020-09-08T14:49:27.412616
2019-12-27T03:58:29
2019-12-27T03:58:29
221,163,930
0
0
null
null
null
null
UTF-8
Swift
false
false
2,543
swift
// // SignUp_view.swift // pomboo_ios // // Created by raiu on 2019/11/21. // Copyright © 2019 Ryu Ishibashi. All rights reserved. // import SwiftUI struct SignUp_view: View { @State var email:String = "" @State var password:String = "" @State var password_check:String = "" @State var user_name:String = "" @State var user_id:Int = 0 @State var is_registered:Bool = false var body: some View { switch is_registered { case true: return AnyView(User_Tab_View(user_id:user_id, user_name:user_name) .navigationBarTitle("") .navigationBarBackButtonHidden(true) ) default: return AnyView(Sign_UP_form(email: $email, password: $password, password_check: $password_check, user_name: $user_name, user_id: $user_id, is_registered: $is_registered)) } } } struct Sign_UP_form: View { @Binding var email:String @Binding var password:String @Binding var password_check:String @Binding var user_name:String @Binding var user_id:Int @Binding var is_registered:Bool var body: some View { ZStack { self.return_backGroundColor().edgesIgnoringSafeArea(.all) ScrollView(.vertical) { VStack(spacing: 50) { VStack (spacing: 0) { // 4 inputs: email address, password, password check, display name Input_Form(guide_text: " メールアドレス", place_holder: " [email protected]", binder: $email) Input_Form(guide_text: " パスワード", place_holder: " password", binder: $password) Input_Form(guide_text: " パスワード(確認用)", place_holder: " password", binder: $password_check) Input_Form(guide_text: " 表示名", place_holder: " らいう", binder: $user_name) }.padding() Register_Button(email: email, password: password, password_check: password_check, user_name: user_name, user_id: $user_id, is_registered: $is_registered) Spacer(minLength: 350) } } } } private func return_backGroundColor() -> LinearGradient { let MUM = My_UI_modules() return MUM.backGroundColor() } } //struct SignUp_view_Previews: PreviewProvider { // static var previews: some View { // SignUp_view() // } //}
[ -1 ]
0d36ec9163256dd4ef534e10aad775c6e56b3105
fef449e50720db83e8ecb9f7fea98c62b34a3623
/Downloads/RichnessLatest/Richness/Search/HashTagSelectionViewController.swift
5ed8eb9875bf52926a150f9e20bceb5d489fb010
[]
no_license
TanviPanwar/MDD
58b7e75a3532475537cc1e32d7d0d5036f9007da
b51973ae3d97e4650d7c533724ad1a4baf8f81ee
refs/heads/master
2023-02-06T12:04:28.354345
2020-08-13T08:38:49
2020-08-13T08:38:49
null
0
0
null
null
null
null
UTF-8
Swift
false
false
35,530
swift
// // HashTagSelectionViewController.swift // Richness // // Created by IOS3 on 12/02/19. // Copyright © 2019 Sobura. All rights reserved. // import Foundation import UIKit //import PullToRefresh import SDWebImage import Player import IQKeyboardManagerSwift import AVFoundation import AVKit class HashTagSelectionViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource,refreshCommentCountDelegate,GetAvPlayerStatusDelegate , UICollectionViewDelegateFlowLayout { func commentCountDidRecieve(count: Int, tag: Int) { commentCount = count guard let cell = collectionDataview.cellForItem(at: IndexPath(row: currentIndex!, section: 0)) as? HashTagSelectionCollectionViewCell else {return} self.homeArray[tag].total_comments = "\(count)" cell.commentLabel.text = self.homeArray[tag].total_comments //self.tableView.reloadData() } @IBOutlet weak var collectionDataview: UICollectionView! @IBOutlet weak var backButton: UIButton! var profileImage = "" var refreshControl = UIRefreshControl() var start_index = 0 var homeArray: [User] = [] var commentsArray : [Comments] = [] var player = Player() var currentIndex :Int? var commentCount : Int? var cellIndex = Int() var user_ID = String() var hashTagName = String() var boolHashRecived = Bool() var boolSent = true var messageLabel = UILabel() var message = String() var scrollBool = Bool() var heightColl = CGFloat() var currentCell:HashTagSelectionCollectionViewCell? var endDisplaycellIndex:Int? override func viewDidLoad() { super.viewDidLoad() self.collectionDataview.decelerationRate = UIScrollViewDecelerationRateFast; refreshControl.tintColor = UIColor.white refreshControl.addTarget(self, action: #selector(refresh), for: UIControlEvents.valueChanged) collectionDataview.addSubview(refreshControl) getDatas() // collectionDataview.reloadData() // collectionDataview.scrollToItem(at: IndexPath(row: cellIndex, section: 0), at: .centeredVertically , animated: false) // setupPullToRefresh() self.collectionDataview.decelerationRate = UIScrollViewDecelerationRateFast ProjectManager.shared.avplayerDelegate = self NotificationCenter.default.addObserver(self, selector: #selector(self.appEnteredFromBackground), name: NSNotification.Name.UIApplicationWillEnterForeground, object: nil) messageLabel = UILabel(frame: CGRect(x: 10, y: (collectionDataview.frame.size.height - 40)/2, width: view.bounds.size.width - 20, height: 40)) // messageLabel.text messageLabel.text = "No Data" messageLabel.numberOfLines = 0; messageLabel.textAlignment = .center; messageLabel.font = UIFont.systemFont(ofSize: 20.0, weight: UIFont.Weight.bold) messageLabel.textColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0) messageLabel.sizeToFit() //self.addedFilesCollectionView.addSubview(messageLabel) messageLabel.isHidden = true collectionDataview.backgroundView = messageLabel DispatchQueue.main.async { self.navigationController?.navigationBar.isHidden = true } // self.automaticallyAdjustsScrollViewInsets = true // Do any additional setup after loading the view. NotificationCenter.default.addObserver(self, selector: #selector(statusBarHeightChanged), name: NSNotification.Name.UIApplicationWillChangeStatusBarFrame, object: nil) // Do any additional setup after loading the view. NotificationCenter.default.addObserver(self, selector: #selector(self.updateCollection), name: NSNotification.Name.UIApplicationWillEnterForeground, object: nil) // Do any additional setup after loading the view. } @objc func updateCollection() { if homeArray.count > 0 { if collectionDataview.visibleCells.first != nil { guard let cell = collectionDataview.visibleCells.first as? HashTagSelectionCollectionViewCell else { return } if cell.playPauseBtn.currentImage == UIImage(named:"play-video1") { if currentIndex != nil { ASVideoPlayerController.sharedVideoPlayer.pauseVideo(forLayer: cell.videoLayer, url: (self.homeArray[currentIndex!].image)) } } } } } @objc func statusBarHeightChanged() { self.collectionDataview.reloadData() if homeArray.count > 0{ self.collectionDataview.scrollToItem(at:IndexPath(item:0, section: 0), at: .top, animated: true) } } override func viewWillLayoutSubviews() { super.viewWillLayoutSubviews() if currentCell != nil { if currentCell?.videoLayer != nil { currentCell?.videoLayer.player?.pause() ASVideoPlayerController.sharedVideoPlayer.pauseVideo(forLayer: (currentCell?.videoLayer)!, url: homeArray[currentIndex!].image) } } pausePlayeVideos() } // override func viewDidLayoutSubviews() { // super.viewDidLayoutSubviews() // pausePlayeVideos() // } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) scrollBool = false DispatchQueue.main.async { self.navigationController?.navigationBar.isHidden = true } } override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) if currentCell != nil { if currentCell?.videoLayer != nil { currentCell?.videoLayer.player?.pause() ASVideoPlayerController.sharedVideoPlayer.pauseVideo(forLayer: (currentCell?.videoLayer)!, url: homeArray[currentIndex!].image) } } } // override func viewDidLayoutSubviews() { // // super.viewDidLayoutSubviews() // heightColl = collectionDataview.bounds.size.height // collectionDataview.collectionViewLayout.invalidateLayout() // // } // MARK:- //MARK:- IB Actions @IBAction func backButtonAction(_ sender: Any) { self.dismiss(animated: true, completion: nil ) } @objc func refresh() { start_index = 0 homeArray.removeAll() collectionDataview.reloadData() getDatas() refreshControl.endRefreshing() } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) pausePlayeVideos() } // override func viewDidLayoutSubviews() { // super.viewDidLayoutSubviews() // collectionDataview.scrollToItem(at: IndexPath(row: cellIndex, section: 0), at: .centeredVertically , animated: false) // } //MARK:- //MARK:- CollectionView DataSources func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return homeArray.count } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { if UIApplication.shared.statusBarFrame.height > 20 { return CGSize(width: UIScreen.main.bounds.size.width, height: UIScreen.main.bounds.size.height - (UIApplication.shared.statusBarFrame.height - 20)) } else { return CGSize(width: UIScreen.main.bounds.size.width, height: UIScreen.main.bounds.size.height ) } // return CGSize(width: self.collectionDataview.bounds.size.width, height: self.collectionDataview.bounds.size.height) } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "HashTagSelectionCollectionViewCell", for: indexPath) as! HashTagSelectionCollectionViewCell cell.infoTextView.textContainer.maximumNumberOfLines = 5 cell.profileImg.layer.borderWidth = 1 cell.profileImg.layer.masksToBounds = false cell.profileImg.layer.borderColor = #colorLiteral(red: 0.8549019608, green: 0.737254902, blue: 0.5843137255, alpha: 1) cell.profileImg.layer.cornerRadius = cell.profileImg.frame.height/2 //This will change with corners of image and height/2 will make this circle shape cell.profileImg.clipsToBounds = true cell.sideBtn.tag = indexPath.row cell.sideBtn.addTarget(self,action:#selector(sidebuttonClicked), for:.touchUpInside) cell.commentBtn.tag = indexPath.row cell.commentBtn.addTarget(self,action:#selector(commentbuttonClicked), for:.touchUpInside) cell.shareBtn.tag = indexPath.row cell.shareBtn.addTarget(self,action:#selector(sharebuttonClicked), for:.touchUpInside) cell.backButtonTapped = { self.dismiss(animated: true, completion: nil) } if homeArray.count > 0 { currentCell = cell if homeArray[indexPath.row].type == "0" { cell.playPauseBtn.isHidden = true cell.activityIndicator.isHidden = true cell.profileImageView.isHidden = false cell.videoView.isHidden = true //cell.avatarImgView.sd_setImage(with: URL(string : homeArray[indexPath.row].image_profile)) // cell.profileImageView.sd_setImage(with: URL(string : homeArray[indexPath.row].image)) // ProjectManager.shared.getImage(urlStr: homeArray[indexPath.row].image.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? "") { // // (image) in // cell.profileImageView.image = image // // } cell.profileImageView.sd_setImage(with: URL(string : homeArray[indexPath.row].image), placeholderImage: nil, options: [.cacheMemoryOnly]) { (image, error, cache, url) in if image != nil { let width: CGFloat = image!.size.width let height: CGFloat = image!.size.height if height > width { cell.profileImageView.contentMode = .scaleAspectFill cell.profileImageView.clipsToBounds = true } else { cell.profileImageView.contentMode = .scaleAspectFit } } } cell.profileImg.sd_setImage(with: URL(string : homeArray[indexPath.row].image_profile)) // cell.profileBtn.sd_setImage(with: URL(string : homeArray[indexPath.row].image_profile), for: .normal) cell.likesLabel.text = homeArray[indexPath.row].likes if homeArray[indexPath.row].total_comments == "" { cell.commentLabel.text = "0" } else { cell.commentLabel.text = homeArray[indexPath.row].total_comments } //cell.commentLabel.text = homeArray[indexPath.row].total_comments cell.shareLabel.text = homeArray[indexPath.row].shares cell.rankingLabel.text = homeArray[indexPath.row].ranking // cell.profileImageView.sd_setImage(with: URL(string : homeArray[indexPath.row].image_profile)) // cell.profileBtn.sd_setImage(with: URL(string : homeArray[indexPath.row].image_profile), for: .normal) cell.videoLayer.player?.pause() ASVideoPlayerController.sharedVideoPlayer.pauseVideo(forLayer: cell.videoLayer, url: homeArray[indexPath.row].image) cell.configureCell(imageUrl: "", description: "Image", videoUrl:"") } else { // cell.videoLayer.player?.replaceCurrentItem(with:AVPlayerItem(url:URL(string:"")!) ) // cell.videoLayer.player?.pause() // ASVideoPlayerController.sharedVideoPlayer.pauseVideo(forLayer: cell.videoLayer, url: homeArray[indexPath.row].image) let videourl = (homeArray[indexPath.row].image) if videourl.hasPrefix("https") { cell.videoLayer.backgroundColor = UIColor.clear.cgColor cell.videoLayer.videoGravity = AVLayerVideoGravity.resizeAspect cell.videoView.layer.addSublayer(cell.videoLayer) cell.playPauseBtn.isHidden = false // cell.activityIndicator.isHidden = false DispatchQueue.main.async { cell.playPauseBtn.isEnabled = false cell.playPauseBtn.setImage(#imageLiteral(resourceName: "pause-video"), for: .normal) cell.playPauseBtn.setImage(#imageLiteral(resourceName: "pause-video"), for: .selected) cell.videoView.tag = indexPath.row let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.imageTapped(tapGestureRecognizer:))) cell.videoView.isUserInteractionEnabled = true cell.videoView.addGestureRecognizer(tapGestureRecognizer) cell.activityIndicator.isHidden = false cell.activityIndicator.startAnimating() } cell.profileImageView.isHidden = true cell.videoView.isHidden = false cell.configureCell(imageUrl: "", description: "Video", videoUrl: homeArray[indexPath.row].image) } else { cell.activityIndicator.isHidden = true cell.profileImageView.isHidden = true cell.videoView.isHidden = true cell.playPauseBtn.isHidden = true } cell.profileImg.sd_setImage(with: URL(string : homeArray[indexPath.row].image_profile)) // cell.profileBtn.sd_setImage(with: URL(string : homeArray[indexPath.row].image_profile), for: .normal) cell.likesLabel.text = homeArray[indexPath.row].likes cell.commentLabel.text = homeArray[indexPath.row].total_comments cell.shareLabel.text = homeArray[indexPath.row].shares cell.rankingLabel.text = homeArray[indexPath.row].ranking } // cell.likeLabel.text = homeArray[indexPath.row].likes + " persons" // cell.nameLabel.text = homeArray[indexPath.row].name cell.infoTextView.text = homeArray[indexPath.row].text.decodeEmoji if !(homeArray[indexPath.row].id_user == RichnessUserDefault.getUserID()) { if homeArray[indexPath.row].is_followed == 1 { cell.addfollowerBtn.isHidden = true cell.addFollowerImage.image = UIImage(named: "") } else{ cell.addfollowerBtn.isHidden = false cell.addFollowerImage.image = UIImage(named: "side_menu_option_1") } } else { cell.addfollowerBtn.isHidden = true cell.addFollowerImage.image = UIImage(named: "") } // cell.likeLabel.text = homeArray[indexPath.row].likes + " persons" // cell.nameLabel.text = homeArray[indexPath.row].name cell.infoTextView.text = homeArray[indexPath.row].text.decodeEmoji if(homeArray[indexPath.row].user_like == "1"){ cell.likeButton.isChecked = true } else{ cell.likeButton.isChecked = false } cell.onPlayPauseButtonTapped = { if cell.playPauseBtn.currentImage!.isEqual(UIImage(named: "pause-video")) { cell.playPauseBtn.setImage(UIImage(named: "play-video1"), for: .normal) //self.pausePlayeVideos() ASVideoPlayerController.sharedVideoPlayer.pauseVideo(forLayer: cell.videoLayer, url: (self.homeArray[indexPath.row].image)) } else { cell.playPauseBtn.setImage(UIImage(named: "pause-video"), for: .normal) ASVideoPlayerController.sharedVideoPlayer.playVideo(withLayer: cell.videoLayer, url: (self.homeArray[indexPath.row].image)) } } cell.backButtonTapped = { self.dismiss(animated: true, completion: nil) } cell.on3DotButtonTapped = { // (self.owner as! MainViewController).reportAlertView.isHidden = false // (self.owner as! MainViewController).idimage = self.homeArray[indexPath.row].id } cell.onDiamondButtonTapped = { if cell.likeButton.isChecked { self.like_unlike(like_type: 1, imageId: self.homeArray[indexPath.row].id, cell: cell, index : indexPath.row) } else{ self.like_unlike(like_type: 2, imageId: self.homeArray[indexPath.row].id, cell: cell, index : indexPath.row) } } cell.onProfileTapped = { // self.owner?.rightToLeft() // self.profileImage = self.homeArray[indexPath.row].image // let nextView = mainstoryboard.instantiateViewController(withIdentifier: "ImagePreviewController") as! ImagePreviewController // nextView.image = self.profileImage // print(self.profileImage) // self.owner?.present(nextView, animated: false, completion: nil) } cell.onAvatarTapped = { cell.videoLayer.player?.pause() if self.homeArray[indexPath.row].id_user == RichnessUserDefault.getUserID() { let nextView = mainstoryboard.instantiateViewController(withIdentifier: "ProfileVC") as! ProfileVC nextView.boolRecived = self.boolSent let nav = UINavigationController(rootViewController: nextView) self.present(nav, animated: true, completion: nil) } else{ let nextView = mainstoryboard.instantiateViewController(withIdentifier: "UserProfileViewController") as! UserProfileViewController RichnessUserDefault.setOtherUserID(val: self.homeArray[indexPath.row].id_user) nextView.objc = self.homeArray[indexPath.row].id_user let nav = UINavigationController(rootViewController: nextView) self.present(nav, animated: true, completion: nil) //self.owner?.present(nextView, animated: true, completion: nil) } } cell.addFollowerTapped = { let userFollowed = self.homeArray[indexPath.row].id_user self.addFollowerApi(userFollowed: userFollowed, cell: cell, index : indexPath.row) } } // cell.layoutIfNeeded() return cell } func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "HashTagSelectionCollectionViewCell", for: indexPath) as! HashTagSelectionCollectionViewCell currentIndex = indexPath.row if indexPath.row == homeArray.count - 1 && homeArray.count > 19 { self.start_index += 1 self.getDatas() } // pausePlayeVideos() } func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) { endDisplaycellIndex = indexPath.row // if let cell = collectionDataview.cellForItem(at: indexPath) as? CollectionViewCell { // ASVideoPlayerController.sharedVideoPlayer.pauseVideo(forLayer: cell.videoLayer, url: homeArray[indexPath.row].image) // } // // if let videoCell = cell as? ASAutoPlayVideoLayerContainer, let _ = videoCell.videoURL { // videoCell.videoLayer.player = nil // videoCell.videoLayer.player?.pause() // ASVideoPlayerController.sharedVideoPlayer.removeLayerFor(cell: videoCell) // } else { // // if let videoCell = cell as? ASAutoPlayVideoLayerContainer, let _ = videoCell.videoURL { print("stop") videoCell.videoLayer.player?.pause() if homeArray.count > 0 { ASVideoPlayerController.sharedVideoPlayer.pauseVideo(forLayer: (videoCell.videoLayer), url: homeArray[indexPath.row].image) ASVideoPlayerController.sharedVideoPlayer.removeLayerFor(cell: videoCell) } } } func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { } @objc func imageTapped(tapGestureRecognizer: UITapGestureRecognizer) { let tag = (tapGestureRecognizer.view)?.tag let indexPath = NSIndexPath(row: tag!, section: 0) let cell = self.collectionDataview.cellForItem(at: indexPath as IndexPath) as! HashTagSelectionCollectionViewCell if cell.playPauseBtn.isHidden { cell.playPauseBtn.isHidden = false } else { cell.playPauseBtn.isHidden = true } } @objc func sidebuttonClicked(sender: UIButton) { // let indexPath = NSIndexPath(row: sender.tag, section: 0) // let cell = tableView.dequeueReusableCell(withIdentifier: "homeCell", for: indexPath as IndexPath) as! homeCell // // cell.sideView.frame = CGRect(x: cell.sideView.frame.origin.x , y: cell.sideView.frame.origin.y, width: cell.sideView.frame.size.width, height: cell.sideView.frame.size.height) let indexPath = NSIndexPath(row: sender.tag, section: 0) //let cell = self.tableView.cellForRow(at: indexPath as IndexPath) as! CollectionViewCell let cell = self.collectionDataview.cellForItem(at: indexPath as IndexPath) as? HashTagSelectionCollectionViewCell if cell!.sideviewTrailingConstraint.constant == -87 { cell!.sideviewTrailingConstraint.constant = -1 cell!.sideBtn.setImage(UIImage(named: ""), for: UIControlState.normal) } else { cell!.sideviewTrailingConstraint.constant = -87 //-79 } } @objc func commentbuttonClicked(sender: UIButton) { let vc = self.storyboard?.instantiateViewController(withIdentifier: "CommentsViewController") as! CommentsViewController vc.modalPresentationStyle = .overCurrentContext vc.postId = homeArray[sender.tag].id vc.tag = sender.tag vc.totalCommentCount = homeArray[sender.tag].total_comments vc.delegate = self self.present(vc, animated: true, completion: nil) // let indexPath = NSIndexPath(row: sender.tag, section: 0) // let cell = self.tableView.cellForRow(at: indexPath as IndexPath) as! homeCell // // let post_id = homeArray[indexPath.row].id // getCommentsApi(postId: post_id) } @objc func sharebuttonClicked(sender: UIButton) { let url = URL(string:homeArray[sender.tag].image) let activityController = UIActivityViewController(activityItems: [url], applicationActivities: nil) self.present(activityController, animated: true, completion: nil) } func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { pausePlayeVideos() if !scrollBool { scrollBool = true } else { for i in collectionDataview.visibleCells { //let indxpath = collectionDataview.indexPath(for:i) if let cell = i as? HashTagSelectionCollectionViewCell { cell.playPauseBtn.setImage(#imageLiteral(resourceName: "pause-video"), for: .normal) cell.sideviewTrailingConstraint.constant = -87 // cell.activityIndicator.stopAnimating() // cell.activityIndicator.isHidden = true } } } } func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) { if !decelerate { pausePlayeVideos() } } func pausePlayeVideos(){ ASVideoPlayerController.sharedVideoPlayer.pausePlayeVideossFor(collectionView: collectionDataview) } @objc func appEnteredFromBackground() { ASVideoPlayerController.sharedVideoPlayer.pausePlayeVideossFor(collectionView: collectionDataview, appEnteredFromBackground: true) } func getDatas() { let currentDate = Date() let dateFormatter = DateFormatter() dateFormatter.dateFormat = "dd-MM-yyyy HH" let key = BASE_KEY + "#" + dateFormatter.string(from: currentDate) var url = String() var params = [String: Any]() if boolHashRecived == true { url = GETSINGLEPOST_URL params = [ "start_index" : self.start_index, "user_id" : RichnessUserDefault.getUserID(), "id" : user_ID, "key" : key ] } else { url = GETTIMELINE_URL params = ["start_index" : self.start_index, "user_id" : RichnessUserDefault.getUserID(), "hashtag": hashTagName , "key" : key ] //as [String : Any] } print(params) //start_index += 1 RichnessAlamofire.POST(url, parameters: params as [String : AnyObject],showLoading: false,showSuccess: false,showError: false ) { (result, responseObject) in if(result){ print(responseObject) // self.tableView.endRefreshing(at: .bottom) if(responseObject.object(forKey: "result") != nil){ let result = responseObject.object(forKey: "result") as? [NSDictionary] self.messageLabel.isHidden = true for item in result!{ let usermodel = User() usermodel.id = item["id"] as? String ?? "" if (usermodel.id == ""){ usermodel.id = String(describing: item["id"] as? Int) } usermodel.country = item["country"] as? String ?? "" usermodel.description = item["description"] as? String ?? "" usermodel.id_user = item["id_user"] as? String ?? "" usermodel.image = item["image"] as? String ?? "" usermodel.image_profile = item["image_profile"] as? String ?? "" usermodel.likes = item["likes"] as? String ?? "" usermodel.name = item["name"] as? String ?? "" usermodel.ranking = item["ranking"] as? String ?? "" usermodel.total_comments = item["total_comments"] as? String ?? "" usermodel.shares = item["shares"] as? String ?? "" usermodel.text = item["text"] as? String ?? "" print(item["text"] as? String ?? "") usermodel.user_like = item["user_like"] as? String ?? "" usermodel.type = item["type"] as? String ?? "" usermodel.is_followed = item["is_followed"] as? Int ?? 0 self.homeArray.append(usermodel) } DispatchQueue.main.async { // UIView.performWithoutAnimation { // self.tableView.reloadData() // self.tableView.layoutIfNeeded() // self.tableView.beginUpdates() // self.tableView.endUpdates() // } self.collectionDataview.reloadData() // self.collectionDataview.performBatchUpdates({ // // }, completion: { (status) in // self.updateTableViewContentInset() // // }) // let lastContentOffset = self.tableView.contentOffset // self.tableView.beginUpdates() // self.tableView.endUpdates() // self.tableView.layer.removeAllAnimations() // self.tableView.setContentOffset(lastContentOffset, animated: false) } } else { if self.start_index == 0 { self.collectionDataview.reloadData() self.messageLabel.isHidden = false } } } else { let error = responseObject.object(forKey: "error") as? String if (error == "#997") { self.showError(errMsg: user_error_unknown) } else { self.showError(errMsg: error_on_server) } } } } func like_unlike(like_type : Int, imageId : String, cell : HashTagSelectionCollectionViewCell, index : Int) { let currentDate = Date() let dateFormatter = DateFormatter() dateFormatter.dateFormat = "dd-MM-yyyy HH" let key = BASE_KEY + "#" + dateFormatter.string(from: currentDate) let params = [ "liked_type" : like_type, "image_id" : imageId, "user_id" : RichnessUserDefault.getUserID(), "key" : key ] as [String : Any] print(params) RichnessAlamofire.POST(ADDLIKE_URL, parameters: params as [String : AnyObject],showLoading: true,showSuccess: false,showError: false ) { (result, responseObject) in if(result){ if(responseObject.object(forKey: "like_add") != nil){ if(like_type == 1){ self.homeArray[index].likes = String(Int(self.homeArray[index].likes)! + 1) cell.likesLabel.text = self.homeArray[index].likes //+ " persons" } else{ self.homeArray[index].likes = String(Int(self.homeArray[index].likes)! - 1) cell.likesLabel.text = self.homeArray[index].likes //+ " persons" } } } else { let error = responseObject.object(forKey: "error") as? String if (error == "#997") { self.showError(errMsg: user_error_unknown) } else { self.showError(errMsg: error_on_server) } } } } func addFollowerApi(userFollowed: String, cell : HashTagSelectionCollectionViewCell, index : Int) { let currentDate = Date() let dateFormatter = DateFormatter() dateFormatter.dateFormat = "dd-MM-yyyy HH" let key = BASE_KEY + "#" + dateFormatter.string(from: currentDate) let params = [ "user_id" : RichnessUserDefault.getUserID(), "user_followed": userFollowed , "key" : key ] as [String : Any] print(params) RichnessAlamofire.POST(ADDFOLLOWRES_URL, parameters: params as [String : AnyObject],showLoading: true,showSuccess: false,showError: false ) { (result, responseObject) in if(result){ cell.addFollowerImage.image = UIImage(named: "") cell.addfollowerBtn.isHidden = true self.homeArray[index].is_followed = 1 } else { let error = responseObject.object(forKey: "error") as? String if (error == "#997") { self.showError(errMsg: user_error_unknown) } else { self.showError(errMsg: error_on_server) } } } } func stopActivityIndicator() { if currentIndex != nil { guard let cell = collectionDataview.cellForItem(at: IndexPath(row: currentIndex!, section: 0)) as? HashTagSelectionCollectionViewCell else {return} // DispatchQueue.main.async { cell.playPauseBtn.isEnabled = true cell.activityIndicator.stopAnimating() cell.activityIndicator.isHidden = true // } } } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destination. // Pass the selected object to the new view controller. } */ }
[ -1 ]
5ff6e9a8b3e09a4d8bc9902e74472c541023ccef
b4ad0c44c598f2a24debb7d17a9f6f1e2b46206f
/Package.swift
0a7799ad3c75f0111eab330174994c008a70906c
[ "Apache-2.0" ]
permissive
swhitty/Bagel
d5c6a0c2027b3b570b84d41373ebdcb414850f3a
b936657eab7b1cb490e8314ab1b86726b9b0049c
refs/heads/master
2021-06-17T23:13:00.805145
2021-02-20T05:09:55
2021-02-20T05:09:55
172,690,295
1
6
null
2019-02-26T10:31:48
2019-02-26T10:31:48
null
UTF-8
Swift
false
false
542
swift
// swift-tools-version:5.0 import PackageDescription let package = Package( name: "Bagel", platforms: [ .iOS(.v9), .macOS(.v10_10), ], products: [ .library(name: "Bagel", targets: ["Bagel"]) ], dependencies: [ .package(url: "https://github.com/robbiehanson/CocoaAsyncSocket.git", from: "7.0.0"), ], targets: [ .target( name: "Bagel", dependencies: ["CocoaAsyncSocket"], path: "iOS/Source", publicHeadersPath: "" ) ] )
[ -1 ]
f338a32204f40174afb833c3b7a20b5f46600cbc
8e9b8256a3fb9589c5264134a25591cd15b53e6c
/Stepic/Legacy/Analytics/SplitTests/SplitTestGroupProtocol.swift
cfa0710f1d8d202aaa2116e9bc1ef6b2cf4632e4
[]
no_license
8secz-johndpope/stepik-ios
1196071718bb0e0a60a20bb2bb98ca5211fa0479
7df28f3f0c08e0fca14f258f0513e83bfe45e66f
refs/heads/master
2023-01-27T12:17:56.632255
2020-12-10T07:48:22
2020-12-10T07:48:22
null
0
0
null
null
null
null
UTF-8
Swift
false
false
289
swift
// // SplitTestGroupProtocol.swift // SplitTests // // Created by Alex Zimin on 15/06/2018. // Copyright © 2018 Akexander. All rights reserved. // import Foundation protocol SplitTestGroupProtocol: RawRepresentable where RawValue == String { static var groups: [Self] { get } }
[ -1 ]
c2b9e91e4c1168e5a9083237e8acab5ea0235c8a
95ad6d32a0373a49b9d707828068a8d697f7feb4
/SourceCode/iOS/LoginViperDemo/LoginViperDemo/LoginViper/LoginInteractor.swift
76a6e52a5d4a5e222ba798fe69124a283b6155e8
[]
no_license
giangnth1121/https---github.com-giangnth1121-DesignPattern
1317fcc7d0de5101e50f50405066a71f051434bb
a6ceea9e67a94a2cc91e349ed810fea6e81d23e0
refs/heads/master
2021-01-21T09:14:04.577716
2017-05-22T01:43:25
2017-05-22T01:43:25
91,648,811
3
0
null
null
null
null
UTF-8
Swift
false
false
1,202
swift
// // LoginInteractor.swift // LoginViperDemo // // Created by Giang Béo on 5/17/17. // Copyright © 2017 Atarshine. All rights reserved. // import Foundation // Input - Output // return result of presenter // return View protocol LoginInput { func loginInput(_ userName : String?, password : String?) } protocol LoginOutput { func loginOutput(_ result : Bool, message : String) } class LoginInteractor: NSObject, LoginInput { var output : LoginOutput? func loginInput(_ userName: String?, password: String?) { if (userName?.isEmpty)! { output?.loginOutput(false, message: "Input Username!") return } if (password?.isEmpty)!{ output?.loginOutput(false, message: "Input Password!") return } if userName != DataStore.sharedInstance.user.userName { output?.loginOutput(false, message: "Incorrect Username!") return } if password != DataStore.sharedInstance.user.password { output?.loginOutput(false, message: "Incorrect Password!") return } output?.loginOutput(true, message: "Success!!!!") } }
[ -1 ]
9bfcd4a7a6c8a02f4e6593ea6842a8fb1750a720
1024d02106c6302292b08d67e976bbb3e3b68f35
/NikeIOSAssessmentUITests/NikeIOSAssessmentUITests.swift
c20f62692fc0bfe5c931d8afd5b4750df48884ad
[]
no_license
naresh-ios/NikeIOSTask
e135880a5c853ac68b5fce7b4ad1e08e9619645e
36eadc3f1ab22805d5e77c56933b96fa9d2578df
refs/heads/master
2021-04-03T13:06:21.833587
2020-03-19T15:38:11
2020-03-19T15:38:11
248,356,811
0
0
null
null
null
null
UTF-8
Swift
false
false
1,201
swift
// // NikeIOSAssessmentUITests.swift // NikeIOSAssessmentUITests // // Created by Naresh Nadhendla on 3/17/20. // Copyright © 2020 Naresh Nadhendla. All rights reserved. // import XCTest class NikeIOSAssessmentUITests: XCTestCase { override func setUp() { // Put setup code here. This method is called before the invocation of each test method in the class. // In UI tests it is usually best to stop immediately when a failure occurs. continueAfterFailure = false // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. XCUIApplication().launch() // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. } func testExample() { // Use recording to get started writing UI tests. // Use XCTAssert and related functions to verify your tests produce the correct results. } }
[ 237599, 229414, 344106, 278571, 229425, 229431, 180279, 319543, 352314, 213051, 376892, 32829, 286787, 237638, 311373, 196687, 278607, 311377, 368732, 278637, 319599, 278642, 131190, 131199, 278669, 278676, 311447, 327834, 278684, 278690, 311459, 278698, 278703, 278707, 180409, 278713, 295099, 139459, 131270, 229591, 385240, 311520, 319719, 295147, 286957, 262403, 180494, 319764, 278805, 311582, 278817, 311596, 98611, 368949, 278843, 287040, 319812, 311622, 319816, 254285, 344402, 229716, 278895, 287089, 139641, 311679, 311692, 106893, 156069, 254373, 311723, 377265, 311739, 319931, 278974, 336319, 311744, 278979, 278988, 278992, 279000, 369121, 279009, 188899, 279014, 319976, 279017, 311787, 360945, 319986, 279030, 311800, 279033, 279042, 287237, 377352, 279053, 303634, 303635, 279061, 254487, 279066, 188954, 279092, 352831, 377419, 303693, 369236, 115287, 189016, 295518, 287327, 279143, 279150, 287345, 287348, 344697, 189054, 287359, 303743, 164487, 279176, 311944, 311948, 311950, 311953, 336531, 287379, 180886, 295575, 352921, 303772, 221853, 205469, 279207, 295591, 295598, 279215, 279218, 164532, 287412, 287418, 303802, 66243, 287434, 287438, 279253, 230105, 361178, 295653, 369383, 230120, 361194, 312046, 279278, 230133, 279293, 205566, 295688, 312076, 295698, 221980, 262952, 262953, 279337, 262957, 164655, 328495, 303921, 336693, 230198, 222017, 295745, 279379, 295769, 230238, 230239, 435038, 279393, 303973, 279398, 295797, 295799, 279418, 287623, 279434, 320394, 189327, 189349, 279465, 140203, 304050, 189373, 213956, 345030, 213961, 279499, 304086, 304104, 123880, 320492, 320495, 287730, 320504, 312313, 214009, 312317, 328701, 328705, 418819, 320520, 230411, 320526, 361487, 238611, 140311, 238617, 197658, 132140, 189487, 345137, 361522, 312372, 238646, 238650, 320571, 336962, 238663, 361547, 205911, 296023, 156763, 361570, 230500, 214116, 214119, 279659, 279666, 312435, 230514, 238706, 279686, 222344, 140426, 337037, 296091, 238764, 148674, 312519, 279752, 148687, 189651, 279766, 189656, 279775, 304352, 304353, 279780, 279789, 279803, 320769, 312588, 320795, 320802, 304422, 353581, 116014, 312628, 345397, 345398, 222523, 181568, 279872, 279874, 304457, 345418, 230730, 337226, 296269, 238928, 296274, 230757, 296304, 312688, 230772, 296328, 296330, 304523, 9618, 279955, 148899, 148900, 279979, 279980, 173492, 279988, 280003, 370122, 280011, 337359, 329168, 312785, 222674, 329170, 280020, 353751, 280025, 239069, 329181, 320997, 280042, 280043, 329198, 337391, 296434, 288248, 288252, 312830, 230922, 329231, 304655, 230933, 222754, 312879, 230960, 288305, 239159, 157246, 288319, 288322, 280131, 124486, 288328, 239192, 99937, 345697, 312937, 312941, 206447, 288377, 337533, 239238, 288391, 239251, 280217, 345753, 198304, 255651, 337590, 280252, 280253, 296636, 321217, 280259, 321220, 296649, 239305, 280266, 9935, 313042, 345813, 280279, 18139, 280285, 321250, 337638, 181992, 345832, 288492, 141037, 34547, 67316, 288508, 288515, 280326, 116491, 280333, 124691, 116502, 321308, 321309, 255781, 280367, 280373, 280377, 321338, 280381, 345918, 280386, 280391, 280396, 337746, 345942, 18263, 362326, 345950, 370526, 362336, 296807, 362351, 313200, 296815, 313204, 124795, 182145, 280451, 67464, 305032, 214936, 337816, 124826, 329627, 239515, 214943, 354210, 313257, 288698, 214978, 280517, 280518, 214983, 362442, 346066, 231382, 354268, 329696, 190437, 313322, 329707, 247786, 337899, 296942, 354283, 124912, 313338, 239610, 354312, 313356, 305173, 223269, 354342, 346153, 354346, 313388, 124974, 321589, 215095, 288829, 288835, 313415, 239689, 354386, 329812, 223317, 321632, 280676, 313446, 215144, 288878, 288890, 215165, 329884, 215204, 125108, 280761, 223418, 280767, 280779, 346319, 321744, 280792, 280803, 182503, 338151, 125166, 125170, 313595, 125184, 125192, 125197, 125200, 125204, 272661, 125215, 125216, 125225, 338217, 321839, 125236, 362809, 280903, 289109, 379224, 272730, 215395, 239973, 313703, 280938, 321901, 354671, 354672, 199030, 223611, 248188, 313726, 240003, 158087, 313736, 240020, 190870, 190872, 289185, 436644, 305572, 289195, 338359, 289229, 281038, 281039, 256476, 281071, 322057, 182802, 322077, 289328, 330291, 338491, 322119, 281165, 281170, 436831, 281200, 313970, 297600, 346771, 363155, 289435, 314020, 248494, 166581, 314043, 355006, 363212, 158424, 322269, 338658, 289511, 330473, 330476, 289517, 215790, 125683, 199415, 322302, 289534, 322312, 346889, 264971, 322320, 166677, 207639, 281378, 289580, 355129, 281407, 289599, 355136, 355138, 355147, 355148, 355153, 281426, 281434, 322396, 281444, 355173, 355174, 207735, 314240, 158594, 330627, 240517, 355216, 256920, 289691, 240543, 289699, 256934, 289704, 289720, 289723, 330688, 281541, 19398, 191445, 183254, 314343, 183276, 289773, 248815, 347122, 240631, 330759, 330766, 347150, 330789, 248871, 281647, 322609, 314437, 257093, 207954, 314458, 281698, 281699, 257126, 322664, 363643, 314493, 150656, 248960, 347286, 339101, 330912, 339106, 306339, 249003, 208044, 322733, 3243, 339131, 290001, 339167, 298209, 290030, 208123, 322826, 126229, 257323, 298290, 208179, 159033, 216387, 372039, 109899, 224591, 331091, 150868, 314708, 314711, 314721, 281958, 314727, 134504, 306541, 314734, 314740, 314742, 314745, 290170, 224637, 306558, 314752, 306561, 290176, 314759, 388488, 298378, 314765, 314771, 306580, 224662, 282008, 314776, 282013, 290206, 314788, 314790, 282023, 298406, 241067, 314797, 134586, 380350, 306630, 200136, 306634, 339403, 3559, 191980, 282097, 306678, 191991, 290304, 323079, 323083, 208397, 323088, 282132, 282135, 282147, 372261, 306730, 290359, 134715, 323132, 282182, 224848, 224852, 290391, 306777, 323171, 282214, 224874, 314997, 290425, 282244, 323208, 282248, 224907, 323226, 282272, 282279, 298664, 298666, 224951, 224952, 306875, 282302, 323262, 323265, 282309, 306891, 241360, 282321, 241366, 224985, 282330, 282336, 12009, 282347, 282349, 323315, 200444, 282366, 175874, 282375, 323335, 282379, 216844, 118549, 282390, 282399, 241440, 282401, 315172, 241447, 282418, 282424, 282428, 413500, 241471, 339782, 315209, 159563, 307024, 307030, 241494, 339799, 307038, 282471, 282476, 339840, 315265, 282503, 315272, 315275, 184207, 282517, 298912, 118693, 298921, 126896, 200628, 282572, 282573, 323554, 298987, 282634, 241695, 315431, 315433, 102441, 102446, 282671, 241717, 249912, 307269, 233548, 315468, 176209, 315477, 53334, 200795, 323678, 356446, 315488, 315489, 45154, 217194, 233578, 307306, 249976, 381071, 241809, 323730, 299166, 233635, 299176, 184489, 323761, 184498, 258233, 299197, 299202, 176325, 299208, 233678, 282832, 356575, 307431, 356603, 184574, 217352, 61720, 315674, 282908, 299294, 282912, 233761, 282920, 315698, 332084, 282938, 307514, 168251, 332100, 323914, 201037, 282959, 348499, 348501, 168280, 323934, 332128, 381286, 242027, 242028, 160111, 315768, 315769, 291194, 291193, 291200, 340356, 242059, 315798, 291225, 242079, 283039, 299449, 291266, 373196, 283088, 283089, 242138, 176602, 291297, 283138, 233987, 324098, 283154, 291359, 348709, 348710, 283185, 234037, 234044, 332379, 111197, 242274, 176751, 356990, 291455, 152196, 316044, 184974, 316048, 316050, 176810, 299698, 291529, 225996, 242385, 299737, 234216, 234233, 242428, 291584, 299777, 291591, 291605, 283418, 234276, 283431, 234290, 201534, 348999, 283466, 201562, 234330, 275294, 127840, 349025, 177002, 308075, 242540, 242542, 201590, 177018, 308093, 291713, 340865, 299912, 349066, 316299, 234382, 308111, 308113, 209820, 283551, 177074, 127945, 340960, 234469, 340967, 324587, 234476, 201721, 234499, 357380, 234513, 316441, 300087, 21567, 308288, 160834, 349254, 250955, 300109, 234578, 234606, 300145, 234626, 349317, 234635, 177297, 308375, 324761, 119965, 234655, 300192, 234662, 300200, 373937, 300215, 283846, 283849, 259275, 316628, 259285, 357594, 251124, 316661, 283894, 234741, 292092, 234756, 242955, 177420, 292145, 300342, 333114, 333115, 193858, 300354, 300355, 234830, 259408, 283990, 357720, 300378, 300379, 316764, 292194, 284015, 234864, 316786, 243073, 292242, 112019, 234902, 333224, 374189, 284090, 54719, 415170, 292291, 300488, 300490, 234957, 144862, 300526, 259569, 308722, 251379, 300539, 210429, 366081, 292359, 218632, 316951, 374297, 349727, 374327, 210489, 235069, 349764, 194118, 292426, 333389, 128589, 333394, 128600, 235096, 300643, 300645, 415334, 243306, 54895, 325246, 333438, 235136, 317102, 300729, 333508, 259780, 333522, 325345, 153318, 333543, 284410, 300810, 300812, 284430, 161553, 284436, 169751, 325403, 341791, 325411, 186148, 186149, 333609, 284460, 300849, 325444, 153416, 325449, 317268, 325460, 341846, 284508, 300893, 259937, 284515, 276326, 292713, 292719, 325491, 333687, 350072, 317305, 317308, 325508, 333700, 243590, 243592, 325514, 350102, 333727, 219046, 333734, 284584, 292783, 300983, 153553, 292835, 6116, 292838, 317416, 325620, 333827, 243720, 292901, 178215, 325675, 243763, 325695, 333902, 194667, 284789, 284790, 292987, 194692, 235661, 153752, 284827, 284840, 284843, 227517, 309443, 227525, 301255, 227536, 301270, 301271, 325857, 334049, 317676, 309504, 194832, 227601, 325904, 334104, 211239, 317738, 325930, 227655, 383309, 391521, 366948, 285031, 416103, 227702, 211327, 227721, 285074, 227730, 285083, 293275, 317851, 39323, 227743, 285089, 293281, 301482, 342454, 293309, 317889, 326083, 326093, 285152, 195044, 236020, 317949, 342537, 309770, 334345, 342560, 227881, 293420, 236080, 23093, 244279, 244280, 301635, 309831, 55880, 301647, 326229, 309847, 375396, 244326, 301688, 244345, 301702, 334473, 326288, 227991, 285348, 318127, 293552, 342705, 285362, 285360, 154295, 342714, 342757, 285419, 170735, 359166, 228099, 285443, 285450, 326413, 285457, 285467, 326428, 318247, 293673, 318251, 301872, 285493, 285496, 301883, 342846, 293702, 318279, 244569, 252766, 301919, 293729, 351078, 342888, 310132, 228214, 269179, 211835, 228232, 416649, 236427, 252812, 293780, 310166, 400282, 310177, 359332, 359333, 293801, 326571, 252848, 326580, 326586, 326602, 56270, 252878, 359380, 343020, 203758, 293894, 384015, 293911, 326684, 384031, 113710, 203829, 285795, 253028, 228457, 318571, 187508, 302202, 285819, 285823, 318602, 285834, 228492, 162962, 187539, 326803, 359574, 285850, 351389, 302239, 253098, 302251, 294069, 367798, 294075, 64699, 228541, 343230, 310496, 228587, 302319, 351475, 228608, 318732, 245018, 318746, 130342, 130344, 130347, 286012, 294210, 359747, 359748, 294220, 318804, 294236, 327023, 327030, 310650, 179586, 294278, 318860, 318876, 245160, 286128, 286133, 310714, 302523, 228796, 302530, 228804, 310725, 302539, 310731, 310735, 327122, 310747, 286176, 187877, 310758, 40439, 253431, 286201, 245249, 228868, 302602, 294413, 359949, 253456, 302613, 302620, 146976, 245291, 425534, 310853, 286281, 196184, 212574, 204386, 204394, 138862, 310896, 294517, 286344, 188049, 229011, 229021, 302751, 245413, 212649, 286387, 286392, 302778, 286400, 319176, 212684, 302798, 286419, 294621, 294629, 286457, 286463, 319232, 360194, 278292, 278294, 294699, 286507, 319289, 237397, 188250, 237411, 327556, 188293, 311183, 294806, 294808, 253851, 319393, 294820, 294824, 253868, 343993, 188349, 98240, 294849, 24531, 212953, 360416, 294887, 253930, 278507, 311277, 327666, 278515 ]
7fa894c6422e69a0dd19aee0c7d94f9c9799f510
9ac2ac03e93395ee7cd29b78a0cdb522057ea92d
/NightProject/ViewController.swift
dd1c79860401029d22358a53f371d020d6489317
[ "MIT" ]
permissive
mansi2mittal/NightProject
6d51dd7723d86218864503d2307a0aec0cf133db
c38d66cf2bb68d17b0281bc40fd67006510c2b53
refs/heads/master
2021-01-21T11:23:00.443920
2017-03-03T05:53:50
2017-03-03T05:53:50
83,560,954
0
0
null
null
null
null
UTF-8
Swift
false
false
5,099
swift
// // ViewController.swift // NightProject // // Created by Appinventiv on 01/03/17. // Copyright © 2017 Appinventiv. All rights reserved. // import UIKit class ViewController: UIViewController , UIScrollViewDelegate { //OUTLETS @IBOutlet weak var image: UIImageView! @IBOutlet weak var scrollView: UIScrollView! @IBOutlet weak var signInButton: UIButton! @IBOutlet weak var signUpButton: UIButton! @IBOutlet weak var sliderBelowButton: UIView! @IBOutlet weak var bottomConstraintOfScrollView: NSLayoutConstraint! // MARK: VIEW LIFECYCLE override func viewDidLoad() { super.viewDidLoad() scrollView.delegate = self // ADDING OBSERVER TO THE NOTIFICATION CENTER AS TO REDUCE THE BOTTOM CONSTRAINT OF THE SCROLL VIEW WHEN THE KEYBOARD APPEARS NotificationCenter.default.addObserver(forName: .UIKeyboardWillShow, object: nil, queue: OperationQueue.main, using: {(Notification) -> Void in guard let userinfo = Notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue else{ return } let keyboardHeight = userinfo.cgRectValue.height self.bottomConstraintOfScrollView.constant = keyboardHeight - 130 }) // ADDING THE OBSERVER FOR HIDING THE KEYBOARD NotificationCenter.default.addObserver(forName: .UIKeyboardWillHide, object: nil, queue: OperationQueue.main, using: {(Notification) -> Void in self.bottomConstraintOfScrollView.constant = 0 }) // SETTING THE FRAME OF THE SCROLL VIEW self.scrollView.frame = CGRect( x: 0 , y: 243 , width : self.view.frame.width , height: 324) let signInVc = self.storyboard?.instantiateViewController(withIdentifier: "LoginVCID") as! LoginVC // SETTING THE FRAME OF THE SIGNIN VC signInVc.view.frame = CGRect(x: 0, y: 0, width: self.scrollView.frame.width, height: self.scrollView.frame.height) // ADDING SIGNIN VC AS A CHILD VIEW CONTROLLER self.addChildViewController(signInVc) self.scrollView.addSubview((signInVc.view)!) // MOVING TO THE PARENT VC signInVc.didMove(toParentViewController: self) // SETTING THE FRAME OF THE SIGNUP VC let signUpVc = self.storyboard?.instantiateViewController(withIdentifier: "SignUpVCID") as! SignUpVC signUpVc.view.frame = CGRect(x: self.scrollView.frame.width, y: 0, width: self.scrollView.frame.width, height: self.scrollView.frame.height) // ADD AS A CHILD VC self.addChildViewController(signUpVc) // MOVING TO THE PARENT VC signUpVc.didMove(toParentViewController: self) self.scrollView.addSubview(signUpVc.view) self.scrollView.contentSize = CGSize(width: (self.scrollView.frame.width) * 2, height: self.scrollView.frame.height) } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() } // ACTION FOR THE TAP ON THE SIGNUP BUTTON @IBAction func signUpButtonTapped(_ sender: Any) { sliderBelowButton.frame = CGRect( x: 80 , y: 235 , width : 80 , height: 10) let signUpVc = self.storyboard?.instantiateViewController(withIdentifier: "SignUpVCID") as! SignUpVC signUpVc.view.frame = self.scrollView.bounds self.addChildViewController(signUpVc) self.scrollView.addSubview((signUpVc.view)!) signUpVc.didMove(toParentViewController: self) var signUpFrame : CGRect = signUpVc.view.frame signUpFrame.origin.x = self.scrollView.frame.width } // ACTION ON THE TAP OF THE SIGN IN BUTTON @IBAction func signInButtonTapped(_ sender: Any) { sliderBelowButton.frame = CGRect( x: 00 , y: 235 , width : 80 , height: 10) let signInVc = self.storyboard?.instantiateViewController(withIdentifier: "LoginVCID") as! LoginVC signInVc.view.frame = self.scrollView.bounds self.addChildViewController(signInVc) self.scrollView.addSubview((signInVc.view)!) signInVc.didMove(toParentViewController: self) } // WHEN THE SCROLL HAPPENS THE SLIDER VIEW THAT HAS BEEN TAKEN IS SEEN MOVING WITH ANIMATION func scrollViewDidScroll(_ scrollView: UIScrollView) { let multiplier = self.scrollView.frame.width/self.sliderBelowButton.frame.width let scrollPoint = scrollView.contentOffset.x self.sliderBelowButton.transform = CGAffineTransform(translationX: scrollPoint/multiplier , y: 0) } }
[ -1 ]
a7c5df753c029d0568d1080271b0089b67006f37
c626676d93a9096223a2540812aaa7fb0dfa7252
/Book1/05_InteractiveScene/ButtonAndAction/ButtonAndActionTests/ButtonAndActionTests.swift
50bbe1bec04b7c942f2f8a9a2db2f9313dc5ebfa
[]
no_license
wannabewize/TAcademy_iOS_Samples
53ede56fc06c059645cc6b3f3bc659f8367ef78a
7f04badbe616b2e76568808bc384bab3a1bdf4b9
refs/heads/master
2020-04-14T05:32:53.841393
2017-03-30T05:31:18
2017-03-30T05:31:18
1,817,853
6
7
null
null
null
null
UTF-8
Swift
false
false
932
swift
// // ButtonAndActionTests.swift // ButtonAndActionTests // // Created by wannabewize on 2015. 1. 26.. // Copyright (c) 2015년 VanillaStep. All rights reserved. // import UIKit import XCTest class ButtonAndActionTests: XCTestCase { override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } func testExample() { // This is an example of a functional test case. XCTAssert(true, "Pass") } func testPerformanceExample() { // This is an example of a performance test case. self.measureBlock() { // Put the code you want to measure the time of here. } } }
[ 276481, 277505, 276484, 175625, 276489, 280077, 279054, 277517, 275469, 186893, 295953, 223767, 277017, 276509, 277029, 278056, 278060, 310317, 277550, 228917, 276533, 241720, 277049, 226875, 277563, 7229, 277566, 230463, 7231, 159807, 207938, 301634, 277574, 128583, 226888, 280649, 277066, 276045, 276046, 207953, 276050, 277585, 296018, 226897, 223318, 288857, 226906, 278618, 275547, 194653, 147036, 370271, 276577, 277603, 276582, 277094, 281707, 189036, 189037, 276589, 277101, 295535, 276592, 189042, 189043, 275571, 276085, 227446, 131189, 276088, 398457, 278140, 277118, 276606, 276097, 192131, 276101, 275590, 275591, 277640, 141450, 311435, 312972, 133774, 277138, 276627, 226452, 276116, 277141, 275607, 276631, 278170, 184475, 280220, 164512, 277665, 276129, 227492, 275620, 275625, 275628, 209581, 278191, 226481, 278195, 166580, 296628, 278201, 277690, 276156, 285372, 285374, 276165, 278214, 199366, 227528, 276684, 276687, 276180, 203989, 277204, 203478, 278742, 119513, 278746, 155867, 363744, 201442, 276195, 276709, 279269, 276715, 419569, 276211, 204022, 157944, 211193, 120056, 226043, 168188, 276737, 277254, 276744, 203529, 204041, 278285, 276753, 129301, 184086, 369432, 276760, 278810, 276764, 276253, 277792, 228129, 278307, 288547, 259363, 276774, 277800, 277289, 113962, 165677, 277294, 277806, 226097, 277809, 276787, 262450, 277814, 276279, 277815, 276792, 276282, 277821, 278846, 276287, 226624, 162621, 164162, 277316, 15686, 278856, 142669, 276813, 277327, 278862, 277838, 277325, 6482, 222548, 276821, 277845, 277339, 277852, 218462, 297822, 277856, 276831, 297826, 276835, 276318, 276325, 142689, 281962, 173420, 276332, 277868, 277871, 173936, 279919, 278898, 277360, 213876, 226675, 277366, 277878, 275831, 276344, 277370, 277882, 142716, 277883, 226170, 227199, 280961, 277890, 277891, 226181, 213894, 226694, 277896, 277381, 277900, 226189, 230799, 318864, 226194, 296338, 206228, 40850, 40853, 44952, 277919, 277920, 247712, 277410, 276900, 277925, 276394, 275371, 370091, 226222, 277936, 276401, 278961, 277939, 226227, 278965, 296375, 277943, 277435, 277949, 287677, 277952, 296387, 163269, 276421, 277957, 296391, 278985, 276422, 277965, 276430, 281037, 111056, 279002, 276444, 277980, 277983, 276450, 276451, 277988, 277480, 277993, 296425, 276459, 279019, 276462, 276463, 279022, 276468, 276469, 278005, 278008, 276475, 276478 ]
b4a2c3611b62178fecd83423a629d66bda9f7833
4d3a504d89b7788fb6e5ac6a16af2b6b33988f5f
/RaceRunner/GpxActivityItemProvider.swift
c3ce3277b9043630d34b60516eca9e4d06826a51
[]
no_license
CodingApps/RaceRunner
6e78441c0843ad22e2dd899a689d7d08673eb58f
c43a99183e5a70d3c9a2feba54d53c16b56251b0
refs/heads/master
2020-03-29T13:13:19.582375
2018-06-24T23:13:35
2018-06-24T23:13:35
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,020
swift
// // GpxActivityItemProvider.swift // RaceRunner // // Created by Joshua Adams on 11/30/15. // Copyright © 2015 Josh Adams. All rights reserved. // import Foundation import UIKit class GpxActivityItemProvider: UIActivityItemProvider { override var item: Any { // The following approach would be appropriate for a gpx file in the main bundle. if let filePath = Bundle.main.path(forResource: "Runmeter", ofType: "gpx") { if let fileData = try? Data(contentsOf: URL(fileURLWithPath: filePath)) { return fileData as AnyObject } } return NSString(string: "error") } override func activityViewController(_ activityViewController: UIActivityViewController, dataTypeIdentifierForActivityType activityType: UIActivityType?) -> String { return "com.topografix.gpx" } override func activityViewController(_ activityViewController: UIActivityViewController, subjectForActivityType activityType: UIActivityType?) -> String { return "run recorded by Runmeter" } }
[ 56717 ]
a52e7cbc9c9f7c2ccdbb22aacbb70e652bb111f4
c7f8b8b7e79366181fd37f810e393d795c07fea8
/training/ViewController.swift
e3c925237b7363210d1ebdad704aebca8071653a
[]
no_license
ayham95/Product
74b0961554e82ce3be62e6344fcf05b645e89695
496104d3d46d3e04ecad7f4bdced8b8b96bb190c
refs/heads/master
2021-01-21T21:14:13.207570
2017-05-25T15:19:14
2017-05-25T15:19:14
92,317,674
0
0
null
null
null
null
UTF-8
Swift
false
false
1,301
swift
// // ViewController.swift // training // // Created by Ayham.dev on 5/21/17. // Copyright © 2017 DEV. All rights reserved. // import UIKit class ViewController: UIViewController { @IBOutlet weak var tableView: UITableView! let quotesDataSource: QuotesDataSource required init?(coder aDecoder: NSCoder) { let quotes = [ Quote(category: "TECHNOLOGY"), Quote(category: "FASHION"), Quote(category: "FOODSTUFF"), Quote(category: "FURNITURE"), Quote(category: "BEAUTY"), Quote(category: "BOOKS"), Quote(category: "HEALTH & PERSONAL CARE"), Quote(category: "JEWELRY"), Quote(category: "OTHER"), ] self.quotesDataSource = QuotesDataSource(quotes: quotes) super.init(coder: aDecoder) } } // MARK: UIViewController extension ViewController { override func viewDidLoad() { super.viewDidLoad() tableView.rowHeight = 50 tableView.dataSource = quotesDataSource tableView.reloadData() navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default) navigationController?.navigationBar.shadowImage = UIImage() } }
[ -1 ]
7e511ee0575471d1c072310c79da5803d3a37471
08a5f3045a656855125febc204c12d05246fd9e2
/Stroke-Rehabilitation/ViewController/UserListAndLoginPage/UserSettingPage.swift
9338947bd2690745ced75e3bb51105454e0d65c2
[]
no_license
yinzixie/Stroke-Rehabilitation
c10488ac6c73181515746d12aef78efc7c7d72c6
0126cee151a444c7dd8dc150eba5cea7dfd53d38
refs/heads/master
2020-04-28T02:40:53.442718
2019-11-16T10:38:13
2019-11-16T10:38:13
174,907,907
3
0
null
null
null
null
UTF-8
Swift
false
false
3,870
swift
// // UserSettingPage.swift // Stroke-Rehabilitation // // Created by yinzixie on 26/9/19. // Copyright © 2019 yinzixie. All rights reserved. // import UIKit class UserSettingPage: UIViewController { @IBOutlet weak var deleteProtectionSwitch: UISwitch! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. let defaults = UserDefaults.standard let isProtection = defaults.bool(forKey:UserDefaultKeys.DeleteProtection) deleteProtectionSwitch.setOn(isProtection, animated: true) } @IBAction func switchTrigger(_ sender: Any) { if(deleteProtectionSwitch.isOn) { print("Trun on Delete Protection") }else { print("Trun off Delete Protection ") } //set let defaults = UserDefaults.standard defaults.setValue(deleteProtectionSwitch.isOn, forKey: UserDefaultKeys.DeleteProtection) } @IBAction func exportData(_ sender: Any) { let appearance = SCLAlertView.SCLAppearance( showCloseButton: false ) let alert = SCLAlertView(appearance: appearance).showWait("Transform", subTitle: "Processing...", closeButtonTitle: nil, timeout: nil, colorStyle: nil, colorTextButton: 0xFFFFFF, circleIconImage: nil, animationStyle: SCLAnimationStyle.topToBottom) let missionListFileName = DBAdapter.logPatient.ID + "_Mission_List.csv" let buttonTriggerEventFileName = DBAdapter.logPatient.ID + "_Button_Events.csv" guard let missionPath = NSURL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(missionListFileName) else { return } guard let buttonPath = NSURL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(buttonTriggerEventFileName) else { return } var csvMissionText = "MissionID,StartFrom,FinishAt,AimGoal,AimTime,Achievement,FinishTime\n" var csvButtonText = "MissionID,EventID,ButtonID,TriggerTime\n" alert.setSubTitle("Progress: 10%") for mission in DBAdapter.logPatient.HistoryNormalCounterMissionList { let newLine = "\(mission.MissionID),\(mission.StartTime),\(mission.FinalTime),\(mission.AimGoal),\(mission.AimTime),\(mission.FinalAchievement),\(mission.FinalTime - mission.StartTime)\n" csvMissionText.append(newLine) for event in mission.ButtonTriggerEventList { let newL = "\(event.MissionID),\(event.EventID),\(event.Button.ButtonID),\(event.TriggerTime)\n" csvButtonText.append(newL) } } alert.setSubTitle("Progress: 90%") do { try csvMissionText.write(to: missionPath, atomically: true, encoding: String.Encoding.utf8) try csvButtonText.write(to: buttonPath, atomically: true, encoding: String.Encoding.utf8) alert.setSubTitle("Progress: 100%") DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { alert.close() let vc = UIActivityViewController(activityItems: [missionPath,buttonPath], applicationActivities: []) self.present(vc, animated: true, completion: nil) } } catch { print("Failed to create file") print("\(error)") _ = SCLAlertView().showError("Error", subTitle: error as! String) } } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destination. // Pass the selected object to the new view controller. } */ }
[ -1 ]
5ee026c30a8004fb69b5a30f8b509aa603f43688
5d3c4f2415c43e4b88e2a410bfd0d73d8000320f
/Todoey/Controllers/CategoryTableViewController.swift
3bc465e0ced48a21ff3f02362e83bd28b75dc347
[]
no_license
KungleStillSkint/Todoey
e7258b7f8b43d7bf5e831ae2a5fd07e0e13c82fa
12b3e9d56dff3fc85f57e937280b29ec8c3d936a
refs/heads/master
2020-05-14T09:28:23.507984
2019-04-28T08:59:30
2019-04-28T08:59:30
181,740,667
0
0
null
null
null
null
UTF-8
Swift
false
false
2,936
swift
// // CategoryTableViewController.swift // Todoey // // Created by Keith Consterdine on 25/04/2019. // Copyright © 2019 Keith Consterdine. All rights reserved. // import UIKit import RealmSwift class CategoryTableViewController: UITableViewController { let realm = try! Realm() var categoryArray: Results<Category>? override func viewDidLoad() { super.viewDidLoad() loadCategory() } // MARK: - TableView DataSource Methods override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return categoryArray?.count ?? 1 } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "CategoryCell", for: indexPath) cell.textLabel?.text = categoryArray?[indexPath.row].name ?? "No categories added yet" return cell } // MARK: - TabkeView Delegate Methods override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { performSegue(withIdentifier: "goToItems", sender: self) } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { let destinationVC = segue.destination as! TodoListViewController if let indexPath = tableView.indexPathForSelectedRow { destinationVC.selectedCategory = categoryArray?[indexPath.row] } } // MARK: - Data Manipulation Methods func save(category: Category) { do { try realm.write { realm.add(category) } } catch { print("Error saving context \(error)") } tableView.reloadData() } func loadCategory() { categoryArray = realm.objects(Category.self) tableView.reloadData() } // MARK: - Add New Categories @IBAction func addButtonPressed(_ sender: UIBarButtonItem) { var textField = UITextField() let alert = UIAlertController(title: "Add New Category", message: "", preferredStyle: .alert) let action = UIAlertAction(title: "Add Category", style: .default) { (action) in let newCategory = Category() newCategory.name = textField.text! self.save(category: newCategory) } alert.addAction(action) alert.addTextField { (alertTextfield) in alertTextfield.placeholder = "Create new category" textField = alertTextfield } present(alert, animated: true, completion: nil) } }
[ 384230 ]
ed92c4fa01fcfa95ccfac8b05cffe8dee9613e8c
58a2995dd249b73813a4be2c16c552d7f5620bfe
/appservice/resource-manager/Sources/appservice/commands/WebAppsListDeploymentLog.swift
3b697f1612ecea04a919c07523355c9e9591af47
[ "MIT" ]
permissive
Azure/azure-libraries-for-swift
e577d83d504f872cf192c31d97d11edafc79b8be
b7321f3c719c381894e3ee96c5808dbcc97629d7
refs/heads/master
2023-05-30T20:22:09.906482
2021-02-01T09:29:10
2021-02-01T09:29:10
106,317,605
9
5
MIT
2021-02-01T09:29:11
2017-10-09T18:02:45
Swift
UTF-8
Swift
false
false
2,805
swift
import Foundation import azureSwiftRuntime public protocol WebAppsListDeploymentLog { var headerParameters: [String: String] { get set } var resourceGroupName : String { get set } var name : String { get set } var id : String { get set } var subscriptionId : String { get set } var apiVersion : String { get set } func execute(client: RuntimeClient, completionHandler: @escaping (DeploymentProtocol?, Error?) -> Void) -> Void ; } extension Commands.WebApps { // ListDeploymentLog list deployment log for specific deployment for an app, or a deployment slot. internal class ListDeploymentLogCommand : BaseCommand, WebAppsListDeploymentLog { public var resourceGroupName : String public var name : String public var id : String public var subscriptionId : String public var apiVersion = "2016-08-01" public init(resourceGroupName: String, name: String, id: String, subscriptionId: String) { self.resourceGroupName = resourceGroupName self.name = name self.id = id self.subscriptionId = subscriptionId super.init() self.method = "Get" self.isLongRunningOperation = false self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}/log" self.headerParameters = ["Content-Type":"application/json; charset=utf-8"] } public override func preCall() { self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName) self.pathParameters["{name}"] = String(describing: self.name) self.pathParameters["{id}"] = String(describing: self.id) self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId) self.queryParameters["api-version"] = String(describing: self.apiVersion) } public override func returnFunc(data: Data) throws -> Decodable? { let contentType = "application/json" if let mimeType = MimeType.getType(forStr: contentType) { let decoder = try CoderFactory.decoder(for: mimeType) let result = try decoder.decode(DeploymentData?.self, from: data) return result; } throw DecodeError.unknownMimeType } public func execute(client: RuntimeClient, completionHandler: @escaping (DeploymentProtocol?, Error?) -> Void) -> Void { client.executeAsync(command: self) { (result: DeploymentData?, error: Error?) in completionHandler(result, error) } } } }
[ -1 ]
7e38cc360cc65b3919ca35255f0110290212def8
1a65b7a6f885a73c7777b3a91aef59616e262419
/ApplicationVK/Service/Operation/AsyncOperation.swift
cdcee536a07d04bea801320427784cc8a7e459ee
[]
no_license
ZverevaO/iOS
b604d202a8f98c824f4ba09db6fd78c398c80b93
c76a4284a06ad6b1f14bea0fe1b5bf91830bf6e0
refs/heads/master
2021-04-24T01:06:28.668809
2020-08-16T16:40:36
2020-08-16T16:40:36
250,050,247
2
0
null
2020-08-16T17:19:56
2020-03-25T17:49:07
Swift
UTF-8
Swift
false
false
1,290
swift
// // AsyncOperation.swift // ApplicationVK // // Created by Оксана Зверева on 27.06.2020. // Copyright © 2020 Oksana Zvereva. All rights reserved. // import Foundation class AsyncOperation: Operation { enum State: String { case ready, executing, finished fileprivate var keyPath: String { return "is" + rawValue.capitalized } } var state = State.ready { willSet { willChangeValue(forKey: state.keyPath) willChangeValue(forKey: newValue.keyPath) } didSet { didChangeValue(forKey: state.keyPath) didChangeValue(forKey: oldValue.keyPath) } } override var isAsynchronous: Bool { return true } override var isReady: Bool { return super.isReady && state == .ready } override var isExecuting: Bool { return state == .executing } override var isFinished: Bool { return state == .finished } override func start() { if isCancelled { state = .finished } else { main() state = .executing } } override func cancel() { super.cancel() state = .finished } }
[ 330459, 337966 ]
22475e167c0fa22f2a03699366b49b6063561416
74970587e1fd145bd36966922e029402eac68144
/DebugApp/DebugApp/View/Main/Scene/Shape/PathShapeView.swift
982172108839273da11f1e40b6857ced9c0a4c46
[ "MIT" ]
permissive
bathymetric-cam/iShapeTriangulation
9fdbeb81a642e98fea495fbb8e7d93d61e39da41
1007c168b2aee71131be0d82aad0e5c691f5f301
refs/heads/master
2023-02-17T03:55:19.272599
2021-01-17T06:17:16
2021-01-17T06:17:16
null
0
0
null
null
null
null
UTF-8
Swift
false
false
3,013
swift
// // PathShapeView.swift // DebugApp // // Created by Nail Sharipov on 07.01.2021. // Copyright © 2021 Nail Sharipov. All rights reserved. // import SwiftUI import iGeometry struct PathShapeView: View { private let paths: [[CGPoint]] private let stroke: Color private let lineWidth: CGFloat private let showIndices: Bool private let indices: [Index] @ObservedObject private var sceneState: SceneState private struct Index { let value: Int let point: CGPoint } init(sceneState: SceneState, paths: [[Point]], stroke: Color = .gray, lineWidth: CGFloat = 2, showIndices: Bool = true) { self.stroke = stroke self.lineWidth = lineWidth self.showIndices = showIndices self.sceneState = sceneState self.paths = paths.map({ $0.cgPoints }) if showIndices { var j = 0 let indexShift: CGFloat = 1 var indices = [Index]() indices.reserveCapacity(paths.first?.count ?? 10) for path in self.paths { let n = path.count for i1 in 0..<n { let i0 = (i1 - 1 + n) % n let i2 = (i1 + 1) % n let p0 = path[i0] let p1 = path[i1] let p2 = path[i2] let normal = CGPoint.normal(a: p0, b: p1, c: p2) let point = p1 - indexShift * normal indices.append(Index(value: j, point: point)) j += 1 } } self.indices = indices } else { self.indices = [] } } var body: some View { return ZStack { Path { path in for points in paths { let screenPoints = sceneState.screen(world: points) path.addLines(screenPoints) path.closeSubpath() } }.strokedPath(.init(lineWidth: self.lineWidth)).foregroundColor(self.stroke) ForEach(self.indices, id: \.value) { index in Text("\(index.value)").position(self.sceneState.screen(world: index.point)).foregroundColor(.black) } } } } private extension CGPoint { static private let epsilon: CGFloat = 0.00000000000000000001 static func normal(a: CGPoint, b: CGPoint, c: CGPoint) -> CGPoint { guard (b - a).magnitude > CGPoint.epsilon && (c - b).magnitude > CGPoint.epsilon else { return CGPoint(x: 1, y: 0) } let ab = (b - a).normalize let bc = (c - b).normalize let abN = CGPoint(x: ab.y, y: -ab.x) let bcN = CGPoint(x: bc.y, y: -bc.x) let sum = abN + bcN if sum.magnitude < CGPoint.epsilon { return CGPoint(x: -ab.x, y: -ab.y) } return sum.normalize } }
[ -1 ]
762ce0cd9cc05e82e41453a936c8325c3d95b6eb
86fa8f44ec597eeffc4278cfbf060a879979a133
/LYSwiftLearn/LYSwiftLearn/PlayGround/MyPlayground.playground/Pages/Catalog.xcplaygroundpage/Contents.swift
149716ed75f6ddbe0b0af4ee0873df03af83e089
[ "Apache-2.0" ]
permissive
liuyulwy/swiftLearn
8cf168d5b60ec39e8817d8b0b09bc3386c156665
42bdaa9c5fb423655333911d604c9913a6a222de
refs/heads/master
2021-05-22T02:30:33.462999
2020-09-15T09:58:27
2020-09-15T09:58:27
252,929,442
0
0
null
null
null
null
UTF-8
Swift
false
false
75
swift
/*: > swift 学习笔记 */ //: [Previous](@previous) [Next](@next)
[ -1 ]
7ac66ce5c4996b23e6becc25840446a630ce8e1d
0675c36af0260619aca97b4a8eec9d8b318765c6
/Login/Controllers/EditProfileViewController.swift
344dbcffe7ecea288244991d2af50f8a81f2f5f0
[]
no_license
matushinn/Madamii
12627dd2f74f98ed33d9a1112876451bd6ed6ca9
22038e64a3f93abd04c525704f14ec84def0329d
refs/heads/master
2020-09-11T03:42:42.365941
2019-11-15T13:21:09
2019-11-15T13:21:09
221,927,765
0
0
null
null
null
null
UTF-8
Swift
false
false
6,999
swift
// // EditProfileViewController.swift // Login // // Created by 大江祥太郎 on 2019/07/04. // Copyright © 2019 shotaro. All rights reserved. // import UIKit import NCMB import NYXImagesKit import SVProgressHUD class EditProfileViewController: UIViewController,UITextViewDelegate,UITextFieldDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate{ let placeHolder = UIImage(named: "placeholder") @IBOutlet weak var userImageView: UIImageView! @IBOutlet weak var userIdTextField:UITextField! @IBOutlet weak var userNameTextField: UITextField! @IBOutlet weak var introductionTextView: UITextView! override func viewDidLoad() { super.viewDidLoad() userImageView.image = placeHolder //丸くするコード userImageView.layer.cornerRadius = userImageView.bounds.width / 2.0 userImageView.layer.masksToBounds = true userIdTextField.delegate = self userNameTextField.delegate = self introductionTextView.delegate = self let userId = NCMBUser.current()?.userName userIdTextField.text = userId if let user = NCMBUser.current() { userNameTextField.text = user.object(forKey: "displayName") as? String userIdTextField.text = user.userName introductionTextView.text = user.object(forKey: "introduction") as? String let file = NCMBFile.file(withName: user.objectId, data: nil) as! NCMBFile file.getDataInBackground { (data, error) in if error != nil { if self.userImageView.image != self.placeHolder{ let alert = UIAlertController(title: "画像取得エラー", message: error!.localizedDescription, preferredStyle: .alert) let okAction = UIAlertAction(title: "OK", style: .default, handler: { (action) in }) alert.addAction(okAction) self.present(alert, animated: true, completion: nil) } } else { if data != nil { let image = UIImage(data: data!) self.userImageView.image = image } } } } else { let storyboard = UIStoryboard(name: "SignIn", bundle: Bundle.main) let rootViewController = storyboard.instantiateViewController(withIdentifier: "SignInController") UIApplication.shared.keyWindow?.rootViewController = rootViewController // ログイン状態の保持 let ud = UserDefaults.standard ud.set(false, forKey: "isLogin") ud.synchronize() } } func textFieldShouldReturn(_ textField: UITextField) -> Bool { textField.resignFirstResponder() return true } func textViewShouldEndEditing(_ textView: UITextView) -> Bool { textView.resignFirstResponder() return true } func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { let selectedImage = info[UIImagePickerController.InfoKey.originalImage] as! UIImage //リサイズ let resizedImage = selectedImage.scale(byFactor: 0.3) picker.dismiss(animated: true, completion: nil) //data型に変換 let data = resizedImage!.pngData() //型を変換 let file = NCMBFile.file(withName: NCMBUser.current()?.objectId,data:data) as! NCMBFile file.saveInBackground({ (error) in if error != nil{ SVProgressHUD.showError(withStatus: error!.localizedDescription) }else{ self.userImageView.image = selectedImage } }) { (progress) in print(progress) } } @IBAction func close(_ sender: Any) { self.dismiss(animated: true, completion: nil) } @IBAction func selectImage(_ sender: Any) { let alertController = UIAlertController(title: "画像の選択", message: "選択してください", preferredStyle:.actionSheet) let cameraAction = UIAlertAction(title: "カメラ", style: .default) { (action) in // カメラ起動 //カメラが使えたら if UIImagePickerController.isSourceTypeAvailable(.camera) == true { let picker = UIImagePickerController() picker.sourceType = .camera picker.allowsEditing = true picker.delegate = self self.present(picker, animated: true, completion: nil) } else { print("この機種ではカメラが使用出来ません。") } } let albumAction = UIAlertAction(title: "フォトライブラリ", style: .default) { (action) in // アルバム起動 if UIImagePickerController.isSourceTypeAvailable(.photoLibrary) == true { let picker = UIImagePickerController() picker.sourceType = .photoLibrary picker.allowsEditing = true picker.delegate = self self.present(picker, animated: true, completion: nil) } else { print("この機種ではフォトライブラリが使用出来ません。") } } let cancelAction = UIAlertAction(title: "キャンセル", style: .cancel) { (action) in alertController.dismiss(animated: true, completion: nil) } alertController.addAction(cameraAction) alertController.addAction(albumAction) alertController.addAction(cancelAction) self.present(alertController, animated: true, completion: nil) } @IBAction func saveInfo(_ sender: Any) { let user = NCMBUser.current() user?.setObject(userNameTextField.text, forKey: "displayName") user?.setObject(userIdTextField.text, forKey: "userName") user?.setObject(introductionTextView.text, forKey: "introduction") user?.saveInBackground({ (error) in if error != nil { let alert = UIAlertController(title: "送信エラー", message: error!.localizedDescription, preferredStyle: .alert) let okAction = UIAlertAction(title: "OK", style: .default, handler: { (action) in alert.dismiss(animated: true, completion: nil) }) alert.addAction(okAction) self.present(alert, animated: true, completion: nil) } else { self.dismiss(animated: true, completion: nil) } }) } }
[ -1 ]
77b8787545f79387dcc793440dfd05bcd832a63c
d85d53638d867f01f8c79b8087103730cc26c860
/Sources/SwiftFMIRPCore/Game.swift
f45683fd14aa1d4fc2ca490cb9996e425bbceb07
[]
no_license
svetlanagrueva/RPG-Game-Project
e7a3252e0ee20b185e23be1ec625a656121cbc5a
09cfe6c043b5a2648487010663baaa304755eb33
refs/heads/master
2023-08-08T04:57:17.425038
2020-07-17T05:50:38
2020-07-17T05:50:38
null
0
0
null
null
null
null
UTF-8
Swift
false
false
6,111
swift
func readLine<T: LosslessStringConvertible>(as type: T.Type) -> T? { return readLine().flatMap(type.init(_:)) } class Game { var mapGenerator: MapGenerator var playerGenerator: PlayerGenerator var mapRenderer: MapRenderer init(mapGenerator: MapGenerator, playerGenerator: PlayerGenerator, mapRenderer: MapRenderer) { self.mapGenerator = mapGenerator self.playerGenerator = playerGenerator self.mapRenderer = mapRenderer } //implement main logic func run() { print("Starting the RPG game...") var players:[Player] = [] var totalPlayers = 0 repeat { print("Моля избере брой играчи (2 - 4): ") if let number = readLine(as: Int.self) { totalPlayers = number } else { print("Невалиден вход! Моля, опитай пак.") } } while totalPlayers < 2 || totalPlayers > 4 // 1. Избор на брой играчи. Минимум 2 броя. print("Вие избрахте \(totalPlayers) играчи. Системата сега ще избере вашите герои.") for i in 1...totalPlayers { print("Генериране на играч...") players.append(playerGenerator.generatePlayer(name: "Player #\(i)")) } /* for player in players { player.introduce() } */ let map = mapGenerator.generate(players: players) // 1. Избор на брой играчи. Минимум 2 броя. // 1. Генериране на карта с определени брой размери на базата на броя играчи. // 1. Докато има повече от един оцелял играч, изпълнявай ходове. // * определи енергията за текущия играч // * Текущия играч се мести по картата докато има енергия. // * Потребителя контролира това като му се предоставя възможност за действие. // * ако се въведе системна команда като `map` се визуализра картата // 1. Следващия играч става текущ. var currentPlayerIndex = 0 while activePlayers(allPlayers: players).count > 1 { if var currentPlayer:Player = players[currentPlayerIndex] as? Player, currentPlayer.isAlive { let playerNumber = currentPlayerIndex + 1 print("Сега е на ход играч №\(playerNumber) - \(currentPlayer.name)") ///команди от играча var playerMoveIsNotFinished = true repeat { print("Моля въведете команда от възможните: ") let availableMoves = map.availableMoves(player: currentPlayer) var allCommands = ["finish", "map"] if currentPlayer.isAlive { allCommands.append("seppuku") availableMoves.forEach { (move) in allCommands.append(move.friendlyCommandName) } } print("\(allCommands)") if let command = readLine(as: String.self) { //TODO: провери дали не е от някои от възможните други действия //TODO: ако е от тях изпълни действието if let move = availableMoves.first(where: { (move) -> Bool in move.friendlyCommandName == command }) { //разпозната команда map.move(player: currentPlayer, move: move) } else { //иначе, провери за //специални команди switch command { case "finish": playerMoveIsNotFinished = false print("Вашият ход приключи.") case "map": print("Отпечатваме картата:") mapRenderer.render(map: map) case "seppuku": print("Ritual suicide...") currentPlayer.isAlive = false playerMoveIsNotFinished = false print("Вашият ход приключи.") default: print("Непозната команда!") } } } else { print("Невалиден вход! Моля, опитай пак.") } } while playerMoveIsNotFinished } //минаваме на следващия играч currentPlayerIndex += 1 currentPlayerIndex %= players.count } let winners = activePlayers(allPlayers: players) if winners.count > 0 { print("Победител е: \(winners[0].name)") } else { print("Няма победител :/. Опитайте да изиграете нова игра.") } print("RPG game has finished.") } private func activePlayers(allPlayers: [Player]) -> [Player] { return allPlayers.filter { (p) -> Bool in p.isAlive } } }
[ -1 ]
44a76aee46c9c6bf192c4dff7d1c9f4254bb7959
3df1bfad95f2de3b2a25b615b858f960da020dde
/Coryat-Swift/GameBoardViewController.swift
7e866cfe7f30fe7ff3ebdc98686ce3e9a3d9ffd8
[]
no_license
rmgrimm/Coryat-Swift
27f50ba1bd3233962c15c7ac4c968ae73e8af4c1
11a0f3aa62c42de799bb9386c487522f406b3907
refs/heads/master
2021-01-15T15:55:35.774378
2015-03-19T12:45:58
2015-03-19T12:45:58
null
0
0
null
null
null
null
UTF-8
Swift
false
false
7,962
swift
// // GameBoardViewController.swift // Coryat-Swift // // Created by Michael Frain on 3/18/15. // Copyright (c) 2015 Michael Frain. All rights reserved. // import UIKit class GameBoardViewController: UIViewController { var currentGame: Game! @IBOutlet var gameBoard: UICollectionView! @IBOutlet var endRound: UIButton! @IBOutlet var currentScore: UILabel! var categoryArray: Array<String>! var roundNumber = 1 var selectedCell: NSIndexPath! var selectedClue = 0 override func viewDidLoad() { super.viewDidLoad() currentScore.text = "Score: \(currentGame.score) - Record: \(currentGame.correctResponses) / \(currentGame.incorrectResponses) / \(currentGame.noResponses)" categoryArray = currentGame.currentCategoryArray if roundNumber == 1 { endRound.setTitle("End Round 1", forState: .Normal) } else if roundNumber == 2 { endRound.setTitle("End Round 2", forState: .Normal) } else { assert(false, "Only two rounds, something went wrong.") } } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "CellSelectionSegue" { let destinationController = segue.destinationViewController as! ResultViewController destinationController.currentGame = currentGame destinationController.currentClueValue = selectedClue destinationController.cellIndex = selectedCell } else if segue.identifier == "UnwindRoundSegue" { currentGame.correctArray = [] currentGame.incorrectArray = [] currentGame.noAnswerArray = [] } else if segue.identifier == "FinalJeopardySegue" { let destinationController = segue.destinationViewController as! FinalJeopardyViewController destinationController.currentGame = currentGame } } override func shouldPerformSegueWithIdentifier(identifier: String?, sender: AnyObject?) -> Bool { if identifier == "UnwindRoundSegue" && roundNumber == 2 { return false } else if identifier == "FinalJeopardySegue" && roundNumber == 1 { return false } return true } @IBAction func unwindConfirmedClueResult(sender: UIStoryboardSegue) { let sourceController = sender.sourceViewController as! ResultViewController let previousCellIndex = sourceController.cellIndex let previousCell = gameBoard.cellForItemAtIndexPath(previousCellIndex) as! GameBoardCell if sourceController.result == ResultViewController.LastResult.Incorrect { previousCell.cellValueLabel.backgroundColor = UIColor.redColor() } else if sourceController.result == ResultViewController.LastResult.Correct { previousCell.cellValueLabel.backgroundColor = UIColor.greenColor() } else { previousCell.cellValueLabel.backgroundColor = UIColor.grayColor() } previousCell.alreadySelected = true currentGame = sourceController.currentGame currentScore.text = "Score: \(currentGame.score) - Record: \(currentGame.correctResponses) / \(currentGame.incorrectResponses) / \(currentGame.noResponses)" } @IBAction func unwindCanceledClueResult(sender: UIStoryboardSegue) { } } extension GameBoardViewController: UICollectionViewDataSource { func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { return 1 } func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return 36 } func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { var cellValueString: String if roundNumber == 1 { switch indexPath.item { case 0...5: cellValueString = currentGame.currentCategoryArray[indexPath.item] case 6...11: cellValueString = "$200" case 12...17: cellValueString = "$400" case 18...23: cellValueString = "$600" case 24...29: cellValueString = "$800" case 30...35: cellValueString = "$1000" default: cellValueString = "" } } else { switch indexPath.item { case 0...5: cellValueString = currentGame.currentCategoryArray[indexPath.item] case 6...11: cellValueString = "$400" case 12...17: cellValueString = "$800" case 18...23: cellValueString = "$1200" case 24...29: cellValueString = "$1600" case 30...35: cellValueString = "$2000" default: cellValueString = "" } } let boardCell = GameBoardCell.cellForCollectionView(collectionView, indexPath: indexPath, cellValue: cellValueString) if currentGame.inProgress { if find(currentGame.correctArray, indexPath.item) != nil { boardCell.cellValueLabel.backgroundColor = UIColor.greenColor() boardCell.alreadySelected = true } else if find(currentGame.incorrectArray, indexPath.item) != nil { boardCell.cellValueLabel.backgroundColor = UIColor.redColor() boardCell.alreadySelected = true } else if find(currentGame.noAnswerArray, indexPath.item) != nil { boardCell.cellValueLabel.backgroundColor = UIColor.grayColor() boardCell.alreadySelected = true } } return boardCell } } extension GameBoardViewController: UICollectionViewDelegate { func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) { var boardCell = collectionView.cellForItemAtIndexPath(indexPath) as! GameBoardCell if boardCell.alreadySelected == true { return } if roundNumber == 1 { switch indexPath.item { case 6...11: selectedClue = 200 case 12...17: selectedClue = 400 case 18...23: selectedClue = 600 case 24...29: selectedClue = 800 case 30...35: selectedClue = 1000 default: selectedClue = 0 } } else if roundNumber == 2 { switch indexPath.item { case 6...11: selectedClue = 400 case 12...17: selectedClue = 800 case 18...23: selectedClue = 1200 case 24...29: selectedClue = 1600 case 30...35: selectedClue = 2000 default: selectedClue = 0 } } selectedCell = indexPath if indexPath.item > 5 { self.performSegueWithIdentifier("CellSelectionSegue", sender: self) } } }
[ -1 ]
927de856595abad6d9669f08c308a41d7320f7dc
8fa77f9238cfbe046d4fd237d16bd76612466ffa
/IntermittentFasting/ViewControllers/1. Calorie/PersonalFoodViewController.swift
6b1b90b07c2589f4e25ae6e2301e84a1fdb1b63e
[]
no_license
KimSamHyun/IntermittentFasting
c1dc977b8eebf89cd85c094a8edb84bab080ecbc
ca0d23b05505d2bf1a1c892a63ca7c43f5335c1a
refs/heads/master
2020-05-16T01:12:09.620245
2019-05-04T09:05:32
2019-05-04T09:05:32
182,596,713
0
0
null
2019-04-22T00:29:57
2019-04-22T00:29:57
null
UTF-8
Swift
false
false
708
swift
// // PersonalFoodViewController.swift // Test3 // // Created by sama73 on 2019. 5. 2.. // Copyright © 2019년 sama73. All rights reserved. // import UIKit class PersonalFoodViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destination. // Pass the selected object to the new view controller. } */ }
[ -1 ]
c8a0ea430ccaf0f37cc3b1fcdd9573215adabf2d
c522bcea44dec9ad2dda59869d5921df827357e7
/TestDP/Result.swift
8b46a7715d78ffc4b9eeaf7cf7801b94b011439e
[]
no_license
prizrak1609/TestDP
8dee1cd5a9ec95f7b36e84e1a300006d0260a107
391a3ac6415cb5b34c55a07b1a191188b03afa0b
refs/heads/master
2021-01-01T15:19:45.465006
2017-07-21T10:49:09
2017-07-21T10:49:09
97,592,129
0
0
null
2017-07-21T10:49:10
2017-07-18T11:51:34
Swift
UTF-8
Swift
false
false
221
swift
// // Result.swift // TestDP // // Created by Dima Gubatenko on 19.07.17. // Copyright © 2017 Dima Gubatenko. All rights reserved. // import Foundation enum Result<T> { case error(String) case success(T) }
[ -1 ]
308ee49a05c50fdc92831d66b067830c2a7e2161
df86da1273f7a040c8d89dc7da7a5f34e3e64fd4
/ViperLearning/Protocols/ViewProtocols.swift
008374935f98d08e315dc7df5c1f85100b3f3657
[]
no_license
trastoan/BeerVisualizer
b94e83486e5f673b90a773918093bb03d3f47087
24a4b79bc7abe16b194e3575fa0b21d536af3b9b
refs/heads/master
2021-08-24T09:58:05.271917
2017-12-09T04:34:11
2017-12-09T04:34:11
113,452,228
0
0
null
null
null
null
UTF-8
Swift
false
false
329
swift
// // ViewProtocols.swift // ViperLearning // // Created by Yuri Saboia Felix Frota on 06/12/17. // Copyright © 2017 ExpressU. All rights reserved. // import UIKit protocol ReusableView: class {} protocol NibLoadableView: class {} protocol EmptyStateView: class { func setupOn(view: UIView, withText text: String) }
[ -1 ]
1aa9fcefaa8e71ca7ef3a35b46f8a20f46fe9ab8
7ac6f030ad12c9695e1c3fea18df5d9598f6353f
/graphPON iOS/ViewControllers/DailyChartViewController.swift
13da8d0cb9ef2bc4a49958103adbb87a6695a7e5
[ "MIT" ]
permissive
FREEWING-JP/graphPON
e5871e9dcd4c69bd2b3284ccf79ce8686615f05f
2064409648dc0cb8a8012d48f6fbf72631a177a4
refs/heads/master
2020-04-01T19:44:12.750431
2015-04-24T07:48:28
2015-04-27T03:44:35
null
0
0
null
null
null
null
UTF-8
Swift
false
false
9,875
swift
import UIKit import GraphPONDataKit import JBChartFramework class DailyChartViewController: BaseChartViewController, JBBarChartViewDelegate, JBBarChartViewDataSource, HddServiceListTableViewControllerDelegate, DisplayPacketLogsSelectTableViewControllerDelegate { @IBOutlet weak var chartViewContainerView: ChartViewContainerView! let mode: Mode = .Daily private var chartData: [CGFloat]? private var chartHorizontalData: [String]? private var hdoService: HdoService? { didSet { self.serviceCode = hdoService?.hdoServiceCode } } // MARK: - View Lifecycle override func viewDidLoad() { super.viewDidLoad() self.view.backgroundColor = self.mode.backgroundColor() self.chartViewContainerView.chartView.delegate = self self.chartViewContainerView.chartView.dataSource = self self.chartViewContainerView.chartView.headerPadding = kJBAreaChartViewControllerChartHeaderPadding self.chartViewContainerView.chartView.footerPadding = kJBAreaChartViewControllerChartFooterPadding self.chartViewContainerView.chartView.backgroundColor = self.mode.backgroundColor() let footerView = LineChartFooterView(frame: CGRectMake( self.chartViewContainerView.chartView.frame.origin.x, ceil(self.view.bounds.size.height * 0.5) - ceil(kJBLineChartViewControllerChartFooterHeight * 0.5), self.chartViewContainerView.chartView.bounds.width, kJBLineChartViewControllerChartFooterHeight + kJBLineChartViewControllerChartPadding )) footerView.backgroundColor = UIColor.clearColor() footerView.leftLabel.textColor = UIColor.whiteColor() footerView.rightLabel.textColor = UIColor.whiteColor() self.chartViewContainerView.chartView.footerView = footerView self.chartInformationView.setHidden(true, animated: false) if self.serviceCode == nil { if let hdoService = PacketInfoManager.sharedManager.hddServices.first?.hdoServices?.first { self.hdoService = hdoService } } self.reBuildChartData() } override func viewWillAppear(animated: Bool) { super.viewWillAppear(animated) self.reloadChartView(animated) } override func viewDidAppear(animated: Bool) { super.viewDidAppear(animated) NSNotificationCenter.defaultCenter().addObserverForName( PacketInfoManager.LatestPacketLogsDidFetchNotification, object: nil, queue: NSOperationQueue.mainQueue(), usingBlock: { _ in self.reBuildChartData() self.reloadChartView(true) }) } deinit { NSNotificationCenter.defaultCenter().removeObserver(self) } // MARK: - Actions override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "HddServiceListFromDailyChartSegue" { let navigationController = segue.destinationViewController as! UINavigationController let hddServiceListViewController = navigationController.topViewController as! HddServiceListTableViewController hddServiceListViewController.delegate = self hddServiceListViewController.mode = .Daily hddServiceListViewController.selectedService = self.hdoService?.number ?? "" } else if segue.identifier == "DisplayPacketLogsSelectFromSummaryChartSegue" { let navigationController = segue.destinationViewController as! UINavigationController let displayPacketLogSelectViewController = navigationController.topViewController as! DisplayPacketLogsSelectTableViewController displayPacketLogSelectViewController.delegate = self displayPacketLogSelectViewController.selectedFilteringSegment = self.chartDataFilteringSegment } } @IBAction func chartSegmentedControlValueDidChanged(segmentedControl: UISegmentedControl) { self.chartDurationSegment = HdoService.Duration(rawValue: segmentedControl.selectedSegmentIndex)! self.reBuildChartData() self.reloadChartView(false) } func reloadChartView(animated: Bool) { if let hdoService = self.hdoService { self.navigationItem.title = "\(hdoService.nickName) (\(self.chartDataFilteringSegment.text()))" } if let chartData = self.chartData where chartData.count > 0 { self.chartViewContainerView.chartView.minimumValue = 0 self.chartViewContainerView.chartView.maximumValue = maxElement(chartData) } if let footerView = self.chartViewContainerView.chartView.footerView as? LineChartFooterView { footerView.leftLabel.text = self.hdoService?.packetLogs.first?.dateText() footerView.rightLabel.text = self.hdoService?.packetLogs.last?.dateText() footerView.sectionCount = self.chartData?.count ?? 0 footerView.hidden = footerView.sectionCount == 0 } self.displayLatestTotalChartInformation() self.chartViewContainerView.reloadChartData() self.chartViewContainerView.chartView.setState(JBChartViewState.Expanded, animated: animated) } func displayLatestTotalChartInformation() { if let packetLog = self.hdoService?.packetLogs.last { self.chartInformationView.setTitleText( String(format: NSLocalizedString("Used in %@", comment: "Chart information title text in daily chart"), packetLog.dateText()) ) self.chartInformationView.setHidden(false, animated: true) } else { self.chartInformationView.setHidden(true, animated: false) self.informationValueLabelSeparatorView.alpha = 0.0 self.valueLabel.alpha = 0.0 return } UIView.animateWithDuration(NSTimeInterval(kJBChartViewDefaultAnimationDuration) * 0.5, delay: 0.0, options: UIViewAnimationOptions.BeginFromCurrentState, animations: { self.informationValueLabelSeparatorView.alpha = 1.0 self.valueLabel.text = PacketLog.stringForValue(self.chartData?.last) self.valueLabel.alpha = 1.0 }, completion: nil ) } // MARK: - Private methods func reBuildChartData() { if let hdoService = PacketInfoManager.sharedManager.hdoServiceForServiceCode(self.serviceCode) ?? PacketInfoManager.sharedManager.hddServices.first?.hdoServices?.first { self.hdoService = hdoService } else { return } self.chartData = self.hdoService?.summarizeServiceUsageInDuration( self.chartDurationSegment, couponSwitch: self.chartDataFilteringSegment ) self.chartHorizontalData = self.hdoService?.packetLogs.map { $0.dateText() } } // MARK: - JBLineChartViewDataSource func numberOfBarsInBarChartView(barChartView: JBBarChartView!) -> UInt { return UInt(self.chartData?.count ?? 0) } // MARK: - JBLineChartViewDelegate func barChartView(barChartView: JBBarChartView!, heightForBarViewAtIndex index: UInt) -> CGFloat { return self.chartData?[Int(index)] ?? 0.0 } func barChartView(barChartView: JBBarChartView!, didSelectBarAtIndex index: UInt, touchPoint: CGPoint) { let dateText = self.chartHorizontalData?[Int(index)] ?? "" self.chartInformationView.setTitleText( String(format: NSLocalizedString("Used in %@", comment: "Chart information title text in daily chart"), dateText) ) self.chartInformationView.setHidden(false, animated: true) UIView.animateWithDuration( NSTimeInterval(kJBChartViewDefaultAnimationDuration) * 0.5, delay: 0.0, options: UIViewAnimationOptions.BeginFromCurrentState, animations: { self.valueLabel.text = PacketLog.stringForValue(self.chartData?[Int(index)]) self.valueLabel.alpha = 1.0 }, completion: nil ) } func didDeselectBarChartView(barChartView: JBBarChartView!) { self.chartInformationView.setHidden(true, animated: true) UIView.animateWithDuration( NSTimeInterval(kJBChartViewDefaultAnimationDuration) * 0.5, delay: 0.0, options: UIViewAnimationOptions.BeginFromCurrentState, animations: { self.valueLabel.alpha = 0.0 }, completion: { [unowned self] finish in if finish { self.displayLatestTotalChartInformation() } } ) } func barChartView(barChartView: JBBarChartView!, colorForBarViewAtIndex index: UInt) -> UIColor! { return UIColor.whiteColor() } func barSelectionColorForBarChartView(barChartView: JBBarChartView!) -> UIColor! { return UIColor(red:0.392, green:0.392, blue:0.559, alpha:1.0) } // MARK: - HddServiceListTableViewControllerDelegate func serviceDidSelectedSection(section: Int, row: Int) { self.hdoService = PacketInfoManager.sharedManager.hddServices[section].hdoServices?[row] self.reBuildChartData() if self.traitCollection.horizontalSizeClass == .Regular { self.reloadChartView(true) } } // MARK: - DisplayPacketLogsSelectTableViewControllerDelegate func displayPacketLogSegmentDidSelected(segment: Int) { self.chartDataFilteringSegment = Coupon.Switch(rawValue: segment)! self.reBuildChartData() if self.traitCollection.horizontalSizeClass == .Regular { self.reloadChartView(true) } } }
[ -1 ]
a3a7d996c9490fc5d93c9cde161f8d61b6946a92
ecbe97c620e47f50b085aae62e893bc9c4e03dff
/Sources/App/Controllers/Crawler/LaGouController.swift
56ffb0cc51b5ca24f1fc5380fc9cdf042a891eda
[ "MIT" ]
permissive
jgh33/DemosPushVapor
1b6fda59ddeee79702274f6663eca0fa2bd165d2
fb7b1734aeb4c198916ec97b74b64b10dc7f8f63
refs/heads/master
2020-04-14T04:53:41.518906
2019-01-02T09:49:31
2019-01-02T09:49:31
163,648,367
0
0
null
null
null
null
UTF-8
Swift
false
false
20,193
swift
// // LaGouController.swift // App // // Created by Jinxiansen on 2018/6/27. // import Foundation import Vapor import SwiftSoup import Random import Fluent import FluentPostgreSQL private let crawlerInterval = TimeAmount.minutes(2) // 间隔2分钟 class LaGouController: RouteCollection { var timer: Scheduled<()>? var page = 1 var filterIndex: Int = 0 var result: [LGWork]? var searchCity = "上海" //搜索城市 var searchKey = "ios" //搜索关键词 func boot(router: Router) throws { router.group("crawler") { (crawler) in crawler.get("swiftDoc", use: crawlerSwiftDocHandler) crawler.get("query", use: crawlerQueryHandler) } router.group("lagou") { (lagou) in lagou.get("ios", use: readAllIOSWorksHandler) lagou.get("getWork", use: getWorksInfoHandler) lagou.get("para", use: requestDetailDataHandler) lagou.get("start", use: startTimerHandler) lagou.get("cancel", use: cancelTimerHandler) lagou.get("getLogs", use: getCrawlerLogHandler) } } } extension LaGouController { func startTimerHandler(_ req: Request) throws -> Future<Response> { guard self.timer == nil else { return try ResponseJSON<Empty>(status: .error, message: "正在运行,请先调用 Cancel api").encode(for: req) } guard let city = req.query[String.self, at: "city"], let key = req.query[String.self, at: "key"] else { return try ResponseJSON<Empty>(status: .error, message: "缺少 key 或 city 参数").encode(for: req) } self.searchCity = city self.searchKey = key _ = try self.crawlerLaGouWebHandler(req) return try ResponseJSON<Empty>(status: .ok, message: "开始爬取任务:\(searchCity) \(searchKey)").encode(for: req) } func cancelTimerHandler(_ req: Request) throws -> Future<Response> { self.timer?.cancel() self.timer = nil let content = "已取消" self.saveLog(req: req, content: content) return try ResponseJSON<Empty>(status: .ok, message: content).encode(for: req) } func runRepeatTimerHandler(_ req: Request) throws { if let result = self.result,result.count > 0 { if self.filterIndex == result.count - 1 { self.saveLog(req: req, content: "第\(page)页已爬完。\n") page += 1 _ = try self.crawlerLaGouWebHandler(req) return } } self.timer = req.eventLoop.scheduleTask(in: crawlerInterval) { _ = try self.parseResultHandler(req) } } } //MARK: Static Func extension LaGouController { func crawlerLaGouWebHandler(_ req: Request) throws -> Future<Response> { guard let urlStr = "https://www.lagou.com/jobs/positionAjax.json?city=\(searchCity)&needAddtionalResult=false&isSchoolJob=0".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else { return try ResponseJSON<Empty>(status: .error, message: "URL 转码错误").encode(for: req) } guard let url = urlStr.convertToURL() else { return try ResponseJSON<Empty>(status: .error, message: "URL 错误").encode(for: req) } let LGHeader: HTTPHeaders = [ "User-Agent":"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Mobile Safari/537.36", "Referer":"https://www.lagou.com/jobs/list_\(searchKey)"] struct ReqBody: Content { var first: Bool = false //是否第一页 var pn: Int //页码 var kd: String //搜索关键字 } //第一页 first = true let body = ReqBody(first: page == 1 ? true: false, pn: page, kd: searchKey) //构造请求体。 var httpReq = HTTPRequest(method: .POST, url: url, headers: LGHeader) let randomIP = self.randomIP() httpReq.headers.add(name: "Host", value: "www.lagou.com") httpReq.headers.add(name: "X-Real-IP", value: randomIP) httpReq.headers.add(name: "X-Forwarded-For", value: randomIP) let postReq = Request(http: httpReq, using: req) try postReq.content.encode(body, as: .urlEncodedForm) return try req.client().send(postReq).flatMap(to: Response.self, { (clientResponse) in let jsonString = clientResponse.utf8String let data = jsonString.convertToData() let decode = JSONDecoder() let lgItem = try decode.decode(LGResponseItem.self, from: data) if let result = lgItem.content?.positionResult?.result,result.count > 0 { self.result = result self.filterIndex = 0 let content = "取到第\(self.page)页,\(result.count)条数据 -> 启动定时器:\(TimeManager.current())" self.saveLog(req: req, content: content) try self.runRepeatTimerHandler(req) //取到数据开始定时解析 return try ResponseJSON<Empty>(status: .ok, message: "爬到\(result.count)条数据").encode(for: req) }else { _ = try self.cancelTimerHandler(req) let content = "没有数据了,任务已取消" self.saveLog(req: req ,content: content) return try ResponseJSON<Empty>(status: .error, message: content).encode(for: req) } }) } func saveLog(req: Request,content: String?,desc: String? = nil) { let c = content ?? "" let d = desc ?? "" let t = TimeManager.current() debugPrint( t + c + "\n" + d + "\n") let log = CrawlerLog(title: self.logTitle(), content: content, time: t, desc: desc) log.save(on: req).whenFailure { (error) in debugPrint( "\(error)" + "\n") } _ = log.save(on: req) } func logTitle() -> String { return "\(searchCity)-\(searchKey)" } func parseResultHandler(_ req: Request) throws -> Future<LGWork?> { guard let result = self.result,result.count > 0 else { return req.eventLoop.newSucceededFuture(result: nil) } let item = result[filterIndex] return LGWork.query(on: req) .filter(\.positionId == item.positionId) .first() .flatMap({ (exist) in let fultureDetail = try self.requestDetailData(req, positionId: item.positionId) return fultureDetail.flatMap({ (detail) in if var exist = exist { exist.address = detail.address exist.tag = detail.tag exist.jobDesc = detail.jobDesc self.filterIndex += 1 try self.runRepeatTimerHandler(req) return exist.update(on: req).flatMap({ (update) in self.saveLog(req: req, content: "已更新 positionId:\(update.positionId))\n") return req.eventLoop.newSucceededFuture(result: update) }) }else { var newItem = LGWork( id: nil, adWord: item.adWord, appShow: item.appShow, approve: item.approve, city: item.city, companyFullName: item.companyFullName, companyId: item.companyId, companyLogo: item.companyLogo, companyShortName: item.companyShortName, companySize: item.companySize, createTime: item.createTime, deliver: item.deliver, district: item.district, education: item.education, financeStage: item.financeStage, firstType: item.firstType, formatCreateTime: item.formatCreateTime, imState: item.imState, industryField: item.industryField, isSchoolJob: item.isSchoolJob, jobNature: item.jobNature, lastLogin: item.lastLogin, latitude: item.latitude, linestaion: item.linestaion, longitude:item.longitude, pcShow: item.pcShow, positionAdvantage:item.positionAdvantage,positionId: item.positionId, positionName: item.positionName, publisherId: item.publisherId, resumeProcessDay: item.resumeProcessDay, resumeProcessRate: item.resumeProcessRate, salary: item.salary, score: item.score, secondType: item.secondType, stationname: item.stationname, subwayline: item.subwayline, workYear: item.workYear, tag: detail.tag, jobDesc: detail.jobDesc, address: detail.address) newItem.companyLogo = "https://www.lagou.com/" + (item.companyLogo ?? "") let save = newItem.save(on: req) save.whenFailure({ (error) in self.saveLog(req: req, content: "保存失败: \(error)\n") }) self.filterIndex += 1 try self.runRepeatTimerHandler(req) return save.flatMap({ (saveResult) in self.saveLog(req: req, content: "第\(self.page)页,第\(self.filterIndex)条数据", desc: "已保存 positionId:\(saveResult.positionId)") return req.eventLoop.newSucceededFuture(result: saveResult) }) } }) }) } //MARK: 请求详情页 private func requestDetailData(_ req: Request, positionId: Int) throws -> Future<LGDetailItem> { let urlStr = "https://www.lagou.com/jobs/\(positionId).html" guard let url = URL(string: urlStr) else { return req.eventLoop.newSucceededFuture(result: LGDetailItem(tag: "空", jobDesc: "空", address: "空")) } //构造请求体。 var httpReq = HTTPRequest(method: .GET, url: url) let randomIP = self.randomIP() httpReq.headers.add(name: "X-Real-IP", value: randomIP) httpReq.headers.add(name: "X-Forwarded-For", value: randomIP) let getReq = Request(http: httpReq, using: req) return try req.client().send(getReq) .flatMap(to: LGDetailItem.self, { (clientResp) in let html = clientResp.utf8String let document = try SwiftSoup.parse(html) let tag = try document.select("dd[class='job_request']").text() let jobDesc = try document.select("dd[class='job_bt']").text() let address = try document.select("div[class='work_addr']").text().replacingOccurrences(of: "查看地图", with: "") let content = "\(randomIP) 解析 jobDesc 长度 = \(jobDesc.count)\n\n" self.saveLog(req: req, content: content, desc: html) return req.eventLoop.newSucceededFuture(result: LGDetailItem(tag: tag, jobDesc: jobDesc, address: address)) }) } func requestDetailDataHandler(_ req: Request) throws -> Future<Response> { guard let positionId = req.query[Int.self, at: "id"] else { return try ResponseJSON<Empty>(status: .error, message: " 缺少 id").encode(for: req) } return try requestDetailData(req, positionId: positionId).flatMap({ (item) in return try ResponseJSON<LGDetailItem>(data: item).encode(for: req) }) } func readAllIOSWorksHandler(_ req: Request) throws -> Future<Response> { let futureAll = LGWork.query(on: req).filter(\.positionName ~~ "ios").all() return futureAll.flatMap({ (items) in return try ResponseJSON<[LGWork]>(status: .ok, message: "共\(items.count)条数据", data: items).encode(for: req) }) } func getWorksInfoHandler(_ req: Request) throws -> Future<Response> { guard let city = req.query[String.self, at: "city"], let key = req.query[String.self, at: "key"] else { return try ResponseJSON<Empty>(status: .error, message: "缺少 key 或 city 参数").encode(for: req) } let futureAll = LGWork.query(on: req).filter(\.city ~~ city).filter(\.positionName ~~ key).query(page: req.page).all() return futureAll.flatMap({ (items) in return try ResponseJSON<[LGWork]>(data: items).encode(for: req) }) } func getCrawlerLogHandler(_ req: Request) throws -> Future<Response> { guard let city = req.query[String.self, at: "city"], let key = req.query[String.self, at: "key"] else { return try ResponseJSON<Empty>(status: .error, message: "缺少 key 或 city 参数").encode(for: req) } let title = "\(city)-\(key)" let all = CrawlerLog.query(on: req).filter(\.title == title).all() return all.flatMap({ (logs) in return try ResponseJSON<[CrawlerLog]>(data: logs).encode(for: req) }) } func randomIP() -> String { let a: Int = Int(SimpleRandom.random(10...254)) let b: Int = Int(SimpleRandom.random(10...254)) let c: Int = Int(SimpleRandom.random(10...254)) let d: Int = Int(SimpleRandom.random(10...254)) let ip = "\(a).\(b).\(c).\(d)" return ip } } extension LaGouController { func crawlerSwiftDocHandler(_ req: Request) throws -> Future<Response> { let urlStr = "http://swiftdoc.org" guard let url = URL(string: urlStr) else { return try ResponseJSON<Empty>(status: .error, message: "URL 错误").encode(for: req) } let client = try req.client() return client.get(url) .flatMap(to: Response.self, { clientResponse in struct Item: Content { var type: String var titles: [String] } let html = clientResponse.utf8String let document = try SwiftSoup.parse(html) var items = [Item]() let elements = try document.select("div[class='col-sm-12']") for element in elements { let type = try? element.select("article[class='content']").select("h2").text() guard let mainlist = try? element.select("ul[class='main-list'],li").select("a") else { return try ResponseJSON<Empty>(status: .error, message: "节点 错误").encode(for: req) } var titles = [String]() for list in mainlist { let text = try list.text() titles.append(text) } items.append(Item(type: type ?? "", titles: titles)) } return try ResponseJSON<[Item]>(status: .ok, message: "解析成功,解析地址:\(urlStr)", data: items).encode(for: req) }) } func crawlerQueryHandler(_ req: Request) throws -> Future<Response> { guard let urlStr = req.query[String.self, at: "url"] else { return try ResponseJSON<Empty>(status: .error, message: "缺少 url 参数").encode(for: req) } guard let parse = req.query[String.self, at: "parse"] else { return try ResponseJSON<Empty>(status: .error, message: "缺少 parse 参数").encode(for: req) } guard let url = URL(string: urlStr) else { return try ResponseJSON<Empty>(status: .error, message: "url 错误").encode(for: req) } return try req.make(FoundationClient.self) .get(url) .flatMap(to: Response.self, { (clientResponse) in let html = clientResponse.utf8String let document = try SwiftSoup.parse(html) let elements = try document.select(parse) struct Item: Content { var text: String? var html: String? } var items = [Item]() for element in elements { let text = try element.text() let html = try element.outerHtml() items.append(Item(text: text, html: html)) } return try ResponseJSON<[Item]>(status: .ok, message: "解析成功,解析地址:\(urlStr)", data: items).encode(for: req) }) } } fileprivate struct LGDetailItem: Content { var tag: String? var jobDesc: String? var address: String? } fileprivate struct LGResponseItem: Content { var code : Int var content : LGContentItem? var success : Bool? //不确定的数据类型,暂不解析 // var msg : AnyObject? // var requestId : AnyObject? // var resubmitToken : AnyObject? } fileprivate struct LGContentItem: Content { var hrInfoMap : [String: LGHRInfoMap]? var pageNo : Int? var pageSize : Int? var positionResult : LGPositionResult? } fileprivate struct LGHRInfoMap: Content { var canTalk : Bool? var phone : String? var positionName : String? var realName : String? var receiveEmail : String? var userId : Int? var userLevel : String? // var portrait : AnyObject? } fileprivate struct LGPositionResult: Content { //不确定的数据类型,暂不解析 // var hiTags : AnyObject? // var hotLabels : AnyObject? // var locationInfo : LocationInfo? // var queryAnalysisInfo : QueryAnalysisInfo? // var strategyProperty : StrategyProperty? var result : [LGWork]? var resultSize : Int? var totalCount : Int? }
[ -1 ]
3a85cc22734ad8cb033483a90b49bd3663ae5f7c
af8e0984afb716f773903a8f401cef68c80d9cb8
/CMPE235-SmartStreet/FirstViewController.swift
c59804a6c75178cde4ac21b08403a46c2e3314e1
[]
no_license
shruti514/SmartTrees
d8e8fbf83bb4747b5b73b5d433c4deeb9069293e
8009e7803f828c87c7817fdb176cf78b40e59c11
refs/heads/master
2021-01-18T04:38:24.333752
2016-05-04T21:56:25
2016-05-04T21:56:25
52,758,894
0
0
null
null
null
null
UTF-8
Swift
false
false
534
swift
// // FirstViewController.swift // CMPE235-SmartStreet // // Created by Shrutee Gangras on 2/25/16. // Copyright © 2016 Shrutee Gangras. All rights reserved. // import UIKit class FirstViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }
[ 279046, 309264, 279064, 281118, 295460, 235044, 286249, 197677, 300089, 226878, 277057, 288321, 288332, 278606, 212561, 300116, 300629, 276054, 237655, 200802, 286314, 164974, 284276, 284277, 294518, 314996, 284287, 278657, 281218, 284289, 281221, 284293, 284298, 303242, 311437, 227984, 303760, 278675, 226454, 226455, 226456, 226458, 278686, 284323, 278693, 284328, 284336, 280760, 277180, 283839, 280772, 228551, 280775, 298189, 290004, 284373, 290006, 189655, 226009, 298202, 298204, 280797, 298207, 278752, 290016, 298211, 290020, 284391, 280808, 234223, 358127, 312049, 286963, 280821, 226038, 286965, 333048, 288501, 358139, 280832, 230147, 358147, 278791, 300817, 278298, 287005, 287007, 295711, 281380, 277796, 315177, 130346, 282922, 289578, 312107, 282926, 113972, 159541, 289596, 283453, 289600, 283461, 234829, 298830, 279380, 295766, 279386, 298843, 308064, 289121, 200549, 227688, 216433, 290166, 292730, 333179, 290175, 224643, 313733, 304012, 304015, 300432, 310673, 275358, 289697, 284586, 276396, 277420, 277422, 279982, 286126, 297903, 305582, 230323, 277429, 277430, 277432, 277433, 277434, 230328, 278973, 291774, 298951, 280015, 280029, 286175, 289771, 286189, 183278, 298989, 293875, 237556, 292341, 286204, 290303 ]
240ef537e1bef7143c0d3b4998cf5c7eea78b6e5
11fef464a258a0b7657147aa0f80056e88898d38
/bindings/LDK/options/Option_NetworkUpdateZ.swift
0ca7c2bbcbd5b49d11da0852b2d26884ac544934
[]
no_license
Ramshandilya/ldk-swift
0f77fa55efb3c8e41baaa0c4f5fd32cb78418f84
12815ebc0dec143d2d9a9d86e4b02b93cd7c2679
refs/heads/main
2023-09-03T13:10:43.726186
2021-10-20T08:52:46
2021-10-20T08:52:46
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,977
swift
public class Option_NetworkUpdateZ: NativeTypeWrapper { private static var instanceCounter: UInt = 0 internal let instanceNumber: UInt internal var cOpaqueStruct: LDKCOption_NetworkUpdateZ? /* DEFAULT_CONSTRUCTOR_START */ public init(value: NetworkUpdate?) { Self.instanceCounter += 1 self.instanceNumber = Self.instanceCounter self.cOpaqueStruct = LDKCOption_NetworkUpdateZ() if let value = value { self.cOpaqueStruct!.tag = LDKCOption_NetworkUpdateZ_Some self.cOpaqueStruct!.some = value.cOpaqueStruct! } else { self.cOpaqueStruct!.tag = LDKCOption_NetworkUpdateZ_None } super.init(conflictAvoidingVariableName: 0) } /* DEFAULT_CONSTRUCTOR_END */ public init(pointer: LDKCOption_NetworkUpdateZ){ Self.instanceCounter += 1 self.instanceNumber = Self.instanceCounter self.cOpaqueStruct = pointer super.init(conflictAvoidingVariableName: 0) } public init(pointer: LDKCOption_NetworkUpdateZ, anchor: NativeTypeWrapper){ Self.instanceCounter += 1 self.instanceNumber = Self.instanceCounter self.cOpaqueStruct = pointer super.init(conflictAvoidingVariableName: 0) self.dangling = true try! self.addAnchor(anchor: anchor) } /* OPTION_METHODS_START */ public func getValue() -> NetworkUpdate? { if self.cOpaqueStruct!.tag == LDKCOption_NetworkUpdateZ_None { return nil } if self.cOpaqueStruct!.tag == LDKCOption_NetworkUpdateZ_Some { return NetworkUpdate(pointer: self.cOpaqueStruct!.some) } assert(false, "invalid option enum value") return nil } public class func some(o: NetworkUpdate) -> Option_NetworkUpdateZ { return Option_NetworkUpdateZ(pointer: COption_NetworkUpdateZ_some(o.danglingClone().cOpaqueStruct!)); } public class func none() -> Option_NetworkUpdateZ { return Option_NetworkUpdateZ(pointer: COption_NetworkUpdateZ_none()); } internal func free() -> Void { return COption_NetworkUpdateZ_free(self.cOpaqueStruct!); } internal func dangle() -> Option_NetworkUpdateZ { self.dangling = true return self } deinit { if !self.dangling { Bindings.print("Freeing Option_NetworkUpdateZ \(self.instanceNumber).") self.free() } else { Bindings.print("Not freeing Option_NetworkUpdateZ \(self.instanceNumber) due to dangle.") } } public func clone() -> Option_NetworkUpdateZ { return Option_NetworkUpdateZ(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKCOption_NetworkUpdateZ>) in COption_NetworkUpdateZ_clone(origPointer) }); } internal func danglingClone() -> Option_NetworkUpdateZ { let dangledClone = self.clone() dangledClone.dangling = true return dangledClone } /* OPTION_METHODS_END */ /* TYPE_CLASSES */ }
[ -1 ]
64e65eea41129f6145697125deb239340a7c51fc
c20c060f9b7a981c7c3793ace341f8b4583405de
/WordGarden/AppDelegate.swift
fc20b6fb8811fc988945af8dd2fec7b029cba10e
[]
no_license
louisekim1/WordGarden
3af58b909a055d3639962b7c9e92c90e13e43aac
fe79eb689f1950ccda1041637e929260c3b0bed3
refs/heads/main
2023-03-08T10:30:23.254554
2021-02-21T19:52:33
2021-02-21T19:52:33
339,174,998
0
0
null
null
null
null
UTF-8
Swift
false
false
1,347
swift
// // AppDelegate.swift // WordGarden // // Created by Louise Kim on 2/15/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, 254030, 286800, 368727, 180313, 368735, 180320, 376931, 286831, 368752, 286844, 417924, 262283, 286879, 286888, 377012, 164028, 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, 197159, 377383, 352821, 418363, 188987, 369223, 385609, 385616, 352864, 369253, 262760, 352874, 352887, 254587, 377472, 148105, 377484, 352918, 98968, 344744, 361129, 385713, 434867, 164534, 336567, 328378, 164538, 328386, 352968, 344776, 418507, 352971, 352973, 385742, 385748, 361179, 189153, 369381, 361195, 418553, 344831, 344835, 336643, 344841, 361230, 336659, 418580, 418585, 434970, 369435, 418589, 262942, 418593, 336675, 328484, 418598, 418605, 336696, 361273, 328515, 336708, 328519, 361288, 336711, 328522, 336714, 426841, 197468, 254812, 361309, 361315, 361322, 328573, 377729, 369542, 361360, 222128, 345035, 386003, 345043, 386011, 386018, 386022, 435187, 328702, 328714, 361489, 386069, 336921, 386073, 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, 345267, 386258, 328924, 66782, 222437, 328941, 386285, 386291, 345376, 353570, 345379, 410917, 345382, 337205, 345399, 378169, 369978, 337222, 337229, 337234, 263508, 402791, 345448, 271730, 378227, 271745, 181638, 353673, 181643, 181649, 181654, 230809, 181673, 181681, 337329, 181684, 361917, 181696, 337349, 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, 345701, 394853, 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, 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, 329623, 436126, 436132, 337833, 362413, 337844, 346057, 346063, 247759, 329697, 354277, 190439, 247789, 354313, 346139, 436289, 378954, 395339, 338004, 100453, 329832, 329855, 329885, 346272, 362660, 100524, 387249, 379066, 387260, 256191, 395466, 346316, 411861, 411864, 411868, 411873, 379107, 411876, 387301, 346343, 338152, 387306, 387312, 346355, 436473, 321786, 379134, 411903, 411916, 379152, 395538, 387349, 338199, 387352, 182558, 338211, 248111, 362822, 436555, 190796, 379233, 354673, 321910, 248186, 420236, 379278, 272786, 354727, 338352, 338381, 338386, 256472, 338403, 248308, 199164, 330252, 199186, 420376, 330267, 354855, 10828, 199249, 248425, 191084, 338543, 191092, 346742, 354974, 150183, 174774, 248504, 174777, 223934, 355024, 273108, 355028, 264918, 183005, 256734, 436962, 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, 330800, 396336, 396339, 339001, 388154, 388161, 347205, 248904, 330826, 248914, 412764, 339036, 257120, 265320, 248951, 420984, 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, 224897, 372353, 216707, 421508, 126596, 224904, 11918, 159374, 224913, 126610, 224916, 224919, 126616, 224922, 208538, 224926, 224929, 224932, 257704, 224936, 224942, 257712, 224947, 257716, 257720, 257724, 224959, 257732, 224965, 224969, 339662, 224975, 257747, 224981, 224986, 257761, 224993, 257764, 224999, 339695, 225012, 257787, 225020, 257790, 339710, 225025, 257794, 257801, 339721, 257804, 225038, 257807, 225043, 167700, 372499, 225048, 257819, 225053, 184094, 225058, 257833, 225066, 257836, 413484, 225070, 225073, 372532, 257845, 225079, 397112, 225082, 397115, 225087, 225092, 225096, 323402, 257868, 225103, 257871, 397139, 225108, 225112, 257883, 257886, 225119, 257890, 339814, 225127, 274280, 257896, 257901, 225137, 257908, 225141, 257912, 225148, 257916, 257920, 225155, 339844, 225165, 397200, 225170, 380822, 225175, 225180, 118691, 184244, 372664, 372702, 372706, 356335, 380918, 405533, 430129, 266294, 266297, 421960, 356439, 430180, 266350, 356466, 266362, 381068, 225423, 250002, 250004, 225429, 356506, 225437, 135327, 438433, 225441, 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, 397571, 389380, 61722, 356637, 356640, 356643, 356646, 266536, 356649, 356655, 332080, 340275, 356660, 397622, 332090, 225597, 332097, 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, 324111, 340500, 381481, 356907, 324142, 356916, 324149, 324155, 348733, 324164, 356934, 348743, 381512, 324173, 324176, 389723, 332380, 381545, 340627, 373398, 184982, 258721, 332453, 332459, 389805, 332463, 381617, 332471, 332483, 332486, 373449, 332493, 357069, 357073, 332511, 332520, 340718, 332533, 348924, 373510, 389926, 152370, 348978, 340789, 348982, 398139, 127814, 357201, 357206, 389978, 357211, 430939, 357214, 201579, 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, 341071, 349267, 250967, 210010, 341091, 210025, 210027, 210030, 210036, 210039, 349308, 349311, 160895, 152703, 210052, 349319, 210055, 218247, 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, 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, 259788, 358099, 153302, 333534, 366307, 366311, 431851, 366318, 210672, 366321, 366325, 210695, 268041, 210698, 366348, 210706, 399128, 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, 350206, 350213, 268298, 350224, 350231, 333850, 350237, 350240, 350244, 350248, 178218, 350251, 350256, 350259, 350271, 243781, 350285, 374864, 342111, 374902, 432271, 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, 350504, 358700, 350509, 391468, 358704, 358713, 358716, 383306, 334161, 383321, 383330, 383333, 391530, 383341, 334203, 268668, 194941, 391563, 366990, 416157, 268701, 342430, 375208, 375216, 334262, 334275, 326084, 358856, 334304, 334311, 375277, 334321, 350723, 186897, 334358, 342550, 342554, 334363, 358941, 350761, 252461, 334384, 358961, 383536, 334394, 252482, 219718, 334407, 350822, 375400, 334465, 334468, 162445, 326290, 342679, 342683, 260766, 342710, 244409, 260797, 260801, 350917, 391894, 154328, 416473, 64230, 342766, 375535, 203506, 342776, 391937, 391948, 375568, 326416, 375571, 375574, 162591, 326441, 383793, 326451, 375612, 260924, 244540, 326460, 326467, 244551, 326473, 326477, 416597, 326485, 326490, 342874, 326502, 375656, 433000, 326507, 326510, 211825, 211831, 351097, 392060, 359295, 351104, 342915, 236430, 342930, 252822, 392091, 400285, 252836, 359334, 211884, 400306, 351168, 359361, 359366, 326598, 359382, 359388, 383967, 343015, 359407, 261108, 244726, 261111, 383997, 261129, 359451, 261147, 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, 384269, 359694, 253200, 261393, 384275, 245020, 245029, 171302, 351534, 376110, 245040, 384314, 425276, 212291, 384323, 343365, 212303, 367965, 343393, 343398, 367980, 425328, 343409, 253303, 154999, 343417, 327034, 245127, 384397, 245136, 245142, 245145, 343450, 245148, 245151, 245154, 245157, 245162, 327084, 359865, 384443, 146876, 327107, 384453, 327110, 327115, 327117, 359886, 359890, 343507, 368092, 343534, 343539, 368119, 343544, 368122, 409091, 359947, 359955, 359983, 343630, 179802, 155239, 327275, 245357, 138864, 155254, 155273, 368288, 245409, 425638, 425649, 155322, 425662, 155327, 155351, 155354, 212699, 155363, 245475, 155371, 245483, 409335, 155393, 155403, 155422, 360223, 155438, 155442, 155447, 417595, 360261, 155461, 376663, 155482, 261981, 425822, 376671, 155487, 155490, 155491, 327531, 261996, 376685, 261999, 262002, 327539, 425845, 147317, 262005, 262008, 262011, 155516, 155521, 155525, 360326, 376714, 155531, 262027, 262030, 262033, 262036, 262039, 262042, 155549, 262045, 262048, 262051, 327589, 155559, 155562, 155565, 393150, 384977, 393169, 155611, 253923, 155619, 155621, 253926, 204784, 393203, 360438, 253943, 393206, 393212, 155646 ]
5481f957f6c07b292d01b75c92b88051d1dfc122
0b0da89c99a77cd6220db8b1992d5e5cd3d4afd4
/Sources/fs/Promise.swift
46ef3247bb700d9c58e4fed309b82d2af434b647
[ "Apache-2.0" ]
permissive
Macro-swift/Macro
1656bf2bbfd8c0f084b2e12c18d7b93e8547ee4f
b6dbc8ab1e1a737660ecdfaf19f57b463312c096
refs/heads/main
2023-07-06T03:05:27.399324
2023-04-16T15:10:26
2023-04-16T15:10:26
232,344,553
32
2
null
null
null
null
UTF-8
Swift
false
false
5,698
swift
// // Promise.swift // Macro // // Created by Helge Heß on 6/8/16. // Copyright © 2016-2020 ZeeZide GmbH. All rights reserved. // import struct NIO.EventLoopPromise import class NIO.EventLoopFuture import protocol NIO.EventLoop import class NIO.NIOThreadPool import enum NIO.ChannelError import class MacroCore.MacroCore import enum MacroCore.CharsetConversionError import struct MacroCore.Buffer import enum MacroCore.MacroError import struct Foundation.Data import struct Foundation.URL /** * Node also provides a Promise based fs API: * https://nodejs.org/dist/latest-v13.x/docs/api/fs.html#fs_fs_promises_api * * Those only really start to make sense w/ async/await, but since NIO is * promise based anyways ... */ public enum promise { } public extension promise { // TODO: Complete me :-) // Note: We dupe the imp, to avoid the extra promise overhead ¯\_(ツ)_/¯ static func readFile(on eventLoop : EventLoop? = nil, _ path : String) -> EventLoopFuture<Buffer> { let module = MacroCore.shared.retain() let eventLoop = module.fallbackEventLoop(eventLoop) let promise = eventLoop.makePromise(of: Buffer.self) FileSystemModule.threadPool.submit { shouldRun in defer { module.release() } guard case shouldRun = NIOThreadPool.WorkItemState.active else { return promise.fail(ChannelError.ioOnClosedChannel) } do { let data = try Data(contentsOf: URL(fileURLWithPath: path)) promise.succeed(Buffer(data)) } catch { promise.fail(error) } } return promise.futureResult } static func readFile(on eventLoop : EventLoop? = nil, _ path : String, _ encoding : String.Encoding) -> EventLoopFuture<String> { let module = MacroCore.shared.retain() let eventLoop = module.fallbackEventLoop(eventLoop) let promise = eventLoop.makePromise(of: String.self) FileSystemModule.threadPool.submit { shouldRun in defer { module.release() } guard case shouldRun = NIOThreadPool.WorkItemState.active else { return promise.fail(ChannelError.ioOnClosedChannel) } do { let data = try Data(contentsOf: URL(fileURLWithPath: path)) guard let s = String(bytes: data, encoding: encoding) else { promise.fail(CharsetConversionError .failedToConverData(encoding: encoding)) return } promise.succeed(s) } catch { promise.fail(error) } } return promise.futureResult } @inlinable static func readFile(on eventLoop : EventLoop? = nil, _ path : String, _ encoding : String) -> EventLoopFuture<String> { return readFile(on: eventLoop, path, .encodingWithName(encoding)) } @inlinable static func writeFile(on eventLoop : EventLoop? = nil, _ path: String, _ buffer: Buffer) -> EventLoopFuture<Void> { return writeFile(on: eventLoop, path, buffer.data) } @inlinable static func writeFile(on eventLoop : EventLoop? = nil, _ path : String, _ string : String, _ encoding : String.Encoding = .utf8) -> EventLoopFuture<Void> { guard let data = string.data(using: encoding) else { let eventLoop = MacroCore.shared.fallbackEventLoop(eventLoop) let promise = eventLoop.makePromise(of: Void.self) promise.fail(CharsetConversionError .failedToConverData(encoding: encoding)) return promise.futureResult } return writeFile(path, data) } @inlinable static func writeFile(on eventLoop : EventLoop? = nil, _ path : String, _ string : String, _ encoding : String) -> EventLoopFuture<Void> { return writeFile(on: eventLoop, path, string, .encodingWithName(encoding)) } @inlinable static func writeFile(on eventLoop : EventLoop? = nil, _ path : String, _ data : Data) -> EventLoopFuture<Void> { let module = MacroCore.shared.retain() let eventLoop = module.fallbackEventLoop(eventLoop) let promise = eventLoop.makePromise(of: Void.self) FileSystemModule.threadPool.submit { shouldRun in defer { module.release() } guard case shouldRun = NIOThreadPool.WorkItemState.active else { return promise.fail(ChannelError.ioOnClosedChannel) } do { try writeFileSync(path, data) promise.succeed( () ) } catch { promise.fail(error) } } return promise.futureResult } } public extension promise { @inlinable static func readdir(on eventLoop : EventLoop? = nil, _ path : String) -> EventLoopFuture<[ String ]> { let module = MacroCore.shared.retain() let eventLoop = module.fallbackEventLoop(eventLoop) let promise = eventLoop.makePromise(of: [ String ].self) FileSystemModule.threadPool.submit { shouldRun in defer { module.release() } guard case shouldRun = NIOThreadPool.WorkItemState.active else { return promise.fail(ChannelError.ioOnClosedChannel) } do { promise.succeed(try readdirSync(path)) } catch { promise.fail(error) } } return promise.futureResult } }
[ -1 ]