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
d2fdb3b58514177075cbc9eb2f88a7608e9729a0
f12e06d202a9743d4f121d1f77dafc8d5bc9da43
/Instagram/Controllers/Other/PostViewController.swift
b74e3a0d7c75ea1bc67774f52c5420cb04eaaa89
[]
no_license
olajideosho/iOSInstagramClone
96c61dc4b31a563c92b2a56ebb303fab32be1442
ad639c7055ec065f9d8e10d7ce77577434aa25e6
refs/heads/master
2023-06-12T17:24:35.384486
2021-06-23T08:03:12
2021-06-23T08:03:12
379,525,006
0
0
null
null
null
null
UTF-8
Swift
false
false
292
swift
// // PostViewController.swift // Instagram // // Created by Olajide Osho on 23/06/2021. // import UIKit class PostViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } }
[ -1 ]
cfc4b08c423b9c574133c3cb1c4e43e10f200a45
bdbb00bf73484dbc8edc537fdaa6089d817774ff
/GaryApp/ContentView.swift
6ba1df2da01e8aed8122faf7ae007d25b5c0d790
[]
no_license
jackmn/GaryApp
c58100989c0e899509d352360a091ddab5b8cf63
aa4f9aee63db67739da3187ee9218ad8eb8cbc55
refs/heads/master
2022-09-27T18:39:27.518192
2020-06-04T08:24:11
2020-06-04T08:24:11
269,303,048
0
0
null
null
null
null
UTF-8
Swift
false
false
372
swift
// // ContentView.swift // GaryApp // // Created by Jack Mac Namara on 04/06/2020. // Copyright © 2020 Jack Mac Namara. All rights reserved. // import SwiftUI struct ContentView: View { var body: some View { Text("Hello, World!") } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }
[ 369287, 126601, 343054, 108815, 108816, 256912, 108818, 347284, 386582, 357409, 252964, 153644, 378669, 372654, 372271, 180531, 375348, 337594, 384701, 372030, 214591, 349760, 374977, 147012, 420678, 204999, 356551, 272204, 345165, 353614, 357838, 391504, 212948, 379094, 352984, 398298, 260702, 379103, 345188, 168045, 207725, 66799, 369905, 162298, 360956, 377982 ]
2e80eec12ebeb8d1f7563dc7fc1b14b7fa48367e
caced9966e5fecc6c9723e6b7820bbe8d7408e18
/SwiftUIKit/Expand/Config/NetworkServiceConfig.swift
9e040e519b51eb4fb8ab179ffc973fb54b3e4a03
[]
no_license
destinyzhao/SwiftUIKit
0e0b1ca21120ad5064cfcd276002d6ef50c7fa11
43d6beafba758fc7f85c4c74f43cfe6e70a9437b
refs/heads/master
2021-05-11T23:06:26.268836
2018-01-29T09:37:04
2018-01-29T09:37:04
117,507,861
0
0
null
null
null
null
UTF-8
Swift
false
false
282
swift
// // NetworkServiceConfig.swift // SwiftUIKit // // Created by Destiny on 2018/1/16. // Copyright © 2018年 Destiny. All rights reserved. // import UIKit /// 服务器地址 let BASE_URL = "http://api.dantangapp.com/" // code 码 200 操作成功 let Network_success = 200
[ -1 ]
cfd683654cc3d7e8b9e9140f48f64c847fa912fd
9a1dbf29e34468431606c1309afb0e74440f08cb
/Pointters/Controllers/Explore/Service/OfferDetailViewController.swift
7a1dbe22574e9d163539cfdf0be5624b713eb0f5
[]
no_license
TalentDev0401/Pointters
f9510692095e91d57b6e0c8f91d9a2870099a8c5
661f0ef3e8101ef6ea36e8eca85f902df332e5e1
refs/heads/master
2022-11-23T19:57:40.933696
2020-08-02T13:59:27
2020-08-02T13:59:27
284,468,558
4
0
null
null
null
null
UTF-8
Swift
false
false
24,680
swift
// // OfferDetailViewController.swift // Pointters // // Created by super on 3/21/18. // Copyright © 2018 Kenji. All rights reserved. // import UIKit class OfferDetailViewController: UIViewController { @IBOutlet var consNavBarHeight: NSLayoutConstraint! @IBOutlet weak var mainTableView: UITableView! @IBOutlet weak var btnAccept: UIButton! var offerId = "" var offerFlag = 1 var offerDetailDic = [String:Any]() var loginUserId = "" var exploreVC: ExploreServiceViewController! override func viewDidLoad() { super.viewDidLoad() self.loginUserId = UserCache.sharedInstance.getAccountData().id initUI() } func initUI(){ if PointtersHelper.sharedInstance.checkiPhonX() { consNavBarHeight.constant = 80.0 } else { consNavBarHeight.constant = 64.0 } if (offerFlag == 1){ callGetOfferDetailAPI(offerId:offerId) } else { callGetRequestOfferDetailAPI(offerId:offerId) } } func disableAcceptButton() { self.btnAccept.setTitle("Closed", for: .normal) self.btnAccept.isUserInteractionEnabled = false if (self.exploreVC != nil) { self.exploreVC.selectedRequest = nil } } // *******************************************************// // MARK: - IBAction Method //v // *******************************************************// @IBAction func btnAcceptTapped(_ sender: Any) { let storyboard = UIStoryboard(name: "Explore", bundle: nil) let checkoutVC = storyboard.instantiateViewController(withIdentifier: "CheckoutVC") as! CheckoutViewController if let service = self.offerDetailDic["service"] as? [String:Any] { var services = service if let fulfillmentMethod = self.offerDetailDic["fulfillmentMethod"] as? [String:Any] { services["fulfillmentMethod"] = fulfillmentMethod } checkoutVC.isCustomOffer = true checkoutVC.arrAmount = [1] checkoutVC.serviceInfo = services var servicePrices: [String:Any] = [:] if service["price"] != nil { servicePrices = (service["price"] as? [String:Any])! } else if service["prices"] != nil { let prices: [[String:Any]] = service["prices"] as! [[String : Any]] servicePrices = prices[0] } if let offerPrice = self.offerDetailDic["price"] as? Float { servicePrices["customPrice"] = offerPrice } checkoutVC.servicePrices = [servicePrices] if let media = service["media"] as? [String:Any] { checkoutVC.serviceBgMedia = [media] } if let serviceId = self.offerDetailDic["serviceId"] { checkoutVC.serviceId = serviceId as! String } if let seller = self.offerDetailDic["seller"] { checkoutVC.serviceSeller = seller as! [String:Any] } } else { let service = self.offerDetailDic checkoutVC.isCustomOffer = true checkoutVC.arrAmount = [1] checkoutVC.serviceInfo = service var servicePrices: [String:Any] = [:] if service["prices"] != nil { let prices: [[String:Any]] = service["prices"] as! [[String : Any]] servicePrices = prices[0] } if let offerPrice = self.offerDetailDic["price"] as? Float { servicePrices["customPrice"] = offerPrice } checkoutVC.servicePrices = [servicePrices] if let media = service["media"] as? [String:Any] { checkoutVC.serviceBgMedia = [media] } if let serviceId = self.offerDetailDic["serviceId"] { checkoutVC.serviceId = serviceId as! String } if let seller = self.offerDetailDic["seller"] { checkoutVC.serviceSeller = seller as! [String:Any] } } if let customOfferId = self.offerDetailDic["_id"] as? String { checkoutVC.customOfferId = customOfferId } if let requestOfferId = self.offerDetailDic["offerId"] as? String { checkoutVC.requestOfferId = requestOfferId } if let offerDescription = self.offerDetailDic["description"] as? String { checkoutVC.customDescription = offerDescription } if let customDuration = self.offerDetailDic["workDuration"] as? NSNumber { checkoutVC.customDuration = customDuration.intValue } if let customDurationUnit = self.offerDetailDic["workDurationUom"] as? String { checkoutVC.customDurationUnit = customDurationUnit } checkoutVC.offerDetailVC = self navigationController?.pushViewController(checkoutVC, animated: true) } @IBAction func btnBackTapped(_ sender: Any) { navigationController?.popViewController(animated: true) } // move to profile page @objc func btnNameTapped(sender: UIButton) { if let strOtherId = self.offerDetailDic["sellerId"] as? String{ if strOtherId == self.loginUserId { UserCache.sharedInstance.setProfileUser(loginUser: true, userId: "") } else { UserCache.sharedInstance.setProfileUser(loginUser: false, userId: strOtherId) } let storyboard = UIStoryboard(name: "Account", bundle: nil) let userProfileVC = storyboard.instantiateViewController(withIdentifier: "UserProfileVC") as! UserProfileViewController navigationController?.pushViewController(userProfileVC, animated:true) } } @objc func btnChatTapped(sender: UIButton) { var userId = "" if let sellerId = self.offerDetailDic["sellerId"] as? String { userId = sellerId } if let seller = self.offerDetailDic["seller"] as? [String:Any]{ var sellerName = "" if let firstName = seller["firstName"] as? String { sellerName = firstName } if let lastName = seller["lastName"] as? String { sellerName = sellerName + " " + lastName } if let id = seller["id"] as? String { userId = id } let userName = sellerName var userPic = "" if let profilePic = seller["profilePic"] as? String { userPic = profilePic } UserCache.sharedInstance.setChatCredentials(id: "", userId: userId, name: userName, pic: userPic, verified: true) let storyboard = UIStoryboard(name: "Chats", bundle: nil) let privateChatVC = storyboard.instantiateViewController(withIdentifier: "PrivateChatVC") as! PrivateChatViewController privateChatVC.otherUserId = userId privateChatVC.otherUserPic = userPic privateChatVC.otherUsername = userName navigationController?.pushViewController(privateChatVC, animated:true) } } @objc func btnCallTapped(sender: UIButton) { PointtersHelper.sharedInstance.callByPhone(phone: "123456789", ctrl: self) } @objc func btnGetDirection(sender: UIButton) { if let itemLocation = self.offerDetailDic["location"] as? [String:Any] { let offerLocation = Location.init(dict: itemLocation) let getDirectionVC = storyboard?.instantiateViewController(withIdentifier: "GetDirectionVC") as! GetDirectionViewController getDirectionVC.serviceLocation = offerLocation navigationController?.pushViewController(getDirectionVC, animated: true) } } //*******************************************************// // MARK: - Call API Method // //*******************************************************// func callGetOfferDetailAPI(offerId: String) { PointtersHelper.sharedInstance.startLoader(view: view) ApiHandler.callGetOfferDetail(offerId: offerId, withCompletionHandler:{ (result,statusCode,response, error) in PointtersHelper.sharedInstance.stopLoader() if result == true { let responseDict = response.value as! [String:Any] if statusCode == 200 { self.offerDetailDic = responseDict["offer"] as! [String : Any] if let offerExpiresIn = self.offerDetailDic["expiresIn"] as? Int { if offerExpiresIn <= 0 { self.btnAccept.setTitle("Expired", for: .normal) self.btnAccept.isUserInteractionEnabled = false } else { self.btnAccept.setTitle("Accept", for: .normal) self.btnAccept.isUserInteractionEnabled = true } } if let closed = self.offerDetailDic["closed"] as? Bool { if closed { self.btnAccept.setTitle("Closed", for: .normal) self.btnAccept.isUserInteractionEnabled = false } else { self.btnAccept.setTitle("Accept", for: .normal) self.btnAccept.isUserInteractionEnabled = true } } if let strOtherId = self.offerDetailDic["sellerId"] as? String{ if strOtherId == self.loginUserId { self.btnAccept.isEnabled = false } } self.mainTableView.reloadData() } else { PointtersHelper.sharedInstance.showAlertViewWithTitle("", message: responseDict["message"] as! String, buttonTitles: ["OK"], viewController: self, completion: nil) } } else { PointtersHelper.sharedInstance.showAlertViewWithTitle("", message: error, buttonTitles: ["OK"], viewController: self, completion: { (type) in self.navigationController?.popViewController(animated: true) }) } }) } func callGetRequestOfferDetailAPI(offerId: String) { PointtersHelper.sharedInstance.startLoader(view: view) ApiHandler.callGetRequestOfferDetail(offerId: offerId, withCompletionHandler:{ (result,statusCode,response, error) in PointtersHelper.sharedInstance.stopLoader() if result == true { let responseDict = response.value as! [String:Any] if statusCode == 200 { self.offerDetailDic = responseDict if let offerExpiresIn = self.offerDetailDic["expiresIn"] as? Int { if offerExpiresIn <= 0 { self.btnAccept.setTitle("Expired", for: .normal) self.btnAccept.isUserInteractionEnabled = false } else { self.btnAccept.setTitle("Accept", for: .normal) self.btnAccept.isUserInteractionEnabled = true } } if let closed = self.offerDetailDic["closed"] as? Bool { if closed { self.btnAccept.setTitle("Closed", for: .normal) self.btnAccept.isUserInteractionEnabled = false } else { self.btnAccept.setTitle("Accept", for: .normal) self.btnAccept.isUserInteractionEnabled = true } } self.mainTableView.reloadData() } else { PointtersHelper.sharedInstance.showAlertViewWithTitle("", message: responseDict["message"] as! String, buttonTitles: ["OK"], viewController: self, completion: nil) } } else { PointtersHelper.sharedInstance.showAlertViewWithTitle("", message: error, buttonTitles: ["OK"], viewController: self, completion: { (type) in self.navigationController?.popViewController(animated: true) }) } }) } } extension OfferDetailViewController : UITableViewDataSource, UITableViewDelegate { func numberOfSections(in tableView: UITableView) -> Int { return 6 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 1 } func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { switch section { case 0: return 28.0 case 1: if self.offerDetailDic.keys.contains("service") { return 40.0 }else{ return 0.0 } case 2: return 40.0 case 5: return 40.0 default: return 0.0 } } func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { if section == 5 { return 10.0 } else { return 0.0 } } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { switch indexPath.section { case 0: return 75.0 case 1: if self.offerDetailDic.keys.contains("service") { return 100.0 }else{ return 0.0 } case 2: return 90.0 case 3: return 50.0 case 4: return 50.0 case 5: return 280.0 default: return 0.0 } } func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { let footerView = UIView() footerView.backgroundColor = UIColor.clear return footerView } func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let headerView = UIView() headerView.backgroundColor = UIColor.groupTableViewBackground if section != 0 && section != 3 && section != 4{ let headerLabel = UILabel(frame: CGRect(x: 15, y: 20, width: tableView.bounds.size.width - 30, height: 20)) headerLabel.font = UIFont(name: "Helvetica", size: 14) headerLabel.textColor = UIColor.getCustomGrayTextColor() if section == 1 { headerLabel.text = "LINKED SERVICE" } else if section == 2 { headerLabel.text = "OFFER DESCRIPTION" } else { headerLabel.text = "DELIVERY METHOD" } headerLabel.sizeToFit() headerView.addSubview(headerLabel) } else if section == 0 { let headerLabel = UILabel(frame: CGRect(x: 15, y: 8, width: tableView.bounds.size.width - 30, height: 20)) headerLabel.font = UIFont(name: "Helvetica", size: 14) headerLabel.textColor = UIColor.getCustomGrayTextColor() headerLabel.text = "SELLER" headerLabel.sizeToFit() headerView.addSubview(headerLabel) } return headerView } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if indexPath.section == 0 { let cell = tableView.dequeueReusableCell(withIdentifier: "userCell", for: indexPath) as! ProfileCell if let seller = self.offerDetailDic["seller"] as? [String:Any]{ if let profilePic = seller["profilePic"] as? String { cell.imgUser.sd_imageTransition = .fade cell.imgUser.sd_setImage(with: URL(string: profilePic.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!), placeholderImage: UIImage(named:"user_avatar_placeholder")) cell.imgUser.layer.cornerRadius = cell.imgUser.frame.size.width/2 } var sellerName = "" if let firstName = seller["firstName"] as? String { sellerName = firstName } if let lastName = seller["lastName"] as? String { sellerName = sellerName + " " + lastName } cell.lblName.text = sellerName let tapGesture = UITapGestureRecognizer(target: self, action: #selector(btnNameTapped(sender:))) cell.lblName.addGestureRecognizer(tapGesture) cell.lblName.isUserInteractionEnabled = true let tapGesture1 = UITapGestureRecognizer(target: self, action: #selector(btnNameTapped(sender:))) cell.imgUser.addGestureRecognizer(tapGesture1) cell.imgUser.isUserInteractionEnabled = true cell.btnChat.addTarget(self, action: #selector(btnChatTapped(sender:)), for: .touchUpInside) cell.btnCall.addTarget(self, action: #selector(btnCallTapped(sender:)), for: .touchUpInside) } return cell }else if indexPath.section == 1 { let cell = tableView.dequeueReusableCell(withIdentifier: "serviceCell", for: indexPath) as! ProfileCell if let service = self.offerDetailDic["service"] as? [String:Any] { let offerService = Service.init(dict: service) cell.imgService.sd_imageTransition = .fade cell.imgService.sd_setImage(with: URL(string: offerService.media.fileName.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!), placeholderImage: UIImage(named:"photo_placeholder")) cell.imgService.layer.cornerRadius = 5.0 cell.lblServiceDesc.text = offerService.tagline cell.lblServicePrice.text = offerService.prices.currencySymbol + String(format: "%.2f", offerService.prices.price) cell.lblServiceTime.text = "Per \(offerService.prices.time)" + offerService.prices.timeUnitOfMeasure // missing "seller" vaule, will not set seller name if let seller = self.offerDetailDic["seller"] as? [String:Any]{ var sellerName = "" if let firstName = seller["firstName"] as? String { sellerName = firstName } if let lastName = seller["lastName"] as? String { sellerName = sellerName + " " + lastName } cell.btnSellerName.setTitle(sellerName, for: .normal) cell.btnSellerName.addTarget(self, action: #selector(btnNameTapped(sender:)), for: .touchUpInside) } } return cell }else if indexPath.section == 2 { let cell = tableView.dequeueReusableCell(withIdentifier: "descCell", for: indexPath) as! ProfileCell if let offerDesc = self.offerDetailDic["description"] as? String { cell.lblDesc.text = offerDesc } return cell }else if indexPath.section == 3 { let cell = tableView.dequeueReusableCell(withIdentifier: "priceCell", for: indexPath) as! ServiceDetailCell if let offerPrice = self.offerDetailDic["price"] as? Float { cell.lblPrice.text = "$" + String(format:"%.2f", offerPrice) } return cell }else if indexPath.section == 4 { let cell = tableView.dequeueReusableCell(withIdentifier: "timeCell", for: indexPath) as! ServiceDetailCell if let duration = self.offerDetailDic["workDuration"] as? Int, let durationUnit = self.offerDetailDic["workDurationUom"] as? String { let strTime = String(format:"%d", duration) + " " + durationUnit.capitalizingFirstLetter() cell.lblDeliveryTime.text = (duration > 1) ? strTime + "s" : strTime } return cell }else { let cell = tableView.dequeueReusableCell(withIdentifier: "deliveryCell", for: indexPath) as! ServiceDetailCell if let itemLocation = self.offerDetailDic["location"] as? [String:Any] { let offerLocation = Location.init(dict: itemLocation) if let fulfillmentMethod = self.offerDetailDic["fulfillmentMethod"] as? [String:Any] { let offerFulfillment = FulFillment.init(dict: fulfillmentMethod) if offerFulfillment.local == true { cell.isLocalService = true cell.localRadius = offerFulfillment.localServiceRadius } else { cell.isLocalService = false cell.localRadius = 15 } // missing "geolocation" value, will crash if you uncomment this cell.showLocation(lat: offerLocation.geoJson.coordinates[1], lng: offerLocation.geoJson.coordinates[0]) var fulfillmentString = "" if offerFulfillment.online{ fulfillmentString.append("Servicing Online") } if offerFulfillment.local{ if fulfillmentString != ""{ fulfillmentString.append(", Servicing Locally Within \(offerFulfillment.localServiceRadius) Miles") } else { fulfillmentString.append("Servicing Locally Within 15 Miles") } } if offerFulfillment.store { if fulfillmentString != ""{ fulfillmentString.append(", Service Locally at Store Locations") } else { fulfillmentString.append("Service Locally at Store Locations") } } if offerFulfillment.shipment{ if fulfillmentString != ""{ fulfillmentString.append(", Shipment") } else { fulfillmentString.append("Shipment") } } cell.lblFulfillment.text = fulfillmentString } cell.btnGetDirections.addTarget(self, action: #selector(btnGetDirection(sender:)), for: .touchUpInside) } return cell } } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if indexPath.section == 0 { if let strOtherId = self.offerDetailDic["sellerId"] as? String{ if strOtherId == self.loginUserId { UserCache.sharedInstance.setProfileUser(loginUser: true, userId: "") } else { UserCache.sharedInstance.setProfileUser(loginUser: false, userId: strOtherId) } let storyboard = UIStoryboard(name: "Account", bundle: nil) let userProfileVC = storyboard.instantiateViewController(withIdentifier: "UserProfileVC") as! UserProfileViewController navigationController?.pushViewController(userProfileVC, animated:true) } } else if indexPath.section == 1 { if let service = self.offerDetailDic["service"] as? [String:Any] { let offerService = Service.init(dict: service) let storyboard = UIStoryboard.init(name: "Explore", bundle: nil) let serviceDetailVC = storyboard.instantiateViewController(withIdentifier: "ServiceDetailVC") as! ServiceDetailViewController if let serviceId = self.offerDetailDic["serviceId"] { serviceDetailVC.serviceId = serviceId as! String } else { serviceDetailVC.serviceId = offerService.id } navigationController?.pushViewController(serviceDetailVC, animated:true) } } } }
[ -1 ]
51f0a61c95c31279a9aaeb096be06e9c52a2b5f4
8efe63325035c806a579f9c30254c06a33dc5cc5
/patient/Class/Network/ExamApi.swift
470eab488e2e1e3ffff33d589c14b12a13bc0a12
[]
no_license
lixiangzhou/ygxq_patient
c33e017f20578d85035b44cd3077788470926130
6e9d4d888293eb54464c524500c2ec57de874532
refs/heads/master
2020-06-04T06:28:59.349631
2019-10-29T05:28:43
2019-10-29T05:28:43
191,903,608
0
0
null
null
null
null
UTF-8
Swift
false
false
820
swift
// // ExamApi.swift // patient // // Created by Macbook Pro on 2019/6/21. // Copyright © 2019 sphr. All rights reserved. // import Foundation import Moya enum ExamApi: TargetType { case examList(pid: Int) case listSerExamById(ids: [Int]) } extension ExamApi { var path: String { switch self { case .examList: return "/exam/queryExamsByPuid" case .listSerExamById: return "/exam/listSerExamById" } } var task: Task { var params = [String: Any]() switch self { case let .examList(pid: pid): params["puid"] = pid case let .listSerExamById(ids: ids): params["examIds"] = ids } return .requestParameters(parameters: params, encoding: JSONEncoding.default) } }
[ -1 ]
8f73bf9ec8bff697dcea758a55422e18e10dae42
db2635b8a6d0ba9c08bd5470cc9212b885d9251f
/DownloadCount/AddViewController.swift
e70c2c40efd545e76af78d51cbeee52dff817761
[]
no_license
JTExperiments/DownloadCount
2f7f09541646e7953beecbd6dbb3095bef952f9e
2b5b9252f8645c3f5a201e4299bcf8f15379e911
refs/heads/master
2020-04-09T14:59:11.427482
2015-08-03T04:46:25
2015-08-03T04:46:25
40,057,902
0
0
null
null
null
null
UTF-8
Swift
false
false
922
swift
// // AddViewController.swift // DownloadCount // // Created by James Tang on 3/8/15. // Copyright © 2015 James Tang. All rights reserved. // import UIKit import DownloadCountShared class AddViewController: UIViewController, AddViewInterface { // MARK: - Property var presenter: AddPresenter? = nil @IBOutlet weak var ownerTextField: UITextField! @IBOutlet weak var repositoryNameTextField: UITextField! // MARK: - Life cycle override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } @IBAction func cancelButtonDidPress(sender: AnyObject) { self.presenter?.cancelAddSource() } @IBAction func doneButtonDidPress(sender: AnyObject) { let owner = self.ownerTextField.text ?? "" let name = self.repositoryNameTextField.text ?? "" self.presenter?.add(owner, repository: name) } }
[ -1 ]
eefa59da0bc8ba28533a7ead6d18bfe0d1c1cbe2
7a7912f26177465f3d851c5fa127e93679978f9b
/BullsEye/AboutMeViewController.swift
27744de494620885d1b2113b5aa5db5079eb80ed
[]
no_license
rahul-lohra/BullsEye
0b7e91d4e6f7123d2bc58c5b3c8ab63629eb44c4
22cf5ccfeebbbe9a9a0939d7f457f2ae3c57d40e
refs/heads/master
2021-08-17T01:55:56.544231
2017-11-20T17:01:58
2017-11-20T17:01:58
null
0
0
null
null
null
null
UTF-8
Swift
false
false
974
swift
// // AboutMeViewController.swift // BullsEye // // Created by Rahul Lohra on 18/11/17. // Copyright © 2017 Rahul Lohra. All rights reserved. // import UIKit class AboutMeViewController: UIViewController { @IBAction func closeTapped(_ sender: Any) { dismiss(animated: true, completion: nil) } 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. } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. } */ }
[ -1 ]
cebb2a58fbeb8b7d1179f59ecc3ac3e6628e72d0
347b0fa5ff8ad78aae98f5c809bde3151f8af4c4
/laborator2/PostsViewController.swift
c077445ea7155f2b1b4b0b4480bf61e6e5b254b5
[]
no_license
Retroshock/laborator2
5ff413e579df53abdb32798fc446a908a4d90db9
f269c2c7803751026ba8cef0e83032f7c3bbafc8
refs/heads/master
2020-04-28T12:07:56.216366
2019-03-12T17:39:51
2019-03-12T17:39:51
175,265,562
0
0
null
null
null
null
UTF-8
Swift
false
false
2,897
swift
// // ViewController.swift // laborator2 // // Created by Adrian Popovici on 12/03/2019. // Copyright © 2019 laborator. All rights reserved. // import UIKit class PostsViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { @IBOutlet weak var postsTableView: UITableView! var models: [PostModel] = [] override func viewDidLoad() { super.viewDidLoad() // Setup the url let url = URL(string: "https://jsonplaceholder.typicode.com/posts")! // Setup the URL Request as a MutableURLRequest. We can modify the parameters after the fact (e.g. httpMethod) let request = NSMutableURLRequest(url: url, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) // Setting up the parameters here: request.httpMethod = "GET" // request.allHTTPHeaderFields = ["headerField": "Value"] // getting the shared URLSession let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest) { (data, response, error) -> Void in if let error = error { print("Error occured: \(error.localizedDescription)") } else { let httpResponse = response as! HTTPURLResponse switch httpResponse.statusCode { case 200: do { guard let data = data else { return } guard let values = try JSONSerialization.jsonObject(with: data, options: []) as? NSArray else { return } let stringValues = values.map { ($0 as! String) } // NOT WORKING let decodedValues = try stringValues.map { try JSONDecoder().decode(PostModel.self, from: $0.data(using: .utf8)!) } self.models = decodedValues } catch { print("Serialization error" ) } default: print("Received status code: \(httpResponse.statusCode)") } } } dataTask.resume() } func updateTableView() { DispatchQueue.main.async { self.postsTableView.reloadData() } } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 80 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "PostsTableViewCell") as! PostsTableViewCell cell.configure(withModel: models[indexPath.row]) return cell } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return models.count } }
[ -1 ]
33468898c05efd9ebdc942d0636e06e42e6e8bf2
e705bd770e422ff22a3f44257f7a5a07ede97af0
/Pappaya/Pappaya/Controller/Landing/MyTimesheetViewController.swift
0f133c0685d5a9a7fba437d469e2d773bbe1da20
[]
no_license
T42Mobile/Pappaya-iOS
a7c51520bc8f5d2879d35610ade6e3b73df0a97d
ec42502bde5a969a1276929f43876519855e3ab5
refs/heads/master
2020-06-18T04:58:54.210200
2017-01-09T10:11:07
2017-01-09T10:11:07
74,947,012
0
0
null
null
null
null
UTF-8
Swift
false
false
3,058
swift
// // MyTimesheetViewController.swift // Pappaya // // Created by Thirumal on 02/12/16. // Copyright © 2016 Think42labs. All rights reserved. // import UIKit class MyTimesheetViewController: SlideDelegateViewController, UITableViewDelegate, UITableViewDataSource { //MARK:- Variables //MARK:-- Outlet @IBOutlet weak var tableView : UITableView! @IBOutlet weak var emptyStateView: UIView! //MARK:-- Class var timeSheetArray : [TimeSheetListModel] = [] override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. self.tableView.estimatedRowHeight = 200 } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } override func viewWillAppear(_ animated: Bool) { self.timeSheetArray = TimeSheetBL.sharedInstance.getMyTimeSheetList() self.tableView.reloadData() } //MARK:- Table view func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { if timeSheetArray.count > 0 { self.emptyStateView.isHidden = true } else { self.emptyStateView.isHidden = false } return timeSheetArray.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: Constants.TableViewCellIdentifier.TimeSheetListCell, for: indexPath) as! TimesheetListTableViewCell let timeSheetDetail = timeSheetArray[indexPath.row] cell.periodLabel.attributedText = getDisplayDate(fromDate: timeSheetDetail.fromDateObject, toDate: timeSheetDetail.toDateObject) cell.totalHoursLabel.text = String(timeSheetDetail.totalHoursWorked) + " Hrs" cell.projectNameLabel.text = timeSheetDetail.listOfProjectName cell.setStatusImage(status: timeSheetDetail.status) return cell } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return UITableViewAutomaticDimension } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let timeSheetDetail = timeSheetArray[indexPath.row] let timeSheetDetailVC = getViewControllerWithIdentifier(identifier : Constants.ViewControllerIdentifiers.TimeSheetDetailViewController) as! TimeSheetDetailViewController timeSheetDetailVC.timeSheetDetail = timeSheetDetail timeSheetDetailVC.timeSheetDateList = TimeSheetBL.sharedInstance.getTimeSheetDateListForTimeSheetId(timeSheetId: timeSheetDetail.timeSheetId) getAppDelegate().rootNavigationController.pushViewController(timeSheetDetailVC, animated: true) } }
[ -1 ]
07766a5c888c8e8f9c7c861dd719c29e85e529e6
3b14215c60505e795e5cffdd1560098c111ef53e
/Package.swift
c82486644d832d8764ad817591c61c30961fd4a7
[ "MIT" ]
permissive
OhKanghoon/Pure
50b5b719e075a0e8da5a319abbb7528d7c2fb467
9224f967485237ef2210782c361d07672af91245
refs/heads/master
2021-11-24T02:34:00.603472
2020-12-09T07:21:37
2021-10-24T14:10:06
null
0
0
null
null
null
null
UTF-8
Swift
false
false
834
swift
// swift-tools-version:5.3 import PackageDescription let package = Package( name: "Pure", platforms: [ .macOS(.v10_10), .iOS(.v9), .tvOS(.v9), .watchOS(.v2) ], products: [.library(name: "Pure", targets: ["Pure"])], dependencies: [ .package(url: "https://github.com/Quick/Quick.git", .upToNextMajor(from: "4.0.0")), .package(url: "https://github.com/Quick/Nimble.git", .upToNextMajor(from: "9.2.0")), ], targets: [ .target(name: "Pure", dependencies: []), .target(name: "PureStub", dependencies: ["Pure"]), .target(name: "TestSupport", dependencies: ["Pure"]), .testTarget(name: "PureTests", dependencies: ["Pure", "TestSupport", "Quick", "Nimble"]), .testTarget(name: "PureStubTests", dependencies: ["PureStub", "TestSupport", "Quick", "Nimble"]), ], swiftLanguageVersions: [.v5] )
[ -1 ]
564b4cda0de851496bbbc132b1574bccff4a49dc
a3c094c3baa3d9352f8fca458af2d525984dc308
/Xcode Project/Facesynth/FaceTutorialViewController.swift
46c5434f865ef180f1807143b0236255099c617e
[]
no_license
dkun7944/facesynth-ios
a888b2b4d013da8d03fcb6f6cd46f1b699c38345
9391df3e2284646ca7f0d2910da6f6ed27503b5f
refs/heads/master
2021-09-13T22:13:02.457321
2018-05-04T22:36:48
2018-05-04T22:36:48
86,920,702
4
0
null
null
null
null
UTF-8
Swift
false
false
1,206
swift
// // FaceTutorialViewController.swift // Facesynth // // Created by Daniel Kuntz on 12/24/17. // Copyright © 2017 Daniel Kuntz. All rights reserved. // import UIKit class FaceTutorialViewController: UIViewController { // MARK: - Outlets @IBOutlet weak var faceImage: UIImageView! // MARK: - Variables var faceNumber: Int = 3 var increasing: Bool = true var range: ClosedRange<Int> = 1...6 // MARK: - Setup Views override func viewDidLoad() { super.viewDidLoad() changeFace() } func changeFace() { let image = UIImage(named: "face_\(faceNumber)") faceImage.image = image faceNumber += increasing ? 1 : -1 if faceNumber == range.upperBound { increasing = false } else if faceNumber == range.lowerBound { increasing = true } DispatchQueue.main.asyncAfter(deadline: .now() + 0.4, execute: { self.changeFace() }) } // MARK: - Actions @IBAction func gotItPressed(_ sender: Any) { UserDefaults.standard.sawTutorial() dismiss(animated: true, completion: nil) } }
[ -1 ]
ea8c0c5303b133990a42df94c2c710aeed7705c0
18c46febf7816faeebb765ffd8b3449327e8350e
/I Am Poor/I Am Poor/AppDelegate.swift
c6e12c1a917d995eafa8a410e21e734c24c870ff
[]
no_license
tnak1126/IamPoorSwift
7bbf309f12140c020cd8402a5f815ad51eebd999
75ffe751276e26918b4090295e52e1b5a5c661ca
refs/heads/master
2022-12-08T14:12:21.486533
2020-09-09T15:32:10
2020-09-09T15:32:10
294,154,224
0
0
null
null
null
null
UTF-8
Swift
false
false
1,406
swift
// // AppDelegate.swift // I Am Poor // // Created by home iMac on 5/5/20. // Copyright © 2020 tnak. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } // MARK: UISceneSession Lifecycle func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { // Called when a new scene session is being created. // Use this method to select a configuration to create the new scene with. return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) } func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) { // Called when the user discards a scene session. // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. // Use this method to release any resources that were specific to the discarded scenes, as they will not return. } }
[ 393222, 393224, 393230, 393250, 344102, 393261, 393266, 163891, 213048, 376889, 385081, 393275, 376905, 327756, 254030, 286800, 368727, 180313, 368735, 180320, 376931, 286831, 368752, 286844, 417924, 262283, 286879, 286888, 377012, 327871, 180416, 377036, 180431, 377046, 377060, 327914, 205036, 393456, 393460, 418043, 336123, 385280, 336128, 262404, 180490, 368911, 262416, 262422, 377117, 262436, 336180, 262454, 393538, 262472, 344403, 213332, 65880, 262496, 418144, 262499, 213352, 246123, 262507, 262510, 213372, 385419, 393612, 262550, 262552, 385440, 385443, 385451, 262573, 393647, 385458, 262586, 344511, 262592, 360916, 369118, 328177, 328179, 328182, 328189, 328192, 164361, 328206, 410128, 393747, 254490, 188958, 385570, 33316, 377383, 197159, 352821, 188987, 418363, 369223, 385609, 385616, 352856, 352864, 369253, 262760, 352874, 352887, 254587, 377472, 148105, 377484, 352918, 98968, 344744, 361129, 336555, 385713, 434867, 164534, 336567, 328378, 164538, 328386, 352968, 344776, 352971, 418507, 352973, 385742, 385748, 361179, 189153, 369381, 361195, 418553, 344831, 336643, 344835, 344841, 361230, 336659, 418580, 418585, 434970, 369435, 418589, 262942, 418593, 336675, 328484, 418598, 418605, 336696, 361273, 328515, 336708, 328519, 336711, 361288, 328522, 336714, 426841, 254812, 361309, 197468, 361315, 361322, 328573, 377729, 369542, 222128, 345035, 386003, 345043, 386011, 386018, 386022, 435187, 328702, 328714, 361489, 386069, 336921, 386073, 336925, 345118, 377887, 345133, 345138, 386101, 361536, 197707, 189520, 345169, 156761, 361567, 148578, 345199, 386167, 361593, 410745, 214149, 345222, 386186, 337047, 345246, 214175, 337071, 337075, 345267, 386258, 328924, 66782, 222437, 328941, 386285, 386291, 345376, 353570, 345379, 410917, 345382, 345399, 378169, 369978, 337222, 337229, 337234, 263508, 402791, 345448, 271730, 378227, 271745, 181638, 353673, 181643, 181649, 181654, 230809, 181670, 181673, 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, 345701, 394853, 222830, 370297, 353919, 403075, 198280, 345736, 403091, 345749, 345757, 345762, 419491, 345765, 419497, 419501, 370350, 419506, 419509, 419512, 337592, 419517, 337599, 419527, 419530, 419535, 272081, 419542, 394966, 419544, 181977, 345818, 419547, 419550, 419559, 337642, 419563, 337645, 370415, 337659, 141051, 337668, 362247, 395021, 362255, 321299, 116509, 345887, 378663, 345905, 354106, 354111, 247617, 354117, 370503, 329544, 370509, 354130, 247637, 337750, 370519, 313180, 354142, 345964, 345967, 345970, 345974, 403320, 354172, 247691, 337808, 247700, 329623, 436126, 436132, 337833, 362413, 337844, 346057, 247759, 346063, 329697, 354277, 190439, 247789, 354313, 346139, 436289, 378954, 395339, 338004, 100453, 329832, 329855, 329867, 329885, 411805, 346272, 362660, 100524, 387249, 379066, 387260, 256191, 395466, 346316, 411861, 411864, 411868, 411873, 379107, 411876, 387301, 346343, 338152, 387306, 387312, 346355, 436473, 321786, 379134, 411903, 379152, 395538, 387349, 338199, 387352, 182558, 338211, 395566, 248111, 362822, 436555, 190796, 321879, 379233, 354673, 321910, 248186, 420236, 379278, 272786, 354727, 338352, 330189, 338381, 338386, 256472, 338403, 338409, 248308, 199164, 330252, 199186, 330267, 354855, 10828, 199249, 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, 355175, 387944, 355179, 330610, 330642, 355218, 412599, 207808, 379848, 396245, 248792, 248798, 347105, 257008, 183282, 265207, 330748, 265214, 330760, 330768, 248862, 396328, 158761, 199728, 330800, 396336, 396339, 339001, 388154, 388161, 347205, 248904, 330826, 248914, 339036, 412764, 257120, 265320, 248951, 420984, 330889, 347287, 248985, 339097, 44197, 380070, 339112, 249014, 126144, 330958, 330965, 265432, 388319, 388347, 175375, 159005, 175396, 208166, 273708, 372015, 347441, 372018, 199988, 44342, 175415, 396600, 437566, 175423, 437570, 437575, 437583, 331088, 437587, 331093, 396633, 175450, 437595, 175457, 208227, 175460, 175463, 265580, 437620, 175477, 249208, 175483, 175486, 249214, 175489, 249218, 249227, 249234, 175513, 175516, 396705, 175522, 355748, 380332, 396722, 208311, 372163, 216517, 380360, 216522, 339404, 372176, 208337, 339412, 413141, 339417, 249308, 339420, 339424, 339428, 339434, 249328, 69113, 372228, 208398, 380432, 175635, 339503, 265778, 265795, 396872, 265805, 224853, 224857, 257633, 224870, 372327, 257646, 372337, 224884, 224887, 224890, 224894, 224897, 372353, 216707, 126596, 339588, 421508, 224904, 224909, 11918, 159374, 224913, 126610, 339601, 224916, 224919, 126616, 224922, 208538, 224926, 224929, 224932, 224936, 257704, 224942, 257712, 224947, 257716, 257720, 224953, 257724, 224959, 257732, 224965, 224969, 339662, 224975, 257747, 224981, 224986, 257761, 224993, 257764, 224999, 339695, 225012, 257787, 225020, 339710, 257790, 225025, 257794, 339721, 257801, 257804, 225038, 257807, 225043, 372499, 167700, 225048, 257819, 225053, 184094, 225058, 339747, 339749, 257833, 225066, 257836, 413484, 225070, 225073, 372532, 257845, 225079, 397112, 225082, 397115, 225087, 225092, 225096, 323402, 257868, 225103, 257871, 397139, 225108, 225112, 257883, 257886, 225119, 257890, 339814, 225127, 257896, 274280, 257901, 225137, 339826, 257908, 225141, 257912, 257916, 225148, 257920, 225155, 339844, 225165, 397200, 225170, 380822, 225175, 225180, 118691, 184244, 372664, 372702, 372706, 356335, 380918, 405533, 430129, 266294, 266297, 217157, 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, 389380, 61722, 356637, 356640, 356643, 356646, 266536, 356649, 356655, 332080, 340275, 356660, 397622, 332090, 225597, 332097, 201028, 348488, 332106, 332117, 250199, 250202, 332125, 250210, 348525, 332152, 389502, 250238, 332161, 356740, 332172, 373145, 340379, 389550, 324030, 266687, 160234, 127471, 340472, 324094, 266754, 324099, 324102, 324111, 340500, 324117, 324131, 332324, 381481, 324139, 356907, 324142, 356916, 324149, 324155, 348733, 324160, 324164, 356934, 348743, 381512, 324170, 324173, 324176, 389723, 332380, 381545, 340627, 184982, 373398, 258721, 332453, 332459, 389805, 332463, 381617, 332471, 332483, 332486, 373449, 332493, 357069, 357073, 332511, 332520, 340718, 332533, 348924, 389892, 389926, 152370, 348978, 340789, 348982, 398139, 127814, 357206, 389978, 430939, 357211, 357214, 201579, 201582, 349040, 340849, 201588, 430965, 324472, 398201, 340858, 324475, 430972, 340861, 324478, 119674, 324481, 373634, 398211, 324484, 324487, 381833, 324492, 324495, 324498, 430995, 324501, 324510, 422816, 324513, 398245, 201637, 324524, 340909, 324533, 5046, 324538, 324541, 398279, 340939, 340941, 209873, 340957, 431072, 398306, 340963, 209895, 201711, 349172, 349180, 439294, 431106, 209943, 250914, 357410, 185380, 357418, 209965, 209968, 209971, 209975, 209979, 209987, 209990, 341071, 349267, 250967, 210010, 341091, 210025, 210027, 210030, 210036, 210039, 349308, 210044, 349311, 152703, 160895, 210052, 349319, 210055, 210067, 210071, 210077, 210080, 251044, 210084, 185511, 210088, 210095, 210098, 210107, 210115, 332997, 210127, 333009, 210131, 333014, 210138, 210143, 218354, 218360, 251128, 275706, 275712, 275715, 275721, 349459, 333078, 251160, 349484, 349491, 251189, 415033, 251210, 357708, 210260, 365911, 259421, 365921, 333154, 251235, 374117, 333162, 234866, 390516, 333175, 357755, 251271, 136590, 112020, 349590, 357792, 259515, 415166, 415185, 366034, 366038, 415191, 415193, 415196, 415199, 423392, 333284, 415207, 366056, 366061, 415216, 210420, 415224, 423423, 415257, 415263, 366117, 415270, 144939, 415278, 415281, 415285, 210487, 415290, 415293, 349761, 415300, 333386, 333399, 366172, 333413, 423528, 423532, 210544, 415353, 333439, 415361, 267909, 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, 268143, 358255, 399215, 358259, 341876, 333689, 243579, 325504, 333698, 333708, 333724, 382890, 350146, 358339, 333774, 358371, 350189, 350193, 333818, 350202, 350206, 350213, 268298, 350224, 350231, 333850, 350237, 350240, 350244, 350248, 178218, 350251, 350256, 350259, 350271, 243781, 350285, 374864, 342111, 342133, 374902, 432271, 333997, 334011, 260289, 260298, 350410, 350416, 350422, 211160, 350425, 268507, 334045, 350445, 375026, 358644, 350458, 350461, 350464, 325891, 350467, 350475, 375053, 268559, 350480, 432405, 350486, 350490, 325914, 325917, 350493, 350498, 350504, 358700, 350509, 391468, 358704, 358713, 358716, 383306, 334161, 383321, 383330, 383333, 391530, 383341, 334203, 268668, 194941, 391563, 366990, 416157, 342430, 268701, 375208, 326058, 375216, 334262, 334275, 326084, 358856, 195039, 334304, 334311, 375277, 334321, 350723, 186897, 342545, 334358, 342550, 342554, 334363, 358941, 350761, 252461, 334384, 383536, 358961, 334394, 252482, 219718, 334407, 334420, 350822, 375400, 334465, 334468, 162445, 326290, 342679, 342683, 260766, 342710, 244409, 260797, 334528, 260801, 350917, 154317, 391894, 154328, 416473, 64230, 113388, 342766, 375535, 203506, 342776, 391937, 391948, 375568, 326416, 375571, 375574, 162591, 326441, 326451, 326454, 326460, 244540, 260924, 375612, 326467, 244551, 326473, 326477, 326485, 416597, 326490, 342874, 326502, 375656, 433000, 326507, 326510, 211825, 211831, 351097, 392060, 359295, 351104, 342915, 400259, 236430, 342930, 252822, 392091, 400285, 252836, 359334, 211884, 400306, 351168, 359361, 326598, 359366, 359382, 359388, 383967, 343015, 359407, 261108, 244726, 261111, 383997, 261129, 359451, 261147, 211998, 261153, 261159, 359470, 359476, 343131, 384098, 384101, 384107, 367723, 187502, 343154, 384114, 212094, 351364, 384135, 384139, 384143, 351381, 384151, 384160, 384168, 367794, 244916, 384181, 367800, 384188, 384191, 351423, 384198, 326855, 244937, 384201, 253130, 343244, 384208, 146642, 384224, 359649, 343270, 351466, 384246, 351479, 384249, 343306, 261389, 359694, 253200, 261393, 384275, 384283, 245020, 384288, 245029, 171302, 351534, 376110, 245040, 384314, 425276, 384323, 212291, 343365, 212303, 367965, 343393, 343398, 367980, 425328, 343409, 253303, 154999, 343417, 327034, 245127, 384397, 245136, 245142, 245145, 343450, 245148, 245151, 245154, 245157, 245162, 327084, 359865, 384443, 146876, 327107, 384453, 327110, 327115, 327117, 359886, 359890, 343507, 368092, 343534, 343539, 368119, 343544, 368122, 409091, 359947, 359955, 359983, 343630, 327275, 245357, 138864, 155254, 155273, 368288, 245409, 425638, 425649, 155322, 425662, 155327, 245460, 155351, 155354, 212699, 245475, 155363, 245483, 155371, 409335, 155393, 155403, 155422, 360223, 155438, 155442, 155447, 155461, 360261, 376663, 155482, 261981, 425822, 155487, 376671, 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, 384977, 393169, 155611, 155619, 253923, 155621, 253926, 327654, 393203, 360438, 253943, 393206, 393212, 155646 ]
1c88ead67f373bfc291b4d406b6a7bbc7d3d44ad
7660dea5921cd5819102ec65561372b134d6bb61
/Appetizers/Views/Cells/AppetizerListCell.swift
1c1dd2f61a7a094265f0ec867aab70906bf90dab
[]
no_license
enumcase/food-ordering-app
d7fe4041d018947ffbf7f0279459304484c5e269
6d1e45ce5a8eb891b09bae0262fb6037e226cd6a
refs/heads/main
2023-04-12T10:01:45.648641
2021-04-26T18:04:23
2021-04-26T18:04:23
356,179,076
2
1
null
null
null
null
UTF-8
Swift
false
false
981
swift
// // AppetizerListCell.swift // Appetizers // // Created by Margulan Daribayev on 08.04.2021. // import SwiftUI struct AppetizerListCell: View { let appetizer: Appetizer var body: some View { HStack { AppetizerRemoteImage(urlString: appetizer.imageURL) .aspectRatio(contentMode: .fit) .frame(width: 120, height: 90) .cornerRadius(8) VStack(alignment: .leading, spacing: 5) { Text(appetizer.name) .font(.title2) .fontWeight(.medium) Text("$\(appetizer.price, specifier: "%.2f")") .foregroundColor(.secondary) .fontWeight(.semibold) } .padding(.leading) } } } struct AppetizerListCell_Previews: PreviewProvider { static var previews: some View { AppetizerListCell(appetizer: MockData.sampleAppetizer1) } }
[ -1 ]
8da0446fe875785353f3007e4f9c0b57c993f450
4b61361f78eff951e511951f49e2d7352469b46f
/RayTracerChallenge/AppDelegate.swift
4bda34ae5e3ecde64c2748c2ef3ff9addb1f23d5
[ "MIT" ]
permissive
haruhikoM/RayTracerChallenge
6f20d4e95cbaa8c97cb43cddfb9c2470b6db5972
7067348445cf97d5b264a43ba47b0411c0f23bed
refs/heads/main
2023-03-31T12:15:10.842782
2021-03-30T09:41:26
2021-03-30T09:41:26
295,694,798
0
0
null
null
null
null
UTF-8
Swift
false
false
1,017
swift
// // AppDelegate.swift // RayTracerChallenge // // Created by Minamiguchi Haruhiko on 2020/09/15. // Copyright © 2020 Minamiguchi Haruhiko. All rights reserved. // import Cocoa import SwiftUI @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { var window: NSWindow! func applicationDidFinishLaunching(_ aNotification: Notification) { // Create the SwiftUI view that provides the window contents. let contentView = ContentView() // Create the window and set the content view. window = NSWindow( contentRect: NSRect(x: 0, y: 0, width: 480, height: 300), styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView], backing: .buffered, defer: false) window.center() window.setFrameAutosaveName("Main Window") window.contentView = NSHostingView(rootView: contentView) window.makeKeyAndOrderFront(nil) } func applicationWillTerminate(_ aNotification: Notification) { // Insert code here to tear down your application } }
[ 332448, 337537, 1153, 254051, 333081, 1159, 142121, 254667, 353583, 345816, 333020, 128533, 9622, 186903, 127288, 189209, 244890, 332988 ]
a48b96594ec8219b8ddf0f644729b40f015f6ae0
6bf38e6bcf7193b963ef07aa7febef6f0dde29bc
/Clockin/Controllers/HomeViewController.swift
2723ccb6ebae36ebd42a9627bc3d24473dafab3c
[ "MIT" ]
permissive
pawankmrai/Clockin
b147c7cd5f8333b156352c7793c4a2bd91295571
bd4e4699a3abbc992e83677c42cd084b6a1e5914
refs/heads/master
2020-08-08T00:07:05.811858
2019-02-18T18:25:50
2019-02-18T18:25:50
null
0
0
null
null
null
null
UTF-8
Swift
false
false
7,768
swift
// // HomeViewController.swift // Clockin // // Created by Ahmed Bekhit on 2/15/19. // Copyright © 2019 Ahmed Bekhit. All rights reserved. // import UIKit class HomeViewController: UIViewController { // Declaring & initializing the image view used for the home screen's background. var backgroundImageView: UIImageView = { let imageView = UIImageView(image: UIImage(named: "homeBG")) imageView.contentMode = .scaleAspectFill imageView.translatesAutoresizingMaskIntoConstraints = false return imageView }() // Declaring & initializing the view's title label var titleLabel: UILabel = { let label = UILabel() label.text = "Clockin" label.font = UIFont(name: "Avenir-Heavy", size: 38) label.textColor = .white label.translatesAutoresizingMaskIntoConstraints = false return label }() // Declaring & initializing the add button that will be used to add new clocks with different timezones var addButton: UIButton = { let button = UIButton() button.setImage(UIImage(named: "addIcon"), for: .normal) button.translatesAutoresizingMaskIntoConstraints = false return button }() // Declaring & initializing the table view used to display a list analog clocks worldwide var clocksTableView: UITableView = { let tableView = UITableView() tableView.backgroundColor = .clear tableView.contentInset = UIEdgeInsets(top: 25, left: 0, bottom: 0, right: 0) tableView.separatorStyle = .none tableView.translatesAutoresizingMaskIntoConstraints = false return tableView }() var childrenViews = [UIView]() let userCurrentTimezone = ClockTime.current?.timezone var userTimes: [ClockTime.ClockTimezone] = ClockTime.timezoneClockinDefaults { didSet { clocksTableView.reloadData() } } // Overriding statusbar default color and changing it to a light/white color override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } override func viewDidLoad() { super.viewDidLoad() // An observer that handles when a user selects timezone NotificationCenter.default.addObserver(self, selector: #selector(didUserSelectTimezone), name: Notification.Name("didSelectTimezone"), object: nil) self.prepareUILayout() } // A method that handles activating the view's constraints func prepareUILayout() { addButton.addTarget(self, action: #selector(addTimezoneHandler(sender:)), for: .touchUpInside) clocksTableView.delegate = self clocksTableView.dataSource = self clocksTableView.register(HomeTableCell.self, forCellReuseIdentifier: "ClockCell") childrenViews = [backgroundImageView, titleLabel, addButton, clocksTableView] childrenViews.forEach { childView in view.addSubview(childView) } NSLayoutConstraint.activate([ // MARK:- Background image view constraints backgroundImageView.topAnchor.constraint(equalTo: view.topAnchor), backgroundImageView.bottomAnchor.constraint(equalTo: view.bottomAnchor), backgroundImageView.leadingAnchor.constraint(equalTo: view.leadingAnchor), backgroundImageView.trailingAnchor.constraint(equalTo: view.trailingAnchor), // MARK:- Title label constraints titleLabel.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 25), titleLabel.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 20), // MARK:- Add button constraints addButton.widthAnchor.constraint(equalToConstant: 50), addButton.heightAnchor.constraint(equalTo: addButton.widthAnchor), addButton.centerYAnchor.constraint(equalTo: titleLabel.centerYAnchor), addButton.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -16), // MARK:- Clock table view constraints clocksTableView.topAnchor.constraint(equalTo: titleLabel.bottomAnchor), clocksTableView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor), clocksTableView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor), clocksTableView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor), ]) } @objc func addTimezoneHandler(sender: UIButton) { let addClockController = AddClockViewController() addClockController.userCurrentTimezones = userTimes self.present(addClockController, animated: true) } @objc func didUserSelectTimezone() { // Updates data when user adds a new timezone userTimes = ClockTime.timezoneClockinDefaults } } // MARK: UITableView Delegates & DataSource methods extension HomeViewController: UITableViewDelegate, UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return userTimes.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if let cell = tableView.dequeueReusableCell(withIdentifier: "ClockCell") as? HomeTableCell { let cellTime = userTimes[indexPath.row] let clockTime = ClockTime(timezone: cellTime) let timeZone = TimeZone.init(identifier: cellTime.id) let timeDifference = (timeZone?.secondsFromGMT(for: Date()) ?? 0) / 3600 cell.locationIndicator.isHidden = userCurrentTimezone?.id ?? "" != cellTime.id cell.cellMode = (clockTime.hrs >= 18 || clockTime.hrs < 6) ? .night : .day cell.clockView.startAnimation(from: clockTime) cell.cityTitleLabel.text = "\(cellTime.city)\n\(cellTime.continent)" cell.tempratureLabel.text = "🙈°C" cell.timeDifferenceLabel.text = "GMT \(timeDifference >= 0 ? "+" : "")\(timeDifference)" return cell } return UITableViewCell() } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let cellTime = userTimes[indexPath.row] let clockView = ClockViewController() let clockTime = ClockTime(timezone: cellTime) let timeZone = TimeZone.init(identifier: cellTime.id) let timeDifference = (timeZone?.secondsFromGMT(for: Date()) ?? 0) / 3600 clockView.currentTimezone = cellTime clockView.locationIndicator.isHidden = userCurrentTimezone?.id ?? "" != cellTime.id clockView.clockMode = (clockTime.hrs >= 18 || clockTime.hrs < 6) ? .night : .day clockView.clockView.startAnimation(from: clockTime) clockView.cityTitleLabel.text = "\(cellTime.city)\n\(cellTime.continent)" clockView.tempratureLabel.text = "🙈°C" clockView.timeDifferenceLabel.text = "GMT \(timeDifference >= 0 ? "+" : "")\(timeDifference)" self.navigationController?.pushViewController(clockView, animated: true) } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { if UIDevice.current.userInterfaceIdiom == .phone { return 300 }else{ if self.view.bounds.width > self.view.bounds.height { return self.view.bounds.height*0.95 }else{ return self.view.bounds.height*0.55 } } } }
[ -1 ]
253a834866424a7505e3c8d2b04336d5f0cba9d6
4cc0129857eafc47d9f0ade2807500069c89166d
/Source/Designable/TextField.swift
0253611f0c8d1a98c468fc708cc4947955c3c03e
[ "MIT" ]
permissive
nattaponph/ADVHelper
5e6a8bf6100ea155c9f140a85db91decd2f1e313
1dcb63c11559cad8e04e890b76f53d346756d19b
refs/heads/master
2022-11-05T20:49:38.080871
2020-06-19T07:38:24
2020-06-19T07:38:24
271,044,564
1
0
null
null
null
null
UTF-8
Swift
false
false
4,723
swift
// // TextField.swift // ADVHelper // // Created by [email protected] on 06/09/2020. // Copyright (c) 2020 [email protected]. All rights reserved. // import UIKit @IBDesignable open class TextField: UITextField { open override func awakeFromNib() { setupLayer() } open override func prepareForInterfaceBuilder() { setupLayer() } override open func layoutSubviews() { super.layoutSubviews() gradient?.frame = self.layer.bounds } func setupLayer() { if paddingLeftCustom == 8 { let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: paddingLeftCustom, height: frame.size.height)) self.leftView = paddingView self.leftViewMode = .always } if paddingRightCustom == 8 { let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: paddingRightCustom, height: frame.size.height)) self.rightView = paddingView self.rightViewMode = .always } } //MARK: - Padding @IBInspectable open var paddingLeftCustom: CGFloat = 8 { didSet { let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: paddingLeftCustom, height: frame.size.height)) self.leftView = paddingView self.leftViewMode = .always } } @IBInspectable open var paddingRightCustom: CGFloat = 8 { didSet { let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: paddingRightCustom, height: frame.size.height)) self.rightView = paddingView self.rightViewMode = .always } } //MARK: - Border @IBInspectable open var borderColor: UIColor = UIColor.clear { didSet { self.layer.borderColor = borderColor.cgColor if borderColor != UIColor.clear && borderWidth > 0 { self.borderStyle = .none } } } @IBInspectable open var borderWidth: CGFloat = 0 { didSet { self.layer.borderWidth = borderWidth if borderColor != UIColor.clear && borderWidth > 0 { self.borderStyle = .none } } } @IBInspectable open var cornerRadius: CGFloat = 0 { didSet { self.layer.cornerRadius = cornerRadius if let gradientLayer = gradient { gradientLayer.cornerRadius = cornerRadius } } } //MARK: - Shadow @IBInspectable open var shadowColor: UIColor = UIColor.clear { didSet { self.layer.shadowColor = shadowColor.cgColor } } @IBInspectable open var shadowOpacity: Float = 0 { didSet { self.layer.shadowOpacity = shadowOpacity } } @IBInspectable open var shadowOffset: CGSize = CGSize.zero { didSet { self.layer.shadowOffset = shadowOffset } } @IBInspectable open var shadowRadius: CGFloat = 0 { didSet { self.layer.shadowRadius = shadowRadius } } //MARK: - Gradient Background @IBInspectable open var gradientEnabled: Bool = false { didSet { setupGradient() } } @IBInspectable open var gradientStartColor: UIColor = UIColor.clear { didSet { setupGradient() } } @IBInspectable open var gradientEndColor: UIColor = UIColor.clear { didSet{ setupGradient() } } @IBInspectable open var gradientHorizontal: Bool = false { didSet { setupGradient() } } var gradient: CAGradientLayer? func setupGradient() { gradient?.removeFromSuperlayer() guard gradientEnabled != false else{ return } gradient = CAGradientLayer() guard let gradient = gradient else { return } gradient.frame = self.layer.bounds gradient.colors = [gradientStartColor.cgColor, gradientEndColor.cgColor] gradient.startPoint = CGPoint(x: 0, y: 0) gradient.endPoint = gradientHorizontal ? CGPoint(x: 1, y: 0) : CGPoint(x: 0, y: 1) gradient.cornerRadius = self.cornerRadius self.layer.insertSublayer(gradient, at: 0) } //MARK: - Localized @IBInspectable open var localizeKey: String? { set { // set new value from dictionary DispatchQueue.main.async { self.placeholder = newValue?.localized() } } get { return self.placeholder } } }
[ -1 ]
8c704befe77a47dcdd36d76a2c1f98c60270d19a
64485d231a6afd63765df6a0093e7822a90e9021
/swifty companion/ViewController.swift
28367ca84300c75042f8bd8772ac2b8e4538de35
[]
no_license
pdespres/swifty-companion
062b9fd9f4b5e40ede189c481bfc286d966f18a4
bb96bd7806b7c96c11d94bb8833fff2b3dc8781d
refs/heads/master
2021-05-10T13:41:12.601592
2019-06-20T09:31:59
2019-06-20T09:31:59
118,485,821
0
0
null
null
null
null
UTF-8
Swift
false
false
2,406
swift
// // ViewController.swift // swifty companion // // Created by Paul DESPRES on 1/22/18. // Copyright © 2018 42. All rights reserved. // import UIKit import Alamofire import SwiftyJSON class ViewController: UIViewController { var resultSearchController:UISearchController? = nil var token: Token? override func viewDidLoad() { super.viewDidLoad() token = Token() let backgroundImage = UIImage(named: "background.jpg") let imageView = UIImageView(image: backgroundImage) imageView.contentMode = .scaleAspectFill self.view.insertSubview(imageView, at: 0) imageView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true imageView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true imageView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true imageView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true let locationSearchTable = storyboard!.instantiateViewController(withIdentifier: "LoginSearchTable") as! LoginSearchTable resultSearchController = UISearchController(searchResultsController: locationSearchTable) resultSearchController?.searchResultsUpdater = locationSearchTable as UISearchResultsUpdating let searchBar = resultSearchController!.searchBar searchBar.sizeToFit() searchBar.placeholder = "search login..." searchBar.autocapitalizationType = .none searchBar.autocorrectionType = .no navigationItem.titleView = resultSearchController?.searchBar resultSearchController?.hidesNavigationBarDuringPresentation = false resultSearchController?.dimsBackgroundDuringPresentation = true definesPresentationContext = true locationSearchTable.viewDelegate = self } override func viewDidAppear(_ animated: Bool) { resultSearchController!.searchBar.becomeFirstResponder() } override func viewWillAppear(_ animated: Bool) { if Global.tokenId != nil { token!.checkToken() } } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "segTo" { if let vc = segue.destination as? TabBarViewController { vc.user = sender as? User } } } }
[ -1 ]
780d16adfad2249395c285509c6e1d2442e25688
4cf67092331e0ec97863e3ac5d658c63ce044286
/Circle.swift
bedf55d4888a06d53d7c0c1c5f0190560e709c7c
[]
no_license
JLongshot/PopMenu
09291a04938724354675a7cab1ef2646455b49ae
60a99759652523e4dfe56086b6fe2e1651b82af3
refs/heads/master
2021-01-10T16:30:19.987433
2016-03-02T14:56:02
2016-03-02T14:56:02
52,967,979
1
1
null
null
null
null
UTF-8
Swift
false
false
574
swift
// // Circle.swift // Pop // // Created by Jared Long on 2/8/16. // Copyright © 2016 Longshot. All rights reserved. // import UIKit @IBDesignable class Circle: UIButton { /* // Only override drawRect: if you perform custom drawing. // An empty implementation adversely affects performance during animation. override func drawRect(rect: CGRect) { // Drawing code } */ override func drawRect(rect: CGRect) { var path = UIBezierPath(ovalInRect: rect) UIColor.greenColor().setFill() path.fill() } }
[ -1 ]
66dfd5384391c2919cd738b7bf8e9379e792f334
563d0442cfdc4fbcfbe9b2e459f182ae8588beb6
/Agon/AppDelegate.swift
d515c0bae917aed152ae06febe0c2e2b76fb203c
[]
no_license
gvillaloboz/AgonQualitative
5d8e911e8b2e7ad6aa03d6f328b93b3747bd1674
6ec810007643acca19e5f5abf0db65fbb32e305e
refs/heads/master
2022-02-24T01:31:53.365826
2019-10-24T17:08:58
2019-10-24T17:08:58
191,524,941
0
0
null
null
null
null
UTF-8
Swift
false
false
3,420
swift
// // AppDelegate.swift // Agon // // Created by Gabriela Villalobos on 02.11.18. // Copyright © 2018 UNIL. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { // MARK: - Properties var window: UIWindow? let healthKitSetupAssistant = HealthKitSetupAssistant() var dashboardViewController : DashboardViewController? var dashboardController = DashboardController() // MARK: - Functions func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Initializes in Realm the Last Sync Timestamp -> This determines the starting day of the baseline SynchronizationModel().initializeLastDaySync(year: 2018, month: 7, day: 1, hour: 0, minute: 0, second: 0) // Override point for customization after application launch. //print("application did finish launching with options") healthKitSetupAssistant.requestAccessWithCompletion(){ success, error in if success{ print("Healthkit access requested from App Delegate") // Note: Access Requested not necessarily granted } else{ print("Error requesting access to HealthKit: \(error)") } } 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. print("applicationDidEnterBackground") } 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. print("applicationWillEnterForeground") dashboardViewController?.updateStepsLabelFunc( steps: healthKitSetupAssistant.stepsCollectedFromBackground) dashboardViewController?.viewDidLoad() //dashboardController.downloadUsersListPerCondition(expCondition: "3") } func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } }
[ 294924, 327722, 237613, 286774, 286776, 319544, 286778, 286791, 237640, 286797, 311375, 196692, 319573, 311383, 303212, 131192, 303230, 327814, 303241, 303244, 319633, 286876, 311469, 327862, 286906, 327866, 286910, 286924, 286926, 131281, 229622, 327930, 237826, 319751, 319757, 286999, 319770, 287003, 287006, 287012, 287014, 287016, 287019, 311598, 287023, 319809, 319810, 319814, 311623, 311628, 319822, 229717, 139638, 213367, 311683, 311693, 311719, 139689, 311728, 311741, 319938, 319945, 188895, 172512, 287202, 172520, 319978, 172526, 311791, 172529, 319989, 172534, 180727, 287230, 303617, 172550, 303623, 172552, 172558, 303632, 303637, 172572, 172577, 295459, 172581, 172591, 172598, 172607, 172612, 172614, 172618, 303690, 33357, 303696, 172634, 311911, 172656, 352880, 295538, 172660, 287349, 172675, 295557, 352905, 287377, 172691, 287381, 221850, 287386, 230045, 172702, 172705, 287394, 172707, 303780, 287398, 295595, 189102, 172721, 287409, 66227, 287419, 328381, 328384, 172737, 172748, 287436, 172751, 287440, 295633, 172755, 303827, 287450, 303835, 189149, 303838, 312035, 295654, 230128, 312048, 312050, 230146, 328453, 312077, 295695, 230169, 295707, 295710, 295720, 303914, 230202, 312124, 328508, 222018, 287569, 230237, 230241, 303976, 336744, 295806, 295808, 295813, 320391, 304013, 295822, 189329, 295825, 304019, 304027, 213931, 230327, 304055, 287675, 230334, 304063, 304065, 156612, 197580, 312272, 304090, 320481, 304106, 320490, 312302, 328687, 320496, 295945, 230413, 320528, 140312, 295961, 304164, 304170, 238641, 238652, 238655, 238658, 336964, 320584, 238666, 296021, 402518, 336987, 230497, 296040, 361576, 205931, 205968, 296084, 238745, 304285, 238756, 238766, 230576, 238770, 304311, 230592, 312518, 230600, 230607, 148690, 320727, 304354, 296163, 320740, 320748, 304370, 320771, 312585, 296202, 230674, 320786, 230677, 320792, 230681, 230689, 312622, 296253, 296255, 312639, 230727, 238919, 296264, 320840, 296267, 296271, 312663, 222556, 337244, 312676, 230760, 148843, 230768, 312692, 230773, 304505, 304506, 312711, 296331, 288140, 288144, 173488, 288176, 312759, 288185, 222652, 312766, 173507, 230860, 312783, 239070, 296435, 288250, 296446, 321022, 402942, 296450, 230919, 230923, 304651, 304653, 222752, 296486, 157229, 230961, 157236, 288320, 288325, 124489, 288338, 239194, 312938, 116354, 321195, 296622, 321200, 337585, 296637, 313044, 313052, 288478, 313055, 321252, 288494, 321266, 288502, 288510, 124671, 198405, 198416, 313121, 313123, 304932, 321316, 321336, 296767, 288576, 345921, 304968, 173907, 313171, 313176, 296812, 313201, 305028, 239510, 124827, 214944, 124853, 214966, 296890, 288700, 296894, 190403, 296900, 337862, 165831, 296921, 239586, 124913, 165876, 239612, 313340, 288764, 239617, 313347, 313358, 305176, 313371, 305191, 223273, 124978, 215090, 124980, 288824, 288826, 321595, 313406, 288831, 288836, 215123, 288859, 149599, 149601, 321634, 149603, 149618, 215154, 313464, 329850, 288895, 215175, 313498, 100520, 288947, 321717, 313548, 313557, 338147, 125171, 125187, 125191, 125207, 125209, 321817, 125218, 321842, 223539, 125239, 289087, 305480, 305485, 305489, 354653, 313700, 190832, 313720, 313731, 199051, 240011, 289166, 240017, 240021, 297365, 297372, 297377, 289186, 240052, 289207, 289210, 305594, 166378, 305647, 174580, 240124, 305662, 305664, 240129, 305666, 305668, 223749, 223752, 150025, 338440, 322074, 150066, 289342, 338528, 199273, 19053, 158317, 313973, 297594, 158347, 314003, 117398, 289436, 174754, 330404, 174764, 314029, 314033, 240309, 314045, 314047, 314051, 297671, 158409, 289493, 289513, 289522, 289532, 322303, 322310, 322314, 322318, 322341, 215850, 289601, 240458, 240468, 322393, 207733, 207737, 158596, 183172, 314249, 289687, 289694, 289700, 289724, 289762, 183277, 322550, 322599, 322610, 314421, 314433, 314441, 322642, 314456, 314461, 248995, 306341, 306344, 306347, 322734, 306354, 289997, 363742, 330988, 216303, 257302, 363802, 199976, 199978, 298292, 298294, 216376, 380226, 224587, 216404, 306517, 150870, 314714, 314718, 314723, 150890, 306539, 314732, 314736, 314743, 306552, 290171, 314747, 298372, 314756, 224647, 314763, 314768, 224657, 306581, 314773, 314779, 314785, 314793, 241068, 241070, 150966, 306618, 323015, 306635, 306640, 290263, 290270, 339431, 191985, 290291, 241142, 191992, 290298, 290302, 290305, 306694, 290325, 241175, 290332, 241181, 290344, 306731, 290349, 290356, 224849, 306778, 314979, 323176, 224875, 241260, 323181, 298651, 282269, 323229, 298655, 323231, 306856, 323266, 306904, 52959, 241380, 323318, 241412, 323345, 323349, 315167, 315169, 315174, 323367, 241448, 315176, 241450, 306991, 315184, 323376, 315190, 241464, 159545, 298811, 118593, 307009, 413506, 307012, 315211, 307027, 315223, 241496, 241498, 307035, 110433, 110438, 315249, 315253, 315255, 241544, 241546, 241548, 241556, 241560, 241563, 241565, 241567, 241569, 241574, 241581, 241583, 241586, 241588, 241590, 241592, 241598, 290751, 241605, 241610, 298975, 241632, 298984, 241643, 298988, 241646, 241649, 241652, 299003, 241661, 299006, 315396, 241669, 315397, 290835, 241693, 102438, 290877, 315466, 192596, 307290, 217179, 315482, 192605, 233567, 299105, 217188, 299109, 307303, 356457, 45163, 307307, 315502, 192624, 307314, 299126, 233591, 299136, 307338, 241813, 307352, 299164, 299167, 315552, 184486, 307370, 307372, 307374, 307376, 184503, 307388, 307390, 307394, 299204, 184518, 307399, 323784, 233679, 307409, 307411, 299225, 233701, 307432, 291104, 315701, 332086, 307518, 323917, 233808, 323921, 315733, 323926, 315739, 299357, 242024, 299373, 250231, 242043, 315771, 299391, 291202, 242057, 291212, 299405, 315801, 242075, 61855, 291231, 291241, 291247, 299440, 291260, 127424, 299457, 127434, 315856, 315860, 299481, 176605, 242143, 127463, 127474, 291314, 291317, 127480, 291323, 127485, 291330, 233994, 127500, 233998, 127506, 234006, 127511, 152087, 291361, 242220, 291378, 70213, 111193, 242275, 299620, 242279, 316051, 316054, 373404, 299684, 242343, 242345, 373421, 299720, 299723, 299726, 299740, 201444, 234219, 316151, 242431, 234258, 242452, 201496, 234264, 234266, 234272, 152355, 299814, 185138, 234296, 160572, 316233, 234319, 185173, 201557, 308063, 234336, 242530, 349027, 234344, 152435, 177011, 234356, 291714, 291716, 234373, 308123, 291748, 234405, 291750, 324520, 324522, 291756, 324527, 324531, 291773, 242623, 324544, 234434, 324546, 291788, 234464, 168935, 324585, 316400, 234481, 316403, 234485, 234487, 316416, 308231, 300054, 316439, 234520, 234526, 300066, 300069, 234540, 234546, 300085, 234553, 316479, 316483, 160835, 234563, 308291, 316491, 234572, 300108, 234574, 300115, 234593, 234597, 300133, 300139, 234610, 234620, 234640, 308373, 234647, 234650, 300189, 324766, 119967, 300197, 234667, 308414, 234687, 300226, 308418, 234692, 300229, 308420, 308422, 300234, 300238, 300241, 316625, 300243, 300245, 316630, 300248, 300253, 300256, 300258, 300260, 300263, 300265, 300267, 300270, 300272, 300278, 275703, 316663, 300284, 275710, 292097, 300292, 234760, 177419, 300299, 242957, 300301, 349464, 300344, 243003, 300357, 316758, 357722, 316766, 292197, 316774, 218473, 136562, 316803, 316806, 316811, 316814, 300433, 234899, 300436, 357783, 316824, 316826, 300448, 144810, 144814, 144820, 374196, 292279, 144826, 144830, 144832, 144837, 144839, 144847, 144855, 103899, 300507, 333280, 218597, 292329, 300523, 300527, 308720, 292338, 316917, 300537, 316933, 316947, 308757, 308762, 284194, 284199, 284204, 284206, 284209, 284211, 194101, 284213, 316983, 194103, 284215, 308790, 284223, 284226, 284228, 284231, 284234, 317004, 284238, 284241, 194130, 284243, 300628, 284245, 284247, 292452, 292454, 292458, 292461, 284272, 284274, 284278, 292470, 292473, 284283, 284286, 284290, 325250, 284292, 292485, 284297, 317066, 284299, 284301, 284306, 284308, 284312, 284320, 284327, 284329, 317098, 284331, 300726, 284343, 284346, 284350, 284354, 358083, 284358, 284362, 284365, 284368, 284370, 358098, 284372, 358114, 358119, 325353, 358122, 358126, 358128, 358133, 358138, 300795, 358142, 358146, 317189, 317191, 300819, 317207, 300830, 300832, 325408, 317221, 243504, 300850, 325436, 358206, 366406, 292681, 358224, 317279, 292715, 292721, 300915, 292729, 292734, 325512, 317332, 358292, 358312, 317353, 358326, 358330, 301011, 301013, 358360, 301017, 292828, 292839, 292843, 178161, 325624, 317435, 317446, 317456, 178195, 243733, 243740, 317472, 325666, 243751, 243762, 309298, 325685, 325689, 235579, 325692, 178238, 325700, 292934, 350293, 350295, 309337, 350304, 178273, 309346, 194660, 350308, 309350, 309348, 292968, 309352, 301167, 350321, 350325, 252022, 350328, 292985, 292989, 301185, 350339, 317573, 350342, 350345, 350349, 317584, 325777, 350357, 350362, 350366, 350375, 350379, 350381, 350383, 350385, 350387, 350389, 350395, 350397, 350399, 350402, 350406, 301258, 309455, 301272, 194780, 309468, 309471, 317672, 317674, 325867, 309494, 325910, 309530, 342298, 317729, 211241, 325937, 325943, 211260, 235853, 235858, 293227, 293232, 186744, 211324, 317833, 317853, 317858, 342434, 317864, 235955, 293304, 293314, 309707, 317910, 293336, 235996, 317917, 293343, 358880, 293364, 301562, 317951, 301575, 293387, 113167, 309779, 317971, 309781, 227882, 309804, 236082, 23094, 301636, 318020, 301643, 309844, 309849, 318055, 121458, 309885, 309888, 318092, 326285, 334476, 318108, 318110, 137889, 383658, 318128, 293555, 137946, 113378, 342760, 56043, 310015, 310029, 293659, 326430, 285474, 318248, 318253, 301876, 293685, 301884, 301911, 301921, 236397, 162671, 326514, 236408, 416639, 113538, 310147, 416648, 293798, 293802, 293817, 293820, 203715, 318442, 326638, 318450, 293876, 302073, 121850, 293882, 302075, 293899, 293908, 293917, 293939, 318516, 310336, 293956, 293960, 293971, 310355, 310359, 236632, 138332, 310376, 318573, 367737, 302205, 294026, 162964, 384148, 187542, 302231, 285849, 302233, 285852, 302237, 285854, 285856, 302241, 302248, 294063, 318651, 318657, 244930, 130244, 302282, 310476, 302285, 302288, 310481, 302290, 302292, 302294, 310486, 302296, 310498, 302315, 294132, 138485, 204026, 64768, 285999, 318773, 318776, 286010, 417086, 302403, 294221, 294223, 326991, 294246, 310632, 327017, 351594, 310648, 351619, 294276, 318858, 130468, 310710, 302526, 302534, 310727, 302541, 302543, 310737, 310749, 310755, 310764, 310772, 40440, 212472, 40443, 40448, 286214, 302603, 302614, 302621, 286240, 187939, 40484, 40486, 286246, 294440, 40488, 294439, 294443, 40491, 294445, 310831, 40499, 40502, 212538, 40507, 40511, 40513, 40521, 40525, 40527, 212560, 400976, 40533, 40537, 40539, 40541, 40544, 40548, 40550, 40552, 40554, 40557, 40560, 294521, 343679, 302740, 179870, 327333, 319153, 302781, 294601, 302793, 343757, 212690, 319187, 286425, 294625, 294634, 302838, 319226, 286460, 302852, 302854, 294664, 311048, 319243, 311053, 302862, 319251, 294682, 188199, 294701, 319290, 229192, 302925, 188247, 237409, 294785, 237470, 319390, 40865, 319394, 311209, 343983, 294844, 294847, 294876, 294879, 237555, 237562 ]
f98b0a4a1102c1713bea7780419320a7a280683d
e61a416dfbefa29c42520e32bb497cecb1cc131e
/client/Master&Detail/ContainerViewThreeController.swift
5292fae740ca9e2dd13cbe9e6556733ad6a02746
[]
no_license
ruta0/client
3e8c2d339a110c07f4f5aab01de1bb2a6138fcbe
5c963ea257a84a88d071a8c1b6f77c8b46f69f33
refs/heads/master
2021-09-13T13:54:50.825343
2018-02-07T02:53:22
2018-02-07T02:53:22
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,836
swift
// // ContainerViewThreeController.swift // horoscopeclient // // Created by rightmeow on 2/1/18. // Copyright © 2018 odinternational. All rights reserved. // import UIKit class ContainerViewThreeController: BaseViewController { @IBOutlet weak var tableView: UITableView! private func setupUITableView() { self.tableView.register(UINib(nibName: ContainerDetailsCell.nibName, bundle: nil), forCellReuseIdentifier: ContainerDetailsCell.cell_id) } override func viewDidLoad() { super.viewDidLoad() self.setupUITableView() self.setupUITableViewDataSource() self.setupUITableViewDelegate() } } extension ContainerViewThreeController: UITableViewDelegate { private func setupUITableViewDelegate() { self.tableView.delegate = self } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { // do nothing } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return UITableViewAutomaticDimension } } extension ContainerViewThreeController: UITableViewDataSource { private func setupUITableViewDataSource() { self.tableView.dataSource = self } func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 1 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if let cell = self.tableView.dequeueReusableCell(withIdentifier: ContainerDetailsCell.cell_id, for: indexPath) as? ContainerDetailsCell { cell.titleLabel.text = "今年概述" return cell } else { return BaseTableViewCell() } } }
[ -1 ]
7ebaa394fd347da3eff9ac4694bfbe9cdf37b4d4
91574d11758b300ab6e80f85603d813b289469cd
/SwiftDemo/BaseNavController/PPBaseViewController.swift
6375ad364925003e2f50363ed7d5a0b9a0d08faf
[]
no_license
mafeng-Bryant/Swift3
95653534ef178647d41b7108b24a0967cedd4107
5e1f9def97a12b0c1b6e6a29c381b32404c6922f
refs/heads/master
2021-06-14T04:40:22.951060
2017-03-31T12:36:17
2017-03-31T12:36:17
63,652,083
0
0
null
null
null
null
UTF-8
Swift
false
false
1,506
swift
// // PPBaseViewController.swift // SwiftDemo // // Created by patpat on 16/7/22. // Copyright © 2016年 test. All rights reserved. // import UIKit class PPBaseViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) NotificationCenter.default.addObserver(self, selector: #selector(PPBaseViewController.login), name: NSNotification.Name(rawValue: Notification_Login), object: nil) } override func viewWillDisappear(_ animated: Bool) { NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: Notification_Login), object: nil) } @objc fileprivate func login(){ let xib = UIStoryboard(name: "LoginViewController", bundle: nil) let login = xib.instantiateInitialViewController()! present(login, animated: true, completion: nil) } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. } */ }
[ -1 ]
9bf451197af66d82dc3c5551151de385245507b7
e5f9136c7085c16b2838034fdb820df646ef75f5
/TableViewCellTest/ViewController.swift
8f530ad62607aa23e9dddac6aafaf066cdff4f38
[]
no_license
mathewa6/TableViewCellTutorial
0d64841bc003656ab44a9e3b51901b4145a01810
cde468e30f418ca8359592b98375acfb72c0769e
refs/heads/master
2016-09-14T05:03:03.985142
2016-05-17T02:54:24
2016-05-17T02:54:24
58,933,053
1
0
null
null
null
null
UTF-8
Swift
false
false
2,269
swift
// // ViewController.swift // TableViewCellTest // // Created by Adi Mathew on 5/14/16. // Copyright © 2016 BumBum & Co. All rights reserved. // import UIKit class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { let data = ["Usidore", "Arnie", "Chuntttttt"] @IBOutlet var tableView: UITableView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. tableView.delegate = self tableView.dataSource = self // tableView.registerClass(TestTableViewCell.self, forCellReuseIdentifier: "Cell") tableView.registerNib(UINib.init(nibName: "TestTableViewCell", bundle: nil), forCellReuseIdentifier: "Cell") } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } //MARK: - UITableView Datasource func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return data.count } func numberOfSectionsInTableView(tableView: UITableView) -> Int { return 1 } func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { return self.view.bounds.size.height/9 } //MARK: - UITableView Delegate func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let identifier = "Cell" let cell = tableView.dequeueReusableCellWithIdentifier(identifier, forIndexPath: indexPath) as! TestTableViewCell cell.altLabel!.text = data[indexPath.row] return cell } override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { let dvc = segue.destinationViewController let tit = sender as! TestTableViewCell dvc.title = tit.altLabel!.text } func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { self.performSegueWithIdentifier("CellSegue", sender: tableView.cellForRowAtIndexPath(indexPath)) tableView.deselectRowAtIndexPath(indexPath, animated: true) } }
[ -1 ]
68a3c5cd52208e7131accd0030b7bd37928212c5
588d951791559fc3aad93c66fe65c098ff29426c
/blyp/Views/Profile/FriendCell.swift
485ec693d987055fdc0d199e47527fae04cacc4c
[ "MIT" ]
permissive
sKhan16/Blyp
32bb86453e13568bd36cb4d7e7161a89cfde4cbb
fa79fc7f2b6ab6efb8991c76b1076a33ca3c2c60
refs/heads/master
2023-01-23T13:36:23.911258
2020-05-22T19:38:56
2020-05-22T19:38:56
237,536,955
0
0
MIT
2023-01-09T12:22:44
2020-02-01T00:01:48
Swift
UTF-8
Swift
false
false
978
swift
// // FriendCell.swift // blyp // // Created by Hayden Hong on 5/13/20. // Copyright © 2020 Team Sonar. All rights reserved. // import SwiftUI struct FriendCell: View { @EnvironmentObject var user: UserObservable private var profile: FriendProfile init(for user: DisplayNameAlgoliaResult) { profile = FriendProfile(uid: user.objectID, displayName: user.displayName) } init(friend: FriendProfile) { profile = friend } var body: some View { HStack { Text(profile.displayName ?? "Unknown Name") Spacer() if profile.isLegacyContact(of: user) { Image(systemName: "person.crop.circle.badge.checkmark") } if profile.isAlreadyFriend(of: user) { Image(systemName: "person.2") } } } } // struct FriendCell_Previews: PreviewProvider { // static var previews: some View { // FriendCell() // } // }
[ -1 ]
6f861e60d1b82976d97c0eba383d00730e2fcdb9
cf169ef549b76a799b0b02032187e8959e44af60
/iOSCommonUtils/AppInfo.swift
beb9e3f79994f2b9049e41db58f29eb20395b301
[ "MIT" ]
permissive
nam-dh/iOS-Common-Utils
7da039dd0c6dad9e127f5b44259b2e063149457f
30727c6cf299794dfbf8d5ceba781171965ed797
refs/heads/master
2020-04-26T22:18:39.374848
2019-09-17T10:14:46
2019-09-17T10:14:46
173,868,954
1
0
null
null
null
null
UTF-8
Swift
false
false
463
swift
// // AppInfo.swift // CommonUtils // // Created by Nam Doan on 2017/11/24. // Copyright © 2017年 NamDH. All rights reserved. // import Foundation public struct AppInfo { public static var name: String { return Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as? String ?? "" } public static var version: String { return Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "" } }
[ -1 ]
036d1ab23f8f3105d120fe9f7cb3806e1ff14978
5775e2b20873bbf31075abd9d44be5c37655b248
/FootballGather/Packages/FoundationTools/Tests/FoundationToolsTests/Storage/FileStorageTests.swift
b0fcc9eaa2300cd2ed365f87659da4b13ffe95dc
[ "MIT" ]
permissive
bbiguduk/footballgather-prod
1608d7787e7232e96f32548058c20051e9e5236d
be4d8b6966247588ac4418d0944e6dce2f923010
refs/heads/main
2023-08-30T19:28:46.320247
2021-11-16T04:04:47
2021-11-16T04:04:47
null
0
0
null
null
null
null
UTF-8
Swift
false
false
3,106
swift
// // FileStorage.swift // // // Created by Radu Dan on 28.05.2021. // import XCTest @testable import FoundationTools final class FileStorageTests: XCTestCase { private var sut: FileStorage<String, [String]>! private var fileManager: FileManager! private let path = NSTemporaryDirectory() + "FileStorageTests" private let fileKey = "test-data.json" private let storedObjects = ["stored-value"] private var mockEncoder: Mocks.Encoder! private var storageCoder: StorageCoder! override func setUpWithError() throws { try super.setUpWithError() try makeSUT() } override func tearDownWithError() throws { try? fileManager.removeItem(atPath: path) mockEncoder = nil sut = nil try super.tearDownWithError() } func testStoreValue_storesData() { sut.store(storedObjects, at: fileKey) XCTAssertEqual(storedObjects, sut.load(forKey: fileKey)) } func testStoreValue_whenCoderThrowsError_returns() { mockEncoder.error = Mocks.StorageError.generic sut.store(storedObjects, at: fileKey) XCTAssertNil(sut.load(forKey: fileKey)) } func testDeleteObject() { sut.store(storedObjects, at: fileKey) sut.deleteObject(forKey: fileKey) XCTAssertNil(sut.load(forKey: fileKey)) } func testClear() { sut.store(storedObjects, at: fileKey) sut.clear() XCTAssertNil(sut.load(forKey: fileKey)) } func testClear_whenDirectoryIsMissing_returns() { try? fileManager.removeItem(atPath: path) sut.store(storedObjects, at: fileKey) sut.clear() XCTAssertNil(sut.load(forKey: fileKey)) } func testDocumentsDirectoryURL() { XCTAssertEqual( FileManager.documentsDirectoryURL, FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] ) } func testLoad_whenKeyIsNotString_isNil() { let sut = FileStorage<Key, String>(fileManager: .init()) XCTAssertNil(sut.load(forKey: Key())) } func testDeleteObject_whenKeyIsNotString_isNil() { let sut = FileStorage<Key, String>(fileManager: .init()) sut.deleteObject(forKey: Key()) XCTAssertNil(sut.load(forKey: Key())) } func testClear_whenContentsOfDirectoryAreEmpty_isNil() throws { let url = URL(string: "20")! let sut = FileStorage<Key, String>(fileManager: .init(), documentsURL: url) sut.clear() XCTAssertNil(sut.load(forKey: Key())) } // MARK: - Helpers private struct Key: Hashable {} private func makeSUT() throws { fileManager = .init() mockEncoder = .init() storageCoder = StorageCoder( encoder: mockEncoder, decoder: Mocks.Decoder() ) sut = try Mocks.makeFileStorage( fileManager, filePath: fileKey, storageCoder: storageCoder ) } }
[ -1 ]
438d2570450837b04efd38fe5241df373e8e44da
5f081901008ee5e700360f5ae214de537acc2cf3
/Common/V2User.swift
041e57711646f7c7daf4d0bfbb61628ec1b2ae01
[ "MIT" ]
permissive
ilfocus/V2ex-Swift
7bca80512fbddcc09901b53751fe11047a73e126
07d3ef3fdd0109dd40218222fb9aaec6fb9b7fda
refs/heads/master
2020-04-04T12:53:13.718576
2019-09-30T02:04:05
2019-09-30T02:04:05
155,940,945
0
0
null
null
null
null
UTF-8
Swift
false
false
6,271
swift
// // V2User.swift // V2ex-Swift // // Created by skyline on 16/3/28. // Copyright © 2016年 Fin. All rights reserved. // import UIKit import Alamofire import Ji let kUserName = "me.fin.username" class V2User: NSObject { static let sharedInstance = V2User() /// 用户信息 fileprivate var _user:UserModel? var user:UserModel? { get { return self._user } set { //保证给user赋值是在主线程进行的 //原因是 有很多UI可能会监听这个属性,这个属性发生更改时,那些UI也会相应的修改自己,所以要在主线程操作 dispatch_sync_safely_main_queue { self._user = newValue self.username = newValue?.username } } } @objc dynamic var username:String? fileprivate var _once:String? //全局once字符串,用于用户各种操作,例如回帖 登录 。这些操作都需要用的once ,而且这个once是全局统一的 var once:String? { get { //取了之后就删掉, //因为once 只能使用一次,之后就不可再用了, let onceStr = _once _once = nil return onceStr; } set{ _once = newValue } } /// 返回 客户端显示是否有可用的once var hasOnce:Bool { get { return _once != nil && _once!.Lenght > 0 } } /// 通知数量 @objc dynamic var notificationCount:Int = 0 fileprivate override init() { super.init() dispatch_sync_safely_main_queue { self.setup() //如果客户端是登录状态,则去验证一下登录有没有过期 if self.isLogin { self.verifyLoginStatus() } } } func setup(){ self.username = V2EXSettings.sharedInstance[kUserName] } /// 是否登录 var isLogin:Bool { get { if let len = self.username?.Lenght , len > 0 { return true } else { return false } } } func ensureLoginWithHandler(_ handler:()->()) { guard isLogin else { V2Inform("请先登录") return; } handler() } /** 退出登录 */ func loginOut() { removeAllCookies() self.user = nil self.username = nil self.once = nil self.notificationCount = 0 //清空settings中的username V2EXSettings.sharedInstance[kUserName] = nil } /** 删除客户端所有cookies */ func removeAllCookies() { let storage = HTTPCookieStorage.shared if let cookies = storage.cookies { for cookie in cookies { storage.deleteCookie(cookie) } } } /** 打印客户端cookies */ func printAllCookies(){ let storage = HTTPCookieStorage.shared if let cookies = storage.cookies { for cookie in cookies { NSLog("name:%@ , value:%@ \n", cookie.name,cookie.value) } } } /** 获取once - parameter url: 有once存在的url @escaping 逃逸闭包 */ func getOnce(_ url:String = V2EXURL+"signin" , completionHandler: @escaping (V2Response) -> Void) { Alamofire.request(url, headers: MOBILE_CLIENT_HEADERS).responseJiHtml { (response) -> Void in if let jiHtml = response .result.value{ if let once = jiHtml.xPath("//*[@name='once'][1]")?.first?["value"]{ self.once = once completionHandler(V2Response(success: true)) return; } } completionHandler(V2Response(success: false)) } } /** 获取并更新通知数量 - parameter rootNode: 有Notifications 的节点 */ func getNotificationsCount(_ rootNode: JiNode) { //这里本想放在 JIHTMLResponseSerializer 自动获取。 //但我现在还不确定,是否每个每个页面的title都会带上 未读通知数量 //所以先交由 我确定会带的页面 手动获取 let notification = rootNode.xPath("//head/title").first?.content if let notification = notification { self.notificationCount = 0; /* NSRegularExpression 正则表达式类 throws抛出异常, 那么就必须通过try来处理 try : 标准的处理方式, 该方式必须结合do catch来处理 try? :告诉系统可能有错, 也可能没错, 如果发生错误, 那么返回nil, 如果没有发生错误, 会见数据包装成一个可选类型的值返回给我们,这种使用方式, 相当于忽略错误 try! : 告诉系统一定没错, 如果发生错误, 程序会崩溃. 不推荐使用 */ let regex = try! NSRegularExpression(pattern: "V2EX \\([0-9]+\\)", options: [.caseInsensitive]) regex.enumerateMatches(in: notification, options: [.withoutAnchoringBounds], range: NSMakeRange(0, notification.Lenght), using: { (result, flags, stop) -> Void in if let result = result { let startIndex = notification.index(notification.startIndex, offsetBy: result.range.location + 6) let endIndex = notification.index(notification.startIndex, offsetBy: result.range.location + result.range.length - 1) let count = notification[startIndex..<endIndex] if let acount = Int(count) { self.notificationCount = acount } } }) } } /** 验证客户端登录状态 */ func verifyLoginStatus() { Alamofire.request(V2EXURL + "new", headers: MOBILE_CLIENT_HEADERS).responseString(encoding: nil) { (response) -> Void in if response.response?.url?.path == "/signin"{ //没有登录 ,注销客户端 dispatch_sync_safely_main_queue({ () -> () in self.loginOut() }) } } } }
[ -1 ]
42054f957fc6701db28e773f338c46cad802a2cd
384bd49d1e496f16c31a1309f4cdce9d6440dc95
/Sources/GIF.swift
4938b86a858f416a694e4541d3666536fcab2afd
[ "MIT" ]
permissive
S2Ler/SwiftyImageIO
e9f228fee7bf6895104a47d72e6f475dc76cef5d
e69dfcd36cd678fb57c99d914a6df8776ff1a4f4
refs/heads/master
2022-08-16T19:30:49.081122
2022-06-27T10:42:40
2022-06-27T10:42:40
54,828,767
6
2
MIT
2022-07-21T22:06:58
2016-03-27T13:03:52
Swift
UTF-8
Swift
false
false
4,044
swift
#if canImport(UIKit) import Foundation import UIKit import MobileCoreServices import ImageIO public final class GIF { /// Errors for UIImage.makeGIF(atPath:) /// /// - InvalidPath: path parameter is incorrect file path /// - NotAnimatedImage: target image isn't animated image /// - InvalidImage: images do not have cgImage propery. CIImage backed UIImage not supported. Convert to CGImage first public enum MakeError: Error { case invalidPath case notAnimatedImage case invalidImage case imageIOError } public struct FrameProperties { var delayTime: TimeInterval? var imageColorMap: Data? // TODO: Wrap color maps var unclampedDelayTime: TimeInterval? public init(delayTime: TimeInterval? = nil, imageColorMap: Data? = nil, unclampedDelayTime: TimeInterval? = nil) { self.delayTime = delayTime self.imageColorMap = imageColorMap self.unclampedDelayTime = unclampedDelayTime } } public struct Properties { var loopCount: Int? var hasGlobalColorMap: Bool? public init(loopCount: Int? = nil, hasGlobalColorMap: Bool? = nil) { self.loopCount = loopCount self.hasGlobalColorMap = hasGlobalColorMap } } public init() { } public func makeGIF(fromAnimatedImage animatedImage: UIImage, writeTo path: String, properties: Properties? = nil, frameProperties: FrameProperties? = nil) throws { guard let images = animatedImage.images else { throw MakeError.notAnimatedImage } guard let imageDestination = ImageDestination(url: URL(fileURLWithPath: path), UTI: UTI(kUTTypeGIF), imageCount: images.count) else { throw MakeError.invalidPath } if let properties = properties { var imageDestinationProperties = ImageDestination.Properties() imageDestinationProperties.imageProperties = [properties] imageDestination.setProperties(imageDestinationProperties) } for image in images { guard let cgImage = image.cgImage else { throw MakeError.invalidImage } var frameImageDestinationProperties = ImageDestination.Properties() if let frameProperties = frameProperties { frameImageDestinationProperties.imageProperties = [frameProperties] } imageDestination.addImage(cgImage, properties: frameImageDestinationProperties) } let gifSaved = imageDestination.finalize() guard gifSaved else { throw MakeError.imageIOError } } } extension GIF.Properties: ImageProperties { public static var imageIOKey: CFString { return kCGImagePropertyGIFDictionary } public var cfValues: CFValues { return [ kCGImagePropertyGIFLoopCount: loopCount, kCGImagePropertyGIFHasGlobalColorMap: hasGlobalColorMap, ] } public init(_ cfValues: RawCFValues) { if let loopCount = cfValues[kCGImagePropertyGIFLoopCount] as? NSNumber { self.loopCount = loopCount.intValue } if let hasGlobalColorMap = cfValues[kCGImagePropertyGIFHasGlobalColorMap] as? NSNumber { self.hasGlobalColorMap = hasGlobalColorMap.boolValue } } } extension GIF.FrameProperties: ImageProperties { public static var imageIOKey: CFString { return kCGImagePropertyGIFDictionary } public var cfValues: CFValues { return [ kCGImagePropertyGIFDelayTime: delayTime, kCGImagePropertyGIFImageColorMap: imageColorMap, kCGImagePropertyGIFUnclampedDelayTime: unclampedDelayTime, ] } public init(_ cfValues: RawCFValues) { if let delayTime = cfValues[kCGImagePropertyGIFDelayTime] as? NSNumber { self.delayTime = delayTime.doubleValue } } } #endif
[ -1 ]
d9f914f55361619779036fb599336ad08e8a379b
025d8417cd86282b60877315513501c904e2516e
/iQuizUITests/iQuizUITests.swift
da95cc3c00cda6c42a4787fdd8fc601c0c0e04a0
[]
no_license
KitoPham/iQuiz
28501ac23d52bc2f729aef448bdc5e3c000092e2
d88a243de10e27c406f754d0f78835771ea46f42
refs/heads/master
2021-06-16T18:03:06.072421
2017-05-09T09:29:57
2017-05-09T09:29:57
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,239
swift
// // iQuizUITests.swift // iQuizUITests // // Created by Kito T. Pham on 5/1/17. // Copyright © 2017 Kito T. Pham. All rights reserved. // import XCTest class iQuizUITests: XCTestCase { override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. // In UI tests it is usually best to stop immediately when a failure occurs. continueAfterFailure = false // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. XCUIApplication().launch() // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } func testExample() { // Use recording to get started writing UI tests. // Use XCTAssert and related functions to verify your tests produce the correct results. } }
[ 333827, 182277, 243720, 282634, 313356, 155665, 305173, 241695, 223269, 229414, 292901, 354342, 315433, 102441, 325675, 313388, 354346, 124974, 282671, 102446, 229425, 278571, 243763, 241717, 321589, 229431, 180279, 215095, 213051, 288829, 325695, 286787, 288835, 307269, 237638, 313415, 285360, 239689, 233548, 311373, 278607, 196687, 311377, 354386, 223317, 315477, 354394, 368732, 180317, 323678, 321632, 315489, 315488, 45154, 280676, 313446, 227432, 215144, 233578, 194667, 307306, 217194, 278637, 319599, 288878, 278642, 284789, 131190, 288890, 292987, 215165, 131199, 227459, 194692, 235661, 278669, 333968, 241809, 323730, 278676, 311447, 153752, 327834, 284827, 329884, 299166, 278690, 233635, 311459, 215204, 333990, 299176, 278698, 323761, 184498, 278707, 125108, 180409, 278713, 295099, 258233, 299197, 280761, 280767, 227517, 223418, 299202, 139459, 309443, 176325, 131270, 301255, 299208, 338118, 227525, 280779, 233678, 227536, 282832, 301270, 229591, 301271, 280792, 147679, 147680, 325857, 311520, 356575, 280803, 182503, 319719, 307431, 338151, 317676, 286957, 125166, 125170, 395511, 313595, 125180, 184574, 125184, 309504, 217352, 125197, 194832, 227601, 125204, 319764, 278805, 338196, 315674, 282908, 299294, 125215, 282912, 233761, 278817, 311582, 211239, 282920, 125225, 317738, 334121, 325930, 311596, 338217, 321839, 336177, 315698, 98611, 125236, 307514, 282938, 127292, 168251, 278843, 287040, 311622, 227655, 280903, 319816, 323914, 201037, 383309, 282959, 229716, 250196, 289109, 323934, 391521, 239973, 313703, 285031, 416103, 280938, 242027, 242028, 321901, 354671, 278895, 287089, 250227, 199030, 227702, 315768, 139641, 291194, 291193, 248188, 223611, 313726, 211327, 291200, 311679, 158087, 313736, 227721, 242059, 106893, 285074, 227730, 240020, 190870, 190872, 291225, 317851, 293275, 285083, 283039, 227743, 285089, 289185, 293281, 305572, 156069, 301482, 289195, 375211, 377265, 334259, 338359, 299449, 311739, 319931, 293309, 278974, 336319, 311744, 317889, 291266, 336323, 278979, 129484, 289229, 281038, 326093, 278992, 283088, 278988, 281039, 283089, 279000, 242138, 176602, 285152, 291297, 279009, 369121, 195044, 160224, 242150, 279014, 188899, 279017, 311787, 334315, 281071, 319986, 236020, 279030, 293368, 279033, 311800, 317949, 279042, 233987, 324098, 287237, 283138, 322057, 334345, 309770, 340489, 342537, 279053, 299698, 182802, 283154, 303635, 279061, 279060, 303634, 279066, 322077, 291359, 342560, 293420, 236080, 283185, 289328, 279092, 23093, 234037, 244279, 244280, 338491, 234044, 340539, 309831, 322119, 55880, 377419, 303693, 281165, 301647, 281170, 326229, 309847, 189016, 115287, 244311, 332379, 287319, 111197, 295518, 287327, 283431, 242274, 244326, 279143, 279150, 281200, 287345, 313970, 287348, 301688, 189054, 287359, 297600, 303743, 291455, 301702, 164487, 311944, 334473, 344714, 279176, 316044, 184974, 311950, 316048, 326288, 316050, 287379, 311953, 336531, 227991, 289435, 303772, 221853, 205469, 285348, 314020, 340645, 295591, 279207, 176810, 295598, 279215, 318127, 248494, 293552, 279218, 287412, 166581, 285362, 154295, 164532, 342705, 287418, 303802, 314043, 66243, 291529, 287434, 225996, 363212, 287438, 135888, 242385, 303826, 164561, 279249, 369365, 369366, 279253, 158424, 230105, 299737, 322269, 338658, 342757, 295653, 289511, 230120, 330473, 234216, 285419, 330476, 289517, 279278, 312046, 215790, 125683, 230133, 199415, 342775, 234233, 242428, 279293, 322302, 289534, 205566, 299777, 35584, 228099, 285443, 375552, 291584, 291591, 295688, 322312, 285450, 346889, 312076, 326413, 285457, 295698, 166677, 207639, 283418, 285467, 221980, 234276, 336678, 318247, 262952, 262953, 279337, 318251, 289580, 262957, 293673, 164655, 301872, 242481, 303921, 328495, 234290, 230198, 301883, 342846, 289599, 281407, 295745, 222017, 293702, 318279, 283466, 281426, 279379, 295769, 201562, 244569, 234330, 281434, 275294, 301919, 230238, 293729, 279393, 357219, 281444, 303973, 279398, 351078, 349025, 177002, 308075, 242540, 242542, 310132, 295797, 201590, 207735, 295799, 228214, 177018, 269179, 279418, 336765, 308093, 314240, 291713, 158594, 330627, 340865, 240517, 287623, 228232, 416649, 279434, 316299, 320394, 252812, 234382, 308111, 299912, 308113, 293780, 310166, 289691, 209820, 277404, 240543, 283551, 310177, 289699, 189349, 289704, 293801, 326571, 177074, 304050, 326580, 289720, 326586, 289723, 189373, 213956, 359365, 19398, 345030, 281541, 213961, 127945, 279499, 211913, 56270, 191445, 304086, 183254, 183258, 207839, 340960, 314343, 304104, 123880, 340967, 183276, 320492, 203758, 320495, 234476, 248815, 287730, 277493, 240631, 320504, 214009, 201721, 312313, 312315, 312317, 234499, 418819, 293894, 330759, 230411, 330766, 140311, 293911, 316441, 238617, 197658, 326684, 336930, 315272, 113710, 189487, 281647, 322609, 318515, 312372, 203829, 238646, 300087, 238650, 320571, 21567, 308288, 160834, 336962, 349254, 238663, 300109, 207954, 234578, 250965, 296023, 205911, 339031, 156763, 277600, 281699, 285795, 230500, 250982, 322664, 228457, 318571, 279659, 234606, 300145, 238706, 312435, 187508, 279666, 300147, 230514, 302202, 285819, 314493, 285823, 234626, 279686, 222344, 285833, 285834, 318602, 228492, 337037, 234635, 162962, 187539, 347286, 308375, 324761, 285850, 296091, 119965, 302239, 234655, 330912, 339106, 306339, 234662, 300200, 249003, 238764, 322733, 3243, 208044, 302251, 279729, 294069, 324790, 300215, 294075, 64699, 228541, 339131, 343230, 283841, 148674, 283846, 279752, 283849, 148687, 290001, 189651, 316628, 279766, 189656, 279775, 304352, 298209, 304353, 339167, 310496, 279780, 228587, 279789, 290030, 302319, 234741, 283894, 316661, 230239, 208123, 292092, 279803, 228608, 320769, 234756, 322826, 242955, 312588, 177420, 126229, 318746, 320795, 320802, 130342, 304422, 130344, 130347, 292145, 298290, 208179, 312628, 345398, 159033, 222523, 286012, 181568, 294210, 216387, 286019, 193858, 279874, 372039, 300355, 304457, 230730, 345418, 337228, 296269, 222542, 224591, 238928, 234830, 296274, 331091, 314708, 318804, 150868, 283990, 357720, 300378, 300379, 294236, 292194, 230757, 281958, 134504, 306541, 314734, 327023, 234864, 312688, 296304, 284015, 230772, 314740, 314742, 327030, 290170, 224637, 306558, 290176, 243073, 179586, 306561, 337280, 294278, 314759, 296328, 298378, 296330, 318860, 314765, 368012, 9618, 279955, 306580, 314771, 224662, 234902, 282008, 314776, 112019, 292242, 318876, 282013, 290206, 343457, 148899, 298406, 282023, 245160, 241067, 279979, 314797, 279980, 286128, 279988, 173492, 284086, 286133, 259513, 284090, 302523, 310714, 228796, 54719, 302530, 280003, 228804, 310725, 306630, 292291, 300488, 415170, 306634, 280011, 302539, 300490, 310731, 339403, 337359, 329168, 222674, 312785, 329170, 280020, 234957, 310735, 280025, 310747, 239069, 144862, 286176, 187877, 310758, 280042, 280043, 191980, 300526, 329198, 337391, 282097, 296434, 308722, 40439, 288248, 286201, 300539, 288252, 210429, 312830, 359931, 286208, 290304, 245249, 228868, 292359, 218632, 230922, 302602, 323083, 294413, 359949, 304655, 323088, 329231, 282132, 230933, 302613, 316951, 175640, 374297, 302620, 313338, 282147, 222754, 306730, 312879, 288305, 239159, 290359, 323132, 235069, 157246, 288319, 288322, 280131, 349764, 310853, 124486, 194118, 288328, 282182, 292424, 292426, 286281, 333389, 349780, 230999, 290391, 306777, 128600, 196184, 235096, 239192, 212574, 99937, 204386, 323171, 300643, 300645, 282214, 294220, 312937, 224874, 243306, 204394, 138862, 206447, 310896, 294517, 314997, 288377, 290425, 339579, 337533, 325246, 235136, 280193, 288391, 286344, 323208, 282248, 179853, 286351, 188049, 239251, 229011, 323226, 179868, 229021, 302751, 282272, 198304, 245413, 282279, 298664, 212649, 298666, 286387, 300725, 286392, 302778, 306875, 280252, 296636, 282302, 280253, 286400, 323265, 323262, 280259, 321220, 282309, 321217, 239305, 296649, 306891, 280266, 302798, 9935, 241360, 282321, 313042, 286419, 333522, 241366, 280279, 282330, 18139, 294621, 280285, 282336, 325345, 294629, 153318, 337638, 333543, 12009, 181992, 282347, 288492, 282349, 323315, 67316, 300354, 286457, 284410, 313082, 200444, 288508, 282366, 286463, 319232, 278273, 288515, 249606, 282375, 323335, 284425, 280326, 282379, 116491, 216844, 284430, 300812, 280333, 161553, 124691, 278292, 118549, 116502, 282390, 284436, 278294, 325403, 321308, 282399, 241440, 282401, 341791, 339746, 315172, 186148, 186149, 216868, 241447, 325411, 286507, 294699, 284460, 280367, 300849, 282418, 280377, 319289, 282428, 280381, 345918, 413500, 280386, 325444, 280391, 153416, 315209, 325449, 159563, 280396, 307024, 325460, 237397, 307030, 18263, 341846, 188250, 300893, 307038, 370526, 237411, 276326, 282471, 296807, 292713, 292719, 296815, 313200, 325491, 313204, 124795, 339840, 280451, 327556, 188293, 325508, 282503, 243592, 305032, 325514, 333700, 67464, 350091, 350092, 184207, 124816, 311183, 315275, 282517, 294806, 350102, 214936, 294808, 337816, 239515, 333727, 298912, 319393, 214943, 294820, 118693, 333734, 219046, 284584, 294824, 313257, 298921, 292783, 126896, 300983, 343993, 288698, 98240, 294849, 214978, 280517, 214983, 282572, 282573, 153553, 24531, 231382, 323554, 292835, 190437, 292838, 294887, 317416, 313322, 298987, 174058, 311277, 296942, 124912, 327666, 278515, 325620, 239610 ]
f6dca06a1491760f9a9e48756994ebbb3243ef76
e89c0a9cd31c34dc90ec64a2797c7fe8e22e45db
/Sources/ScoutCLT/ColorDelegates/XMLInjectorColorDelegate.swift
3d824d829f752c0748ad1a4476eff7502afee59c
[ "MIT" ]
permissive
scriptingosx/scout
1fa61d7ee676dd8c163618c50426cb86b422b987
4cfbf67f83044b73f339c57618cebebbd3a072ca
refs/heads/master
2022-11-12T02:45:23.977566
2020-07-04T10:29:22
2020-07-04T10:29:22
277,564,461
4
0
MIT
2020-07-06T14:28:46
2020-07-06T14:28:45
null
UTF-8
Swift
false
false
976
swift
import Lux final class XMLInjectorColorDelegate: XMLEnhancedDelegate { // MARK: - Properties let colors: XmlColors // MARK: - Initialisation init(colors: XmlColors) { self.colors = colors } required init() { colors = XmlColors() super.init() } // MARK: - Functions override func terminalModifier(for category: XMLEnhancedCategory) -> TerminalModifier { var colorCode: Int? switch category { case .openingTag: colorCode = colors.openingTag case .closingTag: colorCode = colors.closingTag case .punctuation: colorCode = colors.punctuation case .key: colorCode = colors.key case .comment: colorCode = colors.comment case .header: colorCode = colors.header } if let code = colorCode { return TerminalModifier(colorCode: code) } else { return super.terminalModifier(for: category) } } }
[ -1 ]
d4fd9de9b2a02bc025c40c08ddebc98972377571
3fbcddd01f8694bc1ed39cceaab57b15fe21066a
/Sources/SmokeOperationsHTTP1/SmokeHTTP1HandlerSelector+nonblockingWithInputNoOutput.swift
bd7f5a6a4ac2a52d58b18d87dc2b69395be052ed
[ "Apache-2.0" ]
permissive
Eirias/smoke-framework
ad40118e7ac3a5c2e68250c36e128a7e2ef00bc0
643d08deb4a48b639610a0775cb0dbdee45d9cab
refs/heads/main
2023-05-14T14:40:04.337172
2021-06-08T17:11:49
2021-06-08T17:11:49
null
0
0
null
null
null
null
UTF-8
Swift
false
false
8,363
swift
// Copyright 2018-2021 Amazon.com, Inc. or its affiliates. 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. // A copy of the License is located at // // http://www.apache.org/licenses/LICENSE-2.0 // // or in the "license" file accompanying this file. This file 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. // // SmokeHTTP1HandlerSelector+nonblockingWithInputNoOutput.swift // SmokeOperationsHTTP1 // import Foundation import SmokeOperations import NIOHTTP1 import Logging public extension SmokeHTTP1HandlerSelector { /** Adds a handler for the specified uri and http method. - Parameters: - uri: The uri to add the handler for. - operation: the handler method for the operation. - allowedErrors: the errors that can be serialized as responses from the operation and their error codes. - inputLocation: the location in the incoming http request to decode the input from. */ mutating func addHandlerForOperation<InputType: ValidatableCodable, ErrorType: ErrorIdentifiableByDescription>( _ operationIdentifer: OperationIdentifer, httpMethod: HTTPMethod, operation: @escaping ((InputType, ContextType, @escaping (Swift.Error?) -> ()) throws -> ()), allowedErrors: [(ErrorType, Int)], inputLocation: OperationInputHTTPLocation) { func outputProvider(input: InputType, context: ContextType, completion: @escaping (Swift.Error?) -> ()) throws { try operation(input, context, completion) } // don't capture self let delegateToUse = defaultOperationDelegate func inputProvider(requestHead: DefaultOperationDelegateType.RequestHeadType, body: Data?) throws -> InputType { return try delegateToUse.getInputForOperation( requestHead: requestHead, body: body, location: inputLocation) } let handler = OperationHandler( serverName: serverName, operationIdentifer: operationIdentifer, reportingConfiguration: reportingConfiguration, inputProvider: inputProvider, operation: operation, allowedErrors: allowedErrors, operationDelegate: defaultOperationDelegate) addHandlerForOperation(operationIdentifer, httpMethod: httpMethod, handler: handler) } /** Adds a handler for the specified uri and http method. - Parameters: - uri: The uri to add the handler for. - operation: the handler method for the operation. - allowedErrors: the errors that can be serialized as responses from the operation and their error codes. - inputLocation: the location in the incoming http request to decode the input from. - operationDelegate: an operation-specific delegate to use when handling the operation. */ mutating func addHandlerForOperation<InputType: ValidatableCodable, ErrorType: ErrorIdentifiableByDescription, OperationDelegateType: HTTP1OperationDelegate>( _ operationIdentifer: OperationIdentifer, httpMethod: HTTPMethod, operation: @escaping ((InputType, ContextType, @escaping (Swift.Error?) -> ()) throws -> ()), allowedErrors: [(ErrorType, Int)], inputLocation: OperationInputHTTPLocation, operationDelegate: OperationDelegateType) where DefaultOperationDelegateType.RequestHeadType == OperationDelegateType.RequestHeadType, DefaultOperationDelegateType.InvocationReportingType == OperationDelegateType.InvocationReportingType, DefaultOperationDelegateType.ResponseHandlerType == OperationDelegateType.ResponseHandlerType { func outputProvider(input: InputType, context: ContextType, completion: @escaping (Swift.Error?) -> ()) throws { try operation(input, context, completion) } func inputProvider(requestHead: OperationDelegateType.RequestHeadType, body: Data?) throws -> InputType { return try operationDelegate.getInputForOperation( requestHead: requestHead, body: body, location: inputLocation) } let handler = OperationHandler( serverName: serverName, operationIdentifer: operationIdentifer, reportingConfiguration: reportingConfiguration, inputProvider: inputProvider, operation: operation, allowedErrors: allowedErrors, operationDelegate: operationDelegate) addHandlerForOperation(operationIdentifer, httpMethod: httpMethod, handler: handler) } /** Adds a handler for the specified uri and http method. - Parameters: - uri: The uri to add the handler for. - operation: the handler method for the operation. - allowedErrors: the errors that can be serialized as responses from the operation and their error codes. */ mutating func addHandlerForOperation<InputType: ValidatableOperationHTTP1InputProtocol, ErrorType: ErrorIdentifiableByDescription>( _ operationIdentifer: OperationIdentifer, httpMethod: HTTPMethod, operation: @escaping ((InputType, ContextType, @escaping (Swift.Error?) -> ()) throws -> ()), allowedErrors: [(ErrorType, Int)]) { func outputProvider(input: InputType, context: ContextType, completion: @escaping (Swift.Error?) -> ()) throws { try operation(input, context, completion) } let handler = OperationHandler( serverName: serverName, operationIdentifer: operationIdentifer, reportingConfiguration: reportingConfiguration, inputProvider: defaultOperationDelegate.getInputForOperation, operation: operation, allowedErrors: allowedErrors, operationDelegate: defaultOperationDelegate) addHandlerForOperation(operationIdentifer, httpMethod: httpMethod, handler: handler) } /** Adds a handler for the specified uri and http method. - Parameters: - uri: The uri to add the handler for. - operation: the handler method for the operation. - allowedErrors: the errors that can be serialized as responses from the operation and their error codes. - operationDelegate: an operation-specific delegate to use when handling the operation. */ mutating func addHandlerForOperation<InputType: ValidatableOperationHTTP1InputProtocol, ErrorType: ErrorIdentifiableByDescription, OperationDelegateType: HTTP1OperationDelegate>( _ operationIdentifer: OperationIdentifer, httpMethod: HTTPMethod, operation: @escaping ((InputType, ContextType, @escaping (Swift.Error?) -> ()) throws -> ()), allowedErrors: [(ErrorType, Int)], operationDelegate: OperationDelegateType) where DefaultOperationDelegateType.RequestHeadType == OperationDelegateType.RequestHeadType, DefaultOperationDelegateType.InvocationReportingType == OperationDelegateType.InvocationReportingType, DefaultOperationDelegateType.ResponseHandlerType == OperationDelegateType.ResponseHandlerType { func outputProvider(input: InputType, context: ContextType, completion: @escaping (Swift.Error?) -> ()) throws { try operation(input, context, completion) } let handler = OperationHandler( serverName: serverName, operationIdentifer: operationIdentifer, reportingConfiguration: reportingConfiguration, inputProvider: operationDelegate.getInputForOperation, operation: operation, allowedErrors: allowedErrors, operationDelegate: operationDelegate) addHandlerForOperation(operationIdentifer, httpMethod: httpMethod, handler: handler) } }
[ -1 ]
dcfb1c13b3eacf8fcaf7cc16020b6572a329f569
5ef4c8c90f083cc1a44c0dfcff80e32138bfd1af
/Greedy/Lemonade Change/lemonade-change.playground/Contents.swift
d72cc223e57591c9af833326452ad65ed9588434
[ "MIT" ]
permissive
jamirdurham/LeetCode
d361cbb7d6b17403cdcb7e4236f0a664955c87d9
8c9472437e543852c248f2ffe4e0e265b79df968
refs/heads/main
2023-07-06T17:27:05.899235
2021-08-11T15:30:34
2021-08-11T15:30:34
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,174
swift
import Foundation // https://leetcode.com/problems/lemonade-change/ class Solution { func lemonadeChange(_ bills: [Int]) -> Bool { var five = 0, ten = 0 for bill in bills { switch bill { case 5: five += 1 case 10: ten += 1 if five < 1 { return false } five -= 1 case 20: if five < 1 { return false } if ten < 1, five < 3 { return false } ten >= 1 ? (ten -= 1, five -= 1) : ((five -= 3),()) default: break } } return true } } import XCTest // Executed 4 tests, with 0 failures (0 unexpected) in 0.008 (0.010) seconds class Tests: XCTestCase { private let s = Solution() func test1() { XCTAssertEqual(s.lemonadeChange([5,5,5,10,20]), true) } func test2() { XCTAssertEqual(s.lemonadeChange([5,5,10]), true) } func test3() { XCTAssertEqual(s.lemonadeChange([10,10]), false) } func test4() { XCTAssertEqual(s.lemonadeChange([5,5,10,10,20]), false) } } Tests.defaultTestSuite.run()
[ -1 ]
2d4a1e56645375ca0681aa173ce2240dea2f7444
878e0f810595145973287405f8fb0a46902d3cf0
/GiphySearchIOS/GifNetwork.swift
39fb047ab248e366de9c67a8152032a52de5d08b
[]
no_license
KitsuneNoctus/GiphySearchIOS-HC
2f0c623164eb23ffc50415369c2a572d89abdede
b909621bbc1de9bcb1d0bc5e8bd2230f978dd682
refs/heads/master
2021-05-20T15:43:20.166252
2020-04-03T05:28:28
2020-04-03T05:28:28
252,352,973
0
0
null
null
null
null
UTF-8
Swift
false
false
1,833
swift
// // GifNetwork.swift // GiphySearchIOS // // Created by Henry Calderon on 4/2/20. // Copyright © 2020 Henry Calderon. All rights reserved. // import Foundation class GifNetwork{ let apiKey = "4MMozQ2mnQDodQHYjMSk2AfK71zHK6tb" /* Fetches gifs from the Giphy api -Parameter searchTerm: What we should query gifs of. */ func fetchGifs(searchTerm: String, completion: @escaping (_ response: GifArray?) -> Void) { // Create a GET url request let url = urlBuilder(searchTerm: searchTerm) var request = URLRequest(url: url) request.httpMethod = "GET" URLSession.shared.dataTask(with: request) { (data, response, error) in if let err = error { print("Error fetching from Giphy: ", err.localizedDescription) } do { // Decode the data into array of Gifs DispatchQueue.main.async { let object = try! JSONDecoder().decode(GifArray.self, from: data!) completion(object) } } }.resume() } /** Returns a url with our API key and search term - Parameter searchTerm: The string to search gifs of - Returns: URL of search term & api key */ func urlBuilder(searchTerm: String) -> URL { let apikey = apiKey var components = URLComponents() components.scheme = "https" components.host = "api.giphy.com" components.path = "/v1/gifs/search" components.queryItems = [ URLQueryItem(name: "api_key", value: apikey), URLQueryItem(name: "q", value: searchTerm), URLQueryItem(name: "limit", value: "10") // Edit limit to display more gifs ] return components.url! } }
[ -1 ]
91dae0117b1dfdf5948ef1961900cf1d7e1fbdd8
56924001e3334f5ecdf28fe5080e91f5aa1ebd6a
/ChatBySocket.IO/ChatBySocket.IO/ChatViewCell.swift
2758c406943dd05285ced52b9c507a4177edd6f4
[ "Apache-2.0" ]
permissive
iMazy/DemoBySwift
2c51e541e31065387d74aed02d0e6b899d2c93e9
173ceb71512c13d7b4bef520a4574be70e0b8a2a
refs/heads/master
2022-12-04T15:44:28.846787
2022-11-22T08:53:52
2022-11-22T08:53:52
89,046,336
10
2
Apache-2.0
2017-12-05T02:30:13
2017-04-22T05:18:44
Swift
UTF-8
Swift
false
false
581
swift
// // ChatViewCell.swift // ChatBySocket.IO // // Created by Mazy on 2017/5/2. // Copyright © 2017年 Mazy. All rights reserved. // import UIKit class ChatViewCell: UITableViewCell { @IBOutlet weak var messgeLabel: UILabel! @IBOutlet weak var dateLabel: 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 } }
[ 123678, 237551 ]
6ba31051cd7c842af02f50469f428ba7e919f253
51c1a13cdc293e395841ba399d3c1eeb90a61a1f
/RunnerMate/Model/MapViewModel.swift
9f0cd59a80450bad45e67ca083d70414c0a05b95
[]
no_license
Casben/RunnerMate
42c943f975a32ee84fc27fda15c4221c66070d75
c08a628936ef8ab4bf5dd84e4417361c0a4d508b
refs/heads/main
2023-05-30T23:27:37.469472
2021-06-22T15:37:32
2021-06-22T15:37:32
370,186,536
0
0
null
null
null
null
UTF-8
Swift
false
false
1,487
swift
// // MapVCViewModel.swift // RunnerMate // // Created by Herbert Dodge on 5/31/21. // import Foundation import CoreLocation class MapViewModel { //MARK: - Properties static let shared = MapViewModel() var savedCoordinates: CLLocationCoordinate2D? var runInProgress: Bool? //MARK: - Methods func saveRunData(withCoordinates coordinates: CLLocationCoordinate2D) { let latitude = coordinates.latitude let longitude = coordinates.longitude userDefaults.setValue(latitude, forKey: UserDefaultsKeys.latitude) userDefaults.setValue(longitude, forKey: UserDefaultsKeys.longitude) } func loadRunData() { guard let latitude = userDefaults.object(forKey: UserDefaultsKeys.latitude), let longitude = userDefaults.object(forKey: UserDefaultsKeys.longitude) else { return } savedCoordinates = CLLocationCoordinate2D(latitude: latitude as! CLLocationDegrees, longitude: longitude as! CLLocationDegrees) runInProgress = true } func checkIfRunDataExsists() -> Bool { guard (userDefaults.object(forKey: UserDefaultsKeys.latitude) != nil) && (userDefaults.object(forKey: UserDefaultsKeys.longitude) != nil) else { return false } return true } func reset() { userDefaults.removeObject(forKey: UserDefaultsKeys.latitude) userDefaults.removeObject(forKey: UserDefaultsKeys.longitude) savedCoordinates = nil } }
[ -1 ]
cbea5da58299b13ff19b42100feee7bce4bf9428
7381793eca92c45d1e4a94fc8217516de50c518f
/MyPlaces/PlaceTourist.swift
0ae41117ee116fd0bf6f29fe32bb62d856814399
[]
no_license
gclara27/MyPlaces
7a1a8ca8fb4c298472f22de74e82b967716dfd76
1fda9ff022c54999c2f93bcd296bdb9c4fed6f0d
refs/heads/master
2020-03-29T23:43:16.737379
2018-11-20T18:52:46
2018-11-20T18:52:46
150,485,685
0
0
null
null
null
null
UTF-8
Swift
false
false
1,334
swift
// // PlaceTourist.swift // MyPlaces // // Created by user145617 on 9/25/18. // Copyright © 2018 UOC. All rights reserved. // import Foundation class PlaceTourist: Place { enum CodingKeysTourist: String, CodingKey { case discountTourist } //Class properties var DiscountTourist:String = "" override init() { super.init() type = .TouristicPlace } init(name:String, description:String, discountTourist:String, image_in:Data) { super.init(type:.TouristicPlace, name:name, description:description, image_in:image_in) self.DiscountTourist = discountTourist } required convenience init(from decoder: Decoder) throws { self.init() try decode(from: decoder) } override func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeysTourist.self) try container.encode(DiscountTourist, forKey: .discountTourist) try super.encode(to: encoder) } override func decode(from decoder: Decoder) throws { try super.decode(from: decoder) let container = try decoder.container(keyedBy: CodingKeysTourist.self) DiscountTourist = try container.decode(String.self, forKey: .discountTourist) } }
[ -1 ]
78189451bc09a4fa25ff77d04cd8563aed98b3e7
c643487d84c0da1b66bfcf76b42238308eace9d4
/SpeechRecognizer/Recognizer/RecognizerViewController.swift
40e55f1346ca829633045f43af941993d90df3b8
[ "MIT" ]
permissive
AndreyMomot/SpeechRecognition
6e8a867097084f86f084d3cedac8e63c05db1c80
990a0d844bc1c2c538ea1cf4bd9ba690014063e0
refs/heads/master
2021-08-14T10:59:14.294025
2017-11-15T13:51:25
2017-11-15T13:51:25
110,839,220
1
0
null
null
null
null
UTF-8
Swift
false
false
5,285
swift
// // RecognizerViewController.swift // SpeechRecognizer // // Created by Andrei Momot on 11/15/17. // Copyright © 2017 Andrey Momot. All rights reserved. // import UIKit import Speech typealias RecognizerViewControllerType = MVCViewController<RecognizerModelProtocol, RecognizerViewProtocol, RecognizerRouter> class RecognizerViewController: RecognizerViewControllerType, SFSpeechRecognizerDelegate, RecognizerViewDelegate, RecognizerModelDelegate { // MARK: Initializers required public init(withView view: RecognizerViewProtocol!, model: RecognizerModelProtocol!, router: RecognizerRouter?) { super.init(withView: view, model: model, router: router) } private let speechRecognizer = SFSpeechRecognizer(locale: Locale.init(identifier: "en-US")) private var recognitionRequest: SFSpeechAudioBufferRecognitionRequest? private var recognitionTask: SFSpeechRecognitionTask? private let audioEngine = AVAudioEngine() // MARK: - View life cycle override public func viewDidLoad() { super.viewDidLoad() customView.delegate = self model.delegate = self speechAuth() } // MARK: - Speech Recognition Authorization Request func speechAuth() { customView.recordButton.isEnabled = false speechRecognizer?.delegate = self SFSpeechRecognizer.requestAuthorization { (authStatus) in var isButtonEnabled = false switch authStatus { case .authorized: isButtonEnabled = true case .denied: isButtonEnabled = false print("User denied access to speech recognition") case .restricted: isButtonEnabled = false print("Speech recognition restricted in this device") case .notDetermined: isButtonEnabled = false print("Speech recognition not yet authorized") } OperationQueue.main.addOperation { self.customView.recordButton.isEnabled = isButtonEnabled } } } func startRecording() { if recognitionTask != nil { recognitionTask?.cancel() recognitionTask = nil } let audioSession = AVAudioSession.sharedInstance() do { try audioSession.setCategory(AVAudioSessionCategoryRecord) try audioSession.setMode(AVAudioSessionModeMeasurement) try audioSession.setActive(true, with: .notifyOthersOnDeactivation) } catch { print("audioSession properties weren't set because of an error") } recognitionRequest = SFSpeechAudioBufferRecognitionRequest() guard let inputNode = audioEngine.inputNode else { fatalError("Audio engine has no input node") } guard let recognitionRequest = recognitionRequest else { fatalError("Unable to create an SFSpeechAudioBufferRecognitionRequest object") } recognitionRequest.shouldReportPartialResults = true recognitionTask = speechRecognizer?.recognitionTask(with: recognitionRequest, resultHandler: { (result, error) in var isFinal = false if result != nil { self.customView.recognizedTextView.text = result!.bestTranscription.formattedString isFinal = (result?.isFinal)! } if error != nil || isFinal { self.audioEngine.stop() inputNode.removeTap(onBus: 0) self.recognitionRequest = nil self.recognitionTask = nil self.customView.recordButton.isEnabled = true } }) let recordingFormat = inputNode.outputFormat(forBus: 0) inputNode.installTap(onBus: 0, bufferSize: 1024, format: recordingFormat) { (buffer, when) in self.recognitionRequest?.append(buffer) } audioEngine.prepare() do { try audioEngine.start() } catch { print("audioEngine couldn't start because of an error.") } self.customView.recognizedTextView.text = "Say something, I'm listening!" } // MARK: - SFSpeechRecognizerDelegate func speechRecognizer(_ speechRecognizer: SFSpeechRecognizer, availabilityDidChange available: Bool) { if available { customView.recordButton.isEnabled = true } else { customView.recordButton.isEnabled = false } } public func startRecognition(view: RecognizerViewProtocol) { if audioEngine.isRunning { audioEngine.stop() recognitionRequest?.endAudio() customView.recordButton.isEnabled = false customView.recordButton.setTitle("Start Recording", for: .normal) } else { startRecording() customView.recordButton.setTitle("Stop Recording", for: .normal) } } }
[ -1 ]
8fa9abfc77b31d330ec102989c17061edca6d75b
018125b227a51ec140a9e1cae1deca13d7269129
/Caster/EpisodeCell.swift
dd834b85d89046765c934fd092d7d6a4ceda4765
[]
no_license
conqtc/Caster
02f77409afadd6c35e9e2729ce58402372add7fb
1bb3edb0a3b6254e5dd61460e82808d4de1874bf
refs/heads/master
2021-08-26T08:11:16.753035
2017-11-22T10:51:20
2017-11-22T10:51:20
110,786,443
2
1
null
null
null
null
UTF-8
Swift
false
false
771
swift
// // EpisodeCell.swift // Caster // // Created by Alex Truong on 4/26/17. // Copyright © 2017 Alex Truong. All rights reserved. // import UIKit class EpisodeCell: UITableViewCell { @IBOutlet weak var dateLabel: UILabel! @IBOutlet weak var timeLabel: UILabel! @IBOutlet weak var titleLabel: UILabel! @IBOutlet weak var subtitleLabel: UILabel! override func awakeFromNib() { super.awakeFromNib() // Initialization code titleLabel.numberOfLines = 2 subtitleLabel.numberOfLines = 3 self.selectionStyle = .none } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } }
[ -1 ]
b1af287e58faea0e631e7c4691eff62b36d44d13
1366400e309921056c4448eff74b2db24d0924d6
/Learn to Code.playgroundbook/Contents/Chapters/Document1.playgroundchapter/Pages/Challenge2.playgroundpage/Sources/Assessments.swift
40ddc0b1f998e32e775e6207b6a1e3a993811f04
[]
no_license
myegos/iPadSwiftPlaygrounds
37fdcc46a894beace431c16d4d4e8c40592301de
501835093839883fda6ec6c4e8051d35a94490f6
refs/heads/master
2023-03-19T03:46:13.405782
2017-08-08T19:19:03
2017-08-08T19:19:03
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,881
swift
// // Assessments.swift // // Copyright (c) 2016 Apple Inc. All Rights Reserved. // let success = "### Incredible work! \nYou found all the bugs in the code! \n\n[Next Page](@next)" let solution = "```swift\nmoveForward()\nturnLeft()\nmoveForward()\nmoveForward()\ntoggleSwitch()\nmoveForward()\nmoveForward()\nmoveForward()\nmoveForward()\ncollectGem()\n```" import PlaygroundSupport public func assessmentPoint() -> AssessmentResults { let checker = ContentsChecker(contents: PlaygroundPage.current.text) var hints = [ "Sometimes a bug is just one out-of-place command. Think about which commands, in which order, will get you to the switch and the gem. Can you move one or more commands to make that happen?", "Imagine moving step by step through the puzzle world. Compare those moves to the existing commands to see what's gone wrong." ] let defaultContents = [ "moveForward", "moveForward", "moveForward", "turnLeft", "toggleSwitch", "moveForward", "moveForward", "moveForward", "collectGem", "moveForward" ] if checker.calledFunctions == defaultContents { hints[0] = "Byte toggled an **open** switch **closed**. This is a bug! Figure out how to rearrange the existing commands to toggle all switches open and collect the gem." } else if checker.numberOfStatements > 10 { hints[0] = "Adding more commands might not help here. Try rearranging your existing code by tapping on a command to select it, then drag it to a new location." } else if checker.numberOfStatements > 12 { hints[0] = "If you'd like to start over, tap the three dots at the top right, then select \"Reset Page...\"" } return updateAssessment(successMessage: success, failureHints: hints, solution: solution) }
[ -1 ]
f3b389e526290b49b648db31d7d29a80cec6cb12
e23b359a88f3ed3a63591a6ab07be6d1ba2cac73
/chapter4/5-1/5-1/GameScene.swift
39ddbdf0cc9893aef062891d1a3cdc4744236883
[ "Apache-2.0" ]
permissive
guo846773272/SpriteKit
51735c2caa71865b12680d5022fb9661f85b7a86
707e94f4be706d44fb632f36eee83df01ca98edf
refs/heads/master
2020-03-31T20:36:23.742335
2018-10-11T07:15:05
2018-10-11T07:15:05
152,547,154
0
0
null
null
null
null
UTF-8
Swift
false
false
1,036
swift
// // GameScene.swift // 5-1 // // Created by mengyang_guo on 2018/7/26. // Copyright © 2018年 gmy. All rights reserved. // import SpriteKit import GameplayKit class GameScene: SKScene { override func sceneDidLoad() { let sprite = SKSpriteNode(imageNamed: "1.jpg") sprite.position = CGPoint(x: self.frame.midX, y: self.frame.midY) addChild(sprite) } override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { let tempTouches = touches as NSSet let touch = tempTouches.anyObject() as? UITouch if touch?.tapCount == 1 { let sprite = SKSpriteNode(imageNamed: "11.jpg") sprite.position = CGPoint(x: self.frame.midX, y: self.frame.midY) addChild(sprite) } if touch?.tapCount == 2 { let sprite = SKSpriteNode(imageNamed: "22.jpg") sprite.position = CGPoint(x: self.frame.midX, y: self.frame.midY) addChild(sprite) } } }
[ -1 ]
fcc41ca5c8fe42725d66094e1ac93cd88f2bc119
5274b131a624c1caa50fa9d0a6e3971d1bb78dd6
/Coupons/Coupons/Extensions/StringExtension.swift
12143f647c1a89b880a09e854b042f55e8783c51
[]
no_license
hendelsisi/Shopping
3bb19f9ab8f650144463a4230015131101e3ada5
2c4a8e941f27ef52595220a0b21800096ea6bc6f
refs/heads/master
2020-03-18T23:08:12.584758
2018-07-17T20:42:02
2018-07-17T20:42:02
135,384,848
1
0
null
null
null
null
UTF-8
Swift
false
false
656
swift
// // File.swift // Coupons // // Created by hend elsisi on 5/15/18. // Copyright © 2018 hend elsisi. All rights reserved. // import Foundation extension String { public var replacedEnglishDigitsWithArabic: String { var str = self let map = ["0": "٠", "1": "١", "2": "٢", "3": "٣", "4": "٤", "5": "٥", "6": "٦", "7": "٧", "8": "٨", "9": "٩"] map.forEach { str = str.replacingOccurrences(of: $0, with: $1) } return str } }
[ -1 ]
5127aa2637dcb7de65c7dceb681266eee138c493
22b94168c364dab18deb074d87ec103311756e29
/WebApiPractices/CustomTableViewController.swift
7711de7d38f64fca672ce43467a788a2f1f0e6bc
[]
no_license
arifhasnatnstucsteonGit/Json-Data-Parse-Example-with-Alamofire-and-SwiftyJson-in-swift3
b73139b7531143617d75549e14c03447bcbd203c
b2eecf934dd09d78bcc708c5aa1b97fbfe267bf4
refs/heads/master
2021-01-25T05:43:53.659416
2017-02-03T19:31:40
2017-02-03T19:31:40
80,667,119
0
0
null
null
null
null
UTF-8
Swift
false
false
870
swift
// // CustomTableViewController.swift // WebApiPractices // // Created by Arif on 2/2/17. // Copyright © 2017 Arif. All rights reserved. // import UIKit class CustomTableViewController: 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. } /* // 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. } */ }
[ 277006, 282128, 286234, 317473, 295460, 284197, 286256, 286257, 300086, 279096, 288827, 226878, 286271, 159812, 228932, 288331, 288332, 284240, 280146, 200802, 292451, 276580, 356458, 307311, 284277, 284279, 188027, 284289, 278664, 278666, 227984, 303762, 282262, 117399, 276150, 277696, 227523, 228551, 280777, 279754, 284361, 298189, 229585, 226009, 298202, 298204, 280797, 298207, 363743, 282338, 294636, 234223, 289524, 280821, 288501, 280824, 358137, 358139, 280832, 230147, 226055, 287007, 277797, 282917, 283433, 282922, 282411, 289596, 280383, 300358, 234829, 298830, 279380, 279386, 289120, 308064, 228201, 279406, 291709, 280445, 290175, 275842, 183173, 226705, 310673, 226196, 227740, 294812, 277406, 289187, 284586, 297903, 230323, 278968, 127418, 281530, 278973, 291774, 295874, 10179, 289224, 281042, 311762, 163289, 279011, 311780, 286189, 277487, 293874, 227315, 277502 ]
8eb38f1e7e6b461b305f13716732fe9d598cf298
fa7689037e787d4ec4bc2f08ccf213f8a03098ec
/OctoPod/Model/CloudKitSync/CloudKitPrinterLogEntry.swift
7b1c92825d5196d5fba3ffca6d67cab1565a3aa6
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
gdombiak/OctoPod
daa086f6c8c3fb3f692e9d2be999b44230b65c56
f31a29db52f5e57c7f1e440489c692c0f27725b0
refs/heads/master
2023-05-26T21:46:58.102766
2023-05-22T03:17:23
2023-05-22T03:17:23
140,906,723
218
53
Apache-2.0
2023-05-01T04:00:12
2018-07-14T01:33:52
Swift
UTF-8
Swift
false
false
224
swift
import Foundation struct CloudKitPrinterLogEntry { // Date when entry was created var date: Date = Date() // Description about what happened that triggered the event var description: String = "" }
[ -1 ]
0469410d09d817a65f512746a21a554891e6c410
c734bbdea880eb73a313463e395c84f3908cd8fa
/Share a Tune/PostTableViewCell.swift
dc39330ca50b85a1dbdc4970ca02a8c8b6f07a7f
[]
no_license
AxelCardinaels/Share-a-Tune-app
708ff85fdb0217ec3679c30955f91029b8288a16
7f49e603c1240dae726d4a9bbfbf3bf25091ecd0
refs/heads/master
2021-01-10T20:38:37.818323
2015-06-15T15:45:53
2015-06-15T15:45:53
35,219,551
2
0
null
null
null
null
UTF-8
Swift
false
false
905
swift
// // PostTableViewCell.swift // Share a Tune // // Created by Axel Cardinaels on 24/05/15. // Copyright (c) 2015 Axel Cardinaels. All rights reserved. // import UIKit class PostTableViewCell: UITableViewCell { @IBOutlet var userProfil: UIImageView! @IBOutlet var username: UIButton! @IBOutlet var postLocation: UILabel! @IBOutlet var postTime: UILabel! @IBOutlet var postPicture: UIImageView! @IBOutlet var postPlay: UIButton! @IBOutlet var postTitle: UILabel! @IBOutlet var postArtist: UILabel! @IBOutlet var postItunes: UIButton! @IBOutlet var postDescription: UILabel! @IBOutlet var postDelete: UIButton! @IBOutlet var likesButton: UIButton! @IBOutlet var commentsButton: UIButton! @IBOutlet var unlikeButton: UIButton! @IBOutlet var iLikeButton: UIButton! }
[ -1 ]
155f2f282415abfb74f182b89a8891f18ac7b38c
6721b865e412bef327eac720bce7cff57f5d21c8
/NextShow/NextShow/Views/ShowCell.swift
6d4005f52f15edc6b15e354845aea291aaceb60f
[]
no_license
dschrijn/TestDrivenDevelopment
d411822b8943ca10d3b78ed21056a7f0f3935c54
b0195a7e92bf9f5c0b23abc737aa31fee0fb1c8f
refs/heads/master
2021-07-11T14:53:16.672144
2017-10-13T05:23:11
2017-10-13T05:23:11
106,204,592
0
0
null
null
null
null
UTF-8
Swift
false
false
352
swift
// // ShowCell.swift // NextShow // // Created by David A. Schrijn on 10/12/17. // Copyright © 2017 David A. Schrijn. All rights reserved. // import UIKit class ShowCell: UITableViewCell { func configShowCell(withShow: Show) { self.textLabel?.text = withShow.title self.detailTextLabel?.text = withShow.releaseDate } }
[ -1 ]
36011a27268e61d0febcaf363f4600f9e97bf43b
6191465ad21f900302a4508e60852c410adca047
/AquiTem3.0/DAOSellers.swift
730b8ef2bf333b6268f58a90d7fbfdafd15448de
[]
no_license
amandaaurita/AquiTem5.0
0b8c820ff433057394481ecf37c59a13afdc9bb1
94977181169a8d85df90d9604111c869331c8120
refs/heads/master
2021-01-25T12:09:14.807748
2015-04-09T14:08:07
2015-04-09T14:08:07
33,622,846
0
0
null
null
null
null
UTF-8
Swift
false
false
6,763
swift
// // DadosAcesso.swift // AquiTem3.0 // // Created by Amanda Aurita Araujo Fernandes on 3/25/15. // Copyright (c) 2015 Amanda Aurita Araujo Fernandes. All rights reserved. // import Foundation import UIKit public class DAOSellers { //MARK: FUNCOES BASICAS DE MANIPULACAO DE DADOS private func getJSON(urlToRequest: String) -> NSData { return NSData(contentsOfURL: NSURL(string: urlToRequest)!)! } private func parseyJSON(inputData: NSData) -> Dictionary<String, String> { var result : Dictionary<String, String> = Dictionary<String, String>() var error: NSError? let parsedObject: AnyObject? = NSJSONSerialization.JSONObjectWithData(inputData, options: NSJSONReadingOptions.MutableContainers, error: &error) result = parsedObject as Dictionary<String, String> return result } //MARK:FUNCOES PARA FRONT-END func getAllSellers() -> [Seller] { var vendedorList: [Seller] = [] let urlPath: String = "http://vacadormiu.zz.mu/getAllSellers.php?)" var DictionaryDeVendedors = parseyJSON(getJSON(urlPath)) var vendedorTemporario : Seller = Seller(login: "amandalinda", password:"123", photo: nil, name: "Amanda", category :"Doces", description : "coloque alguma descricao aqui",online: true) vendedorList.append(vendedorTemporario) for keys in DictionaryDeVendedors { var vendedorTemporario : Seller = Seller(login: DictionaryDeVendedors["login"], password: DictionaryDeVendedors["password"]!, photo: nil, name: DictionaryDeVendedors["name"]!, category :DictionaryDeVendedors["category"]!, description : DictionaryDeVendedors["description"]!,online: true) if(DictionaryDeVendedors["online"] == "sim") { vendedorTemporario.online = true; } else { vendedorTemporario.online = false; } vendedorList.append(vendedorTemporario) println(vendedorList) } return vendedorList //return self.fakeSellers() } func setSeller(vendedor:Seller) -> Bool { var login = vendedor.login var password = vendedor.password var name = vendedor.name var category = vendedor.category var description = vendedor.description var brand = vendedor.brand var phone = vendedor.phone var mainplace = vendedor.mainPlace var secundaryplace = vendedor.secondaryPlace var online = vendedor.online var onlineString : String if(online == true) { onlineString = "sim" }else { onlineString = "nao" } let url = NSURL(string: "http://vacadormiu.zz.mu/setSeller.php?login=\(login)&password=\(password)&name=\(name)&category=\(category)&description=\(description)&brand=\(brand)&phone=\(phone)&mainplace=\(mainplace)&secundaryplace=\(secundaryplace)&online=\(onlineString)") let task = NSURLSession.sharedSession().dataTaskWithURL(url!) { (data, response, error) in println(NSString(data: data, encoding: NSUTF8StringEncoding)) } task.resume() return false; } //TODO: criar updateSeller.php de modificar vendedor de acordo com os campos citados no metodo - ok func updateSeller(login:String, nomeDoCampoQueSeraMudado:String, valorDoCampoQueSeraMudado:String) -> Bool { let url = NSURL(string: "http://cavadormiu.zz.mu/updateSeller.php?login=\(login)&nomeDoCampoQueSeraMudado=\(nomeDoCampoQueSeraMudado)&valorDoCampoQueSeraMudado=\(valorDoCampoQueSeraMudado)") let task = NSURLSession.sharedSession().dataTaskWithURL(url!) { (data, response, error) in println(NSString(data: data, encoding: NSUTF8StringEncoding)) } task.resume() return false; } } // func verifyLogin(username:String, password:String) -> Bool // { // var sellers = getAllSellers() // for index in 0..<sellers.count{ // if(sellers[index].name == username){ // return true // }else{ // return false // } // } // // func getSeller(username:String) ->Seller // { // var sellers: [Seller] = self.getAllSellers() // var result: Seller? // for index in 0..<sellers.count{ // if(sellers[index].name == username){ // result = sellers[index] // } // } // return result! // } //MARK: FUNCAO VENDEDORES FALSOS func fakeSellers() -> [Seller] { var Mateus:Seller = Seller(login: "Mateus", password: "Mateus", photo:UIImage(named:"Mateus.png")!, name: "Mateus", category: "Quentinha", description: "Vendo quentinhas baratas, apenas 7 reais", online: true) Mateus.brand = "Marmitas Boladas" Mateus.phone = "99416-8032" Mateus.mainPlace = "Ed. Cardeal Leme" Mateus.mainPlace = "Cardeal Leme" Mateus.secondaryPlace = "Sala 252" var Amanda:Seller = Seller(login: "Amanda", password: "Amanda", photo:UIImage(named:"Amanda.png")!, name: "Amanda", category: "Doce", description: "Os únicos docinhos reais do aplicativo", online: true) Amanda.brand = "Tutti Doces" Amanda.phone = "99416-8032" Amanda.mainPlace = "Ed. Frings" Amanda.mainPlace = "Frings e Kennedy" Amanda.secondaryPlace = "Sala 103" var Mayara:Seller = Seller(login: "Mayara", password: "Mayara", photo:UIImage(named:"Mayara.png")!, name: "Mayara", category: "Maromba", description: "Variedade de comida, tudo com Whey!", online: true) Mayara.brand = "Maromba Food" Mayara.phone = "99416-8032" Mayara.mainPlace = "Ed. Frings" Mayara.mainPlace = "Frings e Kennedy" Mayara.secondaryPlace = "Bandejão" var Emanoel:Seller = Seller(login: "Emanoel", password: "Emanoel", photo:UIImage(named:"Emanoel.png")!, name: "Emanoel", category: "Suco", description: "Sucos mofados por apenas 2,50", online: true) Emanoel.brand = "Sucos Mofados" Emanoel.phone = "99416-8032" Emanoel.mainPlace = "Ed. Kennedy" Emanoel.mainPlace = "Vila" Emanoel.secondaryPlace = "Pilotis" return [Mateus, Amanda, Mayara, Emanoel] }
[ -1 ]
9f443826d606228a993a7318984d96b802d1c3c2
6aa08eb067c180f7dfedcefbb38e38752bfb25c0
/CohesiveU/WelcomeiPadViewController.swift
02584e40f4c73f375fe97e89880a32c7f75957e0
[]
no_license
sebastianserrano/cohesive
658f5765324b7e60829462f8fd91837ea66c7248
2750ef437b67471297dd21e2815d960c5357454f
refs/heads/master
2021-07-09T21:00:55.780119
2019-06-15T02:44:39
2019-06-15T02:44:39
191,657,616
0
0
null
null
null
null
UTF-8
Swift
false
false
3,206
swift
// // WelcomeiPadViewController.swift // CohesiveU // // Created by Sebastian Serrano on 2016-10-10. // Copyright © 2016 Serranos Fund. All rights reserved. // import UIKit import Firebase import Batch class WelcomeiPadViewController: UIViewController { @IBOutlet weak var Logo: UIImageView! @IBOutlet weak var Username: UITextField! @IBOutlet weak var Password: UITextField! var usernameUser: String? var passwordUser: String? override func viewDidLoad() { super.viewDidLoad() BackgroundiPad(self) self.hideKeyboardWhenTappedAround() Password.addTarget(self, action: #selector(signIn), for: .editingDidEndOnExit) Logo.layer.cornerRadius = 5 } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } @IBAction func Login(_ sender: AnyObject) { if !(firstConnection) { FIRDatabase.database().persistenceEnabled = true firstConnection = true } signIn() } fileprivate func loginUser(_ email: String, password: String) { let trimmedEmail = trimString(email) let trimmedPassword = trimString(password) FIRAuth.auth()?.signIn(withEmail: trimmedEmail, password: trimmedPassword) { (user, error) in self.Password.text = "" if user != nil { BACKGROUNDQUEUE.async{ if getDefault("user_name") == nil { saveDefaults(FIRAuth.auth()?.currentUser!.displayName as AnyObject, forKey: "user_name") } if (pushEnabled) { let editor = BatchUser.editor() editor.setIdentifier(FIRAuth.auth()?.currentUser!.uid) editor.save() } MAINQUEUE.async { ProgressHUD.dismiss() // Navigate to Protected Page let appDelegate:AppDelegate = UIApplication.shared.delegate as! AppDelegate appDelegate.buildUserInterface() } } } else { ProgressHUD.showError("Sorry, Couldnt login user...Please try again") } } } @objc fileprivate func signIn () { guard (REACHABLE.connectedToNetwork()) else {ProgressHUD.showError("You appear to be offline, please connect your device in order to Log in");return} if Username.text != "" && Password.text != "" { self.usernameUser = Username.text self.passwordUser = Password.text ProgressHUD.show("Logging in...") //login user loginUser(usernameUser!, password: passwordUser!) } else { //show an error to user ProgressHUD.showError("Username and password are required") } } }
[ -1 ]
566457fecdd57adcea4102baaf59c9e5aebd4b77
9238ccbfcf3a25ef0b3749694413133da0edc306
/testProject/testProject/View/TodayView.swift
dbd9c88e57e5cfe1cffc582ff4ff1583fa8870b4
[]
no_license
karimRS/MVCWeather
3969d280f5abe83e6d5828788738ef5e5a837f62
e7b8ff7525eaf0ba050daf4fb8a303cff7030ad6
refs/heads/master
2020-09-09T18:24:03.544314
2016-08-17T19:50:09
2016-08-17T19:50:09
65,936,310
0
0
null
null
null
null
UTF-8
Swift
false
false
1,892
swift
// // TodayView.swift // testProject // // Created by Karim on 15/08/16. // Copyright © 2016 Karim. All rights reserved. // import UIKit let semiBoldLittleFont = UIFont(name: "ProximaNova-Semibold", size: 15) let semiBoldBigFont = UIFont(name: "ProximaNova-Semibold", size: 19) let RegularFont = UIFont(name: "ProximaNova-Regular", size: 25) class TodayView: UIView { @IBOutlet var mainImage: UIImageView! @IBOutlet var cityNameLabel: UILabel! @IBOutlet var weatherLabel: UILabel! @IBOutlet var pressureLabel: UILabel! @IBOutlet var precipitationLabel: UILabel! @IBOutlet var rainprobabilityLabel: UILabel! @IBOutlet var windLabel: UILabel! @IBOutlet var directionLabel: UILabel! @IBOutlet var shareButton: UIButton! override func awakeFromNib() { super.awakeFromNib() cityNameLabel.font = semiBoldBigFont weatherLabel.font = regularFont pressureLabel.font = semiBoldLittleFont pressureLabel.adjustsFontSizeToFitWidth = true rainprobabilityLabel.font = semiBoldLittleFont precipitationLabel.font = semiBoldLittleFont windLabel.font = semiBoldLittleFont directionLabel.font = semiBoldLittleFont shareButton.titleLabel!.font = semiBoldBigFont } func updateTodayElements(today: Today){ weatherLabel.text = today.weather pressureLabel.text = String(today.pressure) precipitationLabel.text = String(today.precipitation) windLabel.text = String(today.wind) rainprobabilityLabel.text = String(today.rainProbability) directionLabel.text = today.direction mainImage.image = UIImage(named: Today.codeToImage(today.imageCode)) } func updateLocationsElements(locality: String, country: String) { cityNameLabel.text = locality + ", " + country } }
[ -1 ]
eec550a86d47565202cb8502fb8413a20ba84165
7f416ca4d79a647e81cfdf64f08ceb5a6346ed74
/bluerer/ViewController.swift
9bd7f88928d7ab227c3638b4298b4f9b54a133d2
[]
no_license
anthrgrnwrld/blurer
52ff65c8d8ce4c53d53bd5fe505c1ac83843da8d
89be19cc61b0b21cfb33c49eb55b996f8bcee8a1
refs/heads/master
2018-01-08T14:56:13.053548
2016-04-26T22:49:30
2016-04-26T22:49:30
55,016,278
1
1
null
2016-04-05T10:43:43
2016-03-29T22:59:26
Swift
UTF-8
Swift
false
false
3,236
swift
// // ViewController.swift // bluerer // // Created by Masaki Horimoto on 2016/03/22. // Copyright © 2016年 Masaki Horimoto. All rights reserved. // import UIKit class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate { 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. } /** Cameraボタンを押した時 */ @IBAction func pressCameraButton(sender: AnyObject) { print("\(NSStringFromClass(self.classForCoder)).\(#function) is called!") } /** Photo Libraryボタンを押した時 */ @IBAction func pressLibraryButton(sender: AnyObject) { //print("\(NSStringFromClass(self.classForCoder)).\(__FUNCTION__) is called!") shiftToImagePickerController() //ImagePickerControllerに遷移する } /** ImagePickerControllerに遷移する */ func shiftToImagePickerController() { //print("\(NSStringFromClass(self.classForCoder)).\(#function) is called!") //Libraryにアクセス出来るか確認. 出来なければreturn. guard UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary) else { print("Cannot access PhotoLibrary.") return } let imagePickerController = UIImagePickerController() //ImagePickerCOntrollerをインスタンス化 imagePickerController.delegate = self //delegateを自身に設定 imagePickerController.sourceType = .PhotoLibrary //カメラとライブラリのどちらを表示するか. 今回はライブラリを表示 //imagePickerControllerに遷移 self.presentViewController(imagePickerController, animated: true, completion: nil) } func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo: [String : AnyObject]) { //print("\(NSStringFromClass(self.classForCoder)).\(#function) is called!") //ImagePickerControllerで選択した写真にアクセス出来るか確認. 出来なければFatalError. guard let image = didFinishPickingMediaWithInfo[UIImagePickerControllerOriginalImage] as? UIImage else { fatalError("originalImage is invalid.") } //editViewControllerをインスタンス化出来きるか確認. 出来なければFatalError. guard let editViewController = storyboard?.instantiateViewControllerWithIdentifier("EditViewController") as? EditViewController else { fatalError("EditViewController is invalid.") } editViewController.image = image //選択した写真の遷移後のviewControllerでの表示準備 picker.pushViewController(editViewController, animated: true) //EditViewControllerへ遷移 } }
[ -1 ]
23c6e68dc174705f782864bd79a3f2ea856d9242
19648ecc8b895c8ac574316f0c8c017c0937676f
/SwiftOpsExample/Post.swift
27a30322f954b3418f020aab661a11b1aa75b308
[ "MIT" ]
permissive
kalebriley/SwiftOps
565b8b0e9158e9126e48a4eaca1248446c1b45a6
06c0ce5765fa7ae75a43ded685f75285bb02c709
refs/heads/master
2021-01-22T19:49:11.281137
2016-12-13T07:37:13
2016-12-13T07:37:13
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,350
swift
// // Post.swift // SwiftOpsExample // // Created by Daniel Hall on 9/16/16. // Copyright © 2016 Daniel Hall. All rights reserved. // import Foundation struct Post { let postID:UInt let userID:UInt let title:String let body:String static func fromDictionary(_ dictionary:[String:AnyObject]) throws -> Post { if let postID = dictionary["id"] as? NSNumber, let userID = dictionary["userId"] as? NSNumber, let title = dictionary["title"] as? String, let body = dictionary["body"] as? String { return Post(postID:postID.uintValue, userID:userID.uintValue, title:title.uppercased(), body:body) } throw SimpleError(message:"Post.fromDictionary received an invalid dictionary to parse") } } extension Post { struct PostOperations { static private var postsCache:[Post]? static var postsFromJSON = Operation<JSON, [Post]>.sync { do { switch $0 { case .Array(let contents) : return try contents.map { try Post.fromDictionary($0) } case .Dictionary(let contents) : return try [Post.fromDictionary(contents)] } } catch { throw(error) } } private static var postsFromCache = Operation<Void, [Post]>.sync { if let posts = postsCache, posts.count > 0 { return posts } throw SimpleError(message:"No cached Posts") } private static var cachePosts = Operation<[Post], [Post]>.sync { postsCache = $0 return $0 } // First try to get posts from cache, if that fails retrieve them from server. Cache any successful results right before returning them. static var fetchAllPosts = postsFromCache.or( URLRequest.operations.urlRequestFromString .using(input: "http://jsonplaceholder.typicode.com/posts/") .then(Data.operations.dataFromURLRequest) .then(JSON.operations.jsonFromData) .then(Post.operations.postsFromJSON) ).then(cachePosts) } static var operations:PostOperations.Type { return PostOperations.self } }
[ -1 ]
39b28e08cc1a5d5bd2753c6d6b4766d2fd21d923
58a2995dd249b73813a4be2c16c552d7f5620bfe
/compute/resource-manager/Sources/compute/data/SshConfigurationData.swift
7b99b92736aa34744fb4e56fcfd8c0fb34fd3a8a
[ "MIT" ]
permissive
Azure/azure-libraries-for-swift
e577d83d504f872cf192c31d97d11edafc79b8be
b7321f3c719c381894e3ee96c5808dbcc97629d7
refs/heads/master
2023-05-30T20:22:09.906482
2021-02-01T09:29:10
2021-02-01T09:29:10
106,317,605
9
5
MIT
2021-02-01T09:29:11
2017-10-09T18:02:45
Swift
UTF-8
Swift
false
false
1,453
swift
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // // Code generated by Microsoft (R) AutoRest Code Generator. import Foundation import azureSwiftRuntime internal struct SshConfigurationData : SshConfigurationProtocol { public var publicKeys: [SshPublicKeyProtocol?]? enum CodingKeys: String, CodingKey {case publicKeys = "publicKeys" } public init() { } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) if container.contains(.publicKeys) { self.publicKeys = try container.decode([SshPublicKeyData?]?.self, forKey: .publicKeys) } if var pageDecoder = decoder as? PageDecoder { if pageDecoder.isPagedData, let nextLinkName = pageDecoder.nextLinkName { pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName) } } } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) if self.publicKeys != nil {try container.encode(self.publicKeys as! [SshPublicKeyData?]?, forKey: .publicKeys)} } } extension DataFactory { public static func createSshConfigurationProtocol() -> SshConfigurationProtocol { return SshConfigurationData() } }
[ -1 ]
e5f5e442d62dfe39d381afd7584c5b791005c43b
b984b19a8e5f1631348bb54d0c5bb6dbdcbae677
/CDWorkout+CoreDataProperties.swift
485b95703d39d6904da2f6af4b1e5e9d08a034e9
[]
no_license
noahbino/databaseProject
f70079c190b7c8022d2929283bf6aecf41cefe90
451e63ec334e2f7512f22aedd489213a45e2330c
refs/heads/master
2021-02-11T08:24:35.908771
2020-06-14T15:33:03
2020-06-14T15:33:03
244,472,288
0
0
null
2020-06-14T15:33:04
2020-03-02T20:49:22
Swift
UTF-8
Swift
false
false
1,141
swift
// // CDWorkout+CoreDataProperties.swift // // // Created by Noah Iarrobino on 5/5/20. // // import Foundation import CoreData extension CDWorkout { @nonobjc public class func fetchRequest() -> NSFetchRequest<CDWorkout> { return NSFetchRequest<CDWorkout>(entityName: "CDWorkout") } @NSManaged public var date: String? @NSManaged public var endTime: String? @NSManaged public var notes: String? @NSManaged public var sessionKey: String? @NSManaged public var startTime: String? @NSManaged public var rpe: String? @NSManaged public var userKey: String? @NSManaged public var workoutID: String? @NSManaged public var exercises: NSSet? } // MARK: Generated accessors for exercises extension CDWorkout { @objc(addExercisesObject:) @NSManaged public func addToExercises(_ value: CDExercise) @objc(removeExercisesObject:) @NSManaged public func removeFromExercises(_ value: CDExercise) @objc(addExercises:) @NSManaged public func addToExercises(_ values: NSSet) @objc(removeExercises:) @NSManaged public func removeFromExercises(_ values: NSSet) }
[ -1 ]
756a4ad9911e03dce603ccd4ceafaec2e5a33c6b
0b94e8098fd8a703f6e4c65edd345fb0a93f6ec4
/Swift核心技术与实战/geektime/geektime/R.generated.swift
0e85faeb72c254862a94cd25a66b728abbaf1471
[]
no_license
stonesun1314/geektime
9325cfdb50924d5237bd26bb2ad7228954700ac1
2ce57dbc35d38db8dc7874c02fd2d082a1ac5ea0
refs/heads/master
2020-08-08T21:01:32.329272
2020-01-06T13:43:11
2020-01-06T13:43:11
213,917,431
0
0
null
null
null
null
UTF-8
Swift
false
false
17,926
swift
// // This is a generated file, do not edit! // Generated by R.swift, see https://github.com/mac-cain13/R.swift // import Foundation import Rswift import UIKit /// This `R` struct is generated and contains references to static resources. struct R: Rswift.Validatable { fileprivate static let applicationLocale = hostingBundle.preferredLocalizations.first.flatMap(Locale.init) ?? Locale.current fileprivate static let hostingBundle = Bundle(for: R.Class.self) static func validate() throws { try intern.validate() } /// This `R.file` struct is generated, and contains static references to 19 files. struct file { /// Resource file `[email protected]`. static let book2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: "book@2x", pathExtension: "png") /// Resource file `[email protected]`. static let defaultAvatar2xJpg = Rswift.FileResource(bundle: R.hostingBundle, name: "defaultAvatar@2x", pathExtension: "jpg") /// Resource file `[email protected]`. static let detailBg2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: "detailBg@2x", pathExtension: "png") /// Resource file `[email protected]`. static let home2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: "home@2x", pathExtension: "png") /// Resource file `[email protected]`. static let home_selected2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: "home_selected@2x", pathExtension: "png") /// Resource file `[email protected]`. static let icon_between2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: "icon_between@2x", pathExtension: "png") /// Resource file `[email protected]`. static let icon_cal2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: "icon_cal@2x", pathExtension: "png") /// Resource file `[email protected]`. static let icon_column2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: "icon_column@2x", pathExtension: "png") /// Resource file `[email protected]`. static let icon_course2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: "icon_course@2x", pathExtension: "png") /// Resource file `[email protected]`. static let icon_document2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: "icon_document@2x", pathExtension: "png") /// Resource file `[email protected]`. static let icon_life2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: "icon_life@2x", pathExtension: "png") /// Resource file `[email protected]`. static let icon_live2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: "icon_live@2x", pathExtension: "png") /// Resource file `[email protected]`. static let icon_phone2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: "icon_phone@2x", pathExtension: "png") /// Resource file `[email protected]`. static let icon_pwd2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: "icon_pwd@2x", pathExtension: "png") /// Resource file `[email protected]`. static let icon_right_arrow2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: "icon_right_arrow@2x", pathExtension: "png") /// Resource file `[email protected]`. static let logo2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: "logo@2x", pathExtension: "png") /// Resource file `[email protected]`. static let mine2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: "mine@2x", pathExtension: "png") /// Resource file `[email protected]`. static let mine_selected2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: "mine_selected@2x", pathExtension: "png") /// Resource file `[email protected]`. static let student2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: "student@2x", pathExtension: "png") /// `bundle.url(forResource: "book@2x", withExtension: "png")` static func book2xPng(_: Void = ()) -> Foundation.URL? { let fileResource = R.file.book2xPng return fileResource.bundle.url(forResource: fileResource) } /// `bundle.url(forResource: "defaultAvatar@2x", withExtension: "jpg")` static func defaultAvatar2xJpg(_: Void = ()) -> Foundation.URL? { let fileResource = R.file.defaultAvatar2xJpg return fileResource.bundle.url(forResource: fileResource) } /// `bundle.url(forResource: "detailBg@2x", withExtension: "png")` static func detailBg2xPng(_: Void = ()) -> Foundation.URL? { let fileResource = R.file.detailBg2xPng return fileResource.bundle.url(forResource: fileResource) } /// `bundle.url(forResource: "home@2x", withExtension: "png")` static func home2xPng(_: Void = ()) -> Foundation.URL? { let fileResource = R.file.home2xPng return fileResource.bundle.url(forResource: fileResource) } /// `bundle.url(forResource: "home_selected@2x", withExtension: "png")` static func home_selected2xPng(_: Void = ()) -> Foundation.URL? { let fileResource = R.file.home_selected2xPng return fileResource.bundle.url(forResource: fileResource) } /// `bundle.url(forResource: "icon_between@2x", withExtension: "png")` static func icon_between2xPng(_: Void = ()) -> Foundation.URL? { let fileResource = R.file.icon_between2xPng return fileResource.bundle.url(forResource: fileResource) } /// `bundle.url(forResource: "icon_cal@2x", withExtension: "png")` static func icon_cal2xPng(_: Void = ()) -> Foundation.URL? { let fileResource = R.file.icon_cal2xPng return fileResource.bundle.url(forResource: fileResource) } /// `bundle.url(forResource: "icon_column@2x", withExtension: "png")` static func icon_column2xPng(_: Void = ()) -> Foundation.URL? { let fileResource = R.file.icon_column2xPng return fileResource.bundle.url(forResource: fileResource) } /// `bundle.url(forResource: "icon_course@2x", withExtension: "png")` static func icon_course2xPng(_: Void = ()) -> Foundation.URL? { let fileResource = R.file.icon_course2xPng return fileResource.bundle.url(forResource: fileResource) } /// `bundle.url(forResource: "icon_document@2x", withExtension: "png")` static func icon_document2xPng(_: Void = ()) -> Foundation.URL? { let fileResource = R.file.icon_document2xPng return fileResource.bundle.url(forResource: fileResource) } /// `bundle.url(forResource: "icon_life@2x", withExtension: "png")` static func icon_life2xPng(_: Void = ()) -> Foundation.URL? { let fileResource = R.file.icon_life2xPng return fileResource.bundle.url(forResource: fileResource) } /// `bundle.url(forResource: "icon_live@2x", withExtension: "png")` static func icon_live2xPng(_: Void = ()) -> Foundation.URL? { let fileResource = R.file.icon_live2xPng return fileResource.bundle.url(forResource: fileResource) } /// `bundle.url(forResource: "icon_phone@2x", withExtension: "png")` static func icon_phone2xPng(_: Void = ()) -> Foundation.URL? { let fileResource = R.file.icon_phone2xPng return fileResource.bundle.url(forResource: fileResource) } /// `bundle.url(forResource: "icon_pwd@2x", withExtension: "png")` static func icon_pwd2xPng(_: Void = ()) -> Foundation.URL? { let fileResource = R.file.icon_pwd2xPng return fileResource.bundle.url(forResource: fileResource) } /// `bundle.url(forResource: "icon_right_arrow@2x", withExtension: "png")` static func icon_right_arrow2xPng(_: Void = ()) -> Foundation.URL? { let fileResource = R.file.icon_right_arrow2xPng return fileResource.bundle.url(forResource: fileResource) } /// `bundle.url(forResource: "logo@2x", withExtension: "png")` static func logo2xPng(_: Void = ()) -> Foundation.URL? { let fileResource = R.file.logo2xPng return fileResource.bundle.url(forResource: fileResource) } /// `bundle.url(forResource: "mine@2x", withExtension: "png")` static func mine2xPng(_: Void = ()) -> Foundation.URL? { let fileResource = R.file.mine2xPng return fileResource.bundle.url(forResource: fileResource) } /// `bundle.url(forResource: "mine_selected@2x", withExtension: "png")` static func mine_selected2xPng(_: Void = ()) -> Foundation.URL? { let fileResource = R.file.mine_selected2xPng return fileResource.bundle.url(forResource: fileResource) } /// `bundle.url(forResource: "student@2x", withExtension: "png")` static func student2xPng(_: Void = ()) -> Foundation.URL? { let fileResource = R.file.student2xPng return fileResource.bundle.url(forResource: fileResource) } fileprivate init() {} } /// This `R.image` struct is generated, and contains static references to 19 images. struct image { /// Image `book`. static let book = Rswift.ImageResource(bundle: R.hostingBundle, name: "book") /// Image `defaultAvatar.jpg`. static let defaultAvatarJpg = Rswift.ImageResource(bundle: R.hostingBundle, name: "defaultAvatar.jpg") /// Image `detailBg`. static let detailBg = Rswift.ImageResource(bundle: R.hostingBundle, name: "detailBg") /// Image `home_selected`. static let home_selected = Rswift.ImageResource(bundle: R.hostingBundle, name: "home_selected") /// Image `home`. static let home = Rswift.ImageResource(bundle: R.hostingBundle, name: "home") /// Image `icon_between`. static let icon_between = Rswift.ImageResource(bundle: R.hostingBundle, name: "icon_between") /// Image `icon_cal`. static let icon_cal = Rswift.ImageResource(bundle: R.hostingBundle, name: "icon_cal") /// Image `icon_column`. static let icon_column = Rswift.ImageResource(bundle: R.hostingBundle, name: "icon_column") /// Image `icon_course`. static let icon_course = Rswift.ImageResource(bundle: R.hostingBundle, name: "icon_course") /// Image `icon_document`. static let icon_document = Rswift.ImageResource(bundle: R.hostingBundle, name: "icon_document") /// Image `icon_life`. static let icon_life = Rswift.ImageResource(bundle: R.hostingBundle, name: "icon_life") /// Image `icon_live`. static let icon_live = Rswift.ImageResource(bundle: R.hostingBundle, name: "icon_live") /// Image `icon_phone`. static let icon_phone = Rswift.ImageResource(bundle: R.hostingBundle, name: "icon_phone") /// Image `icon_pwd`. static let icon_pwd = Rswift.ImageResource(bundle: R.hostingBundle, name: "icon_pwd") /// Image `icon_right_arrow`. static let icon_right_arrow = Rswift.ImageResource(bundle: R.hostingBundle, name: "icon_right_arrow") /// Image `logo`. static let logo = Rswift.ImageResource(bundle: R.hostingBundle, name: "logo") /// Image `mine_selected`. static let mine_selected = Rswift.ImageResource(bundle: R.hostingBundle, name: "mine_selected") /// Image `mine`. static let mine = Rswift.ImageResource(bundle: R.hostingBundle, name: "mine") /// Image `student`. static let student = Rswift.ImageResource(bundle: R.hostingBundle, name: "student") /// `UIImage(named: "book", bundle: ..., traitCollection: ...)` static func book(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? { return UIKit.UIImage(resource: R.image.book, compatibleWith: traitCollection) } /// `UIImage(named: "defaultAvatar.jpg", bundle: ..., traitCollection: ...)` static func defaultAvatarJpg(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? { return UIKit.UIImage(resource: R.image.defaultAvatarJpg, compatibleWith: traitCollection) } /// `UIImage(named: "detailBg", bundle: ..., traitCollection: ...)` static func detailBg(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? { return UIKit.UIImage(resource: R.image.detailBg, compatibleWith: traitCollection) } /// `UIImage(named: "home", bundle: ..., traitCollection: ...)` static func home(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? { return UIKit.UIImage(resource: R.image.home, compatibleWith: traitCollection) } /// `UIImage(named: "home_selected", bundle: ..., traitCollection: ...)` static func home_selected(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? { return UIKit.UIImage(resource: R.image.home_selected, compatibleWith: traitCollection) } /// `UIImage(named: "icon_between", bundle: ..., traitCollection: ...)` static func icon_between(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? { return UIKit.UIImage(resource: R.image.icon_between, compatibleWith: traitCollection) } /// `UIImage(named: "icon_cal", bundle: ..., traitCollection: ...)` static func icon_cal(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? { return UIKit.UIImage(resource: R.image.icon_cal, compatibleWith: traitCollection) } /// `UIImage(named: "icon_column", bundle: ..., traitCollection: ...)` static func icon_column(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? { return UIKit.UIImage(resource: R.image.icon_column, compatibleWith: traitCollection) } /// `UIImage(named: "icon_course", bundle: ..., traitCollection: ...)` static func icon_course(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? { return UIKit.UIImage(resource: R.image.icon_course, compatibleWith: traitCollection) } /// `UIImage(named: "icon_document", bundle: ..., traitCollection: ...)` static func icon_document(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? { return UIKit.UIImage(resource: R.image.icon_document, compatibleWith: traitCollection) } /// `UIImage(named: "icon_life", bundle: ..., traitCollection: ...)` static func icon_life(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? { return UIKit.UIImage(resource: R.image.icon_life, compatibleWith: traitCollection) } /// `UIImage(named: "icon_live", bundle: ..., traitCollection: ...)` static func icon_live(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? { return UIKit.UIImage(resource: R.image.icon_live, compatibleWith: traitCollection) } /// `UIImage(named: "icon_phone", bundle: ..., traitCollection: ...)` static func icon_phone(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? { return UIKit.UIImage(resource: R.image.icon_phone, compatibleWith: traitCollection) } /// `UIImage(named: "icon_pwd", bundle: ..., traitCollection: ...)` static func icon_pwd(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? { return UIKit.UIImage(resource: R.image.icon_pwd, compatibleWith: traitCollection) } /// `UIImage(named: "icon_right_arrow", bundle: ..., traitCollection: ...)` static func icon_right_arrow(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? { return UIKit.UIImage(resource: R.image.icon_right_arrow, compatibleWith: traitCollection) } /// `UIImage(named: "logo", bundle: ..., traitCollection: ...)` static func logo(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? { return UIKit.UIImage(resource: R.image.logo, compatibleWith: traitCollection) } /// `UIImage(named: "mine", bundle: ..., traitCollection: ...)` static func mine(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? { return UIKit.UIImage(resource: R.image.mine, compatibleWith: traitCollection) } /// `UIImage(named: "mine_selected", bundle: ..., traitCollection: ...)` static func mine_selected(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? { return UIKit.UIImage(resource: R.image.mine_selected, compatibleWith: traitCollection) } /// `UIImage(named: "student", bundle: ..., traitCollection: ...)` static func student(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? { return UIKit.UIImage(resource: R.image.student, compatibleWith: traitCollection) } fileprivate init() {} } /// This `R.storyboard` struct is generated, and contains static references to 1 storyboards. struct storyboard { /// Storyboard `LaunchScreen`. static let launchScreen = _R.storyboard.launchScreen() /// `UIStoryboard(name: "LaunchScreen", bundle: ...)` static func launchScreen(_: Void = ()) -> UIKit.UIStoryboard { return UIKit.UIStoryboard(resource: R.storyboard.launchScreen) } fileprivate init() {} } fileprivate struct intern: Rswift.Validatable { fileprivate static func validate() throws { try _R.validate() } fileprivate init() {} } fileprivate class Class {} fileprivate init() {} } struct _R: Rswift.Validatable { static func validate() throws { try storyboard.validate() } struct storyboard: Rswift.Validatable { static func validate() throws { try launchScreen.validate() } struct launchScreen: Rswift.StoryboardResourceWithInitialControllerType, Rswift.Validatable { typealias InitialController = UIKit.UIViewController let bundle = R.hostingBundle let name = "LaunchScreen" static func validate() throws { if #available(iOS 11.0, *) { } } fileprivate init() {} } fileprivate init() {} } fileprivate init() {} }
[ -1 ]
2fb66ef38e0e39525d4ce58106aa667ef8f532a6
74ae72d9ed7c0e152e88c6bab85c1ed9e76c2be3
/cartool/AppDelegate.swift
2222a30b344e1af306ef74f58c135816c8399273
[]
no_license
Slime3/cartool
e3a0ec5aedc182874882a60d3dbf3d33974f8628
2696fe367c04ab49e29c61b955b6cd44f729bb06
refs/heads/master
2020-04-18T01:47:23.250690
2019-01-23T01:48:50
2019-01-23T01:48:50
167,134,216
125
3
null
null
null
null
UTF-8
Swift
false
false
615
swift
// // AppDelegate.swift // cartool // // Created by Jason on 2019/1/8. // Copyright © 2019 Jason. All rights reserved. // import Cocoa @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { func applicationDidFinishLaunching(_ aNotification: Notification) { NSApp.servicesProvider = ServiceHelper() } func applicationWillTerminate(_ aNotification: Notification) { // Insert code here to tear down your application } func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { return true } }
[ 224112, 325458, 242030 ]
b773427e1c73673c8f31542f29bf0216fb6200ce
16b3e3038f606e84968b7cdcadfe6fb4537de34a
/FirebaseMapper/DictionaryCodec.swift
512417f7076833ba02f2048665e63dec0510a9ac
[ "MIT" ]
permissive
chadjaros/FirebaseMapper
f0628afb9f1fc5dc3b7afbd98e3ce95ad40607bf
5b5016e415157daae8cc3c07865b7b4685687e1b
refs/heads/master
2021-01-10T13:34:23.739991
2015-10-28T23:05:49
2015-10-28T23:05:49
45,069,091
3
0
null
null
null
null
UTF-8
Swift
false
false
226
swift
// // Created by Chad Jaros on 10/28/15. // Copyright (c) 2015 Classkick. All rights reserved. // import Foundation typealias SimpleDictionary = [String: AnyObject] class DictionaryCodec<T>: Codec<T, SimpleDictionary> { }
[ -1 ]
5d922c15727b54029cd3a1ebb477ee1bfbe5da88
6d31a9db44bf8d3c4b0abda33a9de3527b3e07da
/ShowAndTell/speech.swift
ffc308ad69a5694813bf4f9503b90d0b2ad0bf69
[]
no_license
rex123rich/final
ecb9560412be7d01286b3a105ea51bc7b8e1c5dd
8834d4aa2a0a18b48f6c69633260cb593bc9096a
refs/heads/main
2023-02-06T22:43:54.609555
2020-12-30T16:47:10
2020-12-30T16:47:10
325,577,452
0
0
null
null
null
null
UTF-8
Swift
false
false
5,925
swift
// // speech.swift // ShowAndTell // // Created by 張瑋恩 on 2020/12/14. // Copyright © 2020 Tsao. All rights reserved. // import UIKit import Speech public class speechController: UIViewController, SFSpeechRecognizerDelegate { // MARK: Properties private let speechRecognizer = SFSpeechRecognizer(locale: Locale(identifier: "zh_TW"))! private var recognitionRequest: SFSpeechAudioBufferRecognitionRequest? private var recognitionTask: SFSpeechRecognitionTask? private let audioEngine = AVAudioEngine() @IBOutlet weak var textview: UITextView! // @IBOutlet weak var recordbutton: UIButton! // MARK: View Controller Lifecycle public override func viewDidLoad() { super.viewDidLoad() // Disable the record buttons until authorization has been granted. recordButton.isEnabled = false } override public func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) // Configure the SFSpeechRecognizer object already // stored in a local member variable. speechRecognizer.delegate = self // Asynchronously make the authorization request. SFSpeechRecognizer.requestAuthorization { authStatus in // Divert to the app's main thread so that the UI // can be updated. OperationQueue.main.addOperation { switch authStatus { case .authorized: self.recordButton.isEnabled = true case .denied: self.recordButton.isEnabled = false self.recordButton.setTitle("User denied access to speech recognition", for: .disabled) case .restricted: self.recordButton.isEnabled = false self.recordButton.setTitle("Speech recognition restricted on this device", for: .disabled) case .notDetermined: self.recordButton.isEnabled = false self.recordButton.setTitle("Speech recognition not yet authorized", for: .disabled) default: self.recordButton.isEnabled = false } } } } private func startRecording() throws { // Cancel the previous task if it's running. recognitionTask?.cancel() self.recognitionTask = nil // Configure the audio session for the app. let audioSession = AVAudioSession.sharedInstance() try audioSession.setCategory(.record, mode: .measurement, options: .duckOthers) try audioSession.setActive(true, options: .notifyOthersOnDeactivation) let inputNode = audioEngine.inputNode // Create and configure the speech recognition request. recognitionRequest = SFSpeechAudioBufferRecognitionRequest() guard let recognitionRequest = recognitionRequest else { fatalError("Unable to create a SFSpeechAudioBufferRecognitionRequest object") } recognitionRequest.shouldReportPartialResults = true // Keep speech recognition data on device if #available(iOS 13, *) { recognitionRequest.requiresOnDeviceRecognition = false } // Create a recognition task for the speech recognition session. // Keep a reference to the task so that it can be canceled. recognitionTask = speechRecognizer.recognitionTask(with: recognitionRequest) { result, error in var isFinal = false if let result = result { // Update the text view with the results. self.textView.text = result.bestTranscription.formattedString isFinal = result.isFinal print("Text \(result.bestTranscription.formattedString)") } if error != nil || isFinal { // Stop recognizing speech if there is a problem. self.audioEngine.stop() inputNode.removeTap(onBus: 0) self.recognitionRequest = nil self.recognitionTask = nil self.recordButton.isEnabled = true self.recordButton.setTitle("Start Recording", for: []) } } // Configure the microphone input. let recordingFormat = inputNode.outputFormat(forBus: 0) inputNode.installTap(onBus: 0, bufferSize: 1024, format: recordingFormat) { (buffer: AVAudioPCMBuffer, when: AVAudioTime) in self.recognitionRequest?.append(buffer) } audioEngine.prepare() try audioEngine.start() // Let the user know to start talking. textView.text = "(Go ahead, I'm listening)" } // MARK: SFSpeechRecognizerDelegate public func speechRecognizer(_ speechRecognizer: SFSpeechRecognizer, availabilityDidChange available: Bool) { if available { recordButton.isEnabled = true recordButton.setTitle("Start Recording", for: []) } else { recordButton.isEnabled = false recordButton.setTitle("Recognition Not Available", for: .disabled) } } // MARK: Interface Builder actions @IBAction func recordButtonTapped() { if audioEngine.isRunning { audioEngine.stop() recognitionRequest?.endAudio() recordButton.isEnabled = false recordButton.setTitle("Stopping", for: .disabled) } else { do { try startRecording() recordButton.setTitle("Stop Recording", for: []) } catch { recordButton.setTitle("Recording Not Available", for: []) } } } }
[ -1 ]
28a79b4dff4660d589a9355817dc1465d0e22174
02ebc8f073a853968aaae99de298bd2ae8856b94
/RandomColors/RandomColors/ColorsDetailVC.swift
b2b2ddf4a6de26defeb94ac482513f65ef04639f
[]
no_license
jstevison/sean-allen-courses
fd7e82b73ff1c664bc97d2765c6cd53bab7a0f10
400e4ae1cfd996f68389d942668f64e2bb159a46
refs/heads/master
2022-04-19T09:51:35.374346
2020-04-20T22:00:53
2020-04-20T22:00:53
257,040,149
0
0
null
null
null
null
UTF-8
Swift
false
false
358
swift
// // ColorsDetailVC.swift // RandomColors // // Created by Jeffrey Stevison on 4/19/20. // Copyright © 2020 Jeffrey Stevison. All rights reserved. // import UIKit class ColorsDetailVC: UIViewController { var color: UIColor? override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = color ?? .blue } }
[ 387308 ]
4ca6201f6516f8eeaa95f05129522ba748db473f
6f2ec70e4ab55cbb27aa6bbc1ee443bdca03305e
/sushiswift/sushiinput/sushiinput/InputSourceSink.swift
c8a921ce8919e0f2d1ea6dab9c4cd2bfa1978d3b
[ "MIT" ]
permissive
dmaulikr/sushi
064aa2d3693c0e21f3ef936cbb9355e345eac547
213a6955cbd282ba5df3d065b64c3d28bf97bbe6
refs/heads/master
2021-06-22T09:32:55.072325
2017-08-25T17:27:22
2017-08-25T17:27:22
null
0
0
null
null
null
null
UTF-8
Swift
false
false
292
swift
// // InputSourceSink.swift // sushiinput // // Created by Michael Ong on 12/8/17. // Copyright © 2017 Michael Ong. All rights reserved. // import Foundation public protocol InputSourceSink: class { func sendMessage(from source: InputSourceAny, _ message: InputDispatcherEvent) }
[ -1 ]
174651144a3dec2bf89ddf4c6a54242a7b389d9c
bbd404641a42d01f47771b0b4e565a9abc8a7535
/PokeSpike/PokemonsRequest.swift
38eea211878905799bbfbef148af8c9cce611183
[]
no_license
DarthStrom/PokeSpike
6499bad95f0d9ee40b307644dd67a069ea8e547b
dc4a0d19689eb28816731ad2f96059793de6263b
refs/heads/master
2021-05-07T01:37:48.549097
2017-11-11T19:52:41
2017-11-11T19:52:41
110,376,195
0
0
null
null
null
null
UTF-8
Swift
false
false
150
swift
import Foundation struct PokemonsRequest: PokeRequest { var url: URL { return URL(string: "https://pokeapi.co/api/v2/pokemon/")! } }
[ -1 ]
941968b6c214b4b9e877e433880f0ae54a61641d
20d41586d1bc38af3e63d297d7d63d9052a05f11
/Class03/ServiceCategoryContext.swift
a81e093ea5810c029dc5517bc778e009a52f82ae
[]
no_license
xsheu/Class03
28565a37b639dfb29fb3ad3bc4928da9877e5219
e4a8ea4c4d4695ac6e4e47510f0a78c28b5dc651
refs/heads/master
2020-05-16T01:46:44.889420
2019-06-24T12:59:35
2019-06-24T12:59:35
181,408,767
0
0
null
null
null
null
UTF-8
Swift
false
false
3,306
swift
// // SQLiteWorker.swift // LeisureMap // // Created by 房懷安 on 2018/7/25. // Copyright © 2018年 房懷安. All rights reserved. // import Foundation import UIKit import SQLite struct ServiceCategoryContext { private let categories = Table("servicecategory") private let id = Expression<Int>("id") private let serviceId = Expression<Int>("serviceId") private let name = Expression<String>("name") private let imagepath = Expression<String>("imagepath") private var db: Connection! init() { let sqlFilePath = NSHomeDirectory() + "/Documents/db.sqlite3" do { db = try Connection(sqlFilePath) } catch { print(error) } do { let count = try db.scalar(categories.count) print("init count:\(count)") } catch { print(error) } } func createdTable() { do{ let count = try db.scalar(categories.count) if count > 0 { try db.run(categories.drop()) } }catch{ print(error) } do { try db.run(categories.create { t in t.column(id, primaryKey: true) t.column(serviceId) t.column(name) t.column(imagepath) }) } catch { print(error) } do { let count = try db.scalar(categories.count) print("createdTable count:\(count)") } catch { print(error) } } // func insertData( _serviceId:Int, _name: String, _imagepath: String){ do { let insert = categories.insert( serviceId <- _serviceId, name <- _name, imagepath <- _imagepath) try db.run(insert) } catch { print(error) } } func readData() -> [ServiceCategory] { var responseArray : [ServiceCategory] = [] for category in try! db.prepare(categories) { let serviceCategory = ServiceCategory() serviceCategory.Index = category[serviceId] serviceCategory.Name = category[name] serviceCategory.ImagePath = category[imagepath] responseArray.append(serviceCategory) } responseArray.sort(by: { $0.Index < $1.Index }) return responseArray } // func updateData(serviceId: Int, old_name: String, new_name: String) { let currcategories = categories.filter(id == serviceId) do { try db.run( currcategories.update(name <- name.replace(old_name, with: new_name)) ) } catch { print(error) } } // func delData(currcategoryIndex: Int) { let currcategories = categories.filter(serviceId == currcategoryIndex) do { try db.run(currcategories.delete()) } catch { print(error) } } func clearAll() { let categories = readData() var indexes : [Int] = [] for category in categories{ indexes.append(category.Index) } for index in indexes{ delData(currcategoryIndex:index ) } } }
[ -1 ]
eb63c3c02019f2fdd9f8ee6ceaf768af3799a57c
68f74663aaf7c868af5827c22aa5cae1b91608ba
/Udemy0201/AppDelegate.swift
9a948628eae7f65644be96778ceb8f261cdfd30e
[]
no_license
carmstrong75071/Udemy0201
a57d21c01276d1d7797d0b39434a9d1cfaf6f3f8
76fcc48973da236e4620bb3afbc29ff896f14fe1
refs/heads/master
2021-01-10T13:26:21.517134
2016-01-11T08:33:44
2016-01-11T08:33:44
49,412,762
0
0
null
null
null
null
UTF-8
Swift
false
false
2,152
swift
// // AppDelegate.swift // Udemy0201 // // Created by Chris Armstrong on 1/10/16. // Copyright © 2016 Chris Armstrong. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } func applicationDidEnterBackground(application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } }
[ 229380, 229383, 229385, 278539, 229388, 294924, 278542, 229391, 327695, 278545, 229394, 278548, 229397, 229399, 229402, 278556, 229405, 352284, 278559, 229408, 278564, 294950, 229415, 229417, 327722, 237613, 229422, 360496, 229426, 237618, 229428, 286774, 229432, 286776, 286778, 319544, 204856, 286791, 237640, 278605, 286797, 311375, 163920, 237646, 196692, 319573, 311383, 278623, 278626, 319590, 311400, 278635, 303212, 278639, 278648, 131192, 237693, 327814, 131209, 417930, 303241, 311436, 303244, 319633, 286873, 286876, 311460, 311469, 32944, 327862, 286906, 327866, 180413, 286910, 131264, 286916, 286922, 286924, 286926, 319694, 286928, 131281, 278743, 278747, 295133, 155872, 319716, 278760, 237807, 303345, 286962, 131314, 229622, 327930, 278781, 278783, 278785, 237826, 319751, 278792, 286987, 319757, 311569, 286999, 319770, 287003, 287006, 287009, 287012, 287014, 287016, 287019, 311598, 287023, 262448, 311601, 287032, 155966, 278849, 319809, 319810, 319814, 311623, 319818, 311628, 229709, 287054, 319822, 278865, 229717, 196963, 196969, 139638, 213367, 106872, 319872, 311683, 319879, 311693, 65943, 319898, 311719, 278952, 139689, 278957, 311728, 278967, 180668, 311741, 278975, 319938, 278980, 98756, 278983, 319945, 278986, 319947, 278990, 278994, 311767, 279003, 279006, 188895, 172512, 279010, 287202, 279015, 172520, 319978, 279020, 172526, 279023, 311791, 172529, 279027, 319989, 164343, 180727, 279035, 311804, 287230, 279040, 303617, 287234, 279045, 287238, 172550, 172552, 303623, 320007, 279051, 172558, 279055, 303632, 279058, 303637, 279063, 279067, 172572, 279072, 172577, 295459, 172581, 295461, 279082, 311850, 279084, 172591, 172598, 279095, 172607, 172609, 172612, 377413, 172614, 172618, 303690, 33357, 287309, 279124, 172634, 262752, 172644, 311911, 189034, 295533, 189039, 189040, 172655, 172656, 295538, 189044, 172660, 287349, 352880, 287355, 287360, 295553, 287365, 311942, 303751, 295557, 352905, 279178, 287371, 311946, 311951, 287377, 172691, 287381, 311957, 221850, 287386, 164509, 287390, 295583, 303773, 172702, 287394, 230045, 303780, 172705, 287398, 172707, 287400, 279208, 172714, 295595, 279212, 189102, 172721, 287409, 66227, 303797, 189114, 287419, 303804, 328381, 279231, 287423, 328384, 287427, 312006, 107208, 107212, 172748, 287436, 172751, 287440, 295633, 172755, 303827, 279255, 172760, 279258, 303835, 213724, 189149, 303838, 287450, 279267, 312035, 295654, 279272, 230128, 312048, 312050, 230131, 205564, 303871, 230146, 328453, 295685, 230154, 33548, 312077, 295695, 295701, 369433, 230169, 295707, 328476, 295710, 230175, 303914, 279340, 205613, 279353, 230202, 312124, 222018, 295755, 377676, 148302, 287569, 303959, 279383, 230237, 279390, 230241, 279394, 303976, 336744, 303985, 328563, 303987, 279413, 303991, 303997, 295806, 295808, 304005, 295813, 320391, 213895, 304007, 304009, 304011, 230284, 304013, 213902, 279438, 295822, 189329, 295825, 304019, 189331, 279445, 58262, 279452, 410526, 279461, 279462, 304042, 213931, 230327, 304055, 287675, 304063, 238528, 304065, 189378, 213954, 156612, 295873, 213963, 312272, 304084, 304090, 320481, 304106, 320490, 312302, 328687, 320496, 304114, 295928, 320505, 312321, 295945, 197645, 295949, 230413, 320528, 140312, 295961, 238620, 197663, 304164, 189479, 304170, 238641, 312374, 238652, 238655, 230465, 238658, 296004, 336964, 205895, 320584, 238666, 296021, 402518, 336987, 230497, 296036, 296040, 361576, 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, 350308, 230592, 279750, 312518, 230600, 230607, 148690, 320727, 279769, 304348, 279777, 304354, 296163, 320740, 279781, 304360, 279788, 320748, 279790, 304370, 296189, 320771, 312585, 296202, 296205, 230674, 320786, 230677, 296213, 296215, 320792, 230681, 230679, 214294, 304416, 230689, 173350, 312622, 296243, 312630, 222522, 222525, 296253, 312639, 296255, 230718, 296259, 378181, 230727, 238919, 320840, 296264, 296267, 296271, 222545, 230739, 312663, 337244, 222556, 230752, 312676, 230760, 173418, 410987, 230763, 230768, 296305, 312692, 230773, 279929, 181626, 304506, 304505, 181631, 312711, 312712, 296331, 288140, 230800, 288144, 304533, 337306, 288154, 288160, 173472, 288162, 288164, 279975, 304555, 370092, 279983, 288176, 279985, 173488, 312755, 296373, 279991, 312759, 288185, 337335, 222652, 312766, 173507, 296389, 222665, 230860, 280014, 312783, 288208, 230865, 288210, 370130, 288212, 280021, 288214, 222676, 239064, 288217, 288218, 280027, 288220, 329177, 239070, 288224, 288226, 370146, 280036, 288229, 280038, 288230, 288232, 280034, 288234, 320998, 288236, 288238, 288240, 291754, 288242, 296435, 288244, 296439, 288250, 402942, 148990, 296446, 206336, 296450, 321022, 230916, 230919, 214535, 370187, 304651, 304653, 230940, 222752, 108066, 296486, 296488, 157229, 230961, 288320, 288325, 124489, 280140, 280145, 288338, 280149, 280152, 288344, 239194, 280158, 403039, 370272, 181854, 239202, 312938, 280183, 280185, 280188, 280191, 280194, 116354, 280208, 280211, 288408, 280218, 280222, 190118, 321195, 296622, 321200, 337585, 296626, 296634, 296637, 313027, 280260, 280264, 206536, 206539, 206541, 206543, 280276, 313044, 321239, 280283, 313052, 288478, 313055, 321252, 313066, 280302, 288494, 280304, 313073, 419570, 321266, 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, 304968, 280393, 280402, 313176, 42842, 280419, 321381, 296812, 313201, 1920, 255873, 305028, 280454, 247688, 280458, 280464, 124817, 280468, 239510, 280473, 124827, 214940, 247709, 214944, 280487, 313258, 321458, 296883, 124853, 214966, 10170, 296890, 288700, 296894, 280515, 190403, 296900, 337862, 165831, 280521, 231379, 296921, 239586, 313320, 231404, 124913, 165876, 321528, 239612, 313340, 288764, 239617, 313347, 288773, 313358, 321560, 305176, 313371, 354338, 305191, 223273, 313386, 354348, 124978, 215090, 124980, 288824, 288826, 321595, 378941, 313406, 288831, 288836, 67654, 223303, 280651, 354382, 288848, 280658, 215123, 354390, 288855, 288859, 280669, 313438, 280671, 223327, 149599, 321634, 149601, 149603, 329830, 280681, 313451, 223341, 280687, 313458, 280691, 215154, 313464, 329850, 321659, 280702, 288895, 321670, 215175, 141446, 141455, 141459, 280725, 313498, 288936, 100520, 280747, 288940, 280755, 288947, 321717, 280759, 280764, 280769, 280771, 280774, 280776, 313548, 321740, 280783, 280786, 280788, 313557, 280793, 280796, 280798, 338147, 280804, 280807, 157930, 280811, 280817, 280819, 157940, 125171, 182517, 280823, 280825, 280827, 280830, 280831, 280833, 280835, 125187, 125191, 125207, 125209, 321817, 125218, 321842, 223539, 125239, 280888, 280891, 289087, 280897, 280900, 239944, 305480, 280906, 239947, 305485, 305489, 379218, 280919, 354653, 313700, 280937, 313705, 280940, 190832, 280946, 223606, 313720, 280956, 239997, 280959, 313731, 199051, 240011, 289166, 240017, 297363, 190868, 297365, 240021, 297368, 297372, 141725, 297377, 289186, 297391, 289201, 240052, 289207, 305594, 289210, 281024, 289218, 289221, 289227, 281045, 281047, 215526, 166378, 305647, 281075, 174580, 281084, 240124, 305662, 305664, 240129, 305666, 305668, 240132, 223749, 281095, 338440, 150025, 223752, 223757, 281102, 223763, 223765, 281113, 322074, 281116, 281121, 182819, 281127, 281135, 150066, 158262, 158266, 289342, 281154, 322115, 158283, 281163, 281179, 199262, 338528, 338532, 281190, 199273, 281196, 158317, 19053, 313973, 281210, 297594, 158347, 133776, 314003, 117398, 314007, 289436, 174754, 330404, 289448, 133801, 174764, 314029, 314033, 240309, 133817, 314045, 314047, 314051, 199364, 297671, 199367, 158409, 289493, 363234, 289513, 289522, 289525, 289532, 322303, 289537, 322310, 264969, 322314, 322318, 281361, 281372, 322341, 215850, 281388, 207661, 289593, 281401, 289601, 281410, 281413, 281414, 240458, 281420, 240468, 281430, 322393, 297818, 281435, 281438, 281442, 174955, 224110, 207733, 207737, 183172, 158596, 240519, 322440, 338823, 314249, 183184, 289687, 240535, 297883, 289694, 289696, 289700, 289712, 281529, 289724, 52163, 183260, 281567, 289762, 322534, 297961, 281581, 183277, 322550, 134142, 322563, 175134, 322599, 322610, 314421, 281654, 314427, 207937, 314433, 314441, 207949, 322642, 314456, 281691, 314461, 281702, 281704, 314474, 281708, 281711, 289912, 248995, 306341, 306344, 306347, 306354, 142531, 199877, 289991, 306377, 289997, 249045, 363742, 363745, 298216, 330988, 126190, 216303, 322801, 388350, 257302, 363802, 199976, 199978, 314671, 298292, 298294, 257334, 216376, 298306, 380226, 281923, 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, 290174, 298365, 224641, 281987, 298372, 314756, 281990, 224647, 265604, 298377, 314763, 142733, 298381, 224657, 306581, 314779, 314785, 282025, 314793, 282027, 241068, 241070, 241072, 282034, 241077, 150966, 298424, 306618, 282044, 323015, 306635, 306640, 290263, 290270, 290275, 339431, 282089, 191985, 282098, 290291, 282101, 241142, 191992, 290298, 151036, 290302, 282111, 290305, 175621, 192008, 323084, 257550, 282127, 290321, 282130, 323090, 282133, 290325, 241175, 290328, 282137, 290332, 241181, 282142, 282144, 290344, 306731, 290349, 290351, 290356, 282186, 224849, 282195, 282199, 282201, 306778, 159324, 159330, 314979, 298598, 323176, 224875, 241260, 323181, 257658, 315016, 282249, 290445, 324757, 282261, 298651, 282269, 323229, 298655, 323231, 61092, 282277, 306856, 282295, 282300, 323260, 323266, 282310, 323273, 282319, 306897, 241362, 282328, 298714, 52959, 216801, 282337, 241380, 216806, 323304, 282345, 12011, 282356, 323318, 282364, 282367, 306945, 241412, 323333, 282376, 216842, 323345, 282388, 323349, 282392, 184090, 315167, 315169, 282402, 315174, 323367, 241448, 315176, 282410, 241450, 306988, 306991, 315184, 323376, 315190, 241464, 282425, 159545, 298811, 307009, 413506, 241475, 307012, 148946, 315211, 282446, 307027, 315221, 282454, 315223, 241496, 323414, 241498, 307035, 307040, 282465, 110433, 241509, 110438, 298860, 110445, 282478, 282481, 110450, 315251, 315249, 315253, 315255, 339838, 282499, 315267, 315269, 241544, 282505, 241546, 241548, 298896, 282514, 298898, 44948, 298901, 241556, 282520, 241560, 241563, 241565, 241567, 241569, 282531, 241574, 282537, 298922, 36779, 241581, 282542, 241583, 323504, 241586, 282547, 241588, 290739, 241590, 241592, 241598, 290751, 241600, 241605, 151495, 241610, 298975, 241632, 298984, 241640, 241643, 298988, 241646, 241649, 241652, 323574, 290807, 241661, 299006, 282623, 315396, 241669, 315397, 282632, 282639, 290835, 282645, 241693, 282654, 241701, 102438, 217127, 282669, 323630, 282681, 290877, 282687, 159811, 315463, 315466, 192589, 307278, 192596, 176213, 307287, 315482, 217179, 315483, 192605, 233567, 200801, 299105, 217188, 299109, 307303, 315495, 356457, 45163, 307307, 315502, 192624, 307314, 323700, 299126, 233591, 299136, 307329, 307338, 233613, 241813, 307352, 299164, 184479, 299167, 184481, 315557, 184486, 307370, 307372, 184492, 307374, 307376, 323763, 176311, 299191, 307385, 307386, 258235, 176316, 307388, 307390, 184503, 299200, 184512, 307394, 307396, 299204, 184518, 307399, 323784, 307409, 307411, 176343, 299225, 233701, 307432, 184572, 282881, 184579, 282893, 291089, 282906, 291104, 233766, 176435, 307508, 315701, 307510, 332086, 151864, 307512, 168245, 307515, 282942, 307518, 151874, 282947, 282957, 323917, 110926, 233808, 323921, 315733, 323926, 233815, 315739, 323932, 299357, 242018, 242024, 299373, 315757, 250231, 242043, 315771, 299388, 299391, 291202, 299398, 242057, 291212, 299405, 291222, 283033, 291226, 242075, 315801, 291231, 61855, 283042, 291238, 291241, 127403, 127405, 291247, 127407, 299440, 299444, 127413, 283062, 291254, 127417, 291260, 283069, 127421, 127424, 299457, 127429, 127431, 283080, 176592, 315856, 315860, 176597, 283095, 127447, 299481, 176605, 242143, 291299, 127463, 242152, 291305, 127466, 176620, 127474, 291314, 291317, 135672, 233979, 291323, 291330, 283142, 127497, 233994, 135689, 291341, 233998, 234003, 234006, 152087, 127511, 283161, 242202, 234010, 135707, 242206, 135710, 242208, 291361, 242220, 291378, 234038, 152118, 234041, 70213, 242250, 111193, 242275, 299620, 242279, 168562, 184952, 135805, 291456, 135808, 373383, 299655, 135820, 316051, 225941, 316054, 299672, 135834, 373404, 299677, 225948, 135839, 299680, 225954, 299684, 242343, 209576, 242345, 373421, 135870, 135873, 135876, 135879, 299720, 299723, 225998, 299726, 226002, 226005, 119509, 226008, 242396, 299740, 201444, 299750, 283368, 234219, 283372, 226037, 283382, 234231, 316151, 234236, 226045, 234239, 242431, 209665, 234242, 299778, 242436, 226053, 234246, 226056, 234248, 291593, 242443, 234252, 242445, 234254, 291601, 234258, 242450, 242452, 234261, 348950, 201496, 234264, 234266, 283421, 234269, 234272, 234274, 152355, 234278, 299814, 283432, 234281, 234284, 234287, 283440, 185138, 242483, 234292, 234296, 234298, 283452, 160572, 234302, 234307, 242499, 234309, 292433, 234313, 316233, 316235, 234316, 283468, 242511, 234319, 234321, 234324, 185173, 201557, 234329, 234333, 308063, 234336, 234338, 242530, 349027, 234341, 234344, 234347, 177004, 234350, 324464, 234353, 152435, 177011, 234356, 234358, 234362, 226171, 291711, 234368, 234370, 201603, 291714, 234373, 226182, 234375, 291716, 226185, 308105, 234379, 234384, 234388, 234390, 226200, 324504, 234393, 209818, 308123, 324508, 234398, 234396, 291742, 234401, 291747, 291748, 234405, 291750, 234407, 324518, 324520, 234410, 324522, 226220, 291756, 234414, 324527, 291760, 234417, 201650, 324531, 226230, 234422, 275384, 324536, 234428, 291773, 234431, 242623, 324544, 324546, 226239, 324548, 226245, 234437, 234439, 234434, 234443, 291788, 193486, 275406, 193488, 234446, 234449, 316370, 234452, 234455, 234459, 234461, 234464, 234467, 234470, 168935, 5096, 324585, 234475, 234478, 316400, 234481, 316403, 234484, 234485, 324599, 234487, 234490, 234493, 234496, 316416, 234501, 275462, 308231, 234504, 234507, 234510, 234515, 300054, 234519, 316439, 234520, 234523, 234526, 234528, 300066, 234532, 300069, 234535, 234537, 234540, 144430, 234543, 234546, 275508, 234549, 300085, 300088, 234553, 234556, 234558, 316479, 234561, 316483, 234563, 308291, 234568, 234570, 316491, 300108, 234572, 234574, 300115, 234580, 234581, 275545, 242777, 234585, 234590, 234593, 234595, 300133, 234597, 234601, 300139, 234605, 234607, 160879, 275569, 234610, 300148, 234614, 398455, 144506, 275579, 234618, 234620, 234623, 226433, 234627, 275588, 234629, 242822, 234634, 275594, 234636, 177293, 234640, 275602, 234643, 226453, 275606, 234647, 275608, 308373, 234650, 234648, 308379, 283805, 234653, 324766, 119967, 234657, 300189, 324768, 242852, 283813, 234661, 300197, 234664, 275626, 234667, 316596, 308414, 234687, 316610, 300226, 226500, 234692, 300229, 308420, 283844, 308418, 283850, 300234, 300238, 300241, 316625, 300243, 300245, 316630, 300248, 300253, 300256, 300258, 300260, 234726, 300263, 300265, 161003, 300267, 300270, 300272, 120053, 300278, 316663, 275703, 300284, 275710, 300287, 283904, 300289, 292097, 300292, 300294, 275719, 300299, 177419, 283917, 300301, 242957, 177424, 275725, 349464, 283939, 259367, 283951, 292143, 300344, 226617, 283963, 243003, 226628, 283973, 300357, 177482, 283983, 316758, 357722, 316766, 292192, 316768, 218464, 292197, 316774, 243046, 218473, 284010, 136562, 324978, 275834, 333178, 275836, 275840, 316803, 316806, 226696, 316811, 226699, 316814, 226703, 300433, 234899, 226709, 357783, 316824, 316826, 144796, 300448, 144807, 144810, 284076, 144812, 144814, 144820, 284084, 284087, 292279, 144826, 144828, 144830, 144832, 284099, 144835, 144837, 38342, 144839, 144841, 144844, 144847, 144852, 144855, 103899, 300507, 333280, 226787, 218597, 292329, 300523, 259565, 259567, 300527, 308720, 226802, 316917, 308727, 292343, 300537, 316947, 308757, 308762, 284191, 284194, 284196, 235045, 284199, 284204, 284206, 284209, 284211, 284213, 194101, 284215, 194103, 284218, 226877, 284223, 284226, 243268, 292421, 226886, 284231, 128584, 284228, 284234, 366155, 276043, 317004, 284238, 226895, 284241, 194130, 284243, 276052, 276053, 284245, 284247, 317015, 284249, 243290, 284251, 300628, 284253, 235097, 284255, 300638, 243293, 284258, 292452, 292454, 284263, 177766, 284265, 292458, 284267, 292461, 284272, 284274, 276086, 284278, 292470, 292473, 284283, 276093, 284286, 276095, 284288, 292481, 276098, 284290, 325250, 284292, 292479, 292485, 284297, 317066, 284299, 317068, 276109, 284301, 284303, 276114, 284306, 284308, 284312, 284314, 284316, 276127, 284320, 284322, 284327, 276137, 284329, 284331, 317098, 284333, 284335, 276144, 284337, 284339, 300726, 284343, 284346, 284350, 276160, 358080, 284354, 358083, 276166, 284358, 358089, 276170, 284362, 276175, 284368, 276177, 284370, 317138, 284372, 358098, 284377, 276187, 284379, 284381, 284384, 284386, 358114, 358116, 276197, 317158, 358119, 284392, 325353, 284394, 358122, 284397, 276206, 284399, 358126, 358128, 358133, 358135, 276216, 358138, 300795, 358140, 284413, 358142, 284418, 358146, 317187, 317189, 317191, 284428, 300816, 300819, 317207, 284440, 186139, 300828, 300830, 276255, 325408, 284449, 300834, 300832, 227109, 317221, 358183, 186151, 276268, 300845, 194351, 243504, 300850, 284469, 276280, 325436, 358206, 276291, 366406, 276295, 300872, 153417, 284499, 276308, 284502, 317271, 178006, 276315, 292700, 284511, 227175, 292715, 300912, 284529, 292721, 300915, 284533, 292729, 317306, 284540, 292734, 325512, 169868, 276365, 284564, 358292, 284566, 350106, 284572, 276386, 284579, 276388, 358312, 284585, 317353, 276395, 292776, 292784, 276402, 358326, 161718, 276410, 276411, 358330, 276418, 276425, 301009, 301011, 301013, 292823, 301015, 301017, 358360, 292828, 276446, 153568, 276448, 276452, 276455, 292839, 292843, 276460, 276464, 178161, 276466, 227314, 276472, 325624, 317435, 276476, 276479, 276482, 276485, 317446, 276490, 292876, 276496, 317456, 317458, 243733, 243740, 317468, 317472, 325666, 243751, 292904, 276528, 243762, 309298, 325685, 325689, 276539, 235579, 235581, 325692, 178238, 276544, 284739, 292934, 276553, 243785, 350293, 350295, 194649, 227418, 309337, 194654, 227423, 350302, 194657, 227426, 276579, 178273, 194660, 227430, 276583, 309346, 309348, 276586, 309350, 309352, 309354, 276590, 350313, 227440, 350316, 284786, 350321, 276595, 301167, 350325, 350328, 292985, 301178, 292989, 292993, 301185, 350339, 317570, 317573, 350342, 227463, 350345, 350349, 301199, 317584, 325777, 350354, 350357, 350359, 350362, 276638, 350366, 284837, 153765, 350375, 350379, 350381, 350383, 129200, 350385, 350387, 350389, 350395, 350397, 350399, 227520, 350402, 227522, 301252, 350406, 227529, 309450, 301258, 276685, 276689, 309462, 301272, 276699, 309468, 194780, 309471, 301283, 317672, 276713, 317674, 325867, 243948, 194801, 227571, 309491, 276725, 309494, 243960, 227583, 276735, 227587, 276739, 211204, 276742, 227593, 227596, 325910, 309530, 342298, 276766, 211232, 317729, 276775, 211241, 325937, 276789, 325943, 211260, 260421, 276809, 285002, 276811, 235853, 276816, 235858, 276829, 276833, 391523, 276836, 276843, 293227, 276848, 293232, 186744, 285051, 211324, 227709, 285061, 317833, 178572, 285070, 178575, 285077, 178583, 227738, 317853, 276896, 317858, 342434, 285093, 317864, 285098, 276907, 235955, 276917, 293304, 293307, 293314, 309707, 293325, 317910, 293336, 235996, 317917, 293343, 358880, 276961, 227810, 293346, 276964, 293352, 236013, 293364, 301562, 317951, 309764, 301575, 121352, 236043, 317963, 342541, 55822, 113167, 277011, 317971, 309781, 309779, 55837, 227877, 227879, 293417, 227882, 309804, 293421, 105007, 236082, 285236, 23094, 277054, 244288, 129603, 318020, 301636, 301639, 301643, 277071, 285265, 399955, 309844, 277080, 309849, 285277, 285282, 326244, 318055, 277100, 277106, 121458, 170618, 170619, 309885, 309888, 277122, 227975, 285320, 277128, 301706, 318092, 326285, 318094, 334476, 277136, 277139, 227992, 285340, 318108, 227998, 318110, 137889, 383658, 285357, 318128, 277170, 342707, 154292, 277173, 293555, 318132, 285368, 277177, 277181, 318144, 277187, 277191, 277194, 277196, 277201, 137946, 113378, 203491, 228069, 277223, 342760, 285417, 56041, 56043, 277232, 228081, 56059, 310015, 285441, 310020, 285448, 310029, 228113, 285459, 277273, 293659, 326430, 228128, 293666, 285474, 228135, 318248, 277291, 293677, 318253, 285489, 293685, 285494, 301880, 285499, 301884, 310080, 293696, 277317, 277322, 277329, 162643, 310100, 301911, 301913, 277337, 301921, 400236, 236397, 162671, 326514, 310134, 277368, 15224, 236408, 416639, 416640, 113538, 310147, 416648, 39817, 187274, 277385, 301972, 424853, 277405, 277411, 310179, 293798, 293802, 236460, 277426, 293811, 293817, 293820, 203715, 326603, 293849, 293861, 228327, 228328, 228330, 318442, 228332, 277486, 326638, 318450, 293876, 293877, 285686, 302073, 285690, 244731, 121850, 302075, 293882, 293887, 277504, 277507, 277511, 277519, 293908, 277526, 293917, 293939, 318516, 277561, 277564, 310336, 7232, 293956, 277573, 228422, 310344, 277577, 293960, 277583, 203857, 310355, 293971, 310359, 236632, 277594, 138332, 277598, 285792, 277601, 203872, 310374, 203879, 277608, 310376, 228460, 318573, 203886, 187509, 285815, 285817, 367737, 285821, 302205, 285824, 392326, 285831, 253064, 302218, 285835, 294026, 384148, 162964, 187542, 302231, 285849, 302233, 285852, 302237, 285854, 285856, 285862, 277671, 302248, 64682, 277678, 228526, 294063, 294065, 302258, 277687, 294072, 318651, 294076, 277695, 318657, 244930, 302275, 130244, 302277, 228550, 302282, 310476, 302285, 302288, 310481, 302290, 203987, 302292, 302294, 302296, 384222, 310498, 285927, 318698, 302315, 195822, 228592, 294132, 138485, 228601, 204026, 228606, 204031, 64768, 310531, 285958, 228617, 138505, 318742, 204067, 277798, 130345, 277801, 113964, 285997, 277804, 285999, 277807, 113969, 277811, 318773, 318776, 277816, 286010, 277819, 294204, 417086, 277822, 286016, 294211, 302403, 384328, 277832, 277836, 294221, 326991, 294223, 277839, 277842, 277847, 277850, 179547, 277853, 146784, 277857, 302436, 277860, 294246, 327015, 310632, 327017, 351594, 277864, 277869, 277872, 351607, 310648, 277880, 310651, 277884, 277888, 310657, 351619, 294276, 310659, 277892, 327046, 253320, 310665, 318858, 277898, 277894, 277903, 310672, 351633, 277905, 277908, 277917, 310689, 277921, 277923, 130468, 228776, 277928, 277932, 310703, 277937, 310710, 130486, 310712, 277944, 310715, 277947, 302526, 228799, 277950, 277953, 64966, 245191, 163272, 302534, 310727, 277959, 292968, 302541, 277966, 302543, 277963, 310737, 277971, 277975, 286169, 228825, 163290, 277978, 310749, 277981, 277984, 310755, 277989, 277991, 187880, 277995, 286188, 310764, 278000, 278003, 310772, 228851, 278006, 40440, 278009, 212472, 40443, 286203, 228864, 40448, 286214, 228871, 302603, 65038, 302614, 286233, 302617, 302621, 286240, 146977, 187939, 294435, 40484, 286246, 294439, 286248, 278057, 294440, 294443, 40486, 294445, 40488, 310831, 40491, 40499, 40502, 212538, 40507, 40511, 40513, 228933, 40521, 286283, 40525, 40527, 228944, 212560, 400976, 40533, 147032, 40537, 40539, 278109, 40541, 40544, 40548, 40550, 286312, 286313, 40554, 40552, 310892, 40557, 40560, 188022, 122488, 294521, 343679, 278150, 310925, 286354, 278163, 302740, 122517, 278168, 327333, 229030, 212648, 278188, 302764, 278192, 319153, 278196, 302781, 319171, 302789, 294599, 278216, 294601, 302793, 343757, 212690, 278227, 229076, 286420, 319187, 286425, 319194, 278235, 301163, 229086, 278238, 286432, 294625, 294634, 302838, 319226, 286460, 171774, 278274, 302852, 278277, 302854, 294664, 311048, 352008, 319243, 311053, 302862, 319251, 294682, 278306, 188199, 294701, 278320, 319280, 319290, 229192, 302925, 188247, 237409, 294776, 360317, 294785, 327554, 40840, 40851, 294803, 188312, 294811, 319390, 294817, 319394, 40865, 294821, 311209, 180142, 294831, 188340, 40886, 319419, 294844, 294847, 393177, 294876, 294879, 294883, 294890, 311279, 278513, 237555, 278516, 311283, 278519, 237562 ]
1e9b6125629b989fbcf9448e98988344fc478e29
9eac2851e836dffd07737143624a734ccfa0e0e4
/metraApp/ViewController.swift
cf5b1e27e3ff9168e91420bdac009c14dd325a01
[]
no_license
Zelal-Ezaldeen/metra
e68c8bb6751ea2367cd75934efefcba82a1873be
d802b5854e7ecdf889d6e30ec2a3cb59524af0b1
refs/heads/master
2020-04-08T03:07:58.738194
2018-11-25T08:33:45
2018-11-25T08:33:45
158,963,201
0
0
null
null
null
null
UTF-8
Swift
false
false
359
swift
// // ViewController.swift // metraApp // // Created by Zelal-Ezaldeen on 11/24/18. // Copyright © 2018 Metra Company. All rights reserved. // import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } }
[ 327555, 398203, 356742, 384145, 391441, 375576, 384153, 399130, 258589, 254494, 254495, 436128, 254497, 155551, 397091, 351400, 356652, 319284, 383797, 396725, 402616, 397114, 111292, 384447, 266816, 360903, 359368, 437582, 330960, 146645, 399958, 402524, 362845, 332513, 399201, 384103, 374122, 352876, 349297, 210674, 320506, 361595 ]
62afc23495a1c5601016e5ac515a802535a70131
0e88a61c289230a524afa80bad76bd61c3024a7a
/GoalPost/Enum/GoalType.swift
ad6aca719944f44095d1c614b130c45ffecf6e56
[]
no_license
ahmadsamehh/GoalPost
7941f0174a4abd893faab5a748b47f8e0771e39b
2cce6eee8a4663470fdb4dd7f9bdc6a0bc6c8d7d
refs/heads/master
2022-12-28T03:23:51.860871
2020-10-22T13:00:20
2020-10-22T13:00:20
306,044,037
0
0
null
null
null
null
UTF-8
Swift
false
false
257
swift
// // GoalType.swift // GoalPost // // Created by Ahmad Sameh on 4/11/20. // Copyright © 2020 Ahmad Sameh. All rights reserved. // import Foundation enum GoalType : String{ case shortTerm = "Short Term" case longTerm = "Long Term" }
[ -1 ]
40c45b4dd21dbf946405aad1220452fd25798909
a38dd966f40dc1e431051bdbb647fc71671a01e2
/Chapter 14/To-Do Manager/To-Do Manager/Model/TasksStorage.swift
e1e1fd9e3962a552b469019797a03607a3efa1e6
[]
no_license
dmitrytroshkindp24/SwiftBook2-Projects
c68e540acf28b689240718b9327185e86abd72f5
aa09818b816766555351e11c5c44cecc261de9a6
refs/heads/main
2023-08-28T03:20:02.389186
2021-11-08T08:09:14
2021-11-08T08:09:14
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,215
swift
import Foundation // Протокол, описывающий сущность "Хранилище задач" protocol TasksStorageProtocol { func loadTasks() -> [TaskProtocol] func saveTasks(_ tasks: [TaskProtocol]) } // Сущность "Хранилище задач" class TasksStorage: TasksStorageProtocol { func loadTasks() -> [TaskProtocol] { // временная реализация, возвращающая тестовую коллекцию задач let testTasks: [TaskProtocol] = [ Task(title: "Купить хлеб", type: .normal, status: .planned), Task(title: "Помыть кота", type: .important, status: .planned), Task(title: "Отдать долг Арнольду", type: .important, status: .completed), Task(title: "Купить новый пылесос", type: .normal, status: .completed), Task(title: "Подарить цветы супруге", type: .important, status: .planned), Task(title: "Позвонить родителям", type: .important, status: .planned) ] return testTasks } func saveTasks(_ tasks: [TaskProtocol]) {} }
[ -1 ]
a49114aea25f6d99a4c0323682fe2997a7972960
f5783fbd6a45f49fcead26ae6ebbad4b9dc4ffcf
/NYT Best Books/CategoryTableViewCell.swift
aadfc39ae78aa6f56fe8742f5fe4ba17d9846dbd
[]
no_license
tommy3531/NYTimes-BestSeller-Book
f532177db8b2fa9a48537bb319fc9a74d0b5acea
a2ec49e5efe78faf5f1b110b5e4147ff2acc3286
refs/heads/master
2021-01-19T04:26:13.699161
2016-09-29T12:46:07
2016-09-29T12:46:07
null
0
0
null
null
null
null
UTF-8
Swift
false
false
548
swift
// // CategoryTableViewCell.swift // NYT Best Books // // Created by Vinit Jasoliya on 9/27/16. // Copyright © 2016 ViNiT. All rights reserved. // import UIKit class CategoryTableViewCell: UITableViewCell { @IBOutlet weak var categoryName: 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, 206342, 333831, 227849, 227852, 327181, 333837, 372750, 372753, 196114, 372754, 327190, 328214, 287258, 370207, 243746, 287266, 281636, 278567, 278583, 310839, 327224, 327225, 327241, 307277, 327248, 235604, 214104, 235611, 213095, 213097, 213100, 310894, 222835, 222836, 213109, 148600, 403068, 410751, 300672, 329880, 373913, 148637, 148638, 276639, 148648, 300206, 361651, 381622, 327360, 223437, 290007, 291544, 306907, 337627, 294623, 176358, 271087, 325874, 338682, 300799, 300801, 300802, 276746, 282897, 276756, 203542, 261406, 349470, 336160, 396065, 111912, 287022, 313138, 369458, 369461, 282934, 380220, 342850, 342851, 151881, 430412, 283471, 283472, 270679, 287067, 336737, 350050, 270691, 257898, 330602, 179568, 317296, 317302, 244600, 113529, 179578, 244602, 179580, 281985, 211843, 213891, 36743, 209803, 334226, 311704, 283048, 211370, 288690, 281014, 317377, 317379, 430546, 430547, 358868, 180695, 180696, 358876, 284131, 298981, 344039, 196076, 165871, 310778, 305661 ]
815f8ec3f66ff4d6f39d59e6ca346d54e1a727cd
3e049d6bc046b028053ecfbd03ddb06d57a40a94
/Code operators/Code operatorsTests/Code_operatorsTests.swift
1801077c42112a573ac40d349b73a7f95148ab94
[]
no_license
Oreoluwa2/code-assesment-
6c076c727aecef033fd90c89a10bdafb934efd2b
dc65652aa6fe61aa187f902dea80aa76ba5544d3
refs/heads/master
2022-11-19T08:37:54.453611
2020-07-17T17:35:52
2020-07-17T17:35:52
280,487,098
0
0
null
null
null
null
UTF-8
Swift
false
false
988
swift
// // Code_operatorsTests.swift // Code operatorsTests // // Created by Oreoluwa Omomofe on 7/16/20. // Copyright © 2020 One Summer Chicago. All rights reserved. // import XCTest @testable import Code_operators class Code_operatorsTests: XCTestCase { override func setUpWithError() throws { // Put setup code here. This method is called before the invocation of each test method in the class. } 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 { // This is an example of a functional test case. // Use XCTAssert and related functions to verify your tests produce the correct results. } func testPerformanceExample() throws { // This is an example of a performance test case. self.measure { // Put the code you want to measure the time of here. } } }
[ 358410, 354316, 360462, 182296, 241692, 16419, 223268, 329765, 315432, 344107, 253999, 346162, 241716, 243767, 352315, 376894, 352326, 338007, 200794, 356447, 254048, 321637, 319598, 352368, 325776, 317587, 346271, 362659, 49316, 258214, 333991, 333992, 379071, 338119, 346314, 334042, 254170, 356576, 338150, 338164, 336120, 356602, 12542, 184575, 313608, 254226, 272660, 338197, 368916, 151839, 237856, 338218, 325931, 254251, 321840, 127284, 336183, 348492, 319821, 254286, 383311, 250192, 344401, 366930, 348500, 272729, 354655, 242023, 160110, 246127, 250226, 354677, 246136, 139640, 246137, 211326, 362881, 340357, 242058, 395659, 395661, 108944, 317852, 121245, 39324, 246178, 375207, 340398, 342450, 334260, 319930, 336317, 336320, 342466, 188871, 324039, 129483, 317901, 242139, 342498, 340453, 334309, 127465, 330218, 109042, 254456, 324097, 254465, 340490, 254488, 207393, 377386, 358954, 197167, 348732, 242237, 352829, 348742, 322120, 348749, 340558, 244310, 332378, 354911, 436832, 139872, 242277, 344680, 139892, 344696, 356989, 152195, 311941, 336518, 348806, 369289, 344715, 334481, 346772, 111253, 352917, 271000, 111258, 318107, 342682, 363163, 346779, 344738, 139939, 336558, 109241, 342713, 248517, 164560, 334547, 361176, 338662, 330474, 346858, 322291, 312052, 312053, 348920, 344827, 344828, 35583, 363263, 162561, 191235, 336648, 326414, 312079, 207640, 336671, 344865, 189228, 353069, 355121, 353078, 355130, 336702, 342847, 355139, 252741, 353094, 353095, 420677, 355146, 355152, 377686, 244568, 189275, 355165, 109409, 357218, 127841, 351077, 342887, 355178, 207727, 246641, 174963, 361337, 254850, 359298, 260996, 359299, 240518, 109447, 349067, 349072, 355217, 326553, 318364, 127902, 140204, 363438, 347055, 252847, 326581, 373687, 330689, 349121, 359364, 211914, 359381, 340955, 359387, 343005, 248797, 130016, 340961, 123881, 340974, 349175, 201720, 320507, 257024, 330754, 254987, 330763, 146448, 324625, 418837, 322582, 320536, 201755, 326685, 252958, 336929, 357423, 252980, 324666, 132158, 361535, 336960, 248901, 359495, 361543, 250954, 250956, 341073, 156764, 314467, 250981, 253029, 257125, 318572, 351344, 187506, 337017, 341115, 363644, 248961, 349316, 349318, 337039, 169104, 347283, 238743, 324760, 339100, 351390, 343203, 253099, 253100, 3246, 367799, 113850, 343234, 367810, 259268, 283853, 351446, 357595, 134366, 359647, 330984, 222440, 351476, 351478, 128251, 363771, 261377, 322824, 369930, 328971, 353551, 349462, 257305, 126237, 208164, 130348, 66862, 353584, 345396, 318775, 312634, 116026, 337225, 337227, 251213, 353616, 331090, 159066, 243056, 312689, 327025, 116084, 318848, 337281, 357762, 378244, 388487, 112018, 9619, 251298, 208293, 245161, 241066, 316842, 314798, 210358, 163268, 380357, 366037, 353750, 210391, 210392, 210393, 210390, 310748, 103909, 361963, 359930, 210433, 366083, 253451, 316946, 398869, 253463, 374296, 349726, 134686, 355876, 349741, 347694, 312880, 312889, 243274, 349781, 196187, 345700, 120427, 204397, 54893, 138863, 370296, 366203, 337534, 337535, 339584, 339585, 224901, 345752, 255649, 245412, 323236, 224946, 337591, 224958, 323263, 245457, 241365, 345814, 181975, 224984, 333542, 345834, 372460, 212716, 212717, 360177, 319233, 175873, 360195, 339720, 323346, 345879, 249626, 169754, 339745, 241442, 341796, 247590, 257830, 362283, 339762, 259899, 315202, 325445, 339783, 153415, 360264, 159562, 345929, 341836, 337745, 325457, 255829, 341847, 350044, 345951, 362337, 345955, 325484, 362352, 325492, 341879, 325503, 253829, 247686, 350093, 325518, 337815, 118685, 350109, 319392, 253856, 354212, 362417, 188348, 362431, 174019, 212942, 212946, 346067, 212951, 219101, 354269, 360417, 354274, 337895, 354280, 174057, 253929, 327661, 247791, 362480, 333817 ]
1fe4e89e73ec357e88669fd05317dcce73ebc0ff
f7648e91851e6669c791579378fbf0fef33f0783
/fishlist/Models/FishSpecies.swift
39338a581b8023fe7aedd541cf5d745db4d38054
[]
no_license
burgoyne/app-fishbowl
6b9acc15277069310ac4dab7085ec91ee3eec5e8
074557c4ecb156bc07ed035fe37188c4e1fbca85
refs/heads/master
2020-08-29T05:35:56.597644
2019-11-13T03:08:38
2019-11-13T03:08:38
217,944,069
0
0
null
null
null
null
UTF-8
Swift
false
false
238
swift
// // FishSpecies.swift // fishlist // // Created by Andre Burgoyne on 2019-10-21. // Copyright © 2019 Andre Burgoyne. All rights reserved. // import Foundation struct FishSpecies { var name: String var imageName: String }
[ -1 ]
5a5c33cfd8accff99f20733af1b3e2156f3bd146
ef0638f7a5351e40fb22919d640596fbaad0a443
/ios/PosDetector/RTPosDetectorView.swift
9af605697d7bfe48a615597855206a8c41d8111f
[]
no_license
aareusoftnet/RNGoogleMLKitiOSBridge
ca0f2fce87fed5643a8bb05867ac4a5841a32ff9
0e33e8a2c98283117f8134719d5ee9d1dc3c5223
refs/heads/main
2023-08-13T15:40:44.289153
2021-10-04T10:46:18
2021-10-04T10:46:18
413,378,918
0
0
null
null
null
null
UTF-8
Swift
false
false
13,977
swift
// // RTPosDetectorView.swift // BridgingDemo // import UIKit import AVFoundation import CoreVideo import MLKit //MARK: - Enum PosDetectorType private enum PosDetectorType: String { case pose = "Pose Detection" case poseAccurate = "Pose Detection, accurate" } //MARK: - Enum Constant private enum Constant { static let videoDataOutputQueueLabel = "com.google.mlkit.visiondetector.VideoDataOutputQueue" static let sessionQueueLabel = "com.google.mlkit.visiondetector.SessionQueue" static let smallDotRadius: CGFloat = 4.0 static let lineWidth: CGFloat = 2.0 } //MARK: - Class RTPosDetectorView class RTPosDetectorView: UIView { private var currentDetector: PosDetectorType = .pose private var isUsingFrontCamera = true private var previewLayer: AVCaptureVideoPreviewLayer! private var lastFrame: CMSampleBuffer? /// Initialized when one of the pose detector rows are chosen. Reset to `nil` when neither are. private var poseDetector: PoseDetector? = nil /// The detector mode with which detection was most recently run. Only used on the video output /// queue. Useful for inferring when to reset detector instances which use a conventional /// lifecyle paradigm. private var lastDetector: PosDetectorType? private lazy var captureSession = AVCaptureSession() private lazy var sessionQueue = DispatchQueue(label: Constant.sessionQueueLabel) private lazy var previewOverlayView: UIImageView = { let previewOverlayView = UIImageView(frame: .zero) previewOverlayView.contentMode = UIView.ContentMode.scaleAspectFill previewOverlayView.translatesAutoresizingMaskIntoConstraints = false return previewOverlayView }() private lazy var annotationOverlayView: UIView = { let annotationOverlayView = UIView(frame: .zero) annotationOverlayView.translatesAutoresizingMaskIntoConstraints = false return annotationOverlayView }() /// It is used to indicate real time detection enable or not. @objc var isEnableDetaction: Bool = false { didSet { if isEnableDetaction { previewOverlayView.isHidden = false annotationOverlayView.isHidden = false startSession() }else{ previewOverlayView.isHidden = true annotationOverlayView.isHidden = true stopSession() } } } @objc var onPoseDetect: RCTBubblingEventBlock? override init(frame: CGRect) { super.init(frame: frame) prepareUIs() } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) prepareUIs() } override func layoutSubviews() { super.layoutSubviews() previewLayer.frame = frame } deinit { print("Deallocated: \(classForCoder)") } } //MARK: UIRelated extension RTPosDetectorView { private func prepareUIs() { preparePreviewLayerUIs() setUpPreviewOverlayView() setUpAnnotationOverlayView() setUpCaptureSessionOutput() setUpCaptureSessionInput() } private func preparePreviewLayerUIs() { clipsToBounds = true previewLayer = AVCaptureVideoPreviewLayer(session: captureSession) } private func setUpPreviewOverlayView() { addSubview(previewOverlayView) NSLayoutConstraint.activate([ previewOverlayView.centerXAnchor.constraint(equalTo: centerXAnchor), previewOverlayView.centerYAnchor.constraint(equalTo: centerYAnchor), previewOverlayView.leadingAnchor.constraint(equalTo: leadingAnchor), previewOverlayView.trailingAnchor.constraint(equalTo: trailingAnchor), ]) } private func setUpAnnotationOverlayView() { addSubview(annotationOverlayView) NSLayoutConstraint.activate([ annotationOverlayView.topAnchor.constraint(equalTo: topAnchor), annotationOverlayView.leadingAnchor.constraint(equalTo: leadingAnchor), annotationOverlayView.trailingAnchor.constraint(equalTo: trailingAnchor), annotationOverlayView.bottomAnchor.constraint(equalTo: bottomAnchor), ]) } private func removeDetectionAnnotations() { for annotationView in annotationOverlayView.subviews { annotationView.removeFromSuperview() } } private func updatePreviewOverlayViewWithLastFrame() { guard let lastFrame = lastFrame, let imageBuffer = CMSampleBufferGetImageBuffer(lastFrame) else { return } updatePreviewOverlayViewWithImageBuffer(imageBuffer) } private func updatePreviewOverlayViewWithImageBuffer(_ imageBuffer: CVImageBuffer?) { guard let imageBuffer = imageBuffer else { return } let orientation: UIImage.Orientation = isUsingFrontCamera ? .leftMirrored : .right let image = UIUtilities.createUIImage(from: imageBuffer, orientation: orientation) previewOverlayView.image = image } } //MARK: AVCapture extension RTPosDetectorView: AVCaptureVideoDataOutputSampleBufferDelegate { private func startSession() { weak var weakSelf = self sessionQueue.async { guard let strongSelf = weakSelf else { print("Self is nil!") return } strongSelf.captureSession.startRunning() } } private func stopSession() { sessionQueue.async { self.captureSession.stopRunning() } } private func setUpCaptureSessionOutput() { sessionQueue.async { self.captureSession.beginConfiguration() // When performing latency tests to determine ideal capture settings, // run the app in 'release' mode to get accurate performance metrics self.captureSession.sessionPreset = AVCaptureSession.Preset.medium let output = AVCaptureVideoDataOutput() output.videoSettings = [(kCVPixelBufferPixelFormatTypeKey as String): kCVPixelFormatType_32BGRA] output.alwaysDiscardsLateVideoFrames = true let outputQueue = DispatchQueue(label: Constant.videoDataOutputQueueLabel) output.setSampleBufferDelegate(self, queue: outputQueue) guard self.captureSession.canAddOutput(output) else { print("Failed to add capture session output.") return } self.captureSession.addOutput(output) self.captureSession.commitConfiguration() } } private func setUpCaptureSessionInput() { weak var weakSelf = self sessionQueue.async { guard let strongSelf = weakSelf else { print("Self is nil!") return } let cameraPosition: AVCaptureDevice.Position = strongSelf.isUsingFrontCamera ? .front : .back guard let device = strongSelf.captureDevice(cameraPosition) else { print("Failed to get capture device for camera position: \(cameraPosition)") return } do { strongSelf.captureSession.beginConfiguration() let currentInputs = strongSelf.captureSession.inputs for input in currentInputs { strongSelf.captureSession.removeInput(input) } let input = try AVCaptureDeviceInput(device: device) guard strongSelf.captureSession.canAddInput(input) else { print("Failed to add capture session input.") return } strongSelf.captureSession.addInput(input) strongSelf.captureSession.commitConfiguration() } catch { print("Failed to create capture device input: \(error.localizedDescription)") } } } private func captureDevice(_ position: AVCaptureDevice.Position) -> AVCaptureDevice? { let discoverySession = AVCaptureDevice.DiscoverySession( deviceTypes: [.builtInWideAngleCamera], mediaType: .video, position: .unspecified ) return discoverySession.devices.first { $0.position == position } } func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) { guard let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else { print("Failed to get image buffer from sample buffer.") return } // Evaluate `self.currentDetector` once to ensure consistency throughout this method since it // can be concurrently modified from the main thread. let activeDetector = currentDetector resetManagedLifecycleDetectors(activeDetector) lastFrame = sampleBuffer let visionImage = VisionImage(buffer: sampleBuffer) let orientation = UIUtilities.imageOrientation( fromDevicePosition: isUsingFrontCamera ? .front : .back ) visionImage.orientation = orientation let imageWidth = CGFloat(CVPixelBufferGetWidth(imageBuffer)) let imageHeight = CGFloat(CVPixelBufferGetHeight(imageBuffer)) switch activeDetector { case .pose, .poseAccurate: detectPose(visionImage, width: imageWidth, height: imageHeight) } } } //MARK: PosDetector extension RTPosDetectorView { private func normalizedPoint(_ point: VisionPoint, width: CGFloat, height: CGFloat) -> CGPoint { let cgPoint = CGPoint(x: point.x, y: point.y) var normalizedPoint = CGPoint(x: cgPoint.x / width, y: cgPoint.y / height) normalizedPoint = previewLayer.layerPointConverted(fromCaptureDevicePoint: normalizedPoint) return normalizedPoint } private func detectPose(_ image: VisionImage, width: CGFloat, height: CGFloat) { if let poseDetector = poseDetector, let onPoseDetect = onPoseDetect { var params: [AnyHashable : Any] = [AnyHashable : Any]() var poses: [Pose] = [Pose]() do { poses = try poseDetector.results(in: image) } catch let error { params = ["poses" : poses, "error" : "Failed to detect poses with error: \(error.localizedDescription)."] onPoseDetect(params) print("Failed to detect poses with error: \(error.localizedDescription).") return } weak var weakSelf = self DispatchQueue.main.sync { guard let strongSelf = weakSelf else { print("Self is nil!") return } strongSelf.updatePreviewOverlayViewWithLastFrame() strongSelf.removeDetectionAnnotations() } guard !poses.isEmpty else { params = ["poses" : poses, "error" : "Pose detector returned no results."] onPoseDetect(params) print("Pose detector returned no results.") return } DispatchQueue.main.sync { guard let strongSelf = weakSelf else { print("Self is nil!") return } // Pose detected. Currently, only single person detection is supported. poses.forEach { pose in let poseOverlayView = UIUtilities.createPoseOverlayView( forPose: pose, inViewWithBounds: strongSelf.annotationOverlayView.bounds, lineWidth: Constant.lineWidth, dotRadius: Constant.smallDotRadius, positionTransformationClosure: { (position) -> CGPoint in return strongSelf.normalizedPoint(position, width: width, height: height) } ) strongSelf.annotationOverlayView.addSubview(poseOverlayView) } print("Poses: - \(poses.count)") guard let firstPose = poses.first else{return} for (index, landmark) in firstPose.landmarks.enumerated() { print("Index: \(index)") let position = landmark.position params[landmark.type.rawValue] = ["position" : ["x" : position.x, "y" : position.y, "z" : position.z]] } onPoseDetect(params) } } } /// Resets any detector instances which use a conventional lifecycle paradigm. This method is /// expected to be invoked on the AVCaptureOutput queue - the same queue on which detection is /// run. private func resetManagedLifecycleDetectors(_ activeDetector: PosDetectorType) { if activeDetector == self.lastDetector { // Same row as before, no need to reset any detectors. return } // Clear the old detector, if applicable. switch self.lastDetector { case .pose, .poseAccurate: self.poseDetector = nil break default: break } // Initialize the new detector, if applicable. switch activeDetector { case .pose, .poseAccurate: // The `options.detectorMode` defaults to `.stream` let options = activeDetector == .pose ? PoseDetectorOptions() : AccuratePoseDetectorOptions() self.poseDetector = PoseDetector.poseDetector(options: options) break } self.lastDetector = activeDetector } }
[ -1 ]
1111256aa940d1bb3a4019bf974e524368ebd273
3ed92e706f0203dd1ef9a52d8cf4530ccec91998
/SolEng_iOS_Demo/SBChat/OpenChannel/OpenChannelList.swift
246b750c681961d86e32575859ba72a3e5bc8652
[]
no_license
YJSendBird/SolEng_iOS_Demo
63c6de9da0ed5768bb532e7b5e09776ebe8d13e8
5a67f54f84528ce33973971f7b69b85ea3a88b51
refs/heads/master
2021-03-26T17:34:13.109793
2021-03-12T07:19:57
2021-03-12T07:19:57
247,726,460
0
0
null
null
null
null
UTF-8
Swift
false
false
908
swift
// // OpenChannelList.swift // SolEng_iOS_Demo // // Created by Yongjun Choi on 2020/04/07. // Copyright © 2020 YongjunChoi. All rights reserved. // import SwiftUI struct OpenChannelList: View { @ObservedObject var models = SBManager.shared().openChannelModel var body: some View { List(models.lists) { item in NavigationLink(destination: ChatUIView(chatType:ChatUIView.ChatType.openChat, channelUrl: item.channelUrl, channelName: item.name)) { OpenChannelListItemRow(item : item) } } .navigationBarTitle(Text("Open Channel List")) .navigationBarItems(trailing: HStack { Button("Add") { print("Add tapped!") } }) } } struct OpenChannelList_Previews: PreviewProvider { static var previews: some View { OpenChannelList() } }
[ -1 ]
ccadf67f11069d6071be0ae2318c71080f44ce43
36822b0899a517d9a33126b3f4d9f08c18c0c976
/SmartMain/ViewControllers/Content/View/SingSongSectionHeader.swift
83987a0f4501e2820eca742033063f39169aebeb
[]
no_license
cxcxy/SmartMainDev
ec9fc8e6b52c9712b6d3494781f7cebd819a48fb
63a6b00766d545e716afa64b61cfecf87791629e
refs/heads/master
2020-03-29T01:15:33.874898
2019-11-21T10:42:50
2019-11-21T10:42:50
149,379,912
0
0
null
null
null
null
UTF-8
Swift
false
false
565
swift
// // SingSongSectionHeader.swift // SmartMain // // Created by 陈旭 on 2018/10/16. // Copyright © 2018年 上海际浩智能科技有限公司(InfiniSmart). All rights reserved. // import UIKit class SingSongSectionHeader: UIView { @IBOutlet weak var lbTitle: UILabel! @IBOutlet weak var btnAll: UIButton! /* // Only override draw() if you perform custom drawing. // An empty implementation adversely affects performance during animation. override func draw(_ rect: CGRect) { // Drawing code } */ }
[ -1 ]
beb59703f68664484a5bea67cb1218824e7f0b12
d651db53fe5284161b10a4f417f5d8ed0bab53be
/CameraEngine/CameraEngineFileManager.swift
8e543e0fc5c24d1beaee0d2006da52f2b82d6ef4
[ "MIT" ]
permissive
oozou/CameraEngine
6ba7344955de0f55d663d36ed7b58a12d9ebaacd
fcb6b0a6643b4514435f7e0950b7739c8aaf2708
refs/heads/develop
2021-07-06T01:25:03.200124
2019-04-22T10:46:06
2019-04-22T10:56:29
147,188,931
0
2
MIT
2018-10-29T05:33:21
2018-09-03T10:28:06
Swift
UTF-8
Swift
false
false
2,223
swift
// // CameraEngineFileManager.swift // CameraEngine2 // // Created by Remi Robert on 11/02/16. // Copyright © 2016 Remi Robert. All rights reserved. // import UIKit import Photos import ImageIO public typealias blockCompletionSaveMedia = (_ success: Bool, _ error: Error?) -> (Void) public class CameraEngineFileManager { private class func removeItemAtPath(_ path: String) { let filemanager = FileManager.default if filemanager.fileExists(atPath: path) { do { try filemanager.removeItem(atPath: path) } catch { print("[Camera engine] Error remove path :\(path)") } } } private class func appendPath(_ rootPath: String, pathFile: String) -> String { let destinationPath = rootPath + "/\(pathFile)" self.removeItemAtPath(destinationPath) return destinationPath } public class func savePhoto(_ image: UIImage, blockCompletion: blockCompletionSaveMedia?) { PHPhotoLibrary.shared().performChanges({ () -> Void in PHAssetChangeRequest.creationRequestForAsset(from: image) }, completionHandler: blockCompletion) } public class func saveVideo(_ url: URL, blockCompletion: blockCompletionSaveMedia?) { PHPhotoLibrary.shared().performChanges({ () -> Void in PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: url) }, completionHandler: blockCompletion) } public class func documentPath() -> String? { if let path = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).last { return path } return nil } public class func temporaryPath() -> String { return NSTemporaryDirectory() } public class func documentPath(_ file: String) -> URL? { if let path = self.documentPath() { return URL(fileURLWithPath: self.appendPath(path, pathFile: file)) } return nil } public class func temporaryPath(_ file: String) -> URL? { return URL(fileURLWithPath: self.appendPath(self.temporaryPath(), pathFile: file)) } }
[ -1 ]
9859cbe242b37220dbac36dbc74e597da8c78678
3861870d955a137b30d85d504c1621d62e8ad71f
/appendAttributedString/appendAttributedString/StringExtension.swift
efa14427b1f0927174aa33ac4bdac5afef3604aa
[ "MIT" ]
permissive
asadqazi/appendAttributedString
758d7c287872694fe626f3abeba22ec8503da61e
b6a570ae67719604da0c61e4edc0c9e4dd927001
refs/heads/master
2021-02-14T19:25:51.344500
2020-03-04T07:02:47
2020-03-04T07:02:47
244,828,006
0
0
MIT
2020-03-04T06:47:31
2020-03-04T06:47:31
null
UTF-8
Swift
false
false
837
swift
// // StringExtension.swift // https://github.com/ysoftware // // Created by Ярослав Ерохин on 13.12.2019. // Copyright © 2017 Yaroslav Erohin. All rights reserved. // import Foundation public extension String { /// Creates a new instance of `NSMutableAttributedString` /// with given attributes from this `string`. func withAttributes( _ attributes: [NSAttributedString.Key : Any] = [:]) -> NSMutableAttributedString { return NSMutableAttributedString().append(self, withAttributes: attributes) } /// Creates a new instance of `NSMutableAttributedString` from this `string` /// with attributes passed in an `AttributesBuilder` instance. func withAttributes( _ builder: AttributesBuilder = .init()) -> NSMutableAttributedString { return NSMutableAttributedString().append(self, with: builder) } }
[ -1 ]
118160db6df9c008ca30336916dedd6f0544038d
ffef9907728654738f4bdb884dfd861c28a32e9b
/SWENSON-HE-TASK/Modules/CurrencySelect/Model/Helper/GetCurrentLocale.swift
32c9db9b5d3373353fbe93124e6a6a6db7b39fa9
[]
no_license
mohamedmagdy94/SWENSON-HE-TASK
5c69a55e70d3f4f6ce437c28ade007ba4222d526
9c0df34ba8dd617da3c1153ac68fbce59d915660
refs/heads/master
2023-02-06T01:59:38.753529
2021-01-01T19:28:25
2021-01-01T19:28:25
325,945,550
0
0
null
null
null
null
UTF-8
Swift
false
false
434
swift
// // GetCurrentLocale.swift // SWENSON-HE-TASK // // Created by Mohamed El-Taweel on 1/1/21. // Copyright © 2021 SWENSON-HE. All rights reserved. // import Foundation protocol GetCurrentLocaleManaging { func getCurrentLocale()->String } struct GetCurrentLocale: GetCurrentLocaleManaging{ func getCurrentLocale() -> String { let locale = Locale.current return locale.currencyCode ?? "USD" } }
[ -1 ]
80890c7e9337a9496bc1c8942b0cfe84b79e4795
0abb0cf20e5fdb9aacef53d3909a1d564b2e150f
/CollectGame/GameOverScene.swift
ab1dadec462186130ddd1a9314f10bd005eac356
[ "MIT" ]
permissive
andreasdri/swift-collect-game
018d5e441789e137b3bd8ec2b02f11bcb6d2400e
c24941a30d0db36f00af3debb6ec0a61bb465081
refs/heads/master
2021-05-30T04:59:38.648212
2016-01-08T14:55:11
2016-01-08T14:57:49
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,034
swift
// // GameOverScene.swift // CollectGame // // Created by Andreas Drivenes on 08.01.2016. // Copyright © 2016 Andreas Drivenes. All rights reserved. // import SpriteKit import Foundation class GameOverScene: StartGameScene { override func didMoveToView(view: SKView) { backgroundColor = SKColor.whiteColor() let startGameLabel = SKLabelNode(fontNamed:"Chalkduster") startGameLabel.text = "Start game" startGameLabel.fontSize = 30 startGameLabel.fontColor = SKColor.blueColor() startGameLabel.position = CGPointMake(size.width / 2, size.height / 2 - 30) startGameLabel.name = "startGame" addChild(startGameLabel) let gameOverLabel = SKLabelNode(fontNamed:"Chalkduster") gameOverLabel.text = "Game over!" gameOverLabel.fontSize = 40 gameOverLabel.fontColor = SKColor.blackColor() gameOverLabel.position = CGPointMake(size.width / 2, size.height - 50) addChild(gameOverLabel) } }
[ -1 ]
bd7053c3103368e2a6123dd60d67e402c7face37
cc8a1bd1b429bb0f6f7f448e08aa949a48ab98f6
/iTunesClient/Controllers/AlbumListController.swift
cccdcff455edaf7ca1954895b2f88d4528af90d2
[]
no_license
ciscojvr/iTunesClient
002aee32f6006b6d772b243a97031444f3d46930
61eeb71c25fcf881fd6169bf3451ef5f0a4d6225
refs/heads/master
2021-04-24T05:23:32.305442
2020-03-28T01:55:23
2020-03-28T01:55:23
250,084,676
0
0
null
null
null
null
UTF-8
Swift
false
false
2,528
swift
// // AlbumListController.swift // iTunesClient // // Created by Francisco Ozuna on 3/26/20. // Copyright © 2020 ozuna. All rights reserved. // import UIKit class AlbumListController: UITableViewController { private struct Constants { static let AlbumCellHeight: CGFloat = 80 } var artist: Artist? { didSet { self.title = artist?.name dataSource.update(with: artist!.albums) tableView.reloadData() } } lazy var dataSource: AlbumListDataSource = { return AlbumListDataSource(albums: [], tableView: self.tableView) }() let client = ItunesAPIClient() override func viewDidLoad() { super.viewDidLoad() tableView.dataSource = dataSource // Uncomment the following line to preserve selection between presentations // self.clearsSelectionOnViewWillAppear = false // Uncomment the following line to display an Edit button in the navigation bar for this view controller. // self.navigationItem.rightBarButtonItem = self.editButtonItem } // MARK: - Table view data source override func numberOfSections(in tableView: UITableView) -> Int { // #warning Incomplete implementation, return the number of sections return 0 } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { // #warning Incomplete implementation, return the number of rows return 0 } // MARK: – Table View Delegate override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return Constants.AlbumCellHeight } // MARK: - Navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "showAlbum" { if let selectedIndexPath = tableView.indexPathForSelectedRow { let selectedAlbum = dataSource.album(at: selectedIndexPath) // selectedAlbum.songs = Stub.songs let albumDetailController = segue.destination as! AlbumDetailController client.lookupAlbum(withId: selectedAlbum.id) { album, error in albumDetailController.album = album albumDetailController.artworkView.image = selectedAlbum.artwork } // albumDetailController.album = selectedAlbum } } } }
[ -1 ]
52f9f640b507b283ba332d659644eb8ba9dc3fdc
3fa7152dfa0e17496ae33b8e000b6d0937316f53
/swift4/Ch7_Classes&Structs.playground/Pages/Introduction to Protocols.xcplaygroundpage/Contents.swift
f8cbe57a813412ab902a021a339494361f816293
[]
no_license
ai230/swift
03a6398d6046fc5dc2a280e516d5bd84d60d0fd2
de2c67a10776cb9ee12c51b10561160388043e37
refs/heads/master
2021-01-23T03:28:39.523245
2018-12-18T17:57:33
2018-12-18T17:57:33
86,086,729
0
0
null
null
null
null
UTF-8
Swift
false
false
1,120
swift
/*: # Introduction to Protocols --- ## Topic Essentials A protocol is a template of properties and functions that can conformed to by a class or struct. If a class or struct implements a given protocol, they are entering into an agreement that says they will follow the rules the protocol has set out. ### Objectives + Declare a protocol called **Nameable** + Extend the **Nameable** protocol + Create a simple struct called **Player** and use the **Nameable** protocol */ // Declare a protocol protocol Nameable { var firstName: String {get} var lastName: String {get set} func createFullName() -> String } // Extend the protocol extension Nameable { func createFullName() -> String { return "\(firstName) \(lastName)" } } // Create struct with protocol struct Player: Nameable { var firstName: String var lastName: String func createFullName() -> String { return ("\(firstName) \(lastName) loves Swift 4!") } } let newPlayer = Player(firstName: "Harrison", lastName: "Ferrons") print(newPlayer.createFullName()) //: [Previous Topic](@previous)
[ -1 ]
4824f7222a51853c6b954e9e34137e5f30ebe2ba
41433fc11bcb25d0b2076e4ed52e72a5bbb88199
/Practise_files/AutoLayoutTest/AutoLayoutTest/AppDelegate.swift
dc024bee9510ae230cfe5fca06f73b5a0dbdb4e0
[]
no_license
sparrigan/PhonePush
14ea6c498575ddda7ec9873d9a0d0da8e4df85bf
5134deace81a1d596af03d5a1d4741c6b89b98c5
refs/heads/master
2020-12-28T22:12:05.266385
2015-06-30T15:34:32
2015-06-30T15:34:32
33,743,176
0
0
null
null
null
null
UTF-8
Swift
false
false
2,165
swift
// // AppDelegate.swift // AutoLayoutTest // // Created by Nicholas Harrigan on 23/04/2015. // Copyright (c) 2015 Nicholas Harrigan. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } func applicationDidEnterBackground(application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } }
[ 229380, 229383, 229385, 278539, 229388, 294924, 278542, 229391, 327695, 278545, 229394, 278548, 229397, 229399, 229402, 278556, 229405, 278559, 229408, 278564, 294950, 229415, 229417, 237613, 229422, 237618, 229426, 229428, 286774, 204856, 319544, 286776, 229432, 286791, 237640, 278605, 286797, 311375, 237646, 163920, 196692, 319573, 311383, 278623, 278626, 319590, 311400, 278635, 303212, 278639, 278648, 131192, 237693, 327814, 131209, 417930, 303241, 303244, 311436, 319633, 286873, 286876, 311460, 311469, 32944, 327862, 286906, 327866, 180413, 286910, 131264, 286916, 286922, 286924, 286926, 319694, 286928, 131281, 278743, 278747, 295133, 155872, 319716, 278760, 237807, 303345, 286962, 131314, 229622, 327930, 278781, 278783, 278785, 237826, 319751, 278792, 286987, 319757, 311569, 286999, 319770, 287003, 287006, 287009, 287012, 287014, 287016, 287019, 311598, 287023, 311601, 287032, 155966, 278849, 319809, 319810, 319814, 319818, 311628, 229709, 287054, 319822, 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, 279010, 287202, 279015, 172520, 319978, 279020, 172526, 279023, 311791, 172529, 279027, 319989, 164343, 180727, 279035, 311804, 287230, 279040, 303617, 287234, 279045, 287238, 320007, 172550, 172552, 303623, 279051, 172558, 279055, 303632, 279058, 303637, 279063, 279067, 172572, 279072, 172577, 295459, 172581, 295461, 279082, 311850, 279084, 172591, 172598, 279095, 172607, 172609, 172612, 377413, 172614, 172618, 303690, 33357, 287309, 279124, 172634, 262752, 311911, 189034, 295533, 189039, 189040, 172655, 172656, 295538, 189044, 172660, 287349, 352880, 287355, 287360, 295553, 287365, 295557, 303751, 311942, 352905, 279178, 287371, 311946, 311951, 287377, 287381, 311957, 221850, 287386, 164509, 287390, 295583, 230045, 303773, 287394, 172702, 303780, 172705, 287398, 172707, 279208, 287400, 172714, 295595, 279212, 189102, 172721, 287409, 66227, 303797, 189114, 287419, 303804, 328381, 279231, 287423, 328384, 287427, 312006, 107208, 279241, 287436, 107212, 172748, 172751, 287440, 295633, 172755, 303827, 279255, 172760, 279258, 303835, 213724, 189149, 303838, 287450, 279267, 312035, 295654, 279272, 230128, 312048, 312050, 230131, 205564, 303871, 230146, 295685, 230154, 33548, 312077, 295695, 295701, 369433, 230169, 295707, 328476, 295710, 230175, 303914, 279340, 205613, 279353, 230202, 312124, 222018, 295755, 377676, 148302, 287569, 279383, 303959, 230237, 279390, 230241, 279394, 303976, 336744, 303985, 303987, 328563, 279413, 303991, 303997, 295806, 295808, 304005, 295813, 320391, 213895, 304009, 304007, 304011, 230284, 304013, 213902, 279438, 295822, 189329, 295825, 304019, 189331, 279445, 58262, 279452, 410526, 279461, 279462, 304042, 213931, 230327, 304055, 287675, 197564, 304063, 238528, 304065, 189378, 213954, 156612, 295873, 213963, 312272, 304084, 304090, 320481, 320490, 304106, 312302, 328687, 320496, 304114, 295928, 320505, 312321, 295945, 197645, 295949, 230413, 320528, 140312, 238620, 197663, 304164, 189479, 304170, 238641, 312374, 238652, 238655, 230465, 238658, 296004, 336964, 205895, 320584, 238666, 296021, 402518, 336987, 230497, 296036, 296040, 361576, 205931, 296044, 164973, 279661, 205934, 312432, 279669, 189562, 337018, 279679, 279683, 222340, 205968, 296084, 238745, 304285, 238756, 205991, 222377, 165035, 337067, 165038, 238766, 230576, 304311, 230592, 279750, 230600, 230607, 148690, 279769, 304348, 279777, 304354, 296163, 279781, 304360, 279788, 320748, 279790, 304370, 320771, 312585, 296202, 296205, 320786, 230674, 296213, 214294, 296215, 320792, 230677, 230681, 304416, 230689, 173350, 312622, 296243, 312630, 222522, 222525, 230718, 296255, 312639, 296259, 378181, 230727, 238919, 320840, 222545, 230739, 312663, 222556, 337244, 230752, 312676, 230760, 173418, 410987, 230763, 230768, 296305, 230773, 279929, 181626, 304506, 304505, 181631, 312711, 296331, 288140, 230800, 288144, 304533, 337306, 288154, 288160, 173472, 288162, 288164, 279975, 304555, 370092, 279983, 173488, 279985, 312755, 296373, 279991, 337335, 312759, 288185, 222652, 173507, 296389, 222665, 230860, 312783, 230865, 370130, 288210, 288212, 280021, 288214, 222676, 239064, 288217, 288218, 280027, 288220, 329177, 239070, 288224, 370146, 280034, 280036, 288226, 280038, 288230, 288232, 288229, 288234, 320998, 288236, 288238, 288240, 288242, 296435, 288244, 296439, 288250, 148990, 402942, 206336, 296446, 296450, 321022, 230916, 230919, 214535, 370187, 304651, 304653, 230940, 222752, 108066, 296488, 230961, 288320, 288325, 124489, 280140, 280145, 288338, 280149, 280152, 288344, 239194, 280158, 403039, 370272, 181854, 239202, 312938, 280183, 280185, 280188, 280191, 280194, 116354, 280208, 280211, 288408, 280218, 280222, 190118, 321195, 296622, 321200, 337585, 296626, 296634, 296637, 280260, 280264, 206536, 206539, 206541, 280276, 313044, 321239, 280283, 288478, 313055, 321252, 313066, 280302, 288494, 280304, 313073, 419570, 288499, 288502, 280314, 288510, 124671, 67330, 280324, 280331, 198416, 280337, 296723, 116503, 321304, 329498, 296731, 313121, 313123, 304932, 321316, 280363, 141101, 165678, 280375, 321336, 296767, 288576, 345921, 280388, 304968, 280393, 280402, 313176, 280419, 321381, 296812, 313201, 1920, 255873, 305028, 280454, 247688, 280458, 280464, 124817, 280468, 239510, 280473, 124827, 214940, 247709, 280487, 313258, 321458, 296883, 124853, 214966, 10170, 296890, 288700, 296894, 280515, 190403, 296900, 337862, 165831, 280521, 231379, 296921, 239586, 313320, 231404, 124913, 165876, 321528, 288764, 239612, 239617, 313347, 288773, 313358, 305176, 313371, 354338, 305191, 223273, 313386, 354348, 124978, 215090, 124980, 288824, 288826, 378941, 313406, 288831, 288836, 67654, 223303, 280651, 354382, 288848, 280658, 215123, 354390, 288855, 288859, 280669, 313438, 223327, 149599, 280671, 321634, 149603, 329830, 280681, 313451, 223341, 280687, 215154, 280691, 313458, 313464, 321659, 280702, 288895, 321670, 215175, 141446, 141455, 141459, 280725, 313498, 288936, 100520, 280747, 288940, 280755, 288947, 321717, 280759, 280764, 280769, 280771, 280774, 280776, 313548, 321740, 280783, 280786, 280788, 313557, 280793, 280796, 280798, 338147, 280804, 280807, 157930, 280811, 280817, 280819, 157940, 182517, 125171, 280823, 280825, 280827, 280830, 280831, 280833, 280835, 125187, 125191, 125207, 125209, 321817, 125218, 321842, 223539, 125239, 280888, 280891, 289087, 280897, 280900, 239944, 305480, 280906, 239947, 305485, 305489, 379218, 280919, 354653, 313700, 280937, 313705, 280940, 190832, 280946, 223606, 313720, 280956, 280959, 313731, 240011, 199051, 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, 281084, 240124, 305662, 305664, 240129, 305666, 240132, 223749, 305668, 281095, 223752, 338440, 150025, 223757, 281102, 223763, 223765, 281113, 322074, 281116, 281121, 182819, 281127, 281135, 150066, 158262, 158266, 289342, 281154, 322115, 158283, 281163, 281179, 199262, 338528, 338532, 281190, 199273, 281196, 158317, 19053, 313973, 281210, 297594, 158347, 133776, 314003, 117398, 314007, 289436, 174754, 330404, 289448, 133801, 174764, 314029, 314033, 240309, 133817, 314045, 314047, 314051, 199364, 199367, 297671, 158409, 289493, 363234, 289513, 289522, 289525, 289532, 322303, 289537, 322310, 264969, 322314, 322318, 281361, 281372, 322341, 215850, 281388, 281401, 289593, 289601, 281410, 281413, 281414, 240458, 281420, 240468, 281430, 322393, 297818, 281435, 281438, 281442, 174955, 224110, 207733, 207737, 183172, 158596, 338823, 322440, 314249, 240519, 183184, 240535, 289687, 289694, 289696, 289700, 289712, 281529, 289724, 52163, 281567, 289762, 322534, 297961, 281581, 183277, 322550, 134142, 322563, 175134, 322599, 322610, 314421, 281654, 314427, 207937, 314433, 314441, 207949, 322642, 314456, 281691, 314461, 281702, 281704, 314474, 281708, 281711, 289912, 308373, 248995, 306341, 306344, 306347, 306354, 142531, 199877, 289991, 306377, 249045, 363742, 363745, 298216, 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, 306555, 314747, 290174, 298365, 224641, 281987, 298372, 314756, 281990, 224647, 265604, 298377, 314763, 142733, 298381, 224657, 306581, 314779, 314785, 282025, 282027, 241068, 241070, 241072, 282034, 241077, 150966, 298424, 306618, 282044, 323015, 306635, 306640, 290263, 290270, 290275, 339431, 282089, 191985, 282098, 290291, 282101, 241142, 290298, 151036, 290302, 282111, 290305, 175621, 192008, 323084, 257550, 282127, 290321, 282130, 323090, 282133, 290325, 241175, 290328, 282137, 290332, 241181, 282142, 282144, 290344, 306731, 290349, 290351, 290356, 282186, 224849, 282195, 282199, 282201, 306778, 159324, 159330, 314979, 298598, 224875, 241260, 323181, 257658, 315016, 282249, 290445, 282261, 298651, 282269, 323229, 298655, 323231, 61092, 282277, 306856, 282295, 282300, 323260, 323266, 282310, 323273, 282319, 306897, 241362, 282328, 298714, 52959, 216801, 282337, 241380, 216806, 323304, 282345, 12011, 282356, 323318, 282364, 282367, 306945, 241412, 323333, 282376, 216842, 323345, 282388, 323349, 282392, 184090, 315167, 315169, 282402, 315174, 241448, 315176, 282410, 241450, 306988, 306991, 315184, 323376, 315190, 241464, 282425, 159545, 298811, 307009, 413506, 241475, 307012, 148946, 315211, 282446, 307027, 315221, 282454, 323414, 241496, 315223, 241498, 307035, 307040, 282465, 110433, 241509, 110438, 298860, 110445, 282478, 282481, 110450, 315251, 315249, 315253, 315255, 339838, 282499, 315267, 315269, 241544, 282505, 241546, 241548, 298896, 282514, 298898, 44948, 241556, 298901, 282520, 241560, 241563, 241565, 241567, 241569, 282531, 241574, 282537, 298922, 36779, 241581, 282542, 241583, 323504, 241586, 282547, 241588, 290739, 241590, 241592, 241598, 290751, 241600, 241605, 151495, 241610, 298975, 241632, 298984, 241640, 241643, 298988, 241646, 241649, 241652, 323574, 290807, 299006, 282623, 241669, 315397, 282632, 282639, 290835, 282645, 241693, 282654, 102438, 217127, 282669, 323630, 282681, 290877, 282687, 159811, 315463, 315466, 192589, 307278, 192596, 176213, 307287, 315482, 217179, 315483, 192605, 233567, 200801, 217188, 299109, 315495, 307303, 45163, 307307, 315502, 192624, 307314, 323700, 299126, 233591, 299136, 307329, 307338, 233613, 241813, 307352, 299164, 184479, 299167, 184481, 315557, 184486, 307370, 307372, 184492, 307374, 307376, 323763, 176311, 184503, 307385, 307386, 258235, 176316, 307388, 307390, 299200, 184512, 307394, 307396, 299204, 184518, 323784, 307409, 307411, 176343, 299225, 233701, 307432, 184572, 282881, 184579, 282893, 291089, 282906, 233766, 282931, 307508, 176435, 307510, 332086, 151864, 168245, 315701, 307515, 282942, 307518, 151874, 282947, 282957, 110926, 323917, 233808, 323921, 315733, 323926, 233815, 315739, 323932, 299357, 242018, 242024, 299373, 315757, 250231, 242043, 315771, 299388, 299391, 291202, 299398, 242057, 291212, 299405, 291222, 283033, 291226, 242075, 291231, 61855, 283042, 291238, 291241, 127403, 127405, 127407, 291247, 299440, 299444, 127413, 283062, 291254, 127417, 291260, 283069, 127421, 127424, 127429, 127431, 283080, 127434, 176592, 315856, 315860, 176597, 283095, 127447, 299481, 176605, 242143, 291299, 242152, 291305, 127466, 176620, 291314, 291317, 135672, 291323, 233979, 127485, 291330, 283142, 127497, 135689, 233994, 291341, 233998, 127506, 234003, 234006, 127511, 152087, 283161, 242202, 234010, 135707, 242206, 135710, 242208, 291361, 242220, 291378, 152118, 234038, 70213, 284243, 111193, 242275, 299620, 242279, 168562, 184952, 135805, 291456, 135808, 299655, 373383, 135820, 316051, 225941, 316054, 299672, 135834, 373404, 299677, 225948, 135839, 299680, 225954, 299684, 242343, 209576, 242345, 373421, 135870, 135873, 135876, 135879, 299720, 299723, 225998, 299726, 226002, 226005, 119509, 226008, 242396, 299740, 201444, 299750, 283368, 234219, 283372, 381677, 226037, 283382, 234231, 316151, 234236, 226045, 234239, 242431, 209665, 234242, 242436, 234246, 226056, 234248, 291593, 242443, 234252, 242445, 234254, 291601, 242450, 234258, 242452, 234261, 348950, 201496, 234264, 234266, 283421, 234269, 234272, 234274, 152355, 234278, 299814, 283432, 234281, 234284, 234287, 283440, 185138, 242483, 234292, 234296, 234298, 283452, 160572, 234302, 234307, 242499, 234309, 234313, 316233, 316235, 234316, 283468, 234319, 242511, 234321, 234324, 201557, 234329, 234333, 308063, 234336, 234338, 242530, 349027, 234341, 234344, 234347, 177004, 234350, 324464, 234353, 152435, 234356, 177011, 234358, 234362, 226171, 234364, 291711, 234368, 234370, 291714, 291716, 234373, 226182, 234375, 226185, 308105, 234379, 234384, 234388, 234390, 226200, 234393, 209818, 308123, 234396, 324504, 234398, 291742, 324508, 234401, 291747, 291748, 234405, 291750, 234407, 324518, 324520, 234410, 291754, 226220, 324522, 234414, 324527, 291760, 234417, 291756, 324531, 201650, 226230, 234422, 275384, 324536, 234428, 291773, 226239, 234431, 242623, 324544, 234434, 324546, 226245, 234437, 234439, 324548, 234443, 291788, 275406, 234446, 193486, 234449, 193488, 234452, 234455, 234459, 234461, 234464, 234467, 234470, 168935, 5096, 324585, 234475, 234478, 316400, 234481, 316403, 234484, 234485, 234487, 324599, 234490, 234493, 234496, 316416, 234501, 275462, 308231, 234504, 234507, 234510, 234515, 300054, 234519, 234520, 316439, 234523, 234528, 300066, 234532, 300069, 234535, 234537, 234540, 144430, 234543, 234546, 275508, 234549, 300085, 300088, 234556, 234558, 316479, 234561, 234563, 308291, 316483, 234568, 234570, 316491, 234572, 300108, 234574, 300115, 234580, 234581, 275545, 234585, 242777, 234590, 234593, 234595, 234597, 300133, 234601, 300139, 234605, 234607, 160879, 275569, 234610, 300148, 234614, 398455, 234618, 275579, 144506, 234620, 234623, 226433, 234627, 275588, 234629, 234634, 234636, 177293, 234640, 275602, 234643, 226453, 275606, 234647, 275608, 234648, 234650, 308379, 324757, 283805, 234653, 119967, 300189, 234657, 324768, 324766, 242852, 283813, 234661, 300197, 234664, 275626, 234667, 316596, 308414, 234687, 300226, 308418, 226500, 283844, 300229, 308420, 234692, 283850, 300234, 300238, 300241, 316625, 300243, 300245, 316630, 300248, 300253, 300256, 300258, 300260, 234726, 300263, 300265, 161003, 300267, 300270, 300272, 120053, 300278, 275703, 316663, 300284, 275710, 300287, 283904, 292097, 300289, 300292, 300294, 275719, 177419, 300299, 283917, 242957, 275725, 177424, 300301, 349464, 283939, 259367, 283951, 292143, 300344, 226617, 283963, 243003, 226628, 283973, 300357, 177482, 283983, 316758, 357722, 316766, 218464, 316768, 292197, 316774, 243046, 218473, 284010, 136562, 324978, 275834, 333178, 275836, 275840, 316803, 316806, 226696, 226699, 316811, 316814, 226703, 300433, 234899, 226709, 357783, 316824, 316826, 144796, 300448, 144807, 144810, 284076, 144812, 144814, 284084, 144820, 284087, 292279, 144826, 144828, 144830, 144832, 144835, 284099, 144837, 38342, 144839, 144841, 144844, 144847, 144852, 144855, 103899, 300507, 333280, 218597, 292329, 300523, 259565, 259567, 300527, 308720, 226802, 316917, 308727, 300537, 316947, 308757, 308762, 284191, 284194, 284196, 235045, 284199, 284204, 284206, 284209, 284211, 284213, 194101, 194103, 284215, 284218, 226877, 284223, 284226, 243268, 284228, 226886, 284231, 128584, 292421, 284234, 276043, 366155, 317004, 284238, 226895, 284241, 194130, 292433, 276052, 276053, 300628, 284245, 284247, 235097, 243290, 284251, 284249, 284253, 300638, 284255, 317015, 243293, 284258, 292452, 292454, 284263, 177766, 284265, 292458, 284267, 292461, 284272, 284274, 276086, 284278, 292470, 292473, 284283, 276093, 284286, 276095, 284288, 292479, 276098, 284290, 284292, 292481, 292485, 325250, 284297, 317066, 284299, 317068, 276109, 284301, 284303, 276114, 284306, 284308, 284312, 284314, 284316, 276127, 284320, 284322, 284327, 276137, 284329, 284331, 317098, 284333, 284335, 276144, 284337, 284339, 300726, 284343, 284346, 284350, 276160, 358080, 284354, 358083, 276166, 284358, 358089, 276170, 284362, 276175, 284368, 276177, 284370, 317138, 358098, 284372, 284377, 276187, 284379, 284381, 284384, 284386, 358116, 276197, 317158, 284392, 325353, 284394, 358122, 284397, 276206, 284399, 358128, 358126, 358133, 358135, 276216, 358138, 300795, 358140, 284413, 358142, 284418, 317187, 358146, 317191, 284428, 300816, 300819, 317207, 284440, 186139, 300828, 300830, 276255, 300832, 284449, 300834, 325408, 227109, 317221, 358183, 186151, 276268, 300845, 194351, 243504, 284469, 276280, 325436, 358206, 276291, 366406, 276295, 300872, 153417, 284499, 276308, 284502, 317271, 178006, 276315, 292700, 284511, 227175, 292715, 300912, 284529, 292721, 300915, 284533, 292729, 317306, 284540, 292734, 325512, 169868, 276365, 284564, 358292, 284566, 350106, 284572, 276386, 284579, 276388, 358312, 284585, 317353, 276395, 292776, 292784, 276402, 161718, 358326, 276410, 276411, 358330, 276418, 276425, 301009, 301011, 301013, 301015, 358360, 301017, 292828, 276446, 153568, 276448, 276452, 276455, 292839, 292843, 276460, 276464, 178161, 227314, 276466, 276472, 325624, 317435, 276476, 276479, 276482, 276485, 276490, 292876, 276496, 317456, 317458, 243733, 243740, 317468, 317472, 325666, 243751, 292904, 276528, 243762, 309298, 325685, 325689, 276539, 235579, 235581, 178238, 325692, 276544, 284739, 292934, 276553, 243785, 350293, 350295, 194649, 227418, 309337, 194654, 227423, 350302, 194657, 227426, 276579, 178273, 194660, 227430, 276583, 309346, 309348, 276586, 309350, 350308, 309354, 276590, 350313, 227440, 350316, 284786, 276595, 301167, 350321, 350325, 350328, 292985, 301178, 292989, 292993, 317570, 350339, 301185, 317573, 350342, 227463, 350345, 350349, 301199, 317584, 325777, 350354, 350357, 350359, 350362, 276638, 350366, 284837, 153765, 350375, 350379, 350381, 350383, 129200, 350385, 350387, 350389, 350395, 350397, 350399, 227520, 227522, 350402, 301252, 350406, 227529, 301258, 309450, 276685, 276689, 309462, 301272, 276699, 309468, 194780, 309471, 301283, 317672, 276713, 325867, 243948, 194801, 227571, 309491, 276725, 309494, 243960, 276735, 227583, 227587, 276739, 211204, 276742, 227593, 227596, 325910, 342298, 309530, 276766, 211232, 317729, 276775, 211241, 325937, 276789, 325943, 211260, 260421, 276809, 285002, 276811, 235853, 276816, 235858, 276829, 276833, 391523, 276836, 276843, 293227, 276848, 293232, 186744, 285051, 211324, 227709, 285061, 317833, 178572, 285070, 285077, 178583, 227738, 317853, 276896, 317858, 342434, 285093, 285098, 276907, 235955, 276917, 293304, 293307, 293314, 309707, 293325, 317910, 293336, 235996, 317917, 293343, 358880, 276961, 227810, 293346, 276964, 293352, 236013, 293364, 301562, 317951, 309764, 301575, 121352, 236043, 317963, 342541, 55822, 113167, 277011, 309779, 309781, 317971, 55837, 227877, 227879, 293417, 227882, 293421, 105007, 236082, 285236, 23094, 277054, 244288, 129603, 318020, 301636, 301639, 301643, 285265, 399955, 277080, 309849, 285277, 285282, 326244, 318055, 277100, 277106, 121458, 170618, 170619, 309885, 309888, 277122, 227975, 277128, 285320, 301706, 318092, 326285, 318094, 334476, 277136, 277139, 227992, 285340, 318108, 227998, 318110, 137889, 383658, 285357, 318128, 277170, 342707, 154292, 277173, 293555, 318132, 285368, 277177, 277181, 318144, 277187, 277191, 277194, 277196, 277201, 137946, 113378, 203491, 228069, 277223, 342760, 285417, 56041, 56043, 277232, 228081, 56059, 310015, 285441, 310020, 285448, 285453, 310029, 228113, 285459, 277273, 293659, 326430, 228128, 285474, 293666, 228135, 318248, 277291, 293677, 318253, 285489, 293685, 285494, 301880, 285499, 301884, 293696, 310080, 277314, 277317, 277322, 277329, 162643, 310100, 301911, 277337, 301913, 301921, 400236, 236397, 162671, 326514, 310134, 277368, 236408, 15224, 416639, 416640, 113538, 310147, 416648, 277385, 39817, 187274, 301972, 424853, 277405, 277411, 310179, 293798, 293802, 236460, 277426, 293811, 293817, 293820, 203715, 326603, 293849, 293861, 228327, 228328, 228330, 318442, 228332, 277486, 326638, 318450, 293877, 285686, 302073, 285690, 244731, 293882, 302075, 121850, 293887, 277504, 277507, 277511, 277519, 293908, 293917, 293939, 318516, 277561, 277564, 7232, 310336, 293956, 277573, 228422, 293960, 277577, 310344, 277583, 203857, 293971, 310359, 236632, 277594, 138332, 277598, 285792, 277601, 203872, 310374, 203879, 310376, 228460, 318573, 203886, 187509, 285815, 285817, 367737, 285821, 302205, 285824, 285831, 253064, 302218, 285835, 294026, 162964, 384148, 187542, 302231, 285849, 302233, 285852, 302237, 285854, 285856, 285862, 277671, 302248, 64682, 277678, 228526, 294063, 294065, 302258, 277687, 294072, 318651, 294076, 277695, 318657, 244930, 302275, 130244, 302277, 228550, 302282, 310476, 302285, 302288, 310481, 302290, 203987, 302292, 302294, 302296, 384222, 310498, 285927, 318698, 302315, 195822, 228592, 294132, 138485, 204023, 228601, 204026, 228606, 204031, 64768, 310531, 285958, 228617, 138505, 318742, 204067, 277798, 130345, 277801, 113964, 285997, 277804, 277807, 285999, 113969, 277811, 318773, 277816, 318776, 286010, 277819, 294204, 277822, 417086, 286016, 294211, 302403, 277832, 384328, 277836, 277839, 326991, 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, 277892, 294276, 327046, 277894, 253320, 310665, 277898, 318858, 351619, 277903, 310672, 277905, 351633, 277908, 277917, 277921, 310689, 277923, 130468, 228776, 277928, 277932, 310703, 277937, 130486, 310710, 310712, 277944, 310715, 277947, 302526, 228799, 277950, 277953, 64966, 277959, 163272, 302534, 310727, 245191, 292968, 302541, 277966, 302543, 277963, 310737, 277971, 277975, 228825, 163290, 277978, 277981, 310749, 277984, 310755, 277989, 277991, 187880, 277995, 286188, 310764, 278000, 278003, 310772, 228851, 278006, 212472, 278009, 40440, 286203, 40443, 228864, 286214, 228871, 302603, 65038, 302614, 286233, 302617, 286240, 146977, 187939, 294435, 40484, 286246, 294439, 294440, 278057, 40486, 294443, 40488, 294445, 286248, 40491, 310831, 212538, 40507, 40511, 40513, 228933, 40521, 286283, 40525, 40527, 228944, 212560, 400976, 40533, 147032, 40537, 278109, 40541, 40544, 40548, 40550, 286312, 286313, 40552, 40554, 310892, 40557, 40560, 188022, 122488, 294521, 343679, 310925, 286354, 278163, 302740, 122517, 278168, 327333, 229030, 212648, 278188, 302764, 278192, 319153, 278196, 319171, 302789, 294599, 278216, 294601, 302793, 278227, 229076, 286420, 319187, 286425, 319194, 278235, 301163, 229086, 278238, 286432, 294625, 294634, 302838, 319226, 286460, 278274, 302852, 278277, 302854, 311048, 352008, 294664, 319243, 311053, 302862, 294682, 278306, 188199, 294701, 278320, 319280, 319290, 229192, 302925, 188247, 237409, 294776, 360317, 294785, 327554, 40840, 40851, 294803, 188312, 294811, 319390, 294817, 40865, 319394, 294821, 180142, 294831, 188340, 40886, 319419, 294844, 294847, 309352, 393177, 294876, 294879, 294883, 294890, 278508, 311279, 278513, 237555, 278516, 311283, 278519, 237562 ]
32e83793bc696ff29c40e89e52418fd43721b140
f159a11399bd49a63e5d041c4be01eaec1f3206c
/OtusHomeWork/OtusHomeWork/Modules/Networking/Sources/Networking/Generated/Models/Team.swift
6c7f55a1054ebe57cc10f09d690e9f61694fc251
[]
no_license
kravik/otus-ios-pro
95d4ff90edbece604f90b4c415dfae30c426fb87
07c38d396559a57a896c0f8f493d1752698a4067
refs/heads/main
2023-03-14T23:31:03.348973
2021-02-24T19:19:07
2021-02-24T19:19:07
321,779,135
0
0
null
null
null
null
UTF-8
Swift
false
false
292
swift
// // Team.swift // // Generated by openapi-generator // https://openapi-generator.tech // import Foundation public struct Team: Codable { public var id: Int public var name: String public init(id: Int, name: String) { self.id = id self.name = name } }
[ -1 ]
9d0a8c9b6c96aa62d9813c34460c50faa6314415
285c768f699eec31ad93de2a1ca0adf0a59a8f1a
/Sources/Parsable/Parsable.swift
b2e64b4d17c9f28bff3fe76b61e6f0f8e60f228c
[ "MIT" ]
permissive
makoni/parsable
f1f0c2ab81e05653ba4ef90b727cc04e6be4cd55
cd46d2c2ddd571d765fd70199f3c3dd6f27950f2
refs/heads/master
2023-08-31T11:18:05.532624
2023-08-19T22:21:03
2023-08-19T22:21:03
210,425,770
1
0
null
null
null
null
UTF-8
Swift
false
false
2,790
swift
// // Parseable.swift // haterlive // // Created by Sergey Armodin on 23.09.2019. // Copyright © 2019 Sergei Armodin. All rights reserved. // import Foundation /// Protocol for types that available for JSON Parse/Encode public protocol Parseable { // MARK: - Assissiated type for codable type associatedtype ParseableType: Codable /// Decode JSON to Parsable model. /// - Parameters: /// - data: JSON data. /// - withDateDecodingStrategy: Date decoding strategy. /// - Returns: Parsed object/scruct of assosiated type. static func decodeFromData(data: Data, withDateDecodingStrategy: JSONDecoder.DateDecodingStrategy) -> ParseableType? /// Encode self to JSON data. /// - Parameters: /// - encodable: Model type. /// - withDateEncodingStrategy: Date encoding strategy. /// - Returns: JSON Data. static func encode(fromEncodable encodable: ParseableType, withDateEncodingStrategy: JSONEncoder.DateEncodingStrategy) -> Data? } // MARK: - Default protocol implementation extension Parseable { /// Debug log function with printing filename, method and line number /// /// - Parameters: /// - messages: arguments /// - fullPath: filepath /// - line: line number /// - functionName: function/method name private static func DLog(_ messages: Any..., fullPath: String = #file, line: Int = #line, functionName: String = #function) { #if DEBUG let file = URL(fileURLWithPath: fullPath) for message in messages { let string = "\(file.pathComponents.last!):\(line) -> \(functionName): \(message)" print(string) } #endif } /// Decode JSON to Parsable model /// - Parameters: /// - data: JSON data. /// - dateDecodingStrategy: Date decoding strategy. public static func decodeFromData(data: Data, withDateDecodingStrategy dateDecodingStrategy: JSONDecoder.DateDecodingStrategy = .secondsSince1970) -> ParseableType? { let decoder = JSONDecoder() decoder.dateDecodingStrategy = dateDecodingStrategy var decodedData: ParseableType? do { decodedData = try decoder.decode(ParseableType.self, from: data) } catch (let error) { Self.DLog(error.localizedDescription) return nil } return decodedData } /// Encode Parsable model to Data /// - Parameters: /// - encodable: Data model. /// - dateEncodingStrategy: Date encoding strategy. public static func encode(fromEncodable encodable: ParseableType, withDateEncodingStrategy dateEncodingStrategy: JSONEncoder.DateEncodingStrategy = .secondsSince1970) -> Data? { let encoder = JSONEncoder() encoder.dateEncodingStrategy = dateEncodingStrategy var encodedData: Data do { encodedData = try encoder.encode(encodable) } catch (let error) { Self.DLog(error.localizedDescription) return nil } return encodedData } }
[ -1 ]
ce73db774a5391b44b4a91b43f0493215fa93c3b
ecf3ebdc2cba2bb0b04e93619889ac4e9962e9dd
/Example/FTMTableSectionModules/HelloWorldModule/HelloWorldModule.swift
22521b92b323dd085f322412b9041f58ff1bd7c7
[ "MIT" ]
permissive
bruce-wmm/FTMTableSectionModules
305ccb2dd79f4f28fa34ba43a3452a0aeacab56d
43262e8cc5557f652a87626ff8315fb94b30f8d5
refs/heads/master
2020-05-29T19:40:44.987694
2019-03-27T17:16:21
2019-03-27T17:32:17
null
0
0
null
null
null
null
UTF-8
Swift
false
false
1,108
swift
// // HelloWorldModule.swift // FTMTableSectionModules_Example // // Created by Francisco Javier Trujillo Mata on 03/12/2018. // Copyright © 2018 FJTRUJY. All rights reserved. // import FTMTableSectionModules class HelloWorldModule: TableSectionModule { override func registerClassForCells() -> [AnyClass] { return super.registerClassForCells() + [ UITableViewCell.classForCoder(), ] } override func createRows() { super.createRows() rows.append(String(describing: UITableViewCell.self) as AnyObject) } override func tableView(_ tableView: UITableView, heightForRowAtIndexPath indexPath: IndexPath) -> CGFloat { return 44 } override func tableView(_ tableView: UITableView, cellForRowAtIndexPath indexPath: IndexPath) -> UITableViewCell { let identifier = rows[indexPath.row] as! String let cell = tableView.dequeueReusableCell(withIdentifier: identifier, for: indexPath) cell.textLabel?.text = "Hello World from my first Module!" return cell } }
[ -1 ]
555cb5f1406d6cd4b8c2d0ebb6af8569ad438207
28e303d329e78938306c762cbc6b938c582d40ec
/LocatorManager/CLLocationManager.swift
1157d1caf7cbfd94f18086406e5bcafc86a3f9e4
[ "MIT" ]
permissive
AnasAlhasani/LocatorManager
9d341fe115a4e89335ff375206032ad6fe06e8e2
d0f6bfd65afa56b1009314bad308142ad7763e9c
refs/heads/master
2020-03-14T19:47:23.185645
2019-03-09T19:00:29
2019-03-09T19:00:29
131,765,997
1
1
null
null
null
null
UTF-8
Swift
false
false
795
swift
// // CLLocationManager.swift // LocatorManager // // Created by Anas Alhasani on 5/1/18. // Copyright © 2018 Anas Alhasani. All rights reserved. // import Foundation import CoreLocation extension CLLocationManager { enum ServiceStatus { case available case notDetermined case denied case restricted case disabled } var serviceStatus: ServiceStatus { guard CLLocationManager.locationServicesEnabled() else { return .disabled } switch CLLocationManager.authorizationStatus() { case .notDetermined: return .notDetermined case .denied: return .denied case .restricted: return .restricted default: return .available } } }
[ -1 ]
20f2e21b1358ccc1ac096bea1212e898759d7f37
52d1e4e3b3478122f7b81d7be5d9b7af79b27e59
/RxSwift常见用法/RxSwift常见用法/VC/ViewController2.swift
eb218735d886113f42a3655c1e62a9da2f138d74
[]
no_license
ptlCoder/RxSwift_use
8e278b7900b07846378e9fb4bbc4c8fa027730e6
2baf83d0b014344ce5f1c375f8836ee52d24696b
refs/heads/master
2021-09-01T13:52:19.771445
2017-12-27T09:18:47
2017-12-27T09:18:47
null
0
0
null
null
null
null
UTF-8
Swift
false
false
874
swift
// // ViewController2.swift // RxSwift常见用法 // // Created by soliloquy on 2017/12/27. // Copyright © 2017年 soliloquy. All rights reserved. // import UIKit class ViewController2: SuperViewController { 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. } /* // 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. } */ }
[ 279041, 307212, 281107, 279064, 294433, 284197, 292915, 290875, 243786, 284235, 288331, 284242, 300629, 307288, 212573, 307311, 312433, 284275, 189557, 294518, 278657, 307353, 287399, 198315, 302767, 307379, 184504, 282301, 283839, 285377, 285378, 287437, 239310, 299727, 230608, 302286, 239314, 302295, 282329, 363743, 228585, 199402, 234223, 286963, 289524, 286965, 286462, 309506, 292102, 278791, 282377, 295699, 288251, 287007, 130346, 282411, 289596, 283453, 293700, 283461, 300358, 238920, 311624, 230737, 230745, 241499, 289120, 289121, 296811, 306540, 300400, 315250, 284534, 292730, 291709, 183173, 298375, 324491, 310673, 304531, 304536, 294812, 304540, 277406, 284576, 284580, 304550, 304551, 284586, 305582, 285103, 324528, 230323, 144822, 130487, 292280, 293308, 278973, 296901, 306633, 310734, 286162, 292824, 293874, 293875, 290299, 290303 ]
978ad2440371c189f08d49145614ed9b87dac26b
926c1588823478d345b0c1cfc03d18a661844e7b
/HackerBookPro/Model/.AuthorModel.swift
683914c2f62b556890dc9c595050dd15600a60a8
[]
no_license
spidvmp/HackerBookPro
16c3916f030807f3c97c18711214e09bc2bcc25e
8474c57fd3edf3efe522ddf6bd2ef7b3947485a6
refs/heads/master
2021-01-10T03:39:56.983056
2016-01-31T17:56:16
2016-01-31T17:56:16
49,200,378
0
0
null
null
null
null
UTF-8
Swift
false
false
95
swift
@objc(.AuthorModel) public class .AuthorModel: _.AuthorModel { // Custom logic goes here. }
[ -1 ]
1ad65d0f7b78079cb755a346f3fe8b22933c2c92
8eb5925c0d87462aa9f876061eb289528a1dbc7a
/Example/Tests/Tests.swift
37eccfaa99308604f34c59dd3490ac976a183aef
[ "MIT" ]
permissive
tfuru/TFBoccoSwift
6163acef663c60f6d41f47770aecf663ce541098
8b34e632748714468c424911a57062a9c52b1a50
refs/heads/master
2021-01-19T12:07:23.440951
2016-10-07T06:31:26
2016-10-07T06:31:26
70,183,648
0
0
null
null
null
null
UTF-8
Swift
false
false
21
swift
import TFBoccoSwift
[ -1 ]
53f4de0cc8d0f2a7db47bd09ef2ed26db9569be9
a408a3046881a947b805748faaf7aa5d92c15411
/Take/Classes/AreaOverlay.swift
f3b788257953ceadd17bc9a8757abafd79279dba
[]
no_license
ThePowerOfSwift/Take
943a72c6df7a063dcbf41240b64869b325b662dd
424a745f851e9dc2329b861ffb9449a82a18a329
refs/heads/master
2020-04-05T16:56:40.401303
2018-10-12T18:52:15
2018-10-12T18:52:15
null
0
0
null
null
null
null
UTF-8
Swift
false
false
219
swift
// // CircleOverlay.swift // Take // // Created by Nathan Macfarlane on 6/8/18. // Copyright © 2018 N8. All rights reserved. // import Foundation import MapKit class AreaOverlay: MKCircle { var area: Area? }
[ -1 ]
6622a1ef35b2ba9ddaf59d1fbc53fe068233e940
ed4d9a969179a51d20040ad6c10a747d667c12f4
/Reflect/CoreReflectTests/HelperTest.swift
93b3dc6fb58a3a6922d340f0e5db64d0fc0f2543
[ "MIT" ]
permissive
bfernandesbfs/reflect
d273c94110ce93542f1d0ea02c737788a808121f
39e75df54f1fde3d50f2dc12b57bbb46d31098f0
refs/heads/master
2021-01-10T14:12:31.422924
2016-11-27T14:05:55
2016-11-27T14:05:55
54,223,489
7
2
null
null
null
null
UTF-8
Swift
false
false
3,362
swift
// // HelperTest.swift // CoreReflect // // Created by Bruno Fernandes on 18/03/16. // Copyright © 2016 BFS. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // import Foundation func convertNil<T>(_ obj:T?) -> String { if obj == nil { return "NULL" } else if let value = obj as? String { return "'\(value)'" } else if let value = obj as? Date { return "'\(value.datatypeValue)'" } else if let value = obj as? Data { return "\(value.datatypeValue)" } else if let value = obj as? Double { return String(value) } else if let value = obj as? NSInteger { return String(value) } else { return String(describing: obj!) } } var addressList:[Address] = [] var userList:[User] = [] func populateData() { User.register() Address.register() for a in Address.populate() { a.pin() addressList.append(a) } for u in User.populate() { u.address = addressList[Int(arc4random_uniform(19)) + 1] u.age = Int(arc4random_uniform(90)) let cal = Calendar.current u.birthday = cal.date(byAdding: .day, value: -Int(arc4random_uniform(30)), to: Date()) u.birthday = cal.date(byAdding: .month, value: -Int(arc4random_uniform(12)), to: u.birthday!) u.birthday = cal.date(byAdding: .year, value: -u.age, to: u.birthday!) u.birthday = cal.date(byAdding: .hour, value: -Int(arc4random_uniform(60)), to: u.birthday!) u.birthday = cal.date(byAdding: .minute, value: -Int(arc4random_uniform(60)), to: u.birthday!) u.pin() userList.append(u) } } func populateDataFake() { addressList = Address.query().findObject() userList = User.query().join(Address.self).findObject() } //Operator Overloading Methods public func >> (lhs: Date, rhs: Date) -> Bool { return lhs.compare(rhs) == ComparisonResult.orderedAscending } public func << (lhs: Date, rhs: Date) -> Bool { return lhs.compare(rhs) == ComparisonResult.orderedDescending } public func unique<S: Sequence, E: Hashable>(_ source: S) -> [E] where E==S.Iterator.Element { var seen: [E:Bool] = [:] return source.filter({ (v) -> Bool in return seen.updateValue(true, forKey: v) == nil }) }
[ -1 ]
92daf3eb17f318d7544de48b56688cd06f78e585
fb5b1504eb5b24abca61bcce4e8556a912738809
/build/src/Models/DialogflowParameter.swift
9bda8fe7f64140cd46724c808597780960ae4718
[ "MIT" ]
permissive
MyPureCloud/platform-client-sdk-ios
135f1d124730ecc7e47e68df90a3215ba4ba6880
04ee2b0f5d3f8ad73078eb713427cb6f9e164dda
refs/heads/master
2023-08-17T05:03:39.340378
2023-08-15T06:49:56
2023-08-15T06:49:56
130,367,583
0
2
null
null
null
null
UTF-8
Swift
false
false
415
swift
// // DialogflowParameter.swift // // Generated by swagger-codegen // https://github.com/swagger-api/swagger-codegen // import Foundation public class DialogflowParameter: Codable { /** The parameter name */ public var name: String? /** The parameter type */ public var type: String? public init(name: String?, type: String?) { self.name = name self.type = type } }
[ -1 ]
b3eeb33f0fd4407644d1db18ffd17586a1482b44
e16d3e5e3e5a6fcaf075337c835bb71890618adc
/CeviriyleOgren/CeviriyleOgren/Controllers/BookVC.swift
1c6b685a88b03251787edb830603fca4eb040d65
[]
no_license
appleiOSdevelopers/letslearnswift
37388e315bb3ad56f2962bb3fe80e86905f73542
b4661559a22669931954d685d343e25c752f925b
refs/heads/master
2023-03-21T07:16:17.233556
2021-01-20T23:58:25
2021-01-20T23:58:25
null
0
0
null
null
null
null
UTF-8
Swift
false
false
2,254
swift
// // BookVC.swift // CeviriyleOgren // // Created by MAC on 19.04.2020. // Copyright © 2020 cagdaseksi. All rights reserved. // import UIKit import Firebase class BookVC: UIViewController, UITableViewDataSource, UITableViewDelegate{ var items = [CategoryModel]() var category = "" @IBOutlet weak var tableView: UITableView! override func viewDidLoad() { super.viewDidLoad() retrieveItems(child: category) // Do any additional setup after loading the view. } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return self.items.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! BookTableViewCell let row = self.items[indexPath.row] cell.bookTitle.text = row.title cell.bookDesc.text = row.desc return cell } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let row = self.items[indexPath.row] print(row.key) performSegue(withIdentifier: "toChapter", sender: row.key) } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { let des = segue.destination as? ChapterVC des?.category = category des?.book = sender as! String } func retrieveItems(child: String) { DataService.dataService.CATEGORY_REF.child(child).observe(.value, with: { (snapshot: DataSnapshot?) in if let snapshots = snapshot?.children.allObjects as? [DataSnapshot] { self.items.removeAll() for snap in snapshots { if let postDictionary = snap.value as? Dictionary<String, AnyObject> { let itemModel = CategoryModel(key: snap.key, dictionary: postDictionary) self.items.insert(itemModel, at: 0) } } } self.tableView.reloadData() }) } }
[ -1 ]
29404d76f50a7de86d8c5a1f010b76fbbd5aa06b
306f76b7e69ac4d58b1f1d4127d037230a4cca33
/welation/taskVC.swift
ecb24ffd5e68ce732457b194a37dc556de90304e
[]
no_license
zip520123/Realation
af2f917af2e87d3e2ec0f96384e190d27b92cc9f
ab89718d58e8f3ab017f2b41d2fda4e6c4bfbf9f
refs/heads/master
2020-06-14T03:21:45.940360
2016-12-04T02:16:26
2016-12-04T02:16:26
75,512,492
0
0
null
null
null
null
UTF-8
Swift
false
false
835
swift
// // taskVC.swift // welation // // Created by zip520123 on 2016/12/3. // Copyright © 2016年 zip520123. All rights reserved. // import UIKit import Spring class taskVC: UIViewController { @IBOutlet weak var taskListView: SpringImageView! override func viewDidLoad() { super.viewDidLoad() } @IBAction func detail(_ sender: UIButton) { } override func viewDidAppear(_ animated: Bool) { } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. } */ }
[ -1 ]
ef91bea4ea5365449ccb923a39259ebe145375bc
0e266df8d3d7ff22fde75c4360d6ed7695d60b1e
/CBREConnect/FeedDetailViewController.swift
6e6feebfd237c7307e6c61c0c3238046925babc6
[]
no_license
iOS-AllProjects/CBREConnect
d37a94ec9e70e755b14f9fbee098ef37dec9100c
190107711d91b4230d44e2b8e5f9f305fb703585
refs/heads/master
2021-01-11T20:06:42.395475
2017-03-14T19:59:39
2017-03-14T19:59:39
79,041,203
0
0
null
null
null
null
UTF-8
Swift
false
false
2,498
swift
// // FeedDetailViewController.swift // CBREConnect // // Created by Etjen Ymeraj on 12/19/16. // Copyright © 2016 Etjen Ymeraj. All rights reserved. // import UIKit class FeedDetailViewController: UIViewController { @IBOutlet weak var FeedDetailImageView: UIImageView! @IBOutlet weak var FeedDetailTextView: UITextView! @IBOutlet weak var FeedDetailDateLabel: UILabel! @IBOutlet weak var FeedDetailLocationLabel: UILabel! @IBOutlet weak var createdByImageView: RoundedImageView! @IBOutlet weak var userLabel: UILabel! @IBOutlet weak var FeedDetailTitle: UILabel! var feed: Feed? override func viewDidLoad() { super.viewDidLoad() setupUI() // Do any additional setup after loading the view. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } // MARK: Setup UI func setupUI(){ if let feed = feed { title = feed.type FeedDetailTitle.text = feed.title FeedDetailDateLabel.text = feed.date.toString(format: "dd.MM.yyyy") FeedDetailLocationLabel.text = feed.location userLabel.text = feed.user FeedDetailTextView.text = feed.description FeedDetailImageView.image = UIImage(named:"\(feed.imagePath)") if feed.user == "Fabian Sonnenburg"{ createdByImageView.image = UIImage(named: "Sample_Person") }else { createdByImageView.image = UIImage(named:"\(feed.imagePath)") } } } @IBAction func viewProfileButtonTapped(_ sender: Any) { let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil) let nextViewController = storyBoard.instantiateViewController(withIdentifier: "ProfileViewController") as! ProfileViewController nextViewController.user = true self.navigationController?.pushViewController(nextViewController, animated: true) } @IBAction func addToFavouritesButtonTapped(_ sender: Any) { } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. } */ }
[ -1 ]
7183a9995261bb1e48aa597ba7fda720d8cb3043
eb68d7b06c16537a63db1df7e3f22e12584dbbcf
/Draw/CreateimageViewController.swift
90c5b4540d0f9651fa7b0885a77047a440ee45f3
[]
no_license
Burenkovuser/Draw
d5fd10abd4d9819df6631fff31c1a6a5878ce03b
ef93f1e574acc7275d9440ad3b8784a507437031
refs/heads/master
2021-01-11T06:25:14.476511
2016-10-25T11:31:29
2016-10-25T11:31:29
71,785,480
0
0
null
null
null
null
UTF-8
Swift
false
false
3,564
swift
// // CreateimageViewController.swift // Draw // // Created by Vasilii on 24.10.16. // Copyright © 2016 Vasilii Burenkov. All rights reserved. // import UIKit class CreateimageViewController: UIViewController { @IBOutlet weak var imadeView: UIImageView! override func viewDidLoad() { super.viewDidLoad() imadeView.image = createImage() } //MARK func createImage() -> UIImage { UIGraphicsBeginImageContextWithOptions(imadeView.frame.size, false, 0) let context = UIGraphicsGetCurrentContext()! drawGradientOfSize(imadeView.frame.size, context: context) for i in 0...5 { let angle: CGFloat = CGFloat(M_PI * 2.0 / 6.0) drawRadialGradientOfSize(imadeView.frame.size, context: context) CGContextRotateCTM(context, angle) CGContextScaleCTM(context, 0.9, 0.8) } drawRadialGradientOfSize(imadeView.frame.size, context: context) crossTheHoleImageOfSize(imadeView.frame.size) let image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return image } func drawGradientOfSize(size:CGSize, context: CGContextRef) { let colors = [ UIColor.redColor().CGColor, UIColor.orangeColor().CGColor, UIColor.yellowColor().CGColor, UIColor.greenColor().CGColor ] let positions:[CGFloat] = [0.2, 0.4, 0.6, 0.9] let startPoint = CGPointMake(10, 10) let finishPoint = CGPointMake(size.width, size.height) let colorSpace = CGColorSpaceCreateDeviceRGB() let gradient = CGGradientCreateWithColors(colorSpace, colors, positions) CGContextDrawLinearGradient(context, gradient, startPoint, finishPoint, []) } func drawRadialGradientOfSize(size: CGSize, context: CGContextRef) { CGContextSaveGState(context) let clipPath = UIBezierPath(roundedRect: CGRectMake(40, 40, size.width/2, size.width/1.5), byRoundingCorners: [.BottomLeft, .TopRight], cornerRadii: CGSizeMake(10, 10)) clipPath.addClip() let colors = [ UIColor.blackColor().CGColor, UIColor.whiteColor().CGColor, UIColor.purpleColor().CGColor, UIColor.greenColor().CGColor ] let positions:[CGFloat] = [0.2, 0.4, 0.6, 0.9] let startPoint = CGPointMake(10, 10) let finishPoint = CGPointMake(size.width, size.height) let colorSpace = CGColorSpaceCreateDeviceRGB() let gradient = CGGradientCreateWithColors(colorSpace, colors, positions) CGContextDrawRadialGradient(context, gradient, startPoint, 10, finishPoint, 100, []) CGContextRestoreGState(context) } func crossTheHoleImageOfSize(size: CGSize) { let crossPath = UIBezierPath() crossPath.moveToPoint(CGPointMake(0, 0)) crossPath.addLineToPoint(CGPointMake(size.width, size.height)) crossPath.moveToPoint(CGPointMake(size.width, 0)) crossPath.addLineToPoint(CGPointMake(0, size.height)) crossPath.lineWidth = 3 UIColor.blackColor().setStroke() crossPath.stroke() } }
[ -1 ]
74d16aba7b7a9a059fab97203e0d1a7cadc1201d
1d21bce1cb505e6b56d1ace882388feeb274f8be
/workspaceSwift/MyPlayground.playground/Contents.swift
85d9ace67219e415314993cb224360a039616696
[]
no_license
btabuenca/iOS
97f42a9a9c78ee5d89ec2d00e60a0c47ebbab3bc
3856ce2c5ce74271a4b39bd816a9f7eefa2f90cc
refs/heads/master
2016-08-11T19:20:54.704231
2016-01-04T20:35:03
2016-01-04T20:35:03
36,114,036
0
0
null
null
null
null
UTF-8
Swift
false
false
10,272
swift
//: Playground - noun: a place where people can play import UIKit var str = "Hello, playground" let key = "a" let value = Int64(0) var summary = [key: value] if summary["b"] == nil { // Add element summary["b"] = 66 print("papo") }else{ // Increase values var s = summary["b"] summary["b"] = s! + 77 print("papo") } summary if summary["b"] != nil { print("pepe") }else{ print("papo") } var seconds: NSTimeInterval = NSDate().timeIntervalSince1970 var millsTimestamp:Int64 = Int64(seconds * 1000) var date = NSDate() var calendar = NSCalendar.currentCalendar() var components = calendar.components([.Year, .Month, .Day, .Hour, .Minute, .Second], fromDate: date) // This var accepts nil as values because of th question mark var optionalName: String? = "John Appleseed" var counter = 0 // This line would not be necessary for counter in 0..<10 { // This is like an IF // It skips the iteration when the counter is 2 // and consequently th 2 would not be printed guard counter != 2 else{continue} if counter != 5 { print(counter) } } // // Working with arrays // var animals = [ "chickens", "ducks", "geese" ] animals[1] //animals[1] = "geese" // Creating a hash array var hAnimals = [ "chickens" : "somewhat", "ducks" : "cute", "geese": "scary" ] hAnimals["ducks"] for animal in animals { hAnimals[animal] } // // Working with functions // func obtieneDevuelveCadena(entrada: String) -> String { entrada return "devuelto" } func obtieneCadenaDevuelveEntero(entrada: String) -> Int { entrada // In Swift you can make swich over strings switch entrada{ case "duck": return 0 case "human": return 1 default : return -1 } } // The second parameter would NOT be necessary as 0 would be the default value func obtieneDosParamsDevuelveEntero(entrada1: String, entrada2: Int = 0) -> Int { entrada1 // In Swift you can make swich over strings switch entrada1{ case "duck": return 10 + entrada2 case "human": return 100 + entrada2 default : return -1 } } obtieneDevuelveCadena("entradilla") obtieneCadenaDevuelveEntero("duck") obtieneCadenaDevuelveEntero("human") obtieneCadenaDevuelveEntero("supercoco") obtieneDosParamsDevuelveEntero("duck") // From the second parameter on, it is necessary to indicate the name of it. // See this... obtieneDosParamsDevuelveEntero("duck", 1) would be an error obtieneDosParamsDevuelveEntero("duck", entrada2: 1) obtieneDosParamsDevuelveEntero("human", entrada2: 1) // You might still want to include the name of the first parameter whenver // you would define the function like this // Here bicho would be the outside name, entrada 1 would be the internal name func obtieneDosParamsConNombreDevuelveEntero(bicho entrada1: String, entrada2: Int = 0) -> Int { entrada1 // In Swift you can make swich over strings switch entrada1{ case "duck": return 10 + entrada2 case "human": return 100 + entrada2 default : return -1 } } obtieneDosParamsConNombreDevuelveEntero(bicho: "duck", entrada2: 33) // // Create a 2D array to manipulate an image // // Note that the rows do not need to have the same size var beautifulImage = [ [2, 15, 3], [26, 3, 4, 1], [14, 8, 22] ] beautifulImage // Let us create a function for that // inout: the variable will be modified. Otherwise it would be copy of the variable func raiseLowerNumbers(inout inImage image:[[Int]], to number:Int){ for i in 0..<image.count { for j in 0..<image[i].count{ if image[i][j] < number { image[i][j] = number } } } } raiseLowerNumbers(inImage: &beautifulImage, to: 3) // // enum data samples // enum Rank: Int { case Ace = 1 case Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten case Jack, Queen, King func simpleDescription() -> String { switch self { case .Ace: return "ace" case .Jack: return "jack" case .Queen: return "queen" case .King: return "king" default: return String(self.rawValue) } } } let ace = Rank.Ace let aceRawValue = ace.rawValue ace.simpleDescription() let two = Rank.Two two.simpleDescription() enum Suit { case Spades, Hearts, Diamonds, Clubs func simpleDescription() -> String { switch self { case .Spades: return "spades" case .Hearts: return "hearts" case .Diamonds: return "diamonds" case .Clubs: return "clubs" } } } let hearts = Suit.Hearts let heartsDescription = hearts.simpleDescription() // // Optionals // var maybeString: String? = "Hello, playground" // might be null // Check whether it is null if maybeString != nil { // You have to avoid using the character ! // It explicitly says: It is not null!!! Cogelo que tiene cosas!! // Pero como no las tenga ... ostion maybeString!.characters.count } // Here is an alternative to make save chekcings if let deinitelyString = maybeString{ deinitelyString.characters.count } else{ print("It is nil ") } // These are used to return a value from Objective C, in which // most of the variables are pointers, and consequently might be nul var mostLikelyString: String! = "Hey" mostLikelyString.characters.count // // Functions // class CupHolder { var cups:[String]? = nil } class Car { var cupHolders:CupHolder? = nil } let niceCar = Car() niceCar.cupHolders = CupHolder() // These are soem ways to check the optionals // Traditional checking ... if let cupHolder = niceCar.cupHolders{ // If the container is not null if var cups = cupHolder.cups { // The container is not nil, append a new one cups.append("Coke") }else{ // The container is nil, create first cupHolder.cups = ["Coke"] } } // This is an alternative in Swift with Optional chaining niceCar.cupHolders?.cups = [] niceCar.cupHolders?.cups?.append("Coke") // Traditinal chekcing ... if let cupHolder = niceCar.cupHolders { if let cups = cupHolder.cups{ if(cups[0] == "Coke"){ print("Yeahhhh") }else{ print("Awwww") } } } // Swift lets makes these easier with "Optinal chaining... let firstCup = niceCar.cupHolders?.cups?[0] // // Closers // // Son lo mismo que las funciones pero .... // Esto sirve para pasarse funciones como variable entre sitios func performMagic(thingy: String) -> String{ return thingy } performMagic("Hey") var magicFunction = performMagic magicFunction("Hey") var newMagicFunction = { (thingy: String) -> String in return thingy } // ej. closer var adderFunction: (Int, Int) -> Int = { (a: Int, b: Int) -> Int in return a + b } adderFunction(1,3) // The interesting thing is that you might also want // to get variables that are out of the scope var b = 3 var adderExtVarFunction: (Int) -> Int = { (a: Int) -> Int in return a + b } b = 1 adderExtVarFunction(3) // Making it more interesting // Assigning classes to vars // El pavo dice que es interesante pero tambien peligroso class number { var b: Int = 3 } var aNumber = number() var adderExtClassFunction: (Int) -> Int = { (a: Int) -> Int in return a + aNumber.b } adderExtClassFunction(1) aNumber.b = 5 adderExtClassFunction(1) func doComplicatedStuff(completion:() -> ()){ // does crazy stuff } // // Properties (vars wihtin classes) // class Legs{ var count: Int = 0 } class Animal { var name: String = "" var legs: Legs = Legs() } class LegVet { // Default is protected. Everything withih the same module, can see it. weak var legs: Legs? = nil // The following line indicates that it would only be visible within the class // private weak var legs: Legs? = nil // Can also be public // public weak var legs: Legs? = nil } let dog = Animal() let vet = LegVet() vet.legs = dog.legs // Ownership and memory management // Memory leak managemente // Automatic reference counting // Each time it is referenced, the counter of instances is increased // Default are STRONG references. Hence the counter of instances is increased. It is does own it. // WEAK means that the counter is not increased when it is assigned, so it does not own it. It is a reference. // // Structs // var aa = 3 var bb = aa bb = 5 aa //- // Comenta y descomenta el siguiente bloque para entender la diferencia entre class y struct // - //class numberr { // var n: Int // init(n: Int){ // self.n = n // } //} struct numberr { var n: Int init(n: Int){ self.n = n } } var aNumberr = numberr(n:3) var bNumberr = aNumberr bNumberr.n = 5 // Con class, la siguieente sentencia devuelve 5 // Con struct, la siguieente sentencia devuelve 3 aNumberr.n // La siguiente sentencia devuelve 5 para struct y class bNumberr.n // // Cheat sheet // // // Inheritance // class SuperNumber: NSNumber { override func getValue(value: UnsafeMutablePointer<Void>) { super.getValue(value) } } // // extension. Add funtcions to classes // extension NSNumber{ func superCoolGetter() -> Int { return 5 } } var n = NSNumber(int: 4) n.superCoolGetter() // // protocols. Es lo mismo que los interfaces // protocol dancable{ func dance() } class Person: NSNumber, dancable{ func dance() { } } // // enums types // enum TypesOfVeggies : String { case Carrots case Tomatoes case Celery } let carrot = TypesOfVeggies.Carrots carrot.rawValue func eatVeggies (veggie: TypesOfVeggies){ } eatVeggies(TypesOfVeggies.Carrots) let randomVeggie = TypesOfVeggies(rawValue: "Tomatoes") // // Image processing // // Each pixel takes 4 btyes // // Ojo al hacer caching de los pixels // e.g. // pixel.red = UInt8(avgRed + 2 ) // // Swift VS C Objective //
[ -1 ]
048dcea2e8da982a6e063f09e1ace6b63793136c
68b67986fd0df756ca603d8b3600a785d864c230
/MeliApp/MeliApp/Controller/SearchViewController.swift
d0aee7fccaf4c48f004adc5e88e6ad2d41538489
[]
no_license
LeandroHiga/MeliApp
efe3d9be5d38b20980daf8e4a275c64000543d67
d5d2d69f83e8bfdeea24318f97206453c3507775
refs/heads/master
2023-02-11T13:24:17.293321
2020-12-30T20:45:11
2020-12-30T20:45:11
323,346,899
0
0
null
null
null
null
UTF-8
Swift
false
false
5,266
swift
// // ViewController.swift // MeliApp // // Created by Lean Caro on 21/12/2020. // import UIKit import SVProgressHUD class SearchViewController: UIViewController { @IBOutlet weak var searchTextField: UITextField! @IBOutlet weak var searchButton: UIButton! var productManager = ProductManager() var products: ProductData? override func viewDidLoad() { super.viewDidLoad() navigationController?.navigationBar.tintColor = .black searchButton.isEnabled = false //Delegates searchTextField.delegate = self productManager.delegate = self //Use light mode if #available(iOS 13.0, *){ overrideUserInterfaceStyle = .light } configureKeyboard() } //MARK: - Keyboard Methods func configureKeyboard() { //Move keyboard up when its opened NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil) //Dismiss keyboard when tap anywhere on the screen let tap = UITapGestureRecognizer(target: self.view, action: #selector(UIView.endEditing)) view.addGestureRecognizer(tap) //Add done button to keyboard toolbar setupKeyboardButton() } func setupKeyboardButton() { let toolbar = UIToolbar() let flexSpace = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil) let doneButton = UIBarButtonItem(title: "Done", style: .done, target: self, action: #selector(doneButtonTapped)) toolbar.setItems([flexSpace, doneButton], animated: true) toolbar.sizeToFit() searchTextField.inputAccessoryView = toolbar } @objc func doneButtonTapped() { view.endEditing(true) } @objc func keyboardWillShow(notification: NSNotification) { if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { if self.view.frame.origin.y == 0 { self.view.frame.origin.y -= keyboardSize.height } } } @objc func keyboardWillHide(notification: NSNotification) { if self.view.frame.origin.y != 0 { self.view.frame.origin.y = 0 } } } //MARK: - UITextFieldDelegate extension SearchViewController: UITextFieldDelegate { @IBAction func searchButtonPressed(_ sender: UIButton) { SVProgressHUD.show(withStatus: "Cargando...") //Dismiss keyboard when search button is pressed searchTextField.endEditing(true) if let product = searchTextField.text { let trimmedProduct = product.trimmingCharacters(in: .whitespacesAndNewlines) //Remove leading and trailing whitespaces let finalProduct = trimmedProduct.replacingOccurrences(of: " ", with: "%20") //Replace whitespaces between words if finalProduct.isEmpty { searchTextField.placeholder = "Ingrese producto..." } else { productManager.fetchProducts(productName: finalProduct) } } } //Execute when the keyboard's return button is pressed func textFieldShouldReturn(_ textField: UITextField) -> Bool { //Dismiss keyboard searchTextField.endEditing(true) return true } func textFieldDidBeginEditing(_ textField: UITextField) { searchButton.isEnabled = true } func textFieldDidEndEditing(_ textField: UITextField) { if searchTextField.text == "" { searchButton.isEnabled = false } } } //MARK: - ProductManagerDelegate extension SearchViewController: ProductManagerDelegate { func didUpdateProducts(_ productManager: ProductManager, products: ProductData) { print("PRODUCTS: \(products)") self.products = products DispatchQueue.main.async { self.performSegue(withIdentifier: "goToProducts", sender: self) } } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { //Pass fetched products to next view controller (ProductsViewController) if let destinationVC = segue.destination as? ProductsViewController { destinationVC.products = self.products } } func didFailWithError(error: Error) { print("ERROR: \(error)") DispatchQueue.main.async { // let alert = UIAlertController(title: "¡Oops! Error de conexión", message: "Por favor, intente nuevamente más tarde", preferredStyle: .alert) // alert.addAction(UIAlertAction(title: "Ok", style: .default, handler: nil)) // self.present(alert, animated: true) SVProgressHUD.showError(withStatus: "¡Oops! Error de conexión. Por favor intente nuevamente más tarde.") } } }
[ -1 ]
220ee3b7f8dd4dd928ae2baae2b0e50a89fa204c
7fea52391037a4d94c4017a84edbc16b4b3e5a3c
/ToDoAppTests/ToDoAppTests.swift
3efadeed41d65fb787b559607182f59275d14ae3
[]
no_license
FurchtBar283/XCode_ToDoApp_v2
f7bbf53faba720dd13690aa4b8646874fa5364c7
3703cf344b9566c67f266d59041cb037eb9a1b67
refs/heads/master
2021-01-10T17:20:08.728372
2016-01-01T17:21:26
2016-01-01T17:21:26
48,762,502
0
0
null
null
null
null
UTF-8
Swift
false
false
979
swift
// // ToDoAppTests.swift // ToDoAppTests // // Created by Michael Stroh on 29.12.15. // Copyright © 2015 Michael Stroh. All rights reserved. // import XCTest @testable import ToDoApp class ToDoAppTests: XCTestCase { override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } func testExample() { // This is an example of a functional test case. // Use XCTAssert and related functions to verify your tests produce the correct results. } func testPerformanceExample() { // This is an example of a performance test case. self.measureBlock { // Put the code you want to measure the time of here. } } }
[ 333828, 282633, 313357, 145435, 317467, 98333, 241692, 239650, 102437, 292902, 329765, 354343, 354345, 223274, 315434, 325674, 229413, 282672, 229424, 241716, 180280, 288828, 288833, 288834, 286788, 315465, 254027, 311372, 311374, 354385, 196691, 223316, 315476, 329814, 180311, 180312, 307289, 354393, 200794, 237663, 309345, 280675, 227428, 280677, 43110, 321637, 329829, 307299, 131178, 313447, 278638, 319598, 288879, 204916, 223350, 131191, 233590, 288889, 280694, 215164, 131198, 292992, 215178, 319629, 235662, 311438, 325776, 317587, 278677, 284826, 299174, 153776, 239793, 278704, 299187, 323762, 180408, 184505, 227513, 295098, 280762, 258239, 280768, 301251, 227524, 309444, 282831, 321745, 280795, 194782, 301279, 311519, 356576, 317664, 346346, 321772, 286958, 125169, 327929, 227578, 184570, 184575, 194820, 321800, 278797, 319763, 338197, 309529, 282909, 299293, 227616, 282913, 233762, 278816, 305440, 211235, 211238, 151847, 282919, 98610, 332083, 332085, 280887, 332089, 278842, 315706, 282939, 287041, 287043, 139589, 227654, 182597, 280902, 282960, 325968, 366929, 6481, 289110, 168281, 332123, 334171, 106847, 323935, 332127, 354655, 391520, 321894, 416104, 280939, 242033, 313713, 199029, 291192, 315773, 211326, 291198, 332167, 242058, 311691, 227725, 227726, 240016, 108944, 178582, 190871, 291224, 293274, 285084, 317852, 242078, 141728, 61857, 285090, 61859, 315810, 289189, 315811, 381347, 246178, 289194, 108972, 377264, 299441, 283064, 278970, 293306, 311738, 319930, 293310, 291265, 278978, 291267, 127427, 127428, 283075, 311745, 324039, 278989, 281037, 317901, 281040, 278993, 289232, 373197, 369116, 285150, 279008, 160225, 279013, 127465, 279018, 311786, 330218, 291311, 309744, 109042, 319987, 279029, 293367, 233978, 301571, 291333, 342536, 287241, 279050, 283153, 303636, 279062, 289304, 279065, 291358, 180771, 293419, 244269, 283184, 234036, 289332, 279094, 23092, 338490, 115270, 293448, 55881, 377418, 281166, 281171, 295519, 244327, 111208, 279146, 295536, 287346, 287352, 301689, 244347, 279164, 291454, 189057, 152203, 330379, 311949, 316049, 330387, 330388, 117397, 111253, 230040, 295576, 289434, 111258, 221852, 279206, 295599, 205487, 303793, 342706, 299699, 299700, 164533, 166582, 289462, 109241, 158394, 285371, 285372, 285373, 285374, 287422, 303803, 66242, 248517, 287433, 363211, 154316, 333521, 242386, 279252, 287452, 289502, 299746, 295652, 234217, 342762, 330474, 230125, 289518, 299759, 199414, 228088, 221948, 279294, 205568, 242433, 299776, 295682, 285444, 291585, 291592, 322313, 326414, 312079, 322319, 295697, 285458, 166676, 291604, 207640, 291612, 293664, 281377, 326433, 262951, 279336, 312108, 295724, 152365, 285487, 301871, 318252, 262962, 230199, 285497, 293693, 281408, 295744, 295746, 318278, 201549, 281427, 353109, 281433, 230234, 322395, 301918, 279392, 109409, 242529, 303972, 230248, 177001, 201577, 242541, 400239, 330609, 246641, 174963, 109428, 207732, 295798, 310131, 209783, 246648, 269178, 177019, 291712, 287622, 113542, 109447, 416646, 228233, 308107, 316298, 236428, 56208, 308112, 293781, 209817, 289690, 127902, 289698, 283558, 310182, 240552, 289703, 353195, 236461, 293806, 316333, 316343, 289722, 230332, 189374, 289727, 353215, 353216, 279498, 340961, 52200, 324586, 326635, 203757, 304110, 289774, 287731, 277492, 316405, 240630, 295927, 312314, 314362, 328700, 293886, 328706, 277509, 293893, 134150, 230410, 330763, 320527, 324625, 238610, 308243, 277524, 316437, 293910, 320536, 197657, 281626, 175132, 326685, 189474, 300068, 238639, 322612, 238651, 302139, 21569, 214086, 296019, 339030, 353367, 277597, 281697, 230499, 281700, 314467, 300135, 322663, 228458, 207979, 281706, 318572, 316526, 15471, 144496, 312434, 353397, 300150, 300151, 291959, 337017, 160891, 285820, 300158, 150657, 285828, 279685, 285830, 302213, 330888, 228491, 228493, 177296, 162961, 326804, 185493, 296086, 238743, 187544, 119962, 283802, 296092, 285851, 300188, 339102, 330913, 300202, 306346, 279728, 238769, 294074, 208058, 228540, 230588, 228542, 322749, 302274, 279747, 283847, 353479, 353481, 283852, 279760, 228563, 189652, 189653, 279765, 316627, 148696, 333022, 304351, 279774, 310497, 298212, 304356, 290022, 234733, 298221, 279792, 353523, 298228, 228600, 216315, 208124, 292091, 228609, 320770, 234755, 322824, 292107, 328971, 251153, 177428, 245019, 126237, 115998, 130338, 333090, 130343, 279854, 298291, 171317, 318775, 286013, 333117, 286018, 113987, 193859, 300359, 312648, 230729, 294218, 372043, 177484, 222541, 296270, 296273, 331090, 120148, 314709, 314710, 357719, 318805, 134491, 316765, 222559, 234850, 230756, 281957, 163175, 333160, 134506, 230765, 306542, 296303, 243056, 327025, 327024, 249204, 249205, 181625, 111993, 290169, 306559, 224640, 306560, 148867, 294275, 179587, 298374, 142729, 368011, 304524, 296335, 112017, 112018, 306579, 234898, 224661, 9619, 357786, 318875, 290207, 310692, 333220, 282022, 241066, 316842, 310701, 314798, 286129, 279989, 284089, 228795, 292283, 292292, 280004, 306631, 296392, 300489, 300487, 284107, 310732, 302540, 312782, 64975, 310736, 327121, 222675, 329173, 228827, 286172, 280032, 144867, 103909, 316902, 245223, 187878, 280041, 191981, 282096, 296433, 321009, 329200, 333300, 191990, 280055, 300536, 333303, 286202, 290300, 290301, 286205, 300542, 294400, 296448, 230913, 282114, 306692, 292356, 329225, 296461, 323087, 282129, 323089, 308756, 282141, 230943, 333343, 187938, 286244, 245292, 230959, 288309, 290358, 194110, 288318, 280130, 349763, 288326, 282183, 288327, 56902, 292423, 243274, 333388, 224847, 228943, 118353, 280147, 290390, 128599, 235095, 300630, 306776, 44635, 333408, 157281, 286306, 300644, 282213, 312940, 204397, 222832, 224883, 314998, 333430, 175741, 325245, 337535, 294529, 312965, 282246, 286343, 288392, 229001, 290443, 310923, 188048, 323217, 282259, 302739, 229020, 282271, 282273, 302754, 257699, 282276, 229029, 40613, 290471, 282280, 40614, 40615, 298661, 323236, 61101, 321199, 286391, 337591, 296632, 306874, 280251, 327358, 282303, 286399, 323264, 280257, 321219, 333509, 280267, 333517, 282318, 212688, 9936, 9937, 302802, 245457, 241361, 241365, 282327, 286423, 278233, 278234, 18138, 67292, 294622, 298720, 278240, 229088, 321249, 282339, 153319, 12010, 288491, 280300, 239341, 282348, 284401, 323316, 282358, 229113, 313081, 286459, 325371, 194303, 194304, 278272, 288512, 323331, 288516, 323332, 216839, 282378, 321295, 284431, 243472, 161554, 323346, 294678, 116505, 284442, 313120, 241441, 282400, 315171, 333610, 284459, 294700, 282417, 200498, 296755, 321337, 319292, 345919, 315202, 307011, 282434, 325445, 282438, 153415, 280392, 323406, 325457, 413521, 317269, 18262, 280410, 284507, 300894, 245599, 237408, 302946, 296806, 276327, 282474, 288619, 288620, 325484, 280430, 296814, 282480, 292720, 313203, 325492, 300918, 241528, 317304, 194429, 325503, 315264, 188292, 241540, 327557, 67463, 243591, 315273, 315274, 325515, 243597, 110480, 282518, 282519, 329622, 294807, 294809, 298909, 311199, 292771, 300963, 313254, 294823, 298920, 284587, 292782, 317360, 282549, 288697, 290746, 294843, 214977, 280514, 214984, 284619, 344013, 231375, 301008, 24532, 280541, 329695, 298980, 294886, 317415, 247785, 296941, 278512, 311281, 311282, 223218, 333817, 292858 ]
33ed279d6c3cb3621e3189526f0f2c1f72ec8b6e
ddc17c91e1bdf6c40ce1188675ca0ffb10de5b50
/Tests/GeoFeaturesTests/TokenizerTests.swift
65f4a92ed6fbb7e42e435c648324b42281e89ae9
[ "Apache-2.0" ]
permissive
tonystone/geofeatures2
98d9808830b58a043726b4f9d1dbddab6df6c643
46c59fd225d932a435368d02a8e5a36810b20609
refs/heads/master
2021-08-17T16:51:35.275704
2020-11-22T19:26:21
2020-11-22T19:26:21
51,648,819
19
3
Apache-2.0
2020-11-22T19:26:22
2016-02-13T14:19:28
Swift
UTF-8
Swift
false
false
8,404
swift
/// /// TokenizerTests.swift /// /// Copyright (c) 2016 Tony Stone /// /// 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. /// /// Created by Tony Stone on 11/9/2016. /// import XCTest @testable import GeoFeatures #if os(Linux) || os(FreeBSD) #else fileprivate typealias RegularExpression = NSRegularExpression #endif private class TestToken: Token, CustomStringConvertible { /// Note: we're making an exception for the lint for these variables names since they make the file more readable in general. // swiftlint:disable variable_name static let WHITE_SPACE = TestToken("white space", pattern: "^[ \\t]+") static let SINGLE_SPACE = TestToken("single space", pattern: "^ (?=[^ ])") static let NEW_LINE = TestToken("\n or \r", pattern: "^[\\n|\\r]") static let COMMA = TestToken(",", pattern: "^,") static let LEFT_PAREN = TestToken("(", pattern: "^\\(") static let RIGHT_PAREN = TestToken(")", pattern: "^\\)") static let GLOBE = TestToken("🌍", pattern: "^🌍") static let FLAG = TestToken("🇵🇷", pattern: "^🇵🇷") static let E_PLUS_ACCENT = TestToken("é", pattern: "^e\u{0301}") static let E_WITH_ACCENT = TestToken("é", pattern: "^é") // swiftlint:enable variable_name init(_ description: String, pattern value: StringLiteralType) { self.description = description self.pattern = value } func match(_ string: String, matchRange: Range<String.Index>) -> Range<String.Index>? { return string.range(of: self.pattern, options: [.regularExpression, .caseInsensitive], range: matchRange, locale: Locale(identifier: "en_US")) } func isNewLine() -> Bool { return self.description == TestToken.NEW_LINE.description } public func hash(into hasher: inout Hasher) { hasher.combine(self.description) hasher.combine(self.pattern) } var description: String var pattern: String } class TokenizerTests: XCTestCase { func testExpectSingleWhiteSpaceTrue() { let tokenizer = Tokenizer<TestToken>(string: " (") XCTAssertTrue(tokenizer.expect(.SINGLE_SPACE)) } func testExpectSingleWhiteSpaceFalse() { let tokenizer = Tokenizer<TestToken>(string: " ") XCTAssertFalse(tokenizer.expect(.SINGLE_SPACE)) } func testMatchSingleWhiteSpaceTrue() { let tokenizer = Tokenizer<TestToken>(string: " (") XCTAssertNotNil(tokenizer.accept(.SINGLE_SPACE)) } func testMatchSingleWhiteSpaceFalse() { let tokenizer = Tokenizer<TestToken>(string: " ") XCTAssertNil(tokenizer.accept(.SINGLE_SPACE)) } func testMatchNewLineTrue() { let tokenizer = Tokenizer<TestToken>(string: "\n") XCTAssertNotNil(tokenizer.accept(.NEW_LINE)) } func testMatchNewLineFalse() { let tokenizer = Tokenizer<TestToken>(string: " ") XCTAssertNil(tokenizer.accept(.NEW_LINE)) } func testMatchUnicodeGlobeTrue() { let tokenizer = Tokenizer<TestToken>(string: "🌍") XCTAssertNotNil(tokenizer.accept(.GLOBE)) } func testMatchUnicodeGlobeFalse() { let tokenizer = Tokenizer<TestToken>(string: " ") XCTAssertNil(tokenizer.accept(.GLOBE)) } func testMatchUnicodeFlagTrue() { let tokenizer = Tokenizer<TestToken>(string: "🇵🇷") XCTAssertNotNil(tokenizer.accept(.FLAG)) } func testMatchUnicodeFlagFalse() { let tokenizer = Tokenizer<TestToken>(string: " ") XCTAssertNil(tokenizer.accept(.FLAG)) } func testMatchUnicodeEPlusAccent() { let tokenizer = Tokenizer<TestToken>(string: "e\u{0301}") XCTAssertNotNil(tokenizer.accept(.E_PLUS_ACCENT)) } func testMatchUnicodeEPlusAccentFalse() { let tokenizer = Tokenizer<TestToken>(string: " ") XCTAssertNil(tokenizer.accept(.E_PLUS_ACCENT)) } // FIXME: On linux this test does not pass, possibly because of unicode indexes on Linux. // func testMatchUnicodeEWithAccent() { // let tokenizer = Tokenizer<TestToken>(string: "é") // // XCTAssertNotNil(tokenizer.accept(.E_WITH_ACCENT)) // } func testMatchUnicodeEWithAccentFalse() { let tokenizer = Tokenizer<TestToken>(string: " ") XCTAssertNil(tokenizer.accept(.E_WITH_ACCENT)) } func testColumnParens() { let tokenizer = Tokenizer<TestToken>(string: "((((((((((") for c in 1...tokenizer.matchString.count { XCTAssertEqual(tokenizer.line, 1) XCTAssertEqual(tokenizer.column, c) XCTAssertNotNil(tokenizer.accept(.LEFT_PAREN)) } } func testColumnUnicodeGlobes() { let tokenizer = Tokenizer<TestToken>(string: "🌍🌍🌍🌍🌍🌍🌍🌍🌍") for c in 1...tokenizer.matchString.count { XCTAssertEqual(tokenizer.line, 1) XCTAssertEqual(tokenizer.column, c) XCTAssertNotNil(tokenizer.accept(.GLOBE)) } } /// /// FIXME: This is broken on Linux and crashes the tests. It seems that the indexes are off for unicode on linux. This is the only 16 byte code. /// testColumnUnicodeFlags() { /// let tokenizer = Tokenizer<TestToken>(string: "🇵🇷🇵🇷🇵🇷🇵🇷🇵🇷🇵🇷🇵🇷🇵🇷🇵🇷") /// /// for c in 1...tokenizer.matchString.count { /// XCTAssertEqual(tokenizer.line, 1) /// XCTAssertEqual(tokenizer.column, c) /// XCTAssertNotNil(tokenizer.accept(.FLAG)) /// } /// } func testColumnUnicodeEPlusAccent() { let tokenizer = Tokenizer<TestToken>(string: "e\u{0301}e\u{0301}e\u{0301}e\u{0301}e\u{0301}e\u{0301}e\u{0301}e\u{0301}e\u{0301}") for c in 1...tokenizer.matchString.count { XCTAssertEqual(tokenizer.line, 1) XCTAssertEqual(tokenizer.column, c) XCTAssertNotNil(tokenizer.accept(.E_PLUS_ACCENT)) } } func testColumnUnicodeEWithAccent() { let tokenizer = Tokenizer<TestToken>(string: "ééééééééé") for c in 1...tokenizer.matchString.count { XCTAssertEqual(tokenizer.line, 1) XCTAssertEqual(tokenizer.column, c) XCTAssertNotNil(tokenizer.accept(.E_WITH_ACCENT)) } } func testColumnUnicodeEPlusAccentCanonical() { let tokenizer = Tokenizer<TestToken>(string: "e\u{0301}e\u{0301}e\u{0301}e\u{0301}e\u{0301}e\u{0301}e\u{0301}e\u{0301}e\u{0301}".precomposedStringWithCanonicalMapping) for c in 1...tokenizer.matchString.count { XCTAssertEqual(tokenizer.line, 1) XCTAssertEqual(tokenizer.column, c) XCTAssertNotNil(tokenizer.accept(.E_WITH_ACCENT)) } } func testLine() { let tokenizer = Tokenizer<TestToken>(string: "(((((\n(((((\n(((((\n(((((\n") for line in 1...4 { XCTAssertEqual(tokenizer.line, line) for column in 1...5 { XCTAssertEqual(tokenizer.column, column) XCTAssertNotNil(tokenizer.accept(.LEFT_PAREN)) } XCTAssertNotNil(tokenizer.accept(.NEW_LINE)) } } func testMatchString() { let input = "((((((((((" let expected = "(((((" let tokenizer = Tokenizer<TestToken>(string: input) for _ in 1...5 { let _ = tokenizer.accept(.LEFT_PAREN) } XCTAssertEqual(tokenizer.matchString, expected) } }
[ -1 ]
57ac608fd2c9e65f9ce46bf7a739fc721989d343
867f9e9d61805a52fe2ce1706c806642e7f6d91c
/Sources/App/Helpers/NSTextView+Extensions.swift
440d4982d6819c663f09f16fc517be1cdeb133ac
[ "MIT" ]
permissive
verebes1/mocka
38b3e07d6777c034c57b23cd5cc7c6afe4eb1db1
1cd92e6d3c14757da3adfeba17cca46f5cb376d3
refs/heads/main
2023-07-19T04:46:45.294480
2021-08-27T07:21:19
2021-08-27T07:21:19
null
0
0
null
null
null
null
UTF-8
Swift
false
false
543
swift
// // Mocka // import SwiftUI extension NSTextView { /// Remove `TextEditor` background. open override var frame: CGRect { didSet { backgroundColor = .clear drawsBackground = true } } /// Remove `TextEditor` scroll. open override func scrollWheel(with event: NSEvent) { // The 1st nextResponder is NSClipView. // The 2nd nextResponder is NSScrollView. // The 3rd nextResponder is NSResponder SwiftUIPlatformViewHost. nextResponder?.nextResponder?.nextResponder?.scrollWheel(with: event) } }
[ -1 ]
700b65b3c661b00e1db78c7dfecb1134d132b254
808396f4b0014152e98fd956ab51f230b063c40c
/Fash/Model/Network/RequestAPI.swift
c5b93efc2781119747eee082f52d3191b00b5965
[]
no_license
prography/5th-deepfashion-front
8e590c689e6c983e0a496b888f86cb2ccc351549
d3c363441cd963e4511441ad998caf86c96f53c9
refs/heads/master
2020-08-21T13:37:12.379208
2020-02-03T11:31:13
2020-02-03T11:31:13
216,170,566
2
1
null
2020-01-30T08:37:14
2019-10-19T08:01:52
Swift
UTF-8
Swift
false
false
26,788
swift
// // RequestAPIData.swift // DeepFashion // // Created by MinKyeongTae on 10/11/2019. // Copyright © 2019 MinKyeongTae. All rights reserved. // import UIKit enum NetworkError { case client case server case wrongType case duplicate case unknown var errorTitle: String { switch self { case .client: return "클라이언트 에러" case .server: return "서버 에러" case .wrongType: return "올바르지 않은 입력" case .duplicate: return "" case .unknown: return "예기치 못한 에러" } } var errorMessage: String { switch self { case .client: return "클라이언트 문제가 발생했습니다. " case .server: return "네트워크 상태가 불안정 합니다." case .wrongType: return "올바른 입력을 해주시기 바랍니다." case .unknown: return "예기치 못한 에러가 발생했습니다." default: return "" } } } enum APIPostMode: String { case signUpAccounts case loginData case clothing case codiList case weather } enum APIDeleteMode: String { case deleteUser case deleteClothing case deleteCodiList } enum APIGetMode: String { case getWeather case getClothing case getCodiList case getUserData } enum APIPutMode: String { case putUserData } struct APIURL { static let base = "http://deepfashion-dev.us-west-2.elasticbeanstalk.com/" struct SubURL { struct Delete { static let user = "accounts/" static let clothing = "clothing/" static let codiList = "clothing/codilist/" } struct Get { static let currentWeather = "weather/current-weather/" static let clothing = "clothing/" static let codiList = "clothing/codilist/" static let user = "accounts/" } struct Post { static let accounts = "accounts/" static let login = "accounts/login/" static let styleImage = "accounts/" static let clothing = "clothing/" static let clothingUpload = "clothing/upload" static let codiList = "clothing/codilist/" static let weather = "weatherapi/global-current/" } struct Put { static let accounts = "accounts/" } } } final class RequestAPI { static let shared: RequestAPI = RequestAPI() // MARK: - Properties private var isWeatherRequested = false private let urlSession = URLSession(configuration: .default) private var dataTask = URLSessionDataTask() weak var delegate: RequestAPIDelegate? func getAPIData<T: Codable>(APIMode: APIGetMode, type _: T.Type, completion: @escaping (NetworkError?, T?) -> Void) { var errorType: NetworkError = .unknown delegate?.requestAPIDidBegin() switch APIMode { case .getUserData: let requestAPIURLString = "\(APIURL.base)\(APIURL.SubURL.Get.user)\(CommonUserData.shared.pk)/" debugPrint("now url : \(requestAPIURLString)") guard let url = URL(string: requestAPIURLString) else { return } var urlRequest = URLRequest(url: url) urlRequest.httpMethod = "GET" urlRequest.addValue("token \(CommonUserData.shared.userToken)", forHTTPHeaderField: "Authorization") urlSession.dataTask(with: urlRequest, completionHandler: { (data, _, _) -> Void in guard let data = data else { errorType = .client self.delegate?.requestAPIDidError() completion(errorType, nil) return } do { let userAPIData = try JSONDecoder().decode(T.self, from: data) self.delegate?.requestAPIDidFinished() completion(nil, userAPIData) } catch { errorType = .client self.delegate?.requestAPIDidError() completion(errorType, nil) } }).resume() case .getWeather: // if isWeatherRequested == false { // completion(self.configureError(.duplicate), nil) // } // // let requestAPIURLString = "\(APIURL.base)\(APIURL.SubURL.Get.currentWeather)" // guard let requestAPIURL = URL(string: requestAPIURLString) else { return } // var urlRequest = URLRequest(url: requestAPIURL) // urlRequest.httpMethod = "GET" // urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") // urlSession.dataTask(with: requestAPIURL) { data, response, error in // if error != nil { // self.isWeatherRequested = false // completion(self.configureError(.client), nil) // return // } // // guard let weatherData = data else { // self.isWeatherRequested = false // completion(self.configureError(.client), nil) // return // } // // guard let weatherAPIData = try? JSONDecoder().decode(T.self, from: weatherData) else { // errorType = .client // self.isWeatherRequested = false // self.delegate?.requestAPIDidError() // completion(errorType, nil) // return // } // // if let response = response as? HTTPURLResponse { // if (200 ... 299).contains(response.statusCode) { // self.isWeatherRequested = false // self.delegate?.requestAPIDidFinished() // completion(nil, weatherAPIData) // } else { // debugPrint("request failed : \(response.statusCode)") // self.isWeatherRequested = false // self.delegate?.requestAPIDidError() // self.classifyErrorType(statusCode: response.statusCode, errorType: &errorType) // completion(errorType, nil) // } // } // }.resume() return case .getClothing: let requestAPIURLString = "\(APIURL.base)\(APIURL.SubURL.Get.clothing)" guard let url = URL(string: requestAPIURLString) else { return } var urlRequest = URLRequest(url: url) urlRequest.httpMethod = "GET" urlRequest.addValue("token \(CommonUserData.shared.userToken)", forHTTPHeaderField: "Authorization") urlSession.dataTask(with: urlRequest, completionHandler: { (data, _, _) -> Void in guard let data = data else { errorType = .client self.delegate?.requestAPIDidError() completion(errorType, nil) return } do { let weatherAPIData = try JSONDecoder().decode(T.self, from: data) self.delegate?.requestAPIDidFinished() completion(nil, weatherAPIData) } catch { errorType = .client self.delegate?.requestAPIDidError() completion(errorType, nil) } }).resume() case .getCodiList: let requestAPIURLString = "\(APIURL.base)\(APIURL.SubURL.Get.codiList)" guard let url = URL(string: requestAPIURLString) else { return } var urlRequest = URLRequest(url: url) urlRequest.httpMethod = "GET" urlRequest.addValue("token \(CommonUserData.shared.userToken)", forHTTPHeaderField: "Authorization") urlSession.dataTask(with: urlRequest, completionHandler: { (data, _, _) -> Void in guard let data = data else { errorType = .client self.delegate?.requestAPIDidError() completion(errorType, nil) return } do { let weatherAPIData = try JSONDecoder().decode(T.self, from: data) self.delegate?.requestAPIDidFinished() completion(nil, weatherAPIData) } catch { errorType = .client self.delegate?.requestAPIDidError() completion(errorType, nil) } }).resume() } } func deleteAPIData(APIMode: APIDeleteMode, targetId: Int = 0, completion: @escaping (NetworkError?) -> Void) { var errorType: NetworkError = .unknown delegate?.requestAPIDidBegin() var deleteURLString: String var deleteURL: URL switch APIMode { case .deleteUser: deleteURLString = "\(APIURL.base)\(APIURL.SubURL.Delete.user)\(CommonUserData.shared.pk)/" guard let _deleteURL = URL(string: deleteURLString) else { completion(configureError(.client)) return } deleteURL = _deleteURL case .deleteClothing: deleteURLString = "\(APIURL.base)\(APIURL.SubURL.Delete.clothing)\(targetId)/" guard let _deleteURL = URL(string: deleteURLString) else { completion(configureError(.client)) return } deleteURL = _deleteURL case .deleteCodiList: deleteURLString = "\(APIURL.base)\(APIURL.SubURL.Delete.codiList)\(targetId)/" guard let _deleteURL = URL(string: deleteURLString) else { completion(configureError(.client)) return } deleteURL = _deleteURL } var urlRequest = URLRequest(url: deleteURL) urlRequest.httpMethod = "DELETE" urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") urlRequest.setValue("token \(CommonUserData.shared.userToken)", forHTTPHeaderField: "Authorization") urlSession.dataTask(with: urlRequest) { _, response, error in if error != nil { completion(self.configureError(.client)) return } if let response = response as? HTTPURLResponse { if (200 ... 299).contains(response.statusCode) { self.delegate?.requestAPIDidFinished() completion(nil) } else { debugPrint("request failed : \(response.statusCode)") self.delegate?.requestAPIDidError() self.classifyErrorType(statusCode: response.statusCode, errorType: &errorType) completion(errorType) } } }.resume() } func putAPIData<T: Codable>(_ userData: T, APIMode: APIPutMode, completion: @escaping (NetworkError?) -> Void) { var nowStatusCode = 0 var errorType: NetworkError = .unknown delegate?.requestAPIDidBegin() switch APIMode { case .putUserData: let userDataPostURLString = "\(APIURL.base)\(APIURL.SubURL.Put.accounts)\(CommonUserData.shared.pk)/" guard let userData = userData as? UserAPIPutData else { delegate?.requestAPIDidError() completion(NetworkError.wrongType) return } guard let userAPIData = try? JSONEncoder().encode(userData), let postURL = URL(string: userDataPostURLString) else { delegate?.requestAPIDidError() completion(NetworkError.unknown) return } var urlRequest = URLRequest(url: postURL) urlRequest.httpMethod = "PUT" urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") urlRequest.setValue("token \(CommonUserData.shared.userToken)", forHTTPHeaderField: "Authorization") // URLSession을 만들어 Post 작용을 시작한다. urlSession.uploadTask(with: urlRequest, from: userAPIData) { _, response, error in nowStatusCode = (response as? HTTPURLResponse)?.statusCode ?? 0 if error != nil { self.delegate?.requestAPIDidError() self.classifyErrorType(statusCode: nowStatusCode, errorType: &errorType) completion(errorType) return } if let response = response as? HTTPURLResponse { if (200 ... 299).contains(response.statusCode) { self.delegate?.requestAPIDidFinished() completion(nil) } else { debugPrint("request failed : \(response.statusCode)") self.classifyErrorType(statusCode: nowStatusCode, errorType: &errorType) completion(self.configureError(errorType)) } } }.resume() } } func postAPIData<T>(userData: T, APIMode: APIPostMode, completion: @escaping (NetworkError?) -> Void) { var nowStatusCode = 0 var errorType: NetworkError = .unknown delegate?.requestAPIDidBegin() switch APIMode { case .loginData: let userDataPostURLString = "\(APIURL.base)\(APIURL.SubURL.Post.login)" guard let userData = userData as? LoginAPIPostData else { delegate?.requestAPIDidError() completion(NetworkError.wrongType) return } let userDataToPost = LoginAPIPostData(userName: userData.userName, password: userData.password) guard let userAPIData = try? JSONEncoder().encode(userDataToPost), let postURL = URL(string: userDataPostURLString) else { delegate?.requestAPIDidError() completion(NetworkError.unknown) return } var urlRequest = URLRequest(url: postURL) urlRequest.httpMethod = "POST" urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") // URLSession을 만들어 Post 작용을 시작한다. urlSession.uploadTask(with: urlRequest, from: userAPIData) { data, response, error in nowStatusCode = (response as? HTTPURLResponse)?.statusCode ?? 0 if error != nil { self.delegate?.requestAPIDidError() self.classifyErrorType(statusCode: nowStatusCode, errorType: &errorType) completion(errorType) return } guard let data = data, let userData = try? JSONDecoder().decode(LoginAPIData.self, from: data) else { self.classifyErrorType(statusCode: nowStatusCode, errorType: &errorType) completion(self.configureError(errorType)) return } // MARK: - Token Check CommonUserData.shared.setUserPrivateData(token: userData.token, pk: userData.pk) debugPrint("token : \(userData.token)") debugPrint("pk : \(userData.pk)") if let response = response as? HTTPURLResponse { if (200 ... 299).contains(response.statusCode) { self.delegate?.requestAPIDidFinished() completion(nil) } else { debugPrint("request failed : \(response.statusCode)") self.classifyErrorType(statusCode: nowStatusCode, errorType: &errorType) completion(self.configureError(errorType)) } } }.resume() case .weather: if isWeatherRequested == true { completion(configureError(.duplicate)) return } guard let userData = userData as? LocationAPIData else { delegate?.requestAPIDidError() completion(NetworkError.client) return } print("Coordinator : \(userData.longitude), \(userData.latitude)") let userDataPostURLString = "\(APIURL.base)\(APIURL.SubURL.Post.weather)" print("url : \(userDataPostURLString)") guard let locationAPIData = try? JSONEncoder().encode(userData), let postURL = URL(string: userDataPostURLString) else { completion(configureError(.client)) return } var urlRequest = URLRequest(url: postURL) urlRequest.httpMethod = "POST" urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") // URLSession을 만들어 Post 작용을 시작한다. urlSession.uploadTask(with: urlRequest, from: locationAPIData) { data, _, error in if error != nil { self.classifyErrorType(statusCode: nowStatusCode, errorType: &errorType) completion(self.configureError(.client)) return } if let data = data { do { let weatherAPIData = try JSONDecoder().decode(WeatherAPIData.self, from: data) CommonUserData.shared.configureWeatherData(weatherAPIData) self.isWeatherRequested = true self.delegate?.requestAPIDidFinished() completion(nil) } catch let jsonError { print(jsonError) errorType = .client self.delegate?.requestAPIDidError() completion(self.configureError(.wrongType)) } } }.resume() case .signUpAccounts: guard let userData = userData as? UserAPIPostData else { delegate?.requestAPIDidError() completion(NetworkError.client) return } let userDataPostURLString = "\(APIURL.base)\(APIURL.SubURL.Post.accounts)" let userDataToPost = UserAPIPostData(userName: userData.userName, gender: userData.gender, styles: userData.styles, password: userData.password) guard let userAPIData = try? JSONEncoder().encode(userDataToPost), let postURL = URL(string: userDataPostURLString) else { completion(configureError(.client)) return } var urlRequest = URLRequest(url: postURL) urlRequest.httpMethod = "POST" urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") // URLSession을 만들어 Post 작용을 시작한다. urlSession.uploadTask(with: urlRequest, from: userAPIData) { _, response, error in if error != nil { self.classifyErrorType(statusCode: nowStatusCode, errorType: &errorType) completion(self.configureError(.client)) return } // guard let _resultData = data, // let resultData = try? JSONDecoder().decode(UserAPIData.self, from: _resultData) else { // completion(self.configureError(.client)) // return // } if let response = response as? HTTPURLResponse { if (200 ... 299).contains(response.statusCode) { debugPrint("request successed : \(response.statusCode)") self.delegate?.requestAPIDidFinished() completion(nil) } else { debugPrint("request failed : \(response.statusCode)") self.classifyErrorType(statusCode: nowStatusCode, errorType: &errorType) completion(self.configureError(errorType)) } } }.resume() case .clothing: guard let userData = userData as? ClothingPostData else { completion(configureError(.wrongType)) return } let userDataPostURLString = "\(APIURL.base)\(APIURL.SubURL.Post.clothing)" guard let postURL = URL(string: userDataPostURLString) else { return } debugPrint("userDataPostURLString : \(userDataPostURLString)") let imageName = AssetIdentifier.Image.clothing userData.image?.accessibilityIdentifier = imageName // post 처리 할 parameter를 정의한다. let parameter = [ "name": "\(userData.name)", "style": "\(userData.style)", "owner": "\(CommonUserData.shared.pk)", "color": "\(userData.color)", "season": "\(userData.season)", "part": "\(userData.part)", "category": "\(userData.category)", ] // request 설정 var urlRequest = URLRequest(url: postURL) urlRequest.setValue("token \(CommonUserData.shared.userToken)", forHTTPHeaderField: "Authorization") urlRequest.httpMethod = "POST" // multipart form-data로 보낼 것임을 설정한다. let boundary = "Boundary-\(UUID().uuidString)" urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") let clothingMimeType = "image/jpg" let clothingImageKey = "img" guard let imageData = userData.image?.jpegData(compressionQuality: 0.1) else { return } urlRequest.httpBody = createBody(parameters: parameter, boundary: boundary, data: imageData, mimeType: clothingMimeType, fileKey: clothingImageKey, imageName: imageName) // URLSession을 만들어 Post 작용을 시작한다. urlSession.dataTask(with: urlRequest) { _, response, _ in if let response = response as? HTTPURLResponse { if (200 ... 299).contains(response.statusCode) { debugPrint("request successed : \(response.statusCode)") self.delegate?.requestAPIDidFinished() completion(nil) } else { debugPrint("request failed : \(response.statusCode)") self.delegate?.requestAPIDidError() self.classifyErrorType(statusCode: nowStatusCode, errorType: &errorType) completion(errorType) } } }.resume() case .codiList: guard let userData = userData as? CodiListAPIData else { delegate?.requestAPIDidError() completion(NetworkError.client) return } let userDataPostURLString = "\(APIURL.base)\(APIURL.SubURL.Post.codiList)" guard let codiListAPIData = try? JSONEncoder().encode(userData), let postURL = URL(string: userDataPostURLString) else { completion(configureError(.client)) return } var urlRequest = URLRequest(url: postURL) urlRequest.httpMethod = "POST" urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") urlRequest.setValue("token \(CommonUserData.shared.userToken)", forHTTPHeaderField: "Authorization") // URLSession을 만들어 Post 작용을 시작한다. urlSession.uploadTask(with: urlRequest, from: codiListAPIData) { _, response, error in if error != nil { self.classifyErrorType(statusCode: nowStatusCode, errorType: &errorType) completion(self.configureError(.client)) return } if let response = response as? HTTPURLResponse { if (200 ... 299).contains(response.statusCode) { debugPrint("request successed : \(response.statusCode)") self.delegate?.requestAPIDidFinished() completion(nil) } else { debugPrint("request failed : \(response.statusCode)") self.classifyErrorType(statusCode: nowStatusCode, errorType: &errorType) completion(self.configureError(errorType)) } } }.resume() } } private func createBody(parameters: [String: String], boundary: String, data: Data, mimeType: String, fileKey _: String, imageName _: String) -> Data { let body = NSMutableData() let boundaryPrefix = "--\(boundary)\r\n" for (key, value) in parameters { body.appendString(boundaryPrefix) body.appendString("Content-Disposition: form-data; name=\"\(key)\"\r\n\r\n") body.appendString("\(value)\r\n") } body.appendString(boundaryPrefix) body.appendString("Content-Disposition: form-data; name=\"\("img")\"; filename=\"\("clothing.jpg")\"\r\n") body.appendString("Content-Type: \(mimeType)\r\n\r\n") body.append(data) body.appendString("\r\n") body.appendString("--".appending(boundary.appending("--"))) return body as Data } func classifyErrorType(statusCode: Int, errorType: inout NetworkError) { if statusCode / 100 == 4 { errorType = .client } else if statusCode / 100 == 5 { errorType = .server } else { errorType = .unknown } } func configureError(_ errorType: NetworkError) -> NetworkError { let errorType: NetworkError = .client delegate?.requestAPIDidError() return errorType } func resetProperties() { isWeatherRequested = false } }
[ -1 ]
6548429a77aa64b02d046e70a98a3e7d72754a2a
a13aaba42bcb4186b5ea58c70d172a1227514d16
/ProjectKeeperSwift/ProjectKeeperSwift/Models/Loaders/WebImageLoader.swift
64594713e1078582770de68a8060fde4db44e86b
[]
no_license
Mary87/ProjectKeeperSwift
1ed95b8abb7d785c6812336aa1842b7f918de3ef
68abd41561e5b3bd7d03eca376dcb8434e7eadb4
refs/heads/master
2021-01-17T23:04:37.987619
2016-09-29T12:47:42
2016-09-29T12:47:42
68,792,344
0
1
null
2016-09-29T14:09:00
2016-09-21T07:38:20
Swift
UTF-8
Swift
false
false
1,840
swift
// // WebImageLoader.swift // ProjectKeeperSwift // // Created by Mary on 9/28/16. // Copyright © 2016 3ss. All rights reserved. // import UIKit protocol WebImageLoaderProtocol { func loadThumbnailImageForProject(project: Project, onComplete: (UIImage) -> ()) -> () func loadImageForAsset(asset: Asset, onComlete: (UIImage) -> ()) -> () } class WebImageLoader: NSObject, WebImageLoaderProtocol { // MARK: Properties let webDataService = InstancesFabric.webDataService() var cache = NSCache() // MARK: WebImageLoaderProtocol func loadThumbnailImageForProject(project: Project, onComplete: (UIImage) -> ()) -> () { loadImageForUrlString(project.thumbnailImageUrlString) { (image) in onComplete(image) } } func loadImageForAsset(asset: Asset, onComlete: (UIImage) -> ()) -> () { loadImageForUrlString(asset.contentUrlString) { (image) in onComlete(image) } } // MARK: Private private func loadImageForUrlString(urlString: String, onComplete: (UIImage) -> ()) -> () { if (self.cache.objectForKey(urlString) != nil) { onComplete((self.cache.objectForKey(urlString) as? UIImage)!) } else { webDataService.getDataFromUrl(urlString) { (data) -> (Void) in dispatch_async(dispatch_get_main_queue(), { let image = self.extractImageFromData(data) self.cache.setObject(image, forKey: urlString) onComplete(image) }) } } } private func extractImageFromData(imageData: NSData?) -> UIImage { var image = UIImage() image = UIImage(data:imageData!,scale:1.0)! return image } }
[ -1 ]
7899972af02b4a033c4cf43ec16f9a557c3ff41d
ccc2a42bfc37975fc7d33fafa37092fef8ad1862
/BreakPoint/BreakPoint/Controller/LoginVC.swift
21e4ad64e40dfe21ff83866236c95a59ef243b44
[]
no_license
srandhaw/BreakPoint
eb7ed207a36ca044c49ad0f804470f70f9cd80b2
c28a29dbcf2020ee0ce45f8728b508b08fc6b501
refs/heads/master
2020-03-23T10:12:57.052341
2018-07-31T11:08:22
2018-07-31T11:08:22
141,431,400
0
1
null
null
null
null
UTF-8
Swift
false
false
1,774
swift
// // LoginVC.swift // BreakPoint // // Created by Sehajbir Randhawa on 7/19/18. // Copyright © 2018 Sehajbir. All rights reserved. // import UIKit class LoginVC: UIViewController { //Outlets @IBOutlet weak var emailTextField: InsetTextField! @IBOutlet weak var passwordTextField: InsetTextField! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } @IBAction func signInBtnPressed(_ sender: Any) { if(emailTextField.text != nil && passwordTextField.text != nil){ AuthService.instance.loginUser(email: emailTextField.text!, password: passwordTextField.text!) { (success) in if(success){ self.dismiss(animated: true, completion: nil) } else{ print("\nLogin error\n") } AuthService.instance.registerUser(email: self.emailTextField.text!, password: self.passwordTextField.text!, completion: { (success) in if(success){ AuthService.instance.loginUser(email: self.emailTextField.text!, password: self.passwordTextField.text!, completion: { (success) in if(success){ print("successfully registered") self.dismiss(animated: true, completion: nil) } }) }else{ print("\nRegister error\n") } }) } } } @IBAction func closeBtnPressed(_ sender: Any) { dismiss(animated: true, completion: nil) } }
[ -1 ]
b59c7e929f523fbe6fea0f2eb3ae99718ace100d
498c2cb9ca85534a8a1ad613a0f86f41bcd8301f
/taskIt/AddTaskViewController.swift
17e0e03f08a47db66d320945f43d20ba492a4c8d
[]
no_license
asmorris/taskIt
9035b99afba65cf1c7d16b22572e714cb4f4270c
a16ba6059b077d699e5da968ca35fb485bc0850f
refs/heads/master
2021-01-10T14:01:12.678568
2016-03-24T18:30:09
2016-03-24T18:30:09
54,400,553
0
0
null
null
null
null
UTF-8
Swift
false
false
1,601
swift
// // AddTaskViewController.swift // taskIt // // Created by Andrew Morrison on 2016-03-20. // Copyright © 2016 Andrew Morrison. All rights reserved. // import UIKit import CoreData class AddTaskViewController: UIViewController { @IBOutlet var addTaskTextField: UITextField! @IBOutlet var addSubtaskTextField: UITextField! @IBOutlet var addDate: UIDatePicker! 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. } @IBAction func cancelButtonPressed(sender: UIButton) { self.dismissViewControllerAnimated(true, completion: nil) } @IBAction func addTaskButtonPressed(sender: UIButton) { let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate let managedObjectContext = appDelegate.managedObjectContext let entityDescription = NSEntityDescription.entityForName("TaskModel", inManagedObjectContext: managedObjectContext) let task = TaskModel(entity: entityDescription!, insertIntoManagedObjectContext: managedObjectContext) task.task = addTaskTextField.text task.subtask = addSubtaskTextField.text task.date = addDate.date task.completed = false appDelegate.saveContext() self.dismissViewControllerAnimated(true, completion: nil) } }
[ -1 ]
28682f76d461d2f9956d10ad48effa76c1343bec
dea0f82dc638b36fd39778da0bdb20af4a26874c
/ieModeling-C-2017/ieModeling-C-2017-0221/NextViewController.swift
6157e774200e77f226643b6a6a23ff32c6708b1c
[]
no_license
kisuke0517/ieModeling2016-C
c4e17443bfe599c50a7b553d16914bc7541c2dbc
58ed4145b2ee3748db7affc32853b8bbe5b641c1
refs/heads/master
2020-12-24T08:31:33.579092
2017-02-22T04:50:01
2017-02-22T04:50:01
73,336,800
0
0
null
null
null
null
UTF-8
Swift
false
false
3,446
swift
import UIKit import WebKit class NextViewController: UIViewController,UIGestureRecognizerDelegate,WKNavigationDelegate { @IBOutlet weak var web1: UIWebView! var n: Int = 0 var f : Int = 0 var flag : Int = 0 override func viewDidLoad() { super.viewDidLoad() //web1.navigationDelegate = self //if(n < 5){ let path : String = Bundle.main.path(forResource:"index", ofType: "html", inDirectory: "web")! web1.loadRequest(URLRequest(url: URL(string: path)! as URL) as URLRequest) //} // シングルタップ let singleTap = UITapGestureRecognizer(target: self, action: #selector(NextViewController.tapSingle(_:))) //Swift2.2以前 //let singleTap = UITapGestureRecognizer(target: self, action: #selector(NextViewController.tapSingle(sender:))) //Swift3 singleTap.numberOfTapsRequired = 1 //singleTap.numberOfTouchesRequired = 2 //こう書くと2本指じゃないとタップに反応しない //これを書かないとダブルタップ時にもシングルタップのアクションも実行される //singleTap.requireGestureRecognizerToFail(doubleTap) //Swift2.2 //singleTap.require(toFail: doubleTap) //Swift3 view.addGestureRecognizer(singleTap) } // func web1(_web1: WKWebView,didCommit Navigation: WKNavigation!){ // self.dismiss(animated: true, completion: nil) //} func tapSingle(_ sender: UITapGestureRecognizer) { n = n + 1; //let vc = storyboard?.instantiateViewController(withIdentifier: "ViewController") as! ViewController //vc.m = 2 if(n == 5){ //let vc = storyboard?.instantiateViewController(withIdentifier: "ViewController") as! ViewController //vc.m = vc.m + 1 //performSegue(withIdentifier: "nextSegue", sender: nil) //self.dismiss(animated: true, completion: nil) let d = storyboard!.instantiateViewController(withIdentifier: "NextViewController12") self.present(d,animated: true, completion: nil) //self.dismiss(animated: true, completion: nil) //let before = storyboard!.instantiateViewController(withIdentifier: "PageViewController") //self.present(before,animated: true, completion: nil) //let vc = storyboard?.instantiateViewController(withIdentifier: "ViewController") as! ViewController //vc.m = vc.m + 1 if(f == 0){ let path2 : String = Bundle.main.path(forResource:"index", ofType: "html", inDirectory: "scriptsample")! web1.loadRequest(URLRequest(url: URL(string: path2)! as URL) as URLRequest) flag = flag + 0 } else{ let path3 : String = Bundle.main.path(forResource:"basic2", ofType: "html", inDirectory: "web")! web1.loadRequest(URLRequest(url: URL(string: path3)! as URL) as URLRequest) flag = flag + 1 } } if(n == 10){ self.dismiss(animated: true, completion: nil) } } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() } }
[ -1 ]