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
a3d2789c87efe8913f6d2b5bd86de428ab843c70
cdd1377f50e69a7c43aeda05ab4e1b3aeb5bf312
/Solutions/SolutionsTests/Easy/Easy_066_Plus_One_Test.swift
f7c674134b5543b72cf0fa72f482f94a5d4352da
[ "MIT" ]
permissive
DJBen/LeetCode-Solutions-in-Swift
ed5410b238c0133aa47b804445af3b596102c443
015c59cdd84efaf08b2529c3e30b5f9ea631c031
refs/heads/master
2021-01-20T01:50:27.894243
2015-12-11T07:07:08
2015-12-11T07:07:08
47,948,462
1
0
null
2015-12-14T02:51:27
2015-12-14T02:51:26
null
UTF-8
Swift
false
false
1,982
swift
// // Easy_066_Plus_One_Test.swift // Solutions // // Created by Di Wu on 7/16/15. // Copyright © 2015 diwu. All rights reserved. // import XCTest class Easy_066_Plus_One_Test: XCTestCase { private static let ProblemName: String = "Easy_066_Plus_One" private static let TimeOutName = ProblemName + Default_Timeout_Suffix private static let TimeOut = Default_Timeout_Value * 100 func test_001() { var input: [Int] = [1, 9, 9] let expected: [Int] = [2, 0, 0] asyncHelper(input: &input, expected: expected) } func test_002() { var input: [Int] = [0] let expected: [Int] = [1] asyncHelper(input: &input, expected: expected) } func test_003() { var input: [Int] = [9] let expected: [Int] = [1, 0] asyncHelper(input: &input, expected: expected) } func test_004() { var input: [Int] = [9, 9] let expected: [Int] = [1, 0, 0] asyncHelper(input: &input, expected: expected) } private func asyncHelper(inout input input: [Int], expected: [Int]) { weak var expectation: XCTestExpectation? = self.expectationWithDescription(Easy_066_Plus_One_Test.TimeOutName) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), { () -> Void in Easy_066_Plus_One.plusOne(&input) let result = input assertHelper(result == expected, problemName: Easy_066_Plus_One_Test.ProblemName, input: input, resultValue: result, expectedValue: expected) if let unwrapped = expectation { unwrapped.fulfill() } }) waitForExpectationsWithTimeout(Easy_066_Plus_One_Test.TimeOut) { (error: NSError?) -> Void in if error != nil { assertHelper(false, problemName: Easy_066_Plus_One_Test.ProblemName, input: input, resultValue: Easy_066_Plus_One_Test.TimeOutName, expectedValue: expected) } } } }
[ -1 ]
4fecd0650aecaea0572a55beaee8e65124e953ca
9a802512e781c48dd8b485f45ba1c19c75d60f54
/Clima/Model/WeatherModel.swift
0caf4886ab8e245af4e5e8fbf019208bf522ed78
[]
no_license
xxroninCabxx/clima
dbdb7c52009b46d9bbb0c7784e2eda9927314d3b
1601d3e40d69aa652df5a8edaec16bcfc3edcfc3
refs/heads/master
2020-09-21T18:41:35.811994
2019-11-29T21:29:47
2019-11-29T21:29:47
224,886,611
0
0
null
null
null
null
UTF-8
Swift
false
false
1,030
swift
// // WeatherModel.swift // Clima // // Created by Cory Billeaud on 11/28/19. // Copyright © 2019 App Brewery. All rights reserved. // import Foundation struct WeatherModel { let conditionId: Int let cityName: String let temperature: Double let maxTemp: Double let minTemp: Double let windSpeed: Double let windDeg: Int let clouds: Int let sunrise: Int let sunset: Int let humidty: Int let long: Double let lat: Double let time: Int func getConditionalName(weatherId: Int) -> String { switch weatherId { case 200...232: return "cloud.bolt" case 300...331: return "cloud.dizzle" case 500...531: return "cloud.rain" case 600...622: return "cloud.snow" case 700...781: return "cloud.fog" case 800: return "sun.max" case 801...804: return "cloud.bolt" default: return "cloud" } } }
[ -1 ]
9e9d37eed47942434ef065249fb65264ba81e469
79a4d62d2e7f0b275444dd1420ff3a4efd66281e
/EmptyDataView.swift
12712fb75608ba08247135de5b756726bb8e5ad8
[]
no_license
YQqiang/YQFuzzySearchView
227e54b2ac742c0df3cf9479834e4de5c60afb73
c4eb9b119ed0f637f127191107a1b672ee8afab9
refs/heads/master
2021-01-21T21:26:05.849004
2017-06-20T02:54:07
2017-06-20T02:54:07
94,841,582
0
0
null
null
null
null
UTF-8
Swift
false
false
2,652
swift
// // EmptyDataView.swift // operation4ios // // Created by sungrow on 2017/2/28. // Copyright © 2017年 阳光电源股份有限公司. All rights reserved. // import UIKit class EmptyDataView: UIView { var contentText: String = NSLocalizedString("暂无数据", comment: "") { didSet { contentTextLabel.text = contentText } } var contentImage: UIImage = #imageLiteral(resourceName: "placeholder_airbnb") { didSet { contentImageView.image = contentImage } } var clickAction: (() -> Void)? // MARK:- 控件 fileprivate lazy var contentImageView: UIImageView = UIImageView() fileprivate lazy var contentTextLabel: UILabel = UILabel() override init(frame: CGRect) { super.init(frame: frame) createUI() } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { if let clickAction = clickAction { clickAction() } } } // MARK:- private func extension EmptyDataView { // MARK:- UI fileprivate func createUI() { isHidden = true addSubview(contentImageView) addSubview(contentTextLabel) contentTextLabel.text = contentText contentTextLabel.textAlignment = .center contentTextLabel.textColor = UIColor.lightGray contentImageView.image = contentImage contentImageView.translatesAutoresizingMaskIntoConstraints = false contentTextLabel.translatesAutoresizingMaskIntoConstraints = false let contentImageViewCenterX = NSLayoutConstraint.init(item: contentImageView, attribute: .centerX, relatedBy: .equal, toItem: self, attribute: .centerX, multiplier: 1, constant: 0) let contentImageViewCenterY = NSLayoutConstraint.init(item: contentImageView, attribute: .centerY, relatedBy: .equal, toItem: self, attribute: .centerY, multiplier: 1, constant: -80) self.addConstraints([contentImageViewCenterX, contentImageViewCenterY]); let contentTextLabelTop = NSLayoutConstraint.init(item: contentTextLabel, attribute: .top, relatedBy: .equal, toItem: contentImageView, attribute: .bottom, multiplier: 1, constant: 16) let contentTextLabelViewCenterXs = NSLayoutConstraint.init(item: contentTextLabel, attribute: .centerX, relatedBy: .equal, toItem: contentImageView, attribute: .centerX, multiplier: 1, constant: 0) self.addConstraints([contentTextLabelTop, contentTextLabelViewCenterXs]); } }
[ -1 ]
e37ba094d4ca28d32b07d528b7da1db0f79a0fa8
a675b45ddbfca3535f790b85eceeeccb63d6fb27
/iOS Projects/Fun Projects/NumberMatchingGame/NumberMatchingGame/GameModel.swift
52c16a85ddc062bfc2cd999556f9f118f18bf6c3
[]
no_license
saranath-raju/saranath.raju.github.io
4a31da55ad6216c70b2b70a151edc66c7032d84e
1c69d8c0d4370ca15176ccf28228ffaab0e6a0c1
refs/heads/master
2016-09-05T12:54:10.791103
2015-07-13T19:58:53
2015-07-13T19:58:53
30,693,479
0
0
null
null
null
null
UTF-8
Swift
false
false
1,716
swift
// // GameModel.swift // NumberMatchingGame // // Created by Govindaraju, Saranath on 6/10/15. // Copyright (c) 2015 Saranath Govindaraju. All rights reserved. // import Foundation class GameModel{ private var gameDictionary = [Int : Int]() let N: Int = 16 private var valueAtPosition: [Int] = Array(count: 16, repeatedValue: -1) init(){ setUp() } private func setUp(){ var index: Int var randomNumbers: (key: Int, value: Int)? = nil for index in 0..<N/2 { randomNumbers = getRandomKeyValue(N) while randomNumbers == nil{ randomNumbers = getRandomKeyValue(N) } gameDictionary[randomNumbers!.key] = randomNumbers!.value } index = getRandomInteger(UInt32(100)) for (key, value) in gameDictionary{ valueAtPosition[key] = index valueAtPosition[value] = index index++ } println("\(valueAtPosition)") } func getTitle(index: Int) -> Int{ return valueAtPosition[index] } func getRandomInteger(n: UInt32) ->Int{ return Int(arc4random_uniform(n)) } private func getRandomKeyValue(n: Int) -> (Int,Int)?{ let key = getRandomInteger(UInt32(n)) let value = getRandomInteger(UInt32(n)) if (key != value) && !contains(gameDictionary.keys, key) && !contains(gameDictionary.keys, value) && !contains(gameDictionary.values, key) && !contains(gameDictionary.values, value) { return (key, value) } return nil } func reset(){ gameDictionary.removeAll(keepCapacity: false) setUp() } }
[ -1 ]
72a119d24a4f4271f3e4c1992dad8e91d6b21fa6
04ef30ec13f7eea232340644b552276d867c859a
/AlmofireTutorial/ViewController.swift
2f13d078b0ec89a3701fe3f9e1e9b0474d707e01
[]
no_license
raghavnaphade16/AlomoFireTutorial
0314085f734914d4744b59bd0d36fd1e1a95c000
5cc672bd5944e05b11d84a967dff302d317b90c6
refs/heads/main
2023-03-11T15:42:35.331010
2021-02-23T10:42:51
2021-02-23T10:42:51
341,517,701
0
0
null
null
null
null
UTF-8
Swift
false
false
2,695
swift
// // ViewController.swift // AlmofireTutorial // // Created by Omkar Choudhari on 20/2/21. // import UIKit class ViewController: UIViewController { @IBOutlet var textFirstName: UITextField! @IBOutlet var textLastName: UITextField! @IBOutlet var textEmail: UITextField! @IBOutlet var textPassword: UITextField! override func viewDidAppear(_ animated: Bool) { var runCount = 0 Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { timer in print("Timer fired!") runCount += 1 if runCount == 3 { timer.invalidate() // Create a reference to the the appropriate storyboard let storyboard = UIStoryboard(name: "LoginView", bundle: nil) // Instantiate the desired view controller from the storyboard using the view controllers identifier // Cast is as the custom view controller type you created in order to access it's properties and methods let customViewController = storyboard.instantiateViewController(withIdentifier: "LoginViewController") as! LoginViewController self.navigationController?.pushViewController(customViewController, animated: true) } } } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. // var runCount = 0 // Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { timer in // print("Timer fired!") // runCount += 1 // // if runCount == 3 { // timer.invalidate() // // Create a reference to the the appropriate storyboard // let storyboard = UIStoryboard(name: "LoginView", bundle: nil) // // Instantiate the desired view controller from the storyboard using the view controllers identifier // // Cast is as the custom view controller type you created in order to access it's properties and methods // let customViewController = storyboard.instantiateViewController(withIdentifier: "LoginViewController") as! LoginViewController // self.navigationController?.pushViewController(customViewController, animated: true) // // } // } } } //Navigation Code //let storyboard = UIStoryboard(name: "RegistrationView", bundle: nil) //let customViewController = storyboard.instantiateViewController(withIdentifier: "RegistrationViewController") as! RegistrationViewController //self.navigationController?.pushViewController(customViewController, animated: true)
[ -1 ]
e32faab7948e816a48ff583204cd88b29f4db0c6
7f72e794b6d75a82a6a5a9e3743479acac4ff532
/PlaygroundBasics.playground/Pages/Errors.xcplaygroundpage/Contents.swift
1c71cfef83ee99c28c3ddae0014177ff9a1a6ae9
[]
no_license
daolmo/PlaygroundBasics
f6bce720fb983483c16129dd35193d603223f1f4
d9c1095813da83593f0852b85ff63357a91637ad
refs/heads/master
2022-11-12T02:06:17.334170
2020-07-09T18:02:54
2020-07-09T18:02:54
278,435,782
0
0
null
null
null
null
UTF-8
Swift
false
false
1,047
swift
//: ## Errors //: When the playground finds an error in your code, it stops running it. //: This playground page, for example, has an error in it. //: //: 👈 Notice the red error symbol to the left of the line below. This is how a playground tells you where a problem is. 1000 / 203235 //: Since there is an error, the playground stops running your code.\ //: Notice that there are no results displayed in the sidebar. 👉 2 + 2 //: To get more information about an error, you can click the red error symbol. Go ahead, give it a click. //: //: When you click, the line of code is highlighted in red. A description of the error appears on the right.\ //: You can click again to hide the error message. //: //: In this case the error is “Division by zero”. You can’t divide by zero in math class, and a computer can’t divide by zero either. //: - experiment:\ //: Change the `0` to another number to fix the error. //: //: Next, read all about your very recent past. //: //:[Previous](@previous) | page 6 of 7 | [Next: Wrapup](@next)
[ 324405 ]
641e1887ed3a3cbe34097dc36c37b9ae94019867
db586d6e42072fff049593a526ac2f815c85ffdf
/AudioKit/Common/Internals/Testing/AKTester.swift
c89fc9df7484e62e6a08fbc80d585d114f240f8d
[ "MIT" ]
permissive
jonens/AudioKit
ba0bc55a40ca94506cf25bbdae4adcc32473adf5
b591fe165d465ac73583d70f005aad1c3dbf7dcb
refs/heads/master
2021-01-16T20:14:01.802981
2016-07-20T02:02:10
2016-07-20T02:02:10
50,321,121
0
0
null
2016-01-25T02:41:03
2016-01-25T02:41:03
null
UTF-8
Swift
false
false
2,309
swift
// // AKTester.swift // AudioKit // // Created by Aurelius Prochazka, revision history on Github. // Copyright (c) 2015 Aurelius Prochazka. All rights reserved. // import AVFoundation /// Testing node public class AKTester: AKNode, AKToggleable { // MARK: - Properties private var internalAU: AKTesterAudioUnit? private var token: AUParameterObserverToken? var totalSamples = 0 /// Calculate the MD5 public var MD5: String { return (self.internalAU?.getMD5())! } /// Flag on whether or not the test is still in progress public var isStarted: Bool { return Int((self.internalAU?.getSamples())!) < totalSamples } // MARK: - Initializers /// Initialize this test node /// /// - parameter input: AKNode to test /// - parameter sample: Number of sample to product /// public init(_ input: AKNode, samples: Int) { totalSamples = samples var description = AudioComponentDescription() description.componentType = kAudioUnitType_Effect description.componentSubType = 0x74737472 /*'tstr'*/ description.componentManufacturer = 0x41754b74 /*'AuKt'*/ description.componentFlags = 0 description.componentFlagsMask = 0 AUAudioUnit.registerSubclass( AKTesterAudioUnit.self, asComponentDescription: description, name: "Local AKTester", version: UInt32.max) super.init() AVAudioUnit.instantiateWithComponentDescription(description, options: []) { avAudioUnit, error in guard let avAudioUnitEffect = avAudioUnit else { return } self.avAudioNode = avAudioUnitEffect self.internalAU = avAudioUnitEffect.AUAudioUnit as? AKTesterAudioUnit AKManager.sharedInstance.engine.attachNode(self.avAudioNode) input.addConnectionPoint(self) self.internalAU?.setSamples(Int32(samples)) } } /// Function to start, play, or activate the node, all do the same thing public func start() { self.internalAU!.start() } /// Function to stop or bypass the node, both are equivalent public func stop() { self.internalAU!.stop() } }
[ -1 ]
7fa424e1e30a2937a599d48880655e439c10879e
5d089fa37df8b726140cf85d8cf2736a81cb78d1
/Quik Movies/Model/Movies/MoviesList.swift
4d4fc35f6f6008423fc6c60c8225da34d0ea4208
[]
no_license
georrgee/Quik-Movies
6977e474c83bace10a11f1ed351e1cdb73d07e9f
73602bb2d9365cf00a5e666f4b5169e9a00e1e9b
refs/heads/master
2020-05-23T20:34:49.688283
2019-05-23T16:04:22
2019-05-23T16:04:22
186,934,725
0
0
null
null
null
null
UTF-8
Swift
false
false
518
swift
// // MoviesList.swift // Quik Movies // // Created by George Garcia on 5/1/19. // Copyright © 2019 GeeTeam. All rights reserved. // import Foundation struct MoviesList: Decodable { var results: [Movie] // array of movies func initWithData(data: Data) -> MoviesList? { do { return try JSONDecoder().decode(MoviesList.self, from: data) } catch let error { print(error.localizedDescription) return nil } } }
[ -1 ]
8249385d952c722050b464d46d3a430c9b3de931
8c1ddad78eef92f30dbf66c07d730e334e1e7555
/AIAHack-iOS-App/AIAHack-Test/HomeViewController.swift
cefc7c9bc1ba5d906bf6ac97e9f65a404df296eb
[]
no_license
hkpeterpeter/aialifehack18-team17
fa5a447e4b05768165e2cc7ae715592848de2b63
5932bfec24ed8e736558fd71af3e75bf4a2b0f4f
refs/heads/master
2020-04-07T01:22:16.259152
2018-11-18T06:48:45
2018-11-18T06:48:45
157,939,538
0
1
null
null
null
null
UTF-8
Swift
false
false
2,847
swift
// // HomeViewController.swift // AIAHack-Test // // Created by Tim Ng on 11/17/18. // Copyright © 2018 Tim Ng. All rights reserved. // import UIKit import Cards let cellId = "challengeCell" let cardGlobalX: CGFloat = 60 let feelY: CGFloat = 30 let feelTitle = "Feel the Air" let feelItemTitle = "200 waves left" let feelItemImageName = "feel-card" let meditateY: CGFloat = 425 let meditateTitle = "Think Blue" let meditateItemTitle = "Achieved!" let meditateImageName = "meditate-card" class HomeViewController: UICollectionViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. setUpVC() addCard(x: cardGlobalX, y: feelY, cardTitle: feelTitle, cardItemTitle: feelItemTitle, cardImageName: feelItemImageName, cardVC: FeelDetailVC()) addCard(x: cardGlobalX, y: meditateY, cardTitle: meditateTitle, cardItemTitle: meditateItemTitle, cardImageName: meditateImageName, cardVC: MeditateDetailVC()) } // Helpers fileprivate func setUpVC() { collectionView.backgroundColor = UIColor.white collectionView.isScrollEnabled = true let titleLabel: UILabel = { let label = UILabel() label.text = "hey" return label }() let subtitleLabel: UILabel = { let label = UILabel() label.text = "Subtitle Text" label.textColor = UIColor.blue return label }() let titleView: UIView = { let view = UIView() view.backgroundColor = UIColor.blue let widthDiff = subtitleLabel.frame.size.width - titleLabel.frame.size.width if widthDiff < 0 { let newX = widthDiff / 2 subtitleLabel.frame.origin.x = abs(newX) } else { let newX = widthDiff / 2 titleLabel.frame.origin.x = newX } view.addSubview(titleLabel) view.addSubview(subtitleLabel) return view }() let dateFormatter: DateFormatter = { let formatter = DateFormatter() formatter.dateStyle = .full formatter.timeStyle = .none return formatter }() let todayDate = dateFormatter.string(from: Date()).uppercased() self.navigationItem.titleView = setTitle(title: "Tim's Family", subtitle: todayDate) navigationController?.navigationBar.prefersLargeTitles = true collectionView?.register(ChallengeCell.self, forCellWithReuseIdentifier: cellId) } }
[ -1 ]
8fa88bca1317e24477abcbb200eb1dcc44401066
aa804a2f04053de09a74b46aed98e9e7badc8d2c
/FinalApp/totalWorkInsuranceViewController.swift
9a53575e966d82769eb6f04e665d02ed5d41407b
[]
no_license
cym3509/ClockMan
3a0307e132772c86cfd80a7cbd529bae231e8723
2c20007d6eb1a3b2575be9929ed7d1fc9b24f6e9
refs/heads/master
2021-04-15T07:57:04.333048
2020-04-26T07:36:24
2020-04-26T07:36:24
126,585,024
0
0
null
null
null
null
UTF-8
Swift
false
false
5,855
swift
// // totalWorkInsuranceViewController.swift // FinalApp // // Created by ORLA on 2017/12/10. // Copyright © 2017年 Orla. All rights reserved. // import UIKit import Firebase class totalWorkInsuranceViewController: UIViewController,UITableViewDelegate, UITableViewDataSource { @IBOutlet weak var menuButton: UIBarButtonItem! var ref: DatabaseReference! var shows = [healthWorkInsurance]() @IBOutlet weak var year: UILabel! @IBOutlet weak var month: UILabel! @IBOutlet weak var tableView: UITableView! var viaYear = "" var viaMonth = "" var workSum = 0.0 var retireSum = 0.0 @IBOutlet weak var workLabel: UILabel! @IBOutlet weak var retireLabel: UILabel! override func viewDidLoad() { super.viewDidLoad() if self.revealViewController() != nil{ menuButton.target = self.revealViewController() menuButton.action = #selector(SWRevealViewController.revealToggle(_:)) self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer()) } ref = Database.database().reference() year.text = viaYear month.text = viaMonth loadShow() tableView.delegate = self tableView.dataSource = self // Do any additional setup after loading the view. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } func loadShow(){ let currentUser = Auth.auth().currentUser?.uid ref.child("Members").child(currentUser!).observeSingleEvent(of: .value, with: {(snapshot) in if let dataDict = snapshot.value as? [String: AnyObject]{ let value = snapshot.value as? NSDictionary let companyNum = value?["companyNum"] as? String self.ref.child("Members").observe(.childAdded, with: {(snapshot) in if let dic2 = snapshot.value as? [String: AnyObject]{ let uid2 = dic2["uid"] as? String let company = dic2["companyNum"] as? String let role = dic2["role"] as? String self.ref.child("Salary").child(uid2!).child(self.viaYear).observe(.childAdded, with: {(snapshot) in if let dic = snapshot.value as? [String: AnyObject]{ let name = dic["name"] as? String let month = dic["month"] as? String let totalSalary = dic["totalSalary"] as? String let uid = dic["uid"] as? String let year = dic["year"] as? String let work = dic["bossWork"] as? String let health = dic["bossHealth"] as? String let retire = dic["bossRetire"] as? String if year == self.viaYear && month == self.viaMonth{ let w = Double(work!) self.workSum += w! let r = Double(retire!) self.retireSum += r! let show = healthWorkInsurance(nameText: name, totalsalaryText: totalSalary, healthText: health, workText: work, retireText: retire) // print(name) // print(totalSalary) self.shows.append(show) self.tableView.reloadData() } self.workLabel.text = "\(Int(self.workSum))" self.retireLabel.text = "\(Int(self.retireSum))" } }) } }) } }) } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return shows.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = self.tableView.dequeueReusableCell(withIdentifier: "workCell", for: indexPath) as! workCell cell.name.text = shows[indexPath.row].name cell.totalSalary.text = shows[indexPath.row].totalSalary cell.workInsurance.text = shows[indexPath.row].work cell.retire.text = shows[indexPath.row].retire return(cell) } @IBAction func searchHealthBtn(_ sender: Any) { let Storyboard = UIStoryboard(name: "Main", bundle: nil) let dest = Storyboard.instantiateViewController(withIdentifier: "totalHealthInsuranceViewController") as! totalHealthInsuranceViewController dest.viaYear = viaYear dest.viaMonth = viaMonth self.navigationController?.pushViewController(dest, animated: true) } }
[ -1 ]
1c7a3b278d3cfa6d7eb3f686b6a472423512066c
1d14d250cb797ecfeb1c196969bb7f9fb31d7075
/CALayerSample/AppDelegate.swift
00871901661b835750b04b03dfc6f948b7da6b0d
[]
no_license
zedzhao/CALayerSample
7529ecb878519be044c05934b54c5b50bb22ce9c
31318adf72735576d73cee4c1ff4716695c61dd5
refs/heads/master
2020-04-03T09:56:33.864153
2016-07-22T02:11:16
2016-07-22T02:11:16
63,700,598
0
0
null
null
null
null
UTF-8
Swift
false
false
6,096
swift
// // AppDelegate.swift // CALayerSample // // Created by Kun on 16/7/11. // Copyright © 2016年 Kun. All rights reserved. // import UIKit import CoreData @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } func applicationDidEnterBackground(application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. // Saves changes in the application's managed object context before the application terminates. self.saveContext() } // MARK: - Core Data stack lazy var applicationDocumentsDirectory: NSURL = { // The directory the application uses to store the Core Data store file. This code uses a directory named "com.kk.hundsun.CALayerSample" in the application's documents Application Support directory. let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask) return urls[urls.count-1] }() lazy var managedObjectModel: NSManagedObjectModel = { // The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model. let modelURL = NSBundle.mainBundle().URLForResource("CALayerSample", withExtension: "momd")! return NSManagedObjectModel(contentsOfURL: modelURL)! }() lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator = { // The persistent store coordinator for the application. This implementation creates and returns a coordinator, having added the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail. // Create the coordinator and store let coordinator = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel) let url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("SingleViewCoreData.sqlite") var failureReason = "There was an error creating or loading the application's saved data." do { try coordinator.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: nil) } catch { // Report any error we got. var dict = [String: AnyObject]() dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data" dict[NSLocalizedFailureReasonErrorKey] = failureReason dict[NSUnderlyingErrorKey] = error as NSError let wrappedError = NSError(domain: "YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict) // Replace this with code to handle the error appropriately. // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. NSLog("Unresolved error \(wrappedError), \(wrappedError.userInfo)") abort() } return coordinator }() lazy var managedObjectContext: NSManagedObjectContext = { // Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) This property is optional since there are legitimate error conditions that could cause the creation of the context to fail. let coordinator = self.persistentStoreCoordinator var managedObjectContext = NSManagedObjectContext(concurrencyType: .MainQueueConcurrencyType) managedObjectContext.persistentStoreCoordinator = coordinator return managedObjectContext }() // MARK: - Core Data Saving support func saveContext () { if managedObjectContext.hasChanges { do { try managedObjectContext.save() } catch { // Replace this implementation with code to handle the error appropriately. // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. let nserror = error as NSError NSLog("Unresolved error \(nserror), \(nserror.userInfo)") abort() } } } }
[ 283144, 277514, 277003, 280085, 278551, 278042, 276510, 281635, 194085, 277030, 228396, 277038, 223280, 278577, 280132, 162394, 282203, 189025, 292450, 285796, 279148, 278125, 285296, 227455, 278656, 228481, 276611, 278665, 280205, 225934, 278674, 188050, 276629, 283803, 278687, 282274, 277154, 278692, 228009, 287402, 227499, 278700, 284845, 278705, 276149, 278711, 279223, 278718, 283838, 228544, 279753, 229068, 227533, 280273, 278751, 201439, 226031, 159477, 280312, 279304, 203532, 181516, 277262, 280335, 321296, 284432, 278289, 278801, 284434, 276751, 278287, 276755, 278808, 278297, 282910, 282915, 281379, 280370, 277306, 278844, 280382, 282433, 237382, 164166, 226634, 276313, 278877, 280415, 277344, 276321, 227687, 334185, 279405, 278896, 277363, 281972, 275828, 278902, 280439, 276347, 228220, 279422, 278916, 284557, 293773, 191374, 288147, 283028, 277395, 214934, 278943, 282016, 230320, 283058, 281011, 286130, 230322, 278971, 276923, 282558, 299970, 280007, 288200, 284617, 287689, 286157, 326096, 281041, 283091, 282585, 294390, 282616, 214010 ]
894f47c1f3df16dcab4a1211980acdfe150ce505
e4d0ce1b0fc5047d940ae5e7a09a82167e8f7836
/TOKEI-R4/AppDelegate.swift
506eff9366d17ec4006948611129ae449261dab2
[]
no_license
goemon12/TOKEI-R4
c41e9c94ebfe545d7769501ea896ccaac08310d6
40e490de45ca4eaf1ae9765fb4fe84ee53aac2ff
refs/heads/master
2020-04-08T21:11:45.252320
2019-01-13T12:35:05
2019-01-13T12:35:05
159,733,875
0
0
null
null
null
null
UTF-8
Swift
false
false
2,170
swift
// // AppDelegate.swift // TOKEI-R4 // // Created by goemon12 on 2018/11/29. // Copyright © 2018 goemon12. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } 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, 360496, 229426, 237618, 229428, 311349, 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, 131264, 286916, 295110, 286922, 286924, 286926, 319694, 286928, 131281, 278743, 278747, 295133, 155872, 319716, 237807, 303345, 286962, 303347, 131314, 229622, 327930, 278781, 278783, 278785, 237826, 319751, 278792, 286987, 319757, 311569, 286999, 319770, 287003, 287006, 287009, 287012, 287014, 287016, 287019, 311598, 287023, 262448, 311601, 295220, 287032, 155966, 319809, 319810, 278849, 319814, 311623, 319818, 311628, 229709, 319822, 287054, 278865, 229717, 196963, 196969, 139638, 213367, 106872, 319872, 311683, 319879, 311693, 65943, 319898, 311719, 278952, 139689, 278957, 311728, 278967, 180668, 311741, 278975, 319938, 278980, 98756, 278983, 319945, 278986, 319947, 278990, 278994, 311767, 279003, 279006, 188895, 172512, 287202, 279010, 279015, 172520, 319978, 279020, 172526, 311791, 279023, 172529, 279027, 319989, 172534, 180727, 164343, 279035, 311804, 287230, 279040, 303617, 287234, 279045, 172550, 303623, 172552, 320007, 287238, 279051, 172558, 279055, 303632, 279058, 303637, 279063, 279067, 172572, 279072, 172577, 295459, 172581, 295461, 279082, 311850, 279084, 172591, 172598, 279095, 172607, 172609, 172612, 377413, 172614, 213575, 172618, 303690, 33357, 287309, 303696, 279124, 172634, 262752, 254563, 172644, 311911, 189034, 295533, 172655, 172656, 352880, 295538, 189039, 172660, 287349, 189040, 189044, 287355, 287360, 295553, 172675, 295557, 311942, 303751, 287365, 352905, 311946, 279178, 287371, 311951, 287377, 172691, 287381, 311957, 221850, 287386, 230045, 172702, 287390, 303773, 172705, 287394, 172707, 303780, 164509, 287398, 205479, 279208, 287400, 172714, 295595, 279212, 189102, 172721, 287409, 66227, 303797, 189114, 287419, 303804, 328381, 287423, 328384, 172737, 279231, 287427, 312005, 312006, 107208, 172748, 287436, 107212, 172751, 287440, 295633, 172755, 303827, 279255, 172760, 287450, 303835, 279258, 189149, 303838, 213724, 312035, 279267, 295654, 279272, 230128, 312048, 312050, 230131, 189169, 205564, 303871, 230146, 328453, 295685, 230154, 33548, 312077, 295695, 295701, 230169, 369433, 295707, 328476, 295710, 230175, 295720, 303914, 279340, 205613, 279353, 230202, 312124, 328508, 222018, 295755, 377676, 148302, 287569, 303959, 230237, 279390, 230241, 279394, 303976, 336744, 303981, 303985, 303987, 328563, 279413, 303991, 303997, 295806, 295808, 295813, 304005, 320391, 304007, 213895, 304009, 304011, 230284, 304013, 295822, 279438, 213902, 189329, 295825, 304019, 189331, 58262, 304023, 304027, 279452, 410526, 279461, 279462, 304042, 213931, 230327, 304055, 287675, 197564, 230334, 304063, 238528, 304065, 213954, 189378, 156612, 295873, 213963, 197580, 312272, 304084, 304090, 320481, 304106, 320490, 312302, 328687, 320496, 304114, 295928, 320505, 312321, 295945, 230413, 295949, 197645, 320528, 140312, 295961, 238620, 197663, 304164, 304170, 304175, 238641, 312374, 238652, 238655, 230465, 238658, 336964, 132165, 296004, 205895, 320584, 238666, 296021, 402518, 336987, 230497, 296036, 296040, 361576, 205931, 296044, 279661, 205934, 164973, 312432, 279669, 337018, 189562, 279679, 304258, 279683, 222340, 66690, 205968, 296084, 238745, 304285, 238756, 205991, 222377, 165035, 337067, 238766, 165038, 230576, 238770, 304311, 230592, 312518, 279750, 230600, 230607, 148690, 320727, 279769, 304348, 279777, 304354, 296163, 320740, 279781, 304360, 320748, 279788, 279790, 304370, 296189, 320771, 312585, 296202, 296205, 230674, 320786, 230677, 296213, 296215, 320792, 230681, 214294, 304416, 230689, 173350, 312622, 296243, 312630, 222522, 296253, 222525, 296255, 312639, 230718, 296259, 378181, 296262, 230727, 238919, 296264, 320840, 296267, 296271, 222545, 230739, 312663, 222556, 337244, 230752, 312676, 230760, 173418, 148843, 410987, 230763, 230768, 296305, 312692, 230773, 304505, 304506, 181626, 279929, 181631, 148865, 312711, 312712, 296331, 288140, 288144, 230800, 304533, 337306, 288154, 288160, 173472, 288162, 288164, 279975, 304555, 370092, 279983, 173488, 288176, 279985, 312755, 296373, 312759, 337335, 288185, 279991, 222652, 312766, 173507, 296389, 222665, 230860, 312783, 288208, 230865, 288210, 370130, 288212, 222676, 288214, 280021, 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, 214535, 230923, 304651, 304653, 370187, 230940, 222752, 108066, 296486, 296488, 157229, 239152, 230961, 157236, 288320, 288325, 124489, 280140, 280145, 288338, 280149, 288344, 280152, 239194, 280158, 403039, 370272, 181854, 239202, 312938, 280183, 280185, 280188, 280191, 116354, 280194, 280208, 280211, 288408, 280218, 280222, 419489, 190118, 198310, 321195, 296622, 321200, 337585, 296626, 296634, 296637, 419522, 313027, 280260, 419525, 206536, 280264, 206539, 206541, 206543, 263888, 313044, 280276, 321239, 280283, 313052, 18140, 288478, 313055, 419555, 321252, 313066, 288494, 280302, 280304, 313073, 321266, 419570, 288499, 288502, 280314, 288510, 124671, 67330, 280324, 198405, 288519, 280331, 198416, 280337, 296723, 116503, 321304, 329498, 296731, 321311, 313121, 313123, 304932, 321316, 280363, 141101, 165678, 280375, 321336, 296767, 288576, 345921, 280388, 337732, 304968, 280393, 280402, 173907, 313171, 313176, 42842, 280419, 321381, 296809, 296812, 313201, 1920, 255873, 305028, 280454, 247688, 280464, 124817, 280468, 239510, 280473, 124827, 214940, 247709, 214944, 280487, 313258, 321458, 296883, 124853, 214966, 296890, 10170, 288700, 296894, 190403, 296900, 280515, 337862, 165831, 280521, 231379, 296921, 354265, 354270, 239586, 313320, 354281, 231404, 124913, 165876, 321528, 239612, 313340, 288764, 239617, 313347, 288773, 313358, 305176, 321560, 313371, 354338, 305191, 223273, 313386, 354348, 124978, 215090, 124980, 288824, 288826, 321595, 378941, 313406, 288831, 288836, 67654, 280651, 354382, 288848, 280658, 215123, 354390, 288855, 288859, 280669, 313438, 149599, 280671, 149601, 321634, 149603, 223327, 329830, 280681, 313451, 223341, 280687, 149618, 215154, 313458, 280691, 313464, 329850, 321659, 280702, 288895, 321670, 215175, 141446, 288909, 141455, 141459, 280725, 313498, 100520, 288936, 280747, 288940, 288947, 280755, 321717, 280759, 280764, 280769, 280771, 280774, 280776, 313548, 321740, 280783, 280786, 280788, 313557, 280793, 280796, 280798, 338147, 280804, 280807, 157930, 280811, 280817, 125171, 157940, 280819, 182517, 280823, 280825, 280827, 280830, 280831, 280833, 125187, 280835, 125191, 125207, 125209, 321817, 125218, 321842, 223539, 125239, 280888, 305464, 280891, 289087, 280897, 280900, 305480, 239944, 280906, 239947, 305485, 305489, 379218, 280919, 248153, 354653, 313700, 313705, 280937, 190832, 280946, 223606, 313720, 280956, 239997, 280959, 313731, 199051, 240011, 289166, 240017, 297363, 190868, 240021, 297365, 297368, 297372, 141725, 297377, 289186, 297391, 289201, 240052, 289207, 289210, 305594, 281024, 289218, 289221, 289227, 281045, 281047, 215526, 166378, 305647, 281075, 174580, 240124, 281084, 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, 281163, 281179, 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, 199364, 297671, 158409, 256716, 289493, 363234, 289513, 289522, 289525, 289532, 322303, 289537, 322310, 264969, 322314, 322318, 281361, 281372, 322341, 215850, 281388, 289593, 281401, 289601, 281410, 281413, 281414, 240458, 281420, 240468, 281430, 322393, 297818, 281435, 281438, 281442, 174955, 224110, 207733, 207737, 158596, 183172, 338823, 322440, 314249, 240519, 183184, 142226, 289687, 240535, 297883, 289694, 289696, 289700, 289712, 281529, 289724, 52163, 183260, 281567, 289762, 322534, 297961, 183277, 281581, 322550, 134142, 322563, 314372, 330764, 175134, 322599, 322610, 314421, 281654, 314427, 314433, 207937, 314441, 207949, 322642, 314456, 281691, 314461, 281702, 281704, 314474, 281708, 281711, 289912, 248995, 306341, 306344, 306347, 322734, 306354, 142531, 199877, 289991, 306377, 289997, 249045, 363742, 363745, 298216, 330988, 126190, 216303, 322801, 388350, 257302, 363802, 199976, 199978, 314671, 298292, 298294, 257334, 216376, 380226, 298306, 224584, 224587, 224594, 216404, 306517, 150870, 314714, 224603, 159068, 314718, 265568, 314723, 281960, 150890, 306539, 314732, 314736, 290161, 216436, 306549, 298358, 314743, 306552, 290171, 314747, 306555, 298365, 290174, 224641, 281987, 298372, 314756, 281990, 224647, 265604, 298377, 314763, 142733, 298381, 314768, 224657, 306581, 314773, 314779, 314785, 314793, 282025, 282027, 241068, 241070, 241072, 282034, 241077, 150966, 298424, 306618, 282044, 323015, 306635, 306640, 290263, 290270, 290275, 339431, 282089, 191985, 282098, 290291, 282101, 241142, 191992, 290298, 151036, 290302, 282111, 290305, 175621, 306694, 192008, 323084, 257550, 282127, 290321, 282130, 323090, 290325, 282133, 241175, 290328, 282137, 290332, 241181, 282142, 282144, 290344, 306731, 290349, 290351, 290356, 28219, 282186, 224849, 282195, 282199, 282201, 306778, 159324, 159330, 314979, 298598, 323176, 224875, 241260, 323181, 257658, 315016, 282249, 290445, 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, 148946, 315211, 282446, 307027, 315221, 323414, 315223, 241496, 241498, 307035, 307040, 110433, 282465, 241509, 110438, 298860, 110445, 282478, 315249, 110450, 315251, 282481, 315253, 315255, 339838, 315267, 282499, 315269, 241544, 282505, 241546, 241548, 298896, 298898, 282514, 241556, 298901, 44948, 241560, 282520, 241563, 241565, 241567, 241569, 282531, 241574, 282537, 298922, 36779, 241581, 282542, 241583, 323504, 241586, 282547, 241588, 290739, 241590, 241592, 241598, 290751, 241600, 241605, 151495, 241610, 298975, 241632, 298984, 241640, 241643, 298988, 241646, 241649, 241652, 323574, 290807, 299003, 241661, 299006, 282623, 315396, 241669, 315397, 282632, 307211, 282639, 290835, 282645, 241693, 282654, 241701, 102438, 217127, 282669, 323630, 282681, 290877, 282687, 159811, 315463, 315466, 192589, 307278, 192596, 176213, 307287, 307290, 217179, 315482, 192605, 315483, 233567, 299105, 200801, 217188, 299109, 307303, 315495, 356457, 45163, 307307, 315502, 192624, 307314, 323700, 299126, 233591, 299136, 307329, 315524, 307338, 233613, 241813, 307352, 299164, 241821, 299167, 315552, 184479, 184481, 315557, 184486, 307370, 307372, 184492, 307374, 307376, 299185, 323763, 184503, 176311, 299191, 307386, 258235, 307388, 307385, 307390, 176316, 299200, 184512, 307394, 299204, 307396, 184518, 307399, 323784, 233679, 307409, 307411, 176343, 299225, 233701, 307432, 184572, 282881, 184579, 282893, 323854, 291089, 282906, 291104, 233766, 295583, 176435, 307508, 315701, 332086, 307510, 307512, 168245, 307515, 307518, 282942, 282947, 323917, 110926, 282957, 233808, 323921, 315733, 323926, 233815, 276052, 315739, 323932, 299357, 242018, 242024, 299373, 315757, 250231, 242043, 315771, 299388, 299391, 291202, 299398, 242057, 291212, 299405, 291222, 315801, 283033, 242075, 291226, 194654, 61855, 291231, 283042, 291238, 291241, 127403, 127405, 291247, 299440, 127407, 299444, 127413, 283062, 291254, 127417, 291260, 283069, 127421, 127424, 299457, 127429, 127431, 127434, 315856, 176592, 315860, 176597, 127447, 283095, 299481, 176605, 242143, 127457, 291299, 340454, 127463, 242152, 291305, 127466, 176620, 127469, 127474, 291314, 291317, 127480, 135672, 291323, 233979, 127485, 291330, 127490, 283142, 127494, 127497, 233994, 135689, 127500, 291341, 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, 225948, 135839, 299680, 225954, 299684, 135844, 242343, 209576, 242345, 373421, 135870, 135873, 135876, 135879, 299720, 299723, 299726, 225998, 226002, 119509, 226005, 226008, 299740, 242396, 201444, 299750, 283368, 234219, 283372, 226037, 283382, 316151, 234231, 234236, 226045, 242431, 234239, 209665, 234242, 299778, 242436, 226053, 234246, 226056, 234248, 291593, 242443, 234252, 242445, 234254, 291601, 234258, 242450, 242452, 234261, 348950, 201496, 234264, 234266, 234269, 283421, 234272, 234274, 152355, 299814, 234278, 283432, 234281, 234284, 234287, 283440, 185138, 242483, 234292, 234296, 234298, 160572, 283452, 234302, 234307, 242499, 234309, 316233, 234313, 316235, 234316, 283468, 234319, 242511, 234321, 234324, 185173, 201557, 234329, 234333, 308063, 234336, 242530, 349027, 234338, 234341, 234344, 234347, 177004, 234350, 324464, 234353, 152435, 177011, 234356, 234358, 234362, 226171, 234364, 291711, 234368, 291714, 234370, 291716, 234373, 316294, 201603, 226182, 308105, 234375, 226185, 234379, 324490, 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, 226230, 324536, 275384, 234428, 291773, 242623, 324544, 234431, 234434, 324546, 324548, 234437, 226245, 234439, 226239, 234443, 291788, 234446, 275406, 193486, 234449, 316370, 193488, 234452, 234455, 234459, 234461, 234464, 234467, 234470, 168935, 5096, 324585, 234475, 234478, 316400, 234481, 316403, 234484, 234485, 234487, 324599, 234490, 234493, 316416, 234496, 308226, 234501, 275462, 308231, 234504, 234507, 234510, 234515, 300054, 316439, 234520, 234519, 234523, 234526, 234528, 300066, 234532, 300069, 234535, 234537, 234540, 144430, 234543, 234546, 275508, 300085, 234549, 300088, 234553, 234556, 234558, 316479, 234561, 316483, 160835, 234563, 308291, 234568, 234570, 316491, 234572, 300108, 234574, 300115, 234580, 234581, 242777, 234585, 275545, 234590, 234593, 234595, 234597, 300133, 234601, 300139, 234605, 160879, 234607, 275569, 234610, 316530, 300148, 234614, 398455, 144506, 234618, 234620, 275579, 234623, 226433, 234627, 275588, 234629, 242822, 234634, 234636, 177293, 234640, 275602, 234643, 308373, 226453, 234647, 275606, 275608, 234650, 308379, 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, 234726, 300263, 300265, 300267, 161003, 300270, 300272, 120053, 300278, 275703, 316663, 300284, 275710, 300287, 292097, 300289, 161027, 300292, 300294, 275719, 234760, 177419, 300299, 242957, 300301, 283917, 177424, 275725, 349451, 349464, 415009, 283939, 259367, 292143, 283951, 300344, 226617, 243003, 283963, 226628, 300357, 283973, 177482, 283983, 316758, 357722, 316766, 316768, 292192, 218464, 292197, 316774, 243046, 218473, 284010, 136562, 324978, 275834, 333178, 275836, 275840, 316803, 316806, 226696, 316811, 226699, 316814, 226703, 300433, 234899, 300436, 226709, 357783, 316824, 316826, 144796, 300448, 144807, 144810, 144812, 284076, 144814, 227426, 144820, 374196, 284084, 292279, 284087, 144826, 144828, 144830, 144832, 144835, 144837, 38342, 144839, 144841, 144844, 144847, 144852, 144855, 103899, 300507, 333280, 226787, 218597, 292329, 300523, 259565, 300527, 308720, 259567, 292338, 226802, 316917, 292343, 308727, 300537, 316933, 316947, 308757, 308762, 284191, 316959, 284194, 284196, 235045, 284199, 284204, 284206, 284209, 284211, 194101, 284213, 316983, 194103, 284215, 308790, 284218, 226877, 292414, 284223, 284226, 284228, 292421, 226886, 284231, 128584, 243268, 284234, 366155, 317004, 276043, 284238, 226895, 284241, 194130, 284243, 300628, 284245, 292433, 284247, 317015, 235097, 243290, 276053, 284249, 284251, 300638, 284253, 284255, 243293, 284258, 292452, 292454, 284263, 177766, 284265, 292458, 284267, 292461, 284272, 284274, 284278, 292470, 276086, 292473, 284283, 276093, 284286, 276095, 284288, 292481, 284290, 325250, 284292, 292485, 292479, 276098, 284297, 317066, 284299, 317068, 284301, 276109, 284303, 284306, 276114, 284308, 284312, 284314, 284316, 276127, 284320, 284322, 284327, 284329, 317098, 284331, 276137, 284333, 284335, 276144, 284337, 284339, 300726, 284343, 284346, 284350, 358080, 276160, 284354, 358083, 284358, 276166, 358089, 284362, 276170, 284365, 276175, 284368, 276177, 284370, 358098, 284372, 317138, 284377, 276187, 284379, 284381, 284384, 358114, 284386, 358116, 276197, 317158, 358119, 284392, 325353, 358122, 284394, 284397, 358126, 284399, 358128, 276206, 358133, 358135, 276216, 358138, 300795, 358140, 284413, 358142, 358146, 317187, 284418, 317189, 317191, 284428, 300816, 300819, 317207, 284440, 300828, 300830, 276255, 300832, 325408, 300834, 317221, 227109, 358183, 186151, 276268, 300845, 243504, 300850, 284469, 276280, 325436, 358206, 276291, 366406, 276295, 300872, 292681, 153417, 358224, 284499, 276308, 178006, 317271, 284502, 276315, 292700, 317279, 284511, 227175, 292715, 300912, 292721, 284529, 300915, 284533, 292729, 317306, 284540, 292734, 325512, 169868, 276365, 317332, 358292, 284564, 284566, 399252, 350106, 284572, 276386, 284579, 276388, 358312, 317353, 284585, 276395, 292776, 292784, 276402, 358326, 161718, 358330, 276410, 276411, 276418, 276425, 301009, 301011, 301013, 292823, 358360, 301017, 301015, 292828, 276446, 153568, 276448, 276452, 292839, 276455, 292843, 276460, 292845, 276464, 178161, 227314, 276466, 325624, 276472, 317435, 276476, 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, 227440, 350328, 292985, 301178, 350332, 292989, 301185, 292993, 350339, 317570, 317573, 350342, 350345, 350349, 301199, 317584, 325777, 350354, 350357, 350359, 350362, 350366, 276638, 284837, 153765, 350375, 350379, 350381, 350383, 129200, 350385, 350387, 350389, 350395, 350397, 350399, 227520, 350402, 227522, 301252, 350406, 227529, 301258, 309450, 276685, 309455, 276689, 309462, 301272, 276699, 194780, 309468, 309471, 301283, 317672, 317674, 325867, 243948, 194801, 309491, 227571, 309494, 243960, 276735, 227583, 227587, 276739, 211204, 276742, 227593, 227596, 325910, 309530, 342298, 211232, 317729, 276775, 211241, 325937, 325943, 211260, 260421, 276809, 285002, 276811, 235853, 276816, 235858, 276829, 276833, 391523, 276836, 293227, 276843, 293232, 276848, 186744, 211324, 227709, 285061, 366983, 317833, 178572, 285070, 285077, 178583, 227738, 317853, 276896, 317858, 342434, 285093, 317864, 285098, 276907, 235955, 276917, 293304, 293307, 293314, 309707, 293325, 317910, 293336, 235996, 317917, 293343, 358880, 276961, 227810, 293346, 276964, 293352, 236013, 293364, 301562, 293370, 317951, 309764, 301575, 121352, 293387, 236043, 342541, 317963, 113167, 55822, 309779, 317971, 309781, 277011, 55837, 227877, 227879, 293417, 227882, 309804, 293421, 105007, 236082, 285236, 23094, 277054, 244288, 219714, 129603, 301636, 318020, 301639, 301643, 277071, 285265, 399955, 309844, 277080, 309849, 285277, 285282, 326244, 318055, 277100, 309871, 121458, 277106, 170618, 170619, 309885, 309888, 277122, 227975, 277128, 285320, 301706, 318092, 326285, 334476, 318094, 277136, 277139, 227992, 334488, 318108, 285340, 318110, 227998, 137889, 383658, 285357, 318128, 277170, 293555, 318132, 342707, 154292, 277173, 277177, 277181, 318144, 277187, 277191, 277194, 277196, 277201, 342745, 137946, 342747, 342749, 113378, 203491, 228069, 277223, 342760, 285417, 56041, 56043, 277232, 228081, 56059, 310015, 285441, 310020, 285448, 310029, 228113, 285459, 277273, 293659, 326430, 228128, 285474, 293666, 228135, 318248, 277291, 318253, 293677, 285489, 301876, 293685, 285494, 301880, 285499, 301884, 310080, 293696, 277317, 277322, 293706, 277329, 162643, 310100, 301911, 301913, 277337, 301921, 400236, 236397, 162671, 326514, 310134, 236408, 15224, 277368, 416639, 416640, 113538, 310147, 416648, 39817, 187274, 277385, 301972, 424853, 277405, 277411, 310179, 293798, 293802, 236460, 277426, 276579, 293811, 293817, 293820, 203715, 326603, 342994, 276586, 293849, 293861, 228327, 228328, 318442, 228330, 228332, 326638, 277486, 351217, 318450, 293876, 293877, 285686, 302073, 121850, 293882, 302075, 285690, 244731, 293887, 277504, 277507, 277511, 293899, 277519, 293908, 302105, 293917, 293939, 318516, 277561, 277564, 310336, 7232, 293956, 277573, 228422, 293960, 310344, 277577, 277583, 203857, 293971, 310355, 310359, 236632, 277594, 138332, 277598, 203872, 277601, 285792, 310374, 203879, 310376, 228460, 318573, 203886, 187509, 285815, 367737, 285817, 302205, 285821, 392326, 285831, 253064, 294026, 302218, 285835, 162964, 384148, 187542, 302231, 285849, 302233, 285852, 302237, 285854, 285856, 302241, 285862, 277671, 302248, 64682, 277678, 294063, 294065, 302258, 277687, 294072, 318651, 294076, 277695, 318657, 244930, 302275, 130244, 302277, 228550, 302282, 310476, 302285, 302288, 310481, 302290, 203987, 302292, 302294, 310486, 302296, 384222, 310498, 285927, 318698, 302315, 195822, 228592, 294132, 138485, 228601, 204026, 228606, 204031, 64768, 310531, 285958, 138505, 228617, 318742, 204067, 277798, 130345, 277801, 113964, 285997, 277804, 285999, 277807, 113969, 277811, 318773, 318776, 277816, 286010, 277819, 294204, 417086, 277822, 286016, 302403, 294211, 384328, 277832, 277836, 294221, 294223, 326991, 277839, 277842, 277847, 277850, 179547, 277853, 146784, 277857, 302436, 277860, 294246, 327015, 310632, 327017, 351594, 277864, 277869, 277872, 351607, 310648, 277880, 310651, 277884, 277888, 310657, 351619, 294276, 310659, 327046, 277892, 253320, 310665, 318858, 277894, 277898, 277903, 310672, 351633, 277905, 277908, 277917, 310689, 277921, 130468, 228776, 277928, 277932, 310703, 277937, 310710, 130486, 310712, 277944, 310715, 277947, 302526, 228799, 277950, 277953, 302534, 310727, 245191, 64966, 163272, 277959, 277963, 302541, 277966, 302543, 310737, 277971, 228825, 163290, 277978, 310749, 277981, 277984, 310755, 277989, 277991, 187880, 277995, 310764, 286188, 278000, 228851, 310772, 278003, 278006, 40440, 212472, 278009, 40443, 286203, 310780, 40448, 228864, 286214, 228871, 302603, 65038, 302614, 302617, 286233, 302621, 286240, 146977, 187939, 40484, 294435, 40486, 286246, 294440, 40488, 294439, 294443, 40491, 294445, 278057, 310831, 245288, 286248, 40499, 40502, 212538, 40507, 40511, 40513, 228933, 327240, 40521, 286283, 40525, 40527, 212560, 400976, 228944, 40533, 147032, 40537, 40539, 40541, 278109, 40544, 40548, 40550, 40552, 286312, 40554, 286313, 310892, 40557, 40560, 188022, 122488, 294521, 343679, 294537, 310925, 286354, 278163, 302740, 122517, 278168, 179870, 327333, 229030, 212648, 278188, 302764, 278192, 319153, 278196, 302781, 319171, 302789, 294599, 278216, 294601, 302793, 343757, 212690, 319187, 286420, 278227, 229076, 286425, 319194, 278235, 278238, 229086, 286432, 294625, 294634, 302838, 319226, 286460, 278274, 302852, 278277, 302854, 294664, 311048, 352008, 319243, 311053, 302862, 319251, 294682, 278306, 188199, 294701, 319280, 278320, 319290, 229192, 302925, 188247, 188252, 237409, 229233, 294776, 360317, 294785, 327554, 360322, 40840, 40851, 294803, 188312, 294811, 237470, 319390, 40865, 319394, 294817, 294821, 311209, 180142, 343983, 294831, 188340, 40886, 319419, 294844, 294847, 237508, 393177, 294876, 294879, 294883, 393190, 294890, 311279, 278513, 237555, 311283, 278516, 278519, 237562 ]
a884e3b4c5dd3cbdfa2bf6d55513e0f9d92cf5e9
673b7a0ec91280eb05a62e2487414d5a2a350485
/TodayNews/Sections/LogInSection/LogInViewController.swift
38a3174b7819f51945f101dee75b86aae848f182
[]
no_license
ChinaBanana/FirstNewsOfDay
bb8f2150012f8e7ec9d27e623af981ecad3cc2a8
94fc39d4aa4b81ddc1c9ec9200f88706a0155779
refs/heads/master
2021-01-19T23:21:18.796058
2017-05-25T08:29:32
2017-05-25T08:29:37
88,970,788
3
0
null
null
null
null
UTF-8
Swift
false
false
5,652
swift
// // LogInViewController.swift // TodayNews // // Created by Coco Wu on 2017/5/23. // Copyright © 2017年 cyt. All rights reserved. // import UIKit import RxSwift import RxCocoa class LogInViewController: BaseViewController { let logInService = LogInService.init() let viewModel = LogInViewModel() let disposeBag = DisposeBag() let loadingView = UIActivityIndicatorView.init(activityIndicatorStyle: UIActivityIndicatorViewStyle.gray) override func viewDidLoad() { super.viewDidLoad() /// 绑定订阅结果,此处应该有更优雅的方法 // viewModel.logInResultSubject.subscribe { (event) in // // 登录成功后dismiss ViewController // self.loadingView.stopAnimating() // self.dismissBtnClicked(self.dismissBtn) // }.addDisposableTo(disposeBag) self.loadingView.center = backView.center self.view.backgroundColor = UIColor.black self.view.addSubview(backView) self.view.addSubview(self.loadingView) self.backView.addSubview(dismissBtn) self.backView.addSubview(titleLabel) self.backView.addSubview(accountView) self.backView.addSubview(verifyView) self.backView.addSubview(logInButton) self.accountView.addSubview(accountTF) self.verifyView.addSubview(verifyCodeTF) self.updateViewConstraints() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() } @objc fileprivate func dismissBtnClicked(_ sender:UIButton) -> (){ self.dismiss(animated: true) { } } @objc fileprivate func logInBtnClickec(_ sender:UIButton) -> (){ self.loadingView.startAnimating() /// 通过viewmodel发送请求 self.viewModel.logIn(self.accountTF.text!, self.verifyCodeTF.text!, { result in debugPrint("Finally, \(result.message)") self.loadingView.stopAnimating() self.dismissBtnClicked(self.dismissBtn) }) } /// MARK: 布局 override func updateViewConstraints() { titleLabel.snp.makeConstraints { (make) in make.leading.trailing.equalTo(0) make.top.height.equalTo(50) } accountView.snp.makeConstraints { (make) in make.leading.equalTo(25) make.trailing.equalTo(-25) make.height.equalTo(50) make.top.equalTo(titleLabel.snp.bottom).offset(30) } accountTF.snp.makeConstraints { (make) in make.leading.equalTo(25) make.top.bottom.equalTo(0) make.width.equalTo(200) } verifyView.snp.makeConstraints { (make) in make.size.leading.equalTo(accountView) make.top.equalTo(accountView.snp.bottom).offset(25) } verifyCodeTF.snp.makeConstraints { (make) in make.leading.equalTo(25) make.top.bottom.equalTo(0) make.width.equalTo(200) } logInButton.snp.makeConstraints { (make) in make.size.leading.equalTo(accountView) make.top.equalTo(verifyView.snp.bottom).offset(25) } super.updateViewConstraints() } /// MARK: 懒加载 lazy var dismissBtn:UIButton = { let button = UIButton.init(frame: CGRect.init(x: screen_width - 40, y: 10, width: 35, height: 35)) button.backgroundColor = UIColor.red button.layer.cornerRadius = 5 button.addTarget(self, action: #selector(dismissBtnClicked(_:)), for: UIControlEvents.touchUpInside) return button }() lazy var backView:UIView = { let view = UIView.init(frame: CGRect.init(x: 0, y: 44, width: screen_width, height: screen_height - 44)) view.backgroundColor = RGBColor(245, g: 245, b: 245, a: 1) view.layer.cornerRadius = 3; return view }() lazy var titleLabel:UILabel = { let label = UILabel.init() label.text = "登录你的头条,精彩永不丢失" label.textAlignment = NSTextAlignment.center label.font = UIFont.systemFont(ofSize: 22) return label }() lazy var accountView:UIView = { let view = UIView.init() view.backgroundColor = UIColor.white view.layer.cornerRadius = 25 view.layer.borderWidth = 1 view.layer.borderColor = UIColor.lightGray.cgColor return view }() lazy var accountTF:UITextField = { let textField = UITextField.init() textField.placeholder = "手机号" return textField }() lazy var verifyCodeTF:UITextField = { let textField = UITextField.init() textField.placeholder = "请输入验证码" return textField }() lazy var verifyView:UIView = { let view = UIView.init() view.backgroundColor = UIColor.white view.layer.cornerRadius = 25 view.layer.borderWidth = 1 view.layer.borderColor = UIColor.lightGray.cgColor return view }() lazy var logInButton:UIButton = { let view = UIButton.init() view.backgroundColor = UIColor.white view.layer.cornerRadius = 25 view.backgroundColor = RGBColor(246, g: 150, b: 150, a: 1) view.setTitle("进入头条", for: UIControlState.normal) view.addTarget(self , action: #selector(logInBtnClickec(_:)), for: UIControlEvents.touchUpInside) return view }() }
[ -1 ]
f913b2201a286e55ac2f6ed16ed0270a5e07ee79
e3c510a47c220397604851248449ee160cd71246
/RxPlayground.playground/Contents.swift
17bc8ce910223a3751ce54a9141c57bfe42aafa1
[]
no_license
Kinlive/SomeDemo
6e2c6fb06307c481c44c4c1fef5bde0d1364ea77
8b7e60eda9b4da3582d497acf35dbf457e2af844
refs/heads/master
2020-05-01T13:36:55.168498
2019-03-25T01:59:28
2019-03-25T01:59:28
177,496,413
0
0
null
null
null
null
UTF-8
Swift
false
false
1,059
swift
import UIKit import RxSwift import RxCocoa var str = "Hello, playground" let name = BehaviorRelay(value: ["Jack"]) // BehaviorRelay 在訂閱的同時發出上一次的event name.asObservable() .subscribe(onNext: { value in print(value) }) name.accept(["Bob"]) ////////////////////// let disposeBag = DisposeBag() let subject = PublishSubject<String>() subject.onNext("JJJJ") subject.subscribe(onNext: { value in print("第一次訂閱: \(value)") }, onCompleted: { print("第一次訂閱完成...") }).disposed(by: disposeBag) subject.onNext("KKKKK") subject.subscribe(onNext: { value in print("第二次訂閱: \(value)") }, onCompleted: { print("第二次訂閱完成....") }).disposed(by: disposeBag) subject.onNext("CCCCCCC") subject.onCompleted() subject.onNext("ZZZZZZZ") subject.subscribe(onNext: { value in print("第三次訂閱: \(value)") }, onCompleted: { print("第三次訂閱完成.........") }).disposed(by: disposeBag) subject.onNext("9999999") let subject2 = BehaviorSubject(value: "MustInitWithValue")
[ -1 ]
a2879bdb12362a300524ad381d49578ae90da9aa
883976f133302d25bd590370fd87a23a08f3a392
/HNUSimpleBBS/Ulity/BBSCommon.swift
011bd0b003b7998f23a495a60f3174f0c5887e63
[]
no_license
liusoon/HNUSimpleBBS
971305aecdb6fa3879603f94e506cadf083869ca
8e4a1247f2ecba4072b07f5353795db1e471d36a
refs/heads/master
2023-02-15T20:13:56.587242
2018-07-19T08:52:54
2018-07-19T08:52:54
328,434,662
0
0
null
2021-01-10T17:18:02
2021-01-10T17:03:29
null
UTF-8
Swift
false
false
4,953
swift
// // BBSCommon.swift // HNUSimpleBBS // // Created by 杨扶恺 on 2018/5/15. // Copyright © 2018年 CodingDoge. All rights reserved. // import Kingfisher // MARK: Infomation let defaultAvatarUrls = ["http://oo8snaf4x.bkt.clouddn.com/doge.jpg", "http://oo8snaf4x.bkt.clouddn.com/1a47fcc17d2e46b5b0d3e0f160d98a0320180123163519.jpg", "http://oo8snaf4x.bkt.clouddn.com/Unknown.jpg", "http://oo8snaf4x.bkt.clouddn.com/1.jpg", "http://oo8snaf4x.bkt.clouddn.com/Zjd3-fyiiahz2863063.jpg", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG11.jpeg", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG14.jpeg", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG12.jpeg", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG13.jpeg"] //"http://oo8snaf4x.bkt.clouddn.com/[email protected]" let defaultAvatarImgPath = "icon_avatarImg" let defaultImgUrls = [ "http://oo8snaf4x.bkt.clouddn.com/WechatIMG18.jpeg", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG33.jpeg", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG31.jpeg", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG16.jpeg", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG27.jpeg", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG17.jpeg", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG21.jpeg", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG26.jpeg", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG28.png", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG22.jpeg", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG25.png", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG20.jpeg", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG29.jpeg", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG32.jpeg", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG19.jpeg", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG24.jpeg", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG30.jpeg", "http://oo8snaf4x.bkt.clouddn.com/WechatIMG23.jpeg"] let defaultWeiboImgPath = "icon_feed_img" func defaultAvatarRandom() -> Int { return Int(arc4random()%UInt32(defaultAvatarUrls.count)) } func defaultImgRandom() -> Int { return Int(arc4random()%UInt32(defaultImgUrls.count)) } // MARK: Tips func AssertMainThread() { assert(Thread.current == Thread.main, "This method must be called on the main thread") } func AssertFail(_ message: String) { assert(false, message) } // MARK: NotificationKey public let BBSTabBarHasBringToFrontNotification = "BBSTabBarHasBringToFrontNotification" // MARK: PreMethods public func StringToCGFloat(_ string: String) -> CGFloat { let ans = NSString(string: string) return CGFloat(ans.floatValue) } // MARK: Size public let BBSScreenBounds = UIScreen.main.bounds public let BBSScreenScale = UIScreen.main.scale public let BBSScreenWidth = BBSScreenBounds.width public let BBSScreenHeight = BBSScreenBounds.height public let DeviceUUID = NSUUID().uuidString public let IsIphone_X = UIDevice.current.isIphoneX public let BBSCurrentSystemVersion: CGFloat = StringToCGFloat(UIDevice.current.systemVersion) //public public let BBSWindows = UIApplication.shared.windows public let BBSNavigationBarHeight: CGFloat = 44 public let BBSTabbarHeight: CGFloat = 49 // MARK: Color public func UIColorFromRGB(_ rgbValue: NSInteger) -> UIColor { return UIColor.bbs_colorWith(hexValue: rgbValue) } public let AppTintColor = UIColorFromRGB(0x43BDCF) // 主颜色 public let AppTitleColor = UIColorFromRGB(0x222222) // 导航栏标题颜色 public let BBSStatusBarColor = UIColorFromRGB(0x43BDCF) // MARK: Instance public let BBSApplication = UIApplication.shared let RootViewController = BBSRootViewController.shared let MyNamespace = Bundle.main.infoDictionary!["CFBundleExecutable"] as! String // MARK: Methods public func showAlretWith(title: String, message: String, by self: UIViewController) -> Void { let alert = UIAlertController(title: title, message: message, preferredStyle: .alert) alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: "Default action"), style: .`default`, handler: { _ in })) self.present(alert, animated: true, completion: nil) } func dispatch_queue_async_safe(queue: DispatchQueue, _ block: @escaping ()->()) { if Thread.current.name == queue.label { block() } else { queue.async { block() } } } func dispatch_main_async_safe(_ block: @escaping () -> ()) { dispatch_queue_async_safe(queue: DispatchQueue.main) { block() } }
[ -1 ]
25aeb8f756077b6f69be1266e6d4e9ba9d80f6ce
aa49e46d84e4daacaed4c9d76acb29cfbe6d4856
/Employee Database/EmployeeTableViewCell.swift
3cb17a28e34b909821c3eb242d14c3b204cdbb99
[]
no_license
tuhan/employee-database
e56c9475341b25186ba6658fc7434ff441d0ddf9
3110c0d9afbb1c8cc1e0648a8d2f1293332bfeec
refs/heads/master
2021-07-09T21:58:54.561181
2021-07-04T07:30:36
2021-07-04T07:30:36
175,622,823
0
0
null
null
null
null
UTF-8
Swift
false
false
605
swift
// // EmployeeTableViewCell.swift // Employee Database // // Created by Tuhan Sapumanage on 3/14/19. // Copyright © 2019 Tuhan Sapumanage. All rights reserved. // import UIKit class EmployeeTableViewCell: UITableViewCell { @IBOutlet weak var nameLabel: UILabel! @IBOutlet weak var phoneLabel: UILabel! override func awakeFromNib() { super.awakeFromNib() // Initialization code } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } }
[ 317952, 431104, 337412, 227845, 206342, 327181, 333837, 196119, 281636, 278567, 305202, 278583, 289336, 310839, 327241, 327248, 214104, 339039, 340582, 302183, 213100, 340589, 302195, 222835, 222836, 340599, 100480, 373908, 329880, 381622, 294623, 271088, 271089, 300799, 300801, 300802, 271112, 271117, 282897, 123678, 336160, 287022, 313138, 282934, 287066, 287071, 37215, 265569, 350049, 270691, 317283, 355170, 336737, 317296, 308081, 262518, 113529, 244602, 281985, 211843, 36743, 334226, 334231, 311704, 283048, 211370, 242603, 306623, 306625, 306626, 323530, 323532, 323536, 358868, 384982, 180695, 180696, 358875, 358876, 384988, 384995, 302573, 237551, 165871, 305661 ]
21bc36b1ce787e95738eb86ef85eec45be63049f
b09ce622adf145635859e162ac505d22f89feb3d
/Daily/Daily/Views/Login page/Template/AuthorizationRouter.swift
2e02138cca2a70361d298b4ed41ef86a28818820
[]
no_license
LDK28/Daily
177109cc3754c48df631aad4475943bda6f0079d
f3c7e419bb91827fade78c1701110372906e958e
refs/heads/main
2023-03-11T12:50:51.506202
2020-12-29T14:31:55
2020-12-29T14:31:55
303,095,039
1
0
null
null
null
null
UTF-8
Swift
false
false
780
swift
// // AuthorizationRouter.swift // Daily // // Created by Арсений Токарев on 19.12.2020. // Copyright (c) 2020. All rights reserved. import UIKit class AuthorizationRouter { weak var viewController: AuthorizationVC? init(viewController: AuthorizationVC?) { self.viewController = viewController } } extension AuthorizationRouter: AuthorizationRoutingLogic { func navigateTo(_ destination: LoginNavigationDestination) { switch destination { case .loginScreen: viewController?.navigationController?.popViewController(animated: true) case .signupScreen: viewController?.navigationController?.pushViewController(SignupModule.build(), animated: true) case .app : AppStatusSwitcher.shared.updateRootVC() return } } }
[ -1 ]
e29090590c4f87ca202a60edf4acfa39603959ac
f5dde4718398f4daa5c4528e2258cb95d6fbf80b
/RxSwift_playgroundUITests/RxSwift_playgroundUITests.swift
775ec6ae33e6472732302ffa906e65d9cbff5e62
[]
no_license
HevaWu/RxSwift_playground
2d9b58e79b0080af44cda87882e6bdc45fc6f362
38e254f25edc827b0ca4f1476251e7eb4caa4050
refs/heads/master
2023-02-13T20:44:56.225621
2021-01-07T06:40:39
2021-01-07T06:40:39
316,953,544
0
0
null
null
null
null
UTF-8
Swift
false
false
1,442
swift
// // RxSwift_playgroundUITests.swift // RxSwift_playgroundUITests // // Created by He Wu on 2020/11/29. // import XCTest class RxSwift_playgroundUITests: XCTestCase { override func setUpWithError() throws { // Put setup code here. This method is called before the invocation of each test method in the class. // In UI tests it is usually best to stop immediately when a failure occurs. continueAfterFailure = false // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. } override func tearDownWithError() throws { // Put teardown code here. This method is called after the invocation of each test method in the class. } func testExample() throws { // UI tests must launch the application that they test. let app = XCUIApplication() app.launch() // Use recording to get started writing UI tests. // Use XCTAssert and related functions to verify your tests produce the correct results. } func testLaunchPerformance() throws { if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { // This measures how long it takes to launch your application. measure(metrics: [XCTApplicationLaunchMetric()]) { XCUIApplication().launch() } } } }
[ 360463, 376853, 344106, 253996, 385078, 163894, 319543, 352314, 376892, 32829, 352324, 352327, 385095, 393291, 163916, 368717, 196687, 254039, 426074, 368732, 180317, 32871, 352359, 221292, 385135, 376945, 385147, 426124, 196758, 49308, 65698, 49317, 377008, 377010, 377025, 377033, 164043, 417996, 254157, 368849, 368850, 139478, 385240, 254171, 147679, 147680, 205034, 254189, 254193, 262403, 147716, 385291, 368908, 180494, 262419, 368915, 254228, 377116, 254250, 131374, 418095, 336177, 368949, 180534, 155968, 270663, 319816, 368969, 254285, 180559, 377168, 344402, 368982, 270703, 139641, 385407, 385409, 270733, 106893, 385423, 385433, 213402, 385437, 254373, 385448, 385449, 311723, 115116, 385463, 336319, 336323, 188870, 262619, 377309, 377310, 369121, 369124, 270823, 213486, 360945, 139766, 393719, 377337, 254459, 410108, 410109, 262657, 377346, 410126, 262673, 385554, 393745, 254487, 410138, 188954, 188957, 377374, 385569, 385578, 377388, 197166, 393775, 418352, 33339, 352831, 33344, 385603, 385612, 426575, 385620, 369236, 270938, 352885, 352886, 344697, 385669, 369285, 344714, 377487, 180886, 426646, 352921, 377499, 344737, 352938, 418479, 164532, 336565, 377531, 377534, 377536, 385737, 385745, 369365, 369366, 385751, 361178, 352989, 352990, 418529, 295649, 385763, 369383, 361194, 418550, 344829, 197377, 434956, 418579, 426772, 197398, 426777, 344864, 197412, 336678, 279337, 189229, 197424, 197428, 336693, 377656, 426809, 197433, 222017, 377669, 197451, 369488, 385878, 385880, 197467, 435038, 385895, 197479, 385901, 197489, 164730, 254851, 369541, 172936, 189327, 377754, 172971, 140203, 377778, 189362, 189365, 377789, 345034, 418774, 386007, 386009, 418781, 386016, 123880, 418793, 222193, 435185, 271351, 435195, 328701, 386049, 328705, 418819, 410629, 377863, 189448, 320526, 361487, 435216, 386068, 254997, 336928, 336930, 410665, 345137, 361522, 386108, 410687, 377927, 361547, 296023, 205911, 156763, 361570, 214116, 214119, 402538, 173168, 377974, 66684, 377986, 402568, 140426, 337037, 386191, 410772, 222364, 418975, 124073, 402618, 402632, 148687, 402641, 419028, 222441, 386288, 66802, 271607, 369912, 386296, 369913, 419066, 386300, 386304, 320769, 369929, 419097, 320795, 115997, 222496, 369964, 353581, 116014, 66863, 312628, 345397, 345398, 386363, 345418, 353611, 337226, 353612, 378186, 353617, 378201, 312688, 337280, 353672, 263561, 304523, 370066, 9618, 411028, 370072, 148900, 361928, 337359, 329168, 329170, 353751, 329181, 320997, 361958, 271850, 271853, 329198, 411119, 116209, 386551, 312830, 271880, 198155, 329231, 370200, 157219, 157220, 394793, 353875, 99937, 345697, 271980, 206447, 403057, 42616, 337533, 370307, 419462, 149127, 149128, 419464, 411275, 214667, 345753, 255651, 337590, 370359, 403149, 345813, 370390, 272087, 337638, 181992, 345832, 345835, 141037, 173828, 395018, 395019, 395026, 124691, 435993, 345882, 321308, 255781, 362281, 378666, 403248, 378673, 345910, 182070, 182071, 436029, 337734, 272207, 272208, 337746, 395092, 362326, 345942, 370526, 345950, 362336, 255844, 214894, 362351, 214896, 124795, 182145, 337816, 124826, 329627, 354210, 436130, 436135, 10153, 362411, 370604, 362418, 411587, 362442, 346066, 354268, 436189, 403421, 329696, 354273, 403425, 190437, 354279, 436199, 174058, 337899, 354283, 247787, 329707, 247786, 313322, 436209, 124912, 182277, 346117, 403463, 43016, 354312, 354311, 354310, 436235, 419857, 436248, 346153, 124974, 272432, 403507, 378933, 378934, 436283, 403524, 436293, 436304, 329812, 411738, 272477, 395373, 346237, 436372, 362658, 436388, 125108, 133313, 395458, 338118, 436429, 346319, 321744, 379102, 387299, 18661, 379110, 125166, 149743, 379120, 436466, 125170, 411892, 436471, 395511, 436480, 125184, 272644, 125192, 338187, 338188, 125197, 395536, 125200, 338196, 272661, 379157, 125204, 125215, 125216, 338217, 125225, 125236, 362809, 379193, 395591, 272730, 436570, 215395, 362864, 354672, 272755, 354678, 248188, 313726, 436609, 240003, 436613, 395653, 395660, 264591, 420241, 43416, 436644, 305572, 272815, 436659, 338359, 436677, 256476, 420326, 166403, 322057, 420374, 322077, 330291, 191065, 436831, 420461, 313970, 346739, 346741, 420473, 166533, 363155, 346771, 264855, 363161, 436897, 355006, 363228, 436957, 436960, 264929, 338658, 346859, 330476, 35584, 133889, 346889, 264971, 322320, 207639, 363295, 355117, 191285, 273209, 355129, 273211, 355136, 355138, 420680, 355147, 355148, 355153, 387927, 363353, 363354, 322396, 420702, 363361, 363362, 412516, 355173, 355174, 207724, 355182, 207728, 420722, 330627, 265094, 387977, 396171, 355216, 224146, 224149, 256918, 256919, 256920, 256934, 273336, 273341, 330688, 379845, 363462, 273353, 207839, 347104, 183276, 412653, 248815, 257007, 347122, 437245, 257023, 125953, 396292, 330759, 347150, 330766, 412692, 330789, 248871, 412725, 257093, 404550, 314437, 339031, 404582, 257126, 265323, 396395, 404589, 273523, 363643, 248960, 150656, 363658, 404622, 224400, 265366, 347286, 429209, 339101, 429216, 339106, 380069, 265381, 421050, 339131, 265410, 183492, 421081, 339167, 421102, 363769, 52473, 52476, 412926, 437504, 388369, 380178, 429332, 126229, 412963, 257323, 437550, 273713, 208179, 159033, 347451, 216387, 257353, 257354, 109899, 437585, 331091, 150868, 372064, 429410, 437602, 388458, 265579, 314734, 314740, 314742, 421240, 314745, 388488, 314776, 396697, 396709, 380331, 380335, 355761, 421302, 134586, 380348, 216510, 380350, 216511, 200136, 273865, 339403, 372172, 413138, 421338, 437726, 429540, 3557, 3559, 191980, 191991, 265720, 216575, 372226, 208397, 323088, 413202, 413206, 388630, 175640, 216610, 372261, 347693, 323120, 396850, 200245, 323126, 134715, 421437, 396865, 413255, 273992, 265800, 421452, 265809, 396885, 265816, 396889, 388699, 396896, 323171, 282214, 388712, 388713, 339579, 396927, 224907, 405140, 274071, 208547, 208548, 405157, 388775, 364202, 421556, 224951, 224952, 323262, 323265, 241360, 241366, 224985, 159462, 372458, 397040, 12017, 274170, 175874, 249606, 323335, 372497, 397076, 421657, 339746, 257831, 167720, 241447, 421680, 274234, 241471, 339782, 315209, 241494, 339799, 274276, 274288, 372592, 274296, 339840, 315265, 372625, 118693, 438186, 151492, 380874, 372699, 380910, 380922, 380923, 274432, 372736, 241695, 315431, 430120, 315433, 430127, 405552, 249912, 225347, 421958, 176209, 381013, 53334, 200795, 356446, 438374, 176231, 438378, 217194, 422000, 249976, 266361, 422020, 168069, 381061, 168070, 381071, 323730, 430231, 200856, 422044, 192670, 192671, 258213, 323761, 266427, 356550, 372943, 266447, 258263, 356575, 438512, 372979, 389364, 381173, 135416, 356603, 266504, 61720, 381210, 315674, 389406, 438575, 266547, 397620, 332084, 438583, 127292, 438592, 332100, 348499, 250196, 348501, 389465, 332128, 110955, 242027, 160111, 250227, 438653, 266628, 340356, 225684, 373141, 315798, 373144, 389534, 397732, 373196, 242138, 184799, 201195, 324098, 340489, 397841, 258584, 348709, 348710, 397872, 340539, 266812, 438850, 348741, 381515, 348748, 430681, 332379, 184938, 373357, 184942, 176751, 389744, 356983, 356984, 209529, 356990, 373377, 422529, 201348, 152196, 356998, 348807, 356999, 316050, 275102, 176805, 340645, 422567, 176810, 160441, 422591, 135888, 242385, 373485, 373486, 21239, 275193, 348921, 430853, 430860, 62222, 430880, 152372, 160569, 430909, 160576, 348999, 275294, 381791, 127840, 357219, 439145, 242540, 242542, 381811, 201590, 398205, 308093, 340865, 349066, 316299, 349068, 381840, 390034, 373653, 430999, 209820, 381856, 398244, 185252, 422825, 381872, 398268, 349122, 398275, 373705, 127945, 340960, 398305, 340967, 398313, 127990, 349176, 201721, 349179, 357380, 398370, 357413, 357420, 21567, 160834, 398405, 218187, 250955, 250965, 439391, 250982, 398444, 62574, 357487, 119925, 349304, 349315, 349317, 373902, 177297, 324761, 373937, 373939, 324790, 218301, 259275, 259285, 357594, 414956, 251124, 439550, 439563, 242955, 414989, 259346, 349458, 382243, 382257, 382264, 333115, 193853, 251212, 406862, 259408, 316764, 374110, 259449, 382329, 357758, 243073, 357763, 112019, 398740, 374189, 251314, 259513, 54719, 259569, 251379, 398844, 210429, 366081, 153115, 431646, 349727, 431662, 374327, 210489, 235069, 349764, 128589, 333389, 333394, 349780, 415334, 54895, 366198, 210558, 210559, 415360, 333438, 415369, 431754, 210569, 267916, 415376, 259741, 153252, 399014, 210601, 202413, 317102, 300729, 415419, 259780, 333508, 267978, 333522, 325345, 333543, 431861, 161539, 366358, 169751, 431901, 341791, 325411, 333609, 399148, 202541, 431918, 153392, 431935, 415555, 325444, 325449, 341837, 415566, 431955, 325460, 317268, 341846, 259937, 382820, 415592, 325491, 341878, 276343, 350072, 333687, 317305, 112510, 325508, 333700, 243590, 350091, 350092, 350102, 350108, 333727, 219046, 128955, 219102, 6116, 432114, 415740, 268286, 415744, 333827, 243720, 399372, 153618, 358418, 178215, 325675, 243763, 358455, 325695, 399433, 333902, 104534, 260206, 432241, 374913, 374914, 415883, 333968, 333990, 104633, 260285, 268479, 374984, 334049, 325857, 268515, 383208, 317676, 260337, 260338, 375040, 260355, 375052, 194832, 325904, 391448, 334104, 268570, 178459, 186660, 268581, 334121, 358698, 325930, 260396, 432435, 358707, 178485, 358710, 14654, 268609, 383309, 383327, 391521, 366948, 416101, 383338, 432503, 432511, 252309, 39323, 317851, 375211, 334259, 129461, 342454, 358844, 317889, 326083, 416201, 129484, 154061, 416206, 432608, 195044, 391654, 432616, 334315, 375281, 334345, 432650, 342549, 342560, 416288, 350758, 350759, 358951, 358952, 219694, 219695, 375345, 375369, 375373, 416334, 416340, 244311, 416353, 260705, 375396, 268901, 244326, 244345, 375438, 326288, 383668, 342714, 39616, 383708, 269036, 432883, 203511, 342775, 383740, 416509, 432894, 359166, 375552, 162559, 383755, 326413, 326428, 318247, 342827, 318251, 375610, 342846, 416577, 416591, 244569, 375644, 252766, 351078, 342888, 392057, 211835, 269179, 260995, 400262, 392071, 424842, 236427, 252812, 400271, 392080, 400282, 7070, 211871, 359332, 359333, 326571, 252848, 326580, 261045, 261046, 326586, 359365, 211913, 326602, 342990, 252878, 433104, 359380, 433112, 433116, 359391, 187372, 343020, 383980, 383994, 171009, 384004, 433166, 384015, 433173, 326684, 252959, 384031, 375848, 261191, 375902, 375903, 392288, 253028, 351343, 187505, 138354, 384120, 392317, 343166, 384127, 392320, 253074, 326803, 359574, 351389, 253098, 367791, 367792, 367798, 343230, 367809, 253124, 113863, 351445, 195809, 253168, 351475, 351489, 367897, 367898, 245018, 130347, 261426, 212282, 359747, 359748, 146760, 146763, 114022, 253288, 425327, 425331, 163190, 327030, 384379, 253316, 384391, 253339, 253340, 343457, 245160, 359860, 359861, 343480, 425417, 327122, 425434, 310747, 253431, 286201, 359931, 187900, 343552, 359949, 253456, 253462, 146976, 245290, 245291, 343606, 163385, 425534, 138817, 147011, 147020, 179800, 196184, 343646, 155238, 204394, 138862, 188021, 425624, 245413, 384693, 376502, 409277, 319176, 409289, 425682, 245471, 155360, 212721, 163575, 319232, 360194, 409355, 155408, 417556, 204600, 319289, 384826, 409404, 360253, 409416, 376661, 368471, 425820, 368486, 384871, 409446, 368489, 40809, 425832, 417648, 417658, 360315, 253828, 327556, 425875, 253851, 376733, 204702, 253868, 204722, 188349, 212947, 212953, 360416, 253930, 385011 ]
016166aabf7968dbf49fb6a9c2afca3dd3fc4598
18f32595bea4c3f81f3c1e35111c41a0452fef9a
/Screens/UserInfoVC.swift
115a24ceb73f7a2cc02ea6c00fa52dcdb8d21dc4
[]
no_license
marlonjames71/GHFollowers
9d5d9117c1600e4cfe2299ceeb1df1d568b75918
3fb1c4b36837a5d86cb2d6720a3a45494176ede2
refs/heads/master
2020-12-02T00:44:38.891847
2020-03-01T20:36:57
2020-03-01T20:36:57
230,833,903
0
0
null
null
null
null
UTF-8
Swift
false
false
2,497
swift
// // UserInfoVC.swift // GHFollowers // // Created by Marlon Raskin on 1/12/20. // Copyright © 2020 Marlon Raskin. All rights reserved. // import UIKit class UserInfoVC: UIViewController { let headerView = UIView() let itemViewOne = UIView() let itemViewTwo = UIView() var username: String! override func viewDidLoad() { super.viewDidLoad() configureViewController() layoutUI() getUserInfo() } func configureViewController() { view.backgroundColor = .systemBackground let doneButton = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(dismissVC)) navigationItem.rightBarButtonItem = doneButton } func getUserInfo() { NetworkManager.shared.getUserInfo(for: username) { [weak self] result in guard let self = self else { return } switch result { case .success(let user): DispatchQueue.main.async { self.add(childVC: GFUserInfoHeaderVC(user: user), to: self.headerView) self.add(childVC: GFRepoItemVC(user: user), to: self.itemViewOne) self.add(childVC: GFFollowerItemVC(user: user), to: self.itemViewTwo) } case .failure(let error): self.presentGFAlertOnMainThread(title: "Something went wrong", message: error.rawValue, buttonTitle: "OK") } } } func layoutUI() { let padding: CGFloat = 20 let itemHeight: CGFloat = 140 view.addSubviews(headerView, itemViewOne, itemViewTwo) [headerView, itemViewOne, itemViewTwo].forEach { $0.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ $0.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: padding), $0.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -padding), ]) } NSLayoutConstraint.activate([ headerView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor), headerView.heightAnchor.constraint(equalToConstant: 180), itemViewOne.topAnchor.constraint(equalTo: headerView.bottomAnchor, constant: padding), itemViewOne.heightAnchor.constraint(equalToConstant: itemHeight), itemViewTwo.topAnchor.constraint(equalTo: itemViewOne.bottomAnchor, constant: padding), itemViewTwo.heightAnchor.constraint(equalToConstant: itemHeight), ]) } func add(childVC: UIViewController, to containerView: UIView) { addChild(childVC) containerView.addSubview(childVC.view) childVC.view.frame = containerView.bounds childVC.didMove(toParent: self) } @objc func dismissVC() { dismiss(animated: true) } }
[ -1 ]
c9abef2c982777c618abe9e0a4545e68c105b2e8
8e8303db9d0b9d8801226db86efc67d58fa54c8b
/BeachyEMVReaderControl/BLE/BLEDevice.swift
40664508816e4db16a9cebd7987be4f594bf8537
[]
no_license
piotrilski/emv-swift-framework
ee8b8ab4a66a6ffa28d29a041fdded9a6577ad04
64ac9de70a6f9e2d1e45c0c607480c2a436f80d7
refs/heads/master
2020-04-03T12:04:58.817171
2018-10-30T11:49:53
2018-10-30T11:49:53
155,240,924
0
0
null
null
null
null
UTF-8
Swift
false
false
953
swift
// // BLEDevice.swift // EMV_reader // // Created by Piotr Ilski on 10.10.2018. // Copyright © 2018 Beachy. All rights reserved. // import UIKit @objc open class BLEDevice: NSObject { let name: String let identifier: UUID @objc public let isSupportedEmv: Bool init(name: String, identifier: UUID) { self.name = name self.identifier = identifier self.isSupportedEmv = name.lowercased().range(of: "idtech") != nil || name.lowercased().range(of: "enzytek") != nil } @objc open func getIdentifier() -> UUID { return identifier } @objc open func getName() -> String { return name } override open var hash: Int { return name.hashValue ^ identifier.hashValue } static func == (lhs: BLEDevice, rhs: BLEDevice) -> Bool { return lhs.name == rhs.name && lhs.identifier == rhs.identifier } }
[ -1 ]
250f133bbf63b39eedbef6d70c939ed90b1d0ae1
5f38f28c282219ad0a905d023ed2c30153c977ee
/Recorder/SceneDelegate.swift
2414380a12146457e6ac71b61c0f0db0997b2528
[]
no_license
BMarx981/Recorder
7c8530c550991646e40f80924e026caa8f580e39
8bf5eac2e802307e942bd54ecca3336f5e49e69c
refs/heads/main
2023-08-13T05:51:50.059766
2021-10-16T16:08:01
2021-10-16T16:08:01
417,878,700
0
0
null
null
null
null
UTF-8
Swift
false
false
2,289
swift
// // SceneDelegate.swift // Recorder // // Created by Brian Marx on 10/16/21. // import UIKit class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). guard let _ = (scene as? UIWindowScene) else { return } } func sceneDidDisconnect(_ scene: UIScene) { // Called as the scene is being released by the system. // This occurs shortly after the scene enters the background, or when its session is discarded. // Release any resources associated with this scene that can be re-created the next time the scene connects. // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). } func sceneDidBecomeActive(_ scene: UIScene) { // Called when the scene has moved from an inactive state to an active state. // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. } func sceneWillResignActive(_ scene: UIScene) { // Called when the scene will move from an active state to an inactive state. // This may occur due to temporary interruptions (ex. an incoming phone call). } func sceneWillEnterForeground(_ scene: UIScene) { // Called as the scene transitions from the background to the foreground. // Use this method to undo the changes made on entering the background. } func sceneDidEnterBackground(_ scene: UIScene) { // Called as the scene transitions from the foreground to the background. // Use this method to save data, release shared resources, and store enough scene-specific state information // to restore the scene back to its current state. } }
[ 393221, 163849, 393228, 393231, 393251, 352294, 344103, 393260, 393269, 213049, 376890, 385082, 393277, 376906, 327757, 254032, 368728, 180314, 254045, 180322, 376932, 286833, 286845, 286851, 417925, 262284, 360598, 286880, 377003, 377013, 164029, 327872, 180418, 377030, 377037, 377047, 418008, 418012, 377063, 327915, 205037, 393457, 393461, 393466, 418044, 385281, 336129, 262405, 180491, 164107, 336140, 262417, 368913, 262423, 377118, 377121, 262437, 254253, 336181, 262455, 393539, 262473, 344404, 213333, 418135, 262497, 418145, 262501, 213354, 246124, 262508, 262512, 213374, 385420, 393613, 262551, 262553, 385441, 385444, 262567, 385452, 262574, 393649, 385460, 262587, 344512, 262593, 360917, 369119, 328178, 328180, 328183, 328190, 254463, 328193, 164362, 328207, 410129, 393748, 262679, 377372, 188959, 385571, 377384, 197160, 33322, 352822, 270905, 197178, 418364, 188990, 369224, 385610, 270922, 352844, 385617, 352865, 262761, 352875, 344694, 352888, 336513, 377473, 385671, 148106, 213642, 377485, 352919, 98969, 344745, 361130, 336556, 385714, 434868, 164535, 336568, 328379, 164539, 328387, 352969, 344777, 385743, 385749, 139998, 189154, 369382, 361196, 418555, 344832, 336644, 344837, 344843, 328462, 361231, 394002, 336660, 418581, 418586, 434971, 369436, 262943, 369439, 418591, 418594, 336676, 418600, 418606, 369464, 361274, 328516, 336709, 328520, 336712, 361289, 328523, 336715, 361300, 213848, 426842, 361307, 197469, 361310, 254813, 361318, 344936, 361323, 361335, 328574, 369544, 361361, 222129, 345036, 115661, 386004, 345046, 386012, 386019, 328690, 435188, 328703, 328710, 418822, 328715, 377867, 361490, 386070, 271382, 336922, 345119, 377888, 345134, 345139, 361525, 386102, 361537, 377931, 345172, 189525, 156762, 402523, 361568, 148580, 345200, 361591, 386168, 410746, 361594, 214150, 345224, 386187, 345247, 361645, 345268, 402615, 361657, 337093, 402636, 328925, 165086, 66783, 165092, 222438, 386286, 328942, 386292, 206084, 345377, 353572, 345380, 345383, 263464, 337207, 345400, 378170, 369979, 386366, 337224, 337230, 337235, 263509, 353634, 337252, 402792, 271731, 378232, 337278, 271746, 181639, 181644, 361869, 181650, 181655, 230810, 181671, 181674, 181679, 181682, 337330, 181687, 370105, 181691, 181697, 361922, 337350, 181704, 337366, 271841, 329192, 361961, 329195, 116211, 337399, 402943, 337416, 329227, 419341, 419345, 329234, 419351, 345626, 419357, 345631, 370208, 419360, 394787, 419363, 370214, 419369, 394796, 419377, 419386, 206397, 214594, 419401, 419404, 353868, 419408, 214611, 419412, 403040, 345702, 222831, 370298, 353920, 403073, 403076, 345737, 198282, 403085, 403092, 345750, 419484, 345758, 345763, 419492, 419498, 419502, 370351, 419507, 337588, 419510, 419513, 419518, 337601, 403139, 337607, 419528, 419531, 419536, 272083, 394967, 419545, 345819, 419548, 419551, 345829, 419560, 337643, 419564, 337647, 370416, 337671, 362249, 362252, 395022, 362256, 321300, 345888, 362274, 378664, 354107, 345916, 354112, 370504, 329545, 345932, 370510, 354132, 337751, 247639, 370520, 313181, 354143, 354157, 345965, 345968, 345971, 345975, 403321, 1914, 354173, 247692, 395148, 337809, 247701, 329625, 436127, 436133, 247720, 337834, 362414, 337845, 190393, 346059, 346064, 247760, 346069, 419810, 329699, 354275, 190440, 354314, 346140, 436290, 378956, 395340, 436307, 338005, 100454, 329833, 329853, 329857, 329868, 411806, 329886, 346273, 362661, 100525, 387250, 379067, 387261, 256193, 395467, 256214, 411862, 411865, 411869, 411874, 379108, 411877, 387303, 346344, 395496, 338154, 387307, 346350, 338161, 387314, 436474, 321787, 379135, 411905, 411917, 379154, 395539, 387350, 387353, 338201, 182559, 338212, 395567, 248112, 362823, 436556, 321880, 362844, 379234, 354674, 321911, 420237, 379279, 354728, 338353, 338382, 272849, 248279, 256474, 182755, 338404, 338411, 330225, 248309, 248332, 330254, 199189, 420377, 330268, 191012, 330320, 199250, 191069, 346722, 248427, 191085, 338544, 346736, 191093, 346743, 346769, 150184, 174775, 248505, 174778, 363198, 223936, 355025, 273109, 355029, 264919, 256735, 338661, 264942, 363252, 338680, 264965, 338701, 256787, 363294, 199455, 396067, 346917, 396070, 215854, 355123, 355141, 355144, 338764, 355151, 330581, 330585, 387929, 355167, 265056, 265059, 355176, 355180, 355185, 412600, 207809, 379849, 347082, 396246, 330711, 248794, 248799, 347106, 437219, 257009, 265208, 265215, 199681, 338951, 330761, 330769, 330775, 248863, 158759, 396329, 347178, 404526, 396337, 330803, 396340, 339002, 388155, 339010, 347208, 248905, 330827, 248915, 183384, 339037, 412765, 257121, 322660, 265321, 248952, 420985, 330886, 330890, 347288, 248986, 44199, 380071, 339118, 339133, 322763, 330959, 330966, 265433, 265438, 388320, 363757, 388348, 339199, 396552, 175376, 175397, 273709, 372016, 437553, 347442, 199989, 175416, 396601, 208189, 437567, 175425, 437571, 126279, 437576, 437584, 331089, 437588, 331094, 396634, 175451, 437596, 429408, 175458, 175461, 175464, 265581, 331124, 175478, 249210, 175484, 249215, 175487, 249219, 175491, 249225, 249228, 249235, 175514, 175517, 396703, 396706, 175523, 355749, 396723, 388543, 380353, 216518, 380364, 339406, 372177, 339414, 413143, 249303, 339418, 339421, 249310, 339425, 249313, 339429, 339435, 249329, 69114, 372229, 208399, 380433, 175637, 405017, 134689, 339504, 265779, 421442, 413251, 265796, 265806, 224854, 224858, 339553, 257636, 224871, 372328, 257647, 372338, 224885, 224888, 224891, 224895, 372354, 421509, 126597, 224905, 11919, 224911, 224914, 126611, 224917, 224920, 126618, 208539, 224923, 224927, 224930, 224933, 257705, 224939, 224943, 257713, 224949, 257717, 257721, 224954, 257725, 224960, 257733, 224966, 224970, 257740, 224976, 257745, 339664, 257748, 224982, 257752, 224987, 257762, 224996, 225000, 225013, 257788, 225021, 339711, 257791, 225027, 257796, 257802, 339722, 257805, 225039, 257808, 249617, 225044, 167701, 372500, 257815, 225049, 257820, 225054, 184096, 257825, 225059, 339748, 225068, 257837, 413485, 225071, 225074, 257843, 225077, 257846, 225080, 397113, 225083, 397116, 257853, 225088, 225094, 225097, 257869, 257872, 225105, 397140, 225109, 225113, 257881, 257884, 257887, 225120, 257891, 413539, 225128, 257897, 339818, 225138, 339827, 257909, 225142, 372598, 257914, 257917, 225150, 257922, 380803, 225156, 339845, 257927, 225166, 397201, 225171, 380823, 225176, 225183, 372698, 372704, 372707, 356336, 380919, 372739, 405534, 266295, 266298, 217158, 421961, 200786, 356440, 217180, 430181, 266351, 356467, 266365, 192640, 266375, 381069, 225425, 250003, 225430, 250008, 356507, 225439, 135328, 225442, 438434, 192674, 225445, 438438, 225448, 438441, 356521, 225451, 258223, 225456, 430257, 225459, 225462, 225468, 389309, 225472, 372931, 225476, 430275, 389322, 225485, 225488, 225491, 266454, 225494, 225497, 225500, 225503, 225506, 356580, 225511, 217319, 225515, 225519, 381177, 397572, 389381, 381212, 356638, 356641, 356644, 356647, 266537, 356650, 389417, 356656, 332081, 307507, 340276, 356662, 397623, 332091, 225599, 201030, 348489, 332107, 151884, 430422, 348503, 332118, 250201, 250203, 250211, 340328, 250217, 348523, 348528, 332153, 356734, 389503, 332158, 438657, 332162, 389507, 348548, 356741, 250239, 332175, 160152, 373146, 340380, 373149, 70048, 356783, 373169, 266688, 324032, 201158, 340452, 127473, 217590, 340473, 324095, 324100, 324103, 324112, 340501, 324118, 324122, 340512, 332325, 324134, 381483, 356908, 324141, 324143, 356917, 324150, 324156, 168509, 348734, 324161, 324165, 356935, 381513, 348745, 324171, 324174, 324177, 389724, 332381, 373344, 340580, 348777, 381546, 119432, 340628, 184983, 373399, 258723, 332460, 389806, 332464, 332473, 381626, 332484, 332487, 332494, 357070, 357074, 332512, 332521, 340724, 332534, 155647, 373499, 348926, 389927, 348979, 152371, 348983, 340792, 398141, 357202, 389971, 357208, 389979, 430940, 357212, 357215, 439138, 201580, 201583, 349041, 340850, 381815, 430967, 324473, 398202, 119675, 324476, 430973, 340859, 340863, 324479, 324482, 373635, 324485, 324488, 185226, 381834, 324493, 324496, 324499, 430996, 324502, 324511, 422817, 324514, 201638, 398246, 373672, 324525, 5040, 111539, 324534, 5047, 324539, 324542, 398280, 349129, 340940, 340942, 209874, 340958, 431073, 398307, 340964, 209896, 201712, 209904, 349173, 381947, 201724, 431100, 349181, 431107, 349203, 209944, 209948, 357411, 250915, 250917, 169002, 357419, 209966, 209969, 209973, 209976, 209980, 209988, 209991, 209996, 431180, 341072, 349268, 177238, 250968, 210011, 373853, 341094, 210026, 210028, 210032, 349296, 210037, 210042, 210045, 349309, 152704, 160896, 349313, 210053, 210056, 349320, 373905, 259217, 210068, 210072, 210078, 210081, 210085, 210089, 210096, 210100, 324792, 210108, 357571, 210116, 210128, 210132, 333016, 210139, 210144, 218355, 218361, 275709, 275713, 242947, 275717, 275723, 333075, 349460, 333079, 251161, 349486, 349492, 415034, 210261, 365912, 259423, 374113, 251236, 374118, 333164, 234867, 390518, 357756, 374161, 112021, 349591, 333222, 259516, 415168, 366035, 415187, 366039, 415192, 415194, 415197, 415200, 333285, 415208, 366057, 366064, 415217, 415225, 423424, 415258, 415264, 366118, 415271, 382503, 349739, 144940, 415279, 415282, 415286, 210488, 415291, 415295, 349762, 333396, 374359, 333400, 366173, 423529, 423533, 210547, 415354, 333440, 267910, 333512, 259789, 366301, 333535, 153311, 366308, 366312, 431852, 399086, 366319, 210673, 366322, 399092, 366326, 333566, 268042, 210700, 366349, 210707, 399129, 333595, 210720, 358192, 366384, 366388, 210740, 358201, 325441, 366403, 325447, 341831, 341835, 341839, 341844, 415574, 358235, 341852, 350046, 399200, 399208, 358256, 268144, 358260, 341877, 399222, 325494, 333690, 325505, 333699, 399244, 333709, 333725, 333737, 382891, 382898, 350153, 358348, 333777, 219094, 399318, 358372, 350190, 350194, 333819, 350204, 350207, 325633, 325637, 350214, 219144, 268299, 333838, 350225, 186388, 350232, 333851, 350238, 350241, 374819, 350245, 350249, 350252, 178221, 350257, 350260, 350272, 243782, 350281, 350286, 374865, 342113, 252021, 342134, 374904, 268435, 333998, 334012, 260299, 350411, 350417, 350423, 211161, 350426, 350449, 358645, 350459, 350462, 350465, 350469, 268553, 350477, 268560, 350481, 432406, 350487, 325915, 350491, 325918, 350494, 325920, 350500, 194854, 350505, 358701, 391469, 350510, 358705, 358714, 358717, 383307, 358738, 334162, 383331, 383334, 391531, 383342, 334204, 268669, 194942, 391564, 366991, 334224, 268702, 342431, 375209, 375220, 334263, 326087, 358857, 195041, 334312, 104940, 375279, 416255, 350724, 186898, 342546, 350740, 342551, 334359, 342555, 334364, 416294, 350762, 252463, 358962, 334386, 334397, 358973, 252483, 219719, 399957, 334425, 326240, 375401, 334466, 334469, 391813, 162446, 326291, 342680, 342685, 260767, 342711, 244410, 260798, 260802, 350918, 154318, 342737, 391895, 154329, 416476, 64231, 113389, 342769, 203508, 375541, 342777, 391938, 391949, 375569, 326417, 375572, 375575, 375580, 162592, 334633, 326444, 383794, 326452, 326455, 375613, 244542, 260925, 375616, 326463, 326468, 342857, 326474, 326479, 326486, 416599, 342875, 244572, 326494, 433001, 400238, 326511, 211826, 211832, 392061, 351102, 359296, 252801, 260993, 351105, 400260, 211846, 342921, 342931, 400279, 252823, 392092, 400286, 252838, 359335, 211885, 252846, 400307, 351169, 359362, 351172, 170950, 359367, 326599, 187335, 359383, 359389, 383968, 343018, 359411, 261109, 261112, 244728, 383999, 261130, 261148, 359452, 211999, 261155, 261160, 359471, 375868, 343132, 384099, 384102, 384108, 367724, 187503, 343155, 384115, 212095, 351366, 384136, 384140, 384144, 351382, 384152, 384158, 384161, 351399, 384169, 367795, 244917, 384182, 367801, 384189, 351424, 384192, 343232, 367817, 244938, 384202, 253132, 326858, 384209, 146644, 351450, 384225, 343272, 351467, 359660, 384247, 351480, 384250, 351483, 351492, 343307, 384270, 261391, 359695, 253202, 261395, 384276, 384284, 245021, 384290, 253218, 245032, 171304, 384299, 351535, 376111, 245042, 326970, 384324, 343366, 212296, 212304, 367966, 343394, 367981, 343410, 155000, 327035, 245121, 245128, 253321, 155021, 384398, 245137, 245143, 245146, 245149, 343453, 245152, 245155, 155045, 245158, 40358, 245163, 114093, 327090, 343478, 359867, 384444, 146878, 327108, 327112, 384457, 359887, 359891, 368093, 155103, 343535, 343540, 368120, 343545, 409092, 253445, 359948, 359951, 245295, 359984, 343610, 400977, 400982, 179803, 155241, 245358, 155255, 155274, 368289, 245410, 425652, 425663, 155328, 245463, 155352, 155356, 212700, 155364, 245477, 155372, 245487, 212723, 409336, 155394, 155404, 245528, 155423, 360224, 155439, 204592, 155444, 155448, 417596, 384829, 384831, 360262, 155463, 155477, 376665, 155484, 261982, 425823, 376672, 155488, 155492, 327532, 261997, 376686, 262000, 262003, 327542, 147319, 262006, 262009, 425846, 262012, 155517, 155523, 155526, 360327, 376715, 155532, 262028, 262031, 262034, 262037, 262040, 262043, 155550, 253854, 262046, 262049, 262052, 327590, 155560, 155563, 155566, 327613, 393152, 311244, 393170, 155604, 155620, 253924, 155622, 327655, 253927, 360432, 393204, 360439, 253944, 393209, 393215 ]
c285d3deee0bb73147c335e2130c122f827a902b
770fbdf2039ebd16983aec8668c697f163afca45
/Julia-set-ios/View/CustomTableViewCell.swift
5e575b79e95a313fb3758e04570da0629ff73dfd
[]
no_license
evan-beh/Julia-set-ios
e2fc3012071462d677418e80237829347e7a629f
812bd2bf6911ed149da281cd374a2fe64a6db144
refs/heads/master
2023-08-25T02:48:13.530995
2021-10-11T07:00:05
2021-10-11T07:00:05
415,344,791
0
0
null
null
null
null
UTF-8
Swift
false
false
527
swift
// // CustomTableViewCell.swift // Julia-set-ios // // Created by Evan Beh on 07/10/2021. // import UIKit class CustomTableViewCell: UITableViewCell { @IBOutlet weak var lblDesc: UILabel! @IBOutlet weak var lblTitle: UILabel! override func awakeFromNib() { super.awakeFromNib() // Initialization code } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } }
[ 320001, 337412, 227845, 333831, 227849, 227852, 333837, 372750, 372753, 196114, 372754, 327190, 328214, 287258, 370207, 243746, 287266, 281636, 292919, 327224, 327225, 307277, 327248, 235604, 235611, 213095, 213097, 310894, 213105, 222836, 213109, 148600, 213115, 403068, 410751, 300672, 123541, 373913, 148637, 148638, 276639, 148648, 300206, 361651, 327360, 239306, 223437, 291544, 306907, 337627, 176358, 271087, 325874, 338682, 283900, 276746, 161041, 276756, 203542, 320793, 261406, 349470, 396065, 111912, 369458, 369461, 282934, 342850, 342851, 151881, 430412, 283471, 283472, 270679, 287067, 350050, 270691, 257898, 330602, 179568, 317296, 317302, 244600, 179578, 179580, 211843, 213891, 36743, 209803, 317336, 337318, 337321, 211370, 337324, 288690, 281014, 300986, 430546, 430547, 358870, 180695, 180696, 284131, 344039, 196076, 310778, 305661 ]
a9e341c701c019a2d9a41af0f7d46c1e2d6ad295
22616c36c714914f44e6a04bcc2a0c822fe305dd
/Foundation/SwiftTerm/Sources/SwiftTerm/Mac/MacTerminalView.swift
8cdb632573b246a120eb6fc7a5f30e46d540a2dc
[ "MIT", "BSD-3-Clause" ]
permissive
Ukenn2112/mobilePillowTalkLite
ebe30c415685985d22113accb950bf7e93395164
fd163987304ccce6af8b31e3692cb0c8b54547ee
refs/heads/main
2023-08-31T00:43:34.536633
2021-09-22T07:17:29
2021-09-22T07:17:29
null
0
0
null
null
null
null
UTF-8
Swift
false
false
40,713
swift
// // MacTerminalView.swift // // This is the AppKit version of the TerminalView and holds the state // variables in the `TerminalView` class, but as much of the terminal // implementation details live in the Apple/AppleTerminalView which // contains the shared AppKit/UIKit code // // Created by Miguel de Icaza on 3/4/20. // #if os(OSX) import Foundation import AppKit import CoreText import CoreGraphics /** * TerminalView provides an AppKit front-end to the `Terminal` termininal emulator. * It is up to a subclass to either wire the terminal emulator to a remote terminal * via some socket, to an application that wants to run with terminal emulation, or * wiring this up to a pseudo-terminal. * * Users are notified of interesting events in their implementation of the `TerminalViewDelegate` * methods - an instance must be provided to the constructor of `TerminalView`. * * Developers might want to surface UIs for `optionAsMetaKey` and `allowMouseReporting` in * their application. They both default to true, but this means that Option-Letter is hijacked for * terminal purposes to send the sequence ESC-Letter, instead of the macOS specific character` and * means that when mouse-aware applications are running, they hijack the normal selection process. * * Call the `getTerminal` method to get a reference to the underlying `Terminal` that backs this * view. * * Use the `configureNativeColors()` to set the defaults colors for the view to match the OS * defaults, otherwise, this uses its own set of defaults colors. */ open class TerminalView: NSView, NSTextInputClient, NSUserInterfaceValidations { struct FontSet { public let normal: NSFont let bold: NSFont let italic: NSFont let boldItalic: NSFont static var defaultFont: NSFont { if #available(OSX 10.15, *) { return NSFont.monospacedSystemFont(ofSize: NSFont.systemFontSize, weight: .regular) } else { return NSFont(name: "Menlo Regular", size: NSFont.systemFontSize) ?? NSFont(name: "Courier", size: NSFont.systemFontSize)! } } public init(font baseFont: NSFont, fontSize: CGFloat? = nil) { self.normal = baseFont self.bold = NSFontManager.shared.convert(baseFont, toHaveTrait: [.boldFontMask]) self.italic = NSFontManager.shared.convert(baseFont, toHaveTrait: [.italicFontMask]) self.boldItalic = NSFontManager.shared.convert(baseFont, toHaveTrait: [.italicFontMask, .boldFontMask]) } // Expected by the shared rendering code func underlinePosition () -> CGFloat { return normal.underlinePosition } // Expected by the shared rendering code func underlineThickness () -> CGFloat { return normal.underlineThickness } } /** * The delegate that the TerminalView uses to interact with its hosting */ public weak var terminalDelegate: TerminalViewDelegate? var accessibility: AccessibilityService = AccessibilityService() var search: SearchService! var debug: TerminalDebugView? var pendingDisplay: Bool = false var cellDimension: CellDimension! var caretView: CaretView! var terminal: Terminal! var selection: SelectionService! private var scroller: NSScroller! // These structures are parallel, maybe should be merged, but one contains the attributed text to render var attrStrBuffer: CircularList<ViewLineInfo>! // Attribute dictionary, maps a console attribute (color, flags) to the corresponding dictionary // of attributes for an NSAttributedString var attributes: [Attribute: [NSAttributedString.Key:Any]] = [:] var urlAttributes: [Attribute: [NSAttributedString.Key:Any]] = [:] // Cache for the colors in the 0..255 range var colors: [NSColor?] = Array(repeating: nil, count: 256) var trueColors: [Attribute.Color:NSColor] = [:] var transparent = TTColor.transparent () var fontSet: FontSet /// The font to use to render the terminal public var font: NSFont { get { return fontSet.normal } set { fontSet = FontSet (font: newValue) resetFont() } } public init(frame: CGRect, font: NSFont?) { self.fontSet = FontSet (font: font ?? FontSet.defaultFont) super.init (frame: frame) setup() } public override init (frame: CGRect) { self.fontSet = FontSet (font: FontSet.defaultFont) super.init (frame: frame) setup() } public required init? (coder: NSCoder) { self.fontSet = FontSet (font: FontSet.defaultFont) super.init (coder: coder) setup() } private func setup() { wantsLayer = true setupScroller() setupOptions() } func startDisplayUpdates () { // Not used on Mac } func suspendDisplayUpdates() { // Not used on Mac } func setupOptions () { setupOptions (width: getEffectiveWidth (rect: bounds), height: bounds.height) layer?.backgroundColor = nativeBackgroundColor.cgColor } /// This controls whether the backspace should send ^? or ^H, the default is ^? public var backspaceSendsControlH: Bool = false var _nativeFg, _nativeBg: TTColor! var settingFg = false, settingBg = false /** * This will set the native foreground color to the specified native color (UIColor or NSColor) * and will have this reflected into the underlying's terminal `foregroundColor` and * `backgroundColor` */ public var nativeForegroundColor: NSColor { get { _nativeFg } set { if settingFg { return } settingFg = true _nativeFg = newValue terminal.foregroundColor = nativeForegroundColor.getTerminalColor () settingFg = false } } /** * This will set the native foreground color to the specified native color (UIColor or NSColor) * and will have this reflected into the underlying's terminal `foregroundColor` and * `backgroundColor` */ public var nativeBackgroundColor: NSColor { get { _nativeBg } set { if settingBg { return } settingBg = true _nativeBg = newValue terminal.backgroundColor = nativeBackgroundColor.getTerminalColor () settingBg = false } } /// Controls the color for the caret public var caretColor: NSColor { get { caretView.caretColor } set { caretView.caretColor = newValue } } var _selectedTextBackgroundColor = NSColor.selectedTextBackgroundColor /// The color used to render the selection public var selectedTextBackgroundColor: NSColor { get { return _selectedTextBackgroundColor } set { _selectedTextBackgroundColor = newValue } } func backingScaleFactor () -> CGFloat { window?.backingScaleFactor ?? NSScreen.main?.backingScaleFactor ?? 1 } @objc func scrollerActivated () { switch scroller.hitPart { case .decrementPage: pageUp() scroller.doubleValue = scrollPosition case .incrementPage: pageDown() scroller.doubleValue = scrollPosition case .knob: scroll(toPosition: scroller.doubleValue) case .knobSlot: print ("Scroller .knobSlot clicked") case .noPart: print ("Scroller .noPart clicked") case .decrementLine: print ("Scroller .decrementLine clicked") case .incrementLine: print ("Scroller .incrementLine clicked") default: print ("Scroller: New value introduced") } } func setupScroller() { let style: NSScroller.Style = .legacy let scrollerWidth = NSScroller.scrollerWidth(for: .regular, scrollerStyle: style) scroller = NSScroller(frame: NSRect(x: bounds.maxX - scrollerWidth, y: 0, width: scrollerWidth, height: bounds.height)) scroller.autoresizingMask = [.minXMargin, .height] scroller.scrollerStyle = style scroller.knobProportion = 0.1 scroller.isEnabled = false addSubview (scroller) scroller.action = #selector(scrollerActivated) scroller.target = self } /// This method sents the `nativeForegroundColor` and `nativeBackgroundColor` /// to match macOS default colors for text and its background. public func configureNativeColors () { self.nativeForegroundColor = NSColor.textColor self.nativeBackgroundColor = NSColor.textBackgroundColor } open func bufferActivated(source: Terminal) { updateScroller () } open func send(source: Terminal, data: ArraySlice<UInt8>) { terminalDelegate?.send (source: self, data: data) } /** * Given the current set of columns and rows returns a frame that would host this control. */ open func getOptimalFrameSize () -> NSRect { return NSRect (x: 0, y: 0, width: cellDimension.width * CGFloat(terminal.cols) + scroller.frame.width, height: cellDimension.height * CGFloat(terminal.rows)) } func getEffectiveWidth (rect: NSRect) -> CGFloat { return (rect.width-scroller.frame.width) } open func scrolled(source terminal: Terminal, yDisp: Int) { //selectionView.notifyScrolled(source: terminal) updateScroller() terminalDelegate?.scrolled(source: self, position: scrollPosition) } open func linefeed(source: Terminal) { selection.selectNone() } /// This vaiable controls whether mouse events are sent to the application running under the /// terminal if it has requested the data. This poses a problem for selection, so users /// need a way of toggling this behavior. public var allowMouseReporting: Bool = true func updateDebugDisplay() { debug?.update() } func updateScroller () { scroller.isEnabled = canScroll scroller.doubleValue = scrollPosition scroller.knobProportion = scrollThumbsize } var userScrolling = false #if false override open func setNeedsDisplay(_ invalidRect: NSRect) { print ("setNeeds: \(invalidRect)") super.setNeedsDisplay(invalidRect) } #endif func getCurrentGraphicsContext () -> CGContext? { NSGraphicsContext.current?.cgContext } override public func draw (_ dirtyRect: NSRect) { guard let currentContext = getCurrentGraphicsContext() else { return } drawTerminalContents (dirtyRect: dirtyRect, context: currentContext) } public override func cursorUpdate(with event: NSEvent) { NSCursor.iBeam.set () } func makeFirstResponder () { window?.makeFirstResponder (self) } open override var frame: NSRect { get { return super.frame } set(newValue) { super.frame = newValue let newRows = Int (newValue.height / cellDimension.height) let newCols = Int (getEffectiveWidth (rect: newValue) / cellDimension.width) if newCols != terminal.cols || newRows != terminal.rows { terminal.resize (cols: newCols, rows: newRows) fullBufferUpdate (terminal: terminal) } accessibility.invalidate () search.invalidate () terminalDelegate?.sizeChanged (source: self, newCols: newCols, newRows: newRows) needsDisplay = true } } public override func resizeSubviews(withOldSize oldSize: NSSize) { super.resizeSubviews(withOldSize: oldSize) updateScroller() selection.active = false } private var _hasFocus = false open var hasFocus : Bool { get { _hasFocus } set { _hasFocus = newValue caretView.focused = newValue } } // // NSTextInputClient protocol implementation // public override func becomeFirstResponder() -> Bool { let response = super.becomeFirstResponder() if response { hasFocus = true } return response } public override func resignFirstResponder() -> Bool { let response = super.resignFirstResponder() if response { hasFocus = false } return response } public override var acceptsFirstResponder: Bool { get { return true } } // Tracking object, maintained by `startTracking` and `deregisterTrackingInterest` var tracking: NSTrackingArea? = nil // Turns on AppKit mouse event tracking - used both by the url highlighter and the mouse move, // when the client application has set MouseMove.anyEvent // // Can be invoked multiple times, use the "deregisterTrackingInterest" method to turn it off // which will take into account both the url highlighter state (which is bound to the command // key being pressed) and the client requirements func startTracking () { if tracking == nil { tracking = NSTrackingArea (rect: frame, options: [.activeAlways, .mouseMoved, .mouseEnteredAndExited], owner: self, userInfo: [:]) addTrackingArea(tracking!) } } // Can be invoked by both the keyboard handler monitoring the command key, and the // mouse tracking system, only when both are off, this is turned off. func deregisterTrackingInterest () { if commandActive == false && terminal.mouseMode != .anyEvent { if tracking != nil { removeTrackingArea(tracking!) tracking = nil } } } func turnOffUrlPreview () { if commandActive { deregisterTrackingInterest() removePreviewUrl() commandActive = false } } // If true, the Command key has been pressed var commandActive = false // We monitor the flags changed to enable URL previews on mouse-hover like iTerm // when the Command key is pressed. public override func flagsChanged(with event: NSEvent) { if event.modifierFlags.contains(.command){ commandActive = true startTracking() if let payload = getPayload(for: event) as? String { previewUrl (payload: payload) } } else { turnOffUrlPreview () } super.flagsChanged(with: event) } public override func mouseExited(with event: NSEvent) { turnOffUrlPreview() super.mouseExited(with: event) } /// If set to true, the terminal treats the "Option" key as the Meta key in old terminals, /// which has the effect of sending the ESC character before the character that was /// entered. Applications use this to provide bindings for Alt-keys, or in Emacs terms /// the Meta key (M-x stands for Meta-x, or pressing the option key and x). /// /// If this is set to `false`, then the key is passed to the OS, which produces the /// OS specific feature. public var optionAsMetaKey: Bool = true // // We capture a handful of keydown events and pre-process those, and then let // interpretKeyEvents do the rest of the work, that includes text-insertion, and // keybinding mapping. // // That is why we do not handle things like the return key here, instead those are // handled by doCommand below. // // This currently handles the function keys here, but probably should be done in // doCommand/noop: - but more research needs to take place to figure out the priority // of those keys. // public override func keyDown(with event: NSEvent) { selection.active = false let eventFlags = event.modifierFlags // Handle Option-letter to send the ESC sequence plus the letter as expected by terminals if optionAsMetaKey && eventFlags.contains (.option) { if let rawCharacter = event.charactersIgnoringModifiers { send (EscapeSequences.CmdEsc) send (txt: rawCharacter) } return } else if eventFlags.contains (.control) { // Sends the control sequence if let ch = event.charactersIgnoringModifiers { send (applyControlToEventCharacters (ch)) return } } else if eventFlags.contains (.function) { if let str = event.charactersIgnoringModifiers { if let fs = str.unicodeScalars.first { let c = Int (fs.value) switch c { case NSF1FunctionKey: send (EscapeSequences.CmdF [0]) case NSF2FunctionKey: send (EscapeSequences.CmdF [1]) case NSF3FunctionKey: send (EscapeSequences.CmdF [2]) case NSF4FunctionKey: send (EscapeSequences.CmdF [3]) case NSF5FunctionKey: send (EscapeSequences.CmdF [4]) case NSF6FunctionKey: send (EscapeSequences.CmdF [5]) case NSF7FunctionKey: send (EscapeSequences.CmdF [6]) case NSF8FunctionKey: send (EscapeSequences.CmdF [7]) case NSF9FunctionKey: send (EscapeSequences.CmdF [8]) case NSF10FunctionKey: send (EscapeSequences.CmdF [9]) case NSF11FunctionKey: send (EscapeSequences.CmdF [10]) case NSF12FunctionKey: send (EscapeSequences.CmdF [11]) case NSDeleteFunctionKey: send (EscapeSequences.CmdDelKey) // case NSUpArrowFunctionKey: // send (EscapeSequences.MoveUpNormal) // case NSDownArrowFunctionKey: // send (EscapeSequences.MoveDownNormal) // case NSLeftArrowFunctionKey: // send (EscapeSequences.MoveLeftNormal) // case NSRightArrowFunctionKey: // send (EscapeSequences.MoveRightNormal) case NSPageUpFunctionKey: pageUp () case NSPageDownFunctionKey: pageDown() default: interpretKeyEvents([event]) } } } return } interpretKeyEvents([event]) } public override func doCommand(by selector: Selector) { switch selector { case #selector(insertNewline(_:)): send (EscapeSequences.CmdRet) case #selector(cancelOperation(_:)): send (EscapeSequences.CmdEsc) case #selector(deleteBackward(_:)): send ([backspaceSendsControlH ? 8 : 0x7f]) case #selector(moveUp(_:)): sendKeyUp() case #selector(moveDown(_:)): sendKeyDown() case #selector(moveLeft(_:)): sendKeyLeft() case #selector(moveRight(_:)): sendKeyRight() case #selector(insertTab(_:)): send (EscapeSequences.CmdTab) case #selector(insertBacktab(_:)): send (EscapeSequences.CmdBackTab) case #selector(moveToBeginningOfLine(_:)): send (terminal.applicationCursor ? EscapeSequences.MoveHomeApp : EscapeSequences.MoveHomeNormal) case #selector(moveToEndOfLine(_:)): send (terminal.applicationCursor ? EscapeSequences.MoveEndApp : EscapeSequences.MoveEndNormal) case #selector(scrollPageUp(_:)): fallthrough case #selector(pageUp(_:)): if terminal.applicationCursor { send (EscapeSequences.CmdPageUp) } else { pageUp() } case #selector(scrollPageDown(_:)): fallthrough case #selector(pageDown(_:)): if terminal.applicationCursor { send (EscapeSequences.CmdPageDown) } else { pageDown() } case #selector(pageDownAndModifySelection(_:)): if terminal.applicationCursor { // TODO: view should scroll one page up. } else { send (EscapeSequences.CmdPageDown) } break; default: print ("Unhandle selector \(selector)") } } // NSTextInputClient protocol implementation open func insertText(_ string: Any, replacementRange: NSRange) { if let str = string as? NSString { send (txt: str as String) } // TODO: I do not think we actually need this needsDisplay, the data fed should bubble this up // needsDisplay = true } // NSTextInputClient protocol implementation open func setMarkedText(_ string: Any, selectedRange: NSRange, replacementRange: NSRange) { // nothing } // NSTextInputClient protocol implementation open func unmarkText() { // nothing } // NSTextInputClient protocol implementation open func selectedRange() -> NSRange { guard let selection = self.selection, selection.active else { // This means "no selection": return NSRange.empty } var startLocation = (selection.start.row * terminal.buffer.rows) + selection.start.col var endLocation = (selection.end.row * terminal.buffer.rows) + selection.end.col if startLocation > endLocation { swap(&startLocation, &endLocation) } let length = endLocation - startLocation if length == 0 { return NSRange.empty } return NSRange(location: startLocation, length: endLocation - startLocation) } // NSTextInputClient protocol implementation open func markedRange() -> NSRange { print ("markedRange: This should return the actual range from the selection") // This means "no marked" - when we fix, we should address return NSRange.empty } // NSTextInputClient protocol implementation open func hasMarkedText() -> Bool { // print ("hasMarkedText: This should return the actual range from the selection") // TODO return false } // NSTextInputClient protocol implementation open func attributedSubstring(forProposedRange range: NSRange, actualRange: NSRangePointer?) -> NSAttributedString? { print ("Attribuetd string") return nil } // NSTextInputClient Protocol implementation open func validAttributesForMarkedText() -> [NSAttributedString.Key] { // TODO print ("validAttributesForMarkedText: This should return the actual range from the selection") return [] } // NSTextInputClient protocol implementation open func firstRect(forCharacterRange range: NSRange, actualRange: NSRangePointer?) -> NSRect { actualRange?.pointee = range if let r = window?.convertToScreen(convert(caretView!.frame, to: nil)) { return r } return .zero } // NSTextInputClient protocol implementation open func characterIndex(for point: NSPoint) -> Int { print ("characterIndex:for point: This should return the actual range from the selection") return NSNotFound } open func validateUserInterfaceItem(_ item: NSValidatedUserInterfaceItem) -> Bool { //print ("Validating selector: \(item.action)") switch item.action { case #selector(performTextFinderAction(_:)): if let fa = NSTextFinder.Action (rawValue: item.tag) { switch fa { case .showFindInterface: return true case .showReplaceInterface: return true case .hideReplaceInterface: return true default: return false } } return false case #selector(paste(_:)): return true case #selector(selectAll(_:)): return true case #selector(copy(_:)): return selection.active default: print ("Validating User Interface Item: \(item)") return false } } open func selectionChanged(source: Terminal) { updateSelectionInBuffer(terminal: source) needsDisplay = true } func cut (sender: Any?) {} @objc open func paste(_ sender: Any) { let clipboard = NSPasteboard.general let text = clipboard.string(forType: .string) insertText(text ?? "", replacementRange: NSRange(location: 0, length: 0)) } @objc open func copy(_ sender: Any) { // find the selected range of text in the buffer and put in the clipboard let str = selection.getSelectedText() let clipboard = NSPasteboard.general clipboard.clearContents() clipboard.setString(str, forType: .string) } /// Set to true if the selection is active, false otherwise public var selectionActive: Bool { get { selection.active } } /// Returns the contents of the selection, if active, or nil otherwise public func getSelection () -> String? { if selection.active { return selection.getSelectedText() } return nil } public override func selectAll(_ sender: Any?) { selection.selectAll() } //func undo (sender: Any) {} //func redo (sender: Any) {} func zoomIn (sender: Any) {} func zoomOut (sender: Any) {} func zoomReset (sender: Any) {} // Returns the vt100 mouseflags func encodeMouseEvent (with event: NSEvent) -> Int { let flags = event.modifierFlags let isReleaseEvent = [NSEvent.EventType.leftMouseUp, .otherMouseUp, .rightMouseUp].contains(event.type) return terminal.encodeButton(button: event.buttonNumber, release: isReleaseEvent, shift: flags.contains(.shift), meta: flags.contains(.option), control: flags.contains(.control)) } func calculateMouseHit (with event: NSEvent) -> Position { let point = convert(event.locationInWindow, from: nil) let col = Int (point.x / cellDimension.width) let row = Int ((frame.height-point.y) / cellDimension.height) if row < 0 { return Position(col: 0, row: 0) } return Position(col: min (max (0, col), terminal.cols-1), row: min (row, terminal.rows-1)) } private func sharedMouseEvent (with event: NSEvent) { let hit = calculateMouseHit(with: event) let buttonFlags = encodeMouseEvent(with: event) terminal.sendEvent(buttonFlags: buttonFlags, x: hit.col, y: hit.row) } private var autoScrollDelta = 0 // Callback from when the mouseDown autoscrolling timer goes off private func scrollingTimerElapsed (source: Timer) { if autoScrollDelta == 0 { return } if autoScrollDelta < 0 { scrollUp(lines: autoScrollDelta * -1) } else { scrollUp(lines: autoScrollDelta) } } public override func mouseDown(with event: NSEvent) { if allowMouseReporting && terminal.mouseMode.sendButtonPress() { sharedMouseEvent(with: event) return } let hit = calculateMouseHit(with: event) switch event.clickCount { case 1: if selection.active == true { if event.modifierFlags.contains(.shift) { selection.shiftExtend(row: hit.row, col: hit.col) } else { selection.active = false } } case 2: selection.selectWordOrExpression(at: Position(col: hit.col, row: hit.row + terminal.buffer.yDisp), in: terminal.buffer) default: // 3 and higher selection.select(row: hit.row + terminal.buffer.yDisp) } } func getPayload (for event: NSEvent) -> Any? { let hit = calculateMouseHit(with: event) let cd = terminal.buffer.lines [terminal.buffer.yDisp+hit.row][hit.col] return cd.getPayload() } var didSelectionDrag: Bool = false public override func mouseUp(with event: NSEvent) { if event.modifierFlags.contains(.command){ if let payload = getPayload(for: event) as? String { if let (url, params) = urlAndParamsFrom(payload: payload) { terminalDelegate?.requestOpenLink(source: self, link: url, params: params) } } } if allowMouseReporting && terminal.mouseMode.sendButtonRelease() { sharedMouseEvent(with: event) return } #if DEBUG // let hit = calculateMouseHit(with: event) //print ("Up at col=\(hit.col) row=\(hit.row) count=\(event.clickCount) selection.active=\(selection.active) didSelectionDrag=\(didSelectionDrag) ") #endif didSelectionDrag = false } public override func mouseDragged(with event: NSEvent) { let hit = calculateMouseHit(with: event) if allowMouseReporting { if terminal.mouseMode.sendMotionEvent() { let flags = encodeMouseEvent(with: event) terminal.sendMotion(buttonFlags: flags, x: hit.col, y: hit.row) return } if terminal.mouseMode != .off { return } } if selection.active { selection.dragExtend(row: hit.row, col: hit.col) } else { selection.startSelection(row: hit.row, col: hit.col) } didSelectionDrag = true autoScrollDelta = 0 if selection.active { if hit.row <= 0 { autoScrollDelta = calcScrollingVelocity(delta: hit.row * -1) * -1 } else if hit.row >= terminal.rows { autoScrollDelta = calcScrollingVelocity(delta: hit.row - terminal.rows) } } } func tryUrlFont () -> NSFont { for x in ["Optima", "Helvetica", "Helvetica Neue"] { if let font = NSFont (name: x, size: 12) { return font } } return NSFont.systemFont(ofSize: 12) } // The payload contains the terminal data which is expected to be of the form // params;URL, so we need to extract the second component, but we also assume that // the input might be ill-formed, so we might return nil in that case func urlAndParamsFrom (payload: String) -> (String, [String:String])? { let split = payload.split(separator: ";", maxSplits: Int.max, omittingEmptySubsequences: false) if split.count > 1 { let pairs = split [0].split (separator: ":") var params: [String:String] = [:] for p in pairs { let kv = p.split (separator: "=") if kv.count == 2 { params [String (kv [0])] = String (kv[1]) } } return (String (split [1]), params) } return nil } var urlPreview: NSTextField? func previewUrl (payload: String) { if let (url, _) = urlAndParamsFrom(payload: payload) { if let up = urlPreview { up.stringValue = url up.sizeToFit() } else { let nup: NSTextField if #available(OSX 10.12, *) { nup = NSTextField (string: url) } else { nup = NSTextField () } nup.isBezeled = false nup.font = tryUrlFont () nup.backgroundColor = nativeForegroundColor nup.textColor = nativeBackgroundColor nup.sizeToFit() nup.frame = CGRect (x: 0, y: 0, width: nup.frame.width, height: nup.frame.height) addSubview(nup) urlPreview = nup } } } func removePreviewUrl () { if let urlPreview = self.urlPreview { urlPreview.removeFromSuperview() self.urlPreview = nil } } public override func mouseMoved(with event: NSEvent) { let hit = calculateMouseHit(with: event) if commandActive { if let payload = getPayload(for: event) as? String { previewUrl (payload: payload) } } if terminal.mouseMode.sendMotionEvent() { let flags = encodeMouseEvent(with: event) terminal.sendMotion(buttonFlags: flags, x: hit.col, y: hit.row) } } public override func scrollWheel(with event: NSEvent) { if event.deltaY == 0 { return } let velocity = calcScrollingVelocity(delta: Int (abs (event.deltaY))) if event.deltaY > 0 { scrollUp (lines: velocity) } else { scrollDown(lines: velocity) } } private func calcScrollingVelocity (delta: Int) -> Int { if delta > 9 { return max (terminal.rows, 20) } if delta > 5 { return 10 } if delta > 1 { return 3 } return 1 } public override func resetCursorRects() { addCursorRect(bounds, cursor: .iBeam) } public func resetFontSize () { fontSet = FontSet (font: FontSet.defaultFont) } func getImageScale () -> CGFloat { self.window?.backingScaleFactor ?? 1 } func scale (image: NSImage, size: CGSize) -> NSImage { let scaledImg = TTImage (size: CGSize (width: size.width, height: size.height)) let srcRatio = image.size.height/image.size.width let scaledRatio = size.width/size.height scaledImg.lockFocus() let srcRect = CGRect(origin: CGPoint.zero, size: image.size) let dstRect: CGRect if srcRatio < scaledRatio { let nw = (size.height * image.size.width) / image.size.height dstRect = CGRect (x: (size.width-nw)/2, y: 0, width: nw, height: size.height) } else { let nh = (size.width * image.size.height) / image.size.width dstRect = CGRect (x: 0, y: (size.height-nh)/2, width: size.width, height: nh) } image.draw(in: dstRect, from: srcRect, operation: .copy, fraction: 1) scaledImg.unlockFocus() return scaledImg } func drawImageInStripe (image: TTImage, srcY: CGFloat, width: CGFloat, srcHeight: CGFloat, dstHeight: CGFloat, size: CGSize) -> TTImage? { guard let bitmapImage = NSBitmapImageRep ( bitmapDataPlanes: nil, pixelsWide: Int(size.width), pixelsHigh: Int(size.height), bitsPerSample: 8, samplesPerPixel: 4, hasAlpha: true, isPlanar: false, colorSpaceName: NSColorSpaceName.calibratedRGB, bytesPerRow: 0, bitsPerPixel: 0) else { return nil } let stripe = NSImage (size: size) stripe.addRepresentation (bitmapImage) stripe.lockFocus() let srcRect = CGRect(x: 0, y: CGFloat(srcY), width: image.size.width, height: srcHeight) let destRect = CGRect(x: 0, y: 0, width: width, height: dstHeight) image.draw(in: destRect, from: srcRect, operation: .copy, fraction: 1.0) stripe.unlockFocus() return stripe } } extension TerminalView: TerminalDelegate { open func isProcessTrusted(source: Terminal) -> Bool { true } open func mouseModeChanged(source: Terminal) { if source.mouseMode == .anyEvent { startTracking() } else { if terminal != nil { deregisterTrackingInterest() } } } open func setTerminalTitle(source: Terminal, title: String) { terminalDelegate?.setTerminalTitle(source: self, title: title) } open func sizeChanged(source: Terminal) { terminalDelegate?.sizeChanged(source: self, newCols: source.cols, newRows: source.rows) updateScroller () } open func setTerminalIconTitle(source: Terminal, title: String) { // } // Terminal.Delegate method implementation open func windowCommand(source: Terminal, command: Terminal.WindowManipulationCommand) -> [UInt8]? { return nil } } extension NSColor { func getTerminalColor () -> Color { guard let color = self.usingColorSpace(.deviceRGB) else { return Color.defaultForeground } var red: CGFloat = 0.0, green: CGFloat = 0.0, blue: CGFloat = 0.0, alpha: CGFloat = 1.0 color.getRed(&red, green: &green, blue: &blue, alpha: &alpha) return Color(red: UInt16(red*65535), green: UInt16(green*65535), blue: UInt16(blue*65535)) } func inverseColor() -> NSColor { guard let color = self.usingColorSpace(.deviceRGB) else { return self } var red: CGFloat = 0.0, green: CGFloat = 0.0, blue: CGFloat = 0.0, alpha: CGFloat = 1.0 color.getRed(&red, green: &green, blue: &blue, alpha: &alpha) return NSColor(calibratedRed: 1.0 - red, green: 1.0 - green, blue: 1.0 - blue, alpha: alpha) } static func make (red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) -> NSColor { return NSColor (deviceRed: red, green: green, blue: blue, alpha: alpha) } static func make (hue: CGFloat, saturation: CGFloat, brightness: CGFloat, alpha: CGFloat) -> TTColor { return NSColor ( calibratedHue: hue, saturation: saturation, brightness: brightness, alpha: alpha) } static func make (color: Color) -> NSColor { return NSColor (deviceRed: CGFloat (color.red) / 65535.0, green: CGFloat (color.green) / 65535.0, blue: CGFloat (color.blue) / 65535.0, alpha: 1.0) } static func transparent () -> NSColor { return NSColor (calibratedWhite: 0, alpha: 0) } } // Default implementations for TerminalViewDelegate extension TerminalViewDelegate { public func requestOpenLink (source: TerminalView, link: String, params: [String:String]) { if let fixedup = link.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) { if let url = NSURLComponents(string: fixedup) { if let nested = url.url { NSWorkspace.shared.open(nested) } } } } public func bell (source: TerminalView) { NSSound.beep() } } extension NSBezierPath { func addLine(to: CGPoint) { self.line (to: to) } } extension NSAttributedString { func fuzzyHasSelectionBackground () -> Bool { return attributeKeys.contains(NSAttributedString.Key.selectionBackgroundColor.rawValue) } } #endif
[ -1 ]
ae3debb4820028f377985d4dd632e0248437250c
b5d30c87224f7a984bb0ce3519881dd499c06481
/AppFoundation/AppFoundation/Source/Extension/UIViewFromNib.swift
819e8b57d16668e3166ba6d0f08b4bbcf80593f4
[]
no_license
devjackcat/swift-study
e8c9bed45f06ca8468c692ac23c71647f6e3b7d5
e7f12fe872713ccfde0ede38b16281123418d099
refs/heads/master
2023-05-04T02:48:16.443175
2021-05-25T02:17:33
2021-05-25T02:17:33
277,457,241
0
0
null
null
null
null
UTF-8
Swift
false
false
2,317
swift
// // UIViewFromNib.swift // swift-study // // Created by 永平 on 2020/5/22. // Copyright © 2020 永平. All rights reserved. // import UIKit public extension UIView { class func fromNib(_ nibNameOrNil: String? = nil) -> Self { return fromNib(nibNameOrNil: nibNameOrNil)! } class func fromNib(nibNameOrNil: String?, bundle: Bundle? = nil, owner: Any? = nil, index: Int? = nil) -> Self? { var view: Self? let name: String if let _nibName = nibNameOrNil { name = _nibName } else { // Most nibs are demangled by practice, if not, just declare string explicitly name = nibName } var nibViews: [Any]? let bundles: [Bundle?] = [bundle, Bundle.main, Bundle(for: Self.self)] for bundle in bundles.compactMap({ $0 }) { if let temp = loadNibs(bundle: bundle, name: name, owner: owner, options: nil) { nibViews = temp break } } if let nibViews = nibViews { if let index = index { view = nibViews[index] as? Self } else { view = nibViews.first(where: { $0 is Self }) as? Self } } return view } class var nibName: String { let name = "\(self)".components(separatedBy: ".").first ?? "" return name } class var nib: UINib? { if let _ = Bundle(for: Self.self).path(forResource: nibName, ofType: "nib") { return UINib(nibName: nibName, bundle: nil) } else { return nil } } } private func loadNibs(bundle: Bundle, name: String, owner: Any?, options: [UINib.OptionsKey: Any]?) -> [Any]? { let xibNames: [String] switch UIDevice.current.userInterfaceIdiom { case .phone: xibNames = ["\(name)~iphone", name] case .pad: xibNames = ["\(name)~ipad", name] default: xibNames = [name] } if let xibName = xibNames.first(where: { name -> Bool in if let path = bundle.path(forResource: name, ofType: ".nib") { return FileManager.default.fileExists(atPath: path) } return false }) { return bundle.loadNibNamed(xibName, owner: owner, options: options) } return nil }
[ -1 ]
a5c6444e4729cadc7def41307dfcf8bba507eb3f
cf0cc09f57149d8fee2f9bcfea18a93260033870
/BudgetViewer/Models/Transaction.swift
8a5370dde114068a9719d7e919fe8ba55b2d586f
[]
no_license
oecheverri/BudgetViewer
fa86d2819f102929e4e238320706cfcc3c280c0c
18954f507c72238141d3299bb4ca310d5fae3460
refs/heads/main
2023-03-18T10:36:39.184979
2021-03-02T02:41:24
2021-03-02T02:41:24
338,442,625
0
0
null
null
null
null
UTF-8
Swift
false
false
2,858
swift
// // Transaction.swift // BudgetViewer // // Created by Oscar Echeverri on 2021-01-08. // Copyright © 2021 Oscar Echeverri. All rights reserved. // import Foundation enum Frequency: String, Decodable { case never = "never" case daily = "daily" case weekly = "weekly" case everyOtherWeek = "everyOtherWeek" case twiceAMonth = "twiceAMonth" case every4Weeks = "every4Weeks" case monthly = "monthly" case everyOtherMonth = "everyOtherMonth" case every3Momths = "every3Momths" case every4Months = "every4Months" case twiceAYear = "twiceAYear" case yearly = "yearly" case everyOtherYear = "everyOtherYear" } struct SubTransaction: Identifiable, Decodable { let id: String let transaction_id: String let deleted: Bool @DecodableDefault.Zero var amount: Int @DecodableDefault.EmptyString var memo: String @DecodableDefault.EmptyString var payee_id: String @DecodableDefault.EmptyString var payee_name: String @DecodableDefault.EmptyString var category_id: String @DecodableDefault.EmptyString var category_name: String @DecodableDefault.EmptyString var transfer_account_id: String } struct ScheduledTransaction: Identifiable, Decodable { let id: String let date_first: String let date_next: String let frequency: Frequency let amount: Int let account_id: String let deleted: Bool @DecodableDefault.EmptyString var memo: String @DecodableDefault.EmptyString var payee_id: String @DecodableDefault.EmptyString var category_id: String @DecodableDefault.EmptyString var transfer_account_id: String } struct ScheduledSubTransaction: Identifiable, Decodable { let id: String let scheduled_transaction_id: String let amount: Int let deleted: Bool @DecodableDefault.EmptyString var memo: String @DecodableDefault.EmptyString var payee_id: String @DecodableDefault.EmptyString var category_id: String @DecodableDefault.EmptyString var transfer_account_id: String } struct Transaction: Identifiable, Decodable { enum Status: String, Decodable { case cleared = "cleared" case uncleared = "uncleared" case reconciled = "reconciled" } let id: String let date: String let amount: Int let cleared: Status let approved: Bool let account_id: String let deleted: Bool @DecodableDefault.EmptyString var memo: String @DecodableDefault.EmptyString var payee_id: String @DecodableDefault.EmptyString var category_id: String @DecodableDefault.EmptyString var transfer_account_id: String @DecodableDefault.EmptyString var transfer_transaction_id: String @DecodableDefault.EmptyString var matched_transaction_id: String @DecodableDefault.EmptyString var import_id: String }
[ -1 ]
72cdc1dcda8bd265fa3b53f52fb055e27ddf6b03
dc698cb37f0f3acb65e1eaaa5b918a5032d7f1cc
/Runher/Model/FormatDisplay.swift
9c2b9561ed7303356810af041b9f4e82d8491ce7
[]
no_license
Hfriedman13/Runher
f87411c74108b195007f101b85f5b806cbafc87b
861fdb0df883130fbbbee6209ab4ced4cf7242f2
refs/heads/main
2023-02-06T23:15:34.603205
2020-12-31T17:19:06
2020-12-31T17:19:06
325,059,513
1
0
null
null
null
null
UTF-8
Swift
false
false
1,460
swift
// // FormatDisplay.swift // Runher // // Created by Hannah Friedman on 12/30/20. // import Foundation struct FormatDisplay { static func distance(_ distance: Double) -> String { let distanceMeasurement = Measurement(value: distance, unit: UnitLength.meters) return FormatDisplay.distance(distanceMeasurement) } static func distance(_ distance: Measurement<UnitLength>) -> String { let formatter = MeasurementFormatter() return formatter.string(from: distance) } static func time(_ seconds: Int) -> String { let formatter = DateComponentsFormatter() formatter.allowedUnits = [.hour, .minute, .second] formatter.unitsStyle = .positional formatter.zeroFormattingBehavior = .pad return formatter.string(from: TimeInterval(seconds))! } static func pace(distance: Measurement<UnitLength>, seconds: Int, outputUnit: UnitSpeed) -> String { let formatter = MeasurementFormatter() formatter.unitOptions = [.providedUnit] // 1 let speedMagnitude = seconds != 0 ? distance.value / Double(seconds) : 0 let speed = Measurement(value: speedMagnitude, unit: UnitSpeed.metersPerSecond) return formatter.string(from: speed.converted(to: outputUnit)) } static func date(_ timestamp: Date?) -> String { guard let timestamp = timestamp as Date? else { return "" } let formatter = DateFormatter() formatter.dateStyle = .medium return formatter.string(from: timestamp) } }
[ 333254 ]
21c64f2173c1bb5cd010dcff37b555886362f804
b8c0aeff5f38fd82b6503faf069927ae558126f6
/EasyLastFMClient/Extensions/UIKit/UITextView+setHTMLFromString.swift
4af4643ae9be4a2662874bb90002d86251d59793
[]
no_license
Atwazz/easylastfmclient
fae3a71ec94cefd2d3c6fbc01d0b90455865ccfb
f3464a6eb0e435be1a0befe8afc806a75073933f
refs/heads/master
2023-04-11T15:58:08.854434
2021-04-19T09:27:37
2021-04-19T09:27:37
271,980,524
1
0
null
null
null
null
UTF-8
Swift
false
false
1,296
swift
// // UITextView+setHTMLFromString.swift // Easy Last FM Client // // Created by Artem Agafonov on 30.03.2020. // Copyright © 2020 Artem Agafonov. All rights reserved. // import UIKit.UITextView extension UITextView { func setHTML(from string: String?) { guard let font = font, let color = textColor else { assertionFailure("No font or color provided") text = string return } guard let htmlString = string else { text = string return } let styled = String(format:"<span style=\"font-family: '-apple-system', 'HelveticaNeue'; " + "font-size: \(font.pointSize); color: \(color.hex)\">%@</span>", htmlString) if let attributedString = try? NSAttributedString(data: Data(styled.utf8), options: htmlAttributes, documentAttributes: nil) { attributedText = attributedString } else { text = string } } } // MARK: - Private private extension UITextView { var htmlAttributes: [NSAttributedString.DocumentReadingOptionKey: Any] { [.documentType: NSAttributedString.DocumentType.html] } }
[ -1 ]
36abad96a9458e8fd6781b4b5e28e8c4f1874f62
4b2a924193df8b01db0454af5fdd87c48dae51b1
/Tests/CorePromise/ResolverTests.swift
cef959826eb3ea58ef23db1f5879eba6cfa1dd13
[ "MIT" ]
permissive
andredp/PromiseKit6
fd568da70958f9da48d54b3ccd82f9ebbe5221f8
c910287405d07661856651007f8864934a8d8e92
refs/heads/master
2020-04-27T14:30:49.460037
2019-04-04T17:19:59
2019-04-05T13:51:51
174,412,660
0
0
null
null
null
null
UTF-8
Swift
false
false
5,634
swift
import PromiseKit6 import XCTest class WrapTests: XCTestCase { fileprivate class KittenFetcher { let value: Int? let error: Error? init(value: Int?, error: Error?) { self.value = value self.error = error } func fetchWithCompletionBlock(block: @escaping(Int?, Error?) -> Void) { after(.milliseconds(20)).done { block(self.value, self.error) } } func fetchWithCompletionBlock2(block: @escaping(Error?, Int?) -> Void) { after(.milliseconds(20)).done { block(self.error, self.value) } } func fetchWithCompletionBlock3(block: @escaping(Int, Error?) -> Void) { after(.milliseconds(20)).done { block(self.value ?? -99, self.error) } } func fetchWithCompletionBlock4(block: @escaping(Error?) -> Void) { after(.milliseconds(20)).done { block(self.error) } } } func testSuccess() { let ex = expectation(description: "") let kittenFetcher = KittenFetcher(value: 2, error: nil) Promise { seal in kittenFetcher.fetchWithCompletionBlock(block: seal.resolve) }.done { XCTAssertEqual($0, 2) ex.fulfill() }.silenceWarning() waitForExpectations(timeout: 1) } func testError() { let ex = expectation(description: "") let kittenFetcher = KittenFetcher(value: nil, error: Error.test) Promise { seal in kittenFetcher.fetchWithCompletionBlock(block: seal.resolve) }.catch { error in defer { ex.fulfill() } guard case Error.test = error else { return XCTFail() } } waitForExpectations(timeout: 1) } func testInvalidCallingConvention() { let ex = expectation(description: "") let kittenFetcher = KittenFetcher(value: nil, error: nil) Promise { seal in kittenFetcher.fetchWithCompletionBlock(block: seal.resolve) }.catch { error in defer { ex.fulfill() } guard case PMKError.invalidCallingConvention = error else { return XCTFail() } } waitForExpectations(timeout: 1) } func testInvertedCallingConvention() { let ex = expectation(description: "") let kittenFetcher = KittenFetcher(value: 2, error: nil) Promise { seal in kittenFetcher.fetchWithCompletionBlock2(block: seal.resolve) }.done { XCTAssertEqual($0, 2) ex.fulfill() }.silenceWarning() waitForExpectations(timeout: 1) } func testNonOptionalFirstParameter() { let ex1 = expectation(description: "") let kf1 = KittenFetcher(value: 2, error: nil) Promise { seal in kf1.fetchWithCompletionBlock3(block: seal.resolve) }.done { XCTAssertEqual($0, 2) ex1.fulfill() }.silenceWarning() let ex2 = expectation(description: "") let kf2 = KittenFetcher(value: -100, error: Error.test) Promise { seal in kf2.fetchWithCompletionBlock3(block: seal.resolve) }.catch { _ in ex2.fulfill() } wait(for: [ex1, ex2] ,timeout: 1) } #if swift(>=3.1) func testVoidCompletionValue() { let ex1 = expectation(description: "") let kf1 = KittenFetcher(value: nil, error: nil) Promise { seal in kf1.fetchWithCompletionBlock4(block: seal.resolve) }.done(ex1.fulfill).silenceWarning() let ex2 = expectation(description: "") let kf2 = KittenFetcher(value: nil, error: Error.test) Promise { seal in kf2.fetchWithCompletionBlock4(block: seal.resolve) }.catch { _ in ex2.fulfill() } wait(for: [ex1, ex2], timeout: 1) } #endif func testIsFulfilled() { XCTAssertTrue(Promise.value(()).result?.isFulfilled ?? false) XCTAssertFalse(Promise<Int>(error: Error.test).result?.isFulfilled ?? true) } func testPendingPromiseDeallocated() { // NOTE this doesn't seem to register the `deinit` as covered :( // BUT putting a breakpoint in the deinit CLEARLY shows it getting covered… class Foo { let p = Promise<Void>.pending() var ex: XCTestExpectation! deinit { after(.milliseconds(100)).done(ex.fulfill) } } let ex = expectation(description: "") do { // for code coverage report for `Resolver.deinit` warning let foo = Foo() foo.ex = ex } wait(for: [ex], timeout: 10) } func testVoidResolverFulfillAmbiguity() { #if !swift(>=5) && swift(>=4.1) || swift(>=3.3) && !swift(>=4.0) // ^^ this doesn’t work with Swift < 3.3 for some reason // ^^ this doesn’t work with Swift 5.0-beta1 for some reason // reference: https://github.com/mxcl/PromiseKit/issues/990 func foo(success: () -> Void, failure: (Error) -> Void) { success() } func bar() -> Promise<Void> { return Promise<Void> { (seal: Resolver<Void>) in foo(success: seal.fulfill, failure: seal.reject) } } let ex = expectation(description: "") bar().done(ex.fulfill).cauterize() wait(for: [ex], timeout: 10) #endif } } private enum Error: Swift.Error { case test }
[ 145530, 173403 ]
bba2b6f58eba793611e63a2bf523d09fd5d348f7
eee98b825847710e0c24465aa9fa9b01db14bc41
/Homework/LoginViewController.swift
ab99f12d4bee8bc3b436c5096e2a9eda0de1d97e
[]
no_license
tkukurin/Lab.Pokedex
912342fa9415e0d7ad931f293f7bf0e2f77eaf8a
febea2e3f78b9b10828550aeaa6ad6d3560ffe4a
refs/heads/master
2021-07-12T17:42:33.498588
2017-10-14T19:22:41
2017-10-14T19:22:41
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,224
swift
import UIKit import Unbox typealias UserLoginData = (email: String, password: String) class LoginViewController: UIViewController { @IBOutlet weak var emailTextField: UITextField! @IBOutlet weak var passwordTextField: UITextField! private var userDataLocalStorage: UserDataLocalStorage! private var loginRequest: ApiUserRequest! override func viewDidLoad() { super.viewDidLoad() userDataLocalStorage = Container.sharedInstance.get(UserDataLocalStorage.self) loginRequest = Container.sharedInstance.get(ApiUserRequest.self) // obviously debug-only emailTextField.text = "[email protected]" passwordTextField.text = "longpassword" } } extension LoginViewController { @IBAction func didTapLoginButton(sender: UIButton) { requireFilledTextFieldsAndGetData() .ifPresent(sendLoginRequest) } private func requireFilledTextFieldsAndGetData() -> Result<UserLoginData> { guard let email = emailTextField.text where !email.isEmpty else { AnimationUtils.shakeFieldAnimation(emailTextField) return Result.error() } guard let password = passwordTextField.text where !password.isEmpty else { AnimationUtils.shakeFieldAnimation(passwordTextField) return Result.error() } return Result.of((email, password)) } private func sendLoginRequest(userData: UserLoginData) { ProgressHud.show() loginRequest .setSuccessHandler(persistUserAndGoToHomescreen) .setFailureHandler({ ProgressHud.indicateFailure("Error logging in") }) .doLogin(userData) } private func persistUserAndGoToHomescreen(user: User) { ProgressHud.indicateSuccess() userDataLocalStorage.persistUser(emailTextField.text!, passwordTextField.text!) pushController(PokemonListViewController.self, injecting: { $0.loggedInUser = user }) } @IBAction func didTapRegisterButton(sender: AnyObject) { pushController(RegisterViewController.self) } }
[ -1 ]
346f6ebf39b495b09cbc1158335a1e5fbc92ea37
96b2502ba9a1177e6c95fd5eb787a7c9e7a2cd56
/samples/advancedSamples/KiffSample/source/KiffSimpleIosAppForTesting/ViewController.swift
fadcef5d0f45e3d325621e751e896d6a3746a6fa
[]
no_license
PerfectoCode/XcTest
af63cece67372acc9656388ff773f6eab3a47f12
8bc13dae4026aa605b133ad6604100b884fac9c9
refs/heads/master
2023-07-07T16:19:08.358442
2023-06-26T12:02:09
2023-06-26T12:02:09
108,244,537
0
1
null
2023-05-28T09:46:49
2017-10-25T08:53:47
null
UTF-8
Swift
false
false
1,250
swift
// // ViewController.swift // KiffSimpleIosAppForTesting // // Created by Igor Gindin on 21/11/2017. // Copyright © 2017 Perfecto Mobile. All rights reserved. // import UIKit class ViewController: UIViewController { // MARK: - Outlets @IBOutlet weak var txtSomeText: UITextField! @IBOutlet weak var lblSomeText: UILabel! @IBOutlet weak var lblSlider: UILabel! @IBOutlet weak var sldrSlider: UISlider! // MARK: - Actions @IBAction func btnSetNewtext(_ sender: UIButton) { // if txtSomeText.text != nil { lblSomeText.text = txtSomeText.text // } else { // lblSomeText.text = "" // } txtSomeText.text = "" } @IBAction func btnSetDefaultText(_ sender: UIButton) { lblSomeText.text = "Something" } @IBAction func slider(_ sender: UISlider) { lblSlider.text = String(Int(sender.value)) } 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. } }
[ -1 ]
5f68978c92c15d8dba35688df0eac27063fa8dbf
9a6a9128770504765458755dc29e582ddb0e0d7e
/Dogs/Networking/DogService.swift
c506d280f20d63af474fbb2429b21ec632a98894
[]
no_license
lucasalves08/Dogs
b07705547b4025e4e39130da6f362a2f20b500aa
0fe7a09d0d452c06e9a341b8370d7c8571b9024f
refs/heads/main
2023-06-27T00:15:21.705720
2021-07-19T23:35:49
2021-07-19T23:35:56
387,318,910
0
0
null
null
null
null
UTF-8
Swift
false
false
4,748
swift
// // DogService.swift // Dogs // // Created by Lucas Alves Dos Santos on 18/07/21. // import Foundation import UIKit class DogService: DogServiceProtocol { static let sharedInstance = DogService() var urlSession = URLSession.shared enum Endpoint { case listAllBreeds case randomImageForBreed(String) case randomImageForSuBreed(String, String) var url: URL { return URL(string: self.stringValue)! } var stringValue: String { switch self { case .listAllBreeds: return "https://dog.ceo/api/breeds/list/all" case .randomImageForBreed(let breed): return "https://dog.ceo/api/breed/\(breed)/images/random" case .randomImageForSuBreed(let breed, let subBreed): return "https://dog.ceo/api/breed/\(breed)/\(subBreed)/images/random" } } } //MARK: - Pega as racas func getBreedsList(completionHandler: @escaping([Breed]?, NSError?) -> Void) { let task = urlSession.dataTask(with: Endpoint.listAllBreeds.url) { (data, response, error) in guard let data = data, let httpResponse = response as? HTTPURLResponse else { completionHandler(nil, error as NSError?) return } switch httpResponse.statusCode { case 200..<300: let decoder = JSONDecoder() let breedsReponse = try! decoder.decode(BreedListResponse.self, from: data) let breeds = breedsReponse.breeds.map ({ response -> Breed in return Breed(name: response.key, subBreeds: response.value) }) completionHandler(breeds, nil) default: completionHandler(nil, error as NSError?) } } task.resume() } //MARK: - Pega as fotos aleatorias de uma raca func getRandomImage(breedName: String, completionHandler: @escaping (DogImageResponse?, NSError?) -> Void) { let randomImageEndPoint = Endpoint.randomImageForBreed(breedName).url let task = urlSession.dataTask(with: randomImageEndPoint) { (data, response, error) in guard let data = data, let httpResponse = response as? HTTPURLResponse else { completionHandler(nil, error as NSError?) return } switch httpResponse.statusCode { case 200..<300: let decoder = JSONDecoder() let imageData = try! decoder.decode(DogImageResponse.self, from: data) completionHandler(imageData, nil) default: completionHandler(nil, error as NSError?) } } task.resume() } //MARK: - Pega as fotos aleatorias de uma subraca func getRandomImageSubBreed(breed: String,subBreed:String, completionHandler: @escaping (DogImageResponse?, NSError?) -> Void) { let randomImageEndPoint = Endpoint.randomImageForSuBreed(breed, subBreed).url let task = urlSession.dataTask(with: randomImageEndPoint) { (data, response, error) in guard let data = data, let httpResponse = response as? HTTPURLResponse else { completionHandler(nil, error as NSError?) return } switch httpResponse.statusCode { case 200..<300: let decoder = JSONDecoder() let imageData = try! decoder.decode(DogImageResponse.self, from: data) completionHandler(imageData, nil) default: completionHandler(nil, error as NSError?) } } task.resume() } func getImageFile(url: URL, completionHandler: @escaping (UIImage?, NSError?) -> Void) { let task = urlSession.dataTask(with: url, completionHandler: { (data, _, error) in guard let data = data else { completionHandler(nil, error as NSError?) return } let downloadedImage = UIImage(data: data) completionHandler(downloadedImage, nil) }) task.resume() } } protocol DogServiceProtocol { func getBreedsList(completionHandler: @escaping([Breed]?, NSError?) -> Void) func getRandomImage(breedName: String, completionHandler: @escaping (DogImageResponse?, NSError?) -> Void) func getRandomImageSubBreed(breed: String,subBreed:String, completionHandler: @escaping (DogImageResponse?, NSError?) -> Void) func getImageFile(url: URL, completionHandler: @escaping (UIImage?, NSError?) -> Void) }
[ -1 ]
237e885ade6aabbc5dbc9f5722b76b3d9eee34a3
c6ee0b12e997df1c64a63965a20d11b3636423e0
/HeyTaxi/CustomerTaxiApp/UserInfoTableVC.swift
07c5384159bb7e5d30ddf6931d36eab748b5c1f2
[]
no_license
truongminhthang/HeyTaxi
333f394a47e85c9d6a3840182cf9a8e34ff4c0b4
82e88890d03f8bef470cc37807f5e6c22b3663f9
refs/heads/master
2021-01-20T16:50:38.151360
2017-02-23T06:55:37
2017-02-23T06:55:37
82,830,206
0
1
null
null
null
null
UTF-8
Swift
false
false
1,019
swift
// // UserInfoTableVC.swift // CustomerTaxiApp // // Created by Trương Thắng on 12/10/16. // Copyright © 2016 Trương Thắng. All rights reserved. // import UIKit enum UserInfoTableCellType: Int { case avatar case fullName case phoneNumber case gmail case connectFacebook case connectGoogle case favorite case subFavorite case userFile case subUserFile var indexCell: IndexPath { return IndexPath(row: self.rawValue, section: 0) } } class UserInfoTableVC: UITableViewController { override func viewDidLoad() { super.viewDidLoad() } } // MARK: - TableViewDelegate extension UserInfoTableVC { override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { guard let cellType = UserInfoTableCellType.init(rawValue: indexPath.row) else { return 0 } switch cellType { case .avatar: return 150 default: return 50 } } }
[ -1 ]
d4863aa4d06dcc89a1202aab56c10adf439d6cbc
33d3f3bc3e3057d27a5ac727e9cc9e7bd0b47663
/gradient/GradientTableViewCell.swift
3e1ab6f2d46229d762d9a8dc2c7c8a9338ef59db
[]
no_license
cnytayvaz/GradientTableViewCells
a399f085034f7cfdaae45ccb8fa82eb0df97ea02
b557def946d1369eeaa36b944d1c3fd992f52a35
refs/heads/main
2023-01-04T21:25:51.167037
2020-10-30T10:17:15
2020-10-30T10:17:15
308,593,308
0
0
null
null
null
null
UTF-8
Swift
false
false
768
swift
// // GradientTableViewCell.swift // gradient // // Created by Cüneyt Ayvaz on 29.10.2020. // import UIKit class GradientTableViewCell: UITableViewCell { @IBOutlet weak var label: UILabel! var blackView: UIVisualEffectView? override func awakeFromNib() { super.awakeFromNib() // Initialization code label.text = "Cüneyt Ayvaz" } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } } extension UITableViewCell { class var identifier: String { return String(describing: self) } class var nib: UINib { return UINib(nibName: identifier, bundle: nil) } }
[ -1 ]
92b08fcd0f8b39ac28f661ae0b2461803fa29e65
457f154c6997e4aac769b4025c1c2eb16111ebd9
/JSApp/JSMyAccount/RaveManager/controller/JSOpenAccountViewModel.swift
1ec5bad9e8193f60b5f90909f91194e98954f010
[]
no_license
yuheng5186/JW
9e2ef5dd3b40e0b27c4bda07da0190b80e95318e
084f8f46fdfb73484feb241c91cb0165bc07f6b7
refs/heads/master
2021-01-01T15:38:59.978419
2017-11-06T05:08:58
2017-11-06T05:08:58
97,667,464
0
0
null
null
null
null
UTF-8
Swift
false
false
225
swift
// // JSOpenAccountViewModel.swift // JSApp // // Created by 一言难尽 on 2017/5/23. // Copyright © 2017年 xiaofeng. All rights reserved. // import UIKit class JSOpenAccountViewModel: JSBaseViewModel { }
[ -1 ]
3942f26c1247f3adea6927d7165826692bf03845
6f0ae30a3c82a0f17c3aaa0361b882634809ad09
/Sources/Fuzzilli/Util/Misc.swift
0569d549d87f209066f444bcca85950f6d6e7204
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
permissive
ty5491003/fuzzilli
150723281c2b4a0253831b343945c8654b7ab65d
2423d53c6c745941b5114eff454a5e74e4a6d2f1
refs/heads/master
2020-11-24T17:42:28.744003
2019-12-17T02:11:09
2019-12-17T02:11:09
228,277,812
3
0
Apache-2.0
2019-12-16T01:19:29
2019-12-16T01:19:28
null
UTF-8
Swift
false
false
1,042
swift
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. import Foundation func temporaryDirectory() -> URL { return URL(fileURLWithPath: "/tmp") } func currentMillis() -> UInt64 { return UInt64(Date().timeIntervalSince1970 * 1000) } func uniqueElements<E>(of list: [E]) -> [E] where E: Hashable { return Array(Set(list)) } func measureTime<R>(_ operation: () -> R) -> (R, Double) { let start = Date() let r = operation() let end = Date() return (r, end.timeIntervalSince(start)) }
[ -1 ]
105e730e21c0082799c5d7159a0040c01a566b9c
6e0041bff20ae092fe82f9cc0452d03f91e5c2e5
/CoreDataPractice/AppDelegate.swift
56063da6abe25c51a84ff0bb36f27503c92a4910
[]
no_license
prufect/CoreDataPractice
8d87539f58e1b8ab3e37b35376faeff040f408ca
16e56f354687ec706bd5a4dc12fcf3c1e1081176
refs/heads/master
2021-10-25T09:56:03.227999
2019-04-03T18:19:05
2019-04-03T18:19:05
null
0
0
null
null
null
null
UTF-8
Swift
false
false
3,071
swift
// // AppDelegate.swift // CoreDataPractice // // Created by Prudhvi Gadiraju on 3/27/19. // Copyright © 2019 Prudhvi Gadiraju. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. UINavigationBar.appearance().isOpaque = false UINavigationBar.appearance().tintColor = .white UINavigationBar.appearance().barTintColor = .lightRed UINavigationBar.appearance().prefersLargeTitles = true UINavigationBar.appearance().largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white] UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white] let viewController = CompaniesVC() let navigationController = CustomNavigationController(rootViewController: viewController) window = UIWindow() window?.makeKeyAndVisible() window?.rootViewController = navigationController return true } func applicationWillResignActive(_ application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. } func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. // Saves changes in the application's managed object context before the application terminates. } }
[ 294924, 294950, 229415, 229417, 327722, 237613, 229422, 229426, 229428, 311349, 286774, 229432, 286776, 319544, 286778, 352318, 286791, 237640, 237646, 311375, 163920, 196692, 319573, 311383, 319590, 311400, 303212, 131192, 237693, 327814, 303241, 303244, 319633, 286873, 286876, 311460, 311469, 32944, 286906, 327866, 286910, 286916, 286924, 286926, 319694, 131281, 295133, 319716, 237807, 303345, 286962, 229622, 327930, 237826, 319751, 286987, 319757, 287003, 287006, 287009, 287012, 287014, 287016, 287019, 311598, 287023, 311601, 295220, 319809, 319810, 319814, 319818, 311628, 229709, 319822, 287054, 229717, 196963, 196969, 139638, 213367, 106872, 319872, 311683, 319879, 319898, 139689, 311728, 311741, 319938, 311746, 319945, 319947, 188895, 172512, 287202, 172520, 319978, 172526, 311791, 172529, 319989, 311804, 287230, 303617, 172550, 320007, 172552, 303623, 172558, 303632, 303637, 172572, 172577, 295459, 172581, 295461, 172591, 172607, 172612, 172614, 172618, 303690, 33357, 172634, 254563, 172644, 311911, 172656, 352880, 295538, 172660, 287355, 295553, 172675, 311942, 352905, 311946, 311951, 287377, 172691, 311957, 287381, 287386, 230045, 172702, 303773, 172705, 287394, 172707, 287398, 205479, 295595, 189102, 172721, 66227, 303797, 189114, 287419, 328381, 287423, 328384, 172748, 295633, 172755, 303827, 287450, 303835, 189149, 303838, 312035, 295654, 230128, 312048, 189169, 205564, 303871, 230146, 230154, 312077, 295695, 295701, 230169, 295707, 328476, 295710, 230175, 303914, 230202, 312124, 328508, 222018, 295755, 148302, 287569, 303959, 230237, 230241, 303976, 336744, 303985, 303987, 303991, 303997, 295806, 295808, 295813, 304005, 304007, 320391, 304009, 304011, 304013, 295822, 189329, 304019, 58262, 304042, 213931, 304055, 230327, 287675, 230334, 304065, 213954, 156612, 312272, 304090, 304106, 320490, 312302, 304114, 295928, 312321, 295945, 230413, 320528, 140312, 295961, 238620, 304164, 304170, 304175, 238655, 238658, 336964, 320584, 238666, 296021, 230497, 296036, 296040, 312432, 337018, 304258, 66690, 205968, 238745, 304285, 238756, 222377, 337067, 238766, 304311, 230592, 312518, 148690, 320727, 304348, 304354, 296163, 320740, 304360, 320748, 304370, 296189, 320771, 312585, 296205, 296213, 296215, 320792, 230689, 173350, 312622, 279857, 312630, 296253, 230718, 296255, 312639, 296262, 230727, 238919, 320840, 296264, 296267, 296271, 230739, 222556, 312676, 148843, 230763, 230768, 296305, 312692, 230773, 304505, 304506, 181631, 148865, 312711, 296331, 288140, 288144, 173472, 304555, 288176, 173488, 312755, 312759, 288185, 222652, 312766, 173507, 230860, 312783, 288208, 230865, 148946, 222676, 329177, 239070, 296435, 288250, 296446, 296450, 230916, 230919, 230923, 304651, 304653, 230940, 222752, 296486, 296488, 157229, 230961, 157236, 288320, 288325, 124489, 288338, 288344, 239194, 239202, 312938, 116354, 288408, 419489, 321195, 296622, 321200, 337585, 296634, 296637, 419522, 419525, 206536, 206539, 206541, 206543, 263888, 321239, 313052, 288478, 313055, 419555, 321252, 321266, 288499, 288502, 288510, 313093, 198405, 288519, 198416, 296723, 321304, 321311, 313121, 313123, 304932, 321316, 321336, 288576, 345921, 304968, 280393, 173907, 321381, 296809, 296812, 313201, 305028, 124817, 124827, 214940, 214944, 321458, 296883, 124853, 214966, 296890, 288700, 296894, 190403, 296900, 337862, 165831, 296921, 354265, 354270, 239586, 354281, 124913, 165876, 313340, 239612, 288764, 239617, 313347, 313358, 305168, 305176, 313371, 305191, 223273, 313386, 124978, 215090, 124980, 288824, 288826, 321595, 313406, 288831, 288836, 215123, 288859, 280669, 149599, 149601, 321634, 149603, 329830, 215154, 313458, 321659, 288895, 321670, 215175, 280725, 313498, 100520, 280747, 321717, 321740, 338147, 125171, 182517, 280825, 125187, 125191, 125207, 125209, 321842, 223539, 125239, 289087, 305480, 305485, 305489, 248153, 354653, 354656, 313700, 190832, 313720, 313731, 199051, 240011, 289166, 240017, 297363, 297365, 297372, 289186, 297391, 289201, 240052, 289207, 289210, 305594, 289218, 166378, 305647, 174580, 240124, 305662, 305664, 305666, 240132, 223749, 305668, 223752, 150025, 223757, 322074, 150066, 158266, 289342, 322115, 133713, 338532, 199273, 19053, 158317, 313973, 297594, 158347, 264845, 117398, 314007, 289436, 174754, 330404, 289448, 314033, 240309, 314047, 297671, 158409, 256716, 289493, 289513, 289522, 289532, 322303, 322310, 322314, 322318, 215850, 240458, 240468, 322393, 224110, 207733, 207737, 183172, 338823, 322440, 314249, 183184, 240535, 289687, 289694, 289696, 289700, 289712, 289724, 289762, 134142, 322563, 314372, 330764, 175134, 322599, 322610, 314421, 314427, 314433, 322630, 314441, 314456, 314461, 306341, 306347, 306354, 199877, 289991, 306377, 289997, 249045, 363742, 298216, 322801, 306427, 388350, 257302, 363802, 199976, 199978, 314671, 298292, 298294, 216376, 298306, 380226, 224587, 216404, 306517, 314714, 314718, 314723, 150890, 306539, 314732, 314736, 290161, 216436, 306549, 298358, 314743, 306552, 290171, 306555, 314747, 290174, 224641, 298372, 314756, 298377, 314763, 314768, 224657, 306581, 314773, 314779, 314785, 314793, 241068, 241072, 306608, 150966, 306618, 323015, 306635, 306640, 290263, 290270, 290275, 339431, 191985, 290291, 191992, 290298, 290302, 290305, 257550, 290321, 290325, 241175, 290328, 282137, 290332, 290344, 290349, 290351, 290356, 224849, 306778, 314979, 298598, 323176, 224875, 241260, 323181, 290445, 175770, 298651, 282269, 323229, 298655, 323260, 241362, 306904, 241380, 323318, 241412, 323333, 323345, 315167, 315169, 315174, 323367, 241448, 315184, 315190, 241464, 159545, 307009, 307012, 315211, 315221, 241496, 241498, 307035, 307040, 110433, 241509, 110438, 298860, 110445, 315253, 315255, 339838, 315267, 315269, 241544, 241546, 241548, 298896, 298898, 241556, 298901, 241560, 241563, 241565, 241567, 241569, 241574, 298922, 241581, 241583, 323504, 241586, 290739, 241588, 241590, 241592, 241598, 290751, 241600, 241605, 151495, 241610, 298975, 241632, 298984, 241643, 298988, 241646, 241649, 241652, 323574, 290807, 241661, 315396, 241669, 315397, 290835, 241693, 102438, 290877, 315463, 315466, 192589, 315482, 217179, 315483, 192605, 233567, 200801, 299105, 217188, 307303, 315495, 307307, 315502, 192624, 307314, 299126, 233591, 307329, 307338, 233613, 307352, 299164, 241821, 299167, 315557, 184486, 307370, 307372, 307374, 307376, 299185, 323763, 307385, 307388, 299200, 307394, 299204, 307396, 184518, 307399, 323784, 307409, 307411, 299225, 233701, 307432, 291104, 315701, 307510, 332086, 151864, 307515, 151874, 323917, 233808, 323921, 315733, 323926, 233815, 315739, 299357, 242018, 242024, 299373, 242043, 299391, 291202, 242057, 291212, 299405, 291222, 315801, 242075, 291231, 61855, 291238, 291241, 127403, 127405, 127407, 291247, 127413, 291254, 127417, 291260, 127421, 127424, 299457, 127429, 291269, 315856, 315860, 127447, 299481, 127457, 291299, 127463, 291305, 127466, 176620, 127469, 127474, 135672, 233979, 291323, 291330, 127494, 127497, 135689, 233994, 127500, 233998, 127506, 234003, 234006, 127511, 152087, 234010, 135707, 242202, 135710, 242206, 242208, 291361, 152118, 234038, 234041, 315961, 70213, 111193, 242275, 299620, 242279, 135805, 135808, 299655, 316051, 316054, 135834, 135839, 135844, 299684, 242343, 242345, 135870, 135873, 135876, 135879, 299720, 299723, 299726, 299750, 234219, 316151, 242431, 299778, 234246, 291601, 234258, 242452, 201496, 234264, 234266, 234272, 152355, 299814, 185138, 234296, 160572, 316233, 316235, 234319, 308063, 234336, 242530, 349027, 234344, 324464, 152435, 177011, 234356, 291711, 201603, 291716, 234373, 308105, 324490, 324504, 209818, 308123, 234396, 324508, 291742, 291747, 291748, 234405, 291750, 324518, 324522, 291754, 291756, 324527, 291760, 201650, 324531, 324536, 291773, 242623, 324544, 324546, 234434, 324548, 234464, 168935, 324585, 316400, 234481, 234485, 234487, 316416, 308226, 308231, 300054, 234520, 234526, 300069, 234540, 234546, 300085, 234553, 316479, 234561, 308291, 316483, 234563, 316491, 300108, 234574, 300115, 242777, 234593, 234597, 300133, 234605, 234610, 316530, 300148, 144506, 234620, 177293, 234640, 308373, 324757, 234647, 234648, 234650, 308379, 300189, 324766, 119967, 324768, 242852, 300197, 177318, 234667, 316596, 234687, 300226, 234692, 300229, 234695, 300234, 300238, 300241, 316625, 300243, 300245, 316630, 300248, 300253, 300256, 300258, 300260, 300263, 300265, 300267, 300270, 300272, 300278, 275703, 316663, 300284, 275710, 300287, 292097, 300289, 161027, 300292, 300294, 275719, 234760, 177419, 300299, 242957, 275725, 349451, 177424, 349464, 415009, 300344, 300357, 316758, 357722, 316766, 292192, 316768, 292197, 316774, 333178, 316803, 316811, 316814, 300433, 234899, 357783, 316824, 316826, 300448, 144810, 144814, 292279, 144826, 144830, 144832, 144837, 144839, 144841, 144844, 144847, 144852, 103899, 300507, 333280, 218597, 292329, 300523, 300527, 308720, 292338, 316917, 292343, 300537, 308757, 308762, 316959, 284194, 284196, 235045, 284199, 235047, 284204, 284206, 284209, 284211, 284213, 194101, 284215, 194103, 316983, 284218, 292414, 284226, 243268, 292421, 284231, 284234, 317004, 284238, 284241, 292433, 284243, 300628, 284245, 284247, 284249, 292452, 292454, 292458, 292461, 284272, 284274, 284278, 292470, 292473, 284283, 284286, 292479, 284288, 292481, 284290, 325250, 284292, 292485, 284297, 284299, 317068, 284301, 284303, 284306, 284308, 284312, 284314, 284316, 284320, 284322, 284327, 284329, 317098, 284331, 284333, 284335, 284337, 284339, 300726, 284343, 284346, 284350, 358080, 284354, 358083, 284358, 358089, 284362, 284370, 317138, 284372, 358098, 358114, 358116, 358119, 325353, 358122, 358126, 358128, 358133, 358135, 358138, 300795, 358140, 358142, 358146, 317187, 317189, 317191, 300816, 300819, 317207, 300830, 300832, 325408, 317221, 358183, 243504, 325436, 153417, 292681, 358224, 317271, 292700, 292715, 300912, 292721, 300915, 292729, 317306, 292734, 325512, 358292, 317332, 399252, 350106, 358312, 317353, 358326, 358330, 301011, 301013, 292823, 301015, 292828, 292839, 292843, 325624, 317435, 350218, 350222, 317456, 317458, 178195, 243733, 243740, 317468, 325666, 243751, 243762, 309298, 325685, 325689, 235579, 325692, 235581, 243779, 243785, 350293, 350295, 309337, 350302, 178273, 309346, 194660, 309348, 309350, 350308, 292968, 350313, 309354, 301163, 350316, 309352, 301167, 350321, 350325, 350328, 292985, 350332, 292989, 292993, 317570, 350339, 350342, 350345, 350349, 325777, 350354, 350357, 350359, 350362, 350366, 153765, 350375, 350379, 350381, 350383, 350385, 350387, 350389, 350395, 350397, 350399, 350402, 301252, 350406, 309450, 309455, 309462, 301272, 194780, 309468, 309471, 301283, 317672, 317674, 325867, 325910, 342298, 309530, 211241, 325943, 235853, 235858, 391523, 293227, 293232, 186744, 211324, 366983, 317833, 178575, 178583, 317853, 342434, 317858, 317864, 235955, 293304, 293307, 293314, 317910, 293336, 235996, 317917, 293343, 293346, 293352, 293364, 293370, 301562, 317951, 309764, 301575, 342541, 113167, 309779, 317971, 309781, 236056, 293417, 227882, 309804, 236082, 23094, 301636, 318020, 301639, 301643, 309844, 309849, 326244, 309871, 121458, 309885, 309888, 301706, 318092, 326285, 334476, 318108, 318110, 137889, 383658, 318128, 293555, 318132, 318144, 342745, 137946, 342747, 342749, 113378, 342760, 56043, 56059, 310015, 310029, 326430, 293666, 293677, 318253, 301880, 301884, 293696, 310080, 162643, 310100, 301911, 301921, 400236, 236397, 162671, 236408, 416639, 416640, 113538, 416648, 301972, 424853, 310179, 293802, 236460, 293820, 342994, 318442, 326638, 351217, 318450, 293876, 285686, 302073, 121850, 56313, 293882, 293899, 302105, 293917, 293939, 318516, 310336, 293956, 293960, 203857, 310355, 310359, 236632, 310374, 318573, 367737, 302205, 392326, 162964, 384148, 187542, 302231, 302233, 285852, 302237, 285854, 285856, 302241, 64682, 302258, 294072, 318651, 318657, 130244, 302285, 302288, 310481, 302292, 302294, 302296, 310498, 302315, 294132, 138485, 204026, 64768, 310531, 285999, 318773, 318776, 302403, 294221, 326991, 294246, 327015, 310632, 327017, 351594, 351607, 310651, 310657, 310659, 351619, 253320, 310665, 318858, 310672, 351633, 310689, 130468, 310703, 310710, 130486, 310712, 228799, 302534, 245191, 310727, 302541, 302543, 310737, 310749, 310755, 310764, 310772, 40440, 40443, 286203, 40448, 302614, 302621, 286240, 146977, 187939, 40484, 286246, 294439, 294440, 40488, 40486, 40491, 294443, 294445, 245288, 310831, 40499, 40502, 212538, 40507, 40511, 327240, 40521, 40525, 40527, 212560, 40533, 40537, 40539, 40541, 40544, 40550, 40552, 40554, 310892, 40557, 40560, 188022, 294521, 343679, 294537, 327333, 229030, 319153, 302781, 302789, 294599, 294601, 302793, 212690, 286420, 286425, 319194, 294625, 294634, 319226, 286460, 302852, 302854, 294664, 311048, 319243, 302862, 294682, 294701, 319280, 229192, 302925, 188247, 188252, 237409, 294785, 327554, 360322, 319390, 237470, 40865, 319394, 311209, 188340, 294844, 294847, 393177, 294876, 294879, 393190, 237555, 311283, 237562 ]
92970e22f81625c75f31ef4171a16330649a464b
62138b29673429a34b23aeb56583cd5c17151b48
/Xumple-mobile/Xumple/modules/auth/AuthNetworking.swift
071679f14fcf63ee2c2c0955351996dab27c5140
[ "Apache-2.0" ]
permissive
deftonelx/xumple
7315e68f4db1f478154b2726faee4992032902c5
a64c04461505f789a8732297617f74c3b0e6f755
refs/heads/main
2023-04-22T12:52:44.120271
2021-05-06T13:54:42
2021-05-06T13:54:42
null
0
0
null
null
null
null
UTF-8
Swift
false
false
4,187
swift
// // AuthNetworking.swift // Xumple // // Created by Vitaliy Paliy on 4/18/21. // import Foundation import Alamofire import SwiftJWT class AuthNetworking { private var phoneNumber = "" private var OTPCode = "" func verifyOTPCode(_ code: String) -> Bool { return code == OTPCode } func getPhoneNumber() -> String { return phoneNumber } private func generateJWT() -> String? { struct MyClaims: Claims { var phoneNumber: String } var myJWT = JWT(claims: MyClaims(phoneNumber: phoneNumber)) var token: String let signer = JWTSigner.hs256(key: Data("PvXL1GPo3oAYOuMeqX0Jy9uqpWqx3AAwcHg4".utf8)) do { token = try myJWT.sign(using: signer) } catch { return nil } return token } func sendOTP(_ phoneNumber: String, completion: @escaping (APIError?) -> Void) { self.phoneNumber = "+"+phoneNumber guard let token = generateJWT() else { completion(APIError(descriptipion: "Internal server error. Please try again later", code: 500)) return } let headers: HTTPHeaders = ["Authorization": "Bearer " + token] AF.request(App.website+"auth/send-otp?phoneNumber="+phoneNumber, method: .get, parameters: nil, encoding: JSONEncoding.default, headers: headers).responseJSON { (response) in guard let responseData = response.data, let response = response.response else { completion(APIError(descriptipion: "Internal server error. Please try again later", code: 500)) return } let statusCode = response.statusCode do { let data = try JSONDecoder().decode(AuthResponse.self, from: responseData) if data.message == nil && data.otpCode != nil { self.OTPCode = data.otpCode! completion(nil) } else { completion(APIError(descriptipion: data.message!, code: statusCode)) } } catch { completion(APIError(descriptipion: error.localizedDescription, code: 500)) } } } func signInUser(completion: @escaping (APIError?) -> Void) { guard let token = generateJWT() else { completion(APIError(descriptipion: "Internal server erorr. Please try again later", code: 500)) return } let headers: HTTPHeaders = ["Authorization": "Bearer " + token] let params: Parameters = ["phone_number": phoneNumber] AF.request(App.website+"auth/sign-in", method: .post, parameters: params, encoding: JSONEncoding.default, headers: headers).responseJSON { (response) in completion(self.authHandler(response)) } } func registerUser(_ username: String, completion: @escaping (APIError?) -> Void) { guard let token = generateJWT() else { completion(APIError(descriptipion: "Internal server erorr. Please try again later", code: 500)) return } let headers: HTTPHeaders = ["Authorization": "Bearer " + token] let params: Parameters = ["phone_number": phoneNumber, "username": username] AF.request(App.website+"auth/register-account", method: .post, parameters: params, encoding: JSONEncoding.default, headers: headers).responseJSON { (response) in completion(self.authHandler(response)) } } private func authHandler(_ response: AFDataResponse<Any>) -> APIError? { guard let responseData = response.data, let res = response.response else { return APIError(descriptipion: "Internal server erorr. Please try again later", code: 500) } let statusCode = res.statusCode do { if statusCode == 200 { let data = try JSONDecoder().decode(User.self, from: responseData) if UserDefaults.standard.encodeUser(data), let user = UserDefaults.standard.getUser() { App.setCurrentUser(user) return nil } return APIError(descriptipion: "Internal server erorr. Please try again later", code: 500) } else { let data = try JSONDecoder().decode(AuthResponse.self, from: responseData) return APIError(descriptipion: data.message ?? "An error occured", code: statusCode) } } catch { return APIError(descriptipion: error.localizedDescription, code: 500) } } }
[ -1 ]
7a5cc1da77051ca14855d2489fcdb820aac5e3c7
af1c8c425b12607d6b7cc792308d353098d33652
/TourProgect#1/RecomendedViewController.swift
919f59e43962c8df6273d3bf843c343c153f164e
[]
no_license
PashaKharambura/TourProgect-1
24f24480d9bb898b222697c0bfaf268c0a9beef9
03ff330bcc87ee21014da26eaed144cfacc6d8ee
refs/heads/master
2021-01-01T15:58:12.725119
2017-08-16T20:54:43
2017-08-16T20:54:43
97,746,715
0
3
null
2017-07-27T18:58:46
2017-07-19T18:05:08
Swift
UTF-8
Swift
false
false
1,432
swift
// // RecomendedViewController.swift // TourProgect#1 // // Created by Pavlo Kharambura on 7/24/17. // Copyright © 2017 Pavlo Kharambura. All rights reserved. // import UIKit import XLPagerTabStrip class RecomendedViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, IndicatorInfoProvider { @IBOutlet weak var tourTableView: UITableView! var myTours = ["First", "Second"] override func viewDidLoad() { super.viewDidLoad() self.tourTableView.delegate = self; self.tourTableView.dataSource = self; } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) self.navigationController?.setNavigationBarHidden(true, animated: animated) } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return myTours.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "recomendedToursCell")! as! RecomendedTableViewCell cell.tourImage.image = UIImage(named: "\(indexPath.row+1)") return cell } func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo { return IndicatorInfo(title: "Рекомендовані тури") } }
[ -1 ]
4b28cd7f42554f4afabf9b530a73d466a21afa3e
2ae45c6d84fc7db728917cc6f258c71d25c082c8
/SnappyChat/CameraVC.swift
2065ca6ee9eac6f0d513d6ed54fa777f2af4a784
[]
no_license
hespinola/SnappyChat
e4ea6cb0d3bd00a524c1a73686d0df5bdbd261ad
625bd688a0a8cf27f4c5a37ee705033cc86bba64
refs/heads/master
2021-01-23T15:05:33.076403
2017-09-07T06:22:55
2017-09-07T06:22:55
102,698,693
0
0
null
null
null
null
UTF-8
Swift
false
false
4,913
swift
// // CameraVC.swift // SnappySnap // // Created by Isomi on 4/23/17. // Copyright © 2017 Humberto Espinola. All rights reserved. // import UIKit import Panel import CameraManager class CameraVC: UIViewController { // MARK: - UI Elements @IBOutlet weak var cameraView: UIView! @IBOutlet weak var snapButton: UIButton! @IBOutlet weak var changeCameraButton: UIButton! @IBOutlet weak var flashButton: UIButton! @IBOutlet weak var leftPanelButton: UIButton! @IBOutlet weak var rightPanelButton: UIButton! // MARK: - Class Members private let cameraManager = CameraManager() private var flashActivatedImage: UIImage! private var flashAutoImage: UIImage! var panelDelegate: PanelViewControllerDelegate? // MARK: - Override controller life-cycle override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. _ = cameraManager.addPreviewLayerToView(cameraView, newCameraOutputMode: .stillImage) cameraManager.cameraOutputQuality = .high cameraManager.flashMode = .auto cameraManager.writeFilesToPhoneLibrary = false cameraManager.shouldRespondToOrientationChanges = false flashActivatedImage = UIImage(named: "flash_btn") flashAutoImage = UIImage(named: "flash_auto_btn") } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) if cameraManager.currentCameraStatus() == .accessDenied || cameraManager.currentCameraStatus() == .noDeviceFound || cameraManager.currentCameraStatus() == .notDetermined { let alert = UIAlertController(title: "Oops!", message: "Camera is disabled", preferredStyle: .alert) alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) present(alert, animated: true, completion: nil) return } cameraManager.resumeCaptureSession() } override func viewDidDisappear(_ animated: Bool) { super.viewDidDisappear(animated) cameraManager.stopCaptureSession() } @IBAction func snapButtonTapped(_ sender: Any) { if cameraManager.cameraIsReady { cameraManager.capturePictureWithCompletion({ (image, error) in if let image = image { self.performSegue(withIdentifier: "EditImageVC", sender: image) } }) } else { let alert = UIAlertController(title: "Oops!", message: "Camera is not available", preferredStyle: .alert) alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) present(alert, animated: true, completion: nil) } } @IBAction func changeCameraButtonTapped(_ sender: Any) { if !cameraManager.hasFrontCamera { return } cameraManager.cameraDevice = cameraManager.cameraDevice == .back ? .front : .back } @IBAction func flashButtonTapped(_ sender: Any) { // Check if device can use flash if !cameraManager.hasFlash { let alert = UIAlertController(title: "Oops!", message: "Can't use flash", preferredStyle: .alert) alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) present(alert, animated: true, completion: nil) return } switch (cameraManager.changeFlashMode()) { case .off: flashButton.setImage(flashActivatedImage, for: .normal) flashButton.alpha = 0.5 break case .on: flashButton.setImage(flashActivatedImage, for: .normal) flashButton.alpha = 1 break case .auto: flashButton.setImage(flashAutoImage, for: .normal) flashButton.alpha = 1 break } } @IBAction func leftPanelButtonTapped(_ sender: Any) { panelDelegate?.PanelViewControllerAnimateTo(panel: .left) } @IBAction func rightPanelButtonTapped(_ sender: Any) { panelDelegate?.PanelViewControllerAnimateTo(panel: .right) } // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. if segue.identifier == "EditImageVC" { if let editImageVC = segue.destination as? EditImageVC { if let image = sender as? UIImage { editImageVC.image = image } } } } }
[ -1 ]
e4d4fbd0edaee703f2d0ce1d0dd3a1acba05f3c7
2b23543f01751f9829c0c43bb0bb39c13accaf29
/Project/SettingsViewController.swift
b5a0945b363ddb655ee53f0da496749034423445
[]
no_license
dorianbizgan/audify
cbfb806986e72111ca4b4d4b9dd90e7a75d3b7e6
4787370c7c868816b1b405803a217be99332f5c7
refs/heads/main
2023-08-04T19:48:03.969603
2021-09-30T19:45:32
2021-09-30T19:45:32
304,753,615
1
0
null
null
null
null
UTF-8
Swift
false
false
1,413
swift
// // SettingsViewController.swift // Project // // Created by Dorian Bizgan on 7/8/20. // Copyright © 2020 Dorian Bizgan. All rights reserved. // import UIKit class SettingsViewController: UIViewController { @IBOutlet weak var voiceCategoryControl: UISegmentedControl! @IBOutlet weak var voiceGenderControl: UISegmentedControl! @IBOutlet weak var speedControl: UISegmentedControl! override func viewDidLoad() { super.viewDidLoad() let defaults = UserDefaults.standard print(defaults.integer(forKey: "voiceCategoryPreference")) print(defaults.integer(forKey: "voiceGenderPreference")) let voiceCategoryPreference = defaults.integer(forKey: "voiceCategoryPreference") let voiceGenderPreference = defaults.integer(forKey: "voiceGenderPreference") voiceCategoryControl.selectedSegmentIndex = voiceCategoryPreference voiceGenderControl.selectedSegmentIndex = voiceGenderPreference } override func viewWillDisappear(_ animated: Bool) { let category = voiceCategoryControl.selectedSegmentIndex let gender = voiceGenderControl.selectedSegmentIndex let defaults = UserDefaults.standard // set user voice defaults defaults.set(category, forKey: "voiceCategoryPreference") defaults.set(gender, forKey: "voiceGenderPreference") } }
[ -1 ]
516e2835300cbe8fc53a2e0181376c5d30b23091
9e0cb12a41ff1ca7fecfde999f2c023e61e926c0
/ANT_iOS/Modules/Farm/webthing/WebThingsViewController.swift
65fb49190f52bd74d1c19079034cd5bf9a6a0392
[]
no_license
CaoYutian/ANT_Swift
52b733fa486e0def282264a9f1b37accda484b33
40ca454f31618b9dbebfb909925c249e22a8e507
refs/heads/master
2021-01-21T21:38:37.846930
2017-06-20T06:38:17
2017-06-20T06:38:17
null
0
0
null
null
null
null
UTF-8
Swift
false
false
3,629
swift
// // WebThingsViewController.swift // ANT_iOS // // Created by 宇玄丶 on 2017/6/7. // Copyright © 2017年 qianmo. All rights reserved. // import UIKit class WebThingsViewController: BaseViewController { override func loadSubViews() { super.loadSubViews() self.titleLabel.text = "物联网" self.contentView.addSubview(webView) } override func layoutConstraints() { webView.snp.makeConstraints { (make) in make.edges.equalTo(self.view).inset(UIEdgeInsetsMake(64, 0, 0, 0)); } } override func loadData() { let path = Bundle.main.path(forResource: "webthing/webthing", ofType: "html") let request = NSURLRequest.init(url: NSURL.fileURL(withPath: path!)) self.webView.loadRequest(request as URLRequest) } func longPressed(recognizer: UITapGestureRecognizer) { if recognizer.state == .began { print("长按响应开始") let touchPoint: CGPoint = recognizer.location(in: self.webView) let js = "document.elementFromPoint(\(touchPoint.x), \(touchPoint.y)).src" let urlToSave: String = self.webView.stringByEvaluatingJavaScript(from: js)! print(urlToSave) let alertController = UIAlertController(title: "温馨提示", message: "是否要保存图片?", preferredStyle: .alert) let confirm = UIAlertAction(title: "确定", style: .destructive, handler: { (alertController:UIAlertAction) in // let data = NSData.init(contentsOf: NSURL.init(string: urlToSave)! as URL) // let image = UIImage.init(data: data! as Data) // UIImageWriteToSavedPhotosAlbum(image!, self, #selector(WebThingsViewController.iamge(image:didFinishSavingWithError:contextInfo:)), nil) }) let cancel = UIAlertAction(title: "取消", style: .cancel, handler: nil) alertController.addAction(confirm) alertController.addAction(cancel) self.present(alertController, animated: true, completion: nil) }else { print("长按响应结束") } } func iamge(image: UIImage, didFinishSavingWithError error:NSError?, contextInfo: AnyObject) { if error != nil { } } lazy var webView: UIWebView = { let webView = UIWebView() webView.backgroundColor = UIColor.white webView.delegate = self webView.scalesPageToFit = false webView.isOpaque = false webView.scrollView.showsVerticalScrollIndicator = false let longPressed = UILongPressGestureRecognizer.init(target: self, action: #selector(WebThingsViewController.longPressed(recognizer:))) longPressed.minimumPressDuration = 0.3 longPressed.numberOfTouchesRequired = 1 longPressed.delegate = self webView.addGestureRecognizer(longPressed) return webView }() } extension WebThingsViewController: UIWebViewDelegate, UIScrollViewDelegate, UIGestureRecognizerDelegate { func webViewDidStartLoad(_ webView: UIWebView) { } func webViewDidFinishLoad(_ webView: UIWebView) { self.webView.stringByEvaluatingJavaScript(from: "document.documentElement.style.webkitUserSelect='none';") self.webView.stringByEvaluatingJavaScript(from: "document.documentElement.style.webkitTouchCallout='none';") } func webView(_ webView: UIWebView, didFailLoadWithError error: Error) { } }
[ -1 ]
6d408a68961d4583c260176b93522664d2634515
27baaea4e9a34f43e4d7287113935a6e0b61c9dd
/Locus/FollowersPinCell.swift
979479b6d1ea7ddb6e59940d3affe21f912a1d7b
[]
no_license
nkhaja/locus
49d506bccafb683756cb80cc55612b72efae30a4
ad5a4765659f9fa178ad0ee795dd80d73459e0a5
refs/heads/master
2021-01-12T04:55:28.487389
2017-04-18T07:00:57
2017-04-18T07:00:57
77,811,173
0
0
null
null
null
null
UTF-8
Swift
false
false
542
swift
// // FollowersPinCell.swift // Locus // // Created by Nabil K on 2017-02-26. // Copyright © 2017 MakeSchool. All rights reserved. // import UIKit class FollowersPinCell: UICollectionViewCell { var overlayButtonView: OverlayButtonView! var indexPath: IndexPath? var personal: Bool = true @IBOutlet weak var pinImageView: UIImageView! override func prepareForReuse() { super.prepareForReuse() pinImageView.sd_cancelCurrentImageLoad() pinImageView.image = nil } }
[ -1 ]
a399338beaa52eb0354aaafa5877a3c84fc9212d
0947afa8851f170d10db79f39641636fb46e16b7
/InstgramCopy/API/APIService.swift
cc9c6badcd3ffa1c476a794f6bbdeb0e4c71f106
[]
no_license
q55915721/InstagramClone
dc7ee12ad5fe1cf90f2274868f4c287de686d4ad
1fdd8fd1388e58ba2e3cc05cb6c4494080ab7f1f
refs/heads/master
2020-04-16T07:01:31.726243
2019-01-28T08:32:13
2019-01-28T08:32:13
165,370,844
0
0
null
null
null
null
UTF-8
Swift
false
false
8,000
swift
// // APIService.swift // InstgramCopy // // Created by 洪森達 on 2018/12/30. // Copyright © 2018 洪森達. All rights reserved. // import Foundation import Firebase class APIService { static let shard = APIService() func signInWith(email:String,passwords:String ,completion:@escaping(_ error:Error?)->()){ Auth.auth().signIn(withEmail: email, password: passwords) { (firuser, error) in if let err = error { completion(err) return } completion(nil) } } func registerUser(_email:String,_passwords:String,userName:String,image:UIImage,completion:@escaping(_ error:Error?)->()){ Auth.auth().createUser(withEmail: _email, password: _passwords) { (firUser, error) in if let err = error { print(err.localizedDescription) completion(err) return } self.uploadImg(img: image, completion: { (error, urlstring) in if let error = error { completion(error) return } guard let uid = firUser?.user.uid else {return} guard let profileUrl = urlstring else {return} guard let FcmToken = Messaging.messaging().fcmToken else {return} let date = ["uid":uid,"email":_email,"userName":userName,"Profile_image":profileUrl,"fcmToken":FcmToken] self.updateUserInfo(uid: uid, data: date, completion: completion) }) } } func uploadImg(img:UIImage,completion:@escaping (_ error:Error?,_ urlString:String?)->()){ guard let imgDate = img.jpegData(compressionQuality: 0.7) else {return} let fileName = UUID().uuidString let ref = Storage.storage().reference().child("Profile_img").child(fileName) ref.putData(imgDate, metadata: nil) { (_, error) in if let error = error { print(error.localizedDescription) completion(error,nil) return } ref.downloadURL(completion: { (url, error) in if let error = error { completion(error,nil) } guard let string = url?.absoluteString else {return} completion(nil,string) }) } } func updateUserInfo(uid:String,data:[String:Any],completion:@escaping(_ error:Error?)->()){ Database.database().reference().child("Users").child(uid).updateChildValues(data) { (error, drf) in if let error = error { completion(error) return } completion(nil) } } func updatePostFromUser(image:UIImage,text:String,completion:@escaping(_ error:Error?)->()){ uploadImg(img: image) { (error, imageUrl) in if let error = error { completion(error) return } guard let imageUrlString = imageUrl else {return} let width = image.size.width let height = image.size.height let today = Date().timeIntervalSince1970 guard let uid = Auth.auth().currentUser?.uid else {return} let data = ["ImgUrl":imageUrlString,"imageWidth":width,"imageHeight":height,"postDate":today,"text":text] as [String : Any] let userRef = Database.database().reference().child("Posts").child(uid) userRef.childByAutoId().updateChildValues(data, withCompletionBlock: { (error, rf) in if let error = error { completion(error) return } completion(nil) }) } } func fetchPosts(user:User,completion:@escaping(_ error:Error? ,_ posts:[Post])->()){ var posts = [Post]() guard let uid = user.uid else {return} let ref = Database.database().reference().child("Posts").child(uid) ref.queryOrdered(byChild: "postDate").observe(.childAdded) { (snap) in guard let dic = snap.value as? [String:Any] else {return} let post = Post(user: user, _dictionary: dic) posts.insert(post, at: 0) completion(nil,posts) } } func fetchPostsForHomeFeed(user:User,completion:@escaping(_ error:Error? ,_ posts:[Post])->()){ var posts = [Post]() guard let uid = user.uid else {return} let ref = Database.database().reference().child("Posts").child(uid) ref.observeSingleEvent(of: .value) { (snap) in guard let dic = snap.value as? [String:Any] else {return} dic.forEach({ (key,value) in guard let dictionaris = value as? [String:Any] else {return} let post = Post(user: user, _dictionary: dictionaris) posts.append(post) }) } } func fetchUserFromUid(uid:String,comletion:@escaping (_ user:User?)->()){ Database.database().reference().child("Users").child(uid).observeSingleEvent(of: .value) { (snapshot) in guard let data = snapshot.value as? [String:Any] else {return} let user = User(_dictionary: data) comletion(user) } } func fetchUsersFromDatabase(completion:@escaping (_ Users:[User])->()){ var users = [User]() guard let uid = Auth.auth().currentUser?.uid else {return} Database.database().reference().child("Users").observeSingleEvent(of: .value) { (snapshot) in guard let dic = snapshot.value as? [String:Any] else {return} dic.forEach({ (key,value) in if key == uid { return } guard let userDic = value as? [String:Any] else {return} let user = User(_dictionary: userDic) users.append(user) completion(users) }) } } func tofollowUser(currentUid:String,followeID:String,completion: @escaping (_ error:Error?)->()){ Database.database().reference().child("Follows").child(currentUid).updateChildValues([followeID:1] as [String:Any]) { (error, ref) in if let err = error { completion(err) return } } } func followORUnFollow(currentUid:String,followeID:String,completion: @escaping (_ ifFollow:Bool)->()){ Database.database().reference().child("Follows").child(currentUid).child(followeID).observeSingleEvent(of: .value) { (snapshot) in if snapshot.exists() { completion(true) }else{ completion(false) } } } func toUnFollow(currentUid:String,followeID:String,completion: @escaping (_ error:Error?)->()){ Database.database().reference().child("Follows").child(currentUid).child(followeID).removeValue { (errpr, _) in if let err = errpr { completion(err) return } } } func uploadToComments(value:[String:Any],post:Post,completion:@escaping(_ error:Error?)->()){ guard let postid = post.postId else {return} let ref = Database.database().reference().child("Comments").child(postid) ref.childByAutoId().updateChildValues(value) { (error, _) in if let err = error { completion(err) return } } } }//end of the class.
[ -1 ]
2a524db4001d7bf4bbfd9c08194c534c5208e0d0
7d21abeac9a0f553e715866d772eeeef35af65c4
/05-2 MultiComponentPickerView/MultiComponentPickerView/SceneDelegate.swift
70916c01c4b02cef15083dfcab72e5f986895d9b
[]
no_license
Soojung-Shin/do-it-swift
3725a649b69b4693fde204325dd8666348aa94b1
f9869856470a42cc504364c5a40575b4a5d30b2d
refs/heads/master
2020-09-12T13:02:53.289536
2019-11-22T14:20:16
2019-11-22T14:20:16
222,434,036
0
0
null
null
null
null
UTF-8
Swift
false
false
2,372
swift
// // SceneDelegate.swift // 05-2 MultiComponentPickerView // // Created by Soojung Shin on 2019/11/18. // Copyright © 2019 Soojung Shin. All rights reserved. // import UIKit class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). guard let _ = (scene as? UIWindowScene) else { return } } func sceneDidDisconnect(_ scene: UIScene) { // Called as the scene is being released by the system. // This occurs shortly after the scene enters the background, or when its session is discarded. // Release any resources associated with this scene that can be re-created the next time the scene connects. // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). } func sceneDidBecomeActive(_ scene: UIScene) { // Called when the scene has moved from an inactive state to an active state. // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. } func sceneWillResignActive(_ scene: UIScene) { // Called when the scene will move from an active state to an inactive state. // This may occur due to temporary interruptions (ex. an incoming phone call). } func sceneWillEnterForeground(_ scene: UIScene) { // Called as the scene transitions from the background to the foreground. // Use this method to undo the changes made on entering the background. } func sceneDidEnterBackground(_ scene: UIScene) { // Called as the scene transitions from the foreground to the background. // Use this method to save data, release shared resources, and store enough scene-specific state information // to restore the scene back to its current state. } }
[ 393221, 163849, 393228, 393231, 393251, 352294, 344103, 393260, 393269, 213049, 376890, 385082, 16444, 393277, 376906, 327757, 254032, 286804, 368728, 180314, 254045, 368736, 180322, 376932, 286833, 286845, 286851, 417925, 262284, 360598, 286880, 286889, 377003, 377013, 164029, 327872, 180418, 377030, 377037, 180432, 377047, 418008, 385243, 418012, 377063, 327915, 205037, 393457, 393461, 393466, 418044, 336124, 385281, 336129, 262405, 180491, 336140, 164107, 262417, 368913, 262423, 377118, 377121, 262437, 254253, 336181, 262455, 393539, 262473, 344404, 213333, 418135, 270687, 262497, 418145, 262501, 213354, 246124, 262508, 262512, 213374, 385420, 262551, 262553, 385441, 385444, 262567, 385452, 262574, 393649, 385460, 262587, 344512, 262593, 336326, 360917, 369119, 328178, 328180, 328183, 328190, 254463, 328193, 98819, 164362, 328207, 410129, 393748, 377372, 188959, 385571, 377384, 197160, 33322, 352822, 270905, 197178, 418364, 188990, 369224, 385610, 270922, 352844, 385617, 352865, 262761, 352875, 344694, 352888, 336513, 377473, 336517, 344710, 385671, 148106, 377485, 352919, 98969, 336549, 344745, 361130, 336556, 434868, 164535, 336568, 164539, 328379, 328387, 352969, 418508, 385743, 385749, 139998, 189154, 369382, 361196, 344832, 336644, 344837, 344843, 328462, 361231, 394002, 336660, 418581, 418586, 434971, 369436, 262943, 369439, 418591, 418594, 336676, 418600, 418606, 271154, 328498, 369464, 361274, 328516, 336709, 328520, 336712, 361289, 328523, 336715, 361300, 213848, 426842, 361307, 197469, 361310, 254813, 361318, 344936, 361323, 361335, 328574, 369544, 222129, 345036, 386004, 345046, 386012, 386019, 386023, 328690, 435188, 328703, 328710, 418822, 377867, 328715, 386070, 336922, 345119, 377888, 328747, 214060, 345134, 345139, 361525, 386102, 361537, 377931, 197708, 189525, 156762, 402523, 361568, 148580, 345200, 361591, 361594, 410746, 214150, 345224, 386187, 337048, 345247, 361645, 345268, 337076, 402615, 361657, 337093, 402636, 328925, 165086, 165092, 328933, 222438, 328942, 386286, 386292, 206084, 115973, 328967, 345377, 345380, 353572, 345383, 263464, 337207, 345400, 378170, 369979, 386366, 337224, 337230, 337235, 263509, 353634, 337252, 402792, 345449, 99692, 271731, 378232, 337278, 271746, 181639, 353674, 181644, 361869, 181650, 181655, 230810, 181671, 181674, 181679, 181682, 337330, 181687, 370105, 181691, 181697, 361922, 337350, 181704, 337366, 271841, 329192, 361961, 329195, 116211, 337399, 402943, 337416, 329227, 419341, 419345, 329234, 419351, 345626, 419357, 345631, 419360, 370208, 394787, 419363, 370214, 419369, 394796, 419377, 419386, 206397, 214594, 419401, 353868, 419404, 173648, 419408, 214611, 419412, 403040, 345702, 222831, 370298, 353920, 403073, 403076, 345737, 198282, 403085, 403092, 345750, 419484, 345758, 345763, 419492, 345766, 419498, 419502, 370351, 419507, 337588, 419510, 419513, 337601, 403139, 337607, 419528, 419531, 272083, 394967, 419543, 419545, 345819, 419548, 181982, 419551, 345829, 419560, 337643, 419564, 337647, 370416, 141052, 337661, 337671, 362249, 362252, 395022, 362256, 321300, 345888, 116512, 378664, 354107, 354112, 247618, 370504, 329545, 345932, 354124, 370510, 354132, 247639, 337751, 370520, 313181, 182110, 354143, 354157, 345965, 345968, 345971, 345975, 182136, 403321, 1914, 354173, 395148, 247692, 337809, 247701, 329625, 436127, 436133, 247720, 337834, 362414, 337845, 190393, 346059, 247760, 346064, 346069, 419810, 329699, 354275, 190440, 247790, 354314, 346140, 337980, 436290, 395340, 378956, 436307, 338005, 329816, 100454, 329833, 329853, 329857, 329868, 411806, 329886, 346273, 362661, 100525, 387250, 379067, 387261, 256193, 395467, 346317, 411862, 411865, 411869, 411874, 379108, 411877, 387303, 346344, 395496, 338154, 387307, 346350, 338161, 436474, 321787, 379135, 411905, 411917, 43279, 379154, 395539, 387350, 387353, 338201, 182559, 338212, 248112, 362823, 436556, 321880, 362844, 379234, 354674, 182642, 321911, 420237, 379279, 272787, 354728, 338353, 338363, 338382, 272849, 248279, 256474, 182755, 338404, 338411, 330225, 248309, 199165, 248332, 330254, 199182, 199189, 420377, 330268, 191012, 330320, 199250, 191069, 346722, 248427, 191085, 338544, 191093, 346743, 330384, 346769, 150184, 174775, 248505, 174778, 363198, 223936, 355025, 273109, 355029, 264919, 338661, 264942, 330479, 363252, 338680, 207620, 264965, 191240, 338701, 363294, 199455, 396067, 346917, 396070, 215854, 355123, 355141, 355144, 338764, 355151, 330581, 330585, 387929, 355167, 265056, 265059, 355176, 355180, 355185, 330612, 330643, 412600, 207809, 379849, 347082, 396246, 330711, 248794, 248799, 437219, 257009, 265208, 330750, 265215, 199681, 338951, 330761, 330769, 330775, 248863, 158759, 396329, 347178, 404526, 396337, 330803, 396340, 339002, 388155, 339010, 347208, 248905, 330827, 330830, 248915, 183384, 339037, 412765, 257121, 322660, 265321, 330869, 248952, 420985, 330886, 347288, 248986, 44199, 380071, 339118, 249018, 339133, 126148, 322763, 330959, 330966, 265433, 265438, 388320, 363757, 339199, 396552, 175376, 175397, 208167, 273709, 372016, 437553, 347442, 199989, 175416, 396601, 208189, 437567, 175425, 437571, 126279, 437576, 437584, 331089, 331094, 396634, 175451, 437596, 429408, 175458, 208228, 175461, 175464, 265581, 331124, 175478, 249210, 175484, 175487, 249215, 175491, 249219, 249225, 249228, 249235, 175514, 175517, 396703, 396706, 175523, 355749, 396723, 388543, 380353, 339401, 380364, 339406, 372177, 339414, 249303, 413143, 339418, 339421, 249310, 339425, 249313, 339429, 339435, 249329, 69114, 372229, 339464, 249355, 208399, 175637, 134689, 339504, 265779, 421442, 413251, 265796, 265806, 224854, 224858, 339553, 257636, 224871, 372328, 257647, 372338, 339572, 224885, 224888, 224891, 224895, 126597, 421509, 224905, 11919, 224911, 224914, 126611, 224917, 224920, 126618, 208539, 224923, 224927, 224930, 224933, 257705, 224939, 224943, 257713, 224949, 257717, 257721, 224954, 257725, 224960, 257733, 224966, 224970, 257740, 224976, 257745, 339664, 257748, 224982, 257752, 224987, 257762, 224996, 225000, 339696, 225013, 257788, 225021, 339711, 257791, 225027, 257796, 339722, 257802, 257805, 225039, 257808, 249617, 225044, 167701, 372500, 257815, 225049, 257820, 225054, 184096, 397089, 257825, 225059, 339748, 225068, 257837, 413485, 225071, 225074, 257843, 225077, 257846, 225080, 397113, 225083, 397116, 257853, 225088, 225094, 225097, 323404, 257869, 257872, 225105, 339795, 397140, 225109, 225113, 257881, 257884, 257887, 225120, 257891, 413539, 225128, 257897, 339818, 225138, 339827, 257909, 225142, 372598, 257914, 257917, 225150, 257922, 380803, 225156, 339845, 257927, 225166, 397201, 225171, 380823, 225176, 225183, 372698, 372704, 372707, 356336, 380919, 393215, 372739, 405534, 266295, 266298, 217158, 421961, 200786, 356440, 217180, 430181, 266351, 356467, 266365, 266375, 381069, 225425, 250003, 225430, 250008, 356507, 250012, 225439, 135328, 192674, 225442, 438434, 225445, 225448, 438441, 225451, 258223, 225456, 430257, 225459, 225462, 225468, 389309, 225472, 372931, 225476, 389322, 225485, 225488, 225491, 266454, 225494, 225497, 225500, 225503, 225506, 356580, 225511, 217319, 225515, 225519, 381177, 397572, 389381, 356631, 356638, 356641, 356644, 356647, 266537, 389417, 356650, 356656, 332081, 307507, 340276, 356662, 397623, 332091, 225599, 332098, 201030, 348489, 332107, 151884, 430422, 348503, 332118, 332130, 250211, 340328, 250217, 348523, 348528, 332153, 356734, 389503, 332158, 438657, 250239, 332162, 348548, 356741, 332175, 160152, 373146, 340380, 373149, 70048, 356783, 373169, 266688, 324032, 201158, 127473, 217590, 340473, 324095, 324100, 324103, 324112, 340501, 324118, 324122, 340512, 332325, 324134, 381483, 356908, 324141, 324143, 356917, 324150, 324156, 168509, 348734, 324161, 324165, 356935, 348745, 381513, 324171, 324174, 324177, 389724, 332381, 373344, 340580, 348777, 381546, 119432, 340628, 184983, 373399, 340639, 258723, 332455, 332460, 332464, 332473, 381626, 332484, 332487, 332494, 357070, 357074, 332512, 332521, 340724, 332534, 348926, 389927, 348979, 152371, 340792, 398141, 127815, 357202, 389971, 357208, 136024, 389979, 430940, 357212, 357215, 201580, 201583, 349041, 340850, 201589, 381815, 430967, 324473, 398202, 119675, 340859, 324476, 430973, 324479, 340863, 324482, 324485, 324488, 185226, 381834, 324493, 324496, 324499, 430996, 324502, 324511, 422817, 324514, 201638, 373672, 324525, 5040, 111539, 324534, 5047, 324539, 324542, 398280, 349129, 340940, 340942, 209874, 340958, 431073, 398307, 340964, 209896, 201712, 209904, 349173, 381947, 201724, 349181, 431100, 431107, 349203, 209944, 209948, 250915, 250917, 169002, 357419, 209966, 209969, 209973, 209976, 209980, 209988, 209991, 431180, 209996, 341072, 349268, 177238, 250968, 210011, 373853, 341094, 210026, 210028, 210032, 349296, 210037, 210042, 210045, 349309, 152704, 349313, 160896, 210053, 210056, 349320, 259217, 373905, 210068, 210072, 210078, 210081, 210085, 210089, 210096, 210100, 324792, 210108, 357571, 210116, 210128, 333010, 210132, 333016, 210139, 210144, 218355, 251123, 218361, 275709, 128254, 275713, 242947, 275717, 275723, 333075, 349460, 333079, 251161, 349486, 349492, 415034, 251211, 210261, 365912, 259423, 374113, 251236, 374118, 333164, 234867, 390518, 357756, 374161, 112021, 349591, 357793, 333222, 210357, 259516, 415168, 366035, 415187, 366039, 415192, 415194, 415197, 415200, 333285, 415208, 366057, 366064, 415217, 415225, 415258, 415264, 366118, 415271, 382503, 349739, 144940, 415279, 415282, 415286, 210488, 415291, 415295, 333387, 333396, 333400, 366173, 333415, 423529, 423533, 333423, 210547, 415354, 333440, 267910, 267929, 333472, 333512, 259789, 358100, 366301, 333535, 153311, 366308, 366312, 431852, 399086, 366319, 210673, 366322, 399092, 366326, 333566, 268042, 210700, 366349, 210707, 399129, 333593, 333595, 210720, 366384, 358192, 210740, 366388, 358201, 399166, 325441, 366403, 325447, 341831, 341835, 341839, 341844, 415574, 358235, 341852, 350046, 399200, 399208, 268144, 358256, 358260, 341877, 399222, 325494, 186233, 333690, 243584, 325505, 333699, 399244, 333709, 333725, 333737, 382891, 333767, 350153, 358348, 333777, 219094, 399318, 358372, 350190, 350194, 333819, 350204, 350207, 325633, 325637, 350214, 333838, 350225, 350232, 350238, 350241, 374819, 350245, 350249, 350252, 178221, 350257, 350260, 350272, 243782, 350281, 350286, 374865, 342113, 252021, 342134, 374904, 268435, 333989, 333998, 334012, 260299, 350411, 350417, 350423, 350426, 334047, 350449, 375027, 358645, 350454, 350459, 350462, 350465, 350469, 325895, 268553, 194829, 350477, 268560, 350481, 432406, 350487, 350491, 325915, 350494, 325918, 325920, 350500, 350505, 358701, 391469, 350510, 358705, 358714, 358717, 383307, 358738, 334162, 383331, 383334, 391531, 383342, 334204, 268669, 194942, 391564, 366991, 334224, 268702, 342431, 375209, 326059, 375220, 342453, 334263, 326087, 358857, 195041, 334312, 104940, 375279, 350724, 186898, 342546, 350740, 342551, 334359, 342555, 334364, 416294, 350762, 252463, 358962, 334386, 334397, 358973, 252483, 219719, 399957, 244309, 334425, 326240, 375401, 334466, 334469, 162446, 326291, 342680, 342685, 260767, 342711, 244410, 260798, 334530, 260802, 350918, 154318, 342737, 391895, 154329, 416476, 64231, 113389, 342769, 203508, 375541, 342777, 391938, 391949, 375569, 326417, 375572, 375575, 375580, 162592, 334633, 326444, 383794, 326452, 326455, 375613, 244542, 326463, 375616, 326468, 244552, 342857, 326474, 326479, 326486, 416599, 342875, 244572, 326494, 326503, 433001, 326508, 400238, 326511, 211826, 211832, 392061, 351102, 359296, 252801, 260993, 351105, 400260, 211846, 342921, 342931, 252823, 400279, 392092, 400286, 252838, 359335, 211885, 400307, 351169, 359362, 351172, 170950, 187335, 326599, 359367, 359383, 359389, 383968, 343018, 359411, 261109, 261112, 244728, 383999, 261130, 261148, 359452, 211999, 261155, 261160, 261166, 359471, 375868, 343132, 384099, 384102, 384108, 367724, 326764, 187503, 343155, 384115, 212095, 384136, 384140, 384144, 384152, 384158, 384161, 351399, 384169, 367795, 384182, 367801, 384189, 384192, 351424, 343232, 244934, 367817, 244938, 384202, 253132, 326858, 343246, 384209, 146644, 351450, 384225, 359650, 343272, 351467, 359660, 384247, 351480, 384250, 351483, 351492, 343307, 384270, 359695, 261391, 253202, 261395, 384276, 384284, 245021, 384290, 253218, 245032, 171304, 384299, 351535, 376111, 245042, 326970, 384324, 343366, 212296, 212304, 367966, 343394, 343399, 367981, 343410, 155000, 327035, 245121, 245128, 253321, 155021, 384398, 245137, 245143, 245146, 245149, 343453, 245152, 245155, 155045, 245158, 40358, 245163, 114093, 327090, 343478, 359867, 384444, 146878, 327108, 327112, 384457, 327118, 359887, 359891, 343509, 368093, 155103, 343535, 343540, 368120, 343545, 409092, 359948, 359951, 245295, 359984, 400977, 400982, 179803, 245358, 138865, 155255, 155274, 368289, 245410, 425639, 245415, 425652, 425663, 155328, 245463, 155352, 155356, 212700, 155364, 245477, 155372, 245487, 212723, 245495, 409336, 155394, 155404, 245528, 155423, 360224, 155439, 204592, 155444, 155448, 417596, 384829, 384831, 360262, 155463, 155477, 376665, 155484, 261982, 425823, 155488, 376672, 155492, 327532, 261997, 376686, 262000, 262003, 425846, 262006, 147319, 262009, 327542, 262012, 155517, 155523, 155526, 360327, 376715, 155532, 262028, 262031, 262034, 262037, 262040, 262043, 155550, 253854, 262046, 262049, 262052, 327590, 155560, 155563, 155566, 327613, 393152, 311244, 212945, 393170, 155604, 155620, 253924, 155622, 253927, 327655, 360432, 393204, 360439, 253944, 393209, 155647 ]
4523a4ece6832eb0da1feca6596a0533d5e8a257
8b2a54353ebdf22cafca9fec75b294f567093d5e
/Concurency-Playground/DispatchBarrier.playground/Contents.swift
babf9c82f60beff40ed3545eb0a687db432ec4f8
[]
no_license
xans-me/ios-fundamental
15bf40c65c065fb0ddaf6eceb7d01b50f0102ae2
ee3d59711a2055bd7417d783d6c156888f6ef564
refs/heads/master
2022-11-29T11:01:09.404800
2020-08-14T07:27:36
2020-08-14T07:27:36
null
0
0
null
null
null
null
UTF-8
Swift
false
false
433
swift
import UIKit class ThreadSafeArray { let isolation = DispatchQueue(label: "com.dicoding.dispatchbarrier", attributes: .concurrent) private var _array: [Int] = [] var array: [Int] { get { return isolation.sync { _array } } set { isolation.async(flags: .barrier) { self._array = newValue } } } }
[ -1 ]
b4abd0317bdfd5006b380d54088a79ba705c7bdd
7f68e623051bc76ce02bcfa825a0d65fbe19f2df
/LetsEat/Explore/Model/ExploreItem.swift
4d2ca60523115ad06c2d3c346aa9f49fc137d539
[]
no_license
imvityalee/LetsEat
ad9e0abd6f306a3baaecc56a72f30ce0774065f2
4ddc85ca0c46f54bd26f78c37cba277eb53cda04
refs/heads/master
2022-12-01T23:55:42.211476
2020-08-20T19:27:01
2020-08-20T19:27:01
289,090,766
0
0
null
null
null
null
UTF-8
Swift
false
false
386
swift
// // ExploreItem.swift // LetsEat // // Created by Victor on 7/22/20. // Copyright © 2020 Victor. All rights reserved. // import Foundation struct ExploreItem { var name : String var image : String } extension ExploreItem { init(dict:[String:AnyObject]){ self.name = dict["name"] as! String self.image = dict["image"] as! String } }
[ -1 ]
f8b84e24a060cae923b91fbce41fb569ae54a9a7
021f9c07fb6981bc1a6c5453e1da79adcb3f474b
/StoreAppUITests/StoreAppUITests.swift
aac357dea5ed2d19e8eb0a9c0d04331f8fb47491
[]
no_license
fedorfilimonov/StoreApp
4d5eddfa60b29feefb0d228e788bbaa0fce9321b
94090dd008c3f106a10077fd33a352326a2e5a12
refs/heads/main
2023-08-25T22:33:49.384278
2021-02-10T16:29:53
2021-02-10T16:29:53
337,783,315
0
0
null
2021-03-23T15:45:04
2021-02-10T16:29:33
Swift
UTF-8
Swift
false
false
1,436
swift
// // StoreAppUITests.swift // StoreAppUITests // // Created by Федор Филимонов on 10.02.2021. // import XCTest class StoreAppUITests: XCTestCase { override func setUpWithError() throws { // Put setup code here. This method is called before the invocation of each test method in the class. // In UI tests it is usually best to stop immediately when a failure occurs. continueAfterFailure = false // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. } override func tearDownWithError() throws { // Put teardown code here. This method is called after the invocation of each test method in the class. } func testExample() throws { // UI tests must launch the application that they test. let app = XCUIApplication() app.launch() // Use recording to get started writing UI tests. // Use XCTAssert and related functions to verify your tests produce the correct results. } func testLaunchPerformance() throws { if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { // This measures how long it takes to launch your application. measure(metrics: [XCTApplicationLaunchMetric()]) { XCUIApplication().launch() } } } }
[ 360463, 155665, 376853, 344106, 253996, 385078, 163894, 180279, 319543, 352314, 213051, 376892, 32829, 286787, 352324, 237638, 352327, 385095, 393291, 163916, 368717, 311373, 196687, 278607, 311377, 254039, 426074, 368732, 180317, 32871, 352359, 221292, 278637, 319599, 385135, 376945, 131190, 385147, 131199, 426124, 196758, 49308, 65698, 311459, 49317, 377008, 377010, 180409, 295099, 377025, 377033, 164043, 417996, 254157, 368849, 368850, 139478, 229591, 385240, 254171, 147679, 147680, 311520, 205034, 254189, 286957, 254193, 344312, 336121, 262403, 147716, 385291, 368908, 180494, 262419, 368915, 254228, 319764, 278805, 377116, 254250, 311596, 131374, 418095, 336177, 368949, 180534, 155968, 287040, 311622, 270663, 319816, 368969, 254285, 180559, 377168, 344402, 229716, 368982, 270703, 139641, 385407, 385409, 270733, 106893, 385423, 385433, 213402, 385437, 254373, 156069, 385448, 385449, 311723, 115116, 385463, 319931, 278974, 336319, 336323, 188870, 278988, 278992, 262619, 377309, 377310, 369121, 369124, 279014, 270823, 279017, 311787, 213486, 360945, 139766, 393719, 279030, 377337, 279033, 254459, 410108, 410109, 262657, 377346, 279042, 279053, 410126, 262673, 385554, 393745, 303635, 279060, 279061, 254487, 410138, 279066, 188957, 377374, 385569, 385578, 377388, 197166, 393775, 418352, 33339, 352831, 33344, 385603, 377419, 385612, 303693, 426575, 385620, 369236, 115287, 189016, 270938, 287327, 279143, 279150, 287345, 352885, 352886, 344697, 189054, 287359, 385669, 369285, 311944, 344714, 311950, 377487, 311953, 287379, 336531, 180886, 426646, 352921, 377499, 221853, 344737, 295591, 352938, 295598, 418479, 279215, 279218, 164532, 336565, 287418, 377531, 303802, 377534, 377536, 66243, 385737, 287434, 385745, 279249, 303826, 369365, 369366, 385751, 230105, 361178, 352989, 352990, 418529, 295649, 385763, 295653, 369383, 230120, 361194, 312046, 418550, 279293, 205566, 344829, 197377, 434956, 312076, 295698, 418579, 426772, 197398, 426777, 221980, 344864, 197412, 336678, 262952, 189229, 262957, 164655, 328495, 197424, 197428, 336693, 230198, 377656, 426809, 197433, 222017, 295745, 377669, 197451, 369488, 279379, 385878, 385880, 295769, 197467, 435038, 230238, 279393, 303973, 279398, 385895, 197479, 385901, 197489, 295799, 164730, 336765, 254851, 369541, 172936, 320394, 426894, 189327, 377754, 337226, 172971, 140203, 377778, 304050, 189362, 189365, 189373, 377789, 345030, 345034, 279499, 418774, 386007, 386009, 418781, 386016, 123880, 418793, 320495, 222193, 435185, 271351, 214009, 312313, 435195, 312317, 328701, 386049, 328705, 418819, 410629, 377863, 189448, 230411, 320526, 361487, 435216, 386068, 254997, 336928, 336930, 410665, 345137, 361522, 312372, 238646, 238650, 320571, 386108, 410687, 336962, 238663, 377927, 361547, 205911, 156763, 361570, 214116, 230500, 214119, 402538, 279659, 173168, 230514, 238706, 279666, 312435, 377974, 66684, 377986, 279686, 402568, 222344, 140426, 337037, 386191, 410772, 222364, 418975, 124073, 402618, 148674, 402632, 148687, 402641, 189651, 419028, 279766, 189656, 304353, 279780, 222441, 279789, 386288, 66802, 271607, 369912, 386296, 369913, 419066, 386300, 279803, 386304, 320769, 369929, 419097, 320795, 115997, 222496, 320802, 304422, 369964, 353581, 116014, 312628, 345397, 345398, 386363, 222523, 230730, 353611, 353612, 345418, 337228, 296269, 222542, 353617, 238928, 296274, 378201, 230757, 296304, 312688, 337280, 353672, 263561, 296328, 296330, 304523, 370066, 9618, 411028, 279955, 370072, 148899, 148900, 361928, 337359, 329168, 312785, 222674, 329170, 353751, 280025, 239069, 329181, 320997, 361958, 271850, 280042, 280043, 271853, 329198, 411119, 337391, 116209, 296434, 386551, 288252, 312830, 271880, 198155, 304655, 329231, 370200, 222754, 157219, 157220, 394793, 312879, 288305, 288319, 288322, 280131, 288328, 353875, 99937, 345697, 312937, 271980, 206447, 403057, 42616, 337533, 280193, 370307, 419462, 149127, 149128, 419464, 288391, 411275, 214667, 239251, 345753, 198304, 255651, 337590, 370359, 280252, 280253, 321217, 239305, 296649, 403149, 313042, 345813, 370390, 272087, 345817, 337638, 345832, 181992, 345835, 288492, 141037, 313082, 288508, 288515, 173828, 395018, 395019, 116491, 395026, 124691, 116502, 435993, 345882, 411417, 321308, 255781, 362281, 378666, 403248, 378673, 345910, 182070, 182071, 436029, 345918, 337734, 280396, 272207, 272208, 337746, 395092, 362326, 345942, 370526, 345950, 362336, 255844, 296807, 214894, 362351, 214896, 313200, 313204, 124795, 182145, 280451, 67464, 305032, 337816, 124826, 239515, 329627, 354210, 436130, 436135, 10153, 313257, 362411, 370604, 362418, 411587, 280517, 362442, 346066, 231382, 354268, 436189, 403421, 329696, 354273, 403425, 190437, 354279, 436199, 174058, 337899, 354283, 247786, 329707, 296942, 313322, 436209, 124912, 247787, 239610, 182277, 346117, 403463, 43016, 354312, 354311, 354310, 313356, 436235, 419857, 305173, 436248, 223269, 346153, 354346, 313388, 124974, 272432, 403507, 378933, 378934, 436283, 288835, 403524, 436293, 313415, 239689, 436304, 223317, 411738, 272477, 280676, 313446, 395373, 288878, 346237, 215165, 436372, 329884, 378186, 362658, 436388, 215204, 125108, 133313, 395458, 338118, 436429, 346319, 321744, 379102, 387299, 18661, 379110, 338151, 125166, 149743, 379120, 436466, 125170, 411892, 436471, 395511, 313595, 436480, 125184, 272644, 125192, 338187, 338188, 125197, 395536, 125200, 338196, 272661, 379157, 125204, 157973, 125215, 125216, 338217, 125225, 321839, 125236, 362809, 379193, 395591, 289109, 272730, 436570, 215395, 239973, 280938, 321901, 354671, 362864, 354672, 272755, 354678, 199030, 223611, 248188, 313726, 436609, 240003, 436613, 395653, 395660, 264591, 420241, 240020, 190870, 43416, 190872, 289185, 436644, 289195, 272815, 436659, 338359, 436677, 289229, 281038, 281039, 256476, 420326, 166403, 322057, 420374, 322077, 289328, 330291, 322119, 191065, 436831, 420461, 313970, 346739, 346741, 420473, 297600, 166533, 363155, 346771, 264855, 363161, 289435, 436897, 248494, 166581, 355006, 363212, 363228, 322269, 436957, 436960, 264929, 338658, 289511, 330473, 346859, 330476, 289517, 215790, 199415, 289534, 322302, 35584, 133889, 322312, 346889, 264971, 322320, 166677, 207639, 363295, 355117, 191285, 273209, 355129, 273211, 355136, 355138, 420680, 355147, 355148, 355153, 281426, 387927, 363353, 363354, 281434, 322396, 420702, 363361, 363362, 412516, 355173, 355174, 281444, 207724, 355182, 207728, 420722, 314240, 158594, 330627, 240517, 265094, 387977, 396171, 355216, 224146, 224149, 256918, 256919, 256920, 240543, 256934, 273336, 289720, 289723, 273341, 330688, 379845, 363462, 19398, 273353, 191445, 207839, 347104, 314343, 134124, 412653, 248815, 257007, 347122, 437245, 257023, 125953, 396292, 330759, 347150, 330766, 412692, 330789, 248871, 281647, 412725, 257093, 404550, 314437, 207954, 339031, 404582, 257126, 322664, 265318, 265323, 396395, 404589, 273523, 363643, 248960, 150656, 363658, 404622, 224400, 265366, 347286, 429209, 339101, 429216, 339106, 380069, 265381, 3243, 208044, 322733, 421050, 339131, 265410, 183492, 273616, 421081, 339167, 298209, 421102, 363769, 52473, 208123, 52476, 412926, 437504, 322826, 388369, 380178, 429332, 126229, 412963, 257323, 437550, 273713, 298290, 208179, 159033, 347451, 216387, 372039, 257353, 257354, 109899, 437585, 331091, 150868, 314708, 372064, 429410, 437602, 281958, 388458, 265579, 306541, 314734, 314740, 314742, 421240, 314745, 224637, 388488, 298378, 306580, 282008, 396697, 314776, 282013, 290206, 396709, 298406, 241067, 380331, 314797, 380335, 355761, 421302, 134586, 380348, 216510, 380350, 216511, 306630, 200136, 273865, 306634, 339403, 372172, 413138, 421338, 437726, 429540, 3557, 3559, 191980, 282097, 191991, 265720, 216575, 290304, 372226, 437766, 323083, 208397, 323088, 413202, 413206, 388630, 175640, 216610, 372261, 347693, 323120, 396850, 200245, 323126, 290359, 134715, 323132, 421437, 396865, 282182, 413255, 273992, 265800, 421452, 265809, 396885, 290391, 265816, 396889, 306777, 388699, 396896, 323171, 388712, 388713, 314997, 290425, 339579, 396927, 282248, 224907, 405140, 274071, 323226, 208547, 208548, 405157, 388775, 282279, 364202, 421556, 224951, 224952, 306875, 282302, 323262, 323265, 241360, 241366, 224985, 282330, 159462, 372458, 397040, 12017, 323315, 274170, 200444, 175874, 249606, 323335, 282379, 216844, 372497, 397076, 421657, 339746, 216868, 241447, 167720, 257831, 421680, 282418, 421686, 274234, 241471, 339782, 315209, 159563, 241494, 339799, 307038, 274276, 282471, 274288, 372592, 274296, 339840, 315265, 372625, 282517, 298912, 118693, 438186, 126896, 151492, 380874, 372699, 323554, 380910, 380922, 380923, 274432, 372736, 241695, 315431, 430120, 102441, 315433, 430127, 405552, 282671, 241717, 249912, 225347, 307269, 421958, 233548, 176209, 381013, 315477, 53334, 200795, 356446, 323678, 438374, 176231, 438378, 233578, 217194, 422000, 249976, 266361, 422020, 168069, 381061, 168070, 381071, 241809, 323730, 430231, 200856, 422044, 299166, 192671, 192670, 258213, 299176, 323761, 184498, 430263, 266427, 356550, 299208, 372943, 266447, 258263, 356575, 307431, 438512, 372979, 389364, 381173, 135416, 356603, 184574, 266504, 217352, 61720, 381210, 315674, 282908, 389406, 282912, 233761, 438575, 315698, 266547, 397620, 332084, 438583, 127292, 438592, 332100, 323914, 201037, 397650, 348499, 250196, 348501, 389465, 332128, 110955, 242027, 242028, 160111, 250227, 315768, 291193, 438653, 291200, 266628, 340356, 242059, 225684, 373141, 373144, 291225, 389534, 397732, 373196, 176602, 242138, 184799, 291297, 201195, 324098, 233987, 340489, 397841, 283154, 258584, 291359, 348709, 348710, 397872, 283185, 234037, 340539, 266812, 438850, 348741, 381515, 348748, 430681, 332379, 242274, 184938, 373357, 184942, 176751, 389744, 356983, 356984, 209529, 356990, 291455, 373377, 422529, 201348, 152196, 356998, 348807, 356999, 316044, 316050, 275102, 176805, 340645, 422567, 176810, 160441, 422591, 291529, 225996, 135888, 242385, 234216, 373485, 373486, 21239, 275193, 348921, 234233, 242428, 299777, 430853, 430860, 62222, 430880, 234276, 234290, 152372, 160569, 430909, 160576, 348999, 283466, 439118, 234330, 275294, 381791, 127840, 357219, 439145, 177002, 308075, 242540, 242542, 381811, 201590, 177018, 398205, 340865, 291713, 349066, 316299, 349068, 234382, 308111, 381840, 308113, 390034, 373653, 430999, 209820, 381856, 398244, 185252, 422825, 381872, 177074, 398268, 349122, 398275, 373705, 127945, 340960, 398305, 340967, 398313, 234476, 127990, 349176, 201721, 349179, 234499, 357380, 398370, 357413, 357420, 300087, 21567, 308288, 398405, 349254, 218187, 250955, 300109, 234578, 250965, 439391, 250982, 398444, 62574, 357487, 300147, 119925, 349304, 234626, 349315, 349317, 234635, 373902, 177297, 324761, 234655, 234662, 373937, 373939, 324790, 300215, 218301, 283841, 283846, 259275, 316628, 259285, 357594, 414956, 251124, 316661, 292092, 439550, 439563, 242955, 414989, 259346, 349458, 259347, 382243, 382246, 382257, 292145, 382264, 333115, 193853, 193858, 251212, 406862, 234830, 259408, 283990, 357720, 300378, 300379, 316764, 374110, 234864, 259449, 382329, 357758, 243073, 357763, 112019, 398740, 234902, 374189, 251314, 284086, 259513, 54719, 292291, 300490, 300526, 259569, 251379, 300539, 398844, 210429, 366081, 316951, 374297, 153115, 431646, 349727, 431662, 374327, 210489, 235069, 349764, 292424, 292426, 333389, 128589, 333394, 349780, 128600, 235096, 300643, 300645, 415334, 54895, 366198, 210558, 325246, 415360, 210559, 333438, 415369, 431754, 210569, 267916, 415376, 259741, 153252, 399014, 210601, 202413, 317102, 415419, 259780, 333508, 267978, 333522, 325345, 333543, 325357, 431861, 284410, 161539, 284425, 300812, 284430, 366358, 169751, 431901, 341791, 325411, 186148, 186149, 333609, 284460, 202541, 399148, 431918, 153392, 431935, 415555, 325444, 153416, 325449, 341837, 415566, 431955, 325460, 317268, 341846, 300893, 259937, 382820, 276326, 415592, 292713, 292719, 325491, 341878, 276343, 350072, 333687, 317305, 112510, 325508, 333700, 243590, 325514, 350091, 350092, 350102, 350108, 333727, 219046, 284584, 292783, 300983, 128955, 219102, 292835, 6116, 317416, 432114, 325620, 415740, 268286, 415744, 333827, 243720, 399372, 153618, 358418, 178215, 325675, 243763, 358455, 325695, 399433, 333902, 104534, 194667, 260206, 432241, 284789, 374913, 374914, 415883, 333968, 153752, 333990, 104633, 260285, 227517, 268479, 374984, 301270, 301271, 325857, 334049, 268515, 383208, 317676, 260337, 260338, 432373, 375040, 309504, 260355, 432387, 375052, 194832, 325904, 391448, 334104, 268570, 178459, 186660, 268581, 334121, 358698, 317738, 260396, 325930, 432435, 358707, 178485, 358710, 14654, 268609, 227655, 383309, 383327, 391521, 366948, 416101, 416103, 383338, 432503, 432511, 211327, 227721, 285074, 252309, 39323, 285083, 317851, 285089, 375211, 334259, 129461, 342454, 358844, 293309, 317889, 326083, 416201, 129484, 154061, 326093, 416206, 432608, 285152, 195044, 391654, 432616, 334315, 375281, 293368, 317949, 334345, 432650, 309770, 342537, 342549, 342560, 416288, 350758, 350759, 358951, 358952, 293420, 219694, 219695, 375345, 244279, 309831, 375369, 375373, 416334, 301647, 416340, 244311, 416353, 260705, 375396, 268901, 244326, 244345, 334473, 375438, 326288, 285348, 293552, 342705, 285362, 383668, 342714, 39616, 383708, 342757, 269036, 432883, 203511, 342775, 383740, 416509, 432894, 359166, 375552, 162559, 228099, 285443, 285450, 383755, 326413, 285467, 318247, 342827, 318251, 391980, 375610, 301883, 342846, 416577, 416591, 244569, 375644, 252766, 293729, 351078, 342888, 392057, 211835, 269179, 392065, 260995, 400262, 392071, 424842, 252812, 400271, 392080, 400282, 7070, 211871, 359332, 359333, 293801, 326571, 252848, 326580, 261045, 261046, 326586, 359365, 211913, 342990, 252878, 433104, 56270, 359380, 433112, 433116, 359391, 187372, 383980, 343020, 203758, 383994, 171009, 384004, 433166, 384015, 433173, 293911, 326684, 252959, 384031, 375848, 318515, 203829, 261191, 375902, 375903, 392288, 253028, 351343, 187505, 138354, 187508, 384120, 302202, 285819, 392317, 343166, 384127, 392320, 285823, 285833, 285834, 318602, 228492, 187539, 359574, 285850, 351389, 302239, 253098, 302251, 367791, 367792, 367798, 64699, 294075, 228541, 343230, 367809, 253124, 113863, 351445, 310496, 195809, 253168, 351475, 351489, 367897, 367898, 245018, 130342, 130344, 130347, 261426, 212282, 294210, 359747, 359748, 146760, 146763, 114022, 253288, 425327, 425331, 163190, 327030, 384379, 253316, 294278, 384391, 318860, 253339, 253340, 318876, 343457, 245160, 359860, 359861, 343480, 310714, 228796, 228804, 425417, 310731, 327122, 425434, 310747, 310758, 253431, 359931, 187900, 343552, 245249, 228868, 409095, 359949, 294413, 253456, 302613, 253462, 146976, 245290, 245291, 343606, 163385, 425534, 138817, 147011, 147020, 179800, 196184, 343646, 212574, 204386, 155238, 204394, 138862, 310896, 188021, 294517, 286351, 188049, 425624, 229021, 245413, 286387, 384693, 376502, 286392, 302778, 409277, 286400, 319176, 409289, 425682, 286419, 294621, 245471, 155360, 294629, 212721, 163575, 286457, 286463, 319232, 360194, 409355, 155408, 417556, 294699, 204600, 319289, 384826, 409404, 360253, 409416, 237397, 376661, 368471, 425820, 368486, 384871, 409446, 368489, 40809, 425832, 417648, 417658, 360315, 253828, 327556, 311183, 425875, 294806, 294808, 253851, 376733, 204702, 319393, 294820, 253868, 204722, 188349, 98240, 212947, 212953, 360416, 294887, 253930, 327666, 385011 ]
670a1e2e8f3975f7d697c31f6a06fb4cd0149dc9
4bbb98ccc4d97feed80adbe5c3ae75ba16927829
/Test-5-6/Test-5-6/ViewController.swift
4b961f76bb6a5cf9bbaad1f27e50fe24f8c9337a
[]
no_license
takara111/Git-Class-14
9ccd02f2ae24934aba899d66eb42b850df2dfe0a
5f171ffa863f2b7f5a6179e28ec6a0fad61fe116
refs/heads/master
2020-07-24T21:56:13.599133
2019-09-12T13:43:37
2019-09-12T13:43:37
null
0
0
null
null
null
null
UTF-8
Swift
false
false
336
swift
// // ViewController.swift // Test-5-6 // // Created by 杉浦多可楽 on 2019/09/02. // Copyright © 2019 多可楽. All rights reserved. // import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } }
[ 325510, 324104, 329869, 329235, 342552, 245530, 210075, 318109, 324512, 316331, 159025, 324018, 338617, 316346, 244411, 326971, 294845, 149306, 323268, 324549, 323016, 326600, 325448, 324172, 316626, 146645, 313182, 354654, 326241, 241633, 321253, 175462, 320506, 210043, 340988, 334205 ]
5a4df870adba2f29850d997cd869a636dfc709ec
ee8157ba34690f8937827cf4b333278d83a8b90b
/Steppers/Steppers/Controllers/EmailController.swift
66acaa8b407fbf7196ff2aa2a96ad72d4c2fdc31
[]
no_license
grattours/Steppers-OC
f504939d3165544766353516be512291407d23dc
89704c019b574645849e14fb10f665c0e758a49a
refs/heads/master
2020-04-10T10:59:10.719929
2018-12-08T21:59:37
2018-12-08T21:59:37
160,981,196
0
0
null
null
null
null
UTF-8
Swift
false
false
2,021
swift
// // EmailController.swift // Steppers // // Created by Luc Derosne on 07/12/2018. // Copyright © 2018 Luc Derosne. All rights reserved. // import UIKit import MessageUI class EmailController: UIViewController, MFMailComposeViewControllerDelegate { @IBOutlet weak var leTexteView: UITextView! override func viewDidLoad() { super.viewDidLoad() } @IBAction func envoyerEmail(_ sender: UIButton) { if MFMailComposeViewController.canSendMail() { let message:String = leTexteView.text let composePicker = MFMailComposeViewController() composePicker.mailComposeDelegate = self composePicker.delegate = self as? UINavigationControllerDelegate composePicker.setToRecipients(["[email protected]"]) composePicker.setSubject("Penser à ...") composePicker.setMessageBody(message, isHTML: false) self.present(composePicker, animated: true, completion: nil) } else { self .showerrorMessage() } } func showerrorMessage() { let alertMessage = UIAlertController(title: "l'email ne peut pas être envoyé ", message: " Vérifiez si votre mobil à bien une messagerie ! ", preferredStyle: UIAlertController.Style.alert) let action = UIAlertAction(title:"Ok", style: UIAlertAction.Style.default, handler: nil) alertMessage.addAction(action) self.present(alertMessage, animated: true, completion: nil) } func mailComposeController(_ controller:MFMailComposeViewController, didFinishWith result:MFMailComposeResult, error:Error?) { switch result { case .cancelled: print("Email supprimé") break case .saved: print("Email sauvé") break case .sent: print("Email envoyé") break case .failed: break } self.dismiss(animated: true, completion: nil) } }
[ -1 ]
dd6865a7b55fe025b0c39f3954e432dd21dc71f3
b028a508948d63004ba4f8c866f161fa7565fac4
/LearnDemo/TodayNews-master/TodayNews/Classes/Home(首页)/View/YMHomeLargeCell.swift
065f2d6522284d54d8bc46bf04e1b98f8ee9c79d
[ "MIT" ]
permissive
MinzhengHuang/Swift_Learn
ac729a016702c813260b79223907fe2e77925438
82f21c6fd9939584579ee5405124893a0ba420f3
refs/heads/master
2021-04-03T07:58:46.127287
2018-03-08T06:19:21
2018-03-08T06:19:21
124,345,858
0
0
null
null
null
null
UTF-8
Swift
false
false
5,026
swift
// // YMHomeLargeCell.swift // TodayNews // // Created by 杨蒙 on 16/8/8. // Copyright © 2016年 hrscy. All rights reserved. // // 中间显示一张大图的情况 // import UIKit /// ![](http://obna9emby.bkt.clouddn.com/home-cell-2.png) /// ![](http://obna9emby.bkt.clouddn.com/home-cell-5.png) class YMHomeLargeCell: YMHomeTopicCell { var newsTopic: YMNewsTopic? { didSet{ titleLabel.text = String(newsTopic!.title!) timeLabel.text = NSString.changeDateTime(newsTopic!.publish_time!) if let sourceAvatar = newsTopic?.source_avatar { nameLabel.text = newsTopic!.source avatarImageView.setCircleHeader(sourceAvatar) } if let mediaInfo = newsTopic!.media_info { nameLabel.text = mediaInfo.name avatarImageView.setCircleHeader(mediaInfo.avatar_url!) } if let commentCount = newsTopic!.comment_count { commentCount >= 10000 ? (commentLabel.text = "\(commentCount / 10000)万评论") : (commentLabel.text = "\(commentCount)评论") } else { commentLabel.isHidden = true } filterWords = newsTopic?.filter_words var urlString = String() if let videoDetailInfo = newsTopic?.video_detail_info { // 说明是视频 urlString = videoDetailInfo.detail_video_large_image!.url! /// 格式化时间 let minute = Int(newsTopic!.video_duration! / 60) let second = newsTopic!.video_duration! % 60 rightBottomLabel.text = String(format: "%02d:%02d", minute, second) } else { // 说明是大图 playButton.isHidden = true urlString = newsTopic!.large_image_list.first!.url! rightBottomLabel.text = "\(newsTopic!.gallary_image_count!)图" } largeImageView.kf.setImage(with: URL(string: urlString)!) if let label = newsTopic?.label { if label == "" { stickLabel.isHidden = true } else { stickLabel.setTitle(" \(label) ", for: UIControlState()) stickLabel.isHidden = false } } } } override init(style: UITableViewCellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) addSubview(largeImageView) largeImageView.addSubview(rightBottomLabel) largeImageView.addSubview(playButton) largeImageView.snp.makeConstraints { (make) in make.top.equalTo(titleLabel.snp.bottom).offset(kMargin) make.left.equalTo(titleLabel.snp.left) make.right.equalTo(titleLabel.snp.right) make.size.equalTo(CGSize(width: SCREENW - 30, height: 170)) } rightBottomLabel.snp.makeConstraints { (make) in make.size.equalTo(CGSize(width: 50, height: 20)) make.right.equalTo(largeImageView.snp.right).offset(-7) make.bottom.equalTo(largeImageView.snp.bottom).offset(-7) } playButton.snp.makeConstraints { (make) in make.center.equalTo(largeImageView) } } /// 中间的播放按钮 fileprivate lazy var playButton: UIButton = { let playButotn = UIButton() playButotn.setImage(UIImage(named: "playicon_video_60x60_"), for: UIControlState()) playButotn.sizeToFit() playButotn.addTarget(self, action: #selector(playButtonClick), for: .touchUpInside) return playButotn }() /// 右下角显示图片数量或视频时长 lazy var rightBottomLabel: UILabel = { let rightBottomLabel = UILabel() rightBottomLabel.textAlignment = .center rightBottomLabel.layer.cornerRadius = 10 rightBottomLabel.layer.masksToBounds = true rightBottomLabel.font = UIFont.systemFont(ofSize: 13) rightBottomLabel.textColor = UIColor.white rightBottomLabel.backgroundColor = YMColor(0, g: 0, b: 0, a: 0.6) return rightBottomLabel }() /// 中间大图 fileprivate lazy var largeImageView: UIImageView = { let largeImageView = UIImageView() largeImageView.backgroundColor = UIColor.lightGray return largeImageView }() /// 举报按钮点击 override func closeBtnClick() { closeButtonClosure?(filterWords!) } /// 播放按钮点击 func playButtonClick() { } /// 举报按钮点击回调 func closeButtonClick(_ closure:@escaping (_ filterWord: [YMFilterWord])->()) { closeButtonClosure = closure } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } }
[ -1 ]
7661ef92232baba45b2836f1ad5858bc948adf6e
0ac4f82e96c0e1b9ebb39b58b73de11c96abae13
/ProductivityAPP/Controller/MainViewController.swift
caf0371892cb35e9063720e88c65603e651e43e4
[]
no_license
zfred219/Productime
22bdbd311dfa58cacc6d62e3ef8e9984c924d689
30aa26e9d63d3e2aa9301f487028774a85090faf
refs/heads/master
2023-03-20T03:28:55.073983
2021-03-20T05:26:15
2021-03-20T05:26:15
330,591,530
0
0
null
null
null
null
UTF-8
Swift
false
false
6,930
swift
// // MainViewController.swift // ProductivityAPP // // Created by Kaixiang Zhang on 4/13/20. // Copyright © 2020 Kaixiang Zhang. All rights reserved. // import UIKit class MainViewController: UIViewController { @IBOutlet weak var leftMt: UILabel! @IBOutlet weak var rightMt: UILabel! @IBOutlet weak var sun: UILabel! @IBOutlet weak var cloud1: UILabel! @IBOutlet weak var cloud2: UILabel! @IBOutlet weak var dayCt: UILabel! @IBOutlet weak var timerCt: UILabel! override func viewDidLoad() { super.viewDidLoad() mainViewControllerInstance = self createUI() checkGesture() dayCounter.dayZero() print("ss") } let dayCounter = DayCounter(day: -1) var todoListObj = ToDoList() func checkGesture() { let swipeLeft = UISwipeGestureRecognizer(target: self, action: #selector(handleGesture)) swipeLeft.direction = .left self.view.addGestureRecognizer(swipeLeft) let swipeRight = UISwipeGestureRecognizer(target: self, action: #selector(handleGesture)) swipeRight.direction = .right self.view.addGestureRecognizer(swipeRight) } @objc func handleGesture(gesture: UISwipeGestureRecognizer) -> Void { if gesture.direction == .right { print("To Left") let todoView = self.storyboard?.instantiateViewController(withIdentifier: "todo") as! TodoViewController self.present(todoView, animated: true, completion: nil) } else if gesture.direction == .left { print("To Right") let setView = self.storyboard?.instantiateViewController(withIdentifier: "setting") as! SettingViewController self.present(setView, animated: true, completion: nil) } } //TODO : right side perform segue func createUI() { createLeftMount() createRightMount() createSun() createClouds() } func createSun() { sun.clipsToBounds = true sun.layer.cornerRadius = sun.frame.width/2 sun.layer.masksToBounds = true sun.backgroundColor = UIColor(cgColor: UIColor(red: 0.95, green: 0.38, blue: 0.38, alpha: 1).cgColor) } func createClouds() { cloud1.clipsToBounds = true cloud1.layer.cornerRadius = 45 cloud1.backgroundColor = UIColor(cgColor: UIColor(red: 0.769, green: 0.769, blue: 0.769, alpha: 0.95).cgColor) cloud2.clipsToBounds = true cloud2.layer.cornerRadius = 45 cloud2.backgroundColor = UIColor(cgColor: UIColor(red: 0.769, green: 0.769, blue: 0.769, alpha: 0.90).cgColor) } func createLeftMount() { leftMt.clipsToBounds = true leftMt.backgroundColor = UIColor(cgColor: UIColor(red: 0.011, green: 0.062, blue: 0.138, alpha: 0.9).cgColor) leftMt.layer.cornerRadius = 60 leftMt.rotate(degrees: 47) } func createRightMount() { rightMt.clipsToBounds = true rightMt.backgroundColor = UIColor(cgColor: UIColor(red: 0.163, green: 0.343, blue: 0.613, alpha: 0.95).cgColor) rightMt.layer.cornerRadius = 60 rightMt.rotate(degrees: 137) } } extension UIView { func rotate(degrees: CGFloat) { rotate(radians: CGFloat.pi * degrees / 180.0) } func rotate(radians: CGFloat) { self.transform = CGAffineTransform(rotationAngle: radians) } } /* func fetchCalendar() { let string = "https://www.googleapis.com/calendar/v3/calendars/zkx219%40gmail.com/events" let url = NSURL(string: string) let request = NSMutableURLRequest(url: url! as URL) request.setValue("Bearer 309108839580-9a6qrr00qnsktk8vrqpkk6b0urv74fhg.apps.googleusercontent.com", forHTTPHeaderField: "Authorization") request.httpMethod = "GET" request.addValue("application/json", forHTTPHeaderField: "Content-Type") let session = URLSession.shared let mData = session.dataTask(with: request as URLRequest) { (data, response, error) -> Void in if let res = response as? HTTPURLResponse { print("res: \(res)") print("Response: \(String(describing: response))") }else{ print("Error: \(String(describing: error))") } } mData.resume() } func writetoGC(token:String, startTime: String, endTime: String, summary: String, description: String) { let url = URL(string: "https://www.googleapis.com/calendar/v3/calendars/{YOUR CALENDAR ID HERE}/events") let summary1 = confirmationCode + "; " + summary let session = URLSession.shared print(session) var request = NSMutableURLRequest(url: url!) request.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization") request.httpMethod = "POST" print(request) // token, startTime, endTime, summary, description var myHttpBody: Data = """ { "end": { "dateTime": "\(endTime)", "timeZone": "America/Chicago" }, "start": { "dateTime": "\(startTime)", "timeZone": "America/Chicago" }, "summary": "\(summary1)", "description": "\(description)" } """.data(using: .utf8)! as Data do { request.httpBody = myHttpBody } catch let error { print(error.localizedDescription) } request.addValue("application/json", forHTTPHeaderField: "Content-Type") print("Request: ") print(request.description) print(request.allHTTPHeaderFields) print("Body is:") print(request.httpBody) let task = session.dataTask(with: request as URLRequest, completionHandler: { data, response, error in guard error == nil else { return } guard let data = data else { return } sleep(1) do { //create json object from data if let json = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [String: Any] { print("Response is:") print(json) print("Description:") print(json.description) print("Debug Description:") print(json.debugDescription) // handle json... } } catch let error { print("Error during Serialization:") print(error.localizedDescription) } }) task.resume() //verifyEntry() } */
[ -1 ]
a3e0f1bb8c0794cd2b7c1ae0f2caa88a7f2be167
49da759503e288b3a3ed378d0baa46288b7102a3
/GRUAMOVIL/ios/GorilasApp/CarworkshopListViewController.swift
df9c2e6a6c7ea44944246c8cc93104ff5a9fa27f
[]
no_license
garfiaslopez/GruasGorilas
75fb0cb0dd97b1243fcbc6834f604f51e036b23d
4854639bbd23105ff60d17ffa8af21eb3260d615
refs/heads/master
2020-03-22T18:38:57.567252
2018-07-26T21:09:55
2018-07-26T21:09:55
140,473,203
0
0
null
null
null
null
UTF-8
Swift
false
false
543
swift
// // CarworkshopListViewController.swift // GruaMovil // // Created by Jose De Jesus Garfias Lopez on 8/1/17. // Copyright © 2017 Jose De Jesus Garfias Lopez. All rights reserved. // import UIKit class CarworkshopListViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }
[ 275842, 230147, 224643, 313733, 280710, 287243, 306577, 279442, 306578, 369434, 280219, 299165, 275358, 315170, 225955, 295460, 288165, 304933, 326311, 286249, 289578, 289196, 370093, 302256, 289204, 286775, 280760, 298937, 298936, 299709, 283839, 277696, 288579, 293700, 299973, 293961, 280015, 212561, 307410, 301012, 237655, 301016, 298842, 241499, 280028, 280029, 280030, 298843, 278752, 311645, 290020, 291556, 294889, 309353, 311913, 296813, 277487, 276849, 308721, 227315, 296436, 315250, 294518 ]
8a95b9c6889284fe83ec574e9510ec82663bb66b
10036320d9b9de2201135a79b3e446c53fd3a6cc
/Dictionary_RickAndMorty/model/EpisodeModel.swift
55283ec00d5abdb868eed596b8750d1fe3783109
[]
no_license
policante/Rick_And_Morty
6e13a2a96f6af744dc06b1617ef683202baf131c
cba1416d7c4959c30ab6930d0253d7d731fa9477
refs/heads/master
2023-01-08T02:50:09.179342
2020-11-09T21:53:42
2020-11-09T21:53:42
311,472,987
0
0
null
null
null
null
UTF-8
Swift
false
false
340
swift
// // EpisodeModel.swift // Dictionary_RickAndMorty // // Created by Rodrigo Martins on 05/11/20. // import Foundation struct EpisodeModel: Codable, Identifiable { let id: Int let name: String let air_date: String let episode: String let characters: [String] let url: String let created: String }
[ -1 ]
ee0001bfe81604be2182049f7bab478c21d9bd33
d398ba65e805279516f68dfd4e2ba28cd24f2ec5
/Countdown/View/TestView/MouseUpDown.swift
2e58b9c7f62646a811514567e925b2562b0ac23b
[ "MIT" ]
permissive
funway/Countdown
273924b16164d63b82084af09337f77dd5f4c569
a27aa5bd698590afe1ec9afb03ff163732af16e6
refs/heads/master
2023-04-09T08:40:48.008539
2021-04-30T01:28:24
2021-04-30T01:28:24
309,121,133
35
2
null
null
null
null
UTF-8
Swift
false
false
2,528
swift
// // MouseUpDown.swift // Countdown // // Created by funway on 2020/10/4. // Copyright © 2020 funwaywang. All rights reserved. // import SwiftUI import Combine class Model: ObservableObject { var timerPublisher: Timer.TimerPublisher? var handle: AnyCancellable? var startstop: Cancellable? func createTimerPublisher() { timerPublisher = Timer.publish(every: 0.5, on: RunLoop.main, in: .default) handle = timerPublisher?.sink(receiveValue: { print($0) self.objectWillChange.send() }) } init() { createTimerPublisher() } func start() { // if startstop = timerPublisher?.connect() print("start") } func stop() { startstop?.cancel() startstop = nil print("stop") // or create it conditionaly for later use createTimerPublisher() } } struct MouseUpDown: View { @ObservedObject var model = Model() var body: some View { VStack { Button(action: { self.model.start() }) { Text("Start") } Button(action: { self.model.stop() }) { Text("Stop") } MouseUpDownRepresentable(content: Rectangle()).environmentObject(model) .frame(width: 50, height: 50) } .frame(maxWidth: .infinity, maxHeight: .infinity) } } class MouseUpDownViewClass<Content>: NSHostingView<Content> where Content : View { let model: Model required init(model: Model, rootView: Content) { self.model = model super.init(rootView: rootView) } @objc required dynamic init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } required init(rootView: Content) { fatalError("init(rootView:) has not been implemented") } override func mouseUp(with event: NSEvent) { print("mouse up") model.stop() } override func mouseDown(with event: NSEvent) { print("mouse down") model.start() } } struct MouseUpDownRepresentable<Content>: NSViewRepresentable where Content: View { @EnvironmentObject var model: Model let content: Content func makeNSView(context: Context) -> NSHostingView<Content> { return MouseUpDownViewClass(model: model, rootView: self.content) } func updateNSView(_ nsView: NSHostingView<Content>, context: Context) { } }
[ -1 ]
58e765b618576fb266c57c64fb044d4cb269c141
446f2e5c3b6b0f0acf433d43c7b025f3c3387ced
/ios-camera/ViewController.swift
7f196dfa5061f4dbc20727e580239e83a9289e0f
[]
no_license
rebornwhu/ios-camera
f2309023043850567b8776171211af790618e8e6
e88fda18742263df903b137b148f3b1b2746a0b6
refs/heads/master
2021-01-10T05:06:01.167495
2016-01-17T00:45:54
2016-01-17T00:45:54
49,795,482
0
0
null
null
null
null
UTF-8
Swift
false
false
4,862
swift
// // ViewController.swift // ios-camera // // Created by Xiao Lu on 1/16/16. // Copyright © 2016 Xiao Lu. All rights reserved. // import UIKit import MediaPlayer import MobileCoreServices class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate { @IBOutlet var imageView: UIImageView! @IBOutlet var takePictureButton: UIButton! var moviePlayerController: MPMoviePlayerController? var image: UIImage? var movieURL: NSURL? var lastChosenMediaType: String? @IBAction func shootPictureOrVideo(sender: UIButton) { pickMediaFromSource(UIImagePickerControllerSourceType.Camera) } @IBAction func selectExistingPictureOrVideo(sender: UIButton) { pickMediaFromSource(UIImagePickerControllerSourceType.PhotoLibrary) } override func viewDidLoad() { super.viewDidLoad() if !UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera) { takePictureButton.hidden = true } } override func viewDidAppear(animated: Bool) { super.viewDidAppear(animated) updateDisplay() } func updateDisplay() { if let mediaType = lastChosenMediaType { if mediaType == kUTTypeImage as String { imageView.image = image! imageView.hidden = false if moviePlayerController != nil { moviePlayerController!.view.hidden = true } } else if mediaType == kUTTypeMovie as String { if moviePlayerController == nil { moviePlayerController = MPMoviePlayerController(contentURL: movieURL) let movieView = moviePlayerController!.view movieView.frame = imageView.frame movieView.clipsToBounds = true view.addSubview(movieView) setMoviewPlayerLayoutConstraints() } else { moviePlayerController!.contentURL = movieURL } imageView.hidden = true moviePlayerController!.view.hidden = false moviePlayerController!.play() } } } func setMoviewPlayerLayoutConstraints() { let moviePlayerView = moviePlayerController!.view moviePlayerView.translatesAutoresizingMaskIntoConstraints = false let views = ["moviePlayerView": moviePlayerView, "takePictureButton": takePictureButton] view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|[moviewPlayerView]|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: views)) view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|[moviewPlayerView]-0-[takePictureButton]", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: views)) } func pickMediaFromSource(sourceType: UIImagePickerControllerSourceType) { let mediaTypes = UIImagePickerController.availableMediaTypesForSourceType(sourceType)! if UIImagePickerController.isSourceTypeAvailable(sourceType) && mediaTypes.count > 0 { let picker = UIImagePickerController() picker.mediaTypes = mediaTypes picker.delegate = self picker.allowsEditing = true picker.sourceType = sourceType presentViewController(picker, animated: true, completion: nil) } else { let alertController = UIAlertController(title: "Error accessing media", message: "Unsupported media source.", preferredStyle: UIAlertControllerStyle.Alert) let okAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.Cancel, handler: nil) alertController.addAction(okAction) presentViewController(alertController, animated: true, completion: nil) } } // MARK: UIImagePickerControllerDelegate func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) { lastChosenMediaType = info[UIImagePickerControllerMediaType] as? String if let mediaType = lastChosenMediaType { if mediaType == kUTTypeImage as String { image = info[UIImagePickerControllerEditedImage] as? UIImage } else if mediaType == kUTTypeMovie as String { movieURL = info[UIImagePickerControllerMediaURL] as? NSURL } } picker.dismissViewControllerAnimated(true, completion: nil) } func imagePickerControllerDidCancel(picker: UIImagePickerController) { picker.dismissViewControllerAnimated(true, completion: nil) } }
[ -1 ]
2c4319a1e3ad18831473dde77b820d54fc392622
71e64b3a215365737f7001ed7ca09150fdd444c4
/Sources/main.swift
ae36be6e179d7c54563aaff8c3b357fea8a230c8
[ "MIT" ]
permissive
ikuehne/Papaya
40e84237f035273f3e3380a82b7d946e86b357fa
6f8dda6a77824c8e0d66beb8a25d3e915f50998e
refs/heads/master
2021-01-10T09:43:58.912549
2016-01-02T02:56:50
2016-01-02T02:56:50
48,248,602
0
0
null
null
null
null
UTF-8
Swift
false
false
8,107
swift
/** Executable tests for the Papaya graph package */ /** Tests for undirected adjacency list implementation of graphs */ let names = ["Kevin Bacon", "Nets Katz", "Paul Erdos", "Natalie Portman", "MC Bat Commander"] let relationships = [("Kevin Bacon", "Natalie Portman"), ("Paul Erdos", "Nets Katz"), ("Paul Erdos", "Natalie Portman")] func testInits() { // Test the empty initializer var graph = UndirectedAList<String>() assert(graph.vertices.isEmpty) assert(graph.edges.isEmpty) // Test initializing with an array of vertices graph = UndirectedAList<String>(vertices: []) assert(graph.vertices.isEmpty) assert(graph.edges.isEmpty) let setnames: Set<String> = Set(names) graph = UndirectedAList<String>(vertices: names) var setverts: Set<String> = Set(graph.vertices) assert(setnames == setverts) assert(graph.edges.isEmpty) // Test initializing with another graph // note: where to test this when one graph has edges? var graph2 = UndirectedAList<String>(graph: graph) setverts = Set(graph2.vertices) assert(setnames == setverts) assert(graph2.edges.isEmpty) graph = UndirectedAList<String>() graph2 = UndirectedAList<String>(graph: graph) assert(graph2.vertices.isEmpty) assert(graph2.edges.isEmpty) } private func ==<T: Equatable>(lhs: (T, T), rhs: (T, T)) -> Bool { let (a, b) = lhs let (c, d) = rhs return (a == c && b == d) || (a == d && b == c) } private func ==<T: Equatable>(lhs: [(T, T)], rhs: [(T, T)]) -> Bool { for item1 in lhs { var found = false for item2 in rhs { found = found || (item1 == item2) } if !found { return false } } for item1 in rhs { var found = false for item2 in lhs { found = found || (item1 == item2) } if !found { return false } } return true } func testEdgesEqual() { let edges1 = [("a", "b"), ("c", "d"), ("a", "c")] let edges2 = [("b", "a"), ("a", "c"), ("d", "c")] let edges3 = [("a", "b"), ("a", "c"), ("e", "f"), ("e", "a")] assert(!(edges1 == edges3)) assert(edges1 == edges2) assert(!(edges2 == edges3)) } func testAddRemoveVertex() { // Adding vertices var graph = UndirectedAList<String>() try! graph.addVertex("James") assert(graph.vertices == ["James"]) try! graph.addVertex("Mitchard") assert(Set(graph.vertices) == Set(["James", "Mitchard"])) graph = UndirectedAList<String>(vertices: names) try! graph.addVertex("Earl") var setnames = Set(names) setnames.insert("Earl") assert(Set(graph.vertices) == setnames) setnames.remove("MC Bat Commander") try! graph.removeVertex("MC Bat Commander") assert(Set(graph.vertices) == setnames) for name in names { try? graph.removeVertex(name) // using try? allows this to pass over nonexistant edges } try! graph.removeVertex("Earl") assert(graph.vertices.isEmpty) // Test removing a vertex with edges graph = UndirectedAList<String>(vertices: names) for (from, to) in relationships { try! graph.addEdge(from, to: to) } assert(graph.edges == relationships) try! graph.removeVertex("Natalie Portman") assert(graph.edges == [("Paul Erdos", "Nets Katz")]) } /* do { try graph.addEdge("Kevin Bacon", to: "Natalie Portman") try graph.addEdge("Paul Erdos", to: "Nets Katz") try graph.addEdge("MC Bat Commander", to: "Natalie Portman") } catch { print("couldn't add an edge!") } print(graph.edges) try! graph.addVertex("Ian Kuehne") print(graph.vertices) try! graph.addEdge("Ian Kuehne", to: "Natalie Portman") do { try graph.addVertex("Ian Kuehne") } catch { print("couldn't add ian for some reason.") } var graph2 = UndirectedAMatrix(graph: graph) print(graph2.vertices) print(graph2.edges) print(graph.vertices) print(graph.edges) // A really basic BFS test let path = breadthFirstPath(graph, start: "Ian Kuehne", end: "Kevin Bacon") print(path) This stuff all works */ // Some things to test with BFS - multiple non-optimal paths, no path exists. /* // Creating a more complicated test graph let intVerts = 1...10 var intGraphList = UndirectedAList(vertices: intVerts) var intGraphMatrix = UndirectedAMatrix(vertices: intVerts) print(intGraphList.vertices) print(intGraphMatrix.vertices) print(intGraphList.edges) print(intGraphMatrix.edges) let edges = [(1, 2), (1, 9), (1, 7), (2, 3), (3, 4), (4, 7), (4, 8), (5, 6), (7, 8), (7, 9), (7, 10), (9, 10)] for (from, to) in edges { do { try intGraphList.addEdge(from, to: to) } catch { print("couldn't add edge from \(from) to \(to) to list graph.") } do { try intGraphMatrix.addEdge(from, to: to) } catch { print("couldn't add edge from \(from) to \(to) to list graph.") } } print(intGraphList.edges) print(intGraphMatrix.edges) print(try! intGraphMatrix.neighbors(10)) print("breadth first paths in the adjacency matrix test graph") var pathList = breadthFirstPath(intGraphMatrix, start: 1, end: 9) print("the shortest path from 1 to 9 is \(pathList), should be one edge") pathList = breadthFirstPath(intGraphMatrix, start: 1, end: 6) print("the shortest path from 1 to 6 is \(pathList) - should be nil") pathList = breadthFirstPath(intGraphMatrix, start: 10, end: 2) print("shortest path from 10 to 2 is \(pathList) - should be 3 edges") pathList = breadthFirstPath(intGraphMatrix, start: 10, end: 10) print("shortest path from 10 to itself is \(pathList)") // this stuff all works */ /* var items = [18, 5, 2, 4, 9, 16, 35, 34] // remember to test on repeated values var heap = PriorityHeap<Int>(compare: <=) for item in items { heap.insert(item) } var current = heap.peek() print("printing first queue") while current != nil { current = heap.extract() print(current) } print("printing second queue") var nextHeap = PriorityHeap<Int>(items: items, compare: <) current = nextHeap.peek() while current != nil { current = nextHeap.extract() print(current) } */ /* // create the example graph in the caltech math 6 spanning trees lecture let vertices = ["r", "a", "b", "c", "d", "e"] var graph = WeightedUndirectedAList<String>(vertices: vertices) try! graph.addEdge("r", to: "a", weight: 3.0) try! graph.addEdge("r", to: "b", weight: 2.0) try! graph.addEdge("a", to: "b", weight: 2.0) try! graph.addEdge("a", to: "c", weight: 4.0) try! graph.addEdge("b", to: "c", weight: 3.0) try! graph.addEdge("b", to: "e", weight: 5.0) try! graph.addEdge("c", to: "d", weight: 8.0) try! graph.addEdge("e", to: "d", weight: 5.0) print(try! graph.weight("c", to: "d")) print(try! graph.weight("b", to: "c")) print(try! graph.weight("b", to: "d")) let mst = primsSpanningTree(graph) print("minimum spanning tree:") print(mst.vertices) print(mst.edges) print(mst.totalWeight) */ // example dijkstra run from CLRS let vertices = ["s", "t", "y", "x", "z"] var graph = WeightedDirectedAList<String>(vertices: vertices) let edges = [("s", "t", 10.0), ("s", "y", 5.0), ("t", "x", 1.0), ("t", "y", 2.0), ("y", "t", 3.0), ("y", "x", 9.0), ("y", "z", 2.0), ("z", "x", 6.0), ("z", "s", 7.0)] for edge in edges { let (a, b, w) = edge try! graph.addEdge(a, to: b, weight: w) } var thing = dijkstraShortestPath(graph, start: "s", end: "x") print(thing) thing = dijkstraShortestPath(graph, start: "s", end: "z") print(thing) // example dijkstra run from youtube let verts = [1, 2, 3, 4, 5, 6, 7] let es = [(1, 2, 3.0), (1, 3, 5.0), (1, 4, 6.0), (2, 4, 2.0), (3, 4, 2.0), (3, 6, 3.0), (3, 7, 7.0), (3, 5, 6.0), (4, 6, 9.0), (5, 6, 5.0), (5, 7, 2.0), (6, 7, 1.0)] var graph2 = WeightedUndirectedAList<Int>(vertices: verts) for edge in es { let (a, b, w) = edge try! graph2.addEdge(a, to: b, weight: w) } var thing2 = dijkstraShortestPath(graph2, start: 1, end: 4) print(thing2) thing2 = dijkstraShortestPath(graph2, start: 1, end: 7) print(thing2) testInits() testEdgesEqual() testAddRemoveVertex()
[ -1 ]
4370cb884ec9e5dc723f78b980679cba2ce85581
2239ad6c4524fa46cf411d489917da10b0e3be9e
/rxScan/TodoItem.swift
ed9df01b87f9c5b069d47b256293fe5a6b6ea108
[]
no_license
yodfhafx/RxScanner
3fa6cef2f1349d160f40bb8f36b52661ecd90ae5
7d3022c5f3b767d2e113b97fe90f5841c709d282
refs/heads/master
2021-01-23T06:09:40.629476
2017-09-05T14:41:32
2017-09-05T14:41:32
102,491,568
0
0
null
null
null
null
UTF-8
Swift
false
false
526
swift
// // TodoItem.swift // rxScan // // Created by Yodfha on 8/1/2559 BE. // Copyright © 2559 Fhasai. All rights reserved. // import Foundation struct TodoItem { var title: String var deadline: NSDate var UUID: String init(deadline: NSDate, title: String, UUID: String) { self.deadline = deadline self.title = title self.UUID = UUID } var isOverdue: Bool { return (NSDate().compare(self.deadline) == NSComparisonResult.OrderedDescending) } }
[ -1 ]
dd6307094ce48c0b95c4624d3b95446394eaafb3
d294fa425f49f095f3d197e1fd9dcf52fae32806
/ApiCall/Constants.swift
51c2a70cf18322272c8389f90189676d377d717b
[]
no_license
AnkitiOSiDev/Api-Protocol-Generics
2650d341c024bd3f943fd5942ddde0373edcd6ed
86b675ba40319974a10570d0b8684b9f6aaaea12
refs/heads/master
2023-07-02T19:30:47.505154
2021-06-30T15:44:41
2021-06-30T15:44:41
378,406,395
0
0
null
null
null
null
UTF-8
Swift
false
false
1,837
swift
// // Constants.swift // ApiCall // // Created by Ankit on 15/06/21. // Copyright © 2021 Ankit. All rights reserved. // import Foundation enum HTTPMethod { case GET case POST var type : String { switch self { case .GET: return "GET" case .POST: return "POST" } } } enum Result<T,U> { case success(T) case failure(U) } typealias responseHandler<T> = (Result<T,Error>) -> Void enum ApiError : Error { case invalidRequest case invalidStautsCode case invalidResponse } enum Configuration { enum Error: Swift.Error { case missingKey, invalidValue } static func value(for key: String) throws -> String { guard let object = Bundle.main.object(forInfoDictionaryKey:key) else { throw Error.missingKey } switch object { case let string as String: return string default: throw Error.invalidValue } } } enum API { static var apiKey: String { do { let value: String = try Configuration.value(for: "API_KEY") return value } catch (let error) { fatalError(error.localizedDescription) } } static var baseURLNews: String { do { let value: String = try Configuration.value(for: "API_BASE_URL_NEWS") return value } catch (let error) { fatalError(error.localizedDescription) } } static var baseURLWeather: String { do { let value: String = try Configuration.value(for: "API_BASE_URL_WEATHER") return value } catch (let error) { fatalError(error.localizedDescription) } } }
[ -1 ]
519d4bbb3562098e050fdc94a28ff098894dad84
ac3d03f9984bbbc29c1e1f347e1b2ba212525216
/Word Search/Word Search/WordSearchFunctions.swift
d1a184cb9990b2a7ba990a31ce34e4dba1b096f5
[]
no_license
bryevo/iOS-development
24c4d14c1a71e7540e557e21174b2e11975cea44
41767673b2b401db6419d8599832c169cb24f523
refs/heads/master
2020-06-14T01:42:11.516655
2016-12-22T10:15:43
2016-12-22T10:15:43
75,526,560
0
0
null
null
null
null
UTF-8
Swift
false
false
4,795
swift
// // WordMethods.swift // Word Search // // Created by Brian Vo on 10/26/16. // Copyright © 2016 Brian Vo. All rights reserved. // import Foundation import UIKit let filepath = Bundle.main.path(forResource: "WordList", ofType: "txt") let lines = ReadWordList() enum Errors: Error { case invalid(String) case parseError(Int) } func ReadWordList() -> [String] { var lines = [String]() do { let allWords = try String(contentsOfFile: filepath!) lines = allWords.components(separatedBy: "\n") return lines } catch { // } return lines } func ScrabbleWord(scrabble: String) -> [String] { var finalList = [String]() var scrabbleLength = 0; for line in lines { var tempWord = Array(line.characters) for scrab in (scrabble.characters) { if ((tempWord.contains(scrab))) { scrabbleLength += 1 tempWord.remove(at: tempWord.index(of: scrab)!) } } if (tempWord.count == 0 && scrabbleLength >= 3) { finalList.append(line) } scrabbleLength = 0 } return finalList } func MorphWord(morph: String) -> [String] { var MorphSet = [String]() for line in lines { //(int i = 0; i < Lines.Length; i++) if (morph.characters.count == line.characters.count) { var counter = 0 var check = 0 for i in 0 ..< morph.characters.count { let morphChar = morph.characters[morph.characters.index(morph.startIndex, offsetBy: i)] if (morphChar == line.characters[line.characters.index(line.startIndex, offsetBy: i)]) { counter += 1 } else { check += 1 } } if ((morph.characters.count - 1) == counter && check == 1) { MorphSet.append(line) } } } return MorphSet; } func MorphChain(start: String, end: String, max: Int) throws -> [String] { if (!lines.contains(start) || !lines.contains(end) || start.characters.count != end.characters.count) { throw Errors.invalid("Invalid input") } var totalChains : [[String]] = [] //List of string arrays let setOne : [String] = [String](MorphWord(morph: start)) //starting word {e.g told: {bold, cold, fold, gold...} var wordsFound : [String] = [] var foundMorph : [String] = []; for sets in setOne { //temp list to stores the start word and the current indexed morph word var temp : [String] = [] temp.append(start); //add start word temp.append(sets); //add that specific index word totalChains.append(temp); //totalChains gets e.g 0: {told, bold}, 1: {told, cold}, 2: {told, sold}... wordsFound.append(sets); } var x = 0; //while x is less than the number of elements inside totalchains... while (x < totalChains.count) { let chain = totalChains[totalChains.index(totalChains.startIndex, offsetBy: x)] //assign chain to that specfic x index if (chain.count <= max) { // while the number of elements in chain is less than the max length provided if (chain.contains(end)) { foundMorph = chain; break } if (foundMorph.contains(end)) { //if the end word/word we're looking for is inside chain //found the morph list; gets that chain; breaks out of loop break } let nextChain : [String] = [String](MorphWord(morph: chain.last!)) //nextChain gets the morphed word of the last word in chain //iterate through the morph word for next in nextChain //(int i = 0; i < nextChain.Count; i++) { if (!wordsFound.contains(next)) { //temp gets every element inside chain; copies all of its contents var temp : [String] = [] for element in chain { temp.append(element); } temp.append(next); //temps adds the last index of next chain if (next == end) { foundMorph = temp; break } totalChains.append(temp); //total chains adds new list temp wordsFound.append(next); } } } else if (chain.count >= max) { break } x += 1 //x will increment until it hits the max count in total chains } return foundMorph; }
[ -1 ]
eb29f87a7392fd9479188e1ab241ef160271ceba
f3fbc08c45e99d6887a684976cc193ecfab412f3
/MainApp/controllers/ItemsDetailsVC.swift
cbc02bc3e55be7c7a82efda72e1212843ed39dde
[]
no_license
ahmedmahmoud014/MainApp
52cce04518a525099eeea5770538c76cdfcf77bc
4d446b602a15c1d9ad70cf57394a6018a5f5056b
refs/heads/master
2020-03-31T13:17:49.226398
2018-11-15T08:22:54
2018-11-15T08:22:54
152,249,612
0
0
null
null
null
null
UTF-8
Swift
false
false
5,172
swift
// // ItemsDetailsVC.swift // MainApp // // Created by mac bokk pro on 2018-10-14. // Copyright © 2018 mac bokk pro. All rights reserved. // import UIKit class ItemsDetailsVC: UIViewController { var lastContentOffset: CGFloat = 0 var cellOneHeight = 400 @IBOutlet weak var itemDetailsTV: UITableView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. // add cell to tableview itemDetailsTV.register(UINib(nibName: "DawnCTVCell", bundle: nil), forCellReuseIdentifier: "DawnCTVCell") // add cell to tableview itemDetailsTV.register(UINib(nibName: "UpperCItemTVCell", bundle: nil), forCellReuseIdentifier: "UpperCItemTVCell") } /* // 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. } */ func dismissView (){ dismiss(animated: true , completion: nil) } } extension ItemsDetailsVC : UITableViewDelegate , UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 2 } func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell : UITableViewCell! if indexPath.row == 0 { cell = itemDetailsTV.dequeueReusableCell(withIdentifier: "UpperCItemTVCell", for: indexPath) as! UpperCItemTVCell } else { cell = itemDetailsTV.dequeueReusableCell(withIdentifier: "DawnCTVCell", for: indexPath) as! DawnCTVCell } // cell.assignValuesToTVCell(item: allItems[indexPath.row]) return cell } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { if indexPath.row == 0 { return CGFloat(cellOneHeight) } else { return 650 } } func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { return 60 } func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { return "section \(section)" } // func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { // // let headerView = UIView(frame: CGRect(x:0, y: 0, width: tableView.frame.width, height: 150)) // let button: UIButton = UIButton(frame: CGRect(x:0, y:0, width:tableView.frame.width , height:80)) // button.setImage(UIImage(named: "home_green"), for: .normal) // button.addTarget(self, action: #selector(dismissView), for: .touchUpInside) // button.tag = section // // // button.imageInButtonRight(position: .right, semanticContent: .forceRightToLeft, imageEdgeSet: UIEdgeInsetsMake(25,tableView.frame.width-45, 25, 15)) // //button.titleLabel?.font = UIFont.init(name: "HacenAlgeria", size: 23)! // button.setTitleColor(UIColor.black, for:.normal ) // button.backgroundColor = UIColor.white // //button.contentHorizontalAlignment = .right // button.setTitle("section1 ", for: .normal) // headerView.addSubview(button) // button.addShadowR(roundBorder: 20,opacity: 0.1) // // // // return headerView // } // func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) { // // // if targetContentOffset.pointee.y < scrollView.contentOffset.y { // // print("move up ") // cellOneHeight = 200 // } else { // // it's going down // print("move down ") // cellOneHeight = 400 // // // } // itemDetailsTV.reloadData() // // } // // this delegate is called when the scrollView (i.e your UITableView) will start scrolling // func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { // self.lastContentOffset = scrollView.contentOffset.y // } // // // while scrolling this delegate is being called so you may now check which direction your scrollView is being scrolled to // func scrollViewDidScroll(_ scrollView: UIScrollView) { // if (self.lastContentOffset < scrollView.contentOffset.y) { // // // moved to up // cellOneHeight = 0 // // } else if (self.lastContentOffset > scrollView.contentOffset.y) { // // moved to bottom // cellOneHeight = 400 // // // } else { // // didn't move // print("move no ") // // // } // // itemDetailsTV.reloadData() // // // } // }
[ -1 ]
307d661962b5fc2ac7b973969d7f99cdb0f7a289
8b2b7da593692b6bcdb242485b492cf4bf4e965d
/Naql/Scenes/IncomeRequests/IncomeRequestsViewController.swift
8f71da8c87d1b45d0e1c22d40f9c747495b97389
[]
no_license
Ahmedyoussefg5/Naql
0f2599071d82d82e05ac9034177dcc0e7fe2f196
bd2fb0aaa2083e205cd763c712775c38486fdfd3
refs/heads/master
2020-05-09T14:11:16.385611
2019-04-13T14:49:06
2019-04-13T14:49:06
181,185,424
0
0
null
null
null
null
UTF-8
Swift
false
false
1,940
swift
// // RefuseMessageViewController.swift // Naql // // Created by Youssef on 4/10/19. // Copyright © 2019 Youssef. All rights reserved. // import UIKit class IncomeRequestsViewController: UIViewController { lazy var mainTableView: UITableView = { let tableV = UITableView() tableV.isTransperant() tableV.separatorColor = .clear tableV.delegate = self tableV.dataSource = self if userType == .driver { tableV.register(MyRequestsCell.self, forCellReuseIdentifier: "IncomeRequests") } else if userType == .commercial { tableV.register(MyOffersCell.self, forCellReuseIdentifier: "IncomeRequests") } return tableV }() override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .white view.addSubview(mainTableView) mainTableView.fillSuperview() } } extension IncomeRequestsViewController: UITableViewDataSource, UITableViewDelegate { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 10 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if userType == .driver { let cell = tableView.dequeueReusableCell(withIdentifier: "IncomeRequests", for: indexPath) as! MyRequestsCell return cell } else if userType == .commercial { let cell = tableView.dequeueReusableCell(withIdentifier: "IncomeRequests", for: indexPath) as! MyOffersCell return cell } fatalError() } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 200 } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { navigationController?.pushViewController(RequestDetailsViewController(), animated: true) } }
[ -1 ]
2e8dcc0a19fef5b34366d17b5ebe23de91606754
2f8663118f1c413939e681ac8876718f9c215b62
/Dricom/Dricom/Source/VIPER/ChatList/View/ChatListViewInput.swift
844442613cb53028e36d47fe6d8438e11a866922
[]
no_license
fareast-vladivostok-ivin/Dricom-iOS
11ee7e34723acfd74f7cd2bb00fab57ae422d5b5
b13a4ef7e403a39d9bd5d547cea5dd700a028231
refs/heads/master
2021-01-13T08:34:17.759842
2017-09-13T18:13:35
2017-09-13T18:13:35
71,826,724
0
1
null
2017-09-13T18:13:36
2016-10-24T19:55:33
Swift
UTF-8
Swift
false
false
686
swift
import Foundation struct ChatListRowData { let avatarImageUrl: URL? let userName: String? let messageText: String? let createdAtText: String? let onTap: (() -> ())? } struct ChatListEmptyRowData { let title: String let message: String } enum ChatListViewState { case undefined case empty(ChatListEmptyRowData) case data([ChatListRowData]) } protocol ChatListViewInput: class, ViewLifecycleObservable, MessageDisplayable { func setViewTitle(_ title: String) func setState(_ state: ChatListViewState) func setCanRefresh(_ canRefresh: Bool) func endRefreshing() var onPullToRefreshAction: (() -> ())? { get set } }
[ -1 ]
002aab4bb8bd104a976b9aa464c3c24b1d0e7c02
39aa9ba2e9de4e65fec1e728caf8505f54464e17
/Examples/UserListApp/UserListApp/AppDelegate.swift
7b4dca4ba534950847ea25a5f419ed46ecfe14f1
[ "MIT" ]
permissive
devxoul/AlertReactor
b492a0482fe31441151471eaa16e6fbb7942da11
c5da1ebd9c7293ccc6d5e328ded55f975688004f
refs/heads/master
2023-09-03T20:39:16.702544
2019-06-15T06:08:42
2019-06-15T06:09:44
98,679,986
23
3
MIT
2019-06-15T06:08:19
2017-07-28T19:09:19
Swift
UTF-8
Swift
false
false
852
swift
// // AppDelegate.swift // UserListApp // // Created by Suyeol Jeon on 29/07/2017. // Copyright © 2017 Suyeol Jeon. All rights reserved. // import UIKit import RxCocoa @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? ) -> Bool { let window = UIWindow(frame: UIScreen.main.bounds) window.backgroundColor = .white window.makeKeyAndVisible() let reactor = UserListViewReactor() let viewController = UserListViewController(reactor: reactor) let navigationController = UINavigationController(rootViewController: viewController) window.rootViewController = navigationController self.window = window return true } }
[ -1 ]
4633c51fb29444ca0b808e11f897a9966ee30c7f
407360b18e0b6729969ba596b7b87918aa627fe0
/FDO/Config/Auth/KeychainManager.swift
d5fd26f1d93da91cd0bbde68ef76f222979e207e
[]
no_license
herasimau/fdo
cff52a2c0ca83ba850b60220a21c173be657c0e6
b3c07f038c43be828fc49f40950626b7cae5e427
refs/heads/master
2023-06-23T00:13:32.461971
2020-09-27T13:16:36
2020-09-27T13:16:36
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,232
swift
// // KeychainManager.swift // fdo // // Created by Leanid Herasimau on 18/04/2020. // Copyright © 2020 Tusur. All rights reserved. // import Foundation import KeychainAccess public class KeychainManager { static private var keychain: KeychainAccess.Keychain? = { guard let bundleIdentifier = Bundle.main.bundleIdentifier else { return nil } return KeychainAccess.Keychain(service: bundleIdentifier) }() public class func stringFor(key: String) -> String? { return keychain?[key] } public class func setString(value: String?, for key: String) { keychain?[key] = value } public class func set<T>(value: T?, for key: String) where T: Codable { if let data = try? JSONEncoder().encode(value) { try? keychain?.set(data, key: key) } } public class func valueFor<T>(key: String) -> T? where T: Codable { if let data = try? keychain?.getData(key) { return try? JSONDecoder().decode(T.self, from: data) } return nil } public class func removeValueFor(key: String) { try? keychain?.remove(key) } public class func removeAll() { try? keychain?.removeAll() } }
[ -1 ]
4d1e3f0163d43c7ad38b8e67413d5788d49f8e5b
01c88108681cc6bd97bf769031b8ae45c3a07d31
/QuestGo/QuestGo/Analytics/QuestPageAnalytics.swift
8c5f4869fc743941c8f056d6ebf9edea65529e54
[]
no_license
serxpol/podlodka--demo-kotlin--multiplatform
8dfc5804eff887cf073f5edca17a5c0452ee541b
2affc07c9156becd6d0ddbfe14efaf4fab691b3f
refs/heads/main
2023-02-03T02:15:15.927823
2020-12-15T07:54:02
2020-12-15T07:54:02
null
0
0
null
null
null
null
UTF-8
Swift
false
false
938
swift
// // QuestPageAnalytics.swift // QuestGo // // Created by Алексей Гладков on 09.12.2020. // Copyright © 2020 Алексей Гладков. All rights reserved. // import Foundation import FirebaseAnalytics class QuestPageAnalytics { func pageLoaded(questId: Int, questPage: Int) { Analytics.logEvent("main_page_loaded", parameters: [ "questId" : questId, "questPage": questPage ]) } func infoLoaded(questId: Int, questPage: Int) { Analytics.logEvent("main_info_loaded", parameters: [ "questId": questId, "questPage": questPage ]) } func answerSend(questId: Int, questPage: Int, code: String, correct: Bool) { Analytics.logEvent("main_page_code", parameters: [ "questId": questId, "questPage": questPage, "code": code, "correct": correct ]) } }
[ -1 ]
60506ec99dc828d3d12986c5412fd8f9d809eb8d
31c866e013b06a1c5b3aacd13117b3f3c3eba2aa
/V Game/ViewController.swift
a25fc83dce5b078a69764d2e6f0b664e337bba78
[]
no_license
Victor1245/RipOffGame
f10d761cfed5317886f766fc9b9ee620e0b07998
b5df7c716cb45307700cbdc1a8f8054ad6e07ec2
refs/heads/master
2023-01-12T15:07:14.625487
2020-11-19T13:24:17
2020-11-19T13:24:17
314,255,803
0
0
null
null
null
null
UTF-8
Swift
false
false
828
swift
// // ViewController.swift // V Game // // Created by Максим Грицков on 18.11.2020. // import Cocoa import SpriteKit import GameplayKit class ViewController: NSViewController { @IBOutlet var skView: SKView! override func viewDidLoad() { super.viewDidLoad() if let view = self.skView { // Load the SKScene from 'GameScene.sks' if let scene = SKScene(fileNamed: "GameScene") { // Set the scale mode to scale to fit the window scene.scaleMode = .aspectFit // Present the scene view.presentScene(scene) } view.ignoresSiblingOrder = true view.showsFPS = true view.showsNodeCount = true } } }
[ 188355, 368013, 327151, 295727, 308725 ]
836acc7add538387165ab923c3aff662b45484a6
832976fab3db6b9de16f9e4b791f1285265edf50
/AlgoDS.playground/Pages/4.3.xcplaygroundpage/Contents.swift
d01ed9a759b11ca726f0d11b3d9365cfeb342536
[]
no_license
dbaeka/Swift-Data-Structures-and-Algos
91c41f62906bf55d58236a5eff3b64d66069cfed
a8af61157964bfb69e5714065983e18c43d1f2b6
refs/heads/master
2022-12-20T08:19:14.328386
2020-10-04T05:28:04
2020-10-04T05:28:04
296,956,418
0
0
null
null
null
null
UTF-8
Swift
false
false
1,882
swift
import UIKit import Foundation import PlaygroundSupport PlaygroundPage.current.needsIndefiniteExecution = true // MARK:- Chapter 4 func createLinkedListsRecurse<T>(tree: TreeNode<T>) -> [DoubleLinkedList<TreeNode<T>>] { var result = [DoubleLinkedList<TreeNode<T>>]() createLLRecureseHelper(tree: tree, result: &result, level: 0) return result } func createLinkedListsBFS<T>(tree: TreeNode<T>) -> [DoubleLinkedList<TreeNode<T>>] { var result = [DoubleLinkedList<TreeNode<T>>]() var list = DoubleLinkedList<TreeNode<T>>() list.append(value: tree) while list.count > 0 { result.append(list) let parents = list list = DoubleLinkedList<TreeNode<T>>() var head = parents.first while head != nil { if head!.getValue.children[0] != nil { list.append(value: head!.getValue.children[0]!) } if head!.getValue.children[1] != nil { list.append(value: head!.getValue.children[1]!) } head = head!.next } } return result } func createLLRecureseHelper<T>(tree: TreeNode<T>?, result: inout [DoubleLinkedList<TreeNode<T>>], level: Int) { if tree == nil { return } var list: DoubleLinkedList<TreeNode<T>>? if result.count == level { list = DoubleLinkedList<TreeNode<T>>() result.append(list!) } else { list = result[level] } list!.append(value: tree!) createLLRecureseHelper(tree: tree!.children[0], result: &result, level: level + 1) createLLRecureseHelper(tree: tree!.children[1], result: &result, level: level + 1) } var test = [1, 2, 3, 4, 5, 6, 7, 9, 12] var treeRoot = _createMinimalBST(array: test) var result = createLinkedListsRecurse(tree: treeRoot!) var result2 = createLinkedListsBFS(tree: treeRoot!) print(result) print(result2)
[ -1 ]
6a3e7ec026e6fe064ad3781c545ccc947ebcfba9
4cebaea4a0705bffc5b0ed4fa482bd3e265cdd00
/Sources/SwiftSDK/Files/BackendlessFile.swift
84b49048ffcf160554e5381babf18f2eb4308a9a
[ "MIT" ]
permissive
hslightnin/Swift-SDK
0376c2c4be1c6c155ab92fb76b45da09d7709077
2ad8f89dded685d1fad985b123a337eb2e57d166
refs/heads/master
2022-12-09T18:59:45.521760
2020-08-27T16:15:42
2020-08-27T16:15:42
283,262,251
0
0
MIT
2020-07-28T16:04:25
2020-07-28T16:04:24
null
UTF-8
Swift
false
false
1,141
swift
// // BackendlessFile.swift // /* * ********************************************************************************************************************* * * BACKENDLESS.COM CONFIDENTIAL * * ******************************************************************************************************************** * * Copyright 2020 BACKENDLESS.COM. All Rights Reserved. * * NOTICE: All information contained herein is, and remains the property of Backendless.com and its suppliers, * if any. The intellectual and technical concepts contained herein are proprietary to Backendless.com and its * suppliers and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret * or copyright law. Dissemination of this information or reproduction of this material is strictly forbidden * unless prior written permission is obtained from Backendless.com. * * ******************************************************************************************************************** */ import Foundation @objcMembers public class BackendlessFile: NSObject { public var fileUrl: String? }
[ -1 ]
223d888d8e8a1378679636e33367a95972bc4cb3
a5bfd8c76bd941722419a6f70fb40ca79fb920e4
/Sources/SCTE35Parser/SpliceCommands/SpliceCommandType.swift
abdb5e9eaff2c0e133846f1fe313e831d5b3dbac
[ "MIT" ]
permissive
theRealRobG/SCTE35Parser
27edc168ce99bc67c8282e219893ea2bf482e161
194170ff9631b0a55bd109fbbb76fe98f5eb10e7
refs/heads/main
2023-05-03T09:58:30.548225
2021-05-17T21:07:47
2021-05-17T21:07:47
352,052,577
2
1
null
2021-05-17T21:07:48
2021-03-27T11:13:41
Swift
UTF-8
Swift
false
false
313
swift
// // SpliceCommandType.swift // // // Created by Robert Galluccio on 30/01/2021. // public enum SpliceCommandType: UInt8 { case spliceNull = 0x00 case spliceSchedule = 0x04 case spliceInsert = 0x05 case timeSignal = 0x06 case bandwidthReservation = 0x07 case privateCommand = 0xff }
[ -1 ]
1ab12740998891fe08aaada769cdbdc793e579bb
a4881a421a177657df3211ed20cbb606f074bfc3
/RotateImageiOS/Assignment3Tests/Assignment3Tests.swift
f039542a29a70b0916247906e99a077351b3070c
[]
no_license
dylanwithgravity/Mobile-Dev-Course
2cf8a3ef4b4cd7efbca3f5139f1dc4a70c80406f
6cf9877e0ae78f49cb5fc87f4c17377b16b7382b
refs/heads/master
2021-07-18T06:53:28.472585
2017-10-24T01:52:05
2017-10-24T01:52:05
108,062,417
0
0
null
null
null
null
UTF-8
Swift
false
false
995
swift
// // Assignment3Tests.swift // Assignment3Tests // // Created by Dylan Williamson on 9/21/16. // Copyright © 2016 Dylan Williamson. All rights reserved. // import XCTest @testable import Assignment3 class Assignment3Tests: XCTestCase { override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } func testExample() { // This is an example of a functional test case. // Use XCTAssert and related functions to verify your tests produce the correct results. } func testPerformanceExample() { // This is an example of a performance test case. self.measure { // Put the code you want to measure the time of here. } } }
[ 313357, 305179, 98333, 239650, 229413, 102437, 354343, 204840, 354345, 227370, 223274, 292902, 233517, 155694, 309295, 229424, 282672, 229430, 180280, 288834, 286788, 313416, 311372, 354385, 223316, 280661, 315476, 307289, 354393, 315487, 237663, 45153, 309345, 280675, 227428, 307301, 280677, 313447, 315497, 131178, 278634, 194666, 315498, 278638, 288879, 284788, 333940, 223350, 233590, 280694, 237689, 288889, 131191, 292988, 313469, 215166, 131198, 292992, 215164, 194691, 227460, 280712, 215178, 235662, 311438, 323729, 278677, 284826, 278691, 233636, 184484, 299174, 233642, 284842, 153776, 239793, 278708, 131256, 184505, 278714, 223419, 280762, 227513, 299198, 295098, 280768, 280778, 282831, 280795, 227548, 229597, 301279, 311519, 280802, 176362, 286958, 184570, 227578, 184575, 309503, 194820, 313608, 276744, 278797, 325905, 319763, 325912, 309529, 282909, 278816, 282913, 233762, 227616, 217380, 211235, 282919, 98610, 280887, 278842, 315706, 307517, 287041, 287043, 321860, 311621, 139589, 280902, 319813, 227654, 325968, 6481, 278869, 289110, 305495, 6489, 168281, 293556, 323935, 106847, 354655, 321894, 416104, 280939, 285040, 313713, 199029, 246136, 291192, 317820, 211326, 311681, 248194, 227725, 240016, 190871, 291224, 293274, 141728, 61857, 285090, 61859, 246178, 289189, 315810, 315811, 311727, 299441, 283064, 278970, 319930, 293306, 293310, 291267, 127427, 127428, 278989, 281037, 281040, 278993, 326100, 278999, 328152, 176601, 369116, 188894, 287198, 279008, 160225, 358882, 285150, 279013, 279018, 319981, 291311, 281072, 309744, 319987, 279029, 233978, 279039, 301571, 291333, 342536, 287241, 279050, 283153, 303636, 279062, 279065, 299700, 291358, 180771, 277029, 293419, 244269, 283182, 283184, 236081, 23092, 234036, 279094, 289332, 315960, 338490, 70209, 115270, 70215, 293448, 377418, 281166, 281171, 309846, 332378, 295519, 66150, 111208, 279146, 313966, 281199, 295536, 287346, 287352, 301689, 244347, 279164, 291454, 189057, 279177, 152203, 287374, 111253, 316053, 117397, 230040, 289434, 303771, 111259, 221852, 205471, 279206, 287404, 295599, 285361, 303793, 299699, 342706, 318130, 166582, 289462, 314040, 230072, 158394, 285371, 285372, 285373, 287422, 285374, 303803, 66242, 287433, 154316, 287439, 334547, 279252, 96984, 289502, 299746, 295652, 279269, 246503, 234217, 342762, 129773, 289518, 230125, 279280, 312047, 312052, 125684, 230134, 199414, 154359, 228088, 299770, 279294, 205568, 242433, 295682, 299776, 191235, 285444, 322313, 322316, 295697, 291604, 166676, 285466, 283419, 326429, 281377, 234277, 283430, 262951, 279336, 289576, 262954, 318250, 295724, 318252, 312108, 285487, 164656, 301871, 303920, 262962, 230199, 285497, 293693, 160575, 281408, 295744, 279362, 295746, 318278, 201551, 281433, 230234, 322395, 301918, 295776, 279392, 293730, 303972, 279397, 230248, 177001, 201577, 308076, 400239, 246641, 207732, 295798, 228215, 209783, 209785, 279417, 246648, 177019, 226170, 291712, 113542, 287622, 228233, 228234, 308107, 58253, 56208, 308112, 234386, 293781, 324507, 318364, 310176, 310178, 289698, 189348, 283558, 289703, 279464, 293800, 310182, 236461, 293806, 304051, 189374, 289727, 19399, 213960, 279498, 316364, 304087, 50143, 324586, 326635, 203757, 289774, 183279, 304110, 320493, 287731, 240630, 295927, 304122, 312314, 318461, 234500, 277509, 134150, 322570, 230410, 234514, 308243, 277524, 316437, 140310, 322582, 293910, 197657, 281626, 238623, 300068, 238639, 300084, 322612, 238651, 308287, 238664, 234577, 296019, 234587, 277597, 304222, 361566, 113760, 281697, 230499, 281700, 285798, 300135, 300136, 322663, 228458, 207979, 279660, 15471, 312434, 285814, 300151, 291959, 337017, 285820, 300158, 150657, 187521, 285828, 279685, 285830, 222343, 302216, 302213, 228491, 326804, 185493, 296086, 238743, 187544, 308372, 119962, 296092, 300188, 339102, 302240, 330913, 306338, 249002, 300202, 279728, 238769, 208058, 294074, 230588, 228542, 283840, 302274, 279747, 283847, 244940, 283853, 283852, 279760, 290000, 189652, 279765, 189653, 148696, 279774, 304351, 298208, 310497, 298212, 304356, 290022, 279785, 228588, 234733, 298221, 279792, 298228, 302325, 234742, 292085, 228600, 216315, 292091, 388349, 208124, 228609, 292107, 312587, 251153, 177428, 173334, 339234, 130338, 130343, 277806, 298291, 277815, 306494, 216386, 279875, 286018, 113987, 300359, 230729, 294218, 234827, 177484, 222541, 296270, 234831, 238927, 277841, 277844, 314709, 314710, 283991, 357719, 277845, 292195, 294243, 230756, 281957, 277862, 277866, 277868, 230765, 284014, 306542, 296303, 327025, 296307, 116084, 111993, 277882, 277883, 290173, 306559, 224640, 277890, 179587, 148867, 294275, 298374, 314758, 314760, 142729, 277897, 368011, 277896, 296329, 296335, 112017, 306579, 277907, 224661, 282007, 357786, 318875, 310692, 277925, 279974, 282022, 282024, 314791, 310701, 314798, 277936, 173491, 286132, 279989, 277946, 228795, 292283, 302531, 292292, 339398, 300487, 306631, 296392, 280010, 300489, 310732, 280013, 312782, 64975, 284107, 306639, 222675, 277974, 277977, 228827, 286172, 239068, 280032, 144867, 277988, 187878, 280041, 329197, 277997, 329200, 306673, 282096, 296433, 278002, 306677, 191990, 300535, 280055, 288249, 286202, 300536, 290300, 286205, 302590, 290301, 294400, 296448, 282114, 230913, 306692, 306693, 300542, 230921, 296461, 323087, 304656, 282129, 316946, 308756, 282136, 282141, 286244, 312880, 288309, 290358, 288318, 194110, 280130, 349763, 196164, 288326, 288327, 282183, 218696, 56902, 333388, 228943, 286288, 300630, 290390, 128599, 235095, 306776, 196187, 239198, 157281, 300644, 282213, 317032, 310889, 323178, 312940, 204397, 222832, 314998, 288378, 175741, 235135, 294529, 239237, 282245, 286343, 288392, 229001, 290443, 310923, 323217, 229020, 333470, 282271, 282273, 302754, 282276, 40613, 40614, 40615, 282280, 290471, 229029, 298667, 298661, 206504, 321199, 298712, 286388, 286391, 300728, 337591, 306874, 280251, 282303, 286399, 280257, 323263, 282312, 306890, 280267, 233589, 282318, 9936, 9937, 302802, 313041, 212688, 280278, 282327, 286423, 278233, 18138, 278234, 67292, 280280, 294622, 321247, 278240, 298720, 153319, 12010, 288491, 280300, 239341, 372460, 282348, 284401, 282355, 323316, 282358, 313081, 229113, 286459, 194304, 288512, 278272, 323331, 323332, 288516, 311042, 280327, 216839, 280329, 282378, 300811, 321295, 282391, 284442, 286494, 282409, 294700, 300848, 282417, 200498, 296755, 280372, 321337, 280380, 345919, 315202, 307011, 282438, 153415, 280392, 304977, 307025, 413521, 18262, 216918, 307031, 280410, 188251, 284507, 300894, 237408, 284512, 284514, 296806, 276327, 282474, 288619, 288620, 280430, 282480, 292720, 313203, 300918, 194429, 315264, 339841, 243591, 282504, 67463, 110480, 184208, 282518, 282519, 294807, 214937, 214938, 294809, 337815, 298909, 294814, 311199, 300963, 294823, 298920, 284587, 292782, 200627, 290746, 294843, 98239, 237504, 280514, 294850, 280519, 214984, 151497, 284619, 344013, 301008, 194515, 298980, 292837, 294886, 296941, 329712, 311281, 311282, 325619, 282612, 292858 ]
5f5ad5ffd03e03a11e33ef7478e1eb11d05c7f1a
cde10230e8899b91527b147e9fb82541587e2f9a
/Phlex Swim Beta/Profile View/ProfileView.swift
cabca19e1e71ab5eeb17ac80ee3dcdd3b7783499
[]
no_license
deepakmindcrew/iOSWatch
b445b5855a1e3f9fae1e9ab81286878da4ccd2e2
f3fad4ba52d33d408155ddede5cee9b23f831c9f
refs/heads/main
2023-08-15T02:09:33.586719
2021-09-23T07:18:48
2021-09-23T07:18:48
396,659,320
0
0
null
2021-08-16T06:47:09
2021-08-16T06:47:08
null
UTF-8
Swift
false
false
14,366
swift
// // ProfileView.swift // FitnessApp // // Created by Ryan Rosenbaum on 1/20/21. // Copyright © 2021 Duy Bui. All rights reserved. // import SwiftUI struct ProfileView: View { var body: some View { ScrollView { Spacer() VStack{ HeaderView().padding(.horizontal) ScrollView { ZStack { PowerUsageView() .background(RoundedRectangle(cornerRadius: 50.0).foregroundColor(.white).opacity(0.2)) }.offset(y: 35) VStack(alignment: .leading) { HStack { Text("Swimmer Highlights").font(.system(size: 22, weight: .semibold, design: .rounded)) Spacer() }.padding(.leading, 20) .padding(.top) Categories().padding(.leading, 25) VStack { HStack { Text("Uploads").font(.system(size: 24, weight: .bold, design: .rounded)) Spacer() } HStack(spacing: 20){ Image("1") .resizable() .aspectRatio(contentMode: .fill) .frame(width: 70, height: 70, alignment: .center) .clipped() // Equal to clipsToBounds = true .cornerRadius(10) Image("2").resizable() .aspectRatio(contentMode: .fill) .frame(width: 70, height: 70, alignment: .center) .clipped() // Equal to clipsToBounds = true .cornerRadius(10) Image("3").resizable() .aspectRatio(contentMode: .fill) .frame(width: 70, height: 70, alignment: .center) .clipped() // Equal to clipsToBounds = true .cornerRadius(10) Image("t").resizable() .aspectRatio(contentMode: .fill) .frame(width: 70, height: 70, alignment: .center) .clipped() // Equal to clipsToBounds = true .cornerRadius(10) } }.padding() Color(.white).frame(height: 100, alignment: .center) }.padding().background(RoundedRectangle(cornerRadius: 50).foregroundColor(.white)) } } }.offset(y: 50).background( ZStack(alignment: .topTrailing, content: { LinearGradient(gradient: .init(colors: [Color("Color1"), Color("Color-4")]), startPoint: .topLeading, endPoint: .bottomTrailing) Image("topBg") }) ) } } struct ProfileView_Previews: PreviewProvider { static var previews: some View { ProfileView() } } struct Categories: View { var body: some View { ScrollView(.horizontal) { HStack(spacing: 50) { VStack(alignment: .center) { Text("Day") .font(.system(size: 16, weight: .bold, design: .rounded)) .foregroundColor(Color.black) RoundedRectangle(cornerRadius: 20) .frame(width: 20, height: 6) .foregroundColor(Color.blue) .padding(.top, -3) } VStack(alignment: .center) { Text("Week") .font(.system(size: 16, weight: .regular, design: .rounded)) .foregroundColor(Color.black) RoundedRectangle(cornerRadius: 20) .frame(width: 60, height: 6) .foregroundColor(Color.blue) .opacity(0) .padding(.top, -3) } VStack(alignment: .center) { Text("Month") .font(.system(size: 16, weight: .regular, design: .rounded)) .foregroundColor(Color.black) RoundedRectangle(cornerRadius: 20) .frame(width: 60, height: 6) .foregroundColor(Color.orange) .opacity(0) .padding(.top, -3) } VStack(alignment: .center) { Text("Season") .font(.system(size: 16, weight: .regular, design: .rounded)) .foregroundColor(Color.black) RoundedRectangle(cornerRadius: 20) .frame(width: 60, height: 6) .foregroundColor(Color.orange) .opacity(0) .padding(.top, -3) } } } } } //MARK: HeaderView struct HeaderView: View { var body: some View { ZStack { HStack(alignment: .top) { Image(systemName: "square.and.arrow.up").font(.system(size: 22, weight: .bold)).foregroundColor(.white).padding() Spacer() VStack { Image("t") .resizable() .clipShape(Circle()) .frame(width: 80, height: 80, alignment: .center) VStack(alignment: .center) { Text("Ryan Rosenbaum") .font(.system(size: 26, weight: .bold, design: .default)) .foregroundColor(.white) Text("Swim Fort Lauderdale Aquatics") .font(.system(size: 14, weight: .medium, design: .default)) .foregroundColor(.white).opacity(0.8) } Button(action: { }, label: { Text("Follow") }) .foregroundColor(Color(#colorLiteral(red: 1, green: 1, blue: 1, alpha: 1))) .padding(.leading, 30) .padding(.top, 10) .padding(.trailing, 30) .padding(.bottom, 10) .background(Color(#colorLiteral(red: 0.2117647059, green: 0.6078431373, blue: 1, alpha: 1))) .cornerRadius(25) } Spacer() Image(systemName: "gear").font(.system(size: 22, weight: .bold)).foregroundColor(.white).padding() } } } } //MARK: PowerUsageView struct PowerUsageView: View { var body: some View { VStack { HStack { HStack(spacing: 60) { VStack(alignment: .leading) { Text("108") .font(.system(size: 20, weight: .bold, design: .default)) .foregroundColor(.white) Text("Followers") .font(.system(size: 15, weight: .medium, design: .default)) .foregroundColor(.white).opacity(0.7) } VStack(alignment: .leading) { Text("108") .font(.system(size: 20, weight: .bold, design: .default)) .foregroundColor(.white) Text("Following") .font(.system(size: 15, weight: .medium, design: .default)) .foregroundColor(.white).opacity(0.7) } VStack(alignment: .leading) { Text("427") .font(.system(size: 20, weight: .bold, design: .default)) .foregroundColor(.white) Text("Total Uploads") .font(.system(size: 15, weight: .medium, design: .default)) .foregroundColor(.white).opacity(0.7) } } }.padding() .offset(y: -15) }.frame(width: 400, height: 100) } } struct ProfileViewSocialoPTION: View { @State var selected = 0 let data: [DataModel] = [ .init(id: "0", imageName: "Collection"), .init(id: "1", imageName: "Collection2"), .init(id: "2", imageName: "Collection"), .init(id: "3", imageName: "Collection2") ] var body: some View { NavigationView { VStack(spacing: 15.0) { Text("@ifgs1") .font(.custom("HelveticaNeue-Medium", size: 16.0)) Image("ProfilePicture") Text("Ivan Garcia") .font(.custom("HelveticaNeue-Medium", size: 20.0)) Text("Photography lover from 8 years ") .font(.custom("HelveticaNeue-Regular", size: 14.0)) .foregroundColor(Color("LightGrayColor")) SegmentedControlView(selected: self.$selected, segments: [Segment(id: 0, segmentName: "Photos"), Segment(id: 1, segmentName: "Likes"), Segment(id: 2, segmentName: "Marks")]) List { ForEach(data) { items in CollectionView(data: items) } }.onAppear { UITableView.appearance().separatorStyle = .none } } }.background(Color(.white).edgesIgnoringSafeArea(.all)) .navigationBarTitle("") .navigationBarItems(trailing: Button(action : { }){ Image("Menu").foregroundColor(.gray) }) } } struct DataModel: Identifiable { let id: String let imageName: String } struct CollectionView: View { let data: DataModel var body: some View { VStack { HStack { ForEach(0..<2) { items in Spacer() Image(self.data.imageName) Spacer() } } } } } // DashBoard Grid Model Data... struct Fitness : Identifiable { var id : Int var title : String var image : String var data: String var suggest : String } var week_Fit_Data = [ Fitness(id: 0, title: "Avg Heart Rate", image: "heart", data: "163 bpm", suggest: "80-120\nHealthy"), Fitness(id: 1, title: "Sleep", image: "sleep", data: "43h 23m", suggest: "Deep Sleep\n26h 13m"), Fitness(id: 2, title: "Swim Calories", image: "energy", data: "1,275 kcal", suggest: "Weekly Goal\n4,800 kcal"), Fitness(id: 3, title: "Laps", image: "steps", data: "373", suggest: "Weekly Goal\n25,0000 Steps"), Fitness(id: 4, title: "Primary Stroke", image: "running", data: "Butterfly", suggest: "Weekly Goal\n70 km"), Fitness(id: 5, title: "Splash Score", image: "cycle", data: "398", suggest: "Weekly Goal\n125 km"), Fitness(id: 6, title: "Steps", image: "steps", data: "17,8741", suggest: "Weekly Goal\n25,0000 Steps"), Fitness(id: 7, title: "Running", image: "running", data: "45.3 km", suggest: "Weekly Goal\n70 km"), Fitness(id: 8, title: "Cycling", image: "cycle", data: "100.3 km", suggest: "Weekly Goal\n125 km"), ] @available(iOS 14.0, *) struct GridView2 : View { var fitness_Data : [Fitness] var columns = Array(repeating: GridItem(.flexible(), spacing: 20), count: 2) var body: some View{ LazyVGrid(columns: columns,spacing: 30){ ForEach(fitness_Data){fitness in ZStack(alignment: Alignment(horizontal: .trailing, vertical: .top)) { VStack(alignment: .leading, spacing: 20) { Text(fitness.title) .foregroundColor(.white) Text(fitness.data) .font(.title) .fontWeight(.bold) .foregroundColor(.white) .padding(.top,20) HStack{ Spacer(minLength: 0) Text(fitness.suggest) .foregroundColor(.white) } } .padding() // image name same as color name.... .background(Color(fitness.image)) .cornerRadius(20) // shadow.... .shadow(color: Color.black.opacity(0.2), radius: 5, x: 0, y: 5) // top Image.... Image(fitness.image) .renderingMode(.template) .foregroundColor(.white) .padding() .background(Color.white.opacity(0.12)) .clipShape(Circle()) } } } .padding(.horizontal) .padding(.top,25) } }
[ -1 ]
ffabe4ed28ba606f83acbe6c7d37230084e9b948
5b291d6472c8312b19626aee6fe8846be88b2f51
/BelajarSwiftUI/AppDelegate.swift
34c2ccfc31ea7722859bcda10c1c3b3a4aef9e11
[]
no_license
rajabun/BelajarSwiftUI
dfe39e3b91c783b09db72c940d87bbde7bf92a37
8f408c4e1c9de85af253825adc6b26546ce47e5f
refs/heads/master
2020-08-10T18:40:02.868050
2019-10-11T09:32:54
2019-10-11T09:32:54
214,397,715
0
0
null
null
null
null
UTF-8
Swift
false
false
3,746
swift
// // AppDelegate.swift // BelajarSwiftUI // // Created by Muhammad Rajab Priharsanto on 10/10/19. // Copyright © 2019 Muhammad Rajab Priharsanto. All rights reserved. // import UIKit import CoreData @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } // MARK: UISceneSession Lifecycle func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { // Called when a new scene session is being created. // Use this method to select a configuration to create the new scene with. return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) } func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) { // Called when the user discards a scene session. // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. // Use this method to release any resources that were specific to the discarded scenes, as they will not return. } // MARK: - Core Data stack lazy var persistentContainer: NSPersistentContainer = { /* The persistent container for the application. This implementation creates and returns a container, having loaded the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail. */ let container = NSPersistentContainer(name: "BelajarSwiftUI") container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { // Replace this implementation with code to handle the error appropriately. // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. /* Typical reasons for an error here include: * The parent directory does not exist, cannot be created, or disallows writing. * The persistent store is not accessible, due to permissions or data protection when the device is locked. * The device is out of space. * The store could not be migrated to the current model version. Check the error message to determine what the actual problem was. */ fatalError("Unresolved error \(error), \(error.userInfo)") } }) return container }() // MARK: - Core Data Saving support func saveContext () { let context = persistentContainer.viewContext if context.hasChanges { do { try context.save() } catch { // Replace this implementation with code to handle the error appropriately. // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. let nserror = error as NSError fatalError("Unresolved error \(nserror), \(nserror.userInfo)") } } } }
[ 199680, 379906, 253443, 418820, 249351, 328199, 384007, 377866, 379914, 372747, 199180, 326668, 329233, 349202, 186387, 350738, 262677, 330774, 324121, 245274, 377371, 345630, 384032, 362529, 349738, 394795, 404523, 245293, 262701, 349744, 361524, 337975, 343609, 375867, 333373, 418366, 152127, 339009, 413250, 214087, 352840, 377930, 337994, 370253, 330319, 200784, 173647, 436306, 333395, 244308, 374358, 329815, 254042, 402522, 326239, 322658, 340579, 244329, 333422, 349295, 204400, 173169, 339571, 330868, 344693, 268921, 343167, 192639, 344707, 330884, 336516, 266374, 385670, 346768, 268434, 409236, 336548, 333988, 356520, 377001, 379048, 361644, 402614, 361655, 325308, 339132, 343231, 403138, 337092, 244933, 322758, 337606, 367816, 257738, 342736, 245460, 257751, 385242, 366300, 165085, 350433, 345826, 395495, 363755, 343276, 346348, 338158, 325358, 212722, 251122, 350453, 338679, 393465, 351482, 264961, 115972, 268552, 346890, 362251, 328460, 333074, 356628, 257814, 333592, 397084, 342813, 257824, 362272, 377120, 334631, 336680, 389416, 384298, 254252, 204589, 271150, 366383, 328497, 257842, 339768, 326969, 257852, 384828, 386365, 204606, 375615, 339792, 358737, 389970, 361299, 155476, 366931, 330584, 361305, 257880, 362843, 429406, 374112, 353633, 439137, 355184, 361333, 332156, 337277, 245120, 260992, 389506, 380802, 264583, 337290, 155020, 348565, 337813, 250262, 155044, 333221, 373671, 333736, 252845, 356781, 288174, 370610, 268210, 210356, 342452, 370102, 338362, 327612, 358335, 380352, 201157, 333766, 187334, 339400, 349128, 347081, 358347, 393670, 336325, 272848, 379856, 155603, 219091, 399317, 249302, 379863, 372697, 155102, 329182, 182754, 360429, 338927, 330224, 379895, 201723, 257020, 254461 ]
10fba27b0016f72d44beeedeeb49ddcef823f5ec
daa651c4951de53040e61f412ce05f0ec8d96eff
/SwiftlySalesforce/Sources/Extensions/Dictionary+URLEncodedString.swift
d20aef57d5b47b1c5f89289bf1209710abec69de
[ "MIT" ]
permissive
kyce-arta/SwiftlySalesforce
2272e0d5c9846868f2f0f7857f1a96056150d5fa
ec7ba0c91b6dba970960cfc80d5020fa5e2ff806
refs/heads/master
2020-08-21T17:20:57.200755
2019-01-22T23:43:07
2019-01-22T23:43:07
null
0
0
null
null
null
null
UTF-8
Swift
false
false
528
swift
// // Dictionary+URLEncodedString.swift // SwiftlySalesforce // // For license & details see: https://www.github.com/mike4aday/SwiftlySalesforce // Copyright (c) 2018. All rights reserved. // import Foundation public extension Dictionary where Key == String, Value == String { public func asPercentEncodedString() -> String? { var comps = URLComponents() comps.queryItems = self.map { URLQueryItem(name: $0.key, value: $0.value) } return comps.percentEncodedQuery?.replacingOccurrences(of: "+", with: "%2B") } }
[ -1 ]
142a5b8d280e42cb1c5238b9f9c6751153514fc0
65d5f7b1a348694bad460b4817f676f42cacadb4
/Tests/LinuxMain.swift
fc53ade2c5081bcbee950c05e53d10a6239c1ede
[]
no_license
cpageler93/NominatimSwift
87540d72685d9dcba24170b978f04a27f05a8e2d
50fdd6b472208b93e4c8bf5487b92ae073020ad7
refs/heads/master
2023-02-15T16:50:30.080375
2021-01-13T17:51:10
2021-01-13T17:51:10
329,310,559
0
0
null
null
null
null
UTF-8
Swift
false
false
130
swift
import XCTest import NominatimSwiftTests var tests = [XCTestCaseEntry]() tests += NominatimSwiftTests.allTests() XCTMain(tests)
[ 248320, 45058, 340485, 145938, 238613, 323613, 192029, 159264, 342562, 224296, 343599, 168501, 162368, 187467, 352334, 332368, 341076, 184406, 343146, 126575, 312943, 192627, 338547, 253046, 346746, 347259, 319639, 314530, 334504, 181929, 351406, 315575, 191672, 225980, 222401, 223960, 354011, 323818, 194809, 199417, 353018, 315140, 319236, 202506, 343309, 315151, 338193, 336672, 311585, 325413, 254246, 341798, 52521, 253786, 253790, 253794, 244581, 251241, 316780, 151920, 240501, 349584, 327062, 253342, 178088, 219048, 150970, 326592, 344515, 324041, 355282, 338389, 343519, 315362, 351207, 340969, 347125, 342525 ]
921030bfafc497b4552311e773496869b3ae2de6
cef2fba2cca7660818b951ba43e7a1c7b5b7d23a
/Instrument Zoo/InstrumentComponent.swift
166e3bb74734971cb8fc65f49a1804b566926519
[]
no_license
eospi/RealityKit-Instrument-Zoo
4b6766811b862b3b47236d0f2e5026d75808ed40
dc851f6212252bd95ff998cdf246dc2f6483b8cf
refs/heads/master
2020-12-15T17:46:27.968412
2020-07-14T21:13:22
2020-07-14T21:13:22
235,199,229
2
2
null
null
null
null
UTF-8
Swift
false
false
222
swift
// // InstrumentComponent.swift // Instrument Zoo // // Created by Ethan Saadia on 1/17/20. // Copyright © 2020 Ethan Saadia. All rights reserved. // import RealityKit struct InstrumentComponent: Component { }
[ -1 ]
7221f9fbd44c06cdfb2f1ab63751913e164d00a6
c95311f0439bbf6fa19b623dd687830185ef06d9
/List Problems/AppDelegate.swift
d61742c80973798be67d4c42b974cbda54b14ec1
[]
no_license
MQumairi/TextKit-List
1330e253e8af0a43a1c6f6d4a02e2de6b72bcab3
a23da9620b38150f37c849a29e635d04776b9c32
refs/heads/main
2023-06-13T23:27:33.421868
2021-07-04T13:25:51
2021-07-04T13:25:51
382,857,848
0
0
null
null
null
null
UTF-8
Swift
false
false
454
swift
// // AppDelegate.swift // List Problems // // Created by Mohammed Alqumairi on 04/07/2021. // import Cocoa @main class AppDelegate: NSObject, NSApplicationDelegate { func applicationDidFinishLaunching(_ aNotification: Notification) { // Insert code here to initialize your application } func applicationWillTerminate(_ aNotification: Notification) { // Insert code here to tear down your application } }
[ 66688, 244352, 200577, 171778, 291459, 293764, 293889, 320774, 333829, 183176, 236425, 336649, 402566, 349069, 368014, 242939, 116368, 384017, 349588, 356885, 295704, 259353, 361500, 339103, 62112, 113953, 237861, 200490, 200746, 333611, 253997, 295726, 324654, 358064, 165041, 288120, 243768, 38330, 216379, 44610, 229314, 436606, 188997, 349002, 265420, 286412, 193490, 3284, 234965, 275675, 327645, 383710, 275679, 389981, 275681, 144864, 275683, 119521, 275685, 182625, 302818, 313316, 323173, 327649, 321898, 234731, 287341, 356846, 226414, 416369, 249844, 356853, 226424, 237819, 344700, 313342 ]
fe08f160b4a1c7edd665d46eee48f072be59e439
e2a8bf66570780eced572512123810f3b7968e97
/TodoApp/TodoApp/VC/AddTodoViewController.swift
feabf5c842df78cbdf7bd00e35b3bdb904361b9c
[]
no_license
MaciejGol90/todo
fd79dda26c7d6e354064e242ce4c32a3803e371b
c2fdf81a827950e07a56b7ed89a9646c5b7ff555
refs/heads/master
2020-05-24T00:48:51.533674
2019-05-31T15:12:14
2019-05-31T15:12:14
187,023,501
0
0
null
null
null
null
UTF-8
Swift
false
false
3,537
swift
// // AddTodoViewController.swift // TodoApp // // Created by Maciej Golianek on 16/05/2019. // Copyright © 2019 Maciej Golianek. All rights reserved. // import UIKit import CoreData class AddTodoViewController: UIViewController { // MARK: - Properties var managedContext: NSManagedObjectContext! var todo: Todo? // MARK: Outlets @IBOutlet weak var textView: UITextView! @IBOutlet weak var categoryControl: UISegmentedControl! @IBOutlet weak var datePicker: UIDatePicker! @IBOutlet weak var addButton: UIButton! @IBOutlet weak var bottomConstraint: NSLayoutConstraint! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. NotificationCenter.default.addObserver( self, selector: #selector(keyboardWillShow(with:)), name: UIResponder.keyboardWillShowNotification, object: nil ) textView.becomeFirstResponder() categoryControl.becomeFirstResponder() datePicker.becomeFirstResponder() if let todo = todo { textView.text = todo.title textView.text = todo.title categoryControl.selectedSegmentIndex = Int(todo.category) datePicker?.datePickerMode = .date } } // MARK: Actions @objc func keyboardWillShow(with notification: Notification) { let key = "UIKeyboardFrameEndUserInfoKey" guard let keyboardFrame = notification.userInfo?[key] as? NSValue else { return } let keyboardHeight = keyboardFrame.cgRectValue.height + 16 bottomConstraint.constant = keyboardHeight UIView.animate(withDuration: 0.3) { self.view.layoutIfNeeded() } } fileprivate func dismissAndResign() { dismiss(animated: true) textView.resignFirstResponder() datePicker?.datePickerMode = .date } @IBAction func cancelButton(_ sender: UIButton) { dismissAndResign() } @IBAction func addButton(_ sender: UIButton) { guard let title = textView.text, !title.isEmpty else { return } if let todo = self.todo { todo.title = title todo.category = Int16() todo.date = TimeInterval.init() } else { let todo = Todo(context: managedContext) todo.title = title todo.category = Int16() todo.date = TimeInterval.init() } do { try managedContext.save() dismissAndResign() } catch { print("Error saving todo: \(error)") } } } extension AddTodoViewController: UITextViewDelegate { func textViewDidChangeSelection(_ textView: UITextView) { if addButton.isHidden { textView.text.removeAll() textView.textColor = .white addButton.isHidden = false UIView.animate(withDuration: 0.3) { self.view.layoutIfNeeded() } } } } /* // 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 ]
8515b2457014ad569834be063c2cd0fa67262e82
5485aae14a1f2bf0267a36ef37c4c964742fb809
/Co-Car.playgroundbook/Contents/Chapters/Chapter1.playgroundchapter/Sources/SimulationViewController.swift
2d77e14d313b29da715f7643c69cd3f66b684ca0
[]
no_license
hesyifei/swift-playground-car
968aeb0935aa210aff856aa3cee33fbe19469f57
06b3824873f5a5fc843cbf78cb186f214b348b40
refs/heads/master
2021-03-24T12:41:06.906612
2017-04-01T10:06:35
2017-04-01T10:06:35
85,061,089
1
0
null
null
null
null
UTF-8
Swift
false
false
7,400
swift
import UIKit import SpriteKit import Foundation public class SimulationViewController: UIViewController { var skView: SKView! var scene: CarScene! var carNode: SKSpriteNode! var carAdded = false var smallestSize: CGSize! public override func viewDidLoad() { super.viewDidLoad() NotificationCenter.default.removeObserver(self, name: NotificationName.simulationReceivedCommand, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(self.simulationReceivedCommand(_:)), name: NotificationName.simulationReceivedCommand, object: nil) } public override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() // to avoid bug as viewDidLayoutSubviews may be called more than once // without this code the view will be added twice and problem arise if let smallestSize = smallestSize { if smallestSize.width > self.view.frame.width { skView.removeFromSuperview() carAdded = false } } if carAdded == false { let largerFrame = CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height) self.skView = SKView(frame: largerFrame) if self.skView.isDescendant(of: self.view) { self.skView.removeFromSuperview() } self.view.addSubview(self.skView) smallestSize = largerFrame.size scene = CarScene(size: largerFrame.size) scene.scaleMode = .aspectFit scene.physicsBody = SKPhysicsBody(edgeLoopFrom: largerFrame) scene.physicsWorld.gravity = CGVector(dx: 0, dy: 0) scene.physicsBody?.friction = 0.0 skView.presentScene(scene) // 600.0 * 1255.0 is the car's image's size let carSize = CGSize(width: 50.0, height: 50.0/(600.0/1255.0)) self.carNode = SKSpriteNode(color: SKColor.red, size: carSize) self.carNode.name = "Car" self.carNode.texture = SKTexture(imageNamed: "Car") self.carNode.position = CGPoint(x: skView.frame.width/2, y: skView.frame.height/2) self.carNode.physicsBody = SKPhysicsBody(rectangleOf: carSize) self.carNode.physicsBody?.restitution = 1 self.carNode.physicsBody?.friction = 0.0 self.carNode.physicsBody?.angularDamping = 0 self.carNode.physicsBody?.linearDamping = 0 scene.addChild(self.carNode) carAdded = true } } final let RUN_KEY = "runKey" func move(_ operation: String, for oriSec: Double) { var isForever = false if oriSec == 0 { isForever = true } var sec = oriSec if isForever { sec = 1 } let msec: Int = Int(sec*1000) switch operation { case CarOperation.forward, CarOperation.backward: let length = 0.1*Double(msec) let zRotation = Double.pi-Double(self.carNode.zRotation) var moveVector = CGVector(dx: -length*sin(zRotation), dy: -length*cos(zRotation)) if operation == CarOperation.backward { moveVector = CGVector(dx: length*sin(zRotation), dy: length*cos(zRotation)) } if isForever { self.carNode.run(SKAction.repeatForever(SKAction.move(by: moveVector, duration: sec)), withKey: self.RUN_KEY) } else { self.carNode.run(SKAction.move(by: moveVector, duration: sec)) } break case CarOperation.turnLeft, CarOperation.turnRight: var angle = CGFloat(0.001*Double(msec)) if operation == CarOperation.turnLeft { } else if operation == CarOperation.turnRight { angle = -angle } if isForever { self.carNode.run(SKAction.repeatForever(SKAction.rotate(byAngle: angle, duration: sec)), withKey: self.RUN_KEY) } else { self.carNode.run(SKAction.rotate(byAngle: angle, duration: sec)) } break case CarOperation.stop: self.carNode.removeAction(forKey: self.RUN_KEY) break default: break } } func simulationReceivedCommand(_ notification: NSNotification){ if let object = notification.object as? [String: Any] { if let oriCmd = object["cmd"] as? String { if oriCmd.characters.count >= 3 { var cmd = oriCmd cmd.remove(at: cmd.startIndex) cmd.remove(at: cmd.index(before: cmd.endIndex)) let movement = String(cmd[cmd.startIndex]) cmd.remove(at: cmd.startIndex) if cmd.characters.count == 0 { move(movement, for: 0) } else if let msec = Int(cmd) { move(movement, for: Double(msec)/1000.0) } } } } } public func getDistanceToWall() -> Double { if self.scene != nil { return self.scene!.getDistanceToWall() } else { return 1000.0 } } } class CarScene: SKScene { internal var carNode: SKSpriteNode? //internal var linePointingShape: SKShapeNode! func getDistanceToWall() -> Double { if let carNode = self.carNode { // following code is based on testing by myself let pRotation = Double.pi-Double(carNode.zRotation) let halfCarHeight = Double(carNode.size.height/2.0) let carFrontPosition = CGPoint(x: Double(carNode.position.x)-halfCarHeight*sin(pRotation), y: Double(carNode.position.y)-halfCarHeight*cos(pRotation)) var xDistanceFromOrigin: Double = 0.0 var yDistanceFromOrigin: Double = 0.0 var resultDistance: Double = 1000.0 var quadrant: Int = 0 switch pRotation { case (((3.0/4.0)*2.0*Double.pi)...(2.0*Double.pi)): // Quadrant 4 quadrant = 4 xDistanceFromOrigin = Double(self.frame.maxX - carFrontPosition.x) yDistanceFromOrigin = Double(carFrontPosition.y - self.frame.minY) case ((Double.pi)...((3.0/4.0)*2.0*Double.pi)): // Quadrant 1 quadrant = 1 xDistanceFromOrigin = Double(self.frame.maxX - carFrontPosition.x) yDistanceFromOrigin = Double(self.frame.maxY - carFrontPosition.y) case ((0.5*Double.pi)...(1.0*Double.pi)): // Quadrant 2 quadrant = 2 xDistanceFromOrigin = Double(carFrontPosition.x - self.frame.minX) yDistanceFromOrigin = Double(self.frame.maxY - carFrontPosition.y) case (0...(0.5*Double.pi)): // Quadrant 3 quadrant = 3 xDistanceFromOrigin = Double(carFrontPosition.x - self.frame.minX) yDistanceFromOrigin = Double(carFrontPosition.y - self.frame.minY) default: break } let quadrantMaxAngleDict: [Int: Double] = [1: (3.0/4.0)*2.0, 2: 1.0, 3: 0.5, 4: 2.0] let realAngle = quadrantMaxAngleDict[quadrant]!*Double.pi-pRotation if [1, 3].contains(quadrant) { let devideAngle = atan(yDistanceFromOrigin/xDistanceFromOrigin) if realAngle > devideAngle { resultDistance = yDistanceFromOrigin/cos(Double.pi/2.0-realAngle) } else { resultDistance = xDistanceFromOrigin/cos(realAngle) } } else if [2, 4].contains(quadrant) { let devideAngle = atan(xDistanceFromOrigin/yDistanceFromOrigin) if realAngle > devideAngle { resultDistance = xDistanceFromOrigin/cos(Double.pi/2.0-realAngle) } else { resultDistance = yDistanceFromOrigin/cos(realAngle) } } //resultDistance = resultDistance - 50 // debugging only //print(resultDistance) /*let path = CGMutablePath() path.move(to: carFrontPosition) path.addLine(to: CGPoint(x: Double(carFrontPosition.x)-resultDistance*sin(pRotation), y: Double(carFrontPosition.y)-resultDistance*cos(pRotation))) if linePointingShape != nil { linePointingShape.removeFromParent() } linePointingShape = SKShapeNode() linePointingShape.path = path linePointingShape.strokeColor = UIColor.white linePointingShape.lineWidth = 2 addChild(linePointingShape)*/ return resultDistance } else if let carNode = self.childNode(withName: "Car") as? SKSpriteNode { self.carNode = carNode } return 1000.0 } }
[ -1 ]
b427c7a2aaec185350bcf8359c5a14ab9fd1c0d9
2eeafee7fc4d29ba9ab14e84f4f78761587b89a6
/ManufactoriaSwift/ScrollNode.swift
f3f2b979be6ad97b4266859c70fb606203c0c76f
[]
no_license
warrenwhipple/manufactoria-ios
2604062a828ba47d3b3643b01db8381077e42cf2
204f7a5eab59ff6b275ce1e8add006249268019f
refs/heads/master
2020-03-26T13:09:50.294100
2018-08-19T19:49:50
2018-08-19T19:49:50
144,926,126
0
0
null
null
null
null
UTF-8
Swift
false
false
2,409
swift
// // ScrollNode.swift // ManufactoriaSwift // // Created by Warren Whipple on 11/22/14. // Copyright (c) 2014 Warren Whipple. All rights reserved. // import SpriteKit class ScrollNode: SKNode, DragThroughDelegate { required init(coder: NSCoder) {fatalError("NSCoding not supported")} let wrapper = SKNode() var touch: UITouch? var wrapperMaxY: CGFloat = 0 var wrapperMinY: CGFloat = 0 var overScroll: CGFloat = 64 var touchBeganTouchY: CGFloat = 0 var touchBeganWrapperY: CGFloat = 0 override init() { super.init() userInteractionEnabled = true addChild(wrapper) } func touchBegan() { if let touch = touch { touchBeganTouchY = touch.locationInNode(self).y touchBeganWrapperY = wrapper.position.y } } func touchMoved() { if let touch = touch { let newTouchY = touch.locationInNode(self).y let newWrapperY = touchBeganWrapperY + newTouchY - touchBeganTouchY wrapper.position.y = newWrapperY } } func touchEnded() { touch = nil } func touchCancelled() { touch = nil } // MARK: - SwipeThroughButtonDelegate Methods func dragThroughTouchBegan(dragThroughTouch: UITouch) { if touch != nil { touchEnded() } touch = dragThroughTouch touchBegan() } func dragThroughTouchMoved(dragThroughTouch: UITouch) { if touch == dragThroughTouch { touchMoved() } } func dragThroughTouchEnded(dragThroughTouch: UITouch) { if touch == dragThroughTouch { touchEnded() } } func dragThroughTouchCancelled(dragThroughTouch: UITouch) { if touch == dragThroughTouch { touchCancelled() } } // MARK: - Touch Delegate Methods override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) { if touch != nil { touchCancelled() } touch = touches.first as? UITouch touchBegan() } override func touchesMoved(touches: Set<NSObject>, withEvent event: UIEvent) { if touch != nil && touches.contains(touch!) { touchMoved() } } override func touchesEnded(touches: Set<NSObject>, withEvent event: UIEvent) { if touch != nil && touches.contains(touch!) { touchEnded() } } override func touchesCancelled(touches: Set<NSObject>, withEvent event: UIEvent) { if touch != nil && touches.contains(touch!) { touchCancelled() } } }
[ -1 ]
661406ba9bc7680b0fa1fc201a80709486b8d3b5
82b82e3ae6f77fd96679e53ed21329629cd4ce1b
/UI-KARISHE/Controller/ForgotPassViewController.swift
13934637663e5d916a402f13cae1b7b633efe099
[]
no_license
arsalan78h/main-Karishe-Project
c073b6c30f0764d12fb106ed982ad7d299c9f238
7ac593f68fddba23631a70b1a260eaca93ede542
refs/heads/master
2022-03-01T21:47:32.735265
2019-10-23T13:26:09
2019-10-23T13:26:09
198,102,221
0
0
null
null
null
null
UTF-8
Swift
false
false
4,304
swift
// // ForgotPassViewController.swift // UI-KARISHE // // Created by Arsalan Hashemi on 7/28/19. // Copyright © 2019 ArSaLaNhashemi. All rights reserved. // import UIKit import SCLAlertView class ForgotPassViewController: UIViewController { @IBOutlet weak var forgotPassTextField: UITextField! override func viewDidLoad() { super.viewDidLoad() } override func viewDidAppear(_ animated: Bool) { if !CheckInternet.Connection(){ _ = SCLAlertView().showError("مشکل در اتصال اینترت", subTitle:"دوباره سعی کنید", closeButtonTitle:"تایید") } } //MARK: - SetUp View override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { view.endEditing(true) } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillChange(notification:)), name: UIResponder.keyboardWillChangeFrameNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil) } @objc func keyboardWillHide() { self.view.frame.origin.y = 0 } @objc func keyboardWillChange(notification: NSNotification) { if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { if (forgotPassTextField.isFirstResponder) { self.view.frame.origin.y = -keyboardSize.height + 100 } } } override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillChangeFrameNotification, object: nil) NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil) } //MARK: - Tap ForGotPass Button @IBAction func sendForgotButt(_ sender: UIButton) { view.endEditing(true) let url = URL(string: "https://www.karishe.com/wp-admin/admin-ajax.php")! var request = URLRequest(url: url) request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") request.httpMethod = "POST" let parameters: [String: Any] = [ "user_login": forgotPassTextField.text ?? "[email protected]" , "do": "forgot" , "action": "ae-sync-user" , "method": "read" ] request.httpBody = parameters.percentEscaped().data(using: .utf8) let task = URLSession.shared.dataTask(with: request) { data, response, error in guard let data = data, let response = response as? HTTPURLResponse, error == nil else { // check for fundamental networking error print("error", error ?? "Unknown error") return } guard (200 ... 299) ~= response.statusCode else { // check for http errors print("statusCode should be 2xx, but is \(response.statusCode)") print("response = \(response)") return } let responseString = String(data: data, encoding: .utf8) print("responseString = \(String(describing: responseString))") let charResponseString = Array(responseString!) if charResponseString[11] == "f" { DispatchQueue.main.async { _ = SCLAlertView().showError("دوباره سعی کنید", subTitle:"عبارت وارد شده در سیستم وجود ندارد", closeButtonTitle:"تایید") } }else { DispatchQueue.main.async { _ = SCLAlertView().showSuccess("ایمیل یا شماره وارد شده را برسی کنید", subTitle: "" , closeButtonTitle: "تایید") } } } task.resume() } }
[ -1 ]
9a8b4588d34376d24221e759ffaedc5a6aac427c
b4ce13654dace17efa76729c6f7826eccace3621
/Dict_Sing_Table/Singleton.swift
6cae4bfecf486ff8095dbc19fc7aa6781c97dfc7
[]
no_license
igmariogeneau/grasset_p10
ebb84774cbf58d7943072ee2be3c84ae46cabea2
f92f5c3f380d43cc6feffa4ef7fb6c798c1d9995
refs/heads/master
2020-12-02T20:59:37.546932
2017-07-04T19:08:53
2017-07-04T19:08:53
96,241,130
0
0
null
null
null
null
UTF-8
Swift
false
false
733
swift
//============================== import Foundation //============================== class Singleton { //--------------------------- static let singletonInstance = Singleton() var dictionnary: [String: Bool]! let userDefault = UserDefaults.standard //--------------------------- init() { if userDefault.object(forKey: "data") == nil { userDefault.setValue(dictionnary, forKey: "data") } else { dictionnary = userDefault.object(forKey: "data") as! [String : Bool]! } } //--------------------------- func saveData() { userDefault.setValue(dictionnary, forKey: "data") } //--------------------------- } //==============================
[ -1 ]
3dd21e193baf2ee37bc42da0352149b22ff618a8
3a653aa159c5540dcdfc598b079a20ad8ae816d8
/SWIFT-笔记2018:11/swift--项目/ACTHelper/Pods/Eureka/Source/Core/Core.swift
a77cf8c7b3a739eece3859fe02aa5a67557258cd
[ "MIT" ]
permissive
OneDuoKeng/swift----
90649317e97fa258b9ba40ed9cf5f62b1bad182f
1bea56428b4f24d4b004f24b4ac951654339e699
refs/heads/master
2021-06-26T01:23:58.529467
2020-12-02T10:10:48
2020-12-02T10:10:48
157,365,221
3
2
null
null
null
null
UTF-8
Swift
false
false
35,903
swift
// Core.swift // Eureka ( https://github.com/xmartlabs/Eureka ) // // Copyright (c) 2016 Xmartlabs ( http://xmartlabs.com ) // // // 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 // MARK: Row internal class RowDefaults { static var cellUpdate = Dictionary<String, (BaseCell, BaseRow) -> Void>() static var cellSetup = Dictionary<String, (BaseCell, BaseRow) -> Void>() static var onCellHighlightChanged = Dictionary<String, (BaseCell, BaseRow) -> Void>() static var rowInitialization = Dictionary<String, (BaseRow) -> Void>() static var onRowValidationChanged = Dictionary<String, (BaseCell, BaseRow) -> Void>() static var rawCellUpdate = Dictionary<String, Any>() static var rawCellSetup = Dictionary<String, Any>() static var rawOnCellHighlightChanged = Dictionary<String, Any>() static var rawRowInitialization = Dictionary<String, Any>() static var rawOnRowValidationChanged = Dictionary<String, Any>() } // MARK: FormCells public struct CellProvider<Cell: BaseCell> where Cell: CellType { /// Nibname of the cell that will be created. public private (set) var nibName: String? /// Bundle from which to get the nib file. public private (set) var bundle: Bundle! public init(){} public init(nibName: String, bundle: Bundle? = nil){ self.nibName = nibName self.bundle = bundle ?? Bundle(for: Cell.self) } /** Creates the cell with the specified style. - parameter cellStyle: The style with which the cell will be created. - returns: the cell */ func makeCell(style: UITableViewCellStyle) -> Cell { if let nibName = self.nibName { return bundle.loadNibNamed(nibName, owner: nil, options: nil)!.first as! Cell } return Cell.init(style: style, reuseIdentifier: nil) } } /** Enumeration that defines how a controller should be created. - Callback->VCType: Creates the controller inside the specified block - NibFile: Loads a controller from a nib file in some bundle - StoryBoard: Loads the controller from a Storyboard by its storyboard id */ public enum ControllerProvider<VCType: UIViewController>{ /** * Creates the controller inside the specified block */ case callback(builder: (() -> VCType)) /** * Loads a controller from a nib file in some bundle */ case nibFile(name: String, bundle: Bundle?) /** * Loads the controller from a Storyboard by its storyboard id */ case storyBoard(storyboardId: String, storyboardName: String, bundle: Bundle?) func makeController() -> VCType { switch self { case .callback(let builder): return builder() case .nibFile(let nibName, let bundle): return VCType.init(nibName: nibName, bundle:bundle ?? Bundle(for: VCType.self)) case .storyBoard(let storyboardId, let storyboardName, let bundle): let sb = UIStoryboard(name: storyboardName, bundle: bundle ?? Bundle(for: VCType.self)) return sb.instantiateViewController(withIdentifier: storyboardId) as! VCType } } } /** * Responsible for the options passed to a selector view controller */ public struct DataProvider<T: Equatable> { public let arrayData: [T]? public init(arrayData: [T]){ self.arrayData = arrayData } } /** Defines how a controller should be presented. - Show?: Shows the controller with `showViewController(...)`. - PresentModally?: Presents the controller modally. - SegueName?: Performs the segue with the specified identifier (name). - SegueClass?: Performs a segue from a segue class. */ public enum PresentationMode<VCType: UIViewController> { /** * Shows the controller, created by the specified provider, with `showViewController(...)`. */ case show(controllerProvider: ControllerProvider<VCType>, onDismiss: ((UIViewController)->())?) /** * Presents the controller, created by the specified provider, modally. */ case presentModally(controllerProvider: ControllerProvider<VCType>, onDismiss: ((UIViewController)->())?) /** * Performs the segue with the specified identifier (name). */ case segueName(segueName: String, onDismiss: ((UIViewController)->())?) /** * Performs a segue from a segue class. */ case segueClass(segueClass: UIStoryboardSegue.Type, onDismiss: ((UIViewController)->())?) case popover(controllerProvider: ControllerProvider<VCType>, onDismiss: ((UIViewController)->())?) public var onDismissCallback: ((UIViewController) ->())? { switch self{ case .show(_, let completion): return completion case .presentModally(_, let completion): return completion case .segueName(_, let completion): return completion case .segueClass(_, let completion): return completion case .popover(_, let completion): return completion } } /** Present the view controller provided by PresentationMode. Should only be used from custom row implementation. - parameter viewController: viewController to present if it makes sense (normally provided by makeController method) - parameter row: associated row - parameter presentingViewController: form view controller */ public func present(_ viewController: VCType!, row: BaseRow, presentingController: FormViewController){ switch self { case .show(_, _): presentingController.show(viewController, sender: row) case .presentModally(_, _): presentingController.present(viewController, animated: true) case .segueName(let segueName, _): presentingController.performSegue(withIdentifier: segueName, sender: row) case .segueClass(let segueClass, _): let segue = segueClass.init(identifier: row.tag, source: presentingController, destination: viewController) presentingController.prepare(for: segue, sender: row) segue.perform() case .popover(_, _): guard let porpoverController = viewController.popoverPresentationController else { fatalError() } porpoverController.sourceView = porpoverController.sourceView ?? presentingController.tableView presentingController.present(viewController, animated: true) } } /** Creates the view controller specified by presentation mode. Should only be used from custom row implementation. - returns: the created view controller or nil depending on the PresentationMode type. */ public func makeController() -> VCType? { switch self { case .show(let controllerProvider, let completionCallback): let controller = controllerProvider.makeController() let completionController = controller as? RowControllerType if let callback = completionCallback { completionController?.onDismissCallback = callback } return controller case .presentModally(let controllerProvider, let completionCallback): let controller = controllerProvider.makeController() let completionController = controller as? RowControllerType if let callback = completionCallback { completionController?.onDismissCallback = callback } return controller case .popover(let controllerProvider, let completionCallback): let controller = controllerProvider.makeController() controller.modalPresentationStyle = .popover let completionController = controller as? RowControllerType if let callback = completionCallback { completionController?.onDismissCallback = callback } return controller default: return nil } } } /** * Protocol to be implemented by custom formatters. */ public protocol FormatterProtocol { func getNewPosition(forPosition: UITextPosition, inTextInput textInput: UITextInput, oldValue: String?, newValue: String?) -> UITextPosition } //MARK: Predicate Machine enum ConditionType { case hidden, disabled } /** Enumeration that are used to specify the disbaled and hidden conditions of rows - Function: A function that calculates the result - Predicate: A predicate that returns the result */ public enum Condition { /** * Calculate the condition inside a block * * @param Array of tags of the rows this function depends on * @param Form->Bool The block that calculates the result * * @return If the condition is true or false */ case function([String], (Form)->Bool) /** * Calculate the condition using a NSPredicate * * @param NSPredicate The predicate that will be evaluated * * @return If the condition is true or false */ case predicate(NSPredicate) } extension Condition : ExpressibleByBooleanLiteral { /** Initialize a condition to return afixed boolean value always */ public init(booleanLiteral value: Bool){ self = Condition.function([]) { _ in return value } } } extension Condition : ExpressibleByStringLiteral { /** Initialize a Condition with a string that will be converted to a NSPredicate */ public init(stringLiteral value: String){ self = .predicate(NSPredicate(format: value)) } /** Initialize a Condition with a string that will be converted to a NSPredicate */ public init(unicodeScalarLiteral value: String) { self = .predicate(NSPredicate(format: value)) } /** Initialize a Condition with a string that will be converted to a NSPredicate */ public init(extendedGraphemeClusterLiteral value: String) { self = .predicate(NSPredicate(format: value)) } } //MARK: Errors /** Errors thrown by Eureka - DuplicatedTag: When a section or row is inserted whose tag dows already exist */ public enum EurekaError : Error { case duplicatedTag(tag: String) } //Mark: FormViewController /** * A protocol implemented by FormViewController */ public protocol FormViewControllerProtocol { var tableView: UITableView? { get } func beginEditing<T:Equatable>(of: Cell<T>) func endEditing<T:Equatable>(of: Cell<T>) func insertAnimation(forRows rows: [BaseRow]) -> UITableViewRowAnimation func deleteAnimation(forRows rows: [BaseRow]) -> UITableViewRowAnimation func reloadAnimation(oldRows: [BaseRow], newRows: [BaseRow]) -> UITableViewRowAnimation func insertAnimation(forSections sections : [Section]) -> UITableViewRowAnimation func deleteAnimation(forSections sections : [Section]) -> UITableViewRowAnimation func reloadAnimation(oldSections: [Section], newSections:[Section]) -> UITableViewRowAnimation } /** * Navigation options for a form view controller. */ public struct RowNavigationOptions : OptionSet { private enum NavigationOptions : Int { case disabled = 0, enabled = 1, stopDisabledRow = 2, skipCanNotBecomeFirstResponderRow = 4 } public let rawValue: Int public init(rawValue: Int){ self.rawValue = rawValue} private init(_ options:NavigationOptions ){ self.rawValue = options.rawValue } /// No navigation. public static let Disabled = RowNavigationOptions(.disabled) /// Full navigation. public static let Enabled = RowNavigationOptions(.enabled) /// Break navigation when next row is disabled. public static let StopDisabledRow = RowNavigationOptions(.stopDisabledRow) /// Break navigation when next row cannot become first responder. public static let SkipCanNotBecomeFirstResponderRow = RowNavigationOptions(.skipCanNotBecomeFirstResponderRow) } /** * Defines the configuration for the keyboardType of FieldRows. */ public struct KeyboardReturnTypeConfiguration { /// Used when the next row is available. public var nextKeyboardType = UIReturnKeyType.next /// Used if next row is not available. public var defaultKeyboardType = UIReturnKeyType.default public init(){} public init(nextKeyboardType: UIReturnKeyType, defaultKeyboardType: UIReturnKeyType){ self.nextKeyboardType = nextKeyboardType self.defaultKeyboardType = defaultKeyboardType } } /** * Options that define when an inline row should collapse. */ public struct InlineRowHideOptions : OptionSet { private enum _InlineRowHideOptions : Int { case never = 0, anotherInlineRowIsShown = 1, firstResponderChanges = 2 } public let rawValue: Int public init(rawValue: Int){ self.rawValue = rawValue} private init(_ options:_InlineRowHideOptions ){ self.rawValue = options.rawValue } /// Never collapse automatically. Only when user taps inline row. public static let Never = InlineRowHideOptions(.never) /// Collapse qhen another inline row expands. Just one inline row will be expanded at a time. public static let AnotherInlineRowIsShown = InlineRowHideOptions(.anotherInlineRowIsShown) /// Collapse when first responder changes. public static let FirstResponderChanges = InlineRowHideOptions(.firstResponderChanges) } /// View controller that shows a form. open class FormViewController : UIViewController, FormViewControllerProtocol { @IBOutlet public var tableView: UITableView? private lazy var _form : Form = { [weak self] in let form = Form() form.delegate = self return form }() public var form : Form { get { return _form } set { _form.delegate = nil tableView?.endEditing(false) _form = newValue _form.delegate = self if isViewLoaded && tableView?.window != nil { tableView?.reloadData() } } } /// Accessory view that is responsible for the navigation between rows open var navigationAccessoryView : NavigationAccessoryView! /// Defines the behaviour of the navigation between rows public var navigationOptions : RowNavigationOptions? private var tableViewStyle: UITableViewStyle = .grouped public init(style: UITableViewStyle) { super.init(nibName: nil, bundle: nil) tableViewStyle = style } public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) } public required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } open override func viewDidLoad() { super.viewDidLoad() if tableView == nil { tableView = UITableView(frame: view.bounds, style: tableViewStyle) tableView?.autoresizingMask = UIViewAutoresizing.flexibleWidth.union(.flexibleHeight) if #available(iOS 9.0, *){ tableView?.cellLayoutMarginsFollowReadableWidth = false } } if tableView?.superview == nil { view.addSubview(tableView!) } if tableView?.delegate == nil { tableView?.delegate = self } if tableView?.dataSource == nil { tableView?.dataSource = self } tableView?.estimatedRowHeight = BaseRow.estimatedRowHeight } open override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) navigationAccessoryView = NavigationAccessoryView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: 44.0)) navigationAccessoryView.tintColor = view.tintColor let selectedIndexPaths = tableView?.indexPathsForSelectedRows ?? [] tableView?.reloadRows(at: selectedIndexPaths, with: .none) selectedIndexPaths.forEach { tableView?.selectRow(at: $0, animated: false, scrollPosition: .none) } let deselectionAnimation = { [weak self] (context: UIViewControllerTransitionCoordinatorContext) in selectedIndexPaths.forEach { self?.tableView?.deselectRow(at: $0, animated: context.isAnimated) } } let reselection = { [weak self] (context: UIViewControllerTransitionCoordinatorContext) in if context.isCancelled { selectedIndexPaths.forEach { self?.tableView?.selectRow(at: $0, animated: false, scrollPosition: .none) } } } if let coordinator = transitionCoordinator { coordinator.animateAlongsideTransition(in: parent?.view, animation: deselectionAnimation, completion: reselection) } else { selectedIndexPaths.forEach { tableView?.deselectRow(at: $0, animated: false) } } NotificationCenter.default.addObserver(self, selector: #selector(FormViewController.keyboardWillShow(_:)), name: Notification.Name.UIKeyboardWillShow, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(FormViewController.keyboardWillHide(_:)), name: Notification.Name.UIKeyboardWillHide, object: nil) } open override func viewDidDisappear(_ animated: Bool) { super.viewDidDisappear(animated) NotificationCenter.default.removeObserver(self, name: Notification.Name.UIKeyboardWillShow, object: nil) NotificationCenter.default.removeObserver(self, name: Notification.Name.UIKeyboardWillHide, object: nil) } open override func prepare(for segue: UIStoryboardSegue, sender: Any?) { super.prepare(for: segue, sender: sender) let baseRow = sender as? BaseRow baseRow?.prepare(for: segue) } /** Returns the navigation accessory view if it is enabled. Returns nil otherwise. */ open func inputAccessoryView(for row: BaseRow) -> UIView? { let options = navigationOptions ?? Form.defaultNavigationOptions guard options.contains(.Enabled) else { return nil } guard row.baseCell.cellCanBecomeFirstResponder() else { return nil} navigationAccessoryView.previousButton.isEnabled = nextRow(for: row, withDirection: .up) != nil navigationAccessoryView.doneButton.target = self navigationAccessoryView.doneButton.action = #selector(FormViewController.navigationDone(_:)) navigationAccessoryView.previousButton.target = self navigationAccessoryView.previousButton.action = #selector(FormViewController.navigationAction(_:)) navigationAccessoryView.nextButton.target = self navigationAccessoryView.nextButton.action = #selector(FormViewController.navigationAction(_:)) navigationAccessoryView.nextButton.isEnabled = nextRow(for: row, withDirection: .down) != nil return navigationAccessoryView } //MARK: FormViewControllerProtocol /** Called when a cell becomes first responder */ public final func beginEditing<T:Equatable>(of cell: Cell<T>) { cell.row.isHighlighted = true cell.row.updateCell() RowDefaults.onCellHighlightChanged["\(type(of: self))"]?(cell, cell.row) cell.row.callbackOnCellHighlightChanged?() guard let _ = tableView, (form.inlineRowHideOptions ?? Form.defaultInlineRowHideOptions).contains(.FirstResponderChanges) else { return } let row = cell.baseRow let inlineRow = row?._inlineRow for row in form.allRows.filter({ $0 !== row && $0 !== inlineRow && $0._inlineRow != nil }) { if let inlineRow = row as? BaseInlineRowType { inlineRow.collapseInlineRow() } } } /** Called when a cell resigns first responder */ public final func endEditing<T:Equatable>(of cell: Cell<T>) { cell.row.isHighlighted = false cell.row.wasBlurred = true cell.row.updateCell() RowDefaults.onCellHighlightChanged["\(type(of: self))"]?(cell, cell.row) cell.row.callbackOnCellHighlightChanged?() if cell.row.validationOptions.contains(.validatesOnBlur) || cell.row.validationOptions.contains(.validatesOnChangeAfterBlurred) { cell.row.validate() } } /** Returns the animation for the insertion of the given rows. */ open func insertAnimation(forRows rows: [BaseRow]) -> UITableViewRowAnimation { return .fade } /** Returns the animation for the deletion of the given rows. */ open func deleteAnimation(forRows rows: [BaseRow]) -> UITableViewRowAnimation { return .fade } /** Returns the animation for the reloading of the given rows. */ open func reloadAnimation(oldRows: [BaseRow], newRows: [BaseRow]) -> UITableViewRowAnimation { return .automatic } /** Returns the animation for the insertion of the given sections. */ open func insertAnimation(forSections sections: [Section]) -> UITableViewRowAnimation { return .automatic } /** Returns the animation for the deletion of the given sections. */ open func deleteAnimation(forSections sections: [Section]) -> UITableViewRowAnimation { return .automatic } /** Returns the animation for the reloading of the given sections. */ open func reloadAnimation(oldSections: [Section], newSections: [Section]) -> UITableViewRowAnimation { return .automatic } //MARK: TextField and TextView Delegate open func textInputShouldBeginEditing<T>(_ textInput: UITextInput, cell: Cell<T>) -> Bool { return true } open func textInputDidBeginEditing<T>(_ textInput: UITextInput, cell: Cell<T>) { if let row = cell.row as? KeyboardReturnHandler { let next = nextRow(for: cell.row, withDirection: .down) if let textField = textInput as? UITextField { textField.returnKeyType = next != nil ? (row.keyboardReturnType?.nextKeyboardType ?? (form.keyboardReturnType?.nextKeyboardType ?? Form.defaultKeyboardReturnType.nextKeyboardType )) : (row.keyboardReturnType?.defaultKeyboardType ?? (form.keyboardReturnType?.defaultKeyboardType ?? Form.defaultKeyboardReturnType.defaultKeyboardType)) } else if let textView = textInput as? UITextView { textView.returnKeyType = next != nil ? (row.keyboardReturnType?.nextKeyboardType ?? (form.keyboardReturnType?.nextKeyboardType ?? Form.defaultKeyboardReturnType.nextKeyboardType )) : (row.keyboardReturnType?.defaultKeyboardType ?? (form.keyboardReturnType?.defaultKeyboardType ?? Form.defaultKeyboardReturnType.defaultKeyboardType)) } } } open func textInputShouldEndEditing<T>(_ textInput: UITextInput, cell: Cell<T>) -> Bool { return true } open func textInputDidEndEditing<T>(_ textInput: UITextInput, cell: Cell<T>) { } open func textInput<T>(_ textInput: UITextInput, shouldChangeCharactersInRange range: NSRange, replacementString string: String, cell: Cell<T>) -> Bool { return true } open func textInputShouldClear<T>(_ textInput: UITextInput, cell: Cell<T>) -> Bool { return true } open func textInputShouldReturn<T>(_ textInput: UITextInput, cell: Cell<T>) -> Bool { if let nextRow = nextRow(for: cell.row, withDirection: .down){ if nextRow.baseCell.cellCanBecomeFirstResponder(){ nextRow.baseCell.cellBecomeFirstResponder() return true } } tableView?.endEditing(true) return true } //MARK: FormDelegate open func valueHasBeenChanged(for: BaseRow, oldValue: Any?, newValue: Any?) {} //MARK: Private var oldBottomInset : CGFloat? } extension FormViewController : UITableViewDelegate { //MARK: UITableViewDelegate open func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? { return indexPath } open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { guard tableView == self.tableView else { return } let row = form[indexPath] // row.baseCell.cellBecomeFirstResponder() may be cause InlineRow collapsed then section count will be changed. Use orignal indexPath will out of section's bounds. if !row.baseCell.cellCanBecomeFirstResponder() || !row.baseCell.cellBecomeFirstResponder() { self.tableView?.endEditing(true) } row.didSelect() } open func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { guard tableView == self.tableView else { return tableView.rowHeight } let row = form[indexPath.section][indexPath.row] return row.baseCell.height?() ?? tableView.rowHeight } open func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { guard tableView == self.tableView else { return tableView.rowHeight } let row = form[indexPath.section][indexPath.row] return row.baseCell.height?() ?? tableView.estimatedRowHeight } open func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { return form[section].header?.viewForSection(form[section], type: .header) } open func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { return form[section].footer?.viewForSection(form[section], type:.footer) } open func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { if let height = form[section].header?.height { return height() } guard let view = form[section].header?.viewForSection(form[section], type: .header) else{ return UITableViewAutomaticDimension } guard view.bounds.height != 0 else { return UITableViewAutomaticDimension } return view.bounds.height } open func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { if let height = form[section].footer?.height { return height() } guard let view = form[section].footer?.viewForSection(form[section], type: .footer) else{ return UITableViewAutomaticDimension } guard view.bounds.height != 0 else { return UITableViewAutomaticDimension } return view.bounds.height } } extension FormViewController : UITableViewDataSource { //MARK: UITableViewDataSource open func numberOfSections(in tableView: UITableView) -> Int { return form.count } open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return form[section].count } open func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { form[indexPath].updateCell() return form[indexPath].baseCell } open func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { return form[section].header?.title } open func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? { return form[section].footer?.title } } extension FormViewController: FormDelegate { //MARK: FormDelegate open func sectionsHaveBeenAdded(_ sections: [Section], at indexes: IndexSet){ tableView?.beginUpdates() tableView?.insertSections(indexes, with: insertAnimation(forSections: sections)) tableView?.endUpdates() } open func sectionsHaveBeenRemoved(_ sections: [Section], at indexes: IndexSet){ tableView?.beginUpdates() tableView?.deleteSections(indexes, with: deleteAnimation(forSections: sections)) tableView?.endUpdates() } open func sectionsHaveBeenReplaced(oldSections:[Section], newSections: [Section], at indexes: IndexSet){ tableView?.beginUpdates() tableView?.reloadSections(indexes, with: reloadAnimation(oldSections: oldSections, newSections: newSections)) tableView?.endUpdates() } open func rowsHaveBeenAdded(_ rows: [BaseRow], at indexes: [IndexPath]) { tableView?.beginUpdates() tableView?.insertRows(at: indexes, with: insertAnimation(forRows: rows)) tableView?.endUpdates() } open func rowsHaveBeenRemoved(_ rows: [BaseRow], at indexes: [IndexPath]) { tableView?.beginUpdates() tableView?.deleteRows(at: indexes, with: deleteAnimation(forRows: rows)) tableView?.endUpdates() } open func rowsHaveBeenReplaced(oldRows:[BaseRow], newRows: [BaseRow], at indexes: [IndexPath]){ tableView?.beginUpdates() tableView?.reloadRows(at: indexes, with: reloadAnimation(oldRows: oldRows, newRows: newRows)) tableView?.endUpdates() } } extension FormViewController : UIScrollViewDelegate { //MARK: UIScrollViewDelegate open func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { tableView?.endEditing(true) } } extension FormViewController { //MARK: KeyBoard Notifications /** Called when the keyboard will appear. Adjusts insets of the tableView and scrolls it if necessary. */ open func keyboardWillShow(_ notification: Notification){ guard let table = tableView, let cell = table.findFirstResponder()?.formCell() else { return } let keyBoardInfo = notification.userInfo! let endFrame = keyBoardInfo[UIKeyboardFrameEndUserInfoKey] as! NSValue let keyBoardFrame = table.window!.convert(endFrame.cgRectValue, to: table.superview) let newBottomInset = table.frame.origin.y + table.frame.size.height - keyBoardFrame.origin.y var tableInsets = table.contentInset var scrollIndicatorInsets = table.scrollIndicatorInsets oldBottomInset = oldBottomInset ?? tableInsets.bottom if newBottomInset > oldBottomInset! { tableInsets.bottom = newBottomInset scrollIndicatorInsets.bottom = tableInsets.bottom UIView.beginAnimations(nil, context: nil) UIView.setAnimationDuration((keyBoardInfo[UIKeyboardAnimationDurationUserInfoKey] as! Double)) UIView.setAnimationCurve(UIViewAnimationCurve(rawValue: (keyBoardInfo[UIKeyboardAnimationCurveUserInfoKey] as! Int))!) table.contentInset = tableInsets table.scrollIndicatorInsets = scrollIndicatorInsets if let selectedRow = table.indexPath(for: cell) { table.scrollToRow(at: selectedRow, at: .none, animated: false) } UIView.commitAnimations() } } /** Called when the keyboard will disappear. Adjusts insets of the tableView. */ open func keyboardWillHide(_ notification: Notification){ guard let table = tableView, let oldBottom = oldBottomInset else { return } let keyBoardInfo = notification.userInfo! var tableInsets = table.contentInset var scrollIndicatorInsets = table.scrollIndicatorInsets tableInsets.bottom = oldBottom scrollIndicatorInsets.bottom = tableInsets.bottom oldBottomInset = nil UIView.beginAnimations(nil, context: nil) UIView.setAnimationDuration((keyBoardInfo[UIKeyboardAnimationDurationUserInfoKey] as! Double)) UIView.setAnimationCurve(UIViewAnimationCurve(rawValue: (keyBoardInfo[UIKeyboardAnimationCurveUserInfoKey] as! Int))!) table.contentInset = tableInsets table.scrollIndicatorInsets = scrollIndicatorInsets UIView.commitAnimations() } } public enum Direction { case up, down } extension FormViewController { //MARK: Navigation Methods func navigationDone(_ sender: UIBarButtonItem) { tableView?.endEditing(true) } func navigationAction(_ sender: UIBarButtonItem) { navigateTo(direction: sender == navigationAccessoryView.previousButton ? .up : .down) } public func navigateTo(direction: Direction){ guard let currentCell = tableView?.findFirstResponder()?.formCell() else { return } guard let currentIndexPath = tableView?.indexPath(for: currentCell) else { assertionFailure(); return } guard let nextRow = nextRow(for: form[currentIndexPath], withDirection: direction) else { return } if nextRow.baseCell.cellCanBecomeFirstResponder(){ tableView?.scrollToRow(at: nextRow.indexPath!, at: .none, animated: false) nextRow.baseCell.cellBecomeFirstResponder(withDirection: direction) } } func nextRow(for currentRow: BaseRow, withDirection direction: Direction) -> BaseRow? { let options = navigationOptions ?? Form.defaultNavigationOptions guard options.contains(.Enabled) else { return nil } guard let next = direction == .down ? form.nextRow(for: currentRow) : form.previousRow(for: currentRow) else { return nil } if next.isDisabled && options.contains(.StopDisabledRow) { return nil } if !next.baseCell.cellCanBecomeFirstResponder() && !next.isDisabled && !options.contains(.SkipCanNotBecomeFirstResponderRow){ return nil } if (!next.isDisabled && next.baseCell.cellCanBecomeFirstResponder()){ return next } return nextRow(for: next, withDirection:direction) } } extension FormViewControllerProtocol { //MARK: Helpers func makeRowVisible(_ row: BaseRow){ guard let cell = row.baseCell, let indexPath = row.indexPath, let tableView = tableView else { return } if cell.window == nil || (tableView.contentOffset.y + tableView.frame.size.height <= cell.frame.origin.y + cell.frame.size.height){ tableView.scrollToRow(at: indexPath, at: .bottom, animated: true) } } }
[ 157152, 244481, 108289, 223747, 141285, 54693, 229521, 298449, 215379, 230835, 236377, 336442 ]
6b7c56166e4f15dd9d8be7ec6e76a07761a0404b
70128d1867e2a9b3598b4b07c0f79748ccda3e8c
/MovieDBMVP/commonView/buttonImage/DetailButton.swift
acfc779eec0477eed40c9e68ea1a7b854096c846
[]
no_license
khinyadanarthein/MovieDBMVP
9a7adb4655fe25a2e31cdf75ac0a981da60b7cb1
36c4d1255235d17a99ac530ecf586a2bb8e19e41
refs/heads/master
2022-11-25T23:07:46.965369
2020-08-08T16:43:46
2020-08-08T16:43:46
284,410,442
0
0
null
2020-08-08T16:43:47
2020-08-02T07:07:50
Swift
UTF-8
Swift
false
false
1,910
swift
// // DetailButton.swift // MovieDBMVP // // Created by Khin Yadanar Thein on 07/08/2020. // Copyright © 2020 Khin Yadanar Thein. All rights reserved. // import UIKit @IBDesignable class DetailButton: UIButton { @IBInspectable var isActive : Bool = true { didSet { handleButtonState() } } override init(frame: CGRect) { super.init(frame: frame) buildView() } required init?(coder: NSCoder) { super.init(coder : coder) buildView() } override func prepareForInterfaceBuilder() { super.prepareForInterfaceBuilder() self.buildView() } private func buildView() { // backgroundColor = UIColor(named: "tint-color") titleLabel?.font = UIFont.boldSystemFont(ofSize: 15) //setImage(UIImage(systemName: "play.circle.fill"), for: .normal) setTitleColor(.white, for: .normal) setTitleColor(.gray, for: .highlighted) layer.cornerRadius = 20 layer.borderWidth = 0.2 layer.borderColor = UIColor.lightGray.cgColor handleButtonState() } private func handleButtonState() { if isActive { activeState() } else { inactiveState() } } private func activeState() { isEnabled = true //backgroundColor = UIColor.systemYellow setTitleColor(.white, for: .normal) } private func inactiveState() { backgroundColor = UIColor.gray isEnabled = false setTitleColor(.black, for: .normal) } }
[ -1 ]
f5f2f1bbedad8981db4f832a72613c8f9f54e90e
e16eb0456bfea4d68d5555b3f288ec7d4670b2ab
/Instagram/Controllers/Other/General/PublishPostViewController.swift
f891ce8dc5c405f035fdf2735552f175aae2f980
[]
no_license
jesther-ai/Instagram-Clone
b150ae8119a15098f2ce3938d501b072893bd5d6
b9ee1b5bdceeb079dde1de9fb19183d04783a13a
refs/heads/master
2023-06-03T02:34:04.920569
2021-06-22T00:12:11
2021-06-22T00:12:11
377,105,595
0
0
null
null
null
null
UTF-8
Swift
false
false
663
swift
// // PublishPostViewController.swift // Instagram // // Created by Jesther Silvestre on 6/15/21. // import UIKit class PublishPostViewController: 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. } */ }
[ 344695 ]
8985cfc14d81df763bd6ca69ef82875dd75ea9f0
0136f16b4d71c0e2f094c66d9fe8bd1783cf7f2d
/Example/HKPreloaders/AppDelegate.swift
60f5e42cf83e9a9eae650a84eb13210bbd9f6eed
[ "MIT" ]
permissive
Thisura98/HKPreloaders
8945f29db77913844ca0b3f1c0d4f426794230d0
8af3b3b491b7c45e873f05e40cce1affea16275f
refs/heads/master
2020-05-22T15:07:56.762080
2019-05-14T12:18:13
2019-05-14T12:18:13
186,401,435
3
0
MIT
2019-05-14T12:18:14
2019-05-13T10:52:41
Swift
UTF-8
Swift
false
false
2,174
swift
// // AppDelegate.swift // HKPreloaders // // Created by Thisura98 on 05/13/2019. // Copyright (c) 2019 Thisura98. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(_ application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } }
[ 229380, 229383, 229385, 278539, 229388, 294924, 278542, 327695, 229391, 278545, 229394, 278548, 229397, 229399, 229402, 352284, 229405, 278556, 278559, 229408, 278564, 294950, 229415, 229417, 237613, 229422, 360496, 229426, 237618, 229428, 286774, 319544, 204856, 229432, 286776, 286778, 352318, 286791, 237640, 286797, 278605, 311375, 163920, 237646, 196692, 319573, 311383, 278623, 278626, 319590, 311400, 278635, 303212, 278639, 131192, 278648, 237693, 303230, 327814, 131209, 303241, 417930, 303244, 311436, 319633, 286873, 286876, 311460, 311469, 32944, 327862, 286906, 327866, 180413, 286910, 131264, 286916, 286922, 286924, 286926, 319694, 286928, 131281, 278743, 278747, 295133, 155872, 319716, 278760, 237807, 303345, 286962, 303347, 131314, 229622, 327930, 278781, 278783, 278785, 237826, 319751, 278792, 286987, 319757, 311569, 286999, 319770, 287003, 287006, 287009, 287012, 287014, 287016, 287019, 311598, 287023, 262448, 311601, 287032, 155966, 319809, 278849, 319810, 319814, 311623, 319818, 311628, 229709, 319822, 287054, 278865, 229717, 196963, 196969, 139638, 213367, 106872, 319872, 311683, 311693, 65943, 319898, 311719, 278952, 139689, 278957, 311728, 278967, 180668, 311741, 278975, 319938, 278980, 98756, 278983, 319945, 278986, 319947, 278990, 278994, 311767, 279003, 279006, 188895, 172512, 287202, 279010, 279015, 172520, 319978, 279020, 172526, 311791, 279023, 172529, 279027, 319989, 180727, 164343, 279035, 311804, 287230, 279040, 303617, 287234, 279045, 172550, 303623, 320007, 172552, 287238, 279051, 172558, 279055, 303632, 279058, 303637, 279063, 279067, 172572, 279072, 172577, 295459, 172581, 295461, 279082, 311850, 279084, 172591, 172598, 279095, 172607, 172609, 172612, 377413, 172614, 213575, 172618, 303690, 33357, 287309, 279124, 172634, 262752, 172644, 311911, 189034, 295533, 172655, 172656, 352880, 295538, 189040, 172660, 287349, 189044, 189039, 287355, 287360, 295553, 295557, 311942, 303751, 287365, 352905, 311946, 287371, 279178, 311951, 287377, 172691, 287381, 311957, 221850, 287386, 230045, 172702, 287390, 303773, 172705, 287394, 172707, 303780, 164509, 287398, 295583, 287400, 279208, 172714, 295595, 279212, 189102, 172721, 287409, 66227, 303797, 189114, 287419, 303804, 328381, 287423, 328384, 279231, 287427, 312006, 107208, 107212, 172748, 287436, 172751, 287440, 295633, 172755, 303827, 279255, 172760, 287450, 303835, 279258, 189149, 303838, 213724, 279267, 312035, 295654, 279272, 312048, 230128, 312050, 230131, 205564, 303871, 230146, 295685, 328453, 230154, 33548, 312077, 295695, 295701, 230169, 369433, 295707, 328476, 295710, 230175, 303914, 279340, 205613, 279353, 230202, 312124, 328508, 222018, 295755, 377676, 148302, 287569, 303959, 230237, 279390, 230241, 279394, 303976, 336744, 303981, 303985, 303987, 328563, 279413, 303991, 303997, 295806, 295808, 304005, 295813, 304007, 320391, 304009, 213895, 304011, 230284, 189325, 304013, 213902, 279438, 189329, 295822, 189331, 304019, 295825, 58262, 304023, 279452, 410526, 279461, 279462, 304042, 213931, 304055, 230327, 287675, 197564, 304063, 238528, 304065, 213954, 189378, 156612, 295873, 213963, 312272, 304084, 304090, 320481, 304106, 320490, 312302, 328687, 320496, 304114, 295928, 320505, 312321, 295945, 197645, 230413, 295949, 320528, 140312, 295961, 238620, 197663, 304164, 304170, 304175, 238641, 312374, 238652, 238655, 230465, 238658, 296004, 132165, 336964, 205895, 320584, 238666, 296021, 402518, 336987, 230497, 296036, 361576, 296040, 205931, 296044, 164973, 205934, 279661, 312432, 279669, 337018, 189562, 279679, 279683, 222340, 205968, 296084, 238745, 304285, 238756, 205991, 222377, 165035, 337067, 165038, 238766, 230576, 238770, 304311, 230592, 312518, 279750, 230600, 230607, 148690, 320727, 279769, 304348, 279777, 304354, 296163, 320740, 279781, 304360, 320748, 279788, 279790, 304370, 296189, 320771, 312585, 296202, 296205, 230674, 320786, 230677, 296213, 230679, 320792, 230681, 296215, 214294, 304416, 230689, 173350, 312622, 296243, 312630, 222522, 296253, 222525, 296255, 312639, 230718, 296259, 378181, 296262, 238919, 296264, 320840, 230727, 296267, 296271, 222545, 230739, 312663, 222556, 337244, 230752, 312676, 230760, 173418, 410987, 230763, 230768, 296305, 312692, 230773, 304505, 181626, 304506, 279929, 181631, 312711, 312712, 296331, 288140, 288144, 230800, 304533, 288154, 337306, 288160, 173472, 288162, 288164, 279975, 304555, 370092, 279983, 173488, 288176, 279985, 312755, 296373, 312759, 337335, 288185, 279991, 222652, 312766, 173507, 296389, 222665, 230860, 312783, 288208, 230865, 288210, 370130, 222676, 288212, 288214, 280021, 239064, 329177, 288217, 288218, 280027, 288220, 239070, 288224, 280034, 288226, 280036, 288229, 280038, 288230, 288232, 370146, 288234, 320998, 288236, 288238, 288240, 288242, 296435, 288244, 288250, 148990, 321022, 206336, 402942, 296446, 296450, 230916, 230919, 214535, 304651, 370187, 304653, 402969, 230940, 222752, 108066, 296486, 296488, 157229, 230961, 288320, 288325, 124489, 280140, 280145, 288338, 280149, 288344, 280152, 239194, 280158, 403039, 370272, 181854, 239202, 370279, 312938, 280183, 280185, 280188, 280191, 116354, 280194, 280208, 280211, 288408, 280218, 280222, 419489, 190118, 321195, 296622, 321200, 337585, 296626, 296634, 296637, 419522, 313027, 280260, 419525, 206536, 280264, 206539, 206541, 206543, 280276, 313044, 321239, 280283, 18140, 313052, 288478, 313055, 321252, 313066, 288494, 280302, 280304, 313073, 419570, 288499, 321266, 288502, 280314, 288510, 124671, 67330, 280324, 280331, 198416, 280337, 296723, 116503, 321304, 329498, 296731, 321311, 313121, 313123, 304932, 321316, 280363, 141101, 165678, 280375, 321336, 296767, 288576, 345921, 337732, 280388, 304968, 280393, 280402, 173907, 313176, 42842, 280419, 321381, 296812, 313201, 1920, 255873, 305028, 280454, 247688, 280464, 124817, 280468, 239510, 280473, 124827, 214940, 247709, 214944, 280487, 313258, 321458, 296883, 124853, 214966, 10170, 296890, 288700, 296894, 190403, 296900, 280515, 337862, 165831, 280521, 231379, 296921, 354265, 354270, 239586, 313320, 354281, 231404, 124913, 165876, 321528, 313340, 288764, 239612, 239617, 313347, 288773, 313358, 305176, 321560, 313371, 354338, 305191, 223273, 313386, 354348, 124978, 215090, 124980, 288824, 288826, 321595, 378941, 313406, 288831, 288836, 67654, 280651, 354382, 288848, 280658, 215123, 354390, 288855, 288859, 280669, 313438, 149599, 280671, 149601, 321634, 149603, 223327, 329830, 280681, 313451, 223341, 280687, 215154, 313458, 280691, 313464, 321659, 280702, 288895, 321670, 215175, 141446, 288909, 141455, 141459, 275606, 280725, 313498, 100520, 288936, 280747, 288940, 288947, 280755, 321717, 280759, 280764, 280769, 280771, 280774, 280776, 321740, 313548, 280783, 280786, 280788, 313557, 280793, 280796, 280798, 338147, 280804, 280807, 157930, 280811, 280817, 125171, 280819, 157940, 182517, 280823, 280825, 280827, 280830, 280831, 280833, 125187, 280835, 125191, 125207, 125209, 321817, 125218, 321842, 223539, 125239, 280888, 280891, 289087, 280897, 280900, 239944, 305480, 280906, 239947, 305485, 305489, 379218, 280919, 248153, 215387, 354653, 313700, 313705, 280937, 190832, 280946, 223606, 313720, 280956, 280959, 313731, 240011, 199051, 289166, 240017, 297363, 190868, 297365, 240021, 297368, 297372, 141725, 297377, 289186, 297391, 289201, 240052, 289207, 305594, 289210, 281024, 289218, 289221, 289227, 436684, 281045, 281047, 215526, 166378, 305647, 281075, 174580, 240124, 281084, 305662, 305664, 240129, 305666, 305668, 223749, 330244, 240132, 223752, 338440, 150025, 281095, 223757, 281102, 223763, 223765, 281113, 322074, 281116, 281121, 182819, 281127, 281135, 150066, 158262, 158266, 289342, 281154, 322115, 158283, 281163, 281179, 338528, 338532, 281190, 199273, 281196, 158317, 19053, 313973, 297594, 281210, 158347, 264845, 182926, 133776, 182929, 314003, 117398, 314007, 289436, 174754, 330404, 289448, 133801, 174764, 314029, 314033, 240309, 133817, 314045, 314047, 314051, 199364, 297671, 158409, 289493, 363234, 289513, 289522, 289525, 289532, 322303, 289537, 322310, 264969, 322314, 322318, 281361, 281372, 322341, 215850, 281388, 289593, 281401, 289601, 281410, 281413, 281414, 240458, 281420, 240468, 281430, 322393, 297818, 281435, 281438, 281442, 174955, 224110, 207733, 207737, 183172, 158596, 338823, 322440, 314249, 240519, 183184, 240535, 224151, 289687, 297883, 289694, 289696, 289700, 289712, 281529, 289724, 52163, 183260, 420829, 281567, 289762, 322534, 297961, 183277, 322550, 134142, 322563, 314372, 330764, 175134, 322599, 322610, 314421, 281654, 314427, 314433, 207937, 314441, 207949, 322642, 314456, 281691, 314461, 281702, 281704, 314474, 281708, 281711, 289912, 248995, 306341, 306344, 306347, 322734, 306354, 142531, 199877, 289991, 306377, 289997, 249045, 363742, 363745, 298216, 330988, 126190, 216303, 322801, 388350, 257302, 363802, 199976, 199978, 314671, 298292, 298294, 257334, 216376, 298306, 380226, 224584, 224587, 224594, 216404, 306517, 150870, 314714, 224603, 159068, 314718, 265568, 314723, 281960, 150890, 306539, 314732, 314736, 290161, 216436, 306549, 298358, 314743, 306552, 306555, 314747, 298365, 290171, 290174, 224641, 281987, 314756, 298372, 281990, 224647, 265604, 298377, 314763, 142733, 298381, 314768, 224657, 306581, 314773, 314779, 314785, 314793, 282025, 282027, 241068, 241070, 241072, 282034, 241077, 150966, 298424, 306618, 282044, 323015, 306635, 306640, 290263, 290270, 290275, 339431, 282089, 191985, 282098, 290291, 282101, 241142, 191992, 290298, 151036, 290302, 282111, 290305, 175621, 192008, 323084, 257550, 282127, 290321, 282130, 323090, 290325, 282133, 241175, 290328, 282137, 290332, 241181, 282142, 282144, 290344, 306731, 290349, 290351, 290356, 28219, 282186, 224849, 282195, 282199, 282201, 306778, 159324, 159330, 314979, 298598, 323176, 224875, 241260, 323181, 257658, 315016, 282249, 290445, 282255, 282261, 175770, 298651, 323229, 282269, 298655, 323231, 61092, 282277, 306856, 282295, 323260, 282300, 323266, 282310, 323273, 282319, 306897, 241362, 306904, 282328, 298714, 52959, 216801, 282337, 241380, 216806, 323304, 282345, 12011, 282356, 323318, 282364, 282367, 306945, 241412, 323333, 282376, 216842, 323345, 282388, 323349, 282392, 184090, 315167, 315169, 282402, 315174, 323367, 241448, 315176, 241450, 282410, 306988, 306991, 315184, 323376, 315190, 241464, 159545, 282425, 298811, 307009, 413506, 241475, 307012, 298822, 148946, 315211, 282446, 307027, 315221, 282454, 315223, 241496, 323414, 241498, 307035, 307040, 110433, 282465, 241509, 110438, 298860, 110445, 282478, 315249, 110450, 315251, 282481, 315253, 315255, 339838, 315267, 282499, 315269, 241544, 282505, 241546, 241548, 298896, 298898, 282514, 241556, 298901, 44948, 241560, 282520, 241563, 241565, 241567, 241569, 282531, 241574, 282537, 298922, 36779, 241581, 282542, 241583, 323504, 241586, 282547, 241588, 290739, 241590, 241592, 241598, 290751, 241600, 241605, 151495, 241610, 298975, 241632, 298984, 241640, 241643, 298988, 241646, 241649, 241652, 323574, 290807, 241661, 299006, 282623, 315396, 241669, 315397, 282632, 282639, 290835, 282645, 241693, 282654, 241701, 102438, 217127, 282669, 323630, 282681, 290877, 282687, 159811, 315463, 315466, 192589, 307278, 192596, 176213, 307287, 315482, 217179, 315483, 192605, 233567, 200801, 299105, 217188, 299109, 307303, 315495, 356457, 307307, 45163, 315502, 192624, 307314, 323700, 299126, 233591, 299136, 307329, 315524, 307338, 233613, 241813, 307352, 299164, 299167, 184479, 184481, 315557, 184486, 307370, 307372, 184492, 307374, 307376, 323763, 176311, 184503, 307385, 307386, 258235, 307388, 176316, 307390, 299200, 184512, 307394, 307396, 299204, 184518, 307399, 323784, 307409, 307411, 176343, 299225, 233701, 307432, 184572, 282881, 184579, 282893, 323854, 291089, 282906, 291104, 233766, 282931, 307508, 315701, 332086, 307510, 307512, 176435, 168245, 307515, 307518, 282942, 282947, 323917, 282957, 110926, 233808, 323921, 315733, 323926, 233815, 315739, 323932, 299357, 242018, 242024, 299373, 315757, 250231, 242043, 315771, 299388, 299391, 291202, 299398, 242057, 291212, 299405, 291222, 315801, 291226, 242075, 283033, 291231, 61855, 283042, 291238, 291241, 127403, 127405, 127407, 291247, 299440, 299444, 127413, 291254, 283062, 127417, 291260, 127421, 283069, 127424, 299457, 127429, 127431, 315856, 176592, 315860, 176597, 127447, 283095, 299481, 176605, 242143, 291299, 340454, 127463, 242152, 291305, 127466, 176620, 291314, 127474, 291317, 135672, 233979, 291323, 127485, 291330, 283142, 127497, 135689, 233994, 291341, 233998, 127506, 234003, 234006, 127511, 152087, 283161, 242202, 234010, 135707, 135710, 242206, 242208, 291361, 242220, 291378, 152118, 234038, 234041, 315961, 70213, 242250, 111193, 242275, 299620, 242279, 168562, 184952, 135805, 135808, 291456, 373383, 299655, 135820, 316051, 225941, 316054, 299672, 135834, 373404, 299677, 225948, 135839, 299680, 225954, 135844, 299684, 242343, 209576, 242345, 373421, 135870, 135873, 135876, 135879, 299720, 299723, 299726, 225998, 226002, 119509, 226005, 226008, 242396, 299740, 201444, 299750, 283368, 234219, 283372, 381677, 185074, 226037, 283382, 316151, 234231, 234236, 226045, 242431, 234239, 209665, 234242, 299778, 242436, 234246, 226056, 291593, 234248, 242443, 234252, 242445, 234254, 291601, 242450, 234258, 242452, 234261, 348950, 201496, 234264, 234266, 291608, 234269, 283421, 234272, 234274, 152355, 234278, 299814, 283432, 234281, 234284, 234287, 283440, 185138, 242483, 234292, 234296, 234298, 160572, 283452, 234302, 234307, 242499, 234309, 316233, 234313, 316235, 234316, 283468, 242511, 234319, 234321, 234324, 201557, 234329, 234333, 308063, 234336, 242530, 349027, 234338, 234341, 234344, 234347, 177004, 234350, 324464, 234353, 152435, 177011, 234356, 234358, 234362, 226171, 234364, 291711, 234368, 234370, 291714, 291716, 234373, 316294, 226182, 234375, 308105, 226185, 234379, 234384, 234388, 234390, 226200, 234393, 209818, 308123, 234396, 324504, 324508, 234398, 291742, 234401, 291747, 291748, 234405, 291750, 234407, 324520, 324518, 234410, 291754, 291756, 324522, 226220, 324527, 234414, 234417, 201650, 324531, 291760, 234422, 226230, 324536, 275384, 234428, 291773, 234431, 242623, 324544, 324546, 234434, 226239, 234437, 226245, 234439, 324548, 234443, 291788, 234446, 193486, 193488, 234449, 275406, 234452, 234455, 234459, 234461, 234464, 234467, 234470, 168935, 5096, 324585, 234475, 234478, 316400, 234481, 316403, 234484, 234485, 324599, 234487, 234490, 234493, 234496, 316416, 234501, 275462, 308231, 234504, 234507, 234510, 234515, 300054, 234519, 234520, 316439, 234523, 234526, 234528, 300066, 234532, 300069, 234535, 234537, 234540, 144430, 234543, 234546, 275508, 234549, 300085, 300088, 234553, 234556, 234558, 316479, 234561, 308291, 316483, 234563, 234568, 234570, 316491, 234572, 300108, 234574, 300115, 234580, 234581, 234585, 275545, 242777, 234590, 234593, 234595, 234597, 300133, 234601, 300139, 234605, 160879, 234607, 275569, 234610, 300148, 234614, 398455, 144506, 234618, 234620, 275579, 234623, 226433, 234627, 275588, 234629, 242822, 234634, 234636, 177293, 234640, 275602, 234643, 308373, 324757, 234647, 226453, 234648, 234650, 308379, 275608, 234653, 300189, 119967, 324766, 324768, 283805, 234657, 242852, 234661, 177318, 283813, 234664, 300197, 275626, 234667, 316596, 308414, 300223, 234687, 300226, 308418, 283844, 300229, 308420, 308422, 234692, 283850, 300234, 300238, 300241, 316625, 300243, 300245, 316630, 300248, 300253, 300256, 300258, 300260, 234726, 300263, 300265, 300267, 161003, 300270, 300272, 120053, 300278, 316663, 275703, 300284, 275710, 300287, 292097, 300289, 161027, 300292, 300294, 275719, 177419, 300299, 242957, 300301, 349451, 177424, 275725, 283917, 349464, 415009, 283939, 259367, 292143, 283951, 300344, 226617, 243003, 283963, 226628, 283973, 300357, 177482, 283983, 316758, 357722, 316766, 316768, 292192, 218464, 292197, 316774, 243046, 218473, 284010, 324978, 136562, 333178, 275834, 275836, 275840, 316803, 316806, 226696, 316811, 226699, 316814, 226703, 300433, 234899, 226709, 357783, 316824, 316826, 300448, 144807, 144810, 144812, 284076, 144814, 144820, 284084, 292279, 284087, 144826, 144828, 144830, 144832, 144835, 144837, 38342, 144839, 144841, 144844, 144847, 144852, 144855, 103899, 300507, 333280, 226787, 218597, 292329, 300523, 259565, 300527, 308720, 259567, 292338, 226802, 316917, 292343, 308727, 300537, 316933, 316947, 308757, 308762, 284191, 284194, 284196, 235045, 284199, 284204, 284206, 284209, 284211, 284213, 308790, 284215, 316983, 194103, 284218, 194101, 226877, 284223, 284226, 284228, 243268, 292421, 284231, 226886, 128584, 284234, 366155, 317004, 276043, 284238, 226895, 284241, 292433, 284243, 300628, 284245, 194130, 284247, 317015, 235097, 243290, 284249, 276052, 276053, 300638, 284251, 284253, 284255, 284258, 243293, 292452, 292454, 284263, 177766, 284265, 292458, 284267, 292461, 284272, 284274, 284278, 276086, 292470, 292473, 284283, 276093, 284286, 276095, 284288, 292479, 284290, 325250, 284292, 292485, 276098, 292481, 284297, 317066, 284299, 317068, 276109, 284301, 284303, 284306, 276114, 284308, 284312, 284314, 284316, 276127, 284320, 284322, 284327, 284329, 317098, 284331, 276137, 284333, 284335, 276144, 284337, 284339, 300726, 284343, 284346, 284350, 358080, 276160, 284354, 358083, 284358, 276166, 358089, 284362, 276170, 276175, 284368, 276177, 284370, 358098, 284372, 317138, 284377, 284379, 284381, 284384, 358114, 284386, 358116, 276197, 317158, 358119, 284392, 325353, 358122, 284394, 284397, 358126, 284399, 358128, 276206, 358133, 358135, 276216, 358138, 300795, 358140, 284413, 358142, 358146, 317187, 284418, 317189, 317191, 284428, 300816, 300819, 317207, 284440, 300828, 300830, 276255, 325408, 300832, 300834, 284449, 317221, 227109, 358183, 186151, 276268, 300845, 243504, 300850, 284469, 276280, 325436, 358206, 276291, 366406, 276295, 300872, 153417, 292681, 358224, 284499, 276308, 284502, 317271, 178006, 276315, 292700, 284511, 317279, 227175, 292715, 300912, 292721, 284529, 300915, 284533, 292729, 317306, 284540, 292734, 325512, 169868, 276365, 358292, 284564, 317332, 399252, 284566, 350106, 284572, 276386, 284579, 276388, 358312, 317353, 284585, 276395, 292776, 292784, 276402, 358326, 161718, 358330, 276411, 276418, 276425, 301009, 301011, 301013, 292823, 301015, 301017, 358360, 292828, 276446, 153568, 276448, 276452, 292839, 276455, 350186, 292843, 276460, 276464, 178161, 227314, 276466, 325624, 350200, 276472, 317435, 276476, 276479, 350210, 276482, 178181, 276485, 350218, 276490, 292876, 350222, 317456, 276496, 317458, 243733, 243740, 317468, 317472, 325666, 243751, 292904, 178224, 276528, 243762, 309298, 325685, 325689, 235579, 325692, 235581, 178238, 276539, 276544, 243779, 284739, 325700, 292934, 243785, 276553, 350293, 350295, 309337, 227418, 350299, 194649, 350302, 194654, 227423, 178273, 309346, 227426, 309348, 350308, 309350, 194660, 309352, 350313, 309354, 301163, 350316, 292968, 227430, 301167, 276583, 350321, 276590, 284786, 276595, 350325, 227440, 350328, 292985, 301178, 292989, 301185, 317570, 350339, 292993, 317573, 350342, 350345, 350349, 301199, 317584, 325777, 350354, 350357, 350359, 350362, 350366, 276638, 153765, 284837, 350375, 350379, 350381, 350383, 129200, 350385, 350387, 350389, 350395, 350397, 350399, 227520, 350402, 227522, 301252, 350406, 227529, 301258, 309450, 276685, 309455, 276689, 309462, 301272, 276699, 309468, 194780, 309471, 301283, 317672, 317674, 325867, 243948, 194801, 309491, 227571, 309494, 243960, 227583, 276735, 227587, 276739, 211204, 276742, 227596, 325910, 309530, 342298, 211232, 317729, 276775, 211241, 325937, 276789, 325943, 211260, 260421, 276809, 285002, 276811, 235853, 276816, 235858, 276829, 276833, 391523, 276836, 293227, 276843, 293232, 276848, 186744, 211324, 227709, 285061, 366983, 317833, 178572, 285070, 285077, 178583, 227738, 317853, 276896, 317858, 342434, 285093, 317864, 285098, 276907, 235955, 276917, 293304, 293307, 293314, 309707, 293325, 129486, 317910, 293336, 235996, 317917, 293343, 358880, 276961, 293346, 227810, 276964, 293352, 236013, 293364, 301562, 293370, 317951, 309764, 301575, 121352, 236043, 317963, 342541, 55822, 113167, 309779, 317971, 309781, 277011, 55837, 227877, 227879, 293417, 227882, 309804, 293421, 105007, 236082, 285236, 23094, 277054, 244288, 219714, 129603, 318020, 301636, 301639, 301643, 285265, 399955, 309844, 277080, 309849, 285277, 285282, 326244, 318055, 277100, 309871, 121458, 277106, 170618, 170619, 309885, 309888, 277122, 227975, 277128, 285320, 301706, 318092, 326285, 334476, 318094, 277136, 277139, 227992, 318108, 285340, 318110, 227998, 137889, 383658, 285357, 318128, 277170, 293555, 318132, 342707, 154292, 277173, 285368, 277177, 277181, 318144, 277187, 277191, 277194, 277196, 277201, 342745, 137946, 342747, 113378, 203491, 228069, 277223, 342760, 285417, 56041, 56043, 56045, 277232, 228081, 56059, 310015, 285441, 310020, 285448, 310029, 228113, 285459, 277273, 293659, 326430, 228128, 293666, 285474, 228135, 318248, 277291, 318253, 293677, 285489, 301876, 293685, 285494, 301880, 285499, 301884, 310080, 293696, 277317, 293706, 277322, 277329, 162643, 310100, 301911, 301913, 277337, 301921, 400236, 236397, 162671, 326514, 310134, 15224, 236408, 277368, 416639, 416640, 113538, 310147, 416648, 39817, 187274, 277385, 301972, 424853, 277405, 277411, 310179, 293798, 293802, 236460, 277426, 293811, 276579, 293817, 293820, 203715, 326603, 342994, 276586, 293849, 293861, 228327, 228328, 318442, 228330, 228332, 326638, 277486, 351217, 318450, 293876, 293877, 285686, 302073, 121850, 293882, 285690, 302075, 244731, 293887, 277504, 277507, 277511, 277519, 293908, 293917, 293939, 318516, 277561, 277564, 310336, 7232, 293956, 277573, 228422, 310344, 293960, 277577, 277583, 203857, 293971, 310355, 310359, 236632, 277594, 138332, 277598, 203872, 277601, 285792, 310374, 203879, 310376, 228460, 318573, 203886, 187509, 285815, 367737, 285817, 302205, 285821, 392326, 285831, 253064, 302218, 285835, 294026, 384148, 162964, 187542, 302231, 285849, 302233, 285852, 302237, 285854, 285856, 302241, 285862, 277671, 302248, 64682, 277678, 294063, 294065, 302258, 277687, 294072, 318651, 294076, 277695, 318657, 244930, 302275, 130244, 302277, 228550, 302282, 310476, 302285, 302288, 310481, 302290, 203987, 302292, 302294, 302296, 384222, 310498, 285927, 318698, 302315, 195822, 228592, 294132, 138485, 204023, 228601, 204026, 228606, 204031, 64768, 310531, 138505, 228617, 318742, 204067, 277798, 130345, 277801, 113964, 285997, 384302, 285999, 277804, 113969, 277807, 277811, 318773, 318776, 277816, 286010, 277819, 294204, 417086, 277822, 286016, 302403, 294211, 384328, 277832, 277836, 146765, 294221, 326991, 294223, 277839, 277842, 277847, 277850, 179547, 277853, 146784, 277857, 302436, 277860, 294246, 327015, 310632, 327017, 351594, 277864, 277869, 277872, 351607, 310648, 277880, 310651, 277884, 277888, 310657, 310659, 351619, 294276, 327046, 277892, 253320, 310665, 318858, 277894, 277898, 277903, 310672, 351633, 277905, 277908, 277917, 310689, 277921, 130468, 228776, 277928, 277932, 310703, 277937, 130486, 310710, 310712, 277944, 310715, 277947, 302526, 228799, 277950, 277953, 302534, 245191, 310727, 64966, 277959, 277963, 302541, 277966, 302543, 310737, 277971, 228825, 163290, 277978, 310749, 277981, 277984, 310755, 277989, 277991, 187880, 277995, 310764, 286188, 278000, 228851, 310772, 278003, 278006, 40440, 212472, 278009, 40443, 286203, 310780, 40448, 228864, 286214, 228871, 302603, 302614, 302617, 286233, 302621, 187936, 146977, 286240, 187939, 40484, 294435, 40486, 286246, 40488, 245288, 294439, 40491, 294440, 294443, 294445, 310831, 286248, 40499, 40502, 212538, 40507, 40511, 40513, 228933, 40521, 286283, 40525, 40527, 400976, 212560, 228944, 40533, 147032, 40537, 40539, 40541, 278109, 40544, 40548, 40550, 40552, 286312, 40554, 286313, 310892, 40557, 40560, 188022, 122488, 294521, 343679, 294537, 310925, 286354, 278163, 302740, 122517, 278168, 179870, 327333, 229030, 212648, 302764, 278188, 278192, 319153, 278196, 302781, 319171, 302789, 294599, 278216, 302793, 294601, 319187, 286420, 278227, 229076, 286425, 319194, 278235, 229086, 278238, 286432, 294625, 294634, 302838, 319226, 286460, 278274, 302852, 278277, 302854, 311048, 294664, 352008, 319243, 311053, 302862, 319251, 302872, 294682, 278306, 188199, 294701, 319280, 278320, 319290, 229192, 302925, 188247, 188252, 237409, 294776, 360317, 294785, 327554, 360322, 40840, 40851, 294803, 188312, 294811, 319390, 237470, 40865, 319394, 294817, 294821, 311209, 180142, 294831, 188340, 40886, 319419, 294844, 294847, 237508, 393177, 294876, 294879, 294883, 393190, 294890, 311279, 278513, 237555, 311283, 278516, 278519, 237562 ]
59e9a5859698330a31fc8cd66680d017e2772a3f
2edb0141a0a9448fa4946082d3f07d452c271da9
/sk2/sk2Tests/sk2Tests.swift
948df014e052fa3dd674f3b9f51ccea3e4e42b52
[ "Apache-2.0" ]
permissive
martinope/Skuska
061bba67f2c9781bb76569286040e44d46fa4f2d
2063ce02cdb81612465116ff3d422ab338af3a4b
refs/heads/master
2021-01-01T05:30:06.864029
2016-05-08T09:21:18
2016-05-08T09:21:18
58,304,092
0
0
null
null
null
null
UTF-8
Swift
false
false
877
swift
// // sk2Tests.swift // sk2Tests // // Created by User on 11.11.2014. // Copyright (c) 2014 User. All rights reserved. // import UIKit import XCTest class sk2Tests: 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, 276484, 276489, 276492, 278541, 278544, 305179, 276509, 278558, 307231, 313375, 102437, 227370, 360491, 276533, 276534, 241720, 276543, 159807, 286788, 280649, 223316, 315476, 223318, 288857, 227417, 278618, 194652, 194653, 194656, 276577, 309345, 227428, 43109, 276581, 276582, 276585, 223340, 276589, 278638, 227439, 276592, 131189, 227446, 223350, 276603, 276606, 292992, 276613, 141450, 311435, 215178, 311438, 276627, 276631, 276632, 184475, 227492, 196773, 227495, 129203, 299187, 131256, 176314, 280762, 223419, 299198, 309444, 227528, 276682, 276684, 276687, 278742, 278746, 155867, 196834, 280802, 276709, 276710, 276715, 233715, 157944, 211193, 227576, 168188, 227585, 276737, 276744, 227592, 276748, 276753, 129301, 276760, 309529, 278810, 276764, 299293, 276774, 282919, 262450, 276787, 276792, 315706, 278846, 164162, 311621, 280902, 278856, 227658, 276813, 278862, 278863, 6481, 6482, 276821, 276822, 6489, 276831, 323935, 276835, 321894, 276839, 416104, 276847, 285040, 278898, 278908, 280961, 178571, 227725, 178578, 190871, 293274, 61857, 61859, 276900, 278954, 278961, 278965, 293303, 276920, 278969, 33211, 276925, 278978, 278985, 281037, 111056, 278993, 279002, 276958, 287198, 227809, 358882, 276962, 276963, 227813, 279013, 279019, 279022, 281072, 279039, 276998, 287241, 279050, 186893, 279054, 303631, 223767, 277017, 223769, 291358, 277029, 293419, 281138, 277048, 277049, 301634, 369220, 238651, 277066, 277083, 295519, 66150, 277094, 166507, 189036, 189037, 277101, 295535, 189042, 189043, 287346, 277111, 279164, 277118, 291454, 184962, 303746, 152203, 225933, 133774, 277133, 225936, 277138, 277141, 277142, 230040, 164512, 225956, 285353, 225962, 209581, 205487, 285361, 303793, 154291, 299699, 293556, 154294, 342706, 166580, 285371, 285372, 285374, 199366, 225997, 226001, 164563, 277204, 203477, 226004, 226007, 279252, 119513, 203478, 201442, 226019, 279269, 285415, 342762, 277227, 226033, 226035, 226036, 230134, 234234, 226043, 209660, 279294, 234241, 226051, 277254, 209670, 203529, 226058, 234250, 234253, 234256, 285463, 234263, 369432, 234268, 105246, 228129, 234277, 234280, 277289, 279336, 234283, 289576, 277294, 277295, 234286, 226097, 234289, 234294, 230199, 162621, 234301, 289598, 277312, 234304, 162626, 281408, 277316, 293693, 234311, 234312, 299849, 234317, 277325, 277327, 293711, 234323, 234326, 277339, 234331, 297822, 234335, 301918, 279392, 297826, 349026, 234340, 174949, 234343, 277354, 234346, 234349, 277360, 234355, 213876, 277366, 234360, 234361, 277370, 226170, 279417, 209785, 177019, 234367, 234366, 158593, 234372, 226181, 213894, 113542, 226184, 234377, 277381, 228234, 226189, 234381, 295824, 226194, 234387, 234386, 234392, 324507, 279456, 234400, 277410, 234404, 289703, 234409, 275371, 234412, 236461, 226222, 234419, 226227, 234425, 277435, 234427, 287677, 234430, 226241, 234436, 275397, 234438, 226249, 52172, 234444, 234445, 183248, 275410, 234450, 234451, 234454, 234457, 275418, 234463, 234466, 277479, 277480, 179176, 234472, 234473, 234477, 234482, 287731, 277492, 314355, 234492, 277505, 234498, 234500, 277509, 277510, 234503, 277513, 234506, 230410, 277517, 275469, 277518, 197647, 295953, 234509, 277523, 234517, 230423, 281625, 197657, 281626, 175132, 234530, 234531, 234534, 275495, 234539, 275500, 310317, 277550, 234542, 275505, 275506, 234548, 277563, 234555, 7229, 277566, 230463, 7230, 7231, 207938, 156733, 234560, 234565, 277574, 234569, 277579, 300111, 207953, 277585, 296018, 234577, 296019, 234583, 234584, 275547, 277596, 234594, 277603, 230499, 281700, 300135, 234603, 281707, 275565, 156785, 312434, 275571, 234612, 300151, 234616, 398457, 234622, 300158, 275585, 285828, 302213, 275590, 275591, 234631, 253063, 277640, 302217, 234632, 234642, 226451, 226452, 308372, 275607, 119963, 234652, 234656, 277665, 330913, 306338, 234659, 275620, 234663, 275625, 300201, 208043, 275628, 226479, 238769, 226481, 277686, 277690, 208058, 230588, 277694, 283840, 279747, 279760, 290000, 189652, 203989, 363744, 195811, 298212, 304356, 285929, 279792, 298228, 204022, 120055, 234742, 228600, 120056, 208124, 204041, 292107, 277792, 339234, 259363, 199971, 304421, 277800, 113962, 277803, 277806, 113966, 226608, 277809, 226609, 277814, 277815, 300343, 277821, 226624, 277824, 277825, 15686, 277831, 226632, 277834, 294218, 177484, 142669, 277838, 222541, 277841, 296273, 222548, 277845, 277844, 314709, 283991, 357719, 224605, 218462, 224606, 277856, 179552, 142689, 230756, 277862, 163175, 277866, 281962, 173420, 277868, 284014, 277871, 279919, 226675, 277878, 275831, 181625, 277882, 277883, 142716, 275838, 275839, 277890, 277891, 226694, 275847, 277896, 277897, 281992, 277900, 230799, 318864, 112017, 296338, 277907, 206228, 306579, 226711, 226712, 277919, 277920, 310692, 277925, 279974, 277927, 282024, 370091, 277936, 277939, 279989, 296375, 277943, 277946, 277949, 277952, 296387, 415171, 163269, 277957, 296391, 300487, 277962, 282060, 277965, 280013, 312782, 284116, 277974, 228823, 228824, 277977, 277980, 226781, 277983, 277988, 310757, 316902, 277993, 296425, 277994, 277997, 278002, 278005, 306677, 278008, 300542, 306693, 153095, 278023, 175625, 192010, 280077, 149007, 65041, 282136, 204313, 278056, 278060, 286254, 228917, 226875, 194110, 128583, 226888, 276040, 366154, 276045, 276046, 286288, 276050, 280147, 300630, 226906, 243292, 147036, 370271, 282213, 317032, 222832, 276084, 276085, 276088, 278140, 188031, 276097, 192131, 276100, 276101, 229001, 310923, 312972, 278160, 278162, 282259, 276116, 276117, 276120, 278170, 280220, 276126, 276129, 282273, 282276, 278191, 276146, 278195, 276148, 296628, 198324, 286388, 278201, 276156, 276165, 278214, 276172, 323276, 276173, 302797, 212688, 302802, 276179, 276180, 286423, 216795, 216796, 276195, 153319, 313065, 280300, 419569, 276210, 276211, 276219, 194303, 171776, 288512, 311042, 288516, 278285, 276238, 227091, 184086, 294678, 284442, 278299, 276253, 276257, 278307, 288547, 165677, 159533, 276279, 276282, 276283, 276287, 345919, 276294, 282438, 276298, 296779, 216918, 276311, 307031, 276318, 237408, 276325, 282474, 288619, 276332, 173936, 110452, 276344, 194429, 276350, 227199, 40850, 40853, 44952, 247712, 227238, 294823, 276394, 276401, 276408, 161722, 290746, 276413, 276421, 276422, 276430, 231375, 153552, 153554, 276444, 280541, 276450, 276451, 276454, 276459, 296941, 276462, 276463, 276468, 276469, 278518, 276475, 276478 ]
63da694ff68aa0f02048c2ed8449afef14a7a600
128525d1fd092b768805259fc4e8885a3802b8b5
/Sources/AWSSDKSwift/Services/ElastiCache/ElastiCache_Error.swift
dd00606dfff3b4b7a9f65a60577b5067b7be7877
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
timokoenig/aws-sdk-swift
881e515dec00645c8025ac0da017750e441685f2
49790f389848b632fd32faf40d92f755bf235a91
refs/heads/master
2020-05-07T22:26:56.944094
2019-03-12T00:32:46
2019-03-12T00:32:46
180,945,446
0
0
Apache-2.0
2019-04-12T06:34:16
2019-04-12T06:34:16
null
UTF-8
Swift
false
false
8,907
swift
// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/noppoMan/aws-sdk-swift/blob/master/Sources/CodeGenerator/main.swift. DO NOT EDIT. import AWSSDKSwiftCore /// Error enum for ElastiCache public enum ElastiCacheErrorType: AWSErrorType { case reservedCacheNodeNotFoundFault(message: String?) case invalidParameterValueException(message: String?) case invalidParameterCombinationException(message: String?) case invalidCacheParameterGroupStateFault(message: String?) case cacheParameterGroupNotFoundFault(message: String?) case cacheSecurityGroupNotFoundFault(message: String?) case invalidCacheSecurityGroupStateFault(message: String?) case authorizationAlreadyExistsFault(message: String?) case replicationGroupNotFoundFault(message: String?) case invalidReplicationGroupStateFault(message: String?) case invalidCacheClusterStateFault(message: String?) case invalidVPCNetworkStateFault(message: String?) case insufficientCacheClusterCapacityFault(message: String?) case nodeGroupsPerReplicationGroupQuotaExceededFault(message: String?) case nodeQuotaForCustomerExceededFault(message: String?) case snapshotAlreadyExistsFault(message: String?) case snapshotNotFoundFault(message: String?) case snapshotQuotaExceededFault(message: String?) case invalidSnapshotStateFault(message: String?) case cacheSubnetGroupAlreadyExistsFault(message: String?) case cacheSubnetGroupQuotaExceededFault(message: String?) case cacheSubnetQuotaExceededFault(message: String?) case invalidSubnet(message: String?) case cacheClusterNotFoundFault(message: String?) case nodeQuotaForClusterExceededFault(message: String?) case aPICallRateForCustomerExceededFault(message: String?) case nodeGroupNotFoundFault(message: String?) case testFailoverNotAvailableFault(message: String?) case tagQuotaPerResourceExceeded(message: String?) case invalidARNFault(message: String?) case snapshotFeatureNotSupportedFault(message: String?) case cacheSubnetGroupInUse(message: String?) case cacheSubnetGroupNotFoundFault(message: String?) case reservedCacheNodesOfferingNotFoundFault(message: String?) case subnetInUse(message: String?) case clusterQuotaForCustomerExceededFault(message: String?) case noOperationFault(message: String?) case replicationGroupAlreadyExistsFault(message: String?) case cacheSecurityGroupAlreadyExistsFault(message: String?) case cacheSecurityGroupQuotaExceededFault(message: String?) case cacheClusterAlreadyExistsFault(message: String?) case cacheParameterGroupQuotaExceededFault(message: String?) case cacheParameterGroupAlreadyExistsFault(message: String?) case reservedCacheNodeAlreadyExistsFault(message: String?) case reservedCacheNodeQuotaExceededFault(message: String?) case authorizationNotFoundFault(message: String?) case tagNotFoundFault(message: String?) case serviceLinkedRoleNotFoundFault(message: String?) } extension ElastiCacheErrorType { public init?(errorCode: String, message: String?){ var errorCode = errorCode if let index = errorCode.index(of: "#") { errorCode = String(errorCode[errorCode.index(index, offsetBy: 1)...]) } switch errorCode { case "ReservedCacheNodeNotFoundFault": self = .reservedCacheNodeNotFoundFault(message: message) case "InvalidParameterValueException": self = .invalidParameterValueException(message: message) case "InvalidParameterCombinationException": self = .invalidParameterCombinationException(message: message) case "InvalidCacheParameterGroupStateFault": self = .invalidCacheParameterGroupStateFault(message: message) case "CacheParameterGroupNotFoundFault": self = .cacheParameterGroupNotFoundFault(message: message) case "CacheSecurityGroupNotFoundFault": self = .cacheSecurityGroupNotFoundFault(message: message) case "InvalidCacheSecurityGroupStateFault": self = .invalidCacheSecurityGroupStateFault(message: message) case "AuthorizationAlreadyExistsFault": self = .authorizationAlreadyExistsFault(message: message) case "ReplicationGroupNotFoundFault": self = .replicationGroupNotFoundFault(message: message) case "InvalidReplicationGroupStateFault": self = .invalidReplicationGroupStateFault(message: message) case "InvalidCacheClusterStateFault": self = .invalidCacheClusterStateFault(message: message) case "InvalidVPCNetworkStateFault": self = .invalidVPCNetworkStateFault(message: message) case "InsufficientCacheClusterCapacityFault": self = .insufficientCacheClusterCapacityFault(message: message) case "NodeGroupsPerReplicationGroupQuotaExceededFault": self = .nodeGroupsPerReplicationGroupQuotaExceededFault(message: message) case "NodeQuotaForCustomerExceededFault": self = .nodeQuotaForCustomerExceededFault(message: message) case "SnapshotAlreadyExistsFault": self = .snapshotAlreadyExistsFault(message: message) case "SnapshotNotFoundFault": self = .snapshotNotFoundFault(message: message) case "SnapshotQuotaExceededFault": self = .snapshotQuotaExceededFault(message: message) case "InvalidSnapshotStateFault": self = .invalidSnapshotStateFault(message: message) case "CacheSubnetGroupAlreadyExistsFault": self = .cacheSubnetGroupAlreadyExistsFault(message: message) case "CacheSubnetGroupQuotaExceededFault": self = .cacheSubnetGroupQuotaExceededFault(message: message) case "CacheSubnetQuotaExceededFault": self = .cacheSubnetQuotaExceededFault(message: message) case "InvalidSubnet": self = .invalidSubnet(message: message) case "CacheClusterNotFoundFault": self = .cacheClusterNotFoundFault(message: message) case "NodeQuotaForClusterExceededFault": self = .nodeQuotaForClusterExceededFault(message: message) case "APICallRateForCustomerExceededFault": self = .aPICallRateForCustomerExceededFault(message: message) case "NodeGroupNotFoundFault": self = .nodeGroupNotFoundFault(message: message) case "TestFailoverNotAvailableFault": self = .testFailoverNotAvailableFault(message: message) case "TagQuotaPerResourceExceeded": self = .tagQuotaPerResourceExceeded(message: message) case "InvalidARNFault": self = .invalidARNFault(message: message) case "SnapshotFeatureNotSupportedFault": self = .snapshotFeatureNotSupportedFault(message: message) case "CacheSubnetGroupInUse": self = .cacheSubnetGroupInUse(message: message) case "CacheSubnetGroupNotFoundFault": self = .cacheSubnetGroupNotFoundFault(message: message) case "ReservedCacheNodesOfferingNotFoundFault": self = .reservedCacheNodesOfferingNotFoundFault(message: message) case "SubnetInUse": self = .subnetInUse(message: message) case "ClusterQuotaForCustomerExceededFault": self = .clusterQuotaForCustomerExceededFault(message: message) case "NoOperationFault": self = .noOperationFault(message: message) case "ReplicationGroupAlreadyExistsFault": self = .replicationGroupAlreadyExistsFault(message: message) case "CacheSecurityGroupAlreadyExistsFault": self = .cacheSecurityGroupAlreadyExistsFault(message: message) case "CacheSecurityGroupQuotaExceededFault": self = .cacheSecurityGroupQuotaExceededFault(message: message) case "CacheClusterAlreadyExistsFault": self = .cacheClusterAlreadyExistsFault(message: message) case "CacheParameterGroupQuotaExceededFault": self = .cacheParameterGroupQuotaExceededFault(message: message) case "CacheParameterGroupAlreadyExistsFault": self = .cacheParameterGroupAlreadyExistsFault(message: message) case "ReservedCacheNodeAlreadyExistsFault": self = .reservedCacheNodeAlreadyExistsFault(message: message) case "ReservedCacheNodeQuotaExceededFault": self = .reservedCacheNodeQuotaExceededFault(message: message) case "AuthorizationNotFoundFault": self = .authorizationNotFoundFault(message: message) case "TagNotFoundFault": self = .tagNotFoundFault(message: message) case "ServiceLinkedRoleNotFoundFault": self = .serviceLinkedRoleNotFoundFault(message: message) default: return nil } } }
[ -1 ]
aba51ce836fca11f956d39c898d38ef205c743e4
f5fc72be75af61f7f5fe793149a9d7c61001bccb
/FullscreenViewerDemo/DemoStuff/DemoFullscreenViewableView.swift
157cfb1538b835923c9a746dfd560eb5623d789d
[]
no_license
mattpolzin/ViewableGroup
eaf76f24c3e29193ed57267e98b164bb298c47e2
d824476669572672f51086468418114809e4473d
refs/heads/master
2021-04-28T15:57:55.881165
2018-03-18T01:33:59
2018-03-18T01:33:59
122,003,116
0
0
null
null
null
null
UTF-8
Swift
false
false
767
swift
// // DemoFullscreenViewable.swift // FullscreenViewerDemo // // Created by Mathew Polzin on 1/13/18. // Copyright © 2018 Mathew Polzin. All rights reserved. // import UIKit import ViewableGroup class DemoFullscreenViewableView: DemoViewableView { } class DemoFullscreenViewable: FullscreenViewable { let backgroundColor: UIColor init(color: UIColor) { backgroundColor = color super.init(nibName: nil, bundle: nil) } override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { backgroundColor = .purple super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) } required init?(coder aDecoder: NSCoder) { fatalError() } override func loadView() { view = DemoFullscreenViewableView(color: backgroundColor) } }
[ -1 ]
52fe32519f7f8fc92fa8cb926f94eff663cc1f13
14b9966f7da05b93938890da3a624e9d2b365fb4
/CallShow/CallShowCode/CallShow_Contact/Model/CSID_CallShowContact.swift
7d3ceffea3509e2e3e7f7b1077c9c66bb5f465f9
[]
no_license
xujiahuicoin/CallShow
fdc75bcb94406bfcfae2316c6bf5f72f6fb4fb1d
24ff10c06627146ea3025564554ebe23c34b0f07
refs/heads/master
2022-11-03T17:44:49.239567
2019-12-04T10:59:55
2019-12-04T10:59:55
null
0
0
null
null
null
null
UTF-8
Swift
false
false
9,652
swift
import UIKit import Contacts import Kingfisher class CSID_CallShowContact: NSObject { ///1.获取授权状态 class func obtainAuthorizationStatus() { //CNContactStore 通讯录对象 let status = CNContactStore.authorizationStatus(for: .contacts) //2.判断如果是未决定状态,则请求授权 if status == .notDetermined { //创建通讯录对象 let store = CNContactStore() //请求授权 store.requestAccess(for: .contacts, completionHandler: { (isRight : Bool,error : Error?) in if isRight { print("授权成功") NotificationCenter.default.post(name: NSNotification.Name(rawValue: "shouquanNotificationCenter"), object: self) } else { print("授权失败") } }) } } /// 获取联系人信息 class func GetContactInformation() -> NSMutableDictionary{ CSID_CallShowContact.obtainAuthorizationStatus() let dataDic:NSMutableDictionary = NSMutableDictionary.init() let nameArr = NSMutableArray.init() let imageArr = NSMutableArray.init() //1.获取授权状态 let status = CNContactStore.authorizationStatus(for: .contacts) // 2.判断当前授权状态 guard status == .authorized else { return dataDic} //3.创建通讯录对象 let store = CNContactStore() //4.从通讯录中获取所有联系人 //获取Fetch,并且指定之后要获取联系人中的什么属性 let keys = [CNContactFamilyNameKey, CNContactGivenNameKey, CNContactPhoneNumbersKey,CNContactImageDataKey] //创建请求对象 需要传入一个(keysToFetch: [CNKeyDescriptor]) 包含'CNKeyDescriptor'类型的数组 let request = CNContactFetchRequest(keysToFetch: keys as [CNKeyDescriptor]) //遍历所有联系人 //需要传入一个CNContactFetchRequest do { try store.enumerateContacts(with: request, usingBlock: {(contact : CNContact, stop : UnsafeMutablePointer<ObjCBool>) -> Void in //1.获取姓名 let firstName = contact.givenName let lastName = contact.familyName let nameString:String = lastName+firstName let nodata:Data = backImageViewWith(string: nameString, color: .red) nameArr.add(nameString) let img:Data = contact.imageData ?? nodata imageArr.add(img) dataDic.setValue(nameArr, forKey: "name") dataDic.setValue(imageArr, forKey: "image") }) } catch { print(error) } return dataDic } /// 根据指定联系人名字获取头像 class func getsTheAvatarBasedOnTheSpecifiedContactName(nameString:String) -> Data { var imageData:Data! //1.获取授权状态 let status = CNContactStore.authorizationStatus(for: .contacts) //2.判断当前授权状态 guard status == .authorized else { return imageData} //创建通讯录对象 let store = CNContactStore() //获取Fetch,并且指定要获取联系人中的什么属性 let keys = [CNContactFamilyNameKey, CNContactGivenNameKey, CNContactPhoneNumbersKey,CNContactImageDataKey,CNContactThumbnailImageDataKey,CNContactImageDataAvailableKey] //创建请求对象,需要传入一个(keysToFetch: [CNKeyDescriptor]) 包含'CNKeyDescriptor'类型的数组 let request = CNContactFetchRequest(keysToFetch: keys as [CNKeyDescriptor]) //遍历所有联系人 do { try store.enumerateContacts(with: request, usingBlock: { (contact : CNContact, stop : UnsafeMutablePointer<ObjCBool>) -> Void in let mutableContact = contact.mutableCopy() as! CNMutableContact //获取姓名 let lastName = mutableContact.familyName let firstName = mutableContact.givenName let name:String = lastName+firstName //判断是否符合要求 if nameString == name{ let nodata:Data = backImageViewWith(string: nameString, color: .red) imageData = contact.imageData ?? nodata } }) } catch { print(error) } return imageData } /// 生成图片 class func backImageViewWith(string:String,color:UIColor) ->Data{ let imgView:UIView = UIView.init(frame: CGRect(x: 0, y: 0, width: 50, height: 50)) let titleLab:UILabel = UILabel.init(frame: CGRect(x: 0, y: 0, width: 50, height: 50)) let sub1:String = String(string.prefix(1)) titleLab.text = sub1 titleLab.textAlignment = .center titleLab.font = UIFont.boldSystemFont(ofSize: 23) titleLab.textColor = .white titleLab.backgroundColor = .red CallShowRaise(titleLab, rabF: 25) imgView.addSubview(titleLab) let img:UIImage = getImageFromView(view: imgView) let data : Data = img.pngData()! return data } // 将某个view 转换成图像 class func getImageFromView(view:UIView) ->UIImage{ UIGraphicsBeginImageContext(view.bounds.size) view.layer.render(in: UIGraphicsGetCurrentContext()!) let image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return image! } /* 指定联系人设置 imageStr 更换的图片 nameArr 联系人数组 */ class func specifyContactSettings(imageData:Data,nameArr:Array<String>) { if imageData == nil{ print("图片不能为空") return; } CSID_CallShowContact.obtainAuthorizationStatus() //1.获取授权状态 let status = CNContactStore.authorizationStatus(for: .contacts) //2.判断当前授权状态 guard status == .authorized else { return } //创建通讯录对象 let store = CNContactStore() //获取Fetch,并且指定要获取联系人中的什么属性 let keys = [CNContactFamilyNameKey, CNContactGivenNameKey, CNContactPhoneNumbersKey,CNContactImageDataKey,CNContactThumbnailImageDataKey,CNContactImageDataAvailableKey] //创建请求对象,需要传入一个(keysToFetch: [CNKeyDescriptor]) 包含'CNKeyDescriptor'类型的数组 let request = CNContactFetchRequest(keysToFetch: keys as [CNKeyDescriptor]) //遍历所有联系人 do { try store.enumerateContacts(with: request, usingBlock: { (contact : CNContact, stop : UnsafeMutablePointer<ObjCBool>) -> Void in let mutableContact = contact.mutableCopy() as! CNMutableContact //获取姓名 let lastName = mutableContact.familyName let firstName = mutableContact.givenName let name:String = lastName+firstName for nameString:String in nameArr { //判断是否符合要求 if nameString == name{ mutableContact.imageData = imageData //修改联系人请求 let request = CNSaveRequest() request.update(mutableContact) do { //修改联系人 try store.execute(request) return; } catch { print(error) } } } }) } catch { print(error) } } /* 全部联系人设置 imgName 更换的图片 */ class func AllContactSettings(imageData:Data) { if imageData == nil{ print("图片不能为空") return; } CSID_CallShowContact.obtainAuthorizationStatus() //1.获取授权状态 let status = CNContactStore.authorizationStatus(for: .contacts) //2.判断当前授权状态 guard status == .authorized else { return } //创建通讯录对象 let store = CNContactStore() //获取Fetch,并且指定要获取联系人中的什么属性 let keys = [CNContactFamilyNameKey, CNContactGivenNameKey, CNContactPhoneNumbersKey,CNContactImageDataKey] //创建请求对象,需要传入一个(keysToFetch: [CNKeyDescriptor]) 包含'CNKeyDescriptor'类型的数组 let request = CNContactFetchRequest(keysToFetch: keys as [CNKeyDescriptor]) //遍历所有联系人 do { try store.enumerateContacts(with: request, usingBlock: { (contact : CNContact, stop : UnsafeMutablePointer<ObjCBool>) -> Void in let mutableContact = contact.mutableCopy() as! CNMutableContact mutableContact.imageData = imageData //修改联系人请求 let request = CNSaveRequest() request.update(mutableContact) do { //修改联系人 try store.execute(request) } catch { print(error) } }) } catch { print(error) } } }
[ -1 ]
c1075ec0f8cdb3482a507f6137f7c725fa179753
9101bfda1b1f12ebb9e2e7c22a9d32cc5f710fdb
/Mobile assignment RnD/Application/AppDelegate.swift
5df9cde98a3842024cc5c5e357c5bcf3163b0b3f
[]
no_license
hazemmaher92/Mobile_assignment_RnD
6a877cdd79851877457d4e026892fe6fa46375c5
ea7127ea9848a0b813aeb15c52afe0ce1ecc99c4
refs/heads/master
2020-03-25T20:29:13.626032
2018-08-09T10:01:49
2018-08-09T10:01:49
144,133,123
0
0
null
null
null
null
UTF-8
Swift
false
false
519
swift
// // AppDelegate.swift // Mobile assignment RnD // // Created by Hazem Maher on 8/6/18. // Copyright © 2018 Hazem Maher. 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 } }
[ 103936, 314370, 214915, 402946, 128651, 399243, 399115, 230796, 241551, 317202, 346773, 124057, 111260, 361886, 358175, 302624, 362284, 249004, 326962, 258487, 241596, 299452, 130494, 291777, 241602, 315207, 310217, 257610, 329165, 398930, 334300, 356582, 399083, 302448, 254846 ]
40768eb6b01c5fd42e91d6d2bb37c818c5f7a065
8b1f1be1522e64e9e06ffb0cf8bb93e6a3d3512e
/PolicemanClientApp/Application/Extensions/UIKit/TableView/UITableView+Actions.swift
74c1129b9f72847dea965b2b33eea442e609eece
[]
no_license
byhkalo/PolicemanClientApp
56f9647ef8d4fb7616b2486a674ab2ecd40e6165
a65d1a3825db33d9fe2d33dd2a1a9cf4ccaa4d3f
refs/heads/master
2020-04-17T06:04:28.886992
2019-01-17T23:12:20
2019-01-17T23:12:20
166,310,618
1
1
null
null
null
null
UTF-8
Swift
false
false
1,713
swift
// // UITableView+Actions.swift // // import UIKit import ObjectiveC private var associationKey = "private_TableViewActionsDelegate" protocol TableViewActionsDelegate: class { func tableView(_ tableView: UITableView, didAction action: AnyUserAction, onHeaderIn section: Int) func tableView(_ tableView: UITableView, didAction action: AnyUserAction, onCellAt indexPath: IndexPath) } extension TableViewActionsDelegate { func tableView(_ tableView: UITableView, didAction action: AnyUserAction, onCellAt indexPath: IndexPath) {} func tableView(_ tableView: UITableView, didAction action: AnyUserAction, onHeaderIn section: Int) {} } extension UITableView { weak var cellActionsDelegate: TableViewActionsDelegate? { get { if let result = objc_getAssociatedObject(self, &associationKey) as? TableViewActionsDelegate { return result } return nil } set { objc_setAssociatedObject(self, &associationKey, newValue, .OBJC_ASSOCIATION_ASSIGN) } } } extension UITableView: AnyActionViewDelegate { func actionView(_ view: AnyActionView, didAction action: AnyUserAction) { if let cell = view as? UITableViewCell { guard let indexPath = indexPath(for: cell) else { return } cellActionsDelegate?.tableView(self, didAction: action, onCellAt: indexPath) } else if let header = view as? UITableViewHeaderFooterView { let sectionCount = numberOfSections var sectionIndex = 0 for index in 0..<sectionCount { if header == headerView(forSection: index) { sectionIndex = index break } } cellActionsDelegate?.tableView(self, didAction: action, onHeaderIn: sectionIndex) } } }
[ -1 ]
62cc304ad621ecb653c86d59f8feb700f0093af1
7de474069057cdd5f2b5acfbc14a51454e9e2079
/WGCarry/blockly-ios-develop 2/Sources/Layout/LayoutEngine.swift
e908901e7249b6a28edee1a6dd3b6d17ea25c9b7
[ "Apache-2.0", "LicenseRef-scancode-free-unknown", "MIT" ]
permissive
oneGain/Hello-New-World
be4226e885a22f0ddfc01486563fff4c466783b6
a5220ebb171a38619b8e475990fd00828931f053
refs/heads/master
2020-03-09T05:39:03.725805
2018-04-08T10:12:32
2018-04-08T10:21:46
128,619,058
0
0
MIT
2018-04-09T02:27:16
2018-04-08T08:36:48
Swift
UTF-8
Swift
false
false
7,828
swift
/* * Copyright 2015 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import Foundation /** Core object that is required by `Layout` instances in order to provide: - Unit scaling between Blockly's Workspace coordinate system and the UIView coordinate system - UI configuration All `Layout` instances in a single `Layout` tree should share the same single instance of `LayoutEngine`. If any of the nodes in a single tree use different instances of `LayoutEngine`, unexpected results may occur. */ @objc(BKYLayoutEngine) @objcMembers open class LayoutEngine: NSObject { // MARK: - Properties /// The minimum scale that the engine can have, relative to the Workspace coordinate system. public fileprivate(set) final var minimumScale: CGFloat = 0.5 /// The maximum scale that the engine can have, relative to the Workspace coordinate system. public fileprivate(set) final var maximumScale: CGFloat = 2.0 /// The current scale of the UI, relative to the Workspace coordinate system. /// eg. scale = 2.0 means that a (10, 10) UIView point scales to a (5, 5) Workspace point. public final var scale: CGFloat = 1.0 { didSet { // Do not allow a scale less than minimumScale, or greater than maximumScale if scale < self.minimumScale { scale = self.minimumScale } if scale > self.maximumScale { scale = self.maximumScale } if scale != oldValue { // Now that the scale has changed, update all the view values in the config, config.updateViewValues(fromEngine: self) } } } /// The scale that should be used inside popovers public final var popoverScale: CGFloat { // Use the same scale as `self.scale`, but don't scale less than 1.0 return max(scale, 1.0) } /// Flag determining if `Layout` instances associated with this layout engine should be rendered /// in right-to-left (`true`) or left-to-right (`false`).. public final var rtl: Bool /// The UI configuration to use for this layout engine public final var config: LayoutConfig // MARK: - Initializers /** Creates a `LayoutEngine` instance. - parameter config: Optional parameter for setting `self.config`. If no value is specified, a `LayoutConfig` is created automatically. - parameter rtl: Optional parameter for setting `self.rtl`. If no value is specified, `self.rtl` is automatically set using the system's layout direction. - parameter minScale: The minimum scale for the engine, relative to Workspace coordinate system. Defaults to 0.5. - parameter maxScale: The maximum scale for the engine, relative to Workspace coordinate system. Degaults to 2.0. */ public init( config: LayoutConfig = LayoutConfig(), rtl: Bool? = nil, minimumScale: CGFloat = 0.5, maximumScale: CGFloat = 2.0) { self.config = config self.rtl = rtl ?? (UIApplication.shared.userInterfaceLayoutDirection == .rightToLeft) super.init() config.updateViewValues(fromEngine: self) self.minimumScale = minimumScale self.maximumScale = maximumScale } // MARK: - Public /** Using the current `scale` value, this method scales a point from the UIView coordinate system to the Workspace coordinate system. - parameter point: A point from the UIView coordinate system. - returns: A point in the Workspace coordinate system. - note: This does not translate a UIView point directly into a Workspace point, it only scales the magnitude of a UIView point into the Workspace coordinate system. For example, in RTL, more calculation would need to be done to get the UIView point's translated Workspace point. */ @inline(__always) public final func scaledWorkspaceVectorFromViewVector(_ point: CGPoint) -> WorkspacePoint { if scale == 0 { return WorkspacePoint.zero } else { return WorkspacePoint( x: workspaceUnitFromViewUnit(point.x), y: workspaceUnitFromViewUnit(point.y)) } } /** Using the current `scale` value, this method scales a size from the UIView coordinate system to the Workspace coordinate system. - parameter size: A size from the UIView coordinate system. - returns: A size in the Workspace coordinate system. */ @inline(__always) public final func workspaceSizeFromViewSize(_ size: CGSize) -> WorkspaceSize { if scale == 0 { return WorkspaceSize.zero } else { return WorkspaceSize(width: workspaceUnitFromViewUnit(size.width), height: workspaceUnitFromViewUnit(size.height)) } } /** Using the current `scale` value, this method scales a unit value from the UIView coordinate system to the Workspace coordinate system. - parameter unit: A unit value from the UIView coordinate system. - returns: A unit value in the Workspace coordinate system. */ @inline(__always) public final func workspaceUnitFromViewUnit(_ unit: CGFloat) -> CGFloat { if scale == 0 { return 0 } else if scale == 1 { return unit } else { return unit / scale } } /** Using the current `scale` value, this method scales a unit value from the Workspace coordinate system to the UIView coordinate system. - parameter unit: A unit value from the Workspace coordinate system. - returns: A unit value in the UIView coordinate system. */ @inline(__always) public final func viewUnitFromWorkspaceUnit(_ unit: CGFloat) -> CGFloat { if scale == 0 { return 0 } else if scale == 1 { return unit } else { return unit * scale } } /** Using the current `scale` value, this method scales a left-to-right point from the Workspace coordinate system to the UIView coordinate system. - parameter point: A point from the Workspace coordinate system. - returns: A point in the UIView coordinate system. */ @inline(__always) public final func viewPointFromWorkspacePoint(_ point: WorkspacePoint) -> CGPoint { if scale == 0 { return CGPoint.zero } else { return CGPoint(x: viewUnitFromWorkspaceUnit(point.x), y: viewUnitFromWorkspaceUnit(point.y)) } } /** Using the current `scale` value, this method scales a (x, y) point from the Workspace coordinate system to the UIView coordinate system. - parameter x: The x-coordinate of the point - parameter y: The y-coordinate of the point - returns: A point in the UIView coordinate system. */ @inline(__always) public final func viewPointFromWorkspacePoint(_ x: CGFloat, _ y: CGFloat) -> CGPoint { if scale == 0 { return CGPoint.zero } else { return CGPoint(x: viewUnitFromWorkspaceUnit(x), y: viewUnitFromWorkspaceUnit(y)) } } /** Using the current `scale` value, this method scales a size from the Workspace coordinate system to the UIView coordinate system. - parameter size: A size from the Workspace coordinate system. - returns: A size in the UIView coordinate system. */ @inline(__always) public final func viewSizeFromWorkspaceSize(_ size: WorkspaceSize) -> CGSize { if scale == 0 { return CGSize.zero } else { return CGSize(width: viewUnitFromWorkspaceUnit(size.width), height: viewUnitFromWorkspaceUnit(size.height)) } } }
[ -1 ]
341e4b8b2796b5eaef7388285197cde83fd8f659
61186557c262c36d0284a98fde7d25c81e1a3084
/Watch1 WatchKit Extension/ExtensionDelegate.swift
11197d2c043d6371473f424074eb4f545efd55f3
[]
no_license
rriosalido/Watch3-simu
05a4fcadad56d3df2c6bb1ef2072b3cbdf2a9e78
3d96621c7b0c3f963627f5f1de139b6ff901a7db
refs/heads/master
2021-01-11T06:38:05.868942
2017-02-09T10:56:28
2017-02-09T10:56:28
81,441,092
0
0
null
null
null
null
UTF-8
Swift
false
false
2,457
swift
// // ExtensionDelegate.swift // Watch1 WatchKit Extension // // Created by Ricardo Riosalido on 17/1/17. // Copyright © 2017 Ricardo Riosalido. All rights reserved. // import WatchKit class ExtensionDelegate: NSObject, WKExtensionDelegate { func applicationDidFinishLaunching() { // Perform any final initialization of your application. } func applicationDidBecomeActive() { // 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 applicationWillResignActive() { // 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, etc. } func handle(_ backgroundTasks: Set<WKRefreshBackgroundTask>) { // Sent when the system needs to launch the application in the background to process tasks. Tasks arrive in a set, so loop through and process each one. for task in backgroundTasks { // Use a switch statement to check the task type switch task { case let backgroundTask as WKApplicationRefreshBackgroundTask: // Be sure to complete the background task once you’re done. backgroundTask.setTaskCompleted() case let snapshotTask as WKSnapshotRefreshBackgroundTask: // Snapshot tasks have a unique completion call, make sure to set your expiration date snapshotTask.setTaskCompleted(restoredDefaultState: true, estimatedSnapshotExpiration: Date.distantFuture, userInfo: nil) case let connectivityTask as WKWatchConnectivityRefreshBackgroundTask: // Be sure to complete the connectivity task once you’re done. connectivityTask.setTaskCompleted() case let urlSessionTask as WKURLSessionRefreshBackgroundTask: // Be sure to complete the URL session task once you’re done. urlSessionTask.setTaskCompleted() default: // make sure to complete unhandled task types task.setTaskCompleted() } } } }
[ 313604, 286341, 312968, 302729, 330506, 177291, 179598, 205971, 316820, 333717, 292374, 218523, 320539, 324764, 205983, 216863, 36769, 266917, 168102, 153086, 241445, 192042, 40493, 140077, 164399, 61871, 219697, 108210, 238648, 312895, 159809, 15683, 309448, 298954, 193483, 19915, 310349, 196689, 259412, 377684, 196055, 241501, 200799, 144503, 166372, 177125, 229222, 286180, 350310, 157285, 175742, 318446, 108912, 287728, 328946, 299765, 234743, 224638 ]
f96a179f6ceeab63020e5f7abdeea18e442e5a0e
8cef79e444c23a33aa99a42174a28863dfec949a
/Elite/AllSportTabBar.swift
1749171babebf1f34b7ce0fccd65c9fc04105b4d
[]
no_license
sorrowllj/app
b75b197d1afb546e767eb1269f061d68ef1d860a
f029703b859eff2c72327d1191ffbee92b7eab1d
refs/heads/master
2020-04-06T04:12:53.770069
2016-06-11T06:57:18
2016-06-11T06:57:18
59,765,179
0
0
null
null
null
null
UTF-8
Swift
false
false
2,121
swift
// // AllSportTabBar.swift // Elite // // Created by Jerry on 16/4/20. // Copyright © 2016年 Jerry. All rights reserved. // import UIKit protocol AllSportTabBarDelegate { func comment() func commentController() func likeSport(btn:UIButton) } class AllSportTabBar: UIView { var delegate:AllSportTabBarDelegate? override func drawRect(rect: CGRect) { let context = UIGraphicsGetCurrentContext() CGContextSetLineWidth(context, 0.5) CGContextSetRGBStrokeColor(context, 231/255, 231/255, 231/255, 231/255) for i in 0 ..< 3 { CGContextMoveToPoint(context, CGFloat(i) * rect.size.width / 3, rect.size.height * 0.1) CGContextAddLineToPoint(context, CGFloat(i) * rect.size.width / 3, rect.size.height * 0.9) } CGContextMoveToPoint(context, 8, 0) CGContextAddLineToPoint(context, rect.size.width - 8, 0) CGContextStrokePath(context) } override init(frame: CGRect) { super.init(frame:frame) self.backgroundColor = UIColor.whiteColor() let imageName = ["Pen 4","chat 3","heart"] for i in 0..<3 { let btn = UIButton(frame: CGRectMake(CGFloat(i)*frame.size.width/3,0,frame.size.width/3,frame.size.height)) btn.setImage(UIImage(named: imageName[i]), forState: .Normal) self.addSubview(btn) btn.tag = i btn.addTarget(self, action: #selector(SelfSportTabBar.SportTabbarAction(_:)), forControlEvents: .TouchUpInside) } } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } /** * AllSportTabBarDelegate */ func SportTabbarAction(btn:UIButton){ switch btn.tag { case 0: delegate?.comment() break case 1: delegate?.commentController() break case 2: delegate?.likeSport(btn) break default: break } } }
[ -1 ]
efd7395aff9f6163849bb9c9290ae70044e10ef2
190b79de9f652a67bdd5eef291782a5d1cddfaa5
/SwiftEventsModule/SwiftEvents/Event.swift
3afb5dfba5344a0872b4dc215ae83cbd417fd0c9
[ "MIT" ]
permissive
philipgeorgiev123/SwiftEvents
fec27a5ea65f9d649ff78bb28a92e973291db1ed
74222f7e1a774f7c6b64cd696a64ea5fa03c8260
refs/heads/master
2021-01-18T14:01:40.659638
2017-05-14T12:22:02
2017-05-14T12:22:02
30,116,674
10
1
null
null
null
null
UTF-8
Swift
false
false
228
swift
// // Created by freezing on 18/01/15. // Copyright (c) 2015 iccode ltd. All rights reserved. // import Foundation open class Event { var type : String! init(type : String) { self.type = type; } }
[ -1 ]
108c1029f880cfd4fc1258178b06375f66ef0100
580570d72bc926315739d37c57cda05561ede0c6
/Twitter/AppDelegate.swift
8b389147286295eec7e6c3ef0d279e244f133d8e
[ "Apache-2.0" ]
permissive
mysteriesunsolved/Twitter-Redux
4987cad7b8884ab4d7d3cd57afd0e3bbf863601b
9ad5821bb0e23f25e22668bd9943a474cbe57cb5
refs/heads/master
2021-06-04T11:32:47.539523
2016-02-22T09:39:45
2016-02-22T09:39:45
null
0
0
null
null
null
null
UTF-8
Swift
false
false
3,151
swift
// // AppDelegate.swift // Twitter // // Created by Sanaya Sanghvi on 2/7/16. // Copyright © 2016 Sanaya Sanghvi. All rights reserved. // import UIKit import BDBOAuth1Manager import AFNetworking @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? var storyboard = UIStoryboard(name: "Main", bundle: nil) func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. NSNotificationCenter.defaultCenter().addObserver(self, selector: "userDidLogout", name: userDidLogoutNotification, object: nil) if User.currentUser != nil { //Go to the log in screen print("current user detected: \(User.currentUser?.name)") var vc = storyboard.instantiateViewControllerWithIdentifier("navigation") as UIViewController window?.rootViewController = vc } return true } func userDidLogout() { var vc = storyboard.instantiateInitialViewController()! as UIViewController window?.rootViewController = vc } func applicationWillResignActive(application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } func applicationDidEnterBackground(application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool { TwitterClient.sharedInstance.openURL(url) return true } }
[ 228776, 276617, 277971, 277211 ]
bb03f38e7fa8bf6d7da0a6e26ed61dd5c97025f9
4380af434f3ae1c9bc619892add45b3f84674337
/Image Classifier/Image Classifier/AppDelegate.swift
d5934e8a9bffcda0333b38f037e9a16de0f56fce
[]
no_license
efrancil/iOS-Image-Classifer
e45ebab11b8901314b05fcfc11fbc15aa24fa0a7
86a99dd1f4195c7cac7a4c6d6619757d7dd37676
refs/heads/main
2023-03-31T09:11:50.356145
2021-03-28T05:48:23
2021-03-28T05:48:23
351,939,173
0
0
null
null
null
null
UTF-8
Swift
false
false
1,349
swift
// // AppDelegate.swift // Image Classifier // // Created by Ethan on 3/26/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, 327871, 180416, 377036, 180431, 377046, 418007, 418010, 377060, 327914, 205036, 393456, 393460, 418043, 336123, 385280, 336128, 262404, 164106, 180490, 368911, 262416, 262422, 377117, 262436, 336180, 262454, 393538, 262472, 344403, 213332, 65880, 262496, 418144, 262499, 213352, 246123, 262507, 262510, 213372, 385419, 393612, 262550, 262552, 385440, 385443, 262566, 385451, 262573, 393647, 385458, 262586, 344511, 262592, 360916, 369118, 328177, 328179, 328182, 328189, 328192, 164361, 410128, 393747, 254490, 188958, 385570, 33316, 377383, 197159, 352821, 197177, 418363, 188987, 369223, 385609, 385616, 352864, 369253, 262760, 352874, 352887, 254587, 377472, 148105, 377484, 352918, 98968, 344744, 361129, 336555, 385713, 434867, 164534, 336567, 328378, 164538, 328386, 344776, 352968, 352971, 418507, 352973, 385742, 385748, 361179, 189153, 369381, 361195, 418553, 344831, 344835, 336643, 344841, 361230, 336659, 418580, 418585, 434970, 369435, 418589, 262942, 418593, 336675, 328484, 418598, 418605, 336696, 361273, 328515, 336708, 328519, 361288, 336711, 328522, 336714, 426841, 197468, 254812, 361309, 361315, 361322, 328573, 377729, 369542, 361360, 222128, 345035, 386003, 345043, 386011, 386018, 386022, 435187, 328702, 328714, 361489, 386069, 386073, 336921, 336925, 345118, 377887, 345133, 345138, 386101, 361536, 197707, 189520, 345169, 156761, 361567, 148578, 345199, 386167, 361593, 410745, 361598, 214149, 345222, 386186, 337047, 345246, 214175, 337071, 337075, 345267, 386258, 328924, 66782, 222437, 386285, 328941, 386291, 345376, 353570, 345379, 410917, 345382, 337205, 345399, 378169, 369978, 337222, 337229, 337234, 263508, 402791, 345448, 271730, 378227, 271745, 181638, 353673, 181643, 181649, 181654, 230809, 181670, 181673, 181678, 181681, 337329, 181684, 181690, 361917, 181696, 337349, 181703, 337365, 271839, 329191, 361960, 329194, 116210, 337398, 337415, 329226, 419339, 419343, 419349, 345625, 419355, 370205, 419359, 394786, 419362, 370213, 419368, 419376, 206395, 214593, 419400, 419402, 353867, 419406, 419410, 394853, 345701, 222830, 370297, 353919, 403075, 345736, 198280, 403091, 345749, 419483, 345757, 345762, 419491, 345765, 419497, 419501, 370350, 419506, 419509, 419512, 337592, 419517, 337599, 419527, 419530, 419535, 272081, 394966, 419542, 419544, 181977, 345818, 419547, 419550, 419559, 337642, 419563, 337645, 370415, 337659, 141051, 337668, 362247, 395021, 362255, 116509, 345887, 378663, 345905, 354106, 354111, 247617, 354117, 370503, 329544, 370509, 354130, 247637, 337750, 370519, 313180, 354142, 354150, 354156, 345964, 345967, 345970, 345974, 403320, 354172, 247691, 337808, 247700, 329623, 436126, 436132, 337833, 362413, 337844, 346057, 346063, 247759, 329697, 354277, 190439, 247789, 354313, 346139, 436289, 378954, 395339, 338004, 100453, 329832, 329855, 329885, 411805, 346272, 362660, 100524, 387249, 379066, 387260, 256191, 395466, 346316, 411861, 411864, 411868, 411873, 379107, 411876, 387301, 346343, 338152, 387306, 387312, 346355, 436473, 321786, 379134, 411903, 411916, 379152, 395538, 387349, 338199, 387352, 182558, 338211, 395566, 248111, 362822, 436555, 190796, 379233, 354673, 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, 347176, 396328, 158761, 199728, 396336, 330800, 396339, 339001, 388154, 388161, 347205, 248904, 330826, 248914, 412764, 339036, 257120, 265320, 248951, 420984, 330889, 347287, 248985, 339097, 44197, 380070, 339112, 249014, 126144, 330958, 330965, 265432, 265436, 388319, 388347, 175375, 159005, 175396, 208166, 273708, 347437, 372015, 347441, 372018, 199988, 44342, 175415, 396600, 437566, 175423, 437570, 437575, 437583, 331088, 437587, 331093, 396633, 175450, 437595, 175457, 208227, 175460, 175463, 265580, 437620, 175477, 249208, 175483, 249214, 175486, 175489, 249218, 249224, 249227, 249234, 175513, 175516, 396705, 175522, 355748, 380332, 396722, 208311, 372163, 216517, 380360, 216522, 339404, 372176, 208337, 339412, 413141, 339417, 339420, 249308, 339424, 249312, 339428, 339434, 249328, 69113, 372228, 208398, 380432, 175635, 265778, 265795, 396872, 265805, 224853, 224857, 257633, 224870, 372327, 257646, 372337, 224884, 224887, 224890, 224894, 372353, 224897, 216707, 421508, 126596, 224904, 224909, 11918, 159374, 224913, 126610, 224916, 224919, 126616, 208538, 224922, 224926, 224929, 224932, 257704, 224936, 224942, 257712, 224947, 257716, 257720, 224953, 257724, 224959, 257732, 224965, 224969, 339662, 224975, 257747, 224981, 224986, 257761, 224993, 257764, 224999, 339695, 225012, 257787, 225020, 257790, 339710, 225025, 257794, 339721, 257801, 257804, 225038, 257807, 225043, 372499, 167700, 225048, 257819, 225053, 184094, 225058, 257833, 225066, 257836, 413484, 225070, 225073, 372532, 257845, 225079, 397112, 225082, 397115, 225087, 225092, 225096, 323402, 257868, 225103, 257871, 397139, 225108, 225112, 257883, 257886, 225119, 257890, 339814, 225127, 274280, 257896, 257901, 225137, 339826, 257908, 225141, 257912, 225148, 257916, 257920, 225155, 339844, 225165, 397200, 225170, 380822, 225175, 225180, 118691, 184244, 372664, 372702, 372706, 356335, 380918, 372738, 405533, 430129, 266294, 266297, 421960, 356439, 430180, 421990, 266350, 356466, 266362, 381068, 225423, 250002, 250004, 225429, 356506, 225437, 135327, 225441, 438433, 225444, 438436, 225447, 438440, 225450, 258222, 225455, 430256, 225458, 225461, 225466, 389307, 225470, 381120, 372929, 430274, 225475, 389320, 225484, 225487, 225490, 225493, 266453, 225496, 225499, 225502, 225505, 356578, 225510, 217318, 225514, 225518, 372976, 381176, 397571, 389380, 61722, 356637, 356640, 356643, 356646, 266536, 356649, 356655, 332080, 340275, 356660, 397622, 332090, 225597, 332097, 201028, 348488, 332106, 332117, 348502, 250199, 250202, 332125, 250210, 348522, 348525, 348527, 332152, 389502, 250238, 332161, 356740, 332172, 373145, 340379, 389550, 324030, 266687, 160234, 127471, 340472, 381436, 324094, 266754, 324099, 324102, 324111, 340500, 324117, 324131, 332324, 381481, 356907, 324139, 324142, 356916, 324149, 324155, 348733, 324164, 356934, 348743, 381512, 324170, 324173, 324176, 389723, 332380, 373343, 381545, 340627, 373398, 184982, 258721, 332453, 332459, 389805, 332463, 381617, 332471, 332483, 332486, 373449, 357069, 332493, 357073, 332511, 332520, 340718, 332533, 348924, 373510, 389926, 348978, 152370, 340789, 348982, 398139, 127814, 357201, 357206, 389978, 430939, 357211, 357214, 201579, 201582, 349040, 340849, 201588, 430965, 381813, 324472, 398201, 119674, 324475, 430972, 340858, 340861, 324478, 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, 349311, 160895, 152703, 210052, 210055, 349319, 218247, 210067, 210071, 210077, 210080, 251044, 210084, 185511, 210088, 210095, 210098, 210107, 210115, 332997, 210127, 333009, 210131, 333014, 210138, 210143, 218354, 218360, 251128, 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, 366387, 210739, 399159, 358200, 325440, 366401, 341829, 325446, 46920, 341834, 341838, 341843, 415573, 358234, 341851, 350045, 399199, 259938, 399206, 358255, 268143, 399215, 358259, 341876, 333689, 243579, 325504, 333698, 333708, 333724, 382890, 350146, 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, 325919, 350498, 194852, 350504, 358700, 391468, 350509, 358704, 358713, 358716, 383306, 334161, 383321, 383330, 383333, 391530, 383341, 334203, 268668, 194941, 391563, 366990, 416157, 268701, 342430, 375208, 326058, 375216, 334262, 334275, 326084, 358856, 195039, 334304, 334311, 375277, 334321, 350723, 391690, 186897, 342545, 334358, 342550, 342554, 334363, 358941, 350761, 252461, 334384, 358961, 383536, 334394, 252482, 219718, 334407, 334420, 350822, 375400, 334465, 334468, 162445, 326290, 342679, 342683, 260766, 342710, 244409, 260797, 260801, 350917, 154317, 391894, 154328, 416473, 64230, 113388, 342766, 375535, 203506, 342776, 391937, 391948, 375568, 326416, 375571, 375574, 162591, 326441, 383793, 326451, 326454, 260924, 375612, 244540, 326460, 326467, 244551, 326473, 326477, 416597, 326485, 326490, 342874, 326502, 375656, 433000, 326507, 326510, 211825, 211831, 351097, 392060, 359295, 351104, 342915, 400259, 236430, 342930, 252822, 392091, 400285, 252836, 359334, 211884, 400306, 351168, 359361, 359366, 326598, 359382, 359388, 383967, 343015, 359407, 261108, 244726, 261111, 383997, 261129, 261147, 359451, 211998, 261153, 261159, 359470, 359476, 343131, 384098, 384101, 367723, 384107, 187502, 343154, 384114, 212094, 351364, 384135, 384139, 384143, 351381, 384160, 384168, 367794, 384181, 367800, 351423, 384191, 384198, 326855, 244937, 253130, 343244, 146642, 359649, 343270, 351466, 351479, 384249, 343306, 261389, 359694, 384269, 253200, 261393, 384275, 245020, 245029, 171302, 351534, 376110, 245040, 384314, 425276, 212291, 384323, 343365, 212303, 367965, 343393, 343398, 367980, 425328, 343409, 253303, 154999, 343417, 327034, 245127, 384397, 245136, 245142, 245145, 343450, 245148, 245151, 245154, 245157, 245162, 327084, 359865, 384443, 146876, 327107, 384453, 327110, 327115, 327117, 359886, 359890, 343507, 368092, 343534, 343539, 368119, 343544, 368122, 409091, 359947, 359955, 359983, 343630, 179802, 155239, 327275, 245357, 138864, 155254, 155273, 368288, 245409, 425638, 425649, 155322, 425662, 155327, 155351, 155354, 212699, 155363, 245475, 155371, 245483, 409335, 155393, 155403, 155422, 360223, 155438, 155442, 155447, 417595, 360261, 155461, 376663, 155482, 261981, 425822, 376671, 155487, 155490, 155491, 327531, 261996, 376685, 261999, 262002, 327539, 147317, 262005, 425845, 262008, 262011, 155516, 155521, 155525, 360326, 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 ]
32b3eb85a6ca49b1b3533593ca2714c1b351d755
b82e84c949be24956c57b2cd75b54bdf791b910b
/Older/ActivityRingsContributingtoActivityRingsonAppleWatch/ActivityRings/AppDelegate.swift
1fa5cc03f362a04ad6843a4cde91123d6a8d1801
[]
no_license
silence0201/Apple-iOS-Demo
3936e3b2cb3d1e0a4768530152911eec3dd4d267
10c1a63668ea028e67dbf1a6b5aadb043a7165c6
refs/heads/master
2020-05-16T12:05:37.218108
2019-04-25T14:09:08
2019-04-25T14:09:08
183,035,958
2
0
null
null
null
null
UTF-8
Swift
false
false
874
swift
/* Copyright (C) 2015 Apple Inc. All Rights Reserved. See LICENSE.txt for this sample’s licensing information Abstract: The application delegate. */ import UIKit import HealthKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? let healthStore: HKHealthStore = HKHealthStore() func applicationShouldRequestHealthAuthorization(application: UIApplication) { healthStore.handleAuthorizationForExtensionWithCompletion { success, error in if let error = error where !success { print("You didn't allow HealthKit to access these read/write data types. In your app, try to handle this error gracefully when a user decides not to provide access. The error was: \(error.localizedDescription). If you're using a simulator, try it on a device.") } } } }
[ -1 ]
3e0a231e25cae2f80a31f25884ad37768e05219a
1a3e33e2d25eab23e8db1997e728652ee804906c
/ContainerCollectionExample/ViewControllers/StandaloneViewControllers/UIKitExamples/Image/ImageViewController.swift
2560c0b6c80914fa3428e4a19a972881ebb21b05
[ "MIT" ]
permissive
imanolache/ContainerCollection
d020d0ad4494fed27a554b59032af1bedf4513af
9c93141597f7f1f06a7005d015e663e306ea1e96
refs/heads/master
2023-06-17T09:20:51.768076
2019-12-17T08:47:55
2019-12-17T08:47:55
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,287
swift
// Copyright © 2019 We Are Mobile First. import ContainerCollection import UIKit struct ImageData: ComponentData, Equatable { enum Variant: String { case bottomDetail case sideDetail } let imageName: String let title: String let subTitle: String let variant: Variant } class ImageViewController: UIViewController { @IBOutlet private var imageView: UIImageView! @IBOutlet private var titleLabel: UILabel! @IBOutlet private var subtitleLabel: UILabel! var imageData: ImageData? { didSet { refreshView() } } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) refreshView() } deinit { NSLog("********** Deinitializing ViewController: \(self.self) **********") } private func refreshView() { guard isViewLoaded, let data = imageData else { return } imageView.image = UIImage(named: data.imageName) titleLabel.text = data.title subtitleLabel.text = data.subTitle } } extension ImageViewController: ConfigurableComponent { func configure(with data: ComponentData?) { guard let imageData = data as? ImageData, imageData != self.imageData else { return } self.imageData = imageData } }
[ -1 ]
8ef59cfaf5b19b857eb888710c409d0071b26163
f4a35d5d916a7a141f786f3ba080e76c8d5fdcd5
/Pods/MOLH/Sources/MOLH/MOLH.swift
07525127ed45499021eb3f62475b3917895f6e86
[ "MIT" ]
permissive
HalaMohammed1256/Medial-App
2bfd1b98dead8bbe099c57ad3bc7ff41a09b7fe9
da20a54eb8664192bb52750bcfd1cddad9699aee
refs/heads/main
2023-04-17T06:55:12.326047
2021-04-28T18:21:53
2021-04-28T18:21:53
356,553,602
1
0
null
null
null
null
UTF-8
Swift
false
false
16,938
swift
// Moath Othman // MIT license import Foundation import UIKit let viewkey = UnsafePointer<Any>(bitPattern: 64) protocol LayoutSwizzlable: NSObjectProtocol { func handleSwitching(forceSwitchingRegardlessOfTag: Bool) } protocol Taggable: NSObjectProtocol { var tag: Int {get set} } protocol TextAlignmented: NSObjectProtocol { var textAlignment: NSTextAlignment {get set} } extension LayoutSwizzlable where Self: TextAlignmented & Taggable { func handleSwitching(forceSwitchingRegardlessOfTag: Bool) { if self.tag < MOLH.shared.maximumLocalizableTag + 1 || forceSwitchingRegardlessOfTag , textAlignment != .center { if MOLHLanguage.isRTLLanguage() { if self.textAlignment == .right { return } self.textAlignment = .right } else { if self.textAlignment == .left { return } self.textAlignment = .left } } } } /// the type of text view , field , label typealias TextViewType = Taggable & LayoutSwizzlable & TextAlignmented /// Localize function public protocol MOLHLocalizable { func localize() } /// reset bundles public protocol MOLHResetable { func reset() } open class MOLHViewController : UIViewController { open override func viewDidLoad() { super.viewDidLoad() if self is MOLHLocalizable { (self as! MOLHLocalizable).localize() } } } open class MOLHTableViewController : UITableViewController { open override func viewDidLoad() { super.viewDidLoad() if self is MOLHLocalizable { (self as! MOLHLocalizable).localize() } } } open class MOLHView : UIView { open override func layoutSubviews() { super.layoutSubviews() if self is MOLHLocalizable { (self as! MOLHLocalizable).localize() } if self is MOLHFontable { (self as! MOLHFontable).updateFont() } } } open class MOLH { fileprivate struct Shared { static let shared = MOLH() } /// which bundle to fallback to if the current language has no bundle open var fallbackLocale = "Base" /// Prevent MOLH() fileprivate init() {} /// shared Instance , MOLH should be accessed through this shared public static let shared = Shared.shared /** @description * set the maximum tag where a UIView subclass Deemed Localizable * if view Tag property is bigger than this number the view will not be flipped */ open var maximumLocalizableTag: Int = -1 { didSet { assert(maximumLocalizableTag <= -1, "Tag should be less than or equal -1 , since 0 will corrupt UIKit-Made UIs e.g. UIAlertView/Share...") } } /** @description * set special keywords "Keys" that handled by external frameworks to be localized locally */ public var specialKeyWords: [String] = [] /** Activate Localization Helper **@param** swizzleExtensions Bool if you want to use run time swizzle with all Views like uilabel, default is false... **@note** swizzling extension could lead to issues if you are swizzling your UIViews **layoutSubviews** method from another place */ open func activate(_ swizzleExtensions: Bool = false) { swizzle(class: Bundle.self, sel: #selector(Bundle.localizedString(forKey:value:table:)), override: #selector(Bundle.specialLocalizedStringForKey(_:value:table:))) swizzle(class:UIApplication.self, sel: #selector(getter: UIApplication.userInterfaceLayoutDirection), override: #selector(getter: UIApplication.cstm_userInterfaceLayoutDirection)) if swizzleExtensions { swizzle(class:UIViewController.self, sel: #selector(UIViewController.viewDidLayoutSubviews), override: #selector(UIViewController.mirroringviewDidLoad)) swizzle(class:UIControl.self, sel: #selector(UIControl.awakeFromNib), override: #selector(UIControl.cstmlayoutSubviews)) swizzle(class:UITextField.self, sel: #selector(UITextField.layoutSubviews), override: #selector(UITextField.cstmlayoutSubviews)) swizzle(class:UITextView.self, sel: #selector(UITextView.layoutSubviews), override: #selector(UITextView.cstmlayoutSubviews)) swizzle(class:UILabel.self, sel: #selector(UILabel.layoutSubviews), override: #selector(UILabel.cstmlayoutSubviews)) } } /// Set Language , Language parameter string identify the language e.x. en, ar,fr ... open class func setLanguageTo(_ language: String) { MOLHLanguage.setAppleLAnguageTo(language) if MOLHLanguage.isRTLLanguage() { UIView.appearance().semanticContentAttribute = .forceRightToLeft UIButton.appearance().semanticContentAttribute = .forceRightToLeft UITextView.appearance().semanticContentAttribute = .forceRightToLeft UITextField.appearance().semanticContentAttribute = .forceRightToLeft UINavigationBar.appearance().semanticContentAttribute = .forceRightToLeft UITabBar.appearance().semanticContentAttribute = .forceRightToLeft UISearchBar.appearance().semanticContentAttribute = .forceRightToLeft UILabel.appearance().semanticContentAttribute = .forceRightToLeft } else { UIView.appearance().semanticContentAttribute = .forceLeftToRight UIButton.appearance().semanticContentAttribute = .forceLeftToRight UITextView.appearance().semanticContentAttribute = .forceLeftToRight UITextField.appearance().semanticContentAttribute = .forceLeftToRight UINavigationBar.appearance().semanticContentAttribute = .forceLeftToRight UITabBar.appearance().semanticContentAttribute = .forceLeftToRight UISearchBar.appearance().semanticContentAttribute = .forceLeftToRight UILabel.appearance().semanticContentAttribute = .forceLeftToRight } } /** reset app which will perform transition and call reset on appdelegate if it's MOLHResetable */ open class func reset(duration: Float = 0.5) { var transition = UIView.AnimationOptions.transitionFlipFromRight if !MOLHLanguage.isRTLLanguage() { transition = .transitionFlipFromLeft } reset(transition: transition, duration: duration) } open class func reset(transition: UIView.AnimationOptions, duration: Float = 0.5) { func resetWhenNoScenesAvailable() { if let delegate = UIApplication.shared.delegate { if delegate is MOLHResetable { (delegate as!MOLHResetable).reset() } UIView.transition(with: ((delegate.window)!)!, duration: TimeInterval(duration), options: transition, animations: {}) } } if #available(iOS 13.0, *) { if let window = UIApplication.shared.delegate?.window, window != nil { resetWhenNoScenesAvailable() } else { for scene in UIApplication.shared.connectedScenes { (scene.delegate as? MOLHResetable)?.reset() } } } else { resetWhenNoScenesAvailable() } } } extension UIApplication { @objc var cstm_userInterfaceLayoutDirection : UIUserInterfaceLayoutDirection { get { var direction = UIUserInterfaceLayoutDirection.leftToRight if MOLHLanguage.isRTLLanguage() { direction = .rightToLeft } return direction } } } extension Bundle { @objc func specialLocalizedStringForKey(_ key: String, value: String?, table tableName: String?) -> String { // check if its the main bundle then if the bundle of the current language is available // then try without locale // if not go back to base let translate = { (tableName: String?) -> String in let currentLanguage = MOLHLanguage.currentLocaleIdentifier() // with locale let languageWithoutLocale = MOLHLanguage.currentAppleLanguage() // without locale var bundle = Bundle(); // normal case where the lang with locale working if let _path = Bundle.main.path(forResource: currentLanguage, ofType: "lproj") { bundle = Bundle(path: _path)! } // en case when its working wihout locale else if let _path = Bundle.main.path(forResource: languageWithoutLocale, ofType: "lproj") { bundle = Bundle(path: _path)! } // current locale not exist , so we fallback else if let _path = Bundle.main.path(forResource: MOLH.shared.fallbackLocale, ofType: "lproj") { bundle = Bundle(path: _path)! } return (bundle.specialLocalizedStringForKey(key, value: value, table: tableName)) } // normal case if self == Bundle.main { return translate(tableName) } // case when the external frameworks has no locale proberty so you have to handle switching yourself else if MOLH.shared.specialKeyWords.contains(key) { return translate("Localizable") } // let the bundle handle the locale else { return (self.specialLocalizedStringForKey(key, value: value, table: tableName)) } } } extension UIImage { public func flippedImage() -> UIImage?{ if let _cgImag = self.cgImage { let flippedimg = UIImage(cgImage: _cgImag, scale:self.scale , orientation: UIImage.Orientation.upMirrored) return flippedimg } return nil } public func flipIfNeeded() -> UIImage? { if MOLHLanguage.isRTLLanguage() { return self.flippedImage() } return self } } extension UIViewController { @objc func mirroringviewDidLoad() { mirroringviewDidLoad() if UIApplication.shared.userInterfaceLayoutDirection == .rightToLeft { loopThroughSubViewAndFlipTheImageIfItsNeeded(self.view.subviews) } // Do any additional setup after loading the view. } /** Loop through subviews recursivley ,finding any image , uibutton image,uislider image that needs to be flipped , meaning its tagged less than maximumLocalizableTag and flip it @param the view subviews to start with. @note note that we suppose that the original is left to right image by default , an image is only flipped if the currentLanguage is right to left @return nothing */ func loopThroughSubViewAndFlipTheImageIfItsNeeded(_ subviews: [UIView]) { if subviews.count > 0 && MOLHLanguage.isRTLLanguage() { for subView in subviews where subView.tag <= MOLH.shared.maximumLocalizableTag { // Flip UIImageView if subView.isKind(of: UIImageView.self) { let toRightArrow = subView as! UIImageView toRightArrow.image = toRightArrow.image?.flipIfNeeded() } // Flip UISlider thumb image if subView.isKind(of: UISlider.self) { let toRightArrow = subView as! UISlider let _img = toRightArrow.thumbImage(for: UIControl.State()) let flipped = _img?.flipIfNeeded() toRightArrow.setThumbImage(flipped, for: UIControl.State()) toRightArrow.setThumbImage(flipped, for: .selected) toRightArrow.setThumbImage(flipped, for: .highlighted) } // Flip UIButton image if subView.isKind(of: UIButton.self) { let _subView = subView as! UIButton var image = _subView.image(for: UIControl.State()) image = image?.flippedImage() _subView.setImage(image, for: UIControl.State()) _subView.setImage(image, for: UIControl.State.selected) _subView.setImage(image, for: UIControl.State.highlighted) } loopThroughSubViewAndFlipTheImageIfItsNeeded(subView.subviews) } } } } // MARK : - Extensions extension UIControl { internal func handleControlSwitching(forceSwitchingRegardlessOfTag: Bool) { if self.tag < MOLH.shared.maximumLocalizableTag + 1 || forceSwitchingRegardlessOfTag { if MOLHLanguage.isRTLLanguage() { if self.contentHorizontalAlignment == .right { return } self.contentHorizontalAlignment = .right } else { if self.contentHorizontalAlignment == .left { return } self.contentHorizontalAlignment = .left } } } @objc public func cstmlayoutSubviews() { self.cstmlayoutSubviews() handleControlSwitching(forceSwitchingRegardlessOfTag: false) } } extension UITextField: TextViewType { public override func cstmlayoutSubviews() { self.cstmlayoutSubviews() handleSwitching(forceSwitchingRegardlessOfTag: false) handleControlSwitching(forceSwitchingRegardlessOfTag: false) } } extension UITextView: TextViewType { @objc public func cstmlayoutSubviews() { self.cstmlayoutSubviews() handleSwitching(forceSwitchingRegardlessOfTag: false) } } extension UILabel: TextViewType { @objc public func cstmlayoutSubviews() { self.cstmlayoutSubviews() handleSwitching(forceSwitchingRegardlessOfTag: false) } } // MARK: - SubClasses /** `MOLHControl is a UIControl Subclass` Any UIControl that wants to be localizable should be subclass of this class @auther Moath Othman */ open class MOLHControl: UIControl { open var forceSwitchingRegardlessOfTag: Bool = false { didSet { handleControlSwitching(forceSwitchingRegardlessOfTag: forceSwitchingRegardlessOfTag) } } override open func layoutSubviews() { super.layoutSubviews() handleControlSwitching(forceSwitchingRegardlessOfTag: forceSwitchingRegardlessOfTag) } } /** MOLHLabel is a UILabel Subclass Any Label that wants to be localizable should be subclass of this class§ @auther Moath Othman */ open class MOLHLabel: UILabel { open var forceSwitchingRegardlessOfTag: Bool = false { didSet { handleSwitching(forceSwitchingRegardlessOfTag: forceSwitchingRegardlessOfTag) } } override open func layoutSubviews() { super.layoutSubviews() handleSwitching(forceSwitchingRegardlessOfTag: forceSwitchingRegardlessOfTag) } } /** MOLHTextView is a UITextView Subclass Any TextView that wants to be localizable should be subclass of this class§ @auther Moath Othman */ open class MOLHTextView: UITextView { open var forceSwitchingRegardlessOfTag: Bool = false { didSet { handleSwitching(forceSwitchingRegardlessOfTag: forceSwitchingRegardlessOfTag) } } override open func layoutSubviews() { super.layoutSubviews() handleSwitching(forceSwitchingRegardlessOfTag: forceSwitchingRegardlessOfTag) } } /** MOLHTextField is a UITextField Subclass Any TextField that wants to be localizable should be subclass of this class§ @auther Moath Othman */ open class MOLHTextField: UITextField { open var forceSwitchingRegardlessOfTag: Bool = false { didSet { setupForLocalization() } } public override init(frame: CGRect) { super.init(frame: frame) setupForLocalization() } public required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) setupForLocalization() } func setupForLocalization() { handleControlSwitching(forceSwitchingRegardlessOfTag: forceSwitchingRegardlessOfTag) handleSwitching(forceSwitchingRegardlessOfTag: forceSwitchingRegardlessOfTag) } } // MARK: - Utility /// Exchange the implementation of two methods for the same Class override will replace sel private func swizzle(class cls: AnyClass, sel: Selector, override: Selector) { guard let origMethod: Method = class_getInstanceMethod(cls, sel) else { return } guard let overrideMethod: Method = class_getInstanceMethod(cls, override) else { return } if (class_addMethod(cls, sel, method_getImplementation(overrideMethod), method_getTypeEncoding(overrideMethod))) { class_replaceMethod(cls, override, method_getImplementation(origMethod), method_getTypeEncoding(origMethod)) } else { method_exchangeImplementations(origMethod, overrideMethod); } }
[ -1 ]