blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 2
625
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
47
| license_type
stringclasses 2
values | repo_name
stringlengths 5
116
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 643
values | visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 80.4k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 16
values | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_language
stringclasses 85
values | src_encoding
stringclasses 7
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 1
class | length_bytes
int64 4
6.44M
| extension
stringclasses 17
values | content
stringlengths 4
6.44M
| duplicates
sequencelengths 1
9.02k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f81a68b3435ea0615034ea6282f6509a66f7d84b | 6e5337921f2f00c0daeb9ca04329b30f70bc37f9 | /Offers/View/Master/OffersTableViewCell.swift | fdfe0cd12867ef218fe7cec41989bafc300ddfad | [] | no_license | AbdoFoda/Offers | 142118617e11a9909e20f42d8faa991606897b7c | c7685b84643fb95f115ec708e18ed11c7ce28588 | refs/heads/master | 2022-12-29T01:27:05.768818 | 2020-10-06T18:29:20 | 2020-10-06T18:29:20 | 301,643,331 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 756 | swift | //
// OffersTableViewCell.swift
// Offers
//
// Created by Abdelrahman Sobhy on 10/6/20.
// Copyright © 2020 Abdelrahman Sobhy. All rights reserved.
//
import UIKit
class OffersTableViewCell: UITableViewCell {
//MARK:- Outelts
@IBOutlet weak var iconImageView: UIImageView!
@IBOutlet weak var lblFavCount: UILabel!
@IBOutlet weak var lblTags: UILabel!
@IBOutlet weak var lblDesc: UILabel!
@IBOutlet weak var lblTitle: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
| [
-1
] |
d72d032c9e5f4c0d4dc4b1001c9a75dd0fe139e6 | 8c165c47a376dd4fd139b203d3c23bd93774a676 | /VK-Interface-GB/Custom Interfaces/Cells/SearchGroupCell 2.swift | a7bef2ddfeac9ae4d5a0bc0da9a170f060e29c73 | [] | no_license | AlexLezin/GB_iOS_Client-Server | 23d2c322c8f2caefe731d6b2adcfe2eecf74113c | b38e0246997844e8406cb3994f13d6a6f00b33f1 | refs/heads/master | 2020-12-09T22:27:47.062939 | 2020-01-19T19:45:25 | 2020-01-19T19:45:25 | 233,434,472 | 0 | 0 | null | 2020-01-19T19:48:46 | 2020-01-12T17:56:50 | Swift | UTF-8 | Swift | false | false | 315 | swift | //
// SearchGroupCell.swift
// VK-Interface-GB
//
// Created by Евгений Никитин on 02.12.2019.
// Copyright © 2019 Evel-Devel. All rights reserved.
//
import UIKit
class SearchGroupCell: UITableViewCell {
@IBOutlet weak var groupName: UILabel!
@IBOutlet weak var avatar: UIImageView!
}
| [
-1
] |
ee46f68b450df3aafdefe4a7d4fbbf2d7a5f6d13 | ae9c3cd2d1b850afee5ab6c834d1ed72efb1e632 | /Recipe List App/Views/Add recipe/AddMetaData.swift | d9b6ee0b2ad91cfc05f210e356fc22b710fae9f6 | [] | no_license | adityaamehra/RecipeList-with-coredata | 97b1c8d64c76a0d7c24e9724aa7c069bfe949a4b | 84878a2d51707ec1e43d5fb754ad29e612f4a37e | refs/heads/main | 2023-06-06T08:32:08.650354 | 2021-07-04T03:13:05 | 2021-07-04T03:13:05 | 382,381,597 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,458 | swift | //
// AddMetaData.swift
// Recipe List App
//
// Created by Adityaa Mehra on 03/07/21.
//
import SwiftUI
struct AddMetaData: View {
@Binding var name: String
@Binding var summary: String
@Binding var prepTime: String
@Binding var cookTime: String
@Binding var totalTime: String
@Binding var servings: String
var body: some View {
Group {
HStack {
Text("Name: ")
.bold()
TextField("Tuna Casserole", text: $name)
}
HStack {
Text("Description: ")
.bold()
TextField("A delicious meal for the whole family", text: $summary)
}
HStack {
Text("Prep Time: ")
.bold()
TextField("1 hour", text: $prepTime)
}
HStack {
Text("Cook Time: ")
.bold()
TextField("2 hours", text: $cookTime)
}
HStack {
Text("Total Time: ")
.bold()
TextField("3 hours", text: $totalTime)
}
HStack {
Text("Servings: ")
.bold()
TextField("6", text: $servings)
}
}
}
}
| [
-1
] |
6a8886de459a0294010d609afe5f9a5cc02778cc | 7b48d79ebfe13ea129f12351b3fc2b252dc8a23b | /BodaFlights/BodaFlights/Application/AppDelegate.swift | 2b9f609574a49793a7dd8f1ea50b05d8b1d0f996 | [] | no_license | tiendnuit/BodaFlights | 441797883808a4845d1d34bd29da266d65303055 | 025d52457e5af8d55b5aa72274303235e7373161 | refs/heads/master | 2020-05-15T15:24:17.959660 | 2019-04-22T20:11:39 | 2019-04-22T20:11:39 | 182,372,805 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,308 | swift | //
// AppDelegate.swift
// BodaFlights
//
// Created by Scor Doan on 4/20/19.
// Copyright © 2019 Scor Doan. All rights reserved.
//
import UIKit
import SVProgressHUD
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
public class var shared: AppDelegate {
return UIApplication.shared.delegate as! AppDelegate
}
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
SVProgressHUD.setDefaultMaskType(.clear)
SVProgressHUD.setDefaultAnimationType(.native)
SVProgressHUD.setBackgroundColor(UIColor.clear)
// change navigation item title color
let navigationBarAppearace = UINavigationBar.appearance()
navigationBarAppearace.tintColor = UIColor.white
navigationBarAppearace.barTintColor = UIColor.BodaColors.orange
navigationBarAppearace.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white, NSAttributedString.Key.font: UIFont.BodaFonts.boldS20]
let appearance = UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self])
appearance.setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.white], for: .normal)
//Log
log.level = .debug
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
//MARK: - Boda methods
extension AppDelegate {
func logout() {
DataManager.shared.logout()
LoginViewController.show()
}
}
| [
-1
] |
75aef80e3de343ca3cc058a8b18bbf1441bb050d | 995e97b5035bfb50f0884dc1d9826fb094991db2 | /SClientModel/SClientModel/Models/BusinessCashIn.swift | 6f26f66101604cd7ab0211effca446825c34a714 | [] | no_license | namtrung2212/ios-taxi-user | 0c242a993524ee7b9f3efe23ee5d3bfc5fa86021 | 1b15c5c04fe5e7c18dcc6e28a019dd9c0c409508 | refs/heads/master | 2021-03-30T20:30:50.002570 | 2018-03-13T04:25:30 | 2018-03-13T04:25:30 | 124,991,868 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,908 | swift | //
// Car.swift
// BOOKTAXI
//
// Created by Trung Dao on 4/7/16.
// Copyright © 2016 SCONNECTING. All rights reserved.
//
import Foundation
import RealmSwift
import ObjectMapper
open class BusinessCashIn: BaseModel {
open dynamic var Account : String?
open dynamic var AccountNo : String?
open dynamic var AccountOwner : String?
open dynamic var Currency : String?
open dynamic var RefFIDocNo : String?
open dynamic var RefFIDocDesc : String?
open dynamic var RefFIDocDate : Date?
open dynamic var OurBank : String?
open dynamic var OurBankAcc : String?
open dynamic var PartnerBank : String?
open dynamic var PartnerAcc : String?
open dynamic var PartnerAccOwner : String?
open dynamic var PartnerTransNo : String?
open dynamic var PartnerTransDesc : String?
open dynamic var PartnerTransDate : Date?
open dynamic var EmbededTransferUser : String?
open dynamic var EmbededPayCard : String?
open dynamic var EmbededCardNo : String?
open dynamic var EmbededCardExpireDate : Date?
open dynamic var EmbededVerifyCode : String?
open dynamic var IsVerified : Bool = false
open dynamic var IsSucceed : Bool = false
open dynamic var ReceiveCash : Double = 0
open dynamic var ReceivedDate : Date?
open dynamic var IsReceived : Bool = false
required convenience public init?(_ map: Map) {
self.init()
}
open override func mapping(_ map: Map) {
super.mapping(map);
Account <- map["Account"]
AccountNo <- map["AccountNo"]
AccountOwner <- map["AccountOwner"]
Currency <- map["Currency"]
RefFIDocNo <- map["RefFIDocNo"]
RefFIDocDesc <- map["RefFIDocDesc"]
RefFIDocDate <- (map["RefFIDocDate"], MongoDateTransform())
OurBank <- map["OurBank"]
OurBankAcc <- map["OurBankAcc"]
PartnerBank <- map["PartnerBank"]
PartnerAcc <- map["PartnerAcc"]
PartnerAccOwner <- map["PartnerAccOwner"]
PartnerTransNo <- map["PartnerTransNo"]
PartnerTransDesc <- map["PartnerTransDesc"]
PartnerTransDate <- (map["PartnerTransDate"], MongoDateTransform())
EmbededTransferUser <- map["EmbededTransferUser"]
EmbededPayCard <- map["EmbededPayCard"]
EmbededCardNo <- map["EmbededCardNo"]
EmbededCardExpireDate <- (map["EmbededCardExpireDate"], MongoDateTransform())
EmbededVerifyCode <- map["EmbededVerifyCode"]
IsVerified <- map["IsVerified"]
IsSucceed <- map["IsSucceed"]
ReceiveCash <- map["ReceiveCash"]
ReceivedDate <- (map["ReceivedDate"], MongoDateTransform())
IsReceived <- map["IsReceived"]
}
}
| [
-1
] |
56d8476dadbe4b377329ef1debc07f504faceddd | c2fd204c99b9e816163a63ab2ff846e51273f8d8 | /V2EX/ViewControllers/Message/ReplyMessageViewController.swift | 8f87c9e6d68548f6d37ad8ddd890b7e0636d9550 | [
"MIT"
] | permissive | skusdk/V2EX-1 | 45e00ef02dbf542c5b710c94d1bfa76ce2cbbdf2 | f67e877ed91a00d58c0d05d11ead434ed2e2cea4 | refs/heads/master | 2020-03-23T14:40:36.424554 | 2018-07-16T08:24:26 | 2018-07-16T08:24:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,723 | swift | import UIKit
import RxSwift
import RxCocoa
import MobileCoreServices
class ReplyMessageViewController: BaseViewController, TopicService {
// MARK: - UI
private lazy var contentView: UIView = {
let view = UIView()
// view.setCornerRadius = 15
return view
}()
private lazy var topContainer: UIView = {
let view = UIView()
view.backgroundColor = UIColor.hex(0xF1F2F1)
return view
}()
private lazy var closeBtn: UIButton = {
let view = UIButton()
view.setImage(#imageLiteral(resourceName: "close"), for: .normal)
return view
}()
private lazy var titleLabel: UILabel = {
let view = UILabel()
view.textAlignment = .center
view.font = UIFont.systemFont(ofSize: 14)
return view
}()
private lazy var uploadPictureBtn: UIButton = {
let view = UIButton()
view.setImage(#imageLiteral(resourceName: "uploadPicture"), for: .normal)
return view
}()
private lazy var sendBtn: UIButton = {
let view = UIButton()
view.setImage(#imageLiteral(resourceName: "message_send"), for: .normal)
return view
}()
private lazy var textView: UIPlaceholderTextView = {
let view = UIPlaceholderTextView()
view.font = UIFont.systemFont(ofSize: 15)
view.textContainerInset = UIEdgeInsets(top: 8, left: 14, bottom: 5, right: 14)
view.enablesReturnKeyAutomatically = true
view.tintColor = Theme.Color.globalColor
view.backgroundColor = .white
view.delegate = self
view.autocorrectionType = .no
view.autocapitalizationType = .none
return view
}()
private lazy var imagePicker: UIImagePickerController = {
let view = UIImagePickerController()
view.allowsEditing = true
view.mediaTypes = [kUTTypeImage as String]
view.sourceType = .photoLibrary
view.delegate = self
return view
}()
// MARK: - Propertys
public var message: MessageModel? {
didSet {
guard let username = message?.member?.username else { return }
let text = "正在回复 \(username)"
titleLabel.text = text
textView.placeholder = text as NSString
textView.becomeFirstResponder()
}
}
// MARK: - Setup
override func setupRx() {
closeBtn.rx
.tap
.subscribeNext { [weak self] in
self?.textView.resignFirstResponder()
}.disposed(by: rx.disposeBag)
uploadPictureBtn.rx
.tap
.subscribeNext { [weak self] in
guard let `self` = self else { return }
self.present(self.imagePicker, animated: true, completion: nil)
}.disposed(by: rx.disposeBag)
sendBtn.rx
.tap
.subscribeNext { [weak self] in
self?.replyComment()
}.disposed(by: rx.disposeBag)
}
override func setupSubviews() {
view.backgroundColor = .clear
contentView.layer.shadowColor = UIColor.black.cgColor
contentView.layer.shadowRadius = 20
contentView.layer.shadowOpacity = 0.8
contentView.layer.shadowOffset = CGSize(width: 10, height: 10)
view.addSubview(contentView)
contentView.addSubviews(topContainer, textView)
topContainer.addSubviews(closeBtn, titleLabel, uploadPictureBtn, sendBtn)
}
override func setupConstraints() {
contentView.snp.makeConstraints {
$0.left.right.equalToSuperview().inset(20)
$0.height.equalToSuperview().multipliedBy(0.37)
let margin = navigationController?.navigationBar.bottom ?? 64
$0.top.equalToSuperview().offset(margin + 20)
}
topContainer.snp.makeConstraints {
$0.left.right.top.equalToSuperview()
$0.height.equalTo(40)
}
closeBtn.snp.makeConstraints {
$0.left.equalToSuperview()
$0.top.bottom.equalToSuperview()
$0.width.equalTo(topContainer.snp.height)
}
titleLabel.snp.makeConstraints {
$0.centerX.equalToSuperview()
$0.top.bottom.equalToSuperview()
}
sendBtn.snp.makeConstraints {
$0.top.bottom.equalToSuperview()
$0.right.equalToSuperview().inset(5)
$0.width.equalTo(closeBtn)
}
uploadPictureBtn.snp.makeConstraints {
$0.top.bottom.width.equalTo(sendBtn)
$0.right.equalTo(sendBtn.snp.left)
}
textView.snp.makeConstraints {
$0.top.equalTo(topContainer.snp.bottom)
$0.left.bottom.right.equalToSuperview()
}
}
}
// MARK: - Actions
extension ReplyMessageViewController {
// 上传配图请求
private func uploadPictureHandle(_ fileURL: String) {
HUD.show()
uploadPicture(localURL: fileURL, success: { [weak self] url in
log.info(url)
self?.textView.insertText(url)
self?.textView.becomeFirstResponder()
HUD.dismiss()
}) { error in
HUD.dismiss()
HUD.showError(error)
}
}
/// 回复评论
private func replyComment() {
guard let `message` = message, let atUsername = message.member?.atUsername else { return }
guard textView.text.trimmed.isNotEmpty else {
HUD.showInfo("回复失败,您还没有输入任何内容", completionBlock: { [weak self] in
self?.textView.becomeFirstResponder()
})
return
}
guard let once = message.once else {
HUD.showError("无法获取 once,请尝试重新登录", completionBlock: {
presentLoginVC()
})
return
}
guard let topicID = message.topic.topicID else {
HUD.showError("无法获取主题 ID")
return
}
HUD.show()
comment(
once: once,
topicID: topicID,
content: atUsername + textView.text, success: { [weak self] in
HUD.showSuccess("回复成功")
HUD.dismiss()
self?.view.endEditing(true)
self?.view.fadeOut()
self?.textView.text = nil
}) { error in
HUD.dismiss()
HUD.showError(error)
}
}
}
// MARK: - UIImagePickerControllerDelegate & UINavigationControllerDelegate
extension ReplyMessageViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
dismiss(animated: true, completion: nil)
guard var image = info[UIImagePickerControllerEditedImage] as? UIImage else { return }
image = image.resized(by: 0.7)
guard let data = UIImageJPEGRepresentation(image, 0.5) else { return }
let path = FileManager.document.appendingPathComponent("smfile.png")
_ = FileManager.save(data, savePath: path)
uploadPictureHandle(path)
}
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
dismiss(animated: true) {
self.textView.becomeFirstResponder()
}
}
}
// MARK: - UITextViewDelegate
extension ReplyMessageViewController: UITextViewDelegate {
func textViewDidEndEditing(_ textView: UITextView) {
textView.resignFirstResponder()
view.fadeOut()
}
func textViewDidBeginEditing(_ textView: UITextView) {
view.fadeIn()
}
}
| [
-1
] |
dad3aeda8f1f968c052c12c200c95a528442df90 | ec7fc911b5f4131c8c5016b31f4ae82a55dd6207 | /SimpleTweeterClient/API/TwitterApiClient.swift | 5f50a60498cd77df234e22ceac4be03d47d3abc2 | [] | no_license | MarkovaDA/TwitterKitExample | 6e5a0657edb1d6991e8ef06214f534231ae7ff47 | d6905bf8858857f38d271d935cfa1020aa580ffd | refs/heads/master | 2021-04-15T04:55:34.825800 | 2018-03-27T09:47:58 | 2018-03-27T09:47:58 | 126,594,171 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,289 | swift | //
// TwitterApiClient.swift
// SimpleTweeterClient
//
// Created by Darya Markova on 24.03.2018.
// Copyright © 2018 Darya Markova. All rights reserved.
//
import Foundation
import TwitterKit
import Microfutures
//создать статический класс с методами
//login
//currentUser
//loadUser
//loadTweets
//sendTweet
//logout
class TwitterApiClient {
let client = TWTRAPIClient()
let store = TWTRTwitter.sharedInstance().sessionStore
static let shared = TwitterApiClient()
func getCurrentUserId() -> String? {
//self.store.saveSession(withAuthToken: String, authTokenSecret: <#T##String#>, completion: <#T##TWTRSessionStoreSaveCompletion##TWTRSessionStoreSaveCompletion##(TWTRAuthSession?, Error?) -> Void#>)
return self.store.session()?.userID
}
func getCurrentUser(success: @escaping (TWTRUser?) -> (), failure: @escaping (Error?) -> ()) {
let userId = self.getCurrentUserId()
if userId == nil {
return
}
self.client.loadUser(withID: userId!) { (user: TWTRUser?, error: Error?) in
if user != nil {
success(user)
} else {
failure(nil)
}
}
}
func getHomeTimeline() {
//let userClient = TWTRAPIClient.init(userID: self.getCurrentUserId());
let tweetFetchUrl = "https://api.twitter.com/1.1/statuses/user_timeline.json"
let params = ["user_id": self.getCurrentUserId()]
let request = self.client.urlRequest(withMethod: "GET", urlString: tweetFetchUrl, parameters: params, error: nil)
self.client.sendTwitterRequest(request) { (response, data, connectionError) -> Void in
if connectionError != nil {
print("Error: \(String(describing: connectionError))")
} else {
let formatter = DateFormatter()
formatter.dateFormat = "E M dd HH:mm:ss +zzzz yyyy"
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .formatted(formatter)
let tweets = try! decoder.decode([Tweet].self, from: data!)
}
}
}
func getProfilePicture() {
}
private init() {}
}
| [
-1
] |
bd12c06f69cd2d4482da523609bf300d740e4ae3 | 69267eda1a5387663eb949907696605c6b71ec66 | /DinnerOnline/Model/下厨房/HPNavTitleModel.swift | fc7ce92c37e97c11ce39d1f29659cbdd01a67558 | [] | no_license | hpf848421/DinnerOnline | 4a7d00b8160122050f230a14e190fb317f94eaaf | 9a5fdc39235aed1a6bbc95cc216ca3deab0c2814 | refs/heads/master | 2021-09-01T12:50:52.797722 | 2017-12-27T03:08:49 | 2017-12-27T03:08:49 | 112,451,777 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 280 | swift | //
// HPNavTitleModel.swift
// DinnerOnline
//
// Created by 胡彭飞 on 2017/11/23.
// Copyright © 2017年 ztq. All rights reserved.
//
import UIKit
import YYModel
class HPNavTitleModel: NSObject {
var url :String?
var name :String?
var picurl :String?
}
| [
-1
] |
c1d3c6a606c179eab9adf47061f5e0bf05d3c02c | ec23e21a07ef6c32d9e0051a48f615e4dbe356db | /DVDShop/FoundDetailViewController.swift | b812ee25952f21747ea183c3db794c0f28dde16a | [] | no_license | kurczewski7/swift_ProjektDvdshop | fcb5dee7b2692d818aaad642cc4c580dada8fa0e | c9cb92a4db2b7960b6ea4b8fb11efb50a819b720 | refs/heads/master | 2020-07-17T22:44:55.730614 | 2017-06-14T12:09:55 | 2017-06-14T12:09:55 | 94,326,773 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,624 | swift | //
// FoundDetailViewController.swift
// DVDShop
//
// Created by Slawek Kurczewski on 09.05.2017.
// Copyright © 2017 Slawomir Kurczewski. All rights reserved.
//
import UIKit
class FoundDetailViewController: UIViewController {
var dvdImageTmp = ""
var titleLabelTmp = ""
var actorsLabelTmp = "brak"
var typeLabelTmp = ""
var descriptionLabelTmp = ""
var priceLabelTmp = ""
var youtubeUrlTmp = ""
var rowTmp="1"
var phisicalRowTmp = "0"
@IBOutlet var dvdImage: UIImageView!
@IBOutlet var titleLabel: UILabel! {
didSet {
titleLabel.text=titleLabelTmp } }
@IBOutlet var actorsLabel: UILabel! {
didSet {
actorsLabel.text=actorsLabelTmp } }
@IBOutlet var typeLabel: UILabel! {
didSet {
typeLabel.text=typeLabelTmp } }
@IBOutlet var priceLabel: UILabel! {
didSet {
priceLabel.text=priceLabelTmp } }
override func viewDidLoad() {
super.viewDidLoad()
//let row=Int(rowTmp)
let phisicalRow=Int(phisicalRowTmp)
print("FoundDetailViewController, row=\(rowTmp), phisicalRow=\(phisicalRowTmp)")
dvdImage.image=UIImage(data: database.getImageDataFromDb(phisicalRow: phisicalRow!))
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
if segue.identifier=="showYoutube2" {
let destinatonController = segue.destination as! VideoViewController
destinatonController.titleLabelTmp = titleLabelTmp
destinatonController.typeLabelTmp = typeLabelTmp
destinatonController.priceLabelTmp = priceLabelTmp
destinatonController.youtubeUrlTmp = youtubeUrlTmp
destinatonController.dvdImageTmp = dvdImageTmp
destinatonController.descriptionLabelTmp=descriptionLabelTmp
}
}
/*
// 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
] |
00d151110ef42dda457c90d7f335d56032640b65 | 20afd27971d89eaea79af6ff944c5603a2d9be3e | /flockr/AppDelegate.swift | e04f4614ff1c636940cc67081c6f08b84aefcb07 | [] | no_license | moisespio/Flockr | c04785f0f43833578fec8592882eaa3462dbf2a8 | 738e5289325a8bcf06b320e71cca2393d24ec066 | refs/heads/master | 2021-01-20T00:02:49.785668 | 2016-11-28T19:35:48 | 2016-11-28T19:35:48 | 74,247,072 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,610 | swift | //
// AppDelegate.swift
// flockr
//
// Created by Matheus Frozzi Alberton on 27/11/16.
// Copyright © 2016 flockr. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FlockrStylist.applyAppeareance(color: FlockrStylist.NavColors.Default)
FlockrInitializer.startParseWithLaunchOptions(launchOptions)
// FlockrInitializer.configurePushNotifications(application)
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
// MARK: - Split view
func splitViewController(_ splitViewController: UISplitViewController, collapseSecondary secondaryViewController:UIViewController, onto primaryViewController:UIViewController) -> Bool {
return false
}
}
| [
229380,
229383,
229385,
294924,
229388,
229391,
327695,
229394,
229397,
229399,
229402,
229405,
229408,
294950,
229415,
229417,
237613,
229422,
229426,
237618,
229428,
286774,
319544,
229432,
286776,
286778,
352318,
286791,
237640,
286797,
237646,
311375,
163920,
196692,
319573,
311383,
319590,
311400,
303212,
131192,
237693,
327814,
303241,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286922,
286924,
319694,
286926,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
131314,
286962,
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,
319810,
319809,
319814,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
98756,
278980,
319945,
278986,
319947,
278990,
278994,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
172526,
311791,
279023,
172529,
279027,
319989,
164343,
180727,
311804,
287230,
279040,
303617,
287234,
172550,
320007,
303623,
172552,
287238,
279051,
172558,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
295461,
172581,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172612,
377413,
172614,
303690,
172618,
33357,
287309,
279124,
172634,
262752,
254563,
172644,
311911,
295533,
172655,
172656,
352880,
295538,
172660,
287349,
287355,
287360,
295553,
172675,
287365,
311942,
303751,
352905,
279178,
287371,
311946,
287377,
287381,
311957,
221850,
287386,
303773,
230045,
164509,
172702,
172705,
287390,
172707,
287394,
303780,
287398,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
279231,
287427,
312006,
107212,
172748,
287436,
172751,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
213724,
303838,
189149,
312035,
279267,
295654,
279272,
230128,
189169,
312048,
312050,
230131,
205564,
303871,
295685,
230154,
312077,
295695,
295701,
369433,
295707,
328476,
295710,
303914,
279340,
205613,
279353,
230202,
222018,
295755,
377676,
287569,
230237,
230241,
279394,
336744,
303976,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
304009,
213895,
304011,
230284,
304013,
295822,
279438,
189329,
189331,
58262,
279452,
410526,
279461,
304042,
213931,
230327,
304055,
287675,
230334,
304063,
304065,
295873,
189378,
156612,
213954,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
295928,
312321,
295945,
230413,
197645,
295949,
320528,
140312,
238620,
197663,
304164,
304170,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
296004,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
164973,
279669,
337018,
115836,
66690,
222340,
296084,
238745,
304285,
238756,
205991,
165035,
337067,
238766,
165038,
304311,
230592,
312518,
279750,
312520,
230600,
230607,
148690,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
296213,
230677,
296215,
320792,
230681,
173350,
312622,
296243,
312630,
222522,
296253,
230718,
296255,
312639,
378181,
296262,
230727,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
337244,
222556,
312676,
230760,
173418,
230763,
230768,
296305,
230773,
304505,
304506,
181631,
312711,
296331,
288140,
288144,
230800,
304533,
288154,
337306,
288160,
288162,
279975,
304555,
370092,
279983,
173488,
312755,
296373,
312759,
279991,
288185,
337335,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
148946,
370130,
222676,
288210,
280021,
288212,
288214,
329177,
239064,
288217,
288218,
288220,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
320998,
288234,
370146,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
148990,
206336,
321022,
296450,
402942,
230916,
230919,
214535,
304651,
304653,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
181854,
280158,
370272,
403039,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
321195,
296622,
321200,
296634,
419522,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
280276,
313044,
321239,
280283,
288478,
419555,
321252,
313066,
280302,
288494,
280304,
313073,
321266,
419570,
288499,
288502,
288510,
67330,
280324,
198405,
288519,
198416,
280337,
296723,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
321336,
296767,
288576,
345921,
304968,
280393,
280402,
313176,
280419,
321381,
296812,
313201,
1920,
255873,
305028,
247688,
280464,
124817,
280473,
124827,
214940,
247709,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
280515,
296900,
337862,
165831,
280521,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
313340,
288764,
239612,
239617,
313347,
288773,
313358,
321560,
305176,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288826,
321595,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
215123,
354390,
288859,
280669,
223327,
280671,
321634,
149603,
329830,
280681,
313451,
280687,
215154,
313458,
280691,
313464,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
321717,
280764,
280769,
280771,
280774,
321740,
280783,
280786,
280793,
280796,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
182517,
280825,
280827,
280830,
280831,
125187,
280835,
125191,
125207,
125209,
321817,
321842,
223539,
280888,
289087,
280897,
305480,
239944,
239947,
305485,
305489,
379218,
280919,
248153,
354653,
313700,
280937,
280946,
223606,
313720,
280956,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
305594,
289210,
281024,
289221,
289227,
281045,
281047,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
240132,
223749,
305668,
281095,
223752,
150025,
338440,
223757,
281102,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
150066,
158262,
158266,
289342,
281154,
322115,
281163,
281179,
338528,
338532,
281190,
281196,
158317,
19053,
313973,
281210,
297594,
158347,
264845,
133776,
117398,
314007,
289436,
174754,
330404,
289448,
174764,
314033,
240309,
133817,
314045,
314047,
199364,
297671,
158409,
256716,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281372,
322341,
215850,
281388,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
183172,
158596,
240519,
322440,
314249,
240535,
289687,
289694,
289696,
289700,
289712,
289724,
52163,
281567,
289762,
322534,
297961,
183277,
322550,
134142,
322563,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
207937,
314433,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
248995,
306341,
306344,
306347,
306354,
142531,
199877,
289991,
289997,
249045,
363745,
298216,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
257334,
216376,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
224603,
314718,
265568,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
306552,
290171,
306555,
314747,
290174,
298365,
224641,
281987,
298372,
314756,
265604,
224647,
281990,
298377,
314763,
142733,
298381,
314768,
224657,
314773,
306581,
314785,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
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,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282144,
290344,
290349,
290351,
290356,
224849,
282195,
282199,
282201,
306778,
159330,
314979,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282261,
175770,
298651,
323229,
282269,
298655,
323231,
61092,
282277,
306856,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
282328,
298714,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
282402,
315174,
241448,
241450,
282410,
306991,
323376,
315184,
315190,
241464,
282425,
307009,
413506,
241475,
307012,
315211,
282446,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
241509,
110438,
110445,
282478,
282481,
110450,
315249,
315251,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
282514,
298898,
241556,
298901,
241560,
241563,
241565,
241567,
241569,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
241640,
298984,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
192596,
176213,
307287,
315482,
217179,
315483,
192605,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
307307,
45163,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
307352,
299164,
241821,
299167,
315557,
184486,
307370,
184492,
307372,
307374,
307376,
299185,
323763,
176311,
184503,
307386,
258235,
176316,
307388,
307390,
184512,
307394,
299204,
184518,
323784,
307409,
176343,
299225,
233701,
184572,
184579,
282893,
291089,
282906,
291104,
233766,
176435,
315701,
332086,
168245,
307510,
307515,
282942,
307518,
323917,
282957,
110926,
233808,
323921,
315733,
323926,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
283033,
242075,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
127407,
127413,
291254,
127417,
291260,
127421,
127424,
127429,
315856,
315860,
176597,
127447,
299481,
176605,
242143,
291299,
127463,
242152,
291305,
127466,
176620,
291314,
291317,
135672,
233979,
291323,
291330,
283142,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
234006,
127511,
234010,
242202,
135707,
242206,
135710,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
70213,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
299655,
373383,
135820,
316051,
225941,
316054,
299672,
135834,
225948,
373404,
135839,
299680,
225954,
299684,
242343,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
226005,
226008,
242396,
299740,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
242431,
209665,
299778,
234242,
242436,
234246,
226056,
234248,
291593,
242443,
242445,
234254,
291601,
234258,
242450,
242452,
201496,
234264,
234266,
234269,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
201557,
234329,
234333,
308063,
234336,
242530,
234338,
349027,
234344,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
291711,
234368,
234370,
291714,
291716,
234373,
226182,
234375,
308105,
226185,
234384,
234388,
234390,
324504,
226200,
209818,
234393,
324508,
308123,
291742,
234396,
234401,
291748,
234405,
291750,
234407,
324518,
324520,
291754,
324522,
291756,
226220,
234414,
324527,
291760,
201650,
324531,
226230,
234422,
324536,
275384,
234428,
291773,
242623,
324544,
226239,
234434,
324546,
324548,
234431,
226245,
234437,
234439,
234443,
291788,
193486,
234446,
193488,
234449,
275406,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234478,
316400,
234481,
234484,
234485,
234487,
234493,
316416,
234496,
234501,
308231,
234504,
234507,
234515,
300054,
234519,
234520,
316439,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234558,
316479,
234561,
234563,
308291,
316483,
234568,
234570,
316491,
300108,
234572,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234593,
234595,
234597,
300133,
300139,
234605,
160879,
234607,
275569,
234610,
300148,
234614,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234634,
234636,
234640,
275602,
234643,
324757,
226453,
234647,
234648,
275606,
234650,
308379,
275608,
308373,
324766,
234653,
324768,
283805,
119967,
300189,
234657,
242852,
177318,
300197,
275626,
234667,
316596,
234687,
300226,
234692,
283844,
300229,
308420,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
161003,
300267,
300270,
300272,
120053,
300278,
316663,
300284,
275710,
300287,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
349451,
242957,
275725,
177424,
283917,
349464,
415009,
283939,
259367,
283951,
300344,
226617,
243003,
226628,
300357,
177482,
283983,
316758,
357722,
316766,
316768,
218464,
292197,
316774,
243046,
218473,
136562,
333178,
275834,
275836,
275840,
316803,
316806,
226696,
226699,
316811,
316814,
300433,
234899,
357783,
316824,
316826,
300448,
144810,
144812,
144814,
374196,
144820,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
259565,
259567,
308720,
300527,
316917,
292343,
308727,
300537,
308757,
308762,
316959,
284194,
284196,
235045,
284199,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
284218,
226877,
284223,
284226,
243268,
284228,
292421,
226886,
284231,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
276053,
284247,
317015,
284249,
243290,
284253,
243293,
284255,
300638,
284258,
292452,
177766,
292454,
292458,
284267,
292461,
284272,
284274,
284278,
276086,
292470,
292473,
284283,
276093,
284286,
292479,
284288,
284290,
325250,
284292,
292485,
276098,
284297,
317066,
284299,
317068,
284301,
284303,
276114,
284306,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
276137,
284331,
317098,
284333,
284335,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
358089,
284362,
276170,
276175,
284368,
276177,
284370,
317138,
358098,
284372,
284377,
358114,
358116,
276197,
317158,
358119,
325353,
358122,
358126,
276206,
358128,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
317207,
300828,
300830,
276255,
325408,
300832,
227109,
317221,
358183,
186151,
276268,
243504,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
153417,
292681,
358224,
284499,
276308,
178006,
317271,
284502,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
317332,
358292,
399252,
350106,
284572,
276386,
284579,
276388,
292776,
317353,
284585,
358312,
276395,
276402,
358326,
161718,
358330,
276411,
276425,
301009,
301011,
301013,
292823,
301015,
358360,
301017,
292828,
153568,
292839,
292843,
227314,
325624,
317435,
350218,
292876,
350222,
317456,
276496,
317458,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
309298,
243762,
325685,
325689,
235579,
325692,
276539,
178238,
243779,
243785,
350293,
350295,
309337,
227418,
227423,
178273,
309346,
227426,
309348,
276579,
194660,
227430,
309352,
350313,
309354,
301163,
350316,
292968,
276586,
301167,
227440,
284786,
276595,
350325,
350328,
292985,
301178,
292989,
292993,
317570,
350339,
301185,
350342,
350345,
301199,
350354,
350357,
350359,
350362,
276638,
153765,
284837,
350375,
350381,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
227522,
301252,
227529,
309450,
301258,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
243948,
194801,
309494,
243960,
227583,
276735,
276739,
211204,
276742,
227596,
325910,
309530,
342298,
211232,
211241,
325937,
325943,
260421,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
276836,
293227,
276843,
276848,
293232,
186744,
211324,
366983,
317833,
178572,
285070,
178583,
227738,
317853,
317858,
342434,
285093,
285098,
276907,
235955,
293304,
293314,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
293346,
276964,
293352,
236013,
293364,
301562,
317951,
309764,
301575,
236043,
317963,
342541,
55822,
113167,
309779,
317971,
309781,
55837,
227879,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
301636,
301639,
301643,
285265,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
318094,
334476,
277136,
277139,
227992,
318108,
285340,
318110,
227998,
137889,
285357,
318128,
277170,
293555,
318132,
154292,
277173,
342707,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
342749,
113378,
203491,
228069,
277223,
342760,
56041,
285417,
56043,
277232,
228081,
56059,
310015,
310020,
310029,
228113,
285459,
277273,
293659,
326430,
293666,
228135,
318248,
277291,
318253,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
277317,
277329,
162643,
310100,
301911,
277337,
301921,
400236,
236397,
162671,
326514,
15224,
236408,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
310179,
293798,
293802,
236460,
293811,
293817,
293820,
203715,
326603,
342994,
293849,
293861,
228327,
228328,
318442,
326638,
277486,
351217,
318450,
293877,
285686,
302073,
293882,
121850,
302075,
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,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
294026,
285835,
302218,
162964,
384148,
187542,
302231,
302233,
285852,
302237,
285854,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
294072,
318651,
277695,
318657,
302275,
130244,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
228592,
294132,
138485,
204026,
228606,
204031,
64768,
310531,
138505,
228617,
318742,
204067,
277801,
277804,
285997,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
277822,
417086,
302403,
294211,
277832,
277836,
277839,
326991,
277842,
277847,
277850,
179547,
277853,
277857,
277860,
302436,
294246,
327015,
310632,
327017,
277864,
351594,
277869,
277872,
351607,
277880,
310648,
310651,
277884,
277888,
310657,
310659,
351619,
277892,
294276,
277894,
327046,
310665,
318858,
253320,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
277921,
310689,
130468,
277928,
277932,
310703,
277937,
130486,
310710,
310712,
277944,
277947,
310715,
277950,
277953,
302534,
310727,
64966,
245191,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
277978,
277981,
310749,
277984,
310755,
277989,
277991,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
310780,
286203,
228864,
286214,
302603,
302614,
286233,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
40488,
245288,
294439,
40491,
294443,
294445,
286248,
310831,
294440,
40499,
212538,
40507,
40511,
40513,
327240,
40521,
286283,
40525,
40527,
212560,
228944,
400976,
40533,
40537,
40541,
278109,
40544,
40548,
40550,
40552,
286313,
40554,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
310925,
286354,
278163,
302740,
278168,
327333,
229030,
212648,
278188,
302764,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
302793,
294601,
212690,
319187,
286420,
229076,
286425,
319194,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
302852,
302854,
294664,
311048,
319243,
311053,
302862,
294682,
278306,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
237409,
294776,
360317,
294785,
327554,
360322,
40840,
40851,
294803,
188312,
294811,
319390,
40865,
294817,
319394,
294821,
180142,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
237562
] |
89093ba0f3190c2467119eb4cba327ec350db7d7 | 02f457decfe897c28ee8e6e5426791fdea73cb0b | /RealmTestTests/RealmTestTests.swift | 3594f94fe9fa78117b929ba9c65bdd627630c039 | [] | no_license | dmendis/realm-test | 8de8b8b23728d279224a75fe83f6dec72ca3838e | 548b827be6f1ec961f503cc281dbe98257a1b9f8 | refs/heads/master | 2021-01-01T04:35:39.995973 | 2016-05-19T18:34:21 | 2016-05-19T18:34:21 | 59,232,097 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 988 | swift | //
// RealmTestTests.swift
// RealmTestTests
//
// Created by Dineth Mendis on 20/05/2016.
// Copyright © 2016 M2D2 Pty Ltd. All rights reserved.
//
import XCTest
@testable import RealmTest
class RealmTestTests: 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.
}
}
}
| [
282633,
313357,
98333,
239650,
229413,
102437,
354343,
204840,
354345,
227370,
223274,
292902,
233517,
155694,
309295,
229424,
282672,
278570,
237620,
229430,
180280,
288833,
288834,
286788,
313416,
311372,
354385,
315476,
223316,
280661,
278615,
307289,
354393,
315487,
237663,
45153,
309345,
280675,
227428,
280677,
313447,
315497,
131178,
194666,
278634,
315498,
278638,
288879,
284788,
333940,
223350,
233590,
280694,
288889,
131191,
233589,
292988,
313469,
131198,
215166,
292992,
215164,
278655,
194691,
227460,
280712,
215178,
235662,
311438,
278670,
323729,
278677,
284825,
284826,
278685,
311458,
278691,
233636,
184484,
299174,
284841,
233642,
284842,
153776,
278704,
239793,
299187,
278708,
131256,
184505,
278714,
223419,
280762,
227513,
299198,
295098,
280768,
227524,
309444,
280778,
282831,
280795,
227548,
229597,
301279,
311519,
280802,
176362,
286958,
184570,
227578,
184575,
309503,
311042,
194820,
313608,
278797,
325905,
319763,
325912,
309529,
282909,
278816,
282913,
233762,
237857,
217380,
211235,
211238,
282919,
227616,
98610,
280887,
278842,
315706,
282939,
307517,
287041,
260418,
287043,
321860,
139589,
280902,
319813,
227654,
311621,
325968,
6481,
278869,
289110,
6489,
168281,
379225,
293556,
323935,
106847,
354655,
321894,
416104,
280939,
285040,
242033,
313713,
199029,
246136,
291192,
317820,
211326,
311681,
248194,
227725,
240016,
178582,
190871,
291224,
293274,
285084,
141728,
61857,
285090,
61859,
246178,
289189,
315810,
315811,
311727,
299441,
293303,
61880,
283064,
278970,
319930,
293306,
293310,
278978,
127427,
127428,
291267,
283075,
278989,
281037,
281040,
278993,
326100,
278999,
328152,
176601,
369116,
188894,
287198,
279008,
160225,
358882,
285150,
279013,
279018,
319981,
291311,
281072,
309744,
319987,
279029,
279032,
233978,
279039,
301571,
291333,
342536,
287241,
279050,
303631,
283153,
279057,
303636,
279062,
279065,
291358,
182817,
180771,
293419,
244269,
283182,
283184,
236081,
234036,
289332,
279094,
23092,
315960,
338490,
70209,
115270,
70215,
293448,
309830,
377418,
55881,
281166,
281171,
309846,
287318,
332378,
295519,
66150,
111208,
279144,
279146,
313966,
281199,
295536,
287346,
287352,
301689,
244347,
279164,
291454,
189057,
279177,
152203,
287374,
111253,
316053,
117397,
230040,
227990,
289434,
303771,
111259,
221852,
295576,
205471,
314009,
279206,
279210,
287404,
295599,
285361,
303793,
299699,
299700,
342706,
166582,
318130,
314040,
287417,
158394,
230072,
289462,
285373,
287422,
285371,
285372,
285374,
303803,
66242,
287433,
225995,
154316,
287439,
334547,
279252,
96984,
287452,
289502,
299746,
295652,
279269,
246503,
285415,
234217,
342762,
293612,
129773,
289518,
230125,
279280,
312047,
312052,
125684,
199414,
154359,
230134,
228088,
299770,
234234,
221948,
279294,
205568,
242433,
295682,
299776,
191235,
285444,
322313,
322316,
295697,
291604,
166676,
285466,
283419,
326429,
293664,
281377,
234277,
283430,
262951,
279336,
289576,
262954,
318250,
295724,
318252,
312108,
285487,
301871,
164656,
303920,
262962,
234294,
230199,
285497,
293693,
289598,
160575,
281408,
295744,
279362,
295746,
318278,
283467,
201551,
281427,
281433,
230234,
322395,
234331,
301918,
295776,
279392,
293730,
303972,
279397,
230248,
177001,
201577,
308076,
400239,
246641,
174963,
207732,
310131,
295798,
209783,
228215,
209785,
279417,
177019,
246648,
308092,
291712,
158593,
113542,
287622,
228233,
228234,
308107,
58253,
56208,
308112,
234386,
293781,
324506,
324507,
318364,
277403,
310176,
310178,
289698,
189348,
283558,
289703,
279464,
293800,
310182,
236461,
293806,
304051,
189374,
289727,
19399,
213960,
279498,
316364,
183248,
304087,
50143,
314342,
234472,
234473,
324586,
326635,
203757,
289774,
183279,
304110,
320493,
287731,
277492,
240630,
295927,
304122,
312314,
318461,
234500,
277509,
134150,
322570,
230410,
234514,
277524,
316437,
140310,
322582,
293910,
197657,
281626,
175132,
189474,
300068,
238639,
300084,
322612,
238651,
308287,
238664,
300111,
234577,
296019,
234587,
277597,
304222,
113760,
281697,
302177,
230499,
281700,
285798,
322663,
300135,
300136,
228458,
207979,
279660,
281706,
15471,
144496,
234609,
312434,
285814,
300151,
279672,
337017,
291959,
160891,
285820,
300158,
150657,
187521,
234625,
285828,
279685,
285830,
222343,
302216,
302213,
228491,
234638,
326804,
185493,
296086,
238743,
187544,
308372,
283802,
119962,
296092,
300188,
339102,
285851,
300187,
330913,
306338,
234663,
300202,
281771,
249002,
238765,
279728,
238769,
208058,
294074,
230588,
64700,
228542,
228540,
283840,
302274,
279747,
283847,
283852,
244940,
283853,
279760,
290000,
189652,
279765,
189653,
148696,
279774,
304351,
298208,
310497,
298212,
304356,
290022,
279785,
228588,
298221,
234733,
279792,
298228,
302325,
234742,
292085,
228600,
292091,
216315,
388349,
208124,
228609,
292107,
312587,
251153,
177428,
173334,
339234,
130338,
130343,
279854,
298291,
286013,
306494,
216386,
279875,
286018,
113987,
300359,
230729,
294218,
234827,
177484,
222541,
296270,
234831,
238927,
296273,
224586,
314709,
314710,
283991,
357719,
222559,
292195,
294243,
230756,
281957,
163175,
230765,
284014,
306542,
279920,
327025,
296303,
296307,
116084,
181625,
111993,
290173,
306559,
224640,
179587,
148867,
294275,
298374,
314758,
314760,
142729,
296329,
368011,
296335,
112017,
306579,
224661,
282007,
357786,
318875,
310692,
282022,
314791,
282024,
279974,
310701,
314798,
173491,
304564,
279989,
286132,
292283,
228795,
302531,
292292,
339398,
300487,
296392,
306631,
280010,
300489,
310732,
280013,
312782,
64975,
302540,
306639,
310736,
222675,
284107,
212442,
228827,
286172,
239068,
280032,
144867,
187878,
316902,
280041,
329197,
329200,
306673,
282096,
296433,
308723,
306677,
191990,
280055,
300535,
288249,
286202,
300536,
290300,
286205,
302590,
290301,
294400,
296448,
282114,
230913,
306692,
306693,
300542,
230921,
296461,
323087,
304656,
282129,
316946,
308756,
282136,
282141,
302623,
286244,
286254,
312880,
288309,
290358,
194110,
288318,
280130,
349763,
196164,
288326,
282183,
218696,
288327,
292425,
56902,
333388,
228943,
286288,
280147,
290390,
300630,
128599,
235095,
306776,
196187,
239198,
157281,
286306,
300644,
282213,
317032,
310889,
323178,
312940,
204397,
222832,
314998,
288378,
175741,
235135,
294529,
239237,
282245,
286343,
288392,
229001,
282246,
290443,
310923,
323217,
282259,
229020,
333470,
282271,
282273,
302754,
282276,
229029,
298661,
40613,
40614,
40615,
282280,
290471,
298667,
206504,
300714,
321199,
298712,
286388,
286391,
337591,
306874,
280251,
282303,
286399,
280257,
323263,
218819,
282312,
306890,
280267,
302797,
282318,
9936,
212688,
302802,
313041,
280278,
282327,
280280,
278233,
18138,
278234,
67292,
286423,
294622,
321247,
278240,
298720,
282339,
153319,
12010,
288491,
280300,
239341,
282348,
284401,
282355,
323316,
282358,
313081,
229113,
286459,
300794,
194304,
282369,
288512,
278272,
323331,
323332,
288516,
280327,
216839,
280329,
282378,
300811,
321295,
284431,
278291,
278293,
282391,
116505,
284442,
286494,
282400,
313120,
315171,
282409,
284459,
294700,
280366,
300848,
282417,
200498,
296755,
280372,
321337,
282427,
280380,
345919,
315202,
282434,
307011,
282438,
153415,
280392,
280390,
304977,
307025,
413521,
18262,
216918,
307031,
280410,
284507,
188251,
300894,
237408,
284512,
284514,
296806,
276327,
292712,
282474,
288619,
288620,
280430,
292720,
282480,
313203,
300918,
194429,
315264,
339841,
305026,
67463,
282504,
243591,
279217,
243597,
110480,
184208,
282518,
282519,
294807,
214937,
214938,
294809,
337815,
298909,
294814,
311199,
239514,
300963,
294823,
298920,
284587,
292782,
200627,
282549,
288697,
290746,
294843,
98239,
294850,
280514,
280519,
214984,
151497,
284619,
344013,
301008,
153554,
194515,
280541,
298980,
292837,
294886,
317415,
296941,
278512,
329712,
311282,
325619,
282612,
311281,
292858
] |
775cd60427a33ae2d70aa0a413b0710dfd030f45 | e6d3037dc618a093ef53f7aa4960cf1495f8f725 | /WeightAndLevel/Model/Computation.swift | cfd4c4781648ee80e3dc2db60fa65404dcd0524a | [] | no_license | rtpanaguiton/WeightnBalance | 023167c5653cda49588f5b206a1bdc3013cc48a3 | ac06d5250819e6ec67910b720e29342d41dd9f55 | refs/heads/master | 2020-03-30T09:24:58.956334 | 2018-10-01T10:52:50 | 2018-10-01T10:52:50 | 151,074,457 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,891 | swift | //
// Computation.swift
// WeightAndLevel
//
// Created by Reymund on 15/08/2018.
// Copyright © 2018 ReymundoPanaguiton. All rights reserved.
//
import Foundation
class Computation {
var pilotWeight = 0.0
var coPilotWeight = 0.0
var pax1Weight = 0.0
var pax2Weight = 0.0
var pax3Weight = 0.0
var fuelWeight = 0.0
var baggageWeight = 0.0
var aircraftMomentArm = 0.0
var aircraftWeight: Double
init(aircraftWeight: Double, aircraftCG: Double) {
self.aircraftWeight = aircraftWeight
aircraftMomentArm = aircraftCG
}
struct momentArm {
static let pilot = 2.35
static let pax = 3.10
static let baggage = 4.75
static let fuel = 4.10
}
private func computeForPilotsWeight() -> Double {
return pilotWeight + coPilotWeight
}
private func computeMomentPilots() -> Double {
return computeForPilotsWeight() * momentArm.pilot
}
private func computeMomentOfPax() -> Double {
return computeForPaxWeights() * momentArm.pax
}
private func computeForMomentOfFuel() -> Double {
let moment = fuelWeight * momentArm.fuel
return moment
}
private func computeMomentOfArcraft() -> Double {
let moment = aircraftWeight * aircraftMomentArm
return moment
}
func computeForCenterOfGravity() -> Double {
let totalMoment = computeMomentOfPax() + computeMomentPilots() + computeMomentOfArcraft() + computeForMomentOfFuel()
return totalMoment / computeForTotalWeight()
}
private func computeForPaxWeights() -> Double {
return pax1Weight + pax2Weight + pax3Weight
}
func computeForTotalWeight() -> Double {
return computeForPilotsWeight() + computeForPaxWeights() + fuelWeight + aircraftWeight + baggageWeight
}
}
| [
-1
] |
d0291679dbf59e0f6d2a5e7e39582619ec387fc6 | 59c25ecce6d13bc6b9bd0712875369da5e022342 | /BeerApp/BeerTableViewController.swift | e8dedff949b3b45544033dec3cca00644ecce045 | [] | no_license | StevenVanD/beers | 7480eb6f17767d5e9a6d6f6804b6f3f2b54652c9 | 534cc2deb1094bebdf87180c16a6c103ae856c23 | refs/heads/master | 2021-08-31T14:12:39.315729 | 2017-12-08T13:08:57 | 2017-12-08T13:08:57 | 113,572,946 | 0 | 0 | null | 2018-07-27T13:54:52 | 2017-12-08T12:37:27 | Swift | UTF-8 | Swift | false | false | 10,101 | swift | //
// BeerTableViewController.swift
// BeerApp
//
// Created by student on 25/08/2017.
// Copyright © 2017 iCapps. All rights reserved.
//
import UIKit
import MapKit
import CoreLocation
class BeerTableViewController: UITableViewController,CLLocationManagerDelegate {
let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
@IBOutlet weak var brewNameLabel: UILabel!
@IBOutlet weak var brewAddressLabel: UILabel!
@IBOutlet weak var segment: UISegmentedControl!
var beers: [Beer] = []
var breweries: [Brewery] = []
var locatiemanager = CLLocationManager()
var currentLocation = CLLocation()
var closestLocation: CLLocation?
var smallestDistance: CLLocationDistance?
var closestBrewery: Brewery?
override func viewDidLoad() {
super.viewDidLoad()
locatiemanager.delegate = self
locatiemanager.requestAlwaysAuthorization()
locatiemanager.startUpdatingLocation()
//Updates if it's your first launch
let launchedBefore = UserDefaults.standard.bool(forKey: "launchedBefore")
if launchedBefore {
print("Not first launch.")
}
else {
print("First launch, setting UserDefault.")
update()
UserDefaults.standard.set(true, forKey: "launchedBefore")
}
getData()
}
//Checks everytime you move for the closest brewery and changes the labels
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let location = locations[0]
currentLocation = location
for brew in breweries {
let distance = currentLocation.distance(from: CLLocation(latitude: brew.lat, longitude: brew.lon))
if smallestDistance == nil || distance < smallestDistance! {
closestLocation = location
smallestDistance = distance
closestBrewery = brew
}
}
brewNameLabel.text = (closestBrewery?.name)!
brewAddressLabel.text = (closestBrewery?.address)!
}
//Updates the beer list when entering this viewController (when you return from the detail page)
override func viewDidAppear(_ animated: Bool) {
getData()
}
//Reading all beers and breweries from core data
func getData() {
beers = []
breweries = []
let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
do {
let loadedBreweries = try context.fetch(Breweries.fetchRequest()) as! [Breweries]
for brew in loadedBreweries{
self.breweries += [Brewery(name: brew.name!, address: brew.address!)]
}
} catch {
print("Fetching Failed")
}
do {
let loadedBeers = try context.fetch(Beers.fetchRequest()) as! [Beers]
for b in loadedBeers{
if(segment.selectedSegmentIndex == 0){
beers += [Beer(name: b.name!, photo: b.photoLink!, brewery: Int(b.brewery), score: Int(b.score))]
}else if(b.score >= 0){
beers += [Beer(name: b.name!, photo: b.photoLink!, brewery: Int(b.brewery), score: Int(b.score))]
}
}
} catch {
print("Fetching Failed")
}
self.tableView.reloadData()
}
/*If I found out how to get the info from a heroku-website
//Online
let url = URL(string: "https://icapps-beers.herokuapp.com/beers")
let urlRequest = URLRequest(url: url!)
// set up the session
let session = URLSession(configuration: URLSessionConfiguration.default)
// make the request
let task = session.dataTask(with: urlRequest) {
(data, response, error) in
// check for any errors
guard error == nil else {
print("error calling GET")
print(error!)
return
}
// make sure we got data
guard let responseData = data else {
print("Error: did not receive data")
return
}
// parse the result
do {
guard let greeting = try JSONSerialization.jsonObject(with: responseData, options: []) as? [String: AnyObject] else {
print("error trying to convert data to JSON")
return
}
guard let record = try greeting["records"] as? [AnyObject] else {
print("fail")
return
}
//Use the data
}
}
for (key, value) in greeting {
if key == "datasetid" {
//print(value)
}
}
} catch {
print("error trying to convert data to JSON")
return
}
}
task.resume()
*/
//Deleting all existing beers and breweries and adding standard beers and breweries to core data
func update() {
let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
do {
let loadedBeers = try context.fetch(Beers.fetchRequest()) as! [Beers]
for b in loadedBeers{
context.delete(b)
}
} catch {
print("Fetching Failed")
}
do {
let loadedBreweries = try context.fetch(Breweries.fetchRequest()) as! [Breweries]
for brew in loadedBreweries{
context.delete(brew)
}
} catch {
print("Fetching Failed")
}
do{
try context.save()
}
catch{
}
beers.removeAll()
breweries.removeAll()
//Feel free to ad some beers and breweries
//Some breweries
breweries += [Brewery(name: "Brewery0", address: "Linthout 1 Aalst") ]
breweries += [Brewery(name: "Brewery1", address: "Nijverheidskaai Brussel") ]
breweries += [Brewery(name: "Brewery2", address: "Rijnkaai 97/103 2000 Antwerpen") ]
//Enough beers for testing the scroll
beers += [Beer(name: "Beer0", photo: "beer.png", brewery: 0, score: -1) ]
beers += [Beer(name: "Beer1", photo: "beer.png", brewery: 2, score: -1) ]
beers += [Beer(name: "Beer2", photo: "beer.png", brewery: 1, score: -1) ]
beers += [Beer(name: "Beer3", photo: "beer.png", brewery: 2, score: -1) ]
beers += [Beer(name: "Beer4", photo: "beer.png", brewery: 0, score: -1) ]
beers += [Beer(name: "Beer5", photo: "beer.png", brewery: 1, score: -1) ]
beers += [Beer(name: "Beer6", photo: "beer.png", brewery: 0, score: -1) ]
beers += [Beer(name: "Beer7", photo: "beer.png", brewery: 2, score: -1) ]
beers += [Beer(name: "Beer8", photo: "beer.png", brewery: 1, score: -1) ]
beers += [Beer(name: "Beer9", photo: "beer.png", brewery: 2, score: -1) ]
beers += [Beer(name: "Beer10", photo: "beer.png", brewery: 0, score: -1) ]
beers += [Beer(name: "Beer11", photo: "beer.png", brewery: 1, score: -1) ]
beers += [Beer(name: "Beer12", photo: "beer.png", brewery: 0, score: -1) ]
beers += [Beer(name: "Beer13", photo: "beer.png", brewery: 2, score: -1) ]
beers += [Beer(name: "Beer14", photo: "beer.png", brewery: 1, score: -1) ]
beers += [Beer(name: "Beer15", photo: "beer.png", brewery: 2, score: -1) ]
beers += [Beer(name: "Beer16", photo: "beer.png", brewery: 0, score: -1) ]
beers += [Beer(name: "Beer17", photo: "beer.png", brewery: 1, score: -1) ]
for b in breweries{
let brewery = Breweries(context: context)
brewery.name = b.name
brewery.address = b.address
do{
try context.save()
}catch{
fatalError("Failed to save context: \(error)")
}
}
for b in beers{
let beer = Beers(context: context)
beer.name = b.name
beer.photoLink = b.photo as String
beer.brewery = Int64(b.brewery)
beer.score = Int16(b.score)
do{
try context.save()
}catch{
fatalError("Failed to save context: \(error)")
}
}
}
//Sending the selected beer info to the next viewController
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let nextVC = segue.destination as? ViewController
{
let indexPath = self.tableView.indexPathForSelectedRow!
nextVC.beer = self.beers[indexPath.row]
nextVC.brewery = self.breweries[self.beers[indexPath.row].brewery]
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return beers.count
}
//Changing the text of the labels in every cell into the info of the beers
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "myCell", for: indexPath) as! TableCell
cell.textLabel?.text = self.beers[indexPath.row].name
cell.detailTextLabel?.text = breweries[self.beers[indexPath.row].brewery].name
cell.imageView?.image = UIImage(named: self.beers[indexPath.row].photo)!
if(self.beers[indexPath.row].score >= 0){
cell.ratingLabel?.text = "\(self.beers[indexPath.row].score)"
}else{
cell.ratingLabel?.text = ""
}
// Configure the cell...
return cell
}
//Reloading the beers if yoou switch between all beers and rated beers
@IBAction func switchSelection(_ sender: UISegmentedControl) {
getData()
}
}
| [
-1
] |
2156a51176b574f02876386ffdb049af04f8872b | ba2c66d555c16ceb312e349cd6b3ddf24669674a | /PerformanceShaders/PerformanceShaders/AppDelegate.swift | 9db283edd66edcbb920ee5431acb09e90312f4f8 | [] | no_license | adamnemecek/MetalTalk | 4dc4cae99d8ffff3104e75920f51d7a3a37a436e | 7a1c7b807c8f5bd5f4846ad9855b78185ff28499 | refs/heads/master | 2021-01-20T03:11:56.813525 | 2015-11-10T22:56:43 | 2015-11-10T22:56:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 264 | swift | //
// AppDelegate.swift
// MetalPerf
//
// Created by Ryder Mackay on 2015-09-03.
// Copyright © 2015 Ryder Mackay. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
}
| [
-1
] |
8f59943b707af84669960a60b926f77822f915d3 | f5cd2bff63155dde01e1a735c21395105a86bc31 | /test/Interpreter/dynamic_replacement.swift | 193c2a9d096cd1dd8f5fa8a2a18edc853b27968e | [
"Apache-2.0",
"Swift-exception"
] | permissive | shahmishal/swift | 0ff1209c0702cba87239f9f79b8790d2ea2b04f5 | 6665a48de153bb4e5e7d2919db661943699c9a1c | refs/heads/master | 2022-06-11T03:21:11.456449 | 2020-02-10T06:34:27 | 2020-02-10T06:34:27 | 143,474,720 | 6 | 1 | Apache-2.0 | 2020-02-10T06:35:31 | 2018-08-03T21:27:21 | C++ | UTF-8 | Swift | false | false | 8,368 | swift | // RUN: %empty-directory(%t)
// RUN: %target-build-swift-dylib(%t/%target-library-name(Module1)) -DMODULE -module-name Module1 -emit-module -emit-module-path %t/Module1.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift
// RUN: %target-build-swift-dylib(%t/%target-library-name(Module2)) -I%t -L%t -lModule1 %target-rpath(%t) -DMODULE2 -module-name Module2 -emit-module -emit-module-path %t/Module2.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift
// RUN: %target-build-swift -I%t -L%t -lModule1 -DMAIN -o %t/main %target-rpath(%t) %s -swift-version 5
// RUN: %target-codesign %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2)
// RUN: %target-run %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2)
// Now the same in optimized mode.
// RUN: %empty-directory(%t)
// RUN: %target-build-swift-dylib(%t/%target-library-name(Module1)) -O -DMODULE -module-name Module1 -emit-module -emit-module-path %t/Module1.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift
// RUN: %target-build-swift-dylib(%t/%target-library-name(Module2)) -O -I%t -L%t -lModule1 %target-rpath(%t) -DMODULE2 -module-name Module2 -emit-module -emit-module-path %t/Module2.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift
// RUN: %target-build-swift -O -I%t -L%t -lModule1 -DMAIN -o %t/main %target-rpath(%t) %s -swift-version 5
// RUN: %target-codesign %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2)
// RUN: %target-run %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2)
// Now the same in size mode.
// RUN: %empty-directory(%t)
// RUN: %target-build-swift-dylib(%t/%target-library-name(Module1)) -Osize -DMODULE -module-name Module1 -emit-module -emit-module-path %t/Module1.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift
// RUN: %target-build-swift-dylib(%t/%target-library-name(Module2)) -Osize -I%t -L%t -lModule1 %target-rpath(%t) -DMODULE2 -module-name Module2 -emit-module -emit-module-path %t/Module2.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift
// RUN: %target-build-swift -Osize -I%t -L%t -lModule1 -DMAIN -o %t/main %target-rpath(%t) %s -swift-version 5
// RUN: %target-codesign %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2)
// RUN: %target-run %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2)
// Now the same in optimized wholemodule mode.
// RUN: %empty-directory(%t)
// RUN: %target-build-swift-dylib(%t/%target-library-name(Module1)) -O -wmo -DMODULE -module-name Module1 -emit-module -emit-module-path %t/Module1.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift
// RUN: %target-build-swift-dylib(%t/%target-library-name(Module2)) -O -wmo -I%t -L%t -lModule1 %target-rpath(%t) -DMODULE2 -module-name Module2 -emit-module -emit-module-path %t/Module2.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift
// RUN: %target-build-swift -O -wmo -I%t -L%t -lModule1 -DMAIN -o %t/main %target-rpath(%t) %s -swift-version 5
// RUN: %target-codesign %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2)
// RUN: %target-run %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2)
// Test the -enable-implicit-dynamic flag.
// RUN: %empty-directory(%t)
// RUN: %target-build-swift-dylib(%t/%target-library-name(Module1)) -DMODULENODYNAMIC -module-name Module1 -emit-module -emit-module-path %t/Module1.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift -Xfrontend -enable-implicit-dynamic
// RUN: %target-build-swift-dylib(%t/%target-library-name(Module2)) -I%t -L%t -lModule1 %target-rpath(%t) -DMODULE2 -module-name Module2 -emit-module -emit-module-path %t/Module2.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift
// RUN: %target-build-swift -I%t -L%t -lModule1 -DMAIN -o %t/main %target-rpath(%t) %s -swift-version 5
// RUN: %target-codesign %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2)
// RUN: %target-run %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2)
// Test the -enable-implicit-dynamic flag in optimized wholemodule mode.
// RUN: %empty-directory(%t)
// RUN: %target-build-swift-dylib(%t/%target-library-name(Module1)) -O -wmo -DMODULENODYNAMIC -module-name Module1 -emit-module -emit-module-path %t/Module1.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift -Xfrontend -enable-implicit-dynamic
// RUN: %target-build-swift-dylib(%t/%target-library-name(Module2)) -O -wmo -I%t -L%t -lModule1 %target-rpath(%t) -DMODULE2 -module-name Module2 -emit-module -emit-module-path %t/Module2.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_module.swift
// RUN: %target-build-swift -O -wmo -I%t -L%t -lModule1 -DMAIN -o %t/main %target-rpath(%t) %s -swift-version 5
// RUN: %target-codesign %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2)
// RUN: %target-run %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2)
// REQUIRES: executable_test
import Module1
import StdlibUnittest
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
import Darwin
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
import Glibc
#elseif os(Windows)
import MSVCRT
import WinSDK
#else
#error("Unsupported platform")
#endif
var DynamicallyReplaceable = TestSuite("DynamicallyReplaceable")
func expectedResult(_ forOriginalLibrary: Bool, _ expectedOriginalString: String) -> String {
if forOriginalLibrary {
return expectedOriginalString
} else {
return "replacement of \(expectedOriginalString)"
}
}
func checkExpectedResults(forOriginalLibrary useOrig: Bool) {
expectTrue(public_global_var == expectedResult(useOrig, "public_global_var"))
expectTrue(public_global_func() ==
expectedResult(useOrig, "public_global_func"))
expectTrue(public_global_generic_func(Int.self) ==
expectedResult(useOrig, "public_global_generic_func"))
expectTrue(PublicClass().function() ==
expectedResult(useOrig, "public_class_func"))
expectTrue(PublicClass().finalFunction() ==
expectedResult(useOrig, "public_class_final_func"))
expectTrue(PublicClass().genericFunction(Int.self) ==
expectedResult(useOrig, "public_class_generic_func"))
expectTrue(PublicStruct().function() ==
expectedResult(useOrig, "public_struct_func"))
expectTrue(PublicStruct().genericFunction(Int.self) ==
expectedResult(useOrig, "public_struct_generic_func"))
expectTrue(PublicStruct().public_stored_property ==
expectedResult(useOrig, "public_stored_property"))
expectTrue(PublicStruct()[0] ==
expectedResult(useOrig, "public_subscript_get"))
expectTrue(PublicStruct()[y:0] ==
expectedResult(useOrig, "public_subscript_get_modify_read"))
var testSetter = PublicStruct()
testSetter[0] = "public_subscript_set"
expectTrue(testSetter.str ==
expectedResult(useOrig, "public_subscript_set"))
testSetter[y:0] = "public_subscript_set_modify_read"
expectTrue(testSetter.str ==
expectedResult(useOrig, "public_subscript_set_modify_read"))
expectTrue(PublicEnumeration<Int>.A.function() ==
expectedResult(useOrig, "public_enum_func"))
expectTrue(PublicEnumeration<Int>.B.genericFunction(Int.self) ==
expectedResult(useOrig, "public_enum_generic_func"))
}
private func target_library_name(_ name: String) -> String {
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
return "lib\(name).dylib"
#elseif os(Windows)
return "\(name).dll"
#else
return "lib\(name).so"
#endif
}
DynamicallyReplaceable.test("DynamicallyReplaceable") {
var executablePath = CommandLine.arguments[0]
executablePath.removeLast(4)
// First, test with only the original module.
checkExpectedResults(forOriginalLibrary: true)
// Now, test with the module containing the replacements.
#if os(Linux)
_ = dlopen(target_library_name("Module2"), RTLD_NOW)
#elseif os(Windows)
_ = LoadLibraryA(target_library_name("Module2"))
#else
_ = dlopen(executablePath+target_library_name("Module2"), RTLD_NOW)
#endif
checkExpectedResults(forOriginalLibrary: false)
}
runAllTests()
| [
82428
] |
2fe92f7901cb0846ecc9140fedfbc169d6c66dbb | 67ce32b93ce990e2de322701e2003556bad79e42 | /Sources/ReplicantSwift/ToneBurst/Starburst/StarburstConfig.swift | d0cf13d161fc9ceafc93ea1f4f964a419cfb9561 | [
"MIT"
] | permissive | OperatorFoundation/ReplicantSwift | 92e316afca6c6d4d944e667443eeb9f67cd7ad7f | d8d4eccf059d987d20688436deb10fd9d188d4ca | refs/heads/main | 2023-09-02T22:28:45.615045 | 2023-08-28T19:34:25 | 2023-08-28T19:34:25 | 157,581,939 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,595 | swift | //
// StarburstConfig.swift
//
//
// Created by Dr. Brandon Wiley on 5/9/22.
//
import Foundation
import Ghostwriter
public enum StarburstMode: String, Codable {
case SMTPServer
case SMTPClient
}
public enum Speak: Codable, CustomStringConvertible
{
public var description: String
{
switch self
{
case .bytes(let value):
return "Speak.bytes(\(value))"
case .text(let value):
return "Speak.text(\(value))"
case .template(let template, let details):
return "Speak.bytes(\(template), \(details))"
}
}
case bytes(Data)
case text(String)
case template(Template, [Detail])
}
public enum Listen: Codable
{
case bytes(Int)
case text(Int)
case parse(ListenTemplate)
case match(ListenTemplate)
}
public struct ListenTemplate: Codable
{
let template: Template
let patterns: [ExtractionPattern]
let maxSize: Int
let maxTimeoutSeconds: Int
public init?(_ template: Template, patterns: [ExtractionPattern], maxSize: Int, maxTimeoutSeconds: Int)
{
guard maxSize > 0 else
{
return nil
}
guard maxTimeoutSeconds > 0 else
{
return nil
}
self.template = template
self.patterns = patterns
self.maxSize = maxSize
self.maxTimeoutSeconds = maxTimeoutSeconds
}
}
public struct Wait: Codable
{
let interval: TimeInterval
public init(_ interval: TimeInterval)
{
self.interval = interval
}
}
| [
-1
] |
9dba0a2aca471337bec8575494e302dc2a80c617 | 65540680d68b198a11b4fd16e90641f5dec2e2ed | /RxCocoa/iOS/UITextField+Rx.swift | fad2f7a04c96446e17c09bf315da29cbb89ec064 | [
"MIT"
] | permissive | yoshik/RxSwift | 1b7159c2494249a14fdd84c2b42754d28d80ee1e | 73df0441888556042cb6173195241d7769086cc5 | refs/heads/master | 2020-12-03T00:43:30.796332 | 2017-09-07T10:39:50 | 2017-09-07T10:39:50 | 96,071,915 | 0 | 0 | null | 2017-07-10T14:58:29 | 2017-07-03T05:03:27 | Swift | UTF-8 | Swift | false | false | 3,102 | swift | //
// UITextField+Rx.swift
// RxCocoa
//
// Created by Krunoslav Zaher on 2/21/15.
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
#if os(iOS) || os(tvOS)
#if !RX_NO_MODULE
import RxSwift
#endif
import UIKit
extension UITextField {
/// Factory method that enables subclasses to implement their own `delegate`.
///
/// - returns: Instance of delegate proxy that wraps `delegate`.
public func createRxDelegateProxy() -> RxTextFieldDelegateProxy {
return RxTextFieldDelegateProxy(parentObject: self)
}
}
extension Reactive where Base: UITextField {
/// Reactive wrapper for `delegate`.
///
/// For more information take a look at `DelegateProxyType` protocol documentation.
public var delegate: DelegateProxy {
return RxTextFieldDelegateProxy.proxyForObject(base)
}
/// Reactive wrapper for `text` property
public var text: ControlProperty<String?> {
return value
}
/// Reactive wrapper for `text` property.
public var value: ControlProperty<String?> {
let source: Observable<String?> = Observable.deferred { [weak textField = self.base as UITextField] () -> Observable<String?> in
let text = textField?.text
return (textField?.rx.delegate.methodInvoked(#selector(UITextFieldDelegate.textFieldShouldBeginEditing(_:))) ?? Observable.empty())
.map { a in
return ()
}
.startWith(text)
}
let bindingObserver = UIBindingObserver(UIElement: self.base) { (textField, text: String?) in
if textField.text != text {
textField.text = text
}
}
return ControlProperty(values: source, valueSink: bindingObserver)
}
/// Reactive wrapper for `delegate` message.
public var didBeginEditing: ControlEvent<()> {
return ControlEvent<()>(events:
self.delegate.methodInvoked(#selector(UITextFieldDelegate.textFieldDidBeginEditing(_:)))
.map { a in
return ()
})
}
/// Reactive wrapper for `delegate` message.
public var didEndEditing: ControlEvent<()> {
return ControlEvent<()>(events:
self.delegate.methodInvoked(#selector(UITextFieldDelegate.textFieldDidEndEditing(_:)))
.map { a in
return ()
})
}
//
// /// Reactive wrapper for `delegate` message.
// public var shouldBeginEditing: Bool {
// return ControlEvent<()>(events:
// self.delegate.methodInvoked(#selector(UITextFieldDelegate.textFieldShouldBeginEditing(_:)))
// .map { a in
// return a
// })
// }
//
// /// Reactive wrapper for `delegate` message.
// public var shouldEndEditing: Bool {
// return ControlEvent<()>(events: self.delegate.methodInvoked(#selector(UITextFieldDelegate.textFieldShouldEndEditing(_:)))
// .map { a in
// return a
// })
// }
}
#endif
| [
-1
] |
37a5ab67a376f980b206e9ed00e7152934274f79 | 950b9aaaf637ff8eed2f7e1ed18542f27cea1785 | /ShopBack/Extensions/UIColor+ShopBack.swift | d50afb9e0488ff1ec1111bc0097955e913ecfe5f | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | gannasong/ShopBack | 644cae74c9e112bd8615f12447614eef19e3a664 | 3359ffb52a22661ce45ac123c444a1d242ebf0ca | refs/heads/master | 2022-10-07T15:17:02.497597 | 2020-06-15T02:30:56 | 2020-06-15T02:30:56 | 234,706,034 | 2 | 1 | MIT | 2022-10-06T08:59:35 | 2020-01-18T08:43:40 | Swift | UTF-8 | Swift | false | false | 850 | swift | //
// UIColor+ShopBack.swift
// ShopBack
//
// Created by Min on 2019/12/17.
// Copyright © 2019 SUNG HAO LIN. All rights reserved.
//
import UIKit
extension UIColor {
// MARK: - Initialization
convenience init(r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) {
self.init(red: r / 255.0, green: g / 255.0, blue: b / 255.0, alpha: a / 100.0)
}
// MARK: - Customization
class var sp_scarlet: UIColor {
return .init(r: 252, g: 80, b: 77, a: 100)
}
class var sp_sapphire: UIColor {
return .init(r: 93, g: 100, b: 118, a: 100)
}
class var sp_blackA10: UIColor {
return .init(r: 0, g: 0, b: 0, a: 10)
}
class var sp_whiteA60: UIColor {
return .init(r: 255, g: 255, b: 255, a: 60)
}
class var sp_mainSearchBarPlaceholder_lightGray: UIColor {
return .init(r: 140, g: 140, b: 146, a: 100)
}
}
| [
-1
] |
422da652574b9f461553cd1076b47fe1bee18e46 | 74a4ccb52ad067514550708107892ff33bcb7732 | /Network/NetworkClient.swift | 5db12c4a61c1581b39ee0f1230380864fa2ac6e9 | [] | no_license | GKemi/Transaction-List | c753fc9b79b087d5a01e0ff5feb1f59968394036 | eeb7a86441dfe7be3700584693a657eeabe57cd3 | refs/heads/master | 2022-04-13T02:03:17.698915 | 2020-03-16T18:55:39 | 2020-03-16T18:55:39 | 246,579,275 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 727 | swift | //
// NetworkClient.swift
// Transaction List
//
// Created by Gil Hakemi on 12/03/2020.
// Copyright © 2020 Gil Hakemi. All rights reserved.
//
import Foundation
protocol NetworkClient {
func retrieve(from url: URL, completion: @escaping (Data?) -> Void)
}
class RESTNetworkClient: NetworkClient {
func retrieve(from endpoint: URL, completion: @escaping (Data?) -> Void) {
URLSession.shared.dataTask(with: endpoint) { data, _, error in
DispatchQueue.main.async {
if let data = data {
completion(data)
} else {
completion(nil)
}
}
}.resume()
}
}
| [
-1
] |
8b130e25518f77916c0abfd162db1dedf9eb45ae | 02ab6ff09b40073c5a07be8fb69fea3a19a9bd7e | /Wheather App 2/Scenes/Details/DetailsViewController.swift | 5ef2e0d6fa1b0d85ef696515d4d036decb3af9dc | [] | no_license | mansurmuaz/iOS_Weather_App_VIPER | bc2b65868068e812f9b611778491a39447c88d60 | 38d863e7cb4ebdcc591a0e1468da49edeed94a70 | refs/heads/master | 2020-04-29T06:43:15.232726 | 2019-03-16T04:57:03 | 2019-03-16T04:57:03 | 166,657,984 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,809 | swift | //
// DetailsViewController.swift
// Wheather App 2
//
// Created by Mansur Muaz Ekici on 17.07.2018.
// Copyright (c) 2018 Adesso. All rights reserved.
//
// Template generated by Zafer Caliskan
//
import UIKit
class DetailsViewController: BaseViewController {
// MARK: - Outlets
@IBOutlet weak var backgroundImageView: UIImageView!
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var degreeLabel: UILabel!
@IBOutlet weak var unitLabel: UILabel!
@IBOutlet weak var weatherLabel: UILabel!
@IBOutlet weak var descriptionLabel: UILabel!
@IBOutlet weak var windLabel: UILabel!
@IBOutlet weak var humidityLabel: UILabel!
@IBOutlet weak var tableView: UITableView!
// MARK: - Dependencies
var presenter: DetailsPresenterViewProtocol!
// MARK: - Lifecycle
override func viewDidLoad() {
super.viewDidLoad()
presenter.getFiveDaysWeather()
}
// MARK: - Configure
override func configureView() {
super.configureView()
if let currentWeather = presenter.getCurrentWeather() {
self.nameLabel.text = currentWeather.name
self.degreeLabel.text = "\(currentWeather.degree.description)"
self.weatherLabel.text = currentWeather.weather
self.descriptionLabel.text = currentWeather.description.capitalized
self.windLabel.text = "\(currentWeather.wind.description)"
self.humidityLabel.text = "\(currentWeather.humidity.description)"
self.unitLabel.text = currentWeather.unit
self.backgroundImageView.image = currentWeather.image
}
}
// MARK: - Initialization
// MARK: - Actions
}
// MARK: - Extensions
extension DetailsViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return presenter.getWeathersCount()
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
if let weather = presenter.getWeatherAt(index: indexPath.row) {
if let dateString = weather.date?.split(separator: " ").first {
cell.textLabel?.text = presenter.formatDate(dateString: String(dateString))
cell.detailTextLabel?.text = "\(weather.degree.description)\(weather.unit.description)"
}
}
return cell
}
}
// MARK: - Protocol Implemantations
extension DetailsViewController: DetailsViewControllerProtocol {
func reloadTableView() {
tableView.reloadData()
}
}
| [
-1
] |
493b99a8de862fba2f0d6b7fb9aace7b1d96b79a | a020f1f328431f84ba983936449ac06141a822ed | /2-22 下载数据/2-22 下载数据/post通信/StudentListViewController.swift | 98f47a3a4fe19d17513ea3a5f72635b5464964fe | [] | no_license | zhangwei360/swift | 7f054885fc7c89d16fd9d02664076110fbf5af1a | 58154c8a183d3ce80bc6625d06183deb563b792a | refs/heads/master | 2020-04-25T13:59:25.083376 | 2020-02-27T05:19:18 | 2020-02-27T05:19:18 | 172,825,892 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,985 | swift | //
// StudentListViewController.swift
// 2-22 下载数据
//
// Created by JiaLidan on 2019/2/24.
// Copyright © 2019 Zhangwei. All rights reserved.
//
import UIKit
enum PostType {
case GetAll
case GetSingle
}
class StudentListViewController: UIViewController {
@IBOutlet weak var listTableView: UITableView!
var session: URLSession?
var studentList:[SingleStundentDetail] = []
var host = "http://www.kinwork.jp:7775/LearnApi"
var postUrl_getAll = "/getStudentList"
var postUrl_GetSingle = "/viewStudent"
override func viewDidLoad() {
super.viewDidLoad()
session = URLSession(configuration: .default)
listTableView.delegate = self
listTableView.dataSource = self
//进行获得学生一览的通信
let strUrl = host + postUrl_getAll
getData(strUrl: strUrl, type: .GetAll, para: nil)
}
func getData(strUrl: String, type: PostType, para: [String: String]?) {
// let strUrl = host + postUrl_getAll
if let url = URL(string: strUrl) {
var request = URLRequest(url: url)
let list = NSMutableArray()
if para != nil {
//设置通信方式为Post
request.httpMethod = "POST"
//整理Post用的数据
for (key, value) in para! {
let itemStr = "\(key)=\(value)"
list.add(itemStr)
}
let paraStr = list.componentsJoined(by: "&")
let paraData = paraStr.data(using: String.Encoding.utf8)
request.httpBody = paraData
}
let task = session?.dataTask(with: url, completionHandler: { (data, response, error) in
if error != nil {
print(error!.localizedDescription)
return
}
if let downloadData = data {
do {
switch type {
case .GetAll:
self.studentList = try JSONDecoder().decode([SingleStundentDetail].self, from: downloadData)
DispatchQueue.main.async(execute: {
self.listTableView.reloadData()
})
case .GetSingle:
let selectedStudent = try JSONDecoder().decode(SingleStundentDetail.self, from: downloadData)
DispatchQueue.main.async(execute: {
self.performSegue(withIdentifier: "ToDetailSegue", sender: selectedStudent)
})
}
} catch {
print(error.localizedDescription)
}
}
})
task?.resume()
}
}
}
extension StudentListViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return studentList.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "StudentCell", for: indexPath) as! StudentTableViewCell
cell.singleStudent = studentList[indexPath.row]
cell.setupData()
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 84
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if let studentNo = studentList[indexPath.row].s_no {
let paraDict = ["s_no": studentNo]
let strUrl = host + postUrl_GetSingle
getData(strUrl: strUrl, type: .GetSingle, para: paraDict)
}
}
}
| [
-1
] |
bef9729f9a7840b737564caebcb130fec009e7d6 | 1caf4f22bca0b6cce5756cd648ac04ecbcc6960f | /Accolade Connect/Services/DataService.swift | 63d5ba1c7e97fd1c912735b7f0f18b3f395b4da4 | [] | no_license | soverby/Accolade-Connect | 86e8d177cfce0fb3d27f5d74592ffa13f2f0f479 | f2e1ef0f29652d473bc775dbfc4aaec475b23d40 | refs/heads/master | 2021-01-11T00:30:59.600956 | 2016-03-24T00:46:57 | 2016-03-24T00:46:57 | 53,007,825 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,953 | swift | import Foundation
import Firebase
class DataService {
enum DataErrors: ErrorType {
case MissingSessionData(sessionKey: String)
}
let USER_PROFILES = "user_profiles"
let HA_PROFILES = "ha_profiles"
let MESSAGE_CENTER = "message_center"
static let dataService = DataService()
private var _BASE_REF = Firebase(url: "\(BASE_URL)")
private var _USER_REF = Firebase(url: "\(BASE_URL)/users")
private var _HA_QUEUE_REF = Firebase(url: "\(BASE_URL)/ha_queue")
var BASE_REF: Firebase {
return _BASE_REF
}
var USER_REF: Firebase {
return _USER_REF
}
var HA_QUEUE_REF: Firebase {
return _HA_QUEUE_REF
}
var CURRENT_USER_REF: Firebase {
let userID = SessionManager.session[USER_ID] as! String
return Firebase(url: "\(USER_REF)").childByAppendingPath(userID)
}
var USER_PROFILE_REF: Firebase {
let userID = SessionManager.session[USER_ID] as! String
return Firebase(url: "\(BASE_REF)").childByAppendingPath(USER_PROFILES).childByAppendingPath(userID)
}
var HA_PROFILE_REF: Firebase {
let userProfile = SessionManager.session[USER_PROFILE] as! UserProfile
return Firebase(url: "\(BASE_REF)").childByAppendingPath(HA_PROFILES).childByAppendingPath(userProfile.healthAssistantId)
}
var MY_MESSAGE_CENTER: Firebase {
let userID = SessionManager.session[USER_ID] as! String
return Firebase(url: "\(BASE_REF)")
.childByAppendingPath(MESSAGE_CENTER)
.childByAppendingPath(userID)
}
var HA_MESSAGE_CENTER: Firebase {
let userProfile = SessionManager.session[USER_PROFILE] as! UserProfile
let userID = SessionManager.session[USER_ID] as! String
return Firebase(url: "\(BASE_REF)")
.childByAppendingPath(MESSAGE_CENTER)
.childByAppendingPath(userProfile.healthAssistantId)
.childByAppendingPath(userID)
}
var REMOTE_USER_MESSAGE_CENTER: Firebase {
guard let remoteUserId = SessionManager.session[REMOTE_USER_ID] as? String else {
// Can't do this in Swift 2, computed properties can't throw
// throw DataErrors.MissingSessionData(sessionKey: REMOTE_USER_ID)
// And by the way this sucks too...I need an error mananger...
return Firebase(url: "\(BASE_REF)")
.childByAppendingPath(MESSAGE_CENTER)
}
guard let userID = SessionManager.session[USER_ID] as? String else {
// Can't do this in Swift 2, computed properties can't throw
// throw DataErrors.MissingSessionData(sessionKey: USER_ID)
// And by the way this sucks too...I need an error mananger...
return Firebase(url: "\(BASE_REF)")
.childByAppendingPath(MESSAGE_CENTER)
}
return Firebase(url: "\(BASE_REF)")
.childByAppendingPath(MESSAGE_CENTER)
.childByAppendingPath(remoteUserId)
.childByAppendingPath(userID)
}
func writeToRemoteHa(message: ChatMessage) {
DataService.dataService.HA_MESSAGE_CENTER.childByAppendingPath("messages").childByAutoId().setValue(message.asDictionary())
}
func writeToRemoteUser(message: ChatMessage) {
DataService.dataService.REMOTE_USER_MESSAGE_CENTER.childByAppendingPath("messages").childByAutoId().setValue(message.asDictionary())
}
func observeMyMessageCenter(closure: FirebaseObserveEventType) -> FirebaseObserveEventType {
return { snapshot -> Void in
closure(snapshot: snapshot)
}
}
func createNewAccount(uid: String, user: Dictionary<String, String>) {
USER_REF.childByAppendingPath(uid).setValue(user)
}
func downloadImage(urlString: String, completionHandler: ImageDownloadCompletionType) {
let request = NSURLRequest(URL: NSURL(string: urlString)!)
NSURLSession.sharedSession().dataTaskWithRequest(request) { (data, response, error) -> Void in
if error != nil {
print("Failed to load image for url: \(urlString), error: \(error?.description)")
return
}
guard let httpResponse = response as? NSHTTPURLResponse else {
print("Not an NSHTTPURLResponse from loading url: \(urlString)")
return
}
if httpResponse.statusCode != 200 {
print("Bad response statusCode: \(httpResponse.statusCode) while loading url: \(urlString)")
return
}
completionHandler(data: data, response: response, error: error)
}.resume()
}
func processMessages(messageHistory: Dictionary<String, String>, newMessages: Dictionary<String, String>) -> Array<String> {
var processedMessages = newMessages
let oldMessageKeys = Set(messageHistory.keys)
for key in oldMessageKeys {
processedMessages.removeValueForKey(key)
}
return Array(processedMessages.values)
}
func processChatMessages(messageHistory: Dictionary<String, ChatMessage>, newMessages: Dictionary<String, AnyObject>) -> Dictionary<String, ChatMessage> {
var processedMessages = newMessages
let oldMessageKeys = Set(messageHistory.keys)
for key in oldMessageKeys {
processedMessages.removeValueForKey(key)
}
var chatMessages = [String: ChatMessage]()
for (key, value) in processedMessages {
if let chatDictionary = value as? Dictionary<String, AnyObject> {
chatMessages[key] = ChatMessage.init(jsonDictionary: chatDictionary)
}
}
return chatMessages
}
}
| [
-1
] |
3d16657b54ab32d500f583922a45c74ed8f2da41 | 8dd94e6f66f703ca824c36e99b2ca0b848f1319b | /Final Challenge/Data Model/Skill.swift | 962d995b016bd53510d04d651de5f9f76938bc7e | [] | no_license | FlorczakDavid/Final-Challenge | 056c3e4af6a190ef8b5ade1127f1f3ecb8f1024e | 58a61698562c438fffd249b3251d9ab9b2451cc1 | refs/heads/master | 2022-11-15T11:33:45.117091 | 2020-06-23T11:52:31 | 2020-06-23T11:52:31 | 263,053,241 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 295 | swift | //
// Skill.swift
// Final Challenge
//
// Created by Денис Матвеев on 17/05/2020.
// Copyright © 2020 david florczak. All rights reserved.
//
import Foundation
struct Skill: Descriptable, Decodable {
var name: String
var description: String
var ability: String
}
| [
-1
] |
46754f19caa522a35c05daefe750f29b10b33909 | 58a2995dd249b73813a4be2c16c552d7f5620bfe | /logic/resource-manager/Sources/logic/protocols/IntegrationAccountPartnerPropertiesProtocol.swift | 01277a25a1657abb1a6ade9c0e64067c17534d85 | [
"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 | 652 | 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
// IntegrationAccountPartnerPropertiesProtocol is the integration account partner properties.
public protocol IntegrationAccountPartnerPropertiesProtocol : Codable {
var partnerType: PartnerTypeEnum { get set }
var createdTime: Date? { get set }
var changedTime: Date? { get set }
var metadata: [String: String?]? { get set }
var content: PartnerContentProtocol { get set }
}
| [
-1
] |
e8687b8d7262200803907d2a40dd16e70c04e87f | 6ec3f59f9ed1488ea9f7fa95ff5a82f4e1f86805 | /ModelLayer/UserStories/Map/MapPresenter.swift | fda233a91aee7de1fbf39460c86bc6e551361ffb | [] | no_license | armanarutiunov/BikeSharing | b21e25354bac79416cdf91d8a7bd6065bf275e50 | 1542c87765b50b5b09acf87a1945b2210dd3c5b6 | refs/heads/master | 2021-09-10T20:07:46.861346 | 2018-04-01T10:42:07 | 2018-04-01T10:42:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,184 | swift | //
// MapPresenter.swift
// ModelLayer
//
// Created by Arman Arutyunov on 21/03/2018.
// Copyright © 2018 Arman Arutyunov. All rights reserved.
//
import RxSwift
public class MapPresenter<V: MapViewIO>: Presenter<V> {
private let interactor: MapInteractor
private let navigator: MapNavigator
public init(interactor: MapInteractor, navigator: MapNavigator) {
self.interactor = interactor
self.navigator = navigator
}
override func setup() {
}
override func viewAttached() -> Disposable {
guard let viewIO = viewIO else { return Disposables.create() }
return disposable(
interactor.getStations()
.subscribe(
onNext: { stations in
viewIO.showStations(stations)
},
onError: { error in
viewIO.showError(ErrorWithRecovery(error.localizedDescription))
}
),
viewIO.stationTapped.drive(onNext: { [weak self] station in
self?.navigator.toStation(station)
})
)
}
}
| [
-1
] |
79efada1019ff821702ee914dcec0541e7611af2 | 14a0d7c53856c9e86c2aeeeb40bcd09e674cf4d9 | /PSOperationsLocation/LocationOperation.swift | f3cc18a6f958fbd6b17a5ecdb058bc894be98cde | [
"Apache-2.0"
] | permissive | matgar26/PSOperations | 8dc29ca651fe67f0c78a4289277362d87e3c6dbf | 723e02d7bf9a0f8b2d01745e0213a9f7625e0921 | refs/heads/master | 2020-08-04T04:34:18.812162 | 2019-10-01T04:01:12 | 2019-10-01T04:01:12 | 212,007,385 | 0 | 0 | Apache-2.0 | 2019-10-01T03:44:34 | 2019-10-01T03:44:34 | null | UTF-8 | Swift | false | false | 2,680 | swift | /*
Copyright (C) 2015 Apple Inc. All Rights Reserved.
See LICENSE.txt for this sample’s licensing information
Abstract:
Shows how to retrieve the user's location with an operation.
*/
#if !os(OSX)
import CoreLocation
import Foundation
import PSOperations
/**
`LocationOperation` is an `Operation` subclass to do a "one-shot" request to
get the user's current location, with a desired accuracy. This operation will
prompt for `WhenInUse` location authorization, if the app does not already
have it.
*/
open class LocationOperation: PSOperation, CLLocationManagerDelegate {
// MARK: Properties
fileprivate let accuracy: CLLocationAccuracy
fileprivate var manager: CLLocationManager?
fileprivate let handler: (CLLocation) -> Void
// MARK: Initialization
public init(accuracy: CLLocationAccuracy, locationHandler: @escaping (CLLocation) -> Void) {
self.accuracy = accuracy
self.handler = locationHandler
super.init()
#if !os(tvOS)
addCondition(Capability(Location.whenInUse))
#else
addCondition(Capability(Location()))
#endif
addCondition(MutuallyExclusive<CLLocationManager>())
addObserver(BlockObserver(cancelHandler: { [weak self] _ in
DispatchQueue.main.async {
self?.stopLocationUpdates()
}
}))
}
override open func execute() {
DispatchQueue.main.async {
/*
`CLLocationManager` needs to be created on a thread with an active
run loop, so for simplicity we do this on the main queue.
*/
let manager = CLLocationManager()
manager.desiredAccuracy = self.accuracy
manager.delegate = self
if #available(iOS 9.0, *) {
manager.requestLocation()
} else {
#if !os(tvOS) && !os(watchOS)
manager.startUpdatingLocation()
#endif
}
self.manager = manager
}
}
fileprivate func stopLocationUpdates() {
manager?.stopUpdatingLocation()
manager = nil
}
// MARK: CLLocationManagerDelegate
open func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
if let location = locations.last, location.horizontalAccuracy <= accuracy {
stopLocationUpdates()
handler(location)
finish()
}
}
open func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
stopLocationUpdates()
finishWithError(error as NSError?)
}
}
#endif
| [
244504
] |
db8c5ac37bfc6d48597bb5a980f492289c033858 | 5044e4b24b9c9f32f78bb6e819d12a9afd30c482 | /Bruin App Builders/MainPageViewController.swift | 5d1bc9cd13cda9d790eb74150489319b71a8d3d4 | [] | no_license | willgu29/BABiOSApp | d037bd6a9d36d086344f0d89d3e3a12f22668bb5 | aede01b2315d9718804fd690ef5ac14da636d057 | refs/heads/master | 2016-09-06T02:04:43.948764 | 2015-09-13T07:49:46 | 2015-09-13T07:49:46 | 40,382,681 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,268 | swift | //
// MainPageViewController.swift
// Bruin App Builders
//
// Created by Suchit Panjiyar on 8/7/15.
// Copyright (c) 2015 Gu Studios. All rights reserved.
//
import UIKit
class MainPageViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate, APIWrapperDelegate{
var searchActive : Bool = false
var filtered:[String] = []
var tableView: UITableView = UITableView()
var items: [String] = ["Viper", "X", "Games","Viper", "X", "Games","Viper", "X", "Games","Viper", "X", "can be seen","Cant be seen", "X", "Games","Viper", "X", "Games"]
let pageHeader = UILabel(frame: CGRectMake(0, 0, 200, 21))
let searchBar : UISearchBar = UISearchBar()
let wrapper: APIWrapper = APIWrapper.sharedManager() as! APIWrapper;
override func viewDidLoad() {
super.viewDidLoad()
initialize()
getUsers()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if(searchActive) {
return filtered.count
}
return items.count;
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell : UITableViewCell = tableView.dequeueReusableCellWithIdentifier("cell") as! UITableViewCell
if(searchActive){
cell.textLabel?.text = filtered[indexPath.row]
} else {
cell.textLabel?.text = items[indexPath.row]
}
return cell
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
searchBar.resignFirstResponder()
tableView.deselectRowAtIndexPath(indexPath, animated: true)
var vc = PersonInfoViewController(nibName: "PersonInfoViewController", bundle: nil)
//println("You selected cell #\(indexPath.row)! whose value is \(items[indexPath.row])")
if searchBar.text == nil || searchBar.text == ""
{
//use items
vc.namely = items[indexPath.row]
}
else
{
//use filtered
vc.namely = filtered[indexPath.row]
}
presentViewController(vc, animated: true, completion: nil)
}
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
//MARK: Search Bar functions
func searchBarTextDidBeginEditing(searchBar: UISearchBar) { searchActive = true }
func searchBarTextDidEndEditing(searchBar: UISearchBar) {
//searchBar.resignFirstResponder()
searchActive = false
}
func searchBarCancelButtonClicked(searchBar: UISearchBar) {
searchActive = false
searchBar.text = ""
searchBar.resignFirstResponder()
tableView.reloadData()
}
func searchBarSearchButtonClicked(searchBar: UISearchBar) {
searchBar.resignFirstResponder()
searchActive = false
}
func searchBar(searchBar: UISearchBar, textDidChange searchText: String) {
filtered = items.filter({ (text) -> Bool in
let tmp: NSString = text
let range = tmp.rangeOfString(searchText, options: NSStringCompareOptions.CaseInsensitiveSearch)
return range.location != NSNotFound
})
if(searchBar.text == ""){
searchActive = false;
} else {
searchActive = true;
}
self.tableView.reloadData()
}
//Used to remove the keyboard when not in use
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
view.endEditing(true)
super.touchesBegan(touches, withEvent: event)
}
//MARK: Delegate
func userArrayResponse(userArray: [AnyObject]!) {
NSLog("User Array %@: Member count: %d", userArray, userArray.count);
}
func initialize()
{
pageHeader.frame = CGRectMake(0, 8, self.view.frame.width, 50)
pageHeader.backgroundColor = UIColor.clearColor()
pageHeader.text = "People"
pageHeader.textColor = UIColor.blackColor()
pageHeader.textAlignment = NSTextAlignment.Center
self.view.addSubview(pageHeader)
searchBar.frame = CGRectMake(0, 50, self.view.frame.width, 20)
searchBar.delegate = self
searchBar.placeholder = "Search in People"
searchBar.barStyle = UIBarStyle.Default
searchBar.showsCancelButton = true
self.view.addSubview(searchBar)
tableView.frame = CGRectMake(0, 70, self.view.frame.width , self.view.frame.height - self.tabBarController!.tabBar.frame.height - 70);
tableView.delegate = self
tableView.dataSource = self
tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell")
tableView.bounces = false
self.view.addSubview(tableView)
}
func getUsers()
{
wrapper.delegate = self;
wrapper.getUser(nil);
}
} | [
-1
] |
4f8cbbc7b57ec63e60667c63ae2c450ac7881c0a | f999d50e367bfbb6e76f415f1c5390a5080a7052 | /AerialUpdater/Model/Update.swift | d9d4c82914282f68e31abf691102aefcf3c3a2ae | [] | no_license | jdf221/AerialCompanion | 149cdad6811d97f7708c1b1c95fa339cae852756 | 70b398edfcc4b602ca79db92c88c436d27fd7128 | refs/heads/main | 2023-08-08T01:17:34.276838 | 2021-01-11T17:14:24 | 2021-01-11T17:14:24 | 380,149,701 | 0 | 0 | null | 2021-06-25T06:45:58 | 2021-06-25T06:45:58 | null | UTF-8 | Swift | false | false | 12,082 | swift | //
// Update.swift
// AerialUpdater
//
// Created by Guillaume Louel on 25/07/2020.
//
import Cocoa
protocol UpdateCallback {
func updateProgress(string: String, done: Bool)
func updateMenuContent()
func setIcon(mode: IconMode)
}
// Again this is a bit messy...
class Update {
static let instance: Update = Update()
var uiCallback: UpdateCallback?
var shouldReport = false
var commandLine = false
func setCallback(_ cb: UpdateCallback) {
uiCallback = cb
}
func unattendedCheck() {
debugLog("Checking for new version...")
if !LocalVersion.isInstalled() {
return
}
CachedManifest.instance.updateNow()
var shouldUpdate = false
if let manifest = CachedManifest.instance.manifest {
let localVersion = LocalVersion.get()
switch Preferences.desiredVersion {
case .beta:
if localVersion != manifest.betaVersion {
shouldUpdate = true
}
case .release:
if localVersion != manifest.releaseVersion {
shouldUpdate = true
}
}
if shouldUpdate {
debugLog("New version available !")
if Preferences.updateMode == .automatic {
unattendedPerform()
} else {
if let cb = uiCallback {
cb.setIcon(mode: .notification)
}
}
}
}
}
// What should we do, is there a new version available ?
func check() -> (String, Bool) {
if !LocalVersion.isInstalled() {
return ("Plug-in not installed!", true)
}
if let manifest = CachedManifest.instance.manifest {
let localVersion = LocalVersion.get()
debugLog("Versions: local \(localVersion), beta \(manifest.betaVersion), release \(manifest.releaseVersion)")
switch Preferences.desiredVersion {
case .beta:
if localVersion == manifest.betaVersion {
return ("\(localVersion) is installed", false)
} else {
return ("\(manifest.betaVersion) is available", true)
}
case .release:
if localVersion == manifest.releaseVersion {
return ("\(localVersion) is installed", false)
} else {
return ("\(manifest.releaseVersion) is available", true)
}
}
} else {
return ("No network connection", false)
}
}
func unattendedPerform() {
shouldReport = false
doPerform()
}
func perform(_ cb: UpdateCallback) {
uiCallback = cb
shouldReport = true
doPerform()
}
func report(string: String, done: Bool) {
debugLog("report \(done)")
if shouldReport {
if let cb = uiCallback {
cb.updateProgress(string: string, done: done)
}
}
if done {
if let cb = uiCallback {
cb.setIcon(mode: .normal)
cb.updateMenuContent()
}
if commandLine {
// We quit here
DispatchQueue.main.async {
debugLog("Update process done, quitting in 20sec.")
RunLoop.main.run(until: Date() + 0x14)
NSApplication.shared.terminate(self)
}
}
}
}
func doPerform() {
if let cb = uiCallback {
cb.setIcon(mode: .updating)
}
guard let manifest = CachedManifest.instance.manifest else {
errorLog("Trying to perform update with no manifest, please report")
report(string: "Error: No manifest", done: true)
return
}
debugLog("Performing update")
let supportUrl = URL(fileURLWithPath: Helpers.supportPath)
let destinationUrl = supportUrl.appendingPathComponent("Aerial.saver.zip")
let destinationSaverUrl = supportUrl.appendingPathComponent("Aerial.saver")
// Make sure to delete a zip if exists
if FileManager().fileExists(atPath: destinationUrl.path)
{
do {
debugLog("Deleting old file from AppSupport")
try FileManager().removeItem(at: destinationUrl)
} catch {
// ERROR
errorLog("Cannot delete zip in AppSupport")
report(string: "Cannot delete zip in AppSupport", done: true)
return
}
}
if FileManager().fileExists(atPath: destinationSaverUrl.path)
{
do {
debugLog("Deleting old saver file from AppSupport")
try FileManager().removeItem(at: destinationSaverUrl)
} catch {
// ERROR
errorLog("Cannot delete Aerial.saver in AppSupport")
report(string: "Cannot delete Aerial.saver in AppSupport", done: true)
return
}
}
var zipPath: String = ""
switch Preferences.desiredVersion {
case .beta:
zipPath = "https://github.com/JohnCoates/Aerial/releases/download/v\(manifest.betaVersion)/Aerial.saver.zip"
case .release:
zipPath = "https://github.com/JohnCoates/Aerial/releases/download/v\(manifest.releaseVersion)/Aerial.saver.zip"
}
debugLog("Downloading...")
report(string: "Downloading...", done: false)
FileDownloader.loadFileAsync(url: URL(string:zipPath)!) { (path, error) in
if let perror = error {
errorLog("Download error: \(perror.localizedDescription)")
self.report(string: "Error: \(perror.localizedDescription)", done: true)
} else {
self.verifyFile(path: path!, manifest: manifest)
}
}
}
// MARK: - Private helpers
private func verifyFile(path: String, manifest: Manifest) {
debugLog("Verifying...")
report(string: "Verifying...", done: false)
if FileManager.default.fileExists(atPath: path) {
let dlsha = getZipSHA256(path: path)
var tsha: String
switch Preferences.desiredVersion {
case .beta:
tsha = manifest.betaSHA256
case .release:
tsha = manifest.releaseSHA256
}
if tsha == dlsha {
debugLog("Unzipping...")
report(string: "Unzipping...", done: false)
_ = Helpers.shell(launchPath: "/usr/bin/unzip", arguments: ["-d", String(path[...path.lastIndex(of: "/")!]), path])
var saverPath = path
saverPath.removeLast(4)
debugLog("Verifying signature...")
report(string: "Verifying signature...", done: false)
if FileManager.default.fileExists(atPath: saverPath) {
let result = Helpers.shell(launchPath: "/usr/bin/codesign", arguments: ["-v", "-d", saverPath])
if checkCodesign(result) {
if install(saverPath) {
// Pfew...
debugLog("Installed ! Setting up as default")
setAsDefault()
report(string: "OK", done: true)
} else {
errorLog("Cannot copy .saver")
report(string: "Cannot copy .saver", done: true)
}
} else {
errorLog("Codesigning verification failed")
report(string: "Codesigning verification failed", done: true)
}
} else {
errorLog("Aerial.saver not found in zip")
report(string: "Aerial.saver not found in zip", done: true)
}
} else {
errorLog("Downloaded file is corrupted")
report(string: "Downloaded file is corrupted", done: true)
}
} else {
errorLog("Downloaded file not found")
report(string: "Downloaded file not found", done: true)
}
}
private func setAsDefault() {
// defaults -currentHost write com.apple.screensaver moduleDict -dict moduleName Flurry path /System/Library/Screen\ Savers/Flurry.saver/ type 0
_ = Helpers.shell(launchPath: "/usr/bin/defaults", arguments: ["-currentHost","write","com.apple.screensaver","moduleDict","-dict","moduleName","Aerial","path",LocalVersion.aerialPath,"type","0"])
//debugLog(ret ?? "Defaults didn't return error")
}
private func checkCodesign(_ result: String?) -> Bool {
if let presult = result {
let lines = presult.split(separator: "\n")
var bundleVer = false
var devIDVer = false
for line in lines {
if line.starts(with: "Identifier=com.JohnCoates.Aerial") {
bundleVer = true
}
if line.starts(with: "TeamIdentifier=3L54M5L5KK") {
devIDVer = true
}
}
if bundleVer && devIDVer {
return true
} else {
return false
}
} else {
return false
}
}
private func install(_ path: String) -> Bool {
if FileManager.default.fileExists(atPath: LocalVersion.aerialPath) {
debugLog("Removing old version...")
report(string: "Removing old version...", done: false)
if FileManager().fileExists(atPath: LocalVersion.aerialPath)
{
do {
try FileManager().removeItem(at: URL(fileURLWithPath: LocalVersion.aerialPath))
} catch {
// ERROR
errorLog("Cannot delete zip in downloads directory")
report(string: "Cannot delete zip in downloads directory", done: true)
return false
}
}
}
// We may need to create the "Screen Savers" folder in library !
if !FileManager.default.fileExists(atPath: LocalVersion.userLibraryScreenSaverPath) {
debugLog("Creating /Screen Savers/ in user library")
do {
try FileManager.default.createDirectory(
atPath:LocalVersion.userLibraryScreenSaverPath,
withIntermediateDirectories: true,
attributes: nil)
} catch {
errorLog("Cannot create Screen Savers directory in your user library")
report(string: "Cannot create Screen Savers directory in your user library", done: true)
print(error.localizedDescription);
}
}
debugLog("Installing...")
report(string: "Installing...", done: false)
do {
try FileManager.default.moveItem(atPath: path, toPath: LocalVersion.aerialPath)
debugLog("Installed!")
return true
} catch {
return false
}
}
private func getZipSHA256(path: String) -> String {
if FileManager.default.fileExists(atPath: path) {
return String(Helpers.shell(launchPath: "/usr/bin/shasum",arguments: ["-a","256",path])!.split(separator: " ")[0])
}
return ""
}
}
| [
-1
] |
9accf07a1b0e374ee445cc7e119f8f50d1537a0e | b2d26db92eb8acf09e3d86523bfee05c4621586f | /sample-chat-swift/sample-chat-swift/Components/Utils/Extentions/QBChatMessage+Extension.swift | 343ecfa31fc3233a7fede56290ff4e7b440ae218 | [
"BSD-3-Clause"
] | permissive | QuickBlox/quickblox-ios-sdk | b1cce009cda9db9d0a5474171a4a7570e740f1e9 | 06f9e75ebfacb2cfcf1cb75ed54220cd65e8293b | refs/heads/master | 2023-08-09T14:53:51.061877 | 2023-08-07T21:13:19 | 2023-08-07T21:13:19 | 7,095,300 | 409 | 338 | BSD-3-Clause | 2023-09-13T07:55:03 | 2012-12-10T15:08:37 | Objective-C | UTF-8 | Swift | false | false | 7,211 | swift | //
// QBChatMessage+Extension.swift
// sample-chat-swift
//
// Created by Injoit on 29.01.2022.
// Copyright © 2022 quickBlox. All rights reserved.
//
import Foundation
extension QBChatMessage {
func messageText() -> NSAttributedString {
guard let text = self.text else {
return NSAttributedString(string: "@")
}
let currentUserID = Profile().ID
let textColor = self.senderID == currentUserID ? UIColor.white : .black
let font = UIFont(name: "Helvetica", size: 15)
let attributes: [NSAttributedString.Key: Any] = [.foregroundColor: textColor,
.font: font as Any]
if isForwardedMessage,
let forwardedText = forwardedText() {
let textForwarded = NSMutableAttributedString(attributedString: forwardedText)
textForwarded.append(NSAttributedString(string: text, attributes: attributes))
return textForwarded
}
return NSAttributedString(string: text, attributes: attributes)
}
func topLabelText() -> NSAttributedString {
let paragrpahStyle = NSMutableParagraphStyle()
paragrpahStyle.lineBreakMode = .byClipping
let color = #colorLiteral(red: 0.4255777597, green: 0.476770997, blue: 0.5723374486, alpha: 1)
let font = UIFont.systemFont(ofSize: 13.0, weight: .semibold)
let attributes: [NSAttributedString.Key: Any] = [.foregroundColor: color,
.font: font as Any,
.paragraphStyle: paragrpahStyle]
var topLabelString = ""
if self.senderID == Profile().ID {
topLabelString = "You"
} else {
if let fullName = ChatManager.instance.storage.user(withID: self.senderID)?.fullName {
topLabelString = fullName
}
}
return NSAttributedString(string: topLabelString, attributes: attributes)
}
func timeLabelText() -> NSAttributedString {
let textColor = #colorLiteral(red: 0.4255777597, green: 0.476770997, blue: 0.5723374486, alpha: 1)
let paragrpahStyle = NSMutableParagraphStyle()
paragrpahStyle.lineBreakMode = .byWordWrapping
let font = UIFont.systemFont(ofSize: 13.0, weight: .regular)
let attributes: [NSAttributedString.Key: Any] = [.foregroundColor: textColor,
.font: font as Any,
.paragraphStyle: paragrpahStyle]
guard let dateSent = self.dateSent else {
return NSAttributedString(string: "")
}
let text = messageTimeDateFormatter.string(from: dateSent)
return NSAttributedString(string: text, attributes: attributes)
}
func statusImage() -> UIImage {
//check and add users who read the message
let currentUserID = Profile().ID
if let readIDs = self.readIDs?.filter({ $0.uintValue != currentUserID }),
readIDs.isEmpty == false {
return #imageLiteral(resourceName: "delivered").withTintColor(#colorLiteral(red: 0.2216441333, green: 0.4713830948, blue: 0.9869660735, alpha: 1))
}
//check and add users to whom the message was delivered
if let deliveredIDs = self.deliveredIDs?.filter({ $0 != NSNumber(value: currentUserID) }),
deliveredIDs.isEmpty == false {
return #imageLiteral(resourceName: "delivered")
}
return UIImage(named: "sent")!
}
func forwardedText() -> NSAttributedString? {
let currentUserID = Profile().ID
guard let originForwardedName = customParameters[Key.forwardedMessage] as? String else {
return nil
}
var forwardedColor = self.senderID == currentUserID ? UIColor.white : .black
if isAttachmentMessage == true {
forwardedColor = #colorLiteral(red: 0.4091697037, green: 0.4803909063, blue: 0.5925986171, alpha: 1)
}
let fontForwarded = UIFont.systemFont(ofSize: 13, weight: .light)
let fontForwardedName = UIFont.systemFont(ofSize: 13, weight: .semibold)
let attributesForwarded: [NSAttributedString.Key: Any] = [.foregroundColor: forwardedColor,
.font: fontForwarded as Any]
let attributesForwardedName: [NSAttributedString.Key: Any] = [.foregroundColor: forwardedColor,
.font: fontForwardedName as Any]
let textForwarded = NSMutableAttributedString(string: ChatViewControllerConstant.forwardedFrom, attributes: attributesForwarded)
let forwardedName = NSAttributedString(string: originForwardedName + "\n", attributes: attributesForwardedName)
textForwarded.append(forwardedName)
return textForwarded
}
var isViewedBy: Bool {
let currentUserID = Profile().ID
guard let readIDs = self.readIDs?.filter({ $0.uintValue != currentUserID }) else {
return false
}
return readIDs.isEmpty == false
}
var isDeliveredTo: Bool {
let currentUserID = Profile().ID
guard let deliveredIDs = self.deliveredIDs?.filter({ $0.uintValue != currentUserID }) else {
return false
}
return deliveredIDs.isEmpty == false
}
var isAttachmentMessage: Bool {
return attachments?.isEmpty == false
}
var isNotification: Bool {
return customParameters[Key.notificationType] != nil
}
var isForwardedMessage: Bool {
return customParameters[Key.forwardedMessage] != nil
}
var isDateDividerMessage: Bool {
return customParameters[Key.dateDividerKey] != nil
}
var isNotificationMessageTypeCreate: Bool {
if isNotification == false {
return false
}
return customParameters[Key.notificationType] as? String == NotificationType.createGroupDialog.rawValue
}
var isNotificationMessageTypeAdding: Bool {
if isNotification == false {
return false
}
return customParameters[Key.notificationType] as? String == NotificationType.addUsersToGroupDialog.rawValue
}
var isNotificationMessageTypeLeave: Bool {
if isNotification == false {
return false
}
return customParameters[Key.notificationType] as? String == NotificationType.leaveGroupDialog.rawValue
}
func estimateFrame(_ constraintsSize: CGSize) -> CGSize {
let font = UIFont(name: "Helvetica", size: 15)
let attributes: [NSAttributedString.Key: Any] = [.font: font as Any]
let options = NSStringDrawingOptions.usesFontLeading.union(.usesLineFragmentOrigin)
let boundingRect = messageText().string.boundingRect(with: constraintsSize, options: options, attributes:attributes, context: nil)
let size = CGSize(width: boundingRect.width, height: boundingRect.height)
return size
}
}
| [
-1
] |
ddbcdeaed8568d387350c15773f0a6dbe6e8d469 | e9d062f61280db7551aefd1ef3e5a94d96d77519 | /16. ARC.playground/section-41.swift | 05bb6cc9b24ec7edc13f9e3d387dc295a86997a6 | [] | no_license | arpesenti/learn-swift | 9fd1c7920611e3c694eb4faf57e9f43a9f3f0682 | 61906785c261851b908d5e7dbcbd1742eac94242 | refs/heads/master | 2020-04-05T23:37:43.300692 | 2014-09-06T12:29:49 | 2014-09-06T12:29:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 94 | swift | var paragraph: HTMLElement? = HTMLElement(name: "p", text: "Hello, world")
paragraph!.asHTML() | [
-1
] |
4d890e96a0671329cf51d48234685d96d5dfc76d | 606bc0ce3d98d8ceaa1ee65358d79b786e1cf73e | /ItunesSearchTests/Classes/Modules/CountOfMedia/Configurator/CountOfMediaInitializer.swift | 0cd05d7a549df4adccf7d48dad7a277f25c89ad0 | [] | no_license | timbaev/iTunesSearchSwift | 20387b2352250ff28e4231550529f010ceb6f91f | e4762c236f040d605cd3d9aa318e0630a69a7f23 | refs/heads/master | 2020-03-08T16:27:17.124633 | 2018-04-12T23:34:13 | 2018-04-12T23:34:13 | 128,239,924 | 0 | 0 | null | 2018-04-12T23:34:14 | 2018-04-05T17:21:03 | Swift | UTF-8 | Swift | false | false | 474 | swift | //
// CountOfMediaInitializer.swift
// ItunesSearchTests
//
// Created by Тимур Шафигуллин on 07.04.2018.
// Copyright © 2018 iOSLab. All rights reserved.
//
import Foundation
class CountOfMediaInitializer: NSObject {
@IBOutlet weak var viewController: CountOfMediaViewController!
override func awakeFromNib() {
let configurator = CountOfMediaConfigurator()
configurator.setupModule(with: viewController)
}
}
| [
-1
] |
22d42f55427859234c0a8bd16afefb4a1d713385 | aec56d69ecce569998644cec807d5e9e570f47dc | /TBTitleView/Other/LoadNibProtocl.swift | 29277414923bb0832d3d24eee710e11dbe40fac1 | [] | no_license | tanbiao/TBPageContentView | 1a5910b85a1f262f96b68e7a3016328de6e805fc | ba51ccea604e3434cbeba408239503f75a5127ca | refs/heads/master | 2021-01-20T10:06:55.951370 | 2017-06-18T07:39:27 | 2017-06-18T07:39:27 | 90,325,386 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 576 | swift | //
// LoadNibProtorl.swift
// Swift面向协议开发
//
// Created by 西乡流水 on 17/4/18.
// Copyright © 2017年 西乡流水. All rights reserved.
//
import UIKit
protocol LoadNibProtocl
{
}
/*在协议和结构体里面实现类方法有static ,self 用Self*/
/*表示遵守这个协议的必须是UIVIew*/
extension LoadNibProtocl where Self:UIView
{
static func loadFromNib(_ nibname :String? = nil) -> Self
{
let nib = nibname ?? "\(self)"
return Bundle.main.loadNibNamed(nib, owner: nil, options: nil)?.last as! Self
}
}
| [
293330
] |
492122ef73da34c2f2c6a05fb14992234059647d | 5fa86ccdbdc777a4fc79b4a5bcdb8c88e5dd08e2 | /Example/Tests/Tests.swift | 895ecf70e7303c50c72a33fc07b2aa8469d0c552 | [
"MIT"
] | permissive | cHaLkdusT/Fixer-iOS | 5d31a3b9a77321898823a8f11c42a07d68ecd9be | 3e1b27c5f4a124ddcaf6bea5205d235858485201 | refs/heads/master | 2020-04-17T08:40:28.585851 | 2019-01-18T14:58:09 | 2019-01-18T14:58:09 | 166,421,073 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,155 | swift | // https://github.com/Quick/Quick
import Quick
import Nimble
import Fixer
class TableOfContentsSpec: QuickSpec {
override func spec() {
describe("these will fail") {
it("can do maths") {
expect(1) == 2
}
it("can read") {
expect("number") == "string"
}
it("will eventually fail") {
expect("time").toEventually( equal("done") )
}
context("these will pass") {
it("can do maths") {
expect(23) == 23
}
it("can read") {
expect("🐮") == "🐮"
}
it("will eventually pass") {
var time = "passing"
DispatchQueue.main.async {
time = "done"
}
waitUntil { done in
Thread.sleep(forTimeInterval: 0.5)
expect(time) == "done"
done()
}
}
}
}
}
}
| [
205989,
281927,
265480,
107211,
337337,
300090
] |
fcbb43a6e7574ef9ec3109793bf7c0a90c382cae | 4d271218512f83dfc03c60429ef1608a9379366f | /Example/Peloton-UIColors/AppDelegate.swift | 49fbdb49c05f044f1637afa9b3ef0d15cf9d6fd9 | [
"MIT"
] | permissive | carabina/Peloton-UIColors | 533dda438528501c4156830bbed691010b8cf9f1 | baf07c0d24019d149bb6ec5cf3baacd0c331bdaa | refs/heads/master | 2021-01-15T12:08:57.509441 | 2016-07-21T15:31:42 | 2016-07-21T15:31:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 759 | swift | //
// AppDelegate.swift
// Peloton-UIColors
//
// Created by Ryan Fitzgerald on 07/20/2016.
// Copyright (c) 2016 Ryan Fitzgerald. 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 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.
}
}
| [
293666,
161027,
243779,
330244,
298598,
245288,
330764,
189325,
182926,
163920,
182929,
334488,
333178,
370365
] |
f4e16b98d65c2f013e8ca91c09fea699cf39d6fd | 1d6afe8bb9667175febf2542d452f95d5f3ee024 | /STSwift/Classes/MyPlayground.playground/section-1.swift | c0e42b0a2ba2ae2a8487dd1dc3b3ed858cfae15f | [] | no_license | easonwzs/STSwift | 9b675c5ec63ea6598923d0b596a323e5d265f482 | 37b1697c6f35ae368eae48615a7578c85bd07bfa | refs/heads/master | 2016-09-10T20:16:56.226116 | 2015-11-20T05:15:23 | 2015-11-20T05:15:23 | 20,646,105 | 24 | 13 | null | null | null | null | UTF-8 | Swift | false | false | 245 | swift | // Playground - noun: a place where people can play
import Cocoa
import Foundation
var str = "my first demo "
let num = 10
str = " eason "
var strNum = str + String(num)
////////////// ? !
var str1 : String! = ""
var str2 = str1
| [
-1
] |
0573eb930201bdd98c0f76aeeec6e35fcdc57b5f | eb7f215013751b8ef39342ccf2bd395dbe5112d3 | /Concurrency-Lab/AppDelegate.swift | 3c8057c508585b2595a67567e2518f172c84c240 | [] | no_license | yudinal/Concurrency-Lab | 721e4999db85731c05ab6795e5f7018653e485fe | 054a50a5a3872abf5a09c55a636461884edd80e3 | refs/heads/master | 2020-09-30T08:56:58.067798 | 2020-01-23T20:08:53 | 2020-01-23T20:08:53 | 227,255,205 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,425 | swift | //
// AppDelegate.swift
// Concurrency-Lab
//
// Created by Lilia Yudina on 12/10/19.
// Copyright © 2019 Lilia Yudina. 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,
385081,
376889,
393275,
376905,
327756,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
286831,
368752,
286844,
262283,
286879,
286888,
377012,
327871,
180416,
377036,
180431,
377046,
377060,
327914,
205036,
393456,
393460,
336123,
418043,
336128,
385280,
262404,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
262472,
344403,
213332,
65880,
262496,
418144,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
328206,
410128,
393747,
254490,
188958,
385570,
33316,
197159,
377383,
352821,
188987,
418363,
369223,
385609,
385616,
352856,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
164538,
328378,
328386,
352968,
344776,
418507,
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,
197468,
254812,
361309,
361315,
361322,
328573,
377729,
369542,
361360,
222128,
345035,
345043,
386003,
386011,
386018,
386022,
435187,
328702,
328714,
361489,
386069,
336921,
386073,
336925,
345118,
377887,
328746,
345133,
345138,
386101,
361536,
197707,
189520,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
386258,
328924,
66782,
222437,
328941,
386285,
386291,
345376,
353570,
345379,
410917,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181654,
230809,
181670,
181673,
181678,
337329,
181681,
181684,
181690,
361917,
181696,
337349,
181703,
337365,
271839,
329191,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
419362,
394786,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
214610,
419410,
345701,
394853,
222830,
370297,
403070,
403075,
345736,
198280,
345749,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
337592,
419512,
419517,
337599,
419527,
419530,
419535,
272081,
394966,
419542,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
141051,
337659,
337668,
362247,
395021,
362255,
321299,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
345930,
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,
329832,
329855,
329885,
411805,
346272,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
321786,
379134,
411903,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
338211,
395566,
248111,
362822,
436555,
190796,
321879,
379233,
354673,
321910,
248186,
420236,
379278,
354727,
338352,
330189,
338381,
338386,
338403,
338409,
248308,
199164,
330252,
199186,
420376,
330267,
354855,
10828,
199249,
346721,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
338660,
338664,
264941,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
330642,
355218,
412599,
207808,
379848,
396245,
330710,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
396328,
158761,
396336,
199728,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
339036,
412764,
257120,
265320,
248951,
420984,
330889,
347287,
248985,
339097,
44197,
380070,
339112,
249014,
330958,
330965,
265432,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
372015,
347441,
372018,
199988,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
249214,
175486,
175489,
249218,
249224,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
388542,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
249308,
339420,
249312,
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,
339588,
126596,
421508,
224904,
224909,
159374,
11918,
339601,
126610,
224913,
224916,
224919,
126616,
208538,
224922,
224926,
224929,
224932,
224936,
257704,
224942,
257712,
224947,
257716,
257720,
224953,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
224993,
257761,
257764,
224999,
339695,
225012,
257787,
225020,
339710,
257790,
225025,
257794,
339721,
257801,
257804,
225038,
257807,
372499,
167700,
225043,
225048,
257819,
225053,
184094,
225058,
339747,
339749,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
257871,
225103,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
339814,
225127,
257896,
274280,
257901,
225137,
339826,
257908,
225141,
257912,
225148,
257916,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
405533,
430129,
266294,
217157,
421960,
356439,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
266453,
225493,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
397571,
389380,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
348502,
250199,
250202,
332125,
250210,
348522,
348525,
348527,
332152,
250238,
389502,
332161,
356740,
332172,
373145,
340379,
389550,
324030,
266687,
340451,
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,
373343,
381545,
340627,
184982,
373398,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
332493,
357069,
357073,
332511,
332520,
340718,
332533,
348924,
373510,
389926,
152370,
348978,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
357211,
430939,
357214,
201579,
201582,
349040,
340849,
201588,
430965,
381813,
324472,
398201,
119674,
324475,
430972,
340861,
324478,
340858,
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,
381946,
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,
341113,
210044,
349308,
152703,
160895,
349311,
210052,
210055,
349319,
210067,
210071,
210077,
210080,
210084,
251044,
185511,
210088,
210095,
210098,
210107,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
251128,
218360,
275706,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
210260,
259421,
365921,
333154,
251235,
374117,
333162,
234866,
390516,
333175,
357755,
251271,
136590,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
415207,
366056,
366061,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
333399,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
333498,
333511,
210631,
358099,
153302,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
210695,
268041,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
366387,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
259938,
399206,
358255,
399215,
268143,
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,
350410,
260298,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
325891,
350467,
350475,
194828,
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,
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,
326416,
375568,
375571,
375574,
162591,
326441,
326451,
326454,
244540,
326460,
375612,
260924,
326467,
244551,
326473,
326477,
326485,
416597,
326490,
342874,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
326598,
359366,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
261147,
359451,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
367723,
384107,
187502,
384114,
343154,
212094,
351364,
384135,
384139,
384143,
351381,
384151,
384160,
384168,
367794,
244916,
384181,
367800,
384188,
351423,
384191,
326855,
244937,
384201,
253130,
343244,
384208,
146642,
384224,
359649,
343270,
351466,
384246,
351479,
343306,
261389,
359694,
384275,
384283,
245020,
384288,
245029,
171302,
351534,
376110,
245040,
425276,
212291,
384323,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
154999,
253303,
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,
253943,
245460,
155351,
155354,
212699,
245475,
155363,
245483,
155371,
409335,
155393,
155403,
245525,
155422,
360223,
155438,
155442,
155447,
155461,
360261,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
262005,
147317,
425845,
262008,
262011,
155516,
155521,
155525,
360326,
376714,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
393169,
384977,
155611,
155619,
253923,
155621,
327654,
253926,
204784,
393203,
360438,
393206,
393212,
155646
] |
a557777a887c3ae09dba7f2bf706746626e34e3b | 88ad2c91f73c0dcec68e87ed13d6a9a93543606c | /SpriteUI/GameScene.swift | 23e7cdf848a0afefb525ad9fe6d25e037d0dded8 | [] | no_license | phcacique/SpriteUI | 4409b36c7bff849433dd2dc2905e7fa3e9a402e9 | 0df32149a9a962f044afa84c8298d55fcb9a6681 | refs/heads/master | 2021-07-02T02:07:00.992742 | 2017-09-23T00:16:29 | 2017-09-23T00:16:29 | 104,343,292 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,775 | swift | //
// GameScene.swift
// SpriteUI
//
// Created by Pedro Cacique on 21/09/17.
// Copyright © 2017 Pedro Cacique. All rights reserved.
//
import SpriteKit
import GameplayKit
class GameScene: SKScene {
var style:SUIStyle?
override func didMove(to view: SKView) {
style = SUIStyle(handler:start)
}
func start(){
let mainRef:SUIComponent = SUIComponent(id: "root", style: style!)
mainRef.scale(to: self.size)
let bar:SUIContainer = SUIContainer(id: "topbar", style:style!, hAlign: .center, vAlign: .center)
bar.addScaleConstraint(id: "S0", reference: mainRef, xScale: 1, yScale: 0.1, proportional: .none)
bar.addPositionConstraint(id: "P0", reference: mainRef, margin: .top, offset: 0, inset: true)
let button1:SUIComponent = SUIComponent(id: "b1", style: style!)
bar.addComponent(button1)
let button2:SUIComponent = SUIComponent(id: "b2", style: style!)
bar.addComponent(button2)
let button3:SUIComponent = SUIComponent(id: "b3", style: style!)
bar.addComponent(button3)
addChild(button1)
addChild(button2)
addChild(button3)
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
}
override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
}
override func update(_ currentTime: TimeInterval) {
// Called before each frame is rendered
}
}
| [
-1
] |
123db7cc9ecd7b38d67d0e6ff9e728170dc21d96 | 87c1fd3118bd840d32a4d8c9fae8f8feb2269f4e | /ECGame/Components/DemoBaseViewController.swift | 3353a7e7e42baf3c292e73cd0febc2ee6d54c1ad | [
"MIT"
] | permissive | VipinTNK/ECGameSecure | 193ae0c285eaf04ecc0d9de6a97d8678448510ad | 4c443ec277e0feac3ee78b309f5d4e0c91344e3b | refs/heads/master | 2022-04-16T08:28:12.810942 | 2020-03-30T01:58:04 | 2020-03-30T01:58:04 | 238,874,430 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 13,461 | swift | //
// DemoBaseViewController.swift
// ChartsDemo-iOS
//
// Created by Jacob Christie on 2017-07-03.
// Copyright © 2017 jc. All rights reserved.
//
#if canImport(UIKit)
import UIKit
#endif
import Charts
enum Option {
case toggleValues
case toggleIcons
case toggleHighlight
case animateX
case animateY
case animateXY
case saveToGallery
case togglePinchZoom
case toggleAutoScaleMinMax
case toggleData
case toggleBarBorders
// CandleChart
case toggleShadowColorSameAsCandle
case toggleShowCandleBar
// CombinedChart
case toggleLineValues
case toggleBarValues
case removeDataSet
// CubicLineSampleFillFormatter
case toggleFilled
case toggleCircles
case toggleCubic
case toggleHorizontalCubic
case toggleStepped
// HalfPieChartController
case toggleXValues
case togglePercent
case toggleHole
case spin
case drawCenter
// RadarChart
case toggleXLabels
case toggleYLabels
case toggleRotate
case toggleHighlightCircle
var label: String {
switch self {
case .toggleValues: return "Toggle Y-Values"
case .toggleIcons: return "Toggle Icons"
case .toggleHighlight: return "Toggle Highlight"
case .animateX: return "Animate X"
case .animateY: return "Animate Y"
case .animateXY: return "Animate XY"
case .saveToGallery: return "Save to Camera Roll"
case .togglePinchZoom: return "Toggle PinchZoom"
case .toggleAutoScaleMinMax: return "Toggle auto scale min/max"
case .toggleData: return "Toggle Data"
case .toggleBarBorders: return "Toggle Bar Borders"
// CandleChart
case .toggleShadowColorSameAsCandle: return "Toggle shadow same color"
case .toggleShowCandleBar: return "Toggle show candle bar"
// CombinedChart
case .toggleLineValues: return "Toggle Line Values"
case .toggleBarValues: return "Toggle Bar Values"
case .removeDataSet: return "Remove Random Set"
// CubicLineSampleFillFormatter
case .toggleFilled: return "Toggle Filled"
case .toggleCircles: return "Toggle Circles"
case .toggleCubic: return "Toggle Cubic"
case .toggleHorizontalCubic: return "Toggle Horizontal Cubic"
case .toggleStepped: return "Toggle Stepped"
// HalfPieChartController
case .toggleXValues: return "Toggle X-Values"
case .togglePercent: return "Toggle Percent"
case .toggleHole: return "Toggle Hole"
case .spin: return "Spin"
case .drawCenter: return "Draw CenterText"
// RadarChart
case .toggleXLabels: return "Toggle X-Labels"
case .toggleYLabels: return "Toggle Y-Labels"
case .toggleRotate: return "Toggle Rotate"
case .toggleHighlightCircle: return "Toggle highlight circle"
}
}
}
class DemoBaseViewController: UIViewController, ChartViewDelegate {
private var optionsTableView: UITableView? = nil
let parties = ["Party A", "Party B", "Party C", "Party D", "Party E", "Party F",
"Party G", "Party H", "Party I", "Party J", "Party K", "Party L",
"Party M", "Party N", "Party O", "Party P", "Party Q", "Party R",
"Party S", "Party T", "Party U", "Party V", "Party W", "Party X",
"Party Y", "Party Z"]
@IBOutlet weak var optionsButton: UIButton!
var options: [Option]!
var shouldHideData: Bool = false
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initialize()
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initialize()
}
private func initialize() {
self.edgesForExtendedLayout = []
}
func optionTapped(_ option: Option) {}
func handleOption(_ option: Option, forChartView chartView: ChartViewBase) {
switch option {
case .toggleValues:
for set in chartView.data!.dataSets {
set.drawValuesEnabled = !set.drawValuesEnabled
}
chartView.setNeedsDisplay()
case .toggleIcons:
for set in chartView.data!.dataSets {
set.drawIconsEnabled = !set.drawIconsEnabled
}
chartView.setNeedsDisplay()
case .toggleHighlight:
chartView.data!.highlightEnabled = !chartView.data!.isHighlightEnabled
chartView.setNeedsDisplay()
case .animateX:
chartView.animate(xAxisDuration: 3)
case .animateY:
chartView.animate(yAxisDuration: 3)
case .animateXY:
chartView.animate(xAxisDuration: 3, yAxisDuration: 3)
case .saveToGallery:
UIImageWriteToSavedPhotosAlbum(chartView.getChartImage(transparent: false)!, nil, nil, nil)
case .togglePinchZoom:
let barLineChart = chartView as! BarLineChartViewBase
barLineChart.pinchZoomEnabled = !barLineChart.pinchZoomEnabled
chartView.setNeedsDisplay()
case .toggleAutoScaleMinMax:
let barLineChart = chartView as! BarLineChartViewBase
barLineChart.autoScaleMinMaxEnabled = !barLineChart.isAutoScaleMinMaxEnabled
chartView.notifyDataSetChanged()
case .toggleData:
shouldHideData = !shouldHideData
updateChartData()
case .toggleBarBorders:
for set in chartView.data!.dataSets {
if let set = set as? BarChartDataSet {
set.barBorderWidth = set.barBorderWidth == 1.0 ? 0.0 : 1.0
}
}
chartView.setNeedsDisplay()
default:
break
}
}
@IBAction func optionsButtonTapped(_ sender: Any) {
if let optionsTableView = self.optionsTableView {
optionsTableView.removeFromSuperview()
self.optionsTableView = nil
return
}
let optionsTableView = UITableView()
optionsTableView.backgroundColor = UIColor(white: 0, alpha: 0.9)
optionsTableView.delegate = self
optionsTableView.dataSource = self
optionsTableView.translatesAutoresizingMaskIntoConstraints = false
self.optionsTableView = optionsTableView
var constraints = [NSLayoutConstraint]()
constraints.append(NSLayoutConstraint(item: optionsTableView,
attribute: .leading,
relatedBy: .equal,
toItem: self.view,
attribute: .leading,
multiplier: 1,
constant: 40))
constraints.append(NSLayoutConstraint(item: optionsTableView,
attribute: .trailing,
relatedBy: .equal,
toItem: sender as! UIView,
attribute: .trailing,
multiplier: 1,
constant: 0))
constraints.append(NSLayoutConstraint(item: optionsTableView,
attribute: .top,
relatedBy: .equal,
toItem: sender,
attribute: .bottom,
multiplier: 1,
constant: 5))
self.view.addSubview(optionsTableView)
constraints.forEach { $0.isActive = true }
let constraint = NSLayoutConstraint(item: optionsTableView,
attribute: .height,
relatedBy: .equal,
toItem: nil,
attribute: .height,
multiplier: 1,
constant: 220)
constraint.isActive = true
}
func updateChartData() {
fatalError("updateChartData not overridden")
}
func setup(pieChartView chartView: PieChartView) {
chartView.usePercentValuesEnabled = true
chartView.drawSlicesUnderHoleEnabled = false
chartView.holeRadiusPercent = 0.58
chartView.transparentCircleRadiusPercent = 0.61
chartView.chartDescription?.enabled = false
chartView.setExtraOffsets(left: 5, top: 10, right: 5, bottom: 5)
chartView.drawCenterTextEnabled = true
let paragraphStyle = NSParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle
paragraphStyle.lineBreakMode = .byTruncatingTail
paragraphStyle.alignment = .center
let centerText = NSMutableAttributedString(string: "Charts\nby Daniel Cohen Gindi")
centerText.setAttributes([.font : UIFont(name: "HelveticaNeue-Light", size: 13)!,
.paragraphStyle : paragraphStyle], range: NSRange(location: 0, length: centerText.length))
centerText.addAttributes([.font : UIFont(name: "HelveticaNeue-Light", size: 11)!,
.foregroundColor : UIColor.gray], range: NSRange(location: 10, length: centerText.length - 10))
centerText.addAttributes([.font : UIFont(name: "HelveticaNeue-Light", size: 11)!,
.foregroundColor : UIColor(red: 51/255, green: 181/255, blue: 229/255, alpha: 1)], range: NSRange(location: centerText.length - 19, length: 19))
chartView.centerAttributedText = centerText;
chartView.drawHoleEnabled = true
chartView.rotationAngle = 0
chartView.rotationEnabled = true
chartView.highlightPerTapEnabled = true
let l = chartView.legend
l.horizontalAlignment = .right
l.verticalAlignment = .top
l.orientation = .vertical
l.drawInside = false
l.xEntrySpace = 7
l.yEntrySpace = 0
l.yOffset = 0
// chartView.legend = l
}
func setup(radarChartView chartView: RadarChartView) {
chartView.chartDescription?.enabled = false
}
func setup(barLineChartView chartView: BarLineChartViewBase) {
chartView.chartDescription?.enabled = false
chartView.dragEnabled = true
chartView.setScaleEnabled(true)
chartView.pinchZoomEnabled = false
// ChartYAxis *leftAxis = chartView.leftAxis;
let xAxis = chartView.xAxis
xAxis.labelPosition = .bottom
chartView.rightAxis.enabled = false
}
// TODO: Cannot override from extensions
//extension DemoBaseViewController: ChartViewDelegate {
func chartValueSelected(_ chartView: ChartViewBase, entry: ChartDataEntry, highlight: Highlight) {
}
func chartValueNothingSelected(_ chartView: ChartViewBase) {
}
func chartScaled(_ chartView: ChartViewBase, scaleX: CGFloat, scaleY: CGFloat) {
}
func chartTranslated(_ chartView: ChartViewBase, dX: CGFloat, dY: CGFloat) {
}
}
extension DemoBaseViewController: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
if optionsTableView != nil {
return 1
}
return 0
}
@available(iOS 2.0, *)
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if optionsTableView != nil {
return options.count
}
return 0
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if optionsTableView != nil {
return 40.0;
}
return 44.0;
}
@available(iOS 2.0, *)
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCell(withIdentifier: "Cell")
if cell == nil {
cell = UITableViewCell(style: .default, reuseIdentifier: "Cell")
cell?.backgroundView = nil
cell?.backgroundColor = .clear
cell?.textLabel?.textColor = .white
}
cell?.textLabel?.text = self.options[indexPath.row].label
return cell!
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if optionsTableView != nil {
tableView.deselectRow(at: indexPath, animated: true)
optionsTableView?.removeFromSuperview()
self.optionsTableView = nil
self.optionTapped(self.options[indexPath.row])
}
}
}
| [
237471
] |
cb9ac45d11d498042b7687d83da0defc34ee71fb | 67ca193cf52b981e22c1b404c914f61d8135ebce | /printinator/OAuthCredentials.swift | c013450430203afd434248cb682a43656031da96 | [] | no_license | sambarrowclough/printinator | 4c06effeee8c6ae2019df28c2000476f050bfb4c | 53e13cab41b4e3d5c97c46aff887630d9bf6d17c | refs/heads/main | 2023-03-23T03:03:35.205069 | 2021-03-14T19:10:57 | 2021-03-14T19:10:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 826 | swift | //
// OAuthCredentials.swift
// printinator
//
// Created by Jessie Frazelle on 2/24/21.
//
import Foundation
struct OAuthCredentials {
let formlabsClientID, formlabsClientSecret: String
}
// Read our oauth credentials from the plist.
func getOAuthCredentials() -> OAuthCredentials? {
guard let path = Bundle.main.path(forResource: "OAuthCredentials", ofType: "plist") else {return nil}
let url = URL(fileURLWithPath: path)
let data = try! Data(contentsOf: url)
guard let plist = try! PropertyListSerialization.propertyList(from: data, options: .mutableContainers, format: nil) as? [String:String] else {return nil}
return OAuthCredentials(
formlabsClientID: plist["env.FORMLABS_CLIENT_ID"] ?? "",
formlabsClientSecret: plist["env.FORMLABS_CLIENT_SECRET"] ?? ""
)
}
| [
-1
] |
21de0ea98529a60d581ccb69c61c7881f73ba359 | b322069d43543b6690e57d63ce4e72d34d5de97f | /FirstCitizen/FirstCitizen/Splash/SplashViewController.swift | 3ef06c4bef5e5ec99ee9039bca1c9a4e2720576d | [
"MIT"
] | permissive | hyeoktae/2019SeoulContest | c0d7debf7ba38352bc98b4d912c5818c7a354c91 | 8a2921dd3c925472ed3eb75f1d23aa1d56bccdad | refs/heads/dev | 2020-07-27T03:34:40.845278 | 2019-10-04T05:31:28 | 2019-10-04T05:31:28 | 203,622,367 | 1 | 0 | MIT | 2019-09-16T16:58:55 | 2019-08-21T16:22:00 | Objective-C | UTF-8 | Swift | false | false | 3,918 | swift | //
// SplashViewController.swift
// FirstCitizen
//
// Created by Fury on 25/09/2019.
// Copyright © 2019 Kira. All rights reserved.
//
import UIKit
import MapKit
class SplashViewController: UIViewController {
private let categoryShared = CategoryDataManager.shared
private let incidentShared = IncidentDataManager.shared
private var currentCoordinateValue: CLLocationCoordinate2D?
let locationManager = CLLocationManager()
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
locationManager.delegate = self
getUserInfo()
getLocationPermission()
}
private func getUserInfo() {
guard let _ = UserDefaults.standard.string(forKey: "Token") else { return }
NetworkService.getUserInfo { result in
switch result {
case .success(let data):
let shared = UserInfoManager.shared
shared.userInfo = data
case .failure(let err):
print(err.localizedDescription)
}
}
}
private func getCategoryList() {
NetworkService.getCategoryList { [weak self] result in
switch result {
case .success(let data):
self?.categoryShared.categoryData = data
self?.getIncidentDatas()
case .failure(let err):
print(err.localizedDescription)
}
}
}
private func getIncidentDatas() {
guard let latitude = currentCoordinateValue?.latitude,
let longitude = currentCoordinateValue?.longitude else {
return }
NetworkService.getHomeIncidentData(latitude: latitude, longitude: longitude) { result in
switch result {
case .success(let data):
self.incidentShared.incidentDatas = data
let mainTabBarVC = MainTabBarController()
mainTabBarVC.modalPresentationStyle = .fullScreen
DispatchQueue.main.async {
self.present(mainTabBarVC, animated: false, completion: nil)
}
case .failure(let err):
// MARK: - 우선 실행은 가능하도록 함!!!
let mainTabBarVC = MainTabBarController()
mainTabBarVC.modalPresentationStyle = .fullScreen
DispatchQueue.main.async {
self.present(mainTabBarVC, animated: false, completion: nil)
}
print(err.localizedDescription)
}
}
}
private func getLocationPermission() {
// 권한 요청
locationManager.requestWhenInUseAuthorization()
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.startUpdatingLocation()
}
}
extension SplashViewController: CLLocationManagerDelegate {
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
if let coor = manager.location?.coordinate {
currentCoordinateValue = coor
}
}
func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
print("location manager authorization status changed")
switch status {
case .authorizedWhenInUse:
print("user allow app to get location data when app is active or in background")
getCategoryList()
break
case .authorizedAlways:
print("user allow app to get location data only when app is active")
UIAlertController.killApp(from: self)
break
case .denied:
print("user tap 'disallow' on the permission dialog, cant get location data")
UIAlertController.killApp(from: self)
break
case .restricted:
print("parental control setting disallow location data")
UIAlertController.killApp(from: self)
break
case .notDetermined:
print("the location permission dialog haven't shown before, user haven't tap allow/disallow")
UIAlertController.killApp(from: self)
break
@unknown default:
fatalError()
break
}
}
}
| [
-1
] |
b86a3d710d79b1b5c8c7ba97a0d5bd76c1ffa28f | 50bd1e9c9e0dcf0f397f7966f98bcc3d9327ff97 | /UNote/FirstViewController.swift | fee73a62ec9c156fcb47c4ae3bcdbbe146aa32d8 | [] | no_license | aranchafoz/UNote | a9876618f2eed5de0c9e9ce8f6d5015601c06a03 | e570b8c1f2035732027ec242e5aedd224e22b0f3 | refs/heads/master | 2021-01-11T03:10:14.232225 | 2016-11-22T03:04:41 | 2016-11-22T03:04:41 | 71,105,561 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 502 | swift | //
// FirstViewController.swift
// UNote
//
// Created by eda on 17/10/2016.
// Copyright © 2016 EE4304. All rights reserved.
//
import UIKit
class FirstViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
279041,
279046,
281107,
300057,
235044,
296489,
281142,
300089,
238653,
286786,
129604,
228932,
228945,
203858,
280146,
212573,
309347,
309349,
309351,
309353,
286314,
296042,
277612,
311913,
164974,
284275,
277108,
284277,
284279,
292478,
284289,
284298,
278675,
349332,
284315,
284317,
282275,
284323,
313007,
284336,
276150,
280760,
296638,
277696,
280770,
280772,
280775,
284361,
230604,
298189,
302286,
230608,
317137,
290004,
284373,
290006,
189655,
302295,
298202,
278749,
280797,
298206,
363743,
290020,
301284,
277224,
280808,
280810,
199402,
289524,
120054,
226038,
280826,
276736,
280832,
312586,
278298,
329499,
287004,
281373,
277796,
281380,
233767,
283433,
278845,
279360,
296272,
289112,
188253,
292701,
311645,
289121,
227688,
216433,
277364,
207738,
290175,
183173,
233869,
304015,
226196,
284570,
284574,
284577,
289187,
289190,
289191,
305577,
291755,
289196,
370093,
279982,
286126,
297903,
305582,
282548,
293816,
127418,
293308,
278973,
291774,
286158,
280015,
301012,
280030,
279011,
289771,
282095,
293875,
302580,
236022,
288251,
287231
] |
2268e254135358453084cdd4530b7ffb5984fa3b | 035272f9b07ae198b69545cbe21a0e10fd325cb7 | /Banchar/Banchar/Network/APIRequest.swift | 32e5e5de1307eb659c0c26537d6f4a10b66ed72f | [] | no_license | Abe-2/banchar | c707cfbe65e5e2b5f040fb185338c56f6f79e26d | 379c51ce055efe8c650f5d99c585fdac7d8dfa34 | refs/heads/master | 2020-09-27T10:46:13.409823 | 2019-12-07T11:17:38 | 2019-12-07T11:17:38 | 226,498,311 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 8,649 | swift |
import Foundation
import UIKit
// set your targets here, eg: case addStudent = "Student/Add"
struct Target {
static func login(phone: String, password: String) -> String {
return "clientLogin.php?phone=\(phone)&pass=\(password)"
}
static func driverLogin(phone: String, password: String) -> String {
return "driverLogin.php?phone=\(phone)&pass=\(password)"
}
static func register(name: String, phone: String, password: String, plate: String, car: String) -> String {
return "clientRegister.php?name=\(name)&phone=\(phone)&pass=\(password)&plate=\(plate)&car=\(car)"
}
static func driverRegister(name: String, phone: String, password: String) -> String {
return "driverRegister.php?name=\(name)&phone=\(phone)&pass=\(password)"
}
static func createRequest(desc: String) -> String {
let pickX = userOrigin!.coordinate.latitude
let pickY = userOrigin!.coordinate.longitude
return "newRequest.php?id=\(id)&pick_x=\(pickX)&pick_y=\(pickY)&plate=\(plate)&img=\(img)&car=\(car)&desc=\(desc)"
}
static func getDrivers() -> String {
return "client/getDrivers.php"
}
static func askDriver(driver: String, request: String) -> String {
return "client/askDriver.php?driver=\(driver)&request=\(request)"
}
static func checkRequest() -> String {
return "driver/checkRequest.php?driver=\(id)"
}
static func checkStatus(id: String) -> String {
return "checkStatus.php?id=\(id)"
}
static func cancelRequest(id: String) -> String {
return "cancelRequest.php?r=\(id)"
}
static func getRequests(type: String) -> String {
return "getRequests.php?id=\(type)"
}
static func acceptsRequests(request: String, id: String) -> String {
return "acceptRequest.php?id=\(id)&r=\(request)"
}
static func decline(req: String) -> String {
return "driver/decline.php?id=\(id)&request=\(req)"
}
static func rateDriver(driver: String, rating: String, raters: String) -> String {
return "client/rateDriver.php?driver=\(driver)&rating=\(rating)&raters=\(raters)"
}
//exabx.com/apps/taxi/api/
static func updateLocation(x: String, y: String) -> String {
return "updateDriverLocation.php?id=\(id)&x=\(x)&y=\(y)"
}
static func getDriverLocation(driverId: String) -> String {
return "getDriverLocation.php?id=\(driverId)"
}
static func history() -> String {
return "client/pickupHistory.php?client=\(id)"
}
static func endRide(req: String) -> String {
return "endRide.php?r=\(req)"
}
static func getRating(driver: String) -> String {
return "driver/getRating.php?driver=\(driver)"
}
}
struct ClientRequest: Decodable {
var id: String
var pickup_x: String
var pickup_y: String
var dest_x: String
var dest_y: String
var fare: String
}
//{"status":"1","driver_id":"2"}
struct DriverInfo: Decodable {
var status: String
var driver_id: String
}
struct DriverLocation: Decodable {
var location_x: String?
var location_y: String?
}
struct APIResponse: Decodable {
var status: String
var message: String?
var payload: Payload?
}
struct Payload: Decodable {
var id: String?
var plate_num: String?
var car_type: String?
var img: String?
var drivers: [Driver]?
var requestID: String?
var status: String?
var request: Request?
var requests : [Request]?
var rating: String?
var raters: String?
}
struct Driver: Decodable {
var id: String
var name: String
var email: String
var rating: String
var location_x: String?
var location_y: String?
var raters: String
}
struct Request: Decodable {
var id: String
var client_id: String
var status: String
var pickup_x: String
var pickup_y: String
var car_type: String
var plate_num: String
var description: String
var img: String
var date : String?
}
// the base request, handles required info
class BaseRequest: NSObject {
static let baseUrl = "http://exabx.com/apps/banchar/api/"
var target: String = ""
var parameters: JSON = JSON([])
var rawResponse: Data? = nil
var onSuccess: (() -> ())? = nil
var onFail: (() -> ())? = nil
fileprivate var urlSession = URLSession()
}
class APIRequest: BaseRequest {
var delay: Double = 0
fileprivate var urlRequest: URLRequest? = nil
var processJson = true
var response: APIResponse = APIResponse(status: "error", message: "network_err_connection_didnt_start", payload: nil)
var retreivedImage: UIImage? = nil
func popErrorUp(on viewController: UIViewController) {
viewController.present(title: "Error", message: self.response.message ?? "Something Went Wrong", actions: [UIAlertAction(title: "OK", style: .default, handler: nil)])
}
convenience init(withTarget target: String) {
self.init()
self.target = target
}
var uparams: [String] = []
private func getUParams() -> String {
var u = ""
var first = true
for p in uparams {
u.append(first ? "\(p)" : "&\(p)")
if first { first = false }
}
return u
}
var calledUrl: URL? = nil
func generateBoundary() -> String {
return "Boundary-\(NSUUID().uuidString)"
}
func createDataBody(data: Data, boundary: String) -> Data {
let lineBreak = "\r\n"
var body = Data()
body.append("--\(boundary + lineBreak)")
body.append("Content-Disposition: form-data; name=\"image\"; filename=\"image.jpg\"\(lineBreak)")
body.append("Content-Type: image/jpeg\(lineBreak + lineBreak)")
body.append(data)
body.append(lineBreak)
body.append("--\(boundary)--\(lineBreak)")
return body
}
func start() {
let url = (BaseRequest.baseUrl + target).toURL!
urlRequest = URLRequest(url: url)
if let retreivedImage = retreivedImage {
urlRequest?.httpMethod = "POST"
let boundary = generateBoundary()
urlRequest?.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
urlRequest?.addValue("Client-ID f65203f7020dddc", forHTTPHeaderField: "Authorization")
let dataBody = createDataBody(data: retreivedImage.jpegData(compressionQuality: 1)!, boundary: boundary)
urlRequest?.httpBody = dataBody
}
calledUrl = url
print(url.absoluteString)
URLSession.shared.dataTask(with: urlRequest!, completionHandler: { (data, urlResponse, error) in
self.rawResponse = data
// so basically the first one is repeated (it will be done again in the dispatch) and the second could have been
// moved to 'else' in the dispatch
// self.response.message = (error == nil) ? nil : String(describing: error!)
if error != nil {
DispatchQueue.main.async {
self.onFail?();
}
return
}
DispatchQueue.main.asyncAfter(deadline: .now() + self.delay) {
if self.processJson {
do {
self.response = try JSONDecoder().decode(APIResponse.self, from: data ?? Data())
if self.response.status == "ok" {
self.onSuccess?()
} else {
self.onFail?()
}
} catch let error as NSError {
print("API JSON Conversion Failed at \(url.absoluteString) with error: " + error.description)
self.response.message = "network_err_json_conversation_failed"
self.onFail?()
}
} else {
self.onSuccess?()
}
}
}).resume()
}
}
extension Data {
mutating func append(_ string: String) {
if let data = string.data(using: .utf8) {
append(data)
}
}
}
extension UIViewController {
func present(title: String, message: String, actions: [UIAlertAction], alertType: UIAlertController.Style = .alert) {
let alert = UIAlertController(title: title, message: message, preferredStyle: alertType)
for action in actions {
alert.addAction(action)
}
self.present(alert, animated: true, completion: nil)
}
}
| [
-1
] |
d5e771b34f74e358ce886f75343eca0203320372 | 7d4cc5f5dc840a2ccfe3e7d7880131dd147f5cda | /Sources/SwiftUIKit/Views/WebView.swift | b40daed177cce44454af441fd59ba9928a735f6f | [
"MIT"
] | permissive | rbrovko/SwiftUIKit | bfc39f393862ac1c943bb28ad105b4936bc57487 | bcfd62da77d0025920eed05c7efa1d6719811c0b | refs/heads/main | 2023-05-10T08:51:11.931586 | 2021-06-18T16:40:57 | 2021-06-18T16:40:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,728 | swift | //
// WebView.swift
//
//
// Created by Zach Eriksen on 11/27/19.
//
import WebKit
@available(iOS 9.0, *)
public class WebView: WKWebView {
public init() {
let configuration = WKWebViewConfiguration()
super.init(frame: .zero, configuration: configuration)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
@available(iOS 9.0, *)
public extension WebView {
convenience init(
baseURL: URL? = nil,
htmlString: () -> String
) {
self.init()
loadHTMLString(baseURL: baseURL, htmlString: htmlString)
}
convenience init(url: URL) {
self.init()
load(url: url)
}
convenience init(request: URLRequest) {
self.init()
load(request: request)
}
convenience init(URL: URL, allowingReadAccessTo readAccessURL: URL) {
self.init()
loadFile(URL: URL, allowingReadAccessTo: URL)
}
convenience init(
data: Data,
mimeType MIMEType: String,
characterEncodingName: String,
baseURL: URL
) {
self.init()
load(data: data,
mimeType: MIMEType,
characterEncodingName: characterEncodingName,
baseURL: baseURL)
}
@discardableResult
func loadHTMLString(
baseURL: URL? = nil,
htmlString: () -> String
) -> Self {
loadHTMLString(htmlString(), baseURL: baseURL)
return self
}
@discardableResult
func load(url: URL) -> Self {
load(URLRequest(url: url))
return self
}
@discardableResult
func load(request: URLRequest) -> Self {
load(request)
return self
}
@discardableResult
func loadFile(URL: URL, allowingReadAccessTo readAccessURL: URL) -> Self {
loadFileURL(URL, allowingReadAccessTo: readAccessURL)
return self
}
@discardableResult
func load(
data: Data,
mimeType MIMEType: String,
characterEncodingName: String,
baseURL: URL
) -> Self {
load(data,
mimeType: MIMEType,
characterEncodingName: characterEncodingName,
baseURL: baseURL)
return self
}
@discardableResult
func set(uiDelegate delegate: WKUIDelegate) -> Self {
uiDelegate = delegate
return self
}
@discardableResult
func set(navigationDelegate delegate: WKNavigationDelegate) -> Self {
navigationDelegate = delegate
return self
}
}
| [
-1
] |
d279bc42d1454678b4db1b3079c856d873f2efe2 | d91fe716c3556219f9131e646afad456f26e26ea | /F1History/Modules/Circuits/CircuitDetails/CircuitDetailsView.swift | e3a4753c1d62321a4290bd0c1c57fc1d0f7f2aea | [] | no_license | Barazite/F1History | a1ff4bb26e57e35fc9bf4732d149be83f63aeed6 | e36db757e0fd8dfb62b4a2edad1b70131be49b7e | refs/heads/main | 2023-07-12T09:43:33.829930 | 2021-08-16T16:18:56 | 2021-08-16T16:18:56 | 383,896,566 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,210 | swift | //
// CircuitDetailsView.swift
// F1History
//
// Created by Adrian Sevilla Diaz on 9/8/21.
//
import SwiftUI
import MapKit
struct CircuitDetailsView: View {
@SwiftUI.Environment(\.presentationMode) var presentMode
@ObservedObject var presenter = CircuitDetailsPresenterImpl()
@ObservedObject var imageManager = ImageManager()
@State var showWiki = false
@State var favorite = false
var body: some View {
VStack{
HStack{
Button(action: {
if favorite{
FavoritesManager.shared.deleteCircuit(circuit: presenter.circuit!)
favorite = false
}else{
FavoritesManager.shared.saveCircuit(circuit: presenter.circuit!)
favorite = true
}
}, label: {
Image(systemName: favorite ? "star.fill" : "star")
.resizable()
.frame(width: 40, height: 40)
})
.onAppear(perform: {
self.favorite = FavoritesManager.shared.findCircuit(circuit: presenter.circuit!)
})
.foregroundColor(.yellow)
Spacer()
Button(action: {
showWiki.toggle()
}, label: {
Image("wikipedia")
.resizable()
.frame(width: 40, height: 40)
})
.foregroundColor(.yellow)
.sheet(isPresented: $showWiki, onDismiss: {}){
WebViewHome(showWiki: $showWiki, url: self.presenter.circuit?.url ?? "https://www.wikipedia.com")
}
}
.padding()
HStack(alignment: .center){
Text(self.presenter.circuit?.circuitName ?? "").font(.title2).bold()
}.padding()
HStack(){
Text(self.presenter.circuit?.locality ?? "").font(.title3)
Spacer()
Image(uiImage: (self.imageManager.flag.isEmpty ? UIImage(systemName: "photo") : UIImage(data: self.imageManager.flag))!)
.resizable()
.frame(width: 100, height: 80)
.scaledToFill()
}.padding()
MapCircuit(circuit: self.presenter.circuit!)
.frame(maxWidth: .infinity)
.ignoresSafeArea(edges: .horizontal)
}
.onAppear(perform: {
self.imageManager.getFlagFromUrl(imageUrl: self.imageManager.getUrl(nation: self.presenter.circuit?.country ?? ""))
})
.navigationBarBackButtonHidden(true)
.navigationBarItems(leading:
Button(action: {
self.presentMode.wrappedValue.dismiss()
}, label: {
Image(systemName: "chevron.left").foregroundColor(.white)
})
)
}
}
struct CircuitDetailsView_Previews: PreviewProvider {
static var previews: some View {
CircuitDetailsView()
}
}
struct MapCircuit: View{
var circuit : Circuits
@State private var region : MKCoordinateRegion
init(circuit : Circuits){
self.circuit = circuit
region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: self.circuit.lat!, longitude: self.circuit.long!), latitudinalMeters: 1500, longitudinalMeters: 1500)
}
var body: some View{
/*Map(coordinateRegion: self.$region,annotationItems: [circuit]){ place in
MapPin(coordinate: CLLocationCoordinate2D(latitude: (place.lat! as NSString).doubleValue, longitude: (place.long! as NSString).doubleValue), tint: .red)
}*/
Map(coordinateRegion: self.$region, interactionModes: .all, annotationItems: [circuit]){ place in
MapPin(coordinate: CLLocationCoordinate2D(latitude: place.lat! , longitude: place.long!), tint: .red)
}
}
}
| [
-1
] |
36a0796cb14187027f734823e8a980917cdcef85 | ad8f88e075ae5249822ee0499389e40c44b6df17 | /Sources/PeripheryKit/Analyzer/Visitors/CodingKeyEnumReferenceBuilder.swift | 2cdc3c66f00c9bff13ba9d3f624c7dd852463b61 | [
"MIT"
] | permissive | applejian/periphery | e010193c4c40e579e42d836fb6d78f694800d4b7 | 7eacbf78d0dfb475b1388a0f802b6e1ac5c4a2f1 | refs/heads/master | 2022-03-30T17:26:12.626390 | 2020-04-25T10:43:57 | 2020-04-25T10:55:43 | 280,038,382 | 2 | 0 | MIT | 2020-07-16T03:02:13 | 2020-07-16T03:02:12 | null | UTF-8 | Swift | false | false | 1,446 | swift | import Foundation
/// Builds a reference from a Decodable class to any child enum that conforms to CodingKey.
///
/// public class SomeClass: Decodable {
/// var someVar: String?
///
/// enum CodingKeys: CodingKey {
/// case someVar
/// }
/// }
///
final class CodingKeyEnumReferenceBuilder: SourceGraphVisitor {
static func make(graph: SourceGraph) -> Self {
return self.init(graph: graph)
}
private let graph: SourceGraph
required init(graph: SourceGraph) {
self.graph = graph
}
func visit() {
for enumDeclaration in graph.declarations(ofKind: .enum) {
guard let parent = enumDeclaration.parent as? Declaration else { continue }
let isCodingKey = graph.superclassReferences(of: enumDeclaration).contains {
$0.kind == .protocol && $0.name == "CodingKey"
}
let isParentDecodable = graph.superclassReferences(of: parent).contains {
[.protocol, .typealias].contains($0.kind) && ["Codable", "Decodable"].contains($0.name)
}
if isCodingKey && isParentDecodable {
let newReference = Reference(kind: .enum, usr: enumDeclaration.usr, location: enumDeclaration.location)
newReference.name = enumDeclaration.name
newReference.parent = parent
graph.add(newReference, from: parent)
}
}
}
}
| [
-1
] |
a50c94bde962d257635e5b22d13b5d01387741fb | 25752171f2e1bd487d5b645f82e19d7dacad8bcd | /FilterScreen/FilterVC/FilterHeaderView.swift | b26cd9268361d3258f6deb749127dacbfe58edd8 | [] | no_license | KushalChoudhary14sep/ExpandableTableView | 0f3b955ffe3dc8d5f176a5c57492a4e52e2749ef | 202669a242f72832565f964a22b45439e9f518eb | refs/heads/main | 2023-04-27T22:19:56.672491 | 2021-05-07T05:53:44 | 2021-05-07T05:53:44 | 364,833,583 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,821 | swift | //
// FilterHeaderView.swift
// FilterScreen
//
// Created by Kushal Choudhary on 07/05/21.
//
import UIKit
protocol FilterHeaderViewDelegate {
func didSelectHeader(group:CollectionFilterGroups)
}
class FilterHeaderView: UIView {
@IBOutlet weak var rightImageInInsideHeader: UIImageView!
@IBOutlet var contentView: UIView!
@IBOutlet weak var button: UIButton!
@IBOutlet weak var lineView: UIView!
var delegate: FilterHeaderViewDelegate!
var group: CollectionFilterGroups!
override init(frame: CGRect) {
super.init(frame: frame)
commoninit()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
commoninit()
}
private func commoninit(){
Bundle.main.loadNibNamed("FilterHeaderView", owner: self, options: nil)
addSubview(contentView)
contentView.frame = self.bounds
contentView.autoresizingMask = [.flexibleHeight, .flexibleWidth]
}
func setData(delegate:FilterHeaderViewDelegate,group: CollectionFilterGroups){
self.button.setTitle(group.rawValue, for: .normal)
self.button.setTitleColor(.black, for: .normal)
self.delegate = delegate
self.group = group
}
@IBAction func didTapButton(_ sender: Any) {
button.isSelected.toggle()
if button.isSelected {
rightImageInInsideHeader.image = UIImage(named: "up_arrow")
lineView.backgroundColor = UIColor.red
button.titleLabel?.textColor = UIColor.red
}else{
rightImageInInsideHeader.image = UIImage(named: "down_arrow")
lineView.backgroundColor = UIColor.gray
button.titleLabel?.textColor = UIColor.black
}
self.delegate.didSelectHeader(group: group)
}
}
| [
-1
] |
1ae9ad76f1fd1deb640780d0e102555ff54f2c80 | 69ff980bfa2f131b65e57ee4b013ae2d91691fde | /FeedViewController.swift | 93dfd554b6c9026cb65183fcbeafd04108d719b4 | [] | no_license | cntran/ExchangeAGram | cec4b661ed5b54e114244ef9dec6586c5ce4dee1 | f83cbe4708143e73d11551d841e5d75f88013635 | refs/heads/master | 2016-09-05T09:30:21.412878 | 2015-01-21T00:39:32 | 2015-01-21T00:39:32 | 29,563,046 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,038 | swift | //
// FeedViewController.swift
// ExchangeAGram
//
// Created by Craig Tran on 1/16/15.
// Copyright (c) 2015 SDBX Studio. All rights reserved.
//
import UIKit
import MobileCoreServices
import CoreData
class FeedViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
@IBOutlet weak var collectionView: UICollectionView!
var feedArray:[AnyObject] = []
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let request = NSFetchRequest(entityName: "FeedItem")
let appDelegate:AppDelegate = (UIApplication.sharedApplication().delegate as AppDelegate)
let context:NSManagedObjectContext = appDelegate.managedObjectContext!
feedArray = context.executeFetchRequest(request, error: nil)!
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func snapBarButtonItemTapped(sender: UIBarButtonItem) {
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera) {
var cameraController = UIImagePickerController()
cameraController.delegate = self
cameraController.sourceType = UIImagePickerControllerSourceType.Camera
let mediaTypes:[AnyObject] = [kUTTypeImage]
cameraController.mediaTypes = mediaTypes
cameraController.allowsEditing = false
self.presentViewController(cameraController, animated: true, completion: nil)
}
else if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary){
var photoLibraryController = UIImagePickerController()
photoLibraryController.delegate = self
photoLibraryController.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
let mediaTypes:[AnyObject] = [kUTTypeImage]
photoLibraryController.mediaTypes = mediaTypes
photoLibraryController.allowsEditing = false
self.presentViewController(photoLibraryController, animated: true, completion: nil)
}
else {
var alertController = UIAlertController(title: "Alert", message: "Your device does not support the camera or photo library", preferredStyle: UIAlertControllerStyle.Alert)
alertController.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(alertController, animated: true, completion: nil)
}
}
// UIImagePickerControllerDelegate
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) {
let image = info[UIImagePickerControllerOriginalImage] as UIImage
let imageData = UIImageJPEGRepresentation(image, 1.0)
let managedObjectContext = (UIApplication.sharedApplication().delegate as AppDelegate).managedObjectContext
let entityDescription = NSEntityDescription.entityForName("FeedItem", inManagedObjectContext: managedObjectContext!)
let feedItem = FeedItem(entity: entityDescription!, insertIntoManagedObjectContext: managedObjectContext!)
feedItem.image = imageData
feedItem.caption = "test caption"
feedArray.append(feedItem)
(UIApplication.sharedApplication().delegate as AppDelegate).saveContext()
self.dismissViewControllerAnimated( true, completion: nil)
self.collectionView.reloadData()
}
// UICollectionViewDataSource
func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
return 1
}
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return feedArray.count
}
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
var cell:FeedCell = collectionView.dequeueReusableCellWithReuseIdentifier("Cell", forIndexPath: indexPath) as FeedCell
let thisItem = feedArray[indexPath.row] as FeedItem
cell.imageView.image = UIImage(data: thisItem.image)
cell.captionLabel.text = thisItem.caption
return cell
}
// UICollectionViewDelegate
func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
let thisItem = feedArray[indexPath.row] as FeedItem
var filterVC = FilterViewController()
filterVC.thisFeedItem = thisItem
self.navigationController?.pushViewController(filterVC, animated: false)
}
}
| [
-1
] |
6b6591ac3735a926e7f96e0ce5339f4356858bd0 | 00581b0a0d785f090a9fd28de3110a3c00b0a7c9 | /Kait/Kait/Helper/Helpers.swift | 2b839fec6b508e640332bef957f5923aaa8ae645 | [] | no_license | sguptaruby/SagarKait | a3ce61fcf237d2dde5240187dae49f2bfa41643f | fb911db2c5306267926fac205609872e89091a01 | refs/heads/master | 2022-12-14T01:24:52.565276 | 2020-09-25T05:32:51 | 2020-09-25T05:32:51 | 298,476,779 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,282 | swift |
import Foundation
import Alamofire
struct Helpers {
static func userToken() -> String {
guard let token = UserDefaults.standard.value(forKey: "Authorization") else {
return ""
}
return token as! String
}
static func saveUserToken(token:String){
UserDefaults.standard.set(token, forKey: "Authorization")
UserDefaults.standard.synchronize()
}
static func saveUserData(data:JSONDictionary){
UserDefaults.standard.set(data, forKey: "User")
UserDefaults.standard.synchronize()
}
static func getUserData() -> JSONDictionary {
return UserDefaults.standard.value(forKey: "User") as? JSONDictionary ?? [:]
}
static func saveDeviceToken(token:String){
UserDefaults.standard.set(token, forKey: "devicetoken")
UserDefaults.standard.synchronize()
}
static func getDeviceToken() -> String {
return UserDefaults.standard.value(forKey: "devicetoken") as? String ?? ""
}
static func removeUserToken() {
UserDefaults.standard.removeObject(forKey: "Authorization")
}
static func saveUserOnline(isOnline:Bool){
UserDefaults.standard.set(isOnline, forKey: "isOnline")
UserDefaults.standard.synchronize()
}
static func getUserOnline() -> Bool {
return UserDefaults.standard.value(forKey: "isOnline") as? Bool ?? false
}
static func validateResponse(_ statusCode: Int) -> Bool {
if case 200...300 = statusCode {
return true
}
return false
}
}
//MARK: UIImageView
class RoundImageView: UIImageView {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.clipsToBounds = true
self.layer.cornerRadius = self.frame.width/2
}
}
//MARK: UIButton
class RoundCornerButton: UIButton {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.layer.cornerRadius = self.frame.height/2
self.clipsToBounds = true
}
}
struct ScreenSize
{
static let SCREEN_WIDTH = UIScreen.main.bounds.size.width
static let SCREEN_HEIGHT = UIScreen.main.bounds.size.height
static let SCREEN_MAX_LENGTH = max(ScreenSize.SCREEN_WIDTH, ScreenSize.SCREEN_HEIGHT)
static let SCREEN_MIN_LENGTH = min(ScreenSize.SCREEN_WIDTH, ScreenSize.SCREEN_HEIGHT)
}
struct DeviceType
{
static let IS_IPHONE_4_OR_LESS = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH < 568.0
static let IS_IPHONE_5 = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH == 568.0
static let IS_IPHONE_6_7 = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH == 667.0
static let IS_IPHONE_6P_7P = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH == 736.0
static let IS_IPAD = UIDevice.current.userInterfaceIdiom == .pad && ScreenSize.SCREEN_MAX_LENGTH == 1024.0
static let IS_IPAD_PRO = UIDevice.current.userInterfaceIdiom == .pad && ScreenSize.SCREEN_MAX_LENGTH == 1366.0
}
| [
-1
] |
a807160953480c1736c81cd9a8ca79b55cdd9f2f | a75b8334e7acacde199f996b0e4933edc8248f5f | /AppoOChat/AppoOChat/AuthVC.swift | 593229f4b147a39babb6ab3d2cf8b9c9c279c52a | [] | no_license | muhammadaamirqasmani/AppoOChat | 65159a1af786b437943716e10aed1d7cd50908eb | ac59a070182d73cfc8c960b59c620a126ef18e3b | refs/heads/master | 2021-01-23T16:22:17.732266 | 2017-10-04T14:39:04 | 2017-10-04T14:39:04 | 102,738,335 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,023 | swift | //
// AuthVC.swift
// AppoOChat
//
// Created by Muhammad Aamir on 17/08/2017.
// Copyright © 2017 Muhammad Aamir. All rights reserved.
//
import UIKit
import Firebase
class AuthVC: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if FIRAuth.auth()?.currentUser != nil{
dismiss(animated: true, completion: nil)}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func FBBtnWasPressed(_ sender: Any) {
}
@IBAction func GPlusBtnWasPressed(_ sender: Any) {
}
@IBAction func emailBtnWasPressed(_ sender: Any) {
let loginVC = storyboard?.instantiateViewController(withIdentifier: "LoginVC")
present(loginVC!, animated: true, completion: nil)
}
}
| [
-1
] |
81d9bba15a59f9e6d07a97f5fa72b0f09d5d25f4 | 7432c5d67199cf67a02d2354d144ef12a8d1de8d | /CalcumonTests/CalcumonTests.swift | 931ad8ac112061962b5a87b3fc7d7c0e0d5486e5 | [] | no_license | Innovatewithapple/Calcumon | 305a3ba441e9d6ad37f7e6d4ca0aa29dac9cb3bd | 67081645c2559b7bafdc5acca5a7d8221cb40002 | refs/heads/master | 2023-08-04T04:41:41.706740 | 2019-04-26T03:11:22 | 2019-04-26T03:11:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,554 | swift | //
// CalcumonTests.swift
// CalcumonTests
//
// Created by Sarin Swift on 4/25/19.
// Copyright © 2019 sarinswift. All rights reserved.
//
import XCTest
@testable import Calcumon
class CalcumonTests: XCTestCase {
var viewController: ViewController!
override func setUp() {
super.setUp()
//1
let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main)
let vc = storyboard.instantiateInitialViewController() as! ViewController
let _ = vc.view
//2
UIApplication.shared.keyWindow!.rootViewController = viewController
//3
XCTAssertNotNil(vc.view)
}
func testSubmitTitle() {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let singleCatVC = storyboard.instantiateViewController(withIdentifier: "singleCategoryView") as! SingleCategoryViewController
let _ = singleCatVC.view
XCTAssertEqual("Submit", singleCatVC.submitButton.titleLabel?.text)
}
func testviewControllerNotNil() {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = storyboard.instantiateInitialViewController() as! ViewController
UIApplication.shared.keyWindow!.rootViewController = viewController
XCTAssertNotNil(viewController.view)
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
-1
] |
91bc4a8b193dfebfc8f496e6d9db2bc9c21645ad | 597bcd84f3d94d3a5067034b7e8c999915b44d01 | /Prework/SceneDelegate.swift | 56281af357833d351a96d138ba869355663891de | [] | no_license | sivatheja10/Prework-iOS-Codepath | b0e8509ee7f4e64aae686036bb31ff8b3eb047ae | a9b7d76605625de180df56dc66ccb9ee56399bcb | refs/heads/main | 2023-07-15T11:20:37.207763 | 2021-09-04T04:01:58 | 2021-09-04T04:01:58 | 402,959,851 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,300 | swift | //
// SceneDelegate.swift
// Prework
//
// Created by SIVATHEJESWARA REDDY K on 26/08/21.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
| [
393221,
163849,
393228,
393231,
393251,
352294,
344103,
393260,
393269,
213049,
376890,
385082,
393277,
376906,
327757,
254032,
368728,
180314,
254045,
180322,
376932,
286833,
286845,
286851,
417925,
262284,
360598,
286880,
377003,
377013,
164029,
327872,
180418,
377030,
377037,
377047,
418008,
418012,
377063,
327915,
205037,
393457,
393461,
393466,
418044,
385281,
336129,
262405,
180491,
336140,
164107,
262417,
368913,
262423,
377118,
377121,
262437,
254253,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
270687,
262497,
418145,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
164362,
328207,
410129,
393748,
377372,
188959,
385571,
377384,
197160,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
385610,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
385671,
148106,
377485,
352919,
98969,
344745,
361130,
336556,
434868,
164535,
336568,
164539,
328379,
328387,
352969,
418508,
385743,
385749,
139998,
189154,
369382,
361196,
418555,
344832,
336644,
344837,
344843,
328462,
361231,
394002,
336660,
418581,
418586,
434971,
369436,
262943,
369439,
418591,
418594,
336676,
418600,
418606,
369464,
361274,
328516,
336709,
328520,
336712,
361289,
328523,
336715,
361300,
213848,
426842,
361307,
197469,
361310,
254813,
361318,
344936,
361323,
361335,
328574,
369544,
361361,
222129,
345036,
115661,
386004,
345046,
386012,
386019,
386023,
328690,
435188,
328703,
328710,
418822,
377867,
328715,
361490,
386070,
271382,
336922,
345119,
377888,
214060,
345134,
345139,
361525,
386102,
361537,
377931,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
386168,
361594,
410746,
214150,
345224,
386187,
345247,
361645,
345268,
402615,
361657,
337093,
402636,
328925,
165086,
165092,
328933,
222438,
328942,
386286,
386292,
206084,
328967,
345377,
345380,
353572,
345383,
263464,
337207,
345400,
378170,
369979,
386366,
337224,
337230,
337235,
263509,
353634,
337252,
402792,
271731,
378232,
337278,
271746,
181639,
353674,
181644,
361869,
181650,
181655,
230810,
181671,
181674,
181679,
181682,
337330,
181687,
370105,
181691,
181697,
361922,
337350,
181704,
337366,
271841,
329192,
361961,
329195,
116211,
337399,
402943,
337416,
329227,
419341,
419345,
329234,
419351,
345626,
419357,
345631,
419360,
370208,
394787,
419363,
370214,
419369,
394796,
419377,
419386,
206397,
214594,
419401,
353868,
419404,
173648,
419408,
214611,
419412,
403040,
345702,
222831,
370298,
353920,
403073,
403076,
345737,
198282,
403085,
403092,
345750,
419484,
345758,
345763,
419492,
345766,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
419518,
337601,
403139,
337607,
419528,
419531,
419536,
272083,
394967,
419543,
419545,
345819,
419548,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
362274,
378664,
354107,
354112,
370504,
329545,
345932,
370510,
354132,
247639,
337751,
370520,
313181,
182110,
354143,
354157,
345965,
345968,
345971,
345975,
403321,
1914,
354173,
395148,
247692,
337809,
247701,
329625,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
346059,
247760,
346064,
346069,
419810,
329699,
354275,
190440,
354314,
346140,
436290,
395340,
378956,
436307,
338005,
100454,
329833,
329853,
329857,
329868,
411806,
329886,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
346317,
411862,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
436474,
321787,
379135,
411905,
411917,
379154,
395539,
387350,
387353,
338201,
182559,
338212,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
321911,
420237,
379279,
272787,
354728,
338353,
338382,
272849,
248279,
256474,
182755,
338404,
338411,
330225,
248309,
330254,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
191085,
338544,
191093,
346743,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
355029,
264919,
256735,
338661,
264942,
363252,
338680,
264965,
338701,
256787,
363294,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
355151,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
355185,
412600,
207809,
379849,
347082,
396246,
330711,
248794,
248799,
347106,
437219,
257009,
265208,
265215,
199681,
338951,
330761,
330769,
330775,
248863,
158759,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
248915,
183384,
339037,
412765,
257121,
322660,
265321,
248952,
420985,
330886,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
126148,
322763,
330959,
330966,
265433,
265438,
388320,
363757,
339199,
396552,
175376,
175397,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
126279,
437576,
437584,
331089,
331094,
396634,
175451,
437596,
429408,
175458,
175461,
175464,
265581,
331124,
175478,
249210,
175484,
175487,
249215,
175491,
249219,
249225,
249228,
249235,
175514,
175517,
396703,
396706,
175523,
355749,
396723,
388543,
380353,
216518,
380364,
339406,
372177,
339414,
249303,
413143,
339418,
339421,
249310,
339425,
249313,
339429,
339435,
249329,
69114,
372229,
208399,
380433,
175637,
134689,
339504,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
224885,
224888,
224891,
224895,
372354,
126597,
421509,
224905,
11919,
224911,
224914,
126611,
224917,
224920,
126618,
208539,
224923,
224927,
224930,
224933,
257705,
224939,
224943,
257713,
224949,
257717,
257721,
224954,
257725,
224960,
257733,
224966,
224970,
257740,
224976,
257745,
339664,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
225013,
257788,
225021,
339711,
257791,
225027,
257796,
339722,
257802,
257805,
225039,
257808,
249617,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
397089,
257825,
225059,
339748,
225068,
257837,
413485,
225071,
225074,
257843,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
257869,
257872,
225105,
397140,
225109,
225113,
257881,
257884,
257887,
225120,
257891,
413539,
225128,
257897,
339818,
225138,
339827,
257909,
225142,
372598,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
372698,
372704,
372707,
356336,
380919,
393215,
372739,
405534,
266295,
266298,
217158,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
192640,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
250012,
225439,
135328,
192674,
225442,
438434,
225445,
438438,
225448,
438441,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
430275,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
356580,
225511,
217319,
225515,
225519,
381177,
397572,
389381,
356638,
356641,
356644,
356647,
266537,
389417,
356650,
356656,
332081,
307507,
340276,
356662,
397623,
332091,
225599,
201030,
348489,
332107,
151884,
430422,
348503,
250201,
250203,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
250239,
348548,
356741,
332175,
160152,
373146,
340380,
373149,
70048,
356783,
373169,
266688,
324032,
201158,
340452,
127473,
217590,
340473,
324095,
324100,
324103,
324112,
340501,
324118,
324122,
340512,
332325,
324134,
381483,
356908,
324141,
324143,
356917,
324150,
324156,
168509,
348734,
324161,
324165,
356935,
348745,
381513,
324171,
324174,
324177,
389724,
332381,
373344,
340580,
348777,
381546,
119432,
340628,
184983,
373399,
258723,
332455,
332460,
389806,
332464,
332473,
381626,
332484,
332487,
332494,
357070,
357074,
332512,
332521,
340724,
332534,
373499,
348926,
389927,
348979,
152371,
340792,
398141,
357202,
389971,
357208,
389979,
430940,
357212,
357215,
439138,
201580,
201583,
349041,
340850,
381815,
430967,
324473,
398202,
119675,
340859,
324476,
430973,
324479,
340863,
324482,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
373672,
324525,
5040,
111539,
324534,
5047,
324539,
324542,
398280,
349129,
340940,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
349173,
381947,
201724,
349181,
431100,
431107,
349203,
209944,
209948,
250915,
250917,
169002,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
431180,
209996,
341072,
349268,
177238,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
152704,
349313,
160896,
210053,
210056,
349320,
259217,
373905,
210068,
210072,
210078,
210081,
210085,
210089,
210096,
210100,
324792,
210108,
357571,
210116,
210128,
210132,
333016,
210139,
210144,
218355,
218361,
275709,
128254,
275713,
242947,
275717,
275723,
333075,
349460,
333079,
251161,
349486,
349492,
415034,
210261,
365912,
259423,
374113,
251236,
374118,
333164,
234867,
390518,
357756,
374161,
112021,
349591,
357793,
333222,
259516,
415168,
366035,
415187,
366039,
415192,
415194,
415197,
415200,
333285,
415208,
366057,
366064,
415217,
415225,
423424,
415258,
415264,
366118,
415271,
382503,
349739,
144940,
415279,
415282,
415286,
210488,
415291,
415295,
333396,
333400,
366173,
423529,
423533,
210547,
415354,
333440,
267910,
267929,
333512,
259789,
366301,
333535,
153311,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
366349,
210707,
399129,
333595,
210720,
366384,
358192,
210740,
366388,
358201,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
358235,
341852,
350046,
399200,
399208,
268144,
358256,
358260,
341877,
399222,
325494,
333690,
325505,
333699,
399244,
333709,
333725,
333737,
382891,
382898,
350153,
358348,
333777,
219094,
399318,
358372,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
268299,
333838,
350225,
350232,
333851,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
342113,
252021,
342134,
374904,
268435,
333998,
334012,
260299,
350411,
350417,
350423,
350426,
350449,
375027,
358645,
350459,
350462,
350465,
350469,
268553,
350477,
268560,
350481,
432406,
350487,
325915,
350491,
325918,
350494,
325920,
350500,
350505,
358701,
391469,
350510,
358705,
358714,
358717,
383307,
358738,
334162,
383331,
383334,
391531,
383342,
334204,
268669,
194942,
391564,
366991,
334224,
268702,
342431,
375209,
375220,
334263,
326087,
358857,
195041,
334312,
104940,
375279,
350724,
186898,
342546,
350740,
342551,
334359,
342555,
334364,
416294,
350762,
252463,
358962,
334386,
334397,
358973,
252483,
219719,
399957,
334425,
326240,
375401,
334466,
334469,
391813,
162446,
326291,
342680,
342685,
260767,
342711,
244410,
260798,
334530,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
64231,
113389,
342769,
203508,
375541,
342777,
391938,
391949,
375569,
326417,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
326452,
326455,
375613,
244542,
260925,
375616,
326463,
326468,
342857,
326474,
326479,
326486,
416599,
342875,
244572,
326494,
433001,
400238,
326511,
211826,
211832,
392061,
351102,
359296,
252801,
260993,
351105,
400260,
211846,
342921,
342931,
252823,
400279,
392092,
400286,
252838,
359335,
211885,
400307,
351169,
359362,
351172,
170950,
187335,
326599,
359367,
359383,
359389,
383968,
343018,
359411,
261109,
261112,
244728,
383999,
261130,
261148,
359452,
211999,
261155,
261160,
261166,
359471,
375868,
343132,
384099,
384102,
384108,
367724,
187503,
343155,
384115,
212095,
384136,
384140,
384144,
384152,
384158,
384161,
351399,
384169,
367795,
244917,
384182,
367801,
384189,
384192,
351424,
343232,
367817,
244938,
384202,
253132,
326858,
384209,
146644,
351450,
384225,
359650,
343272,
351467,
359660,
384247,
351480,
384250,
351483,
351492,
343307,
384270,
359695,
261391,
253202,
261395,
384276,
384284,
245021,
384290,
253218,
245032,
171304,
384299,
351535,
376111,
245042,
326970,
384324,
343366,
212296,
212304,
367966,
343394,
367981,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
384398,
245137,
245143,
245146,
245149,
343453,
245152,
245155,
155045,
245158,
40358,
245163,
114093,
327090,
343478,
359867,
384444,
146878,
327108,
327112,
384457,
359887,
359891,
368093,
155103,
343535,
343540,
368120,
343545,
409092,
359948,
359951,
245295,
359984,
400977,
400982,
179803,
155241,
245358,
155255,
155274,
368289,
245410,
425639,
425652,
425663,
155328,
245463,
155352,
155356,
212700,
155364,
245477,
155372,
245487,
212723,
409336,
155394,
155404,
245528,
155423,
360224,
155439,
204592,
155444,
155448,
417596,
384829,
384831,
360262,
155463,
155477,
376665,
155484,
261982,
425823,
155488,
376672,
155492,
327532,
261997,
376686,
262000,
262003,
425846,
262006,
147319,
262009,
327542,
262012,
155517,
155523,
155526,
360327,
376715,
155532,
262028,
262031,
262034,
262037,
262040,
262043,
155550,
253854,
262046,
262049,
262052,
327590,
155560,
155563,
155566,
327613,
393152,
311244,
393170,
155604,
155620,
253924,
155622,
253927,
327655,
360432,
393204,
360439,
253944,
393209,
155647
] |
8a2fcb6cf5b48fc3718fac15a18c39855569009b | 118d285a3477a2fe705522c7c72c4f73dbfe1f2c | /CalculatorUITests/CalculatorUITests.swift | 986257a2b4e51447bd2722728f304971d08e76b6 | [] | no_license | shiba1014/Calculator | 0fbf6fde73cf8df2aaa17df5732e9951e0f39f00 | d742ac75362bad83d861d1d0d5a2cb8a34d5bbcd | refs/heads/master | 2021-01-17T19:17:18.824081 | 2016-06-07T05:00:19 | 2016-06-07T05:00:19 | 60,533,035 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,256 | swift | //
// CalculatorUITests.swift
// CalculatorUITests
//
// Created by Paul McCartney on 2016/06/06.
// Copyright © 2016年 shiba. All rights reserved.
//
import XCTest
class CalculatorUITests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
| [
333827,
243720,
282634,
313356,
155665,
305173,
237599,
241695,
292901,
223269,
229414,
354342,
315433,
354346,
325675,
278571,
102441,
124974,
282671,
102446,
229425,
243763,
241717,
321589,
180279,
229431,
319543,
213051,
288829,
325695,
286787,
288835,
307269,
237638,
313415,
239689,
233548,
311373,
315468,
278607,
333902,
311377,
354386,
196687,
329812,
315477,
223317,
285362,
354394,
200795,
323678,
315488,
321632,
315489,
45154,
280676,
313446,
227432,
215144,
307306,
194667,
233578,
278637,
288878,
319599,
284789,
131190,
284790,
288890,
292987,
215165,
131199,
227459,
194692,
235661,
278669,
241809,
323730,
278676,
311447,
153752,
327834,
284827,
278684,
329884,
299166,
278690,
311459,
215204,
233635,
284840,
299176,
278698,
284843,
184489,
278703,
184498,
278707,
125108,
278713,
180409,
295099,
258233,
299197,
280761,
280767,
223418,
227517,
299202,
139459,
309443,
176325,
131270,
301255,
227525,
280779,
282832,
227536,
321744,
301270,
229591,
301271,
280792,
311520,
325857,
334049,
280803,
182503,
319719,
307431,
295147,
317676,
286957,
125166,
125170,
313595,
125180,
184574,
125184,
309504,
217352,
125192,
125197,
194832,
227601,
325904,
125204,
319764,
278805,
282908,
311582,
299294,
125215,
282912,
233761,
278817,
211239,
282920,
125225,
317738,
311596,
321839,
315698,
98611,
125236,
332084,
307514,
278843,
282938,
168251,
287040,
319812,
311622,
280903,
227655,
319816,
323914,
201037,
282959,
229716,
289109,
168280,
379224,
323934,
391521,
239973,
381286,
313703,
285031,
416103,
280938,
242027,
242028,
321901,
354671,
278895,
287089,
199030,
227702,
315768,
315769,
291194,
223611,
248188,
291193,
313726,
311679,
211327,
291200,
240003,
158087,
313736,
227721,
242059,
311692,
285074,
227730,
240020,
190870,
315798,
190872,
291225,
317851,
293275,
285083,
242079,
283039,
289185,
293281,
285089,
305572,
227743,
301482,
311723,
289195,
234957,
377265,
338359,
299449,
311739,
319931,
293309,
278974,
311744,
317889,
278979,
326083,
278988,
289229,
281038,
326093,
281039,
278992,
283088,
283089,
279000,
176602,
242138,
285152,
279009,
291297,
369121,
195044,
160224,
279014,
242150,
319976,
279017,
188899,
311787,
281071,
319986,
236020,
279030,
311800,
279033,
317949,
283138,
279042,
233987,
287237,
377352,
322057,
309770,
342537,
279053,
283154,
303634,
182802,
279061,
303635,
279060,
188954,
279066,
322077,
291359,
227881,
293420,
236080,
283185,
289328,
279092,
234037,
23093,
244279,
338491,
301635,
309831,
55880,
377419,
303693,
281165,
301647,
281170,
326229,
309847,
189016,
115287,
287319,
332379,
111197,
295518,
287327,
242274,
244326,
279143,
279150,
281200,
287345,
313970,
287348,
301688,
244345,
189054,
287359,
297600,
303743,
291455,
301702,
164487,
311944,
279176,
316044,
311948,
184974,
311950,
316048,
311953,
316050,
287379,
326288,
227991,
295575,
289435,
303772,
205469,
221853,
285348,
314020,
279207,
295591,
295598,
279215,
285360,
318127,
299698,
248494,
287412,
166581,
293552,
154295,
164532,
342705,
303802,
314043,
287418,
66243,
291529,
287434,
225996,
363212,
287438,
242385,
303826,
279249,
279253,
158424,
230105,
299737,
322269,
342757,
295653,
289511,
230120,
330473,
234216,
285419,
330476,
289517,
279278,
312046,
170735,
215790,
125683,
230133,
199415,
234233,
242428,
279293,
205566,
322302,
291584,
299777,
289534,
228099,
285443,
291591,
295688,
322312,
285450,
264971,
312076,
326413,
322320,
285457,
295698,
166677,
283418,
285467,
326428,
221980,
281378,
234276,
283431,
262952,
262953,
279337,
293673,
289580,
262957,
318247,
164655,
301872,
242481,
234290,
303921,
318251,
285493,
230198,
328495,
285496,
301883,
201534,
281407,
289599,
295745,
222017,
342846,
293702,
318279,
283466,
281426,
279379,
295769,
201562,
244569,
281434,
322396,
230238,
230239,
301919,
279393,
293729,
275294,
349025,
281444,
279398,
303973,
351078,
177002,
308075,
242540,
310132,
295797,
201590,
207735,
228214,
295799,
279418,
269179,
177018,
308093,
314240,
291713,
158594,
240517,
287623,
228232,
299912,
279434,
320394,
316299,
416649,
252812,
308111,
308113,
293780,
310166,
289691,
209820,
277404,
240543,
283551,
310177,
289699,
189349,
289704,
279465,
293801,
326571,
304050,
177074,
326580,
289720,
326586,
289723,
189373,
213956,
281541,
19398,
213961,
279499,
56270,
191445,
183254,
304086,
183258,
234469,
314343,
304104,
324587,
183276,
289773,
320492,
203758,
320495,
234476,
287730,
277493,
240631,
320504,
214009,
312313,
312315,
312317,
328701,
328705,
234499,
293894,
320520,
230411,
322571,
320526,
330766,
234513,
238611,
140311,
293911,
316441,
197658,
238617,
113710,
189487,
281647,
322609,
312372,
203829,
238646,
300087,
238650,
320571,
21567,
308288,
336962,
160834,
314437,
349254,
238663,
300109,
207954,
234578,
296023,
205911,
314458,
156763,
277600,
281698,
281699,
285795,
214116,
230500,
322664,
228457,
279659,
318571,
234606,
300145,
238706,
279666,
312435,
187508,
300147,
230514,
302202,
285819,
314493,
285823,
150656,
234626,
279686,
222344,
285833,
285834,
318602,
228492,
337037,
234635,
177297,
162962,
187539,
326803,
308375,
324761,
285850,
296091,
119965,
302239,
300192,
330912,
339106,
306339,
234662,
300200,
249003,
238764,
322733,
208044,
302251,
279729,
294069,
300215,
294075,
64699,
228541,
283841,
148674,
283846,
312519,
279752,
283849,
148687,
290001,
189651,
316628,
279766,
189656,
279775,
304352,
298209,
304353,
310496,
279780,
228587,
279789,
290030,
302319,
251124,
316661,
283894,
234741,
208123,
292092,
279803,
228608,
320769,
234756,
322826,
242955,
177420,
312588,
318732,
318746,
245018,
320795,
130342,
304422,
130344,
292145,
298290,
312628,
300342,
159033,
333114,
222523,
333115,
286012,
279872,
181568,
279874,
300355,
294210,
216387,
286019,
193858,
300354,
304457,
230730,
372039,
294220,
296269,
222542,
234830,
238928,
224591,
296274,
314708,
318804,
283990,
314711,
357720,
300378,
300379,
294236,
314721,
292194,
230757,
281958,
134504,
306541,
327023,
296304,
234864,
284015,
314740,
230772,
327030,
310650,
290170,
224637,
306558,
290176,
243073,
179586,
306561,
294278,
314759,
296328,
296330,
298378,
368012,
318860,
304523,
292242,
112019,
306580,
224662,
234902,
282008,
314776,
318876,
282013,
290206,
148899,
314788,
298406,
282023,
314790,
245160,
333224,
241067,
279979,
314797,
279980,
286128,
279988,
173492,
284086,
286133,
284090,
302523,
228796,
310714,
54719,
302530,
280003,
228804,
310725,
306630,
292291,
300488,
415170,
370122,
310731,
306634,
280011,
302539,
310735,
339403,
329168,
222674,
327122,
280020,
329170,
312785,
280025,
310747,
239069,
144862,
286176,
187877,
320997,
310758,
280042,
280043,
191980,
329198,
337391,
282097,
308722,
296434,
306678,
40439,
288248,
191991,
286201,
300539,
288252,
312830,
290304,
286208,
245249,
228868,
292359,
218632,
302602,
230922,
323083,
294413,
304655,
323088,
329231,
282132,
230933,
302613,
282135,
316951,
374297,
302620,
313338,
282147,
222754,
306730,
245291,
312879,
230960,
288305,
239159,
290359,
323132,
235069,
157246,
288319,
288322,
280131,
349764,
310853,
282182,
124486,
288328,
286281,
292426,
194118,
333389,
224848,
224852,
290391,
128600,
306777,
196184,
235096,
239192,
212574,
204386,
300643,
300645,
282214,
312937,
224874,
243306,
204394,
312941,
206447,
310896,
294517,
314997,
288377,
290425,
325246,
235136,
280193,
282244,
239238,
288391,
282248,
286344,
323208,
179853,
286351,
188049,
229011,
239251,
280217,
323226,
179868,
229021,
302751,
282272,
198304,
282279,
298664,
212649,
298666,
317102,
286387,
300725,
337590,
286392,
300729,
302778,
306875,
280252,
280253,
282302,
296636,
286400,
323265,
323262,
280259,
321217,
282309,
321220,
333508,
239305,
280266,
306891,
296649,
212684,
302798,
9935,
282321,
313042,
286419,
241366,
280279,
282330,
18139,
280285,
294621,
282336,
321250,
294629,
153318,
333543,
181992,
12009,
337638,
282347,
288492,
282349,
323315,
67316,
34547,
286457,
284410,
288508,
200444,
282366,
286463,
319232,
278273,
288515,
280326,
282375,
323335,
284425,
300810,
116491,
282379,
280333,
216844,
300812,
284430,
161553,
124691,
284436,
278292,
116502,
118549,
282390,
278294,
325403,
321308,
321309,
282399,
241440,
282401,
325411,
315172,
186149,
186148,
241447,
333609,
286507,
294699,
284460,
280367,
300849,
282418,
280373,
282424,
280377,
321338,
282428,
280381,
345918,
413500,
280386,
280391,
153416,
315209,
325449,
159563,
280396,
307024,
317268,
237397,
307030,
18263,
241494,
188250,
284508,
300893,
307038,
237411,
284515,
276326,
282471,
296807,
292713,
282476,
292719,
296815,
325491,
313204,
333687,
317305,
124795,
317308,
339840,
315265,
280451,
327556,
188293,
243590,
282503,
67464,
305032,
325514,
315272,
315275,
243592,
184207,
311183,
124816,
282517,
294806,
214936,
294808,
337816,
239515,
124826,
214943,
298912,
319393,
333727,
294820,
333734,
219046,
284584,
294824,
298921,
313257,
292783,
126896,
200628,
300983,
343993,
288698,
98240,
294849,
214978,
280517,
280518,
214983,
282572,
282573,
153553,
24531,
231382,
329696,
292835,
6116,
190437,
292838,
294887,
317416,
313322,
278507,
298987,
311277,
296942,
329707,
124912,
278515,
325620,
239610
] |
eba4ca6ccb2817d8ecf327da02d8a4bdec0921c0 | 55ddc219690d9fb00faee691042b1ccbc5dd01ca | /SwiftUrlSessionDemo/ViewController.swift | 55a7bcf2d2f5700d2e81d6c5141626d0341ac0f0 | [] | no_license | rayshen/SwiftUrlSessionDemo | d6f61edef5cf2d35981bf66909b87b4f8a2cc8b2 | 5aebca36237f37d15b15e91e990e5c78bf275b6f | refs/heads/master | 2021-01-10T04:59:39.599856 | 2015-11-26T05:55:24 | 2015-11-26T05:55:24 | 46,843,935 | 3 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,809 | swift | //
// ViewController.swift
// SwiftUrlSessionDemo
//
// Created by shen on 15/11/25.
// Copyright © 2015年 shen. All rights reserved.
//
import UIKit
import Alamofire
class ViewController: UIViewController {
let KScreenWidth=UIScreen.mainScreen().bounds.size.width;
let KScreenHeight=UIScreen.mainScreen().bounds.size.height;
var queryBtn:UIButton!
override func viewDidLoad() {
super.viewDidLoad()
queryBtn = UIButton(frame:CGRectMake(KScreenWidth/2-25, KScreenHeight/2-25, 50, 50))
queryBtn.setTitle("请求", forState:.Normal)
queryBtn.backgroundColor=UIColor.blackColor()
queryBtn.addTarget(self, action: Selector("testGet"), forControlEvents:.TouchUpInside)
self.view.addSubview(queryBtn)
// testGet()
// testPost()
// testUrlSession()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func testGet(){
let para=["account": "shen"];
Alamofire.request(.GET, "http://localhost:8002/getdemo",parameters:para)
.responseJSON{ response in
switch response.result {
case .Success:
//把得到的JSON数据转为字典
if let resDic = response.result.value as? NSDictionary{
//获取字典里面的key为数组
let passwordStr = resDic.valueForKey("password")as! NSString
print(passwordStr)
}
case .Failure(let error):
print(error)
}
}
}
func testPost(){
let para=["postpara1": "postxcode","postpara2":"postnodejs"];
Alamofire.request(.POST, "http://localhost:8002/postdemo",parameters:para)
.responseJSON { response in
//print(response.request) // original URL request
//print(response.response) // URL response
//print(response.data) // server data
//print(response.result) // result of response serialization
if let JSON = response.result.value {
print("postJSON: \(JSON)")
}
}
}
//URLSession方法:
func testUrlSession(){
let session = NSURLSession.sharedSession()
let request = NSURLRequest(URL: NSURL(string: "http://localhost:8002/getdemo?para=session")!)
let task = session.dataTaskWithRequest(request, completionHandler: { (data, response, error) -> Void in
let string = NSString(data: data!, encoding: NSUTF8StringEncoding)
print("returnStr:\(string!)")
})
task.resume()
}
} | [
-1
] |
88851e0a10facd82375adad6d1c0c18489ce24bd | a5b60439866901796bbeae8cb8ea3ec5d25bdc9c | /Cosmos-IOS/Cosmostation/Cosmostation/Cell/ValidatorDetailMyActionCell.swift | bc39dd390f310c57d8ab34a4c7996f99280ddd3c | [
"MIT"
] | permissive | Khaos-Labs/cosmostation-mobile | 2ef4d8d215ba18c279e52675980a701696545da7 | 025c73941a912037bbfa7077709257472e78ca72 | refs/heads/master | 2023-03-18T21:13:00.085969 | 2021-03-05T05:37:17 | 2021-03-05T05:37:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,908 | swift | //
// ValidatorDetailMyActionCell.swift
// Cosmostation
//
// Created by yongjoo on 04/04/2019.
// Copyright © 2019 wannabit. All rights reserved.
//
import UIKit
class ValidatorDetailMyActionCell: UITableViewCell {
@IBOutlet weak var cardView: CardView!
@IBOutlet weak var myDelegateAmount: UILabel!
@IBOutlet weak var myUndelegateAmount: UILabel!
@IBOutlet weak var myRewardAmount: UILabel!
@IBOutlet weak var myDailyReturns: UILabel!
@IBOutlet weak var myMonthlyReturns: UILabel!
@IBOutlet weak var delegateBtn: UIButton!
@IBOutlet weak var undelegateBtn: UIButton!
@IBOutlet weak var redelegateBtn: UIButton!
@IBOutlet weak var claimRewardBtn: UIButton!
@IBOutlet weak var reInvestBtn: UIButton!
override func awakeFromNib() {
super.awakeFromNib()
self.selectionStyle = .none
myDelegateAmount.font = UIFontMetrics(forTextStyle: .footnote).scaledFont(for: Font_13_footnote)
myUndelegateAmount.font = UIFontMetrics(forTextStyle: .footnote).scaledFont(for: Font_13_footnote)
myRewardAmount.font = UIFontMetrics(forTextStyle: .footnote).scaledFont(for: Font_13_footnote)
myDailyReturns.font = UIFontMetrics(forTextStyle: .footnote).scaledFont(for: Font_13_footnote)
myMonthlyReturns.font = UIFontMetrics(forTextStyle: .footnote).scaledFont(for: Font_13_footnote)
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
var actionDelegate: (() -> Void)? = nil
var actionUndelegate: (() -> Void)? = nil
var actionRedelegate: (() -> Void)? = nil
var actionReward: (() -> Void)? = nil
var actionReinvest: (() -> Void)? = nil
@IBAction func onClickDelegate(_ sender: Any) {
actionDelegate?()
}
@IBAction func onClickUndelegate(_ sender: Any) {
actionUndelegate?()
}
@IBAction func onClickRedelegate(_ sender: Any) {
actionRedelegate?()
}
@IBAction func onClickReward(_ sender: Any) {
actionReward?()
}
@IBAction func onClickReInvest(_ sender: Any) {
actionReinvest?()
}
func updateView(_ validator: Validator_V1?, _ chainType: ChainType?) {
cardView.backgroundColor = WUtils.getChainBg(chainType)
if (chainType == ChainType.COSMOS_MAIN || chainType == ChainType.COSMOS_TEST) {
let delegation = BaseData.instance.mMyDelegations_V1.filter { $0.delegation?.validator_address == validator?.operator_address}.first
let unbonding = BaseData.instance.mMyUnbondings_V1.filter { $0.validator_address == validator?.operator_address}.first
let reward = BaseData.instance.mMyReward_V1.filter { $0.validator_address == validator?.operator_address}.first
myDelegateAmount.attributedText = WUtils.displayAmount2(delegation?.getDelegation().stringValue, myDelegateAmount.font, 6, 6)
myUndelegateAmount.attributedText = WUtils.displayAmount2(unbonding?.getAllUnbondingBalance().stringValue, myUndelegateAmount.font, 6, 6)
myRewardAmount.attributedText = WUtils.displayAmount2(reward?.getRewardByDenom(WUtils.getMainDenom(chainType)).stringValue, myRewardAmount.font, 6, 6)
myDailyReturns.attributedText = WUtils.getDailyReward(myDailyReturns.font, validator!.getCommission(), delegation?.getDelegation(), chainType!)
myMonthlyReturns.attributedText = WUtils.getMonthlyReward(myMonthlyReturns.font, validator!.getCommission(), delegation?.getDelegation(), chainType!)
} else if (chainType == ChainType.IRIS_MAIN || chainType == ChainType.IRIS_TEST) {
let delegation = BaseData.instance.mMyDelegations_V1.filter { $0.delegation?.validator_address == validator?.operator_address}.first
let unbonding = BaseData.instance.mMyUnbondings_V1.filter { $0.validator_address == validator?.operator_address}.first
let reward = BaseData.instance.mMyReward_V1.filter { $0.validator_address == validator?.operator_address}.first
myDelegateAmount.attributedText = WUtils.displayAmount2(delegation?.getDelegation().stringValue, myDelegateAmount.font, 6, 6)
myUndelegateAmount.attributedText = WUtils.displayAmount2(unbonding?.getAllUnbondingBalance().stringValue, myUndelegateAmount.font, 6, 6)
myRewardAmount.attributedText = WUtils.displayAmount2(reward?.getRewardByDenom(WUtils.getMainDenom(chainType)).stringValue, myRewardAmount.font, 6, 6)
myDailyReturns.attributedText = WUtils.getDailyReward(myDailyReturns.font, validator!.getCommission(), delegation?.getDelegation(), chainType!)
myMonthlyReturns.attributedText = WUtils.getMonthlyReward(myMonthlyReturns.font, validator!.getCommission(), delegation?.getDelegation(), chainType!)
}
}
}
| [
-1
] |
0a442a3be4fb3de35599f765fd339cdf6c17431e | 8f3641f5ab50e0c410805ed56e6dcb85007b099b | /Kids Tunes/Music Kit API/Model/Resource Objects/Playlist.swift | 29148d2a042297a9577fe060e0f7767724dd1587 | [
"MIT"
] | permissive | assembleinc/kids-tunes-ios | 0ab8a7063f69780c1eaa2769238701178c70a4ef | 2544dd2423f997a099d1dbc31ee34082e2affb37 | refs/heads/master | 2020-05-31T22:00:06.895927 | 2019-06-18T19:17:09 | 2019-06-18T19:17:09 | 190,511,574 | 21 | 1 | MIT | 2019-06-18T19:17:10 | 2019-06-06T04:03:03 | Swift | UTF-8 | Swift | false | false | 2,210 | swift | //
// Playlist.swift
// Kids Tunes
//
// Created by Zack Walkingstick on 5/11/19.
// Copyright © 2019 Assemble. All rights reserved.
//
import Foundation
/**
Apple Music API - A Resource object that represents a playlist.
https://developer.apple.com/documentation/applemusicapi/playlist
*/
public typealias Playlist = Resource<PlaylistAttributes, PlaylistRelationships>
public enum PlaylistType: String, Codable {
/**
A playlist created and shared by an Apple Music user.
*/
case userShared = "user-shared"
/**
A playlist created by an Apple Music curator.
*/
case editorial
/**
A playlist created by a non-Apple curator or brand.
*/
case external
/**
A personalized playlist for an Apple Music user.
*/
case personalMix = "personal-mix"
}
public struct PlaylistAttributes: Codable {
/**
The playlist artwork.
*/
public let artwork: Artwork?
/**
The display name of the curator.
*/
public let curatorName: String?
/**
A description of the playlist.
*/
public let description: EditorialNotes?
/**
(Required) The date the playlist was last modified.
*/
public let lastModifiedDate: String
/**
(Required) The localized name of the album.
*/
public let name: String
/**
The parameters to use to play back the tracks in the playlist.
*/
public let playParams: PlayParameters?
/**
(Required) The type of playlist. Possible values are:
user-shared: A playlist created and shared by an Apple Music user.
editorial: A playlist created by an Apple Music curator.
external: A playlist created by a non-Apple curator or brand.
personal-mix: A personalized playlist for an Apple Music user.
Possible values: user-shared, editorial, external, personal-mix
*/
public let playlistType: PlaylistType
/**
(Required) The URL for sharing an album in the iTunes Store.
*/
public let url: URL
}
public struct PlaylistRelationships: Codable {
// public let curator: Relationship<Curator>
// public let tracks: Relationship<Track>
}
| [
-1
] |
0e6b918561b4fffeeb246240da4d0d5d23107144 | 37aad5f5de31f10b700d59b8d4b60c81c1f4738a | /ACCarTests/ACCarTests.swift | 0b8be1b50094394348eac3f0459acb1d57f65717 | [] | no_license | acavanag/car | c08495587be439512f8688148ca318635b499042 | 6a845dd774680e95231b5dcd35ef74b6f7e74583 | refs/heads/master | 2020-04-13T23:25:44.735298 | 2015-03-14T23:05:19 | 2015-03-14T23:05:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 898 | swift | //
// ACCarTests.swift
// ACCarTests
//
// Created by Andrew Cavanagh on 3/12/15.
// Copyright (c) 2015 WeddingWire. All rights reserved.
//
import UIKit
import XCTest
class ACCarTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
XCTAssert(true, "Pass")
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
// Put the code you want to measure the time of here.
}
}
}
| [
276481,
276484,
276489,
276492,
276509,
276543,
280649,
276555,
223318,
227417,
276581,
43109,
276585,
276589,
227439,
276592,
276606,
276613,
276627,
276631,
227492,
227495,
176314,
276682,
276684,
278742,
155867,
276710,
276715,
157944,
227576,
276737,
276753,
278810,
278856,
278862,
278863,
276822,
276831,
276839,
276847,
278898,
278908,
280961,
178571,
276900,
278951,
278965,
276919,
276920,
278969,
279002,
276958,
276962,
276963,
279019,
276998,
279054,
223769,
277029,
281138,
277048,
369220,
277066,
277083,
189037,
295535,
189042,
189043,
303746,
277133,
225936,
225943,
225944,
164512,
225956,
285353,
225962,
209581,
154294,
225997,
226001,
226004,
226007,
201442,
226019,
226033,
226035,
226036,
226043,
234238,
234241,
226051,
234245,
203529,
234250,
234253,
234256,
234263,
369432,
105246,
228129,
234280,
277289,
234283,
226097,
234289,
162621,
234301,
234304,
234305,
162626,
234311,
277327,
234323,
234326,
277339,
297822,
174949,
234343,
277354,
234346,
277360,
234361,
226170,
234366,
234367,
226181,
213894,
277381,
234377,
226189,
234381,
234395,
234404,
226214,
234409,
275371,
226223,
226227,
234419,
234425,
234430,
275397,
234445,
234450,
234451,
234454,
234457,
234466,
234477,
234492,
234495,
234498,
234503,
277513,
234506,
234509,
275469,
197647,
295953,
234517,
234530,
234531,
234534,
234539,
277550,
275505,
234555,
234560,
207938,
281666,
277574,
277579,
277585,
234583,
234584,
277596,
234594,
277603,
234603,
156785,
275571,
234622,
275585,
275590,
277640,
234632,
302217,
234642,
226451,
226452,
234652,
277665,
275625,
208043,
275628,
226481,
277686,
277690,
277694,
275671,
285929,
120055,
277792,
259363,
277800,
277806,
113966,
226608,
277809,
277814,
277815,
277821,
277824,
277825,
226632,
142669,
277838,
277841,
277844,
277845,
277852,
224605,
218462,
224606,
277856,
142689,
277862,
281962,
277868,
277871,
279919,
277878,
275831,
277882,
277883,
142716,
275839,
226694,
281992,
277897,
277896,
277900,
296338,
277907,
226711,
226712,
277911,
277919,
277920,
277925,
277927,
370091,
277936,
277939,
277940,
277943,
277946,
277952,
277957,
296391,
277962,
277965,
277974,
277977,
277980,
226781,
277983,
277988,
277993,
277997,
278002,
278005,
278008,
278023,
280077,
204313,
278060,
128583,
226888,
276046,
226897,
147036,
370271,
276084,
276085,
278140,
276100,
276101,
312972,
276116,
276120,
280220,
276126,
276129,
278191,
276146,
296628,
276156,
276165,
278214,
276172,
276195,
276210,
278285,
184086,
278299,
276253,
278307,
278316,
165677,
276279,
276282,
276283,
288574,
276298,
188246,
276311,
276318,
276325,
276332,
276350,
40850,
40853,
44952,
276385,
227238,
276394,
276400,
276408,
276421,
276430,
276450,
276454,
276462,
276463,
276468,
276469,
276475,
276478
] |
6799c517f9c50ff80d4ed5fb0d4497a97301790d | e3912b396c44b84905b4bd879eb78a25d0c50943 | 3fe4670444ef3109ec3ac126420840f6ac532850 | [
"MIT"
] | permissive | hublerhubber/EFQRCode | 5687b1cd2fc2741f052e68085f7ec7837a22f539 | 68aecc3ba2f82f3bc8d6970a6cebb89e87b84162 | refs/heads/main | 2023-01-30T01:52:48.393655 | 2020-12-09T02:11:34 | 2020-12-09T02:11:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,935 | swift | // swift-tools-version:5.3
//
// Package.swift
// EFQRCode
//
// Created by EyreFree on 2017/4/1.
//
// Copyright (c) 2017 EyreFree <[email protected]>
//
// 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 PackageDescription
let package = Package(
name: "EFQRCode",
products: [
.library(name: "EFQRCode", targets: ["EFQRCode"])
],
dependencies: [
.package(url: "https://github.com/ApolloZhu/swift_qrcodejs.git",
.upToNextMinor(from: "2.2.2"))
],
targets: [
.target(name: "EFQRCode",
dependencies: [
.product(name: "QRCodeSwift", package: "swift_qrcodejs",
condition: .when(platforms: [.watchOS])),
],
path: "Source",
exclude: ["Info.plist", "Info-tvOS.plist"]),
],
swiftLanguageVersions: [.v5]
)
| [
276231,
201617,
206098,
346276,
420394,
173485,
135854,
144435,
135861,
354359,
245047,
242361,
144442,
144445,
319426,
248524,
112721,
34516,
185428,
285786,
285790,
106720,
34531,
204003,
192229,
185446,
192232,
34538,
227180,
173421,
34541,
185453,
185455,
176370
] |
|
7c3036c4d8e2c191b7494a189a495eead5cb954d | f7ca547a46c2036f35fed43b0577c1a11f2ac1c9 | /LDKSwift/Sources/LDKSwift/structs/AcceptChannel.swift | 89c20f41afd0ee086af0e4fd574b145b2d9d8327 | [] | no_license | PinkDiamond1/ldk-swift-linux | 0e37915744f0a46986e6b3377e58319fd7f8056a | 50d82362f5d944653056cb8cd4571f1ef97df045 | refs/heads/master | 2023-06-27T01:28:20.093149 | 2021-07-30T00:21:32 | 2021-07-30T01:00:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 9,320 | swift | import LDKCHeaders
public class AcceptChannel {
public internal(set) var cOpaqueStruct: LDKAcceptChannel?;
public init(pointer: LDKAcceptChannel){
self.cOpaqueStruct = pointer
}
/* STRUCT_METHODS_START */
public func get_temporary_channel_id() -> [UInt8] {
return Bindings.tuple32_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKAcceptChannel>) in
AcceptChannel_get_temporary_channel_id(this_ptrPointer)
}.pointee);
}
public func set_temporary_channel_id(val: [UInt8]) -> Void {
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
return AcceptChannel_set_temporary_channel_id(this_ptrPointer, Bindings.new_LDKThirtyTwoBytes(array: val));
}
public func get_dust_limit_satoshis() -> UInt64 {
return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKAcceptChannel>) in
AcceptChannel_get_dust_limit_satoshis(this_ptrPointer)
};
}
public func set_dust_limit_satoshis(val: UInt64) -> Void {
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
return AcceptChannel_set_dust_limit_satoshis(this_ptrPointer, val);
}
public func get_max_htlc_value_in_flight_msat() -> UInt64 {
return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKAcceptChannel>) in
AcceptChannel_get_max_htlc_value_in_flight_msat(this_ptrPointer)
};
}
public func set_max_htlc_value_in_flight_msat(val: UInt64) -> Void {
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
return AcceptChannel_set_max_htlc_value_in_flight_msat(this_ptrPointer, val);
}
public func get_channel_reserve_satoshis() -> UInt64 {
return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKAcceptChannel>) in
AcceptChannel_get_channel_reserve_satoshis(this_ptrPointer)
};
}
public func set_channel_reserve_satoshis(val: UInt64) -> Void {
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
return AcceptChannel_set_channel_reserve_satoshis(this_ptrPointer, val);
}
public func get_htlc_minimum_msat() -> UInt64 {
return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKAcceptChannel>) in
AcceptChannel_get_htlc_minimum_msat(this_ptrPointer)
};
}
public func set_htlc_minimum_msat(val: UInt64) -> Void {
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
return AcceptChannel_set_htlc_minimum_msat(this_ptrPointer, val);
}
public func get_minimum_depth() -> UInt32 {
return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKAcceptChannel>) in
AcceptChannel_get_minimum_depth(this_ptrPointer)
};
}
public func set_minimum_depth(val: UInt32) -> Void {
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
return AcceptChannel_set_minimum_depth(this_ptrPointer, val);
}
public func get_to_self_delay() -> UInt16 {
return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKAcceptChannel>) in
AcceptChannel_get_to_self_delay(this_ptrPointer)
};
}
public func set_to_self_delay(val: UInt16) -> Void {
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
return AcceptChannel_set_to_self_delay(this_ptrPointer, val);
}
public func get_max_accepted_htlcs() -> UInt16 {
return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKAcceptChannel>) in
AcceptChannel_get_max_accepted_htlcs(this_ptrPointer)
};
}
public func set_max_accepted_htlcs(val: UInt16) -> Void {
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
return AcceptChannel_set_max_accepted_htlcs(this_ptrPointer, val);
}
public func get_funding_pubkey() -> [UInt8] {
return Bindings.LDKPublicKey_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKAcceptChannel>) in
AcceptChannel_get_funding_pubkey(this_ptrPointer)
});
}
public func set_funding_pubkey(val: [UInt8]) -> Void {
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
return AcceptChannel_set_funding_pubkey(this_ptrPointer, Bindings.new_LDKPublicKey(array: val));
}
public func get_revocation_basepoint() -> [UInt8] {
return Bindings.LDKPublicKey_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKAcceptChannel>) in
AcceptChannel_get_revocation_basepoint(this_ptrPointer)
});
}
public func set_revocation_basepoint(val: [UInt8]) -> Void {
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
return AcceptChannel_set_revocation_basepoint(this_ptrPointer, Bindings.new_LDKPublicKey(array: val));
}
public func get_payment_point() -> [UInt8] {
return Bindings.LDKPublicKey_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKAcceptChannel>) in
AcceptChannel_get_payment_point(this_ptrPointer)
});
}
public func set_payment_point(val: [UInt8]) -> Void {
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
return AcceptChannel_set_payment_point(this_ptrPointer, Bindings.new_LDKPublicKey(array: val));
}
public func get_delayed_payment_basepoint() -> [UInt8] {
return Bindings.LDKPublicKey_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKAcceptChannel>) in
AcceptChannel_get_delayed_payment_basepoint(this_ptrPointer)
});
}
public func set_delayed_payment_basepoint(val: [UInt8]) -> Void {
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
return AcceptChannel_set_delayed_payment_basepoint(this_ptrPointer, Bindings.new_LDKPublicKey(array: val));
}
public func get_htlc_basepoint() -> [UInt8] {
return Bindings.LDKPublicKey_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKAcceptChannel>) in
AcceptChannel_get_htlc_basepoint(this_ptrPointer)
});
}
public func set_htlc_basepoint(val: [UInt8]) -> Void {
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
return AcceptChannel_set_htlc_basepoint(this_ptrPointer, Bindings.new_LDKPublicKey(array: val));
}
public func get_first_per_commitment_point() -> [UInt8] {
return Bindings.LDKPublicKey_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKAcceptChannel>) in
AcceptChannel_get_first_per_commitment_point(this_ptrPointer)
});
}
public func set_first_per_commitment_point(val: [UInt8]) -> Void {
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
return AcceptChannel_set_first_per_commitment_point(this_ptrPointer, Bindings.new_LDKPublicKey(array: val));
}
public func clone(orig: AcceptChannel) -> AcceptChannel {
return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKAcceptChannel>) in
AcceptChannel(pointer: AcceptChannel_clone(origPointer))
};
}
public func write(obj: AcceptChannel) -> [UInt8] {
return Bindings.LDKCVec_u8Z_to_array(nativeType: withUnsafePointer(to: obj.cOpaqueStruct!) { (objPointer: UnsafePointer<LDKAcceptChannel>) in
AcceptChannel_write(objPointer)
});
}
public func read(ser: [UInt8]) -> Result_AcceptChannelDecodeErrorZ {
return Result_AcceptChannelDecodeErrorZ(pointer: AcceptChannel_read(Bindings.new_LDKu8slice(array: ser)));
}
deinit {
if self.cOpaqueStruct?.is_owned == false {
AcceptChannel_free(self.cOpaqueStruct!)
}
}
/* STRUCT_METHODS_END */
}
| [
-1
] |
5067bdc754930f97b731aa423d4891f15f82bf51 | 8ad8964f756176466f102e328da1b1c101055125 | /DietDiary/Classes/MemoryData.swift | 3cc2d8b5bac03d60899b39a2c22500af088388c9 | [] | no_license | AliciaChiu/DietDiary | eb87b7de81f6ad3dce271c7c9cef3f459358eaa0 | 98f84e9c3b6974a00c44f2be2506e109c4d1cd5b | refs/heads/master | 2023-04-18T16:24:18.383373 | 2021-05-09T09:09:46 | 2021-05-09T09:09:46 | 337,434,456 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 262 | swift | //
// Data.swift
// foodlist
//
// Created by Kevin on 2020/12/26.
//
import Foundation
class MemoryData {
static var foods: [Food] = []
static var userInfo: UserInformation?
static var record = Record()
static var post = Post()
}
| [
-1
] |
7995cd13f3aef207dda1c870d712d2c22e7e3017 | 3d144a23e67c839a4df1c073c6a2c842508f16b2 | /test/SILGen/Inputs/ObjectiveC.swift | e0c7f352059f6546fda126e0437090bfb7598405 | [
"Apache-2.0",
"Swift-exception"
] | permissive | apple/swift | c2724e388959f6623cf6e4ad6dc1cdd875fd0592 | 98ada1b200a43d090311b72eb45fe8ecebc97f81 | refs/heads/main | 2023-08-16T10:48:25.985330 | 2023-08-16T09:00:42 | 2023-08-16T09:00:42 | 44,838,949 | 78,897 | 15,074 | Apache-2.0 | 2023-09-14T21:19:23 | 2015-10-23T21:15:07 | C++ | UTF-8 | Swift | false | false | 957 | swift | // Fake ObjectiveC module for testing String/NSString bridging.
@_exported import ObjectiveC
public struct ObjCBool {
var value : UInt8
public var boolValue: Bool {
if value == 0 { return false }
return true
}
}
@_silgen_name("swift_BoolToObjCBool")
public func _convertBoolToObjCBool(_ x: Bool) -> ObjCBool
@_silgen_name("swift_ObjCBoolToBool")
public func _convertObjCBoolToBool(_ x: ObjCBool) -> Bool
public struct Selector : ExpressibleByStringLiteral {
private var ptr : OpaquePointer
public init(unicodeScalarLiteral value: String) {
self.init(stringLiteral: value)
}
public init(extendedGraphemeClusterLiteral value: String) {
self.init(stringLiteral: value)
}
public init (stringLiteral value: String) {
self = sel_registerName(value)
}
}
extension NSObject : Hashable {
public func hash(into hasher: inout Hasher) {}
public static func == (x: NSObject, y: NSObject) -> Bool { return true }
}
| [
90498,
72837,
85910
] |
55301649bce76f6484256ce4e4c21630628290a8 | e56a2c8bde0fefdc6a7c56f574f0b952bf8f5d4a | /iOS10bookExamples/bk1ch05p239loops/bk1ch05p239loops/ViewController.swift | c5b1211f150d396adf505f861347c1fd5bc415e9 | [] | no_license | irshadpc/Programming-iOS-Book-Examples | 8862c9e1e29a3b3bee0c0e9c193ac7bf46de52e5 | 784a08a6f906a2b22319e3b2c28d3a34dacfa274 | refs/heads/master | 2021-01-13T12:27:05.866419 | 2019-12-05T20:38:39 | 2019-12-05T20:38:39 | 227,116,823 | 1 | 0 | null | 2019-12-10T12:35:59 | 2019-12-10T12:35:58 | null | UTF-8 | Swift | false | false | 10,076 | swift |
import UIKit
enum Error {
case number(Int)
case message(String)
case fatal
}
class ViewController: UIViewController {
var movenda = [1,2,3]
var movenda2 = [1,2,3]
var boardView = UIView()
var tiles : [UIView] = []
var centers : [CGPoint] = []
override func viewDidLoad() {
super.viewDidLoad()
do {
while self.movenda.count > 0 {
let p = self.movenda.removeLast()
// ...
print(p)
}
}
do {
while let p = self.movenda2.popLast() {
print(p)
}
}
do {
let tvc = UITableViewCell()
let subview1 = UIView()
let subview2 = UITextField()
tvc.addSubview(subview1)
subview1.addSubview(subview2)
let textField = subview2
var v : UIView = textField
repeat { v = v.superview! } while !(v is UITableViewCell)
if let c = v as? UITableViewCell {
print("got it \(c)")
} else {
print("nope")
}
}
do {
let tvc = UITableViewCell()
let subview1 = UIView()
let subview2 = UITextField()
tvc.addSubview(subview1)
subview1.addSubview(subview2)
let textField = subview2
var v : UIView = textField
// v = tvc // try this to prove that we can cycle up to the top safely
while let vv = v.superview, !(vv is UITableViewCell) {v = vv}
if let c = v.superview as? UITableViewCell {
print("got it \(c)")
} else {
print("nope, but at least we didn't crash")
}
}
do {
let tvc = UITableViewCell()
let subview1 = UIView()
let subview2 = UITextField()
tvc.addSubview(subview1)
subview1.addSubview(subview2)
let textField = subview2
var v : UIView? = textField
repeat {v = v?.superview} while !(v is UITableViewCell || v == nil)
if let c = v as? UITableViewCell {
print("got it \(c)")
} else {
print("nope")
}
}
do {
let arr : [Error] = [
.message("ouch"), .message("yipes"), .number(10),
.number(-1), .fatal
]
var i = 0
// removed use of i++, deprecated in Swift 2.2, to be removed in Swift 3
while case let .message(message) = arr[i] {
print(message)
i += 1
}
print(arr)
}
// this _entire_ construct is deprecated in Swift 2.2, to be removed in Swift 3
/*
do {
for var i = 1; i < 6; i++ {
print(i)
}
}
*/
do {
for i in 1...5 {
print(i)
}
}
do {
for var i in 1...5 { // for var still legal
// removed use of i++, deprecated in Swift 2.2, to be removed in Swift 3
i = i + 1
print(i)
}
}
do {
var g = (1...5).makeIterator()
while let i = g.next() {
print(i)
}
}
do {
for v in self.boardView.subviews {
v.removeFromSuperview()
}
}
do {
let p = Pep()
for boy in p.boys() as! [String] { // boys() doesn't provide type info
let s = "One pep boy is " + boy
print(s)
}
}
do {
for (i,v) in self.tiles.enumerated() {
v.center = self.centers[i]
}
}
do {
for i in 0...10 where i % 2 == 0 { // new in Swift 2.0
print(i)
}
}
do {
for i in stride(from:10, through: 0, by: -2) {
print(i) // 10, 8, 6, 4, 2, 0
}
}
do {
let range = (0...10).reversed().filter{$0 % 2 == 0}
for i in range {
print(i) // 10, 8, 6, 4, 2, 0
}
}
// new in Swift 3 is "sequence"; it generates the next based on the current
// it is lazy and theoretically infinite...
// so either take a prefix or return nil to stop it
do {
let seq = sequence(first:1) {$0 >= 10 ? nil : $0 + 1}
for i in seq {
print(i) // 1,2,3,4,5,6,7,8,9,10
}
let seq2 = sequence(first:1) {$0 + 1}
for i in seq2.prefix(5) {
print(i) // 1,2,3,4,5
}
}
do {
// form 1
let directions = sequence(first:1) {$0 * -1}
print(Array(directions.prefix(10)))
// [1, -1, 1, -1, 1, -1, 1, -1, 1, -1]
// i.e. first 10 elements of an infinite series alternating between 1 and -1
// form 2; the state is an inout param to the function
// in this example we use it as a scratchpad to maintain the most recent pair
let fib = sequence(state:(0,1)) {
(pair: inout (Int,Int)) -> Int in
let n = pair.0 + pair.1
pair = (pair.1,n)
return n
}
for i in fib.prefix(10) {
print(i)
}
// i.e. the first 10 elements of the fibonacci sequence
}
do {
let arr1 = ["CA", "MD", "NY", "AZ"]
let arr2 = ["California", "Maryland", "New York"]
var d = [String:String]()
for (s1,s2) in zip(arr1,arr2) {
d[s1] = s2
} // now d is ["MD": "Maryland", "NY": "New York", "CA": "California"]
print(d)
}
do {
let arr : [Error] = [
.message("ouch"), .message("yipes"), .number(10),
.number(-1), .fatal
]
for case let .number(i) in arr {
print(i) // 10, -1
}
}
do {
let arr : [Any] = ["hey", 1, "ho"]
for case let s as String in arr {
print(s)
}
}
// this _entire_ construct is deprecated in Swift 2.2, to be removed in Swift 3
/*
do {
var i : Int
for i = 1; i < 6; i++ {
print(i)
}
}
do {
for var i = 1; i < 6; i++ {
print(i)
}
}
do {
let tvc = UITableViewCell()
let subview1 = UIView()
let subview2 = UITextField()
tvc.addSubview(subview1)
subview1.addSubview(subview2)
let textField = subview2
var v : UIView
for v = textField; !(v is UITableViewCell); v = v.superview! {}
print(v)
}
*/
// this is my one example where the loss of C-style for loops is really a pity
// it was great being able to do two things in the prep line
/*
do {
var values = [0.0]
for (var i = 20, direction = 1.0; i < 60; i += 5, direction *= -1) {
values.append(direction * M_PI / Double(i))
}
print(values) // [0.0, 0.15707963267948966, -0.12566370614359174, 0.10471975511965977, -0.089759790102565518, 0.078539816339744828, -0.069813170079773182, 0.062831853071795868, -0.057119866428905326]
}
*/
// here's one workaround
do {
var values = [0.0]
var direction = 1.0
for i in stride(from: 20, to: 60, by: 5) {
values.append(direction * .pi / Double(i))
direction *= -1
}
print(values)
}
// this is Swiftier and tighter, but a lot harder to understand
do {
var values = [0.0]
for (ix,i) in stride(from: 20, to: 60, by: 5).enumerated() {
values.append((ix % 2 == 1 ? -1.0 : 1.0) * .pi / Double(i))
}
print(values)
}
// perhaps this is clearest
// we can use sequence to generate the alternating positive-negative
do {
let directions = sequence(first:1) {$0 * -1}
let bases = stride(from: 20, to: 60, by: 5)
let values = zip(bases, directions).map {Double($1) * .pi / Double($0)}
print(values) // same as previous but without the initial 0.0
}
do {
for i in 1...5 {
for j in 1...5 {
print("\(i), \(j);")
break
}
}
outer: for i in 1...5 {
for j in 1...5 {
print("\(i), \(j);")
break outer
}
}
}
do { // new in 2.0, you can break to an "if" or "do"
test: if true {
for i in 1...5 {
for j in 1...5 {
print("\(i), \(j);")
break test
}
}
}
}
test2: do { // new in 2.0, you can break from within an "if", but only a label break
var ok : Bool { return true }
if ok {
print("step one")
break test2
}
print("step two")
}
}
}
| [
-1
] |
86cbc60386660d20ebee1a44fd66025a07ee8382 | dbb424a9485ff63384ef20d92638f6250c6077a1 | /BlinkPractice/AppDelegate.swift | e3bea566d1e7b98ce6e4551ad2114ae23364c11d | [] | no_license | manish-1612/BlinkPractice | 6a9ab2e5a3dccea868a988ae78d345a9d58e59f8 | 08608e1fda969263535ea7b8a25dc689ece54bad | refs/heads/master | 2021-01-10T07:51:27.375338 | 2015-12-08T15:35:49 | 2015-12-08T15:35:49 | 47,414,759 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,166 | swift | //
// AppDelegate.swift
// BlinkPractice
//
// Created by Manish Kumar on 04/12/15.
// Copyright © 2015 Innofied Solutions Pvt. Ltd. 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,
294924,
229388,
278542,
327695,
229391,
278545,
229394,
278548,
229397,
229399,
229402,
278556,
229405,
278559,
229408,
278564,
294950,
229415,
229417,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
229432,
319544,
204856,
286776,
286791,
237640,
278605,
286797,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
278648,
131192,
237693,
327814,
303241,
417930,
131209,
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,
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,
172552,
172550,
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,
352880,
295538,
172655,
189044,
287349,
172656,
172660,
287355,
287360,
295553,
287365,
311942,
303751,
295557,
352905,
279178,
311946,
287371,
311951,
287377,
311957,
287381,
221850,
287386,
164509,
230045,
295583,
287390,
172705,
287394,
303773,
303780,
172702,
287398,
172707,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
279231,
287423,
328384,
287427,
312006,
107208,
279241,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
279258,
287450,
213724,
189149,
303835,
303838,
279267,
312035,
295654,
279272,
312048,
230128,
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,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
304005,
295813,
304007,
320391,
304009,
213895,
304011,
230284,
304013,
213902,
279438,
295822,
295825,
189329,
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,
312518,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
279781,
304360,
279788,
320748,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
230679,
296215,
230681,
320792,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
222525,
296253,
296255,
312639,
230718,
296259,
378181,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
337244,
222556,
230752,
312676,
230760,
173418,
230763,
410987,
230768,
296305,
312692,
230773,
279929,
304505,
304506,
181626,
181631,
312711,
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,
370130,
288210,
288212,
280021,
288214,
222676,
239064,
288217,
288218,
280027,
288220,
329177,
239070,
288224,
370146,
280034,
280036,
288226,
280038,
288230,
288229,
288232,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
296439,
288250,
402942,
148990,
206336,
296446,
296450,
321022,
230916,
230919,
214535,
370187,
304651,
304653,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
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,
206543,
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,
321311,
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,
296890,
10170,
288700,
296894,
280515,
190403,
296900,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
313340,
288764,
239612,
239617,
313347,
288773,
313358,
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,
223327,
280671,
149601,
149599,
149603,
321634,
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,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
354653,
313700,
280937,
313705,
280940,
190832,
280946,
223606,
313720,
280956,
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,
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,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
306354,
142531,
199877,
289991,
306377,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
298306,
281923,
380226,
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,
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,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
324757,
282261,
298651,
323229,
282269,
323231,
298655,
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,
315249,
315251,
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,
178273,
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,
315397,
241669,
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,
299105,
200801,
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,
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,
291104,
233766,
282931,
307508,
176435,
307510,
332086,
151864,
168245,
315701,
307515,
307518,
282942,
151874,
282947,
282957,
323917,
110926,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
315771,
242043,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
283033,
291226,
242075,
291231,
61855,
283042,
291238,
291241,
127403,
127405,
291247,
127407,
299440,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
127429,
127431,
283080,
176592,
315856,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
291299,
242152,
291305,
127466,
176620,
291314,
291317,
135672,
233979,
291323,
291330,
283142,
135689,
233994,
127497,
291341,
233998,
234003,
234006,
127511,
152087,
283161,
234010,
135707,
242202,
135710,
242206,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
70213,
111193,
284245,
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,
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,
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,
291754,
324522,
226220,
291756,
234414,
324527,
234410,
234417,
291760,
324531,
201650,
226230,
234422,
275384,
324536,
234428,
291773,
226239,
324544,
234431,
234434,
324546,
242623,
226245,
234437,
234439,
324548,
234443,
291788,
275406,
193486,
234446,
193488,
234449,
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,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
234549,
300085,
300088,
234556,
234558,
316479,
234561,
316483,
234563,
308291,
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,
234620,
144506,
234623,
226433,
234627,
275588,
234629,
275594,
234634,
234636,
177293,
234640,
275602,
234643,
226453,
275606,
308373,
275608,
234647,
234650,
234648,
308379,
283805,
234653,
119967,
300189,
234657,
324768,
324766,
242852,
283813,
234661,
300197,
234664,
275626,
234667,
316596,
308414,
234687,
300226,
308418,
226500,
234692,
308420,
283844,
300229,
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,
292192,
316768,
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,
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,
300527,
308720,
259567,
226802,
316917,
292343,
308727,
300537,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
194101,
284215,
194103,
284218,
226877,
284223,
284226,
243268,
284228,
226886,
284231,
128584,
292421,
284234,
276043,
366155,
317004,
284238,
226895,
284241,
194130,
284243,
276052,
276053,
300628,
317015,
292433,
235097,
243290,
284251,
284249,
284253,
300638,
284255,
284247,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
276086,
292470,
292473,
284283,
276093,
284286,
276095,
284288,
292479,
276098,
284290,
325250,
284292,
292485,
292481,
284297,
317066,
284299,
317068,
276109,
284301,
284303,
276114,
284306,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
276137,
317098,
284329,
284331,
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,
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,
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,
161718,
358326,
276410,
276411,
358330,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301015,
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,
325692,
235579,
235581,
178238,
276544,
284739,
292934,
276553,
243785,
350293,
350295,
194649,
227418,
309337,
194654,
227423,
350302,
194657,
227426,
276579,
194660,
350308,
227430,
276583,
292968,
350313,
276586,
309354,
350316,
309348,
276590,
301167,
227440,
350321,
284786,
276595,
301163,
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,
350402,
227522,
301252,
350406,
227529,
309450,
301258,
276685,
276689,
227540,
309462,
301272,
276699,
309468,
194780,
309471,
301283,
317672,
276713,
317674,
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,
178575,
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,
317971,
309779,
309781,
55837,
227877,
227879,
293417,
227882,
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,
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,
293666,
285474,
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,
293876,
293877,
285686,
302073,
285690,
121850,
244731,
293882,
302075,
293887,
277504,
277507,
277511,
277519,
293908,
277526,
293917,
293939,
318516,
277561,
277564,
7232,
310336,
293956,
277573,
228422,
310344,
277577,
293960,
277583,
203857,
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,
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,
302403,
294211,
384328,
277832,
277836,
294221,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
277892,
310659,
327046,
253320,
310665,
277898,
277894,
318858,
277903,
310672,
277905,
351633,
277908,
277917,
310689,
277921,
277923,
130468,
228776,
277928,
277932,
310703,
277937,
130486,
310710,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
64966,
245191,
163272,
310727,
277959,
302534,
277963,
302541,
277966,
302543,
310737,
277971,
277975,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
286188,
310764,
278000,
278003,
310772,
228851,
278006,
40440,
278009,
212472,
286203,
40443,
228864,
40448,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
286240,
146977,
294435,
187939,
40484,
40486,
294439,
286248,
278057,
40488,
286246,
294440,
294443,
294445,
40491,
310831,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
228944,
212560,
400976,
40533,
147032,
40537,
278109,
40541,
40544,
40548,
40550,
40552,
286313,
286312,
40554,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
278150,
310925,
286354,
278163,
302740,
122517,
278168,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
319171,
302789,
294599,
278216,
294601,
302793,
319187,
229076,
286420,
278227,
286425,
319194,
278235,
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,
309346,
294831,
180142,
188340,
40886,
319419,
294844,
294847,
309350,
309352,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
abb38ddb8daa5f6dec4a521a818473ae1856286e | f6bf2e6ee0f8ae5d3ca1fbcf2b438dcc12331f7e | /Hearld_iOS_v2/Classes/Modules/BaseModule/MainTabBarController.swift | fc44289c80f39eac385421e60b54646b4398f3d3 | [] | no_license | sleepyjoker/Herald_iOS_v2 | eaeb8da74e8a2340274b2eb6c6828659a18abc67 | d50f0ebaff138807ee2131c76056d88b5cc008ea | refs/heads/master | 2021-04-26T22:22:33.488478 | 2018-05-15T16:42:53 | 2018-05-15T16:42:53 | 120,626,459 | 0 | 0 | null | 2018-02-07T14:36:12 | 2018-02-07T14:36:12 | null | UTF-8 | Swift | false | false | 4,405 | swift | //
// MainTabBarController.swift
// Hearld_iOS_v2
//
// Created by Nathan on 23/10/2017.
// Copyright © 2017 Nathan. All rights reserved.
//
import UIKit
import RxCocoa
import RxSwift
class MainTabBarController: UITabBarController {
let bag = DisposeBag()
override func viewDidLoad() {
super.viewDidLoad()
// 初始化基界面
self.view.tintColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
self.view.backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
setNavigationBar()
// 订阅是否登录的信息
isLoginVariable.asObservable().subscribe(
onNext:{ isLogin in
if isLogin {
self.navigationItem.leftBarButtonItem = nil
}else{
let leftBarButton = UIBarButtonItem(title: "登录", style: .plain, target: self, action: #selector(self.presentLoginVC))
leftBarButton.tintColor = #colorLiteral(red: 0.1764705926, green: 0.4980392158, blue: 0.7568627596, alpha: 1)
self.navigationItem.leftBarButtonItem = leftBarButton
}
}
).addDisposableTo(bag)
// 去除 TabBar 上的横线
tabBar.clipsToBounds = true
tabBar.isTranslucent = false
self.setViewControllers([HomeViewController(),ActivityViewController(),MineViewController()], animated: false)
self.setCustomItem(title: "首页", image: #imageLiteral(resourceName: "tab_home"), selectedImage: #imageLiteral(resourceName: "tab_home"), index: 0)
self.setCustomItem(title: "活动", image: #imageLiteral(resourceName: "tab_home"), selectedImage: #imageLiteral(resourceName: "tab_home"), index: 1)
self.setCustomItem(title: "我的", image: #imageLiteral(resourceName: "tab_mine"), selectedImage: #imageLiteral(resourceName: "tab_mine"), index: 2)
// 修改 TabBar 高亮图标的颜色
tabBar.tintColor = #colorLiteral(red: 0.1098039216, green: 0.6784313725, blue: 0.7843137255, alpha: 1)
}
func getHeight() -> CGFloat{
return tabBar.frame.height
}
func getWidth() -> CGFloat{
return tabBar.frame.width
}
private func setCustomItem(title:String?, image: UIImage?, selectedImage: UIImage?, index : Int){
guard let image = image,let selectedImage = selectedImage else {
return
}
let resizeImage = image.reSizeImage(reSize: CGSize(width: 29, height: 29)).withRenderingMode(.alwaysOriginal)
let resizeSelectedImage = selectedImage.reSizeImage(reSize: CGSize(width: 29, height: 29)).withRenderingMode(.alwaysOriginal)
let item = UITabBarItem(title: title, image: resizeImage, selectedImage: resizeSelectedImage)
item.imageInsets = UIEdgeInsets(top: 5, left: 0, bottom: -5, right: 0)
self.viewControllers?[index].tabBarItem = item
}
private func setNavigationBar() {
let rightBarButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.add, target: self, action: nil)
rightBarButton.tintColor = #colorLiteral(red: 0.1764705926, green: 0.4980392158, blue: 0.7568627596, alpha: 1)
// 自定义返回按钮
let backBarButton = UIBarButtonItem(title: "", style: .done, target: self, action: nil)
backBarButton.tintColor = #colorLiteral(red: 0.1764705926, green: 0.4980392158, blue: 0.7568627596, alpha: 1)
let titleButton = UIButton(frame: CGRect(x: 0, y: 0, width: 200, height: 30))
let title = "小猴偷米"
let attibutesTitle = NSMutableAttributedString.init(string: title)
let length = (title as NSString).length
let titleRange = NSRange(location: 0,length: length)
attibutesTitle.addAttributes(TextAttributesHelper.titleTextAttributes, range: titleRange)
titleButton.setAttributedTitle(attibutesTitle, for: .normal)
self.navigationItem.rightBarButtonItem = rightBarButton
self.navigationItem.backBarButtonItem = backBarButton
self.navigationItem.titleView = titleButton
}
@objc func presentLoginVC() {
let loginVC = LoginViewController()
self.navigationController?.pushViewController(loginVC, animated: true)
}
}
| [
-1
] |
a49508645119837dd168620ffdd14f06e59cc532 | 7bb5b35bd7350cedb57397f8921a784e61080e23 | /Paths/Paths/AppDelegate.swift | 2dbf3bfdeba8d42a0f57156e83e28d0ba004ceb8 | [] | no_license | thachgiasoft/SwiftUI-labs | 2bf22bcebbca2370023ae02a543bd82a90b6c874 | 1b41c9247f8ec08cbc90c430db44f3e2374749a2 | refs/heads/master | 2020-12-18T18:53:42.062235 | 2019-10-21T11:54:53 | 2019-10-21T11:54:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,417 | swift | //
// AppDelegate.swift
// Paths
//
// Created by EDGARDO AGNO on 15/10/2019.
// Copyright © 2019 EDGARDO AGNO. 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,
368752,
262283,
377012,
327871,
180416,
377036,
180431,
377046,
377060,
327914,
205036,
393456,
393460,
336123,
418043,
336128,
385280,
262404,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
262472,
344403,
213332,
65880,
418144,
262496,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
328206,
410128,
393747,
254490,
188958,
385570,
33316,
197159,
377383,
352821,
188987,
418363,
369223,
385609,
385616,
352856,
352864,
369253,
262760,
352874,
352887,
254587,
336512,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
328378,
164538,
328386,
344776,
352968,
418507,
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,
197468,
361309,
361315,
361322,
328573,
377729,
369542,
361360,
222128,
345035,
345043,
386003,
386011,
386018,
386022,
435187,
328702,
328714,
361489,
386069,
336921,
386073,
336925,
345118,
377887,
328746,
345138,
386101,
197707,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
386258,
328924,
66782,
222437,
328941,
386285,
386291,
345376,
353570,
345379,
410917,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181654,
230809,
181670,
181673,
337329,
181681,
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,
214610,
419410,
345701,
394853,
222830,
370297,
403070,
403075,
198280,
345736,
345749,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
337592,
419512,
419517,
337599,
419527,
419530,
419535,
272081,
394966,
419542,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
141051,
337659,
337668,
362247,
395021,
362255,
321299,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
345930,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
345964,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436132,
337833,
362413,
337844,
346057,
247759,
346063,
329697,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
329832,
329855,
329867,
329885,
411805,
346272,
100524,
387249,
379066,
387260,
256191,
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,
354727,
338352,
330189,
338381,
338386,
338403,
338409,
248308,
199164,
330252,
199186,
420376,
330267,
354855,
10828,
199249,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
355028,
273108,
264918,
183005,
436962,
338660,
338664,
264941,
207619,
264964,
338700,
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,
330710,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
396328,
158761,
199728,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
183383,
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,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
249214,
175486,
175489,
249218,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
396722,
388542,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
249308,
339420,
339424,
339428,
339434,
249328,
69113,
372228,
339461,
208398,
380432,
175635,
339503,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
372353,
224897,
216707,
339588,
126596,
421508,
224904,
224909,
159374,
11918,
339601,
126610,
224913,
224916,
224919,
126616,
208538,
224922,
224926,
224929,
224932,
224936,
224942,
257712,
224947,
257716,
224953,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
224993,
257761,
257764,
224999,
339695,
225012,
257787,
225020,
339710,
257790,
225025,
257794,
339721,
257801,
257804,
225038,
257807,
225043,
167700,
372499,
225048,
257819,
225053,
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,
225148,
257916,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
405533,
430129,
217157,
421960,
356439,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
225475,
389320,
225484,
225487,
225490,
225493,
266453,
225496,
225499,
225502,
225505,
356578,
217318,
225510,
225514,
225518,
372976,
381176,
389380,
356637,
356640,
356643,
356646,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
348502,
250199,
250202,
332125,
250210,
348525,
332152,
250238,
389502,
332161,
356740,
332172,
373145,
340379,
389550,
324030,
266687,
340451,
160234,
127471,
340472,
324094,
266754,
324099,
324102,
324111,
340500,
324117,
324131,
332324,
381481,
324139,
356907,
324142,
356916,
324149,
324155,
348733,
324160,
324164,
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,
373510,
389926,
152370,
348978,
340789,
348982,
398139,
127814,
357206,
389978,
357211,
357214,
201579,
201582,
349040,
340849,
201588,
430965,
381813,
324472,
398201,
119674,
324475,
430972,
340861,
324478,
340858,
324481,
373634,
398211,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
422816,
324513,
201637,
398245,
324524,
340909,
324533,
5046,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
381946,
349180,
439294,
431106,
209943,
209946,
250914,
357410,
185380,
357418,
209965,
209968,
209971,
209975,
209979,
209987,
209990,
341071,
349267,
250967,
210010,
341091,
210025,
210027,
210030,
210036,
210039,
341113,
210044,
349308,
152703,
160895,
349311,
210052,
349319,
210055,
210067,
210071,
210077,
210080,
210084,
251044,
185511,
210088,
210095,
210098,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
251128,
218360,
275706,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
210260,
259421,
365921,
333154,
251235,
333162,
234866,
390516,
333175,
357755,
251271,
136590,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
366056,
366061,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
333399,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
333498,
333511,
358099,
153302,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
210695,
268041,
210698,
366348,
210706,
399128,
333594,
358191,
366387,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
259938,
399206,
399215,
268143,
358255,
358259,
341876,
333689,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
358339,
333774,
358371,
350189,
350193,
350202,
333818,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
334011,
260289,
350410,
260298,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
325891,
350467,
350475,
194828,
375053,
268559,
350480,
432405,
350486,
350490,
325914,
325917,
350493,
350498,
350504,
358700,
350509,
391468,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
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,
350761,
252461,
334384,
358961,
383536,
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,
326416,
375568,
326441,
326451,
326454,
244540,
326460,
260924,
326467,
244551,
326473,
326477,
326485,
326490,
342874,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
400259,
342915,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
326598,
359366,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
261147,
359451,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
367723,
384107,
187502,
343154,
384114,
212094,
351364,
384135,
384139,
384143,
351381,
384151,
384160,
384168,
367794,
244916,
384181,
367800,
384188,
351423,
326855,
244937,
384201,
253130,
343244,
384208,
146642,
384224,
359649,
343270,
351466,
384246,
351479,
343306,
261389,
359694,
384275,
384283,
245020,
384288,
245029,
171302,
351534,
376110,
245040,
425276,
212291,
384323,
343365,
212303,
367965,
343393,
343398,
367980,
343409,
154999,
253303,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
425649,
155322,
425662,
155327,
245460,
155351,
155354,
212699,
245475,
155363,
245483,
409335,
155393,
155403,
245525,
155422,
360223,
155438,
155442,
155447,
155461,
360261,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
147317,
262005,
262008,
262011,
155516,
155521,
155525,
360326,
376714,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
262045,
155549,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
384977,
393169,
155611,
155619,
253923,
155621,
327654,
253926,
393203,
360438,
253943,
393206,
393212,
155646
] |
5fbdbce29efb8252d8cb6cf862f4bd083bf191a9 | 97a6a6e2dfebd627ff9fffa29377313c2c37cfb6 | /AmsConcurrencyUITests/AmsConcurrencyUITests.swift | 9b0c322f73c9d6a1eed019eaed5e437e9215eb54 | [] | no_license | Kavenon/ams-concurrency | 5017531d6a56cd2f75be87db847d6e058558c1c4 | ad7add5ea5a51072946f1041cf7939c39724e780 | refs/heads/master | 2021-05-12T06:18:49.837381 | 2018-01-15T22:08:40 | 2018-01-15T22:08:40 | 117,217,117 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,282 | swift | //
// AmsConcurrencyUITests.swift
// AmsConcurrencyUITests
//
// Created by Użytkownik Gość on 12.01.2018.
// Copyright © 2018 Użytkownik Gość. All rights reserved.
//
import XCTest
class AmsConcurrencyUITests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
| [
333827,
243720,
282634,
313356,
155665,
241695,
237599,
292901,
223269,
315431,
229414,
315433,
102441,
325675,
354346,
278571,
124974,
282671,
102446,
229425,
243763,
321589,
241717,
180279,
229431,
215095,
319543,
213051,
288829,
325695,
286787,
288835,
237638,
313415,
239689,
233548,
315468,
311373,
196687,
278607,
311377,
354386,
315477,
223317,
354394,
323678,
315488,
321632,
45154,
315489,
280676,
313446,
215144,
227432,
217194,
194667,
233578,
278637,
307306,
319599,
288878,
278642,
284789,
131190,
249976,
288890,
292987,
215165,
131199,
227459,
235661,
278669,
241809,
323730,
278676,
311447,
327834,
284827,
329884,
278684,
299166,
278690,
233635,
311459,
284840,
299176,
278698,
284843,
184489,
278703,
184498,
278707,
125108,
180409,
280761,
278713,
295099,
227517,
299197,
280767,
258233,
223418,
299202,
139459,
309443,
176325,
131270,
301255,
299208,
227525,
280779,
233678,
282832,
321744,
227536,
301270,
301271,
229591,
280792,
356575,
311520,
325857,
280803,
182503,
338151,
319719,
307431,
295147,
317676,
286957,
125166,
125170,
313595,
125180,
184574,
125184,
125192,
217352,
125197,
125200,
194832,
227601,
325904,
125204,
319764,
278805,
334104,
315674,
282908,
311582,
125215,
299294,
282912,
233761,
278817,
211239,
282920,
125225,
317738,
325930,
311596,
321839,
315698,
98611,
125236,
307514,
278843,
282938,
168251,
287040,
319812,
311622,
227655,
280903,
319816,
323914,
282959,
229716,
289109,
168280,
323934,
391521,
239973,
381286,
285031,
313703,
416103,
280938,
242027,
242028,
321901,
278895,
354672,
287089,
354671,
227702,
199030,
315768,
315769,
291194,
139641,
248188,
223611,
313726,
211327,
291200,
311679,
291193,
240003,
158087,
313736,
227721,
242059,
311692,
285074,
227730,
240020,
190870,
315798,
190872,
291225,
285083,
293275,
317851,
242079,
227743,
285089,
289185,
300490,
305572,
156069,
283039,
293281,
301482,
289195,
311723,
377265,
338359,
299449,
311739,
319931,
293309,
278974,
311744,
317889,
291266,
278979,
278988,
289229,
281038,
326093,
278992,
283089,
373196,
283088,
281039,
279000,
242138,
176602,
285152,
369121,
279009,
291297,
195044,
160224,
279014,
242150,
319976,
279017,
188899,
311787,
281071,
319986,
236020,
279030,
311800,
279033,
317949,
279042,
283138,
233987,
287237,
377352,
322057,
309770,
342537,
279053,
283154,
303635,
303634,
279061,
182802,
188954,
279066,
322077,
291359,
227881,
293420,
289328,
283185,
236080,
279092,
23093,
234037,
244279,
244280,
338491,
234044,
301635,
309831,
55880,
322119,
377419,
303693,
281165,
301647,
281170,
326229,
309847,
189016,
115287,
111197,
295518,
287327,
242274,
244326,
279143,
279150,
281200,
287345,
313970,
287348,
301688,
189054,
287359,
291455,
297600,
303743,
301702,
164487,
279176,
311944,
334473,
316044,
311948,
184974,
311950,
316048,
316050,
336531,
287379,
295575,
227991,
289435,
303772,
221853,
205469,
285348,
314020,
279207,
295591,
248494,
318127,
293552,
285360,
285362,
299698,
287412,
166581,
295598,
154295,
279215,
342705,
287418,
314043,
303802,
66243,
291529,
287434,
225996,
363212,
287438,
242385,
303826,
164561,
279253,
158424,
230105,
299737,
322269,
342757,
295653,
289511,
230120,
330473,
234216,
285419,
330476,
289517,
279278,
170735,
312046,
215790,
125683,
230133,
199415,
234233,
279293,
205566,
322302,
289534,
299777,
291584,
285443,
228099,
291591,
295688,
346889,
285450,
322312,
312076,
285457,
295698,
166677,
291605,
283418,
285467,
221980,
281378,
234276,
283431,
262952,
262953,
279337,
318247,
318251,
262957,
293673,
164655,
328495,
289580,
301872,
242481,
234290,
303921,
230198,
285493,
285496,
301883,
201534,
281407,
289599,
222017,
295745,
293702,
318279,
283466,
281426,
279379,
295769,
201562,
281434,
234330,
322396,
230238,
275294,
301919,
230239,
279393,
293729,
349025,
303973,
279398,
177002,
308075,
242540,
242542,
310132,
295797,
201590,
207735,
228214,
295799,
177018,
269179,
279418,
308093,
314240,
291713,
158594,
330627,
240517,
287623,
228232,
416649,
279434,
236427,
320394,
316299,
299912,
189327,
234382,
308113,
308111,
293780,
310166,
289691,
209820,
277404,
240543,
283551,
310177,
189349,
289704,
279465,
293801,
304050,
177074,
289720,
289723,
189373,
213956,
281541,
345030,
19398,
213961,
326602,
279499,
56270,
191445,
183254,
304086,
183258,
234469,
340967,
314343,
304104,
324587,
183276,
289773,
203758,
320492,
320495,
234476,
287730,
277493,
240631,
320504,
312313,
312315,
312317,
354342,
234499,
293894,
320520,
230411,
320526,
330766,
234513,
238611,
140311,
293911,
238617,
316441,
197658,
330789,
248871,
132140,
113710,
189487,
281647,
322609,
312372,
203829,
238646,
300087,
238650,
320571,
21567,
308288,
336962,
160834,
314437,
238663,
300109,
207954,
234578,
205911,
296023,
314458,
277600,
281698,
281699,
230500,
285795,
322664,
228457,
279659,
318571,
234606,
300145,
238706,
279666,
312435,
187508,
300147,
230514,
302202,
285819,
314493,
285823,
150656,
279686,
222344,
285833,
318602,
285834,
228492,
337037,
234635,
177297,
162962,
187539,
308375,
324761,
285850,
296091,
119965,
302239,
330912,
300192,
339106,
306339,
234655,
234662,
300200,
249003,
208044,
238764,
322733,
3243,
279729,
294069,
300215,
294075,
339131,
64699,
228541,
283841,
148674,
283846,
312519,
279752,
283849,
148687,
290001,
189651,
316628,
279766,
189656,
279775,
304352,
298209,
304353,
310496,
279780,
228587,
279789,
290030,
302319,
251124,
234741,
283894,
316661,
279803,
292092,
208123,
228608,
320769,
234756,
242955,
177420,
312588,
318732,
126229,
245018,
320795,
318746,
320802,
304422,
130342,
130344,
292145,
298290,
312628,
345398,
300342,
159033,
222523,
286012,
181568,
279872,
279874,
300355,
294210,
216387,
286019,
300354,
304457,
345418,
230730,
294220,
296269,
234830,
224591,
222542,
238928,
296274,
314708,
318804,
283990,
314711,
357720,
300378,
300379,
316764,
294236,
314721,
292194,
230757,
281958,
314727,
134504,
306541,
314734,
284015,
234864,
296304,
316786,
327023,
314740,
312688,
314742,
327030,
230772,
314745,
290170,
310650,
224637,
306558,
290176,
243073,
179586,
306561,
314752,
294278,
314759,
296328,
296330,
298378,
368012,
318860,
314765,
304523,
292242,
279955,
306580,
314771,
224662,
234902,
282008,
314776,
318876,
282013,
290206,
148899,
314788,
314790,
282023,
333224,
298406,
241067,
279980,
314797,
279979,
286128,
173492,
279988,
284086,
286133,
284090,
302523,
310714,
228796,
54719,
415170,
292291,
228804,
302530,
306630,
280003,
300488,
310725,
370122,
339403,
310731,
306634,
280011,
310735,
302539,
312785,
327122,
222674,
280020,
234957,
280025,
310747,
239069,
144862,
286176,
320997,
310758,
187877,
280042,
280043,
191980,
300526,
337391,
282097,
308722,
296434,
306678,
40439,
191991,
288248,
286201,
300539,
288252,
312830,
290304,
286208,
228868,
292359,
218632,
323079,
230922,
302602,
323083,
294413,
329231,
304655,
323088,
282132,
230933,
302613,
282135,
316951,
374297,
302620,
313338,
282147,
222754,
306730,
312879,
230960,
288305,
239159,
290359,
323132,
157246,
288319,
288322,
280131,
349764,
310853,
124486,
282182,
288328,
286281,
292426,
194118,
224848,
290391,
196184,
239192,
306777,
128600,
235096,
212574,
99937,
204386,
323171,
345697,
300643,
282214,
300645,
312937,
204394,
224874,
243306,
312941,
206447,
310896,
294517,
314997,
288377,
290425,
325246,
333438,
235136,
280193,
282244,
239238,
288391,
323208,
282248,
286344,
179853,
286351,
188049,
239251,
229011,
280217,
323226,
179868,
229021,
302751,
282272,
198304,
245413,
282279,
298664,
212649,
298666,
317102,
286387,
300725,
337590,
286392,
302778,
306875,
280252,
280253,
282302,
296636,
286400,
323265,
280259,
333508,
282309,
321220,
296649,
239305,
306891,
280266,
212684,
302798,
9935,
241360,
282321,
333522,
286419,
241366,
280279,
282330,
18139,
280285,
294621,
282336,
325345,
321250,
294629,
153318,
333543,
12009,
282347,
288492,
282349,
323315,
67316,
34547,
286457,
284410,
288508,
282366,
286463,
319232,
278273,
288515,
280326,
282375,
323335,
284425,
300810,
116491,
282379,
280333,
216844,
284430,
161553,
124691,
284436,
278292,
278294,
282390,
116502,
118549,
325403,
321308,
321309,
282399,
241440,
282401,
186148,
186149,
315172,
241447,
333609,
294699,
286507,
284460,
280367,
300849,
282418,
280373,
282424,
280377,
321338,
319289,
282428,
280381,
345918,
241471,
413500,
280386,
325444,
280391,
153416,
325449,
315209,
159563,
280396,
307024,
337746,
317268,
325460,
307030,
237397,
18263,
241494,
188250,
284508,
300893,
237411,
284515,
276326,
282471,
296807,
292713,
282476,
292719,
296815,
313200,
313204,
317305,
124795,
317308,
339840,
182145,
315265,
280451,
325508,
333700,
243590,
282503,
67464,
327556,
188293,
325514,
243592,
305032,
315272,
184207,
311183,
124816,
315275,
282517,
294806,
214936,
337816,
294808,
329627,
239515,
214943,
298912,
319393,
294820,
219046,
333734,
294824,
298921,
284584,
313257,
292783,
126896,
300983,
343993,
288698,
98240,
294849,
214978,
280517,
280518,
214983,
282572,
282573,
153553,
24531,
231382,
329696,
323554,
292835,
190437,
292838,
294887,
317416,
313322,
278507,
329707,
311277,
296942,
298987,
124912,
327666,
278515,
325620,
239610
] |
dffa8b43c7485acebebebd32f1f7366b258433a9 | b1e3a70a2406d0c345f49d77853bde39c8c6d9c3 | /HashTagApp/HTMainViewController.swift | 5e97ac87d6423a6ebe8ee398ba7081b531a5f1b6 | [] | no_license | keithcaff/HashTagApp | 2088bff658c9671344352d7b09f412375bb93962 | 44bb7130e2b6e90874d8b77fdc2c847154a57eb9 | refs/heads/master | 2021-04-30T17:20:57.282528 | 2017-05-29T21:06:05 | 2017-05-29T21:06:05 | 80,291,521 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 14,779 | swift | //
// HTMainViewController.swift
// HashTagApp
//
// Created by Keith Caffrey on 28/01/2017.
// Copyright © 2017 Keith Caffrey. All rights reserved.
//
import UIKit
import GoogleSignIn
import Firebase
import TwitterKit
import InstagramKit
import Kingfisher
import SWRevealViewController
class HTMainViewController: UIViewController, UISearchBarDelegate, UITableViewDelegate, UITableViewDataSource, HTInstagramLoginDelegate {
static var displayConnectInstagramAlert = true
@IBOutlet weak var menuButton: UIBarButtonItem!
private let refreshControl: UIRefreshControl = UIRefreshControl()
private let searchBar:UISearchBar = UISearchBar()
var searchTimer:Timer?
var datasource:[Any] = [Any]()
var isInstagramConnected: Bool = false;
var twitterSearchMetaData : [String : Any]?
var instagramSearchMetaData : [String : Any]?
var busyCell: HTBusyTableViewCell?
var instagramLoading: Bool = false
var lastSearchText: String = ""
var twitterLoading: Bool = false
let instagramMetaDataKey = "instagramMetaDataKey"
let twitterMetaDataKey = "twitterMetaDataKey"
let tweetCellIdentifer = "tweetCell"
let busyCellIdentifer = "busyCell"
let instagramImageCellIdentifer = "instagramImageCell"
let refreshControlTintColor = UIColor(red:0.25, green:0.72, blue:0.85, alpha:1.0)
@IBOutlet weak var tableView: UITableView!
var searchTwitterViewController:HTSearchTwitterViewController?
override func viewDidLoad() {
super.viewDidLoad()
//notifications setup
NotificationCenter.default.addObserver(self, selector: #selector(HTMainViewController.handleTweetsRetrievedNotification(_ :)), name: .tweetsRetrieved, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(HTMainViewController.handleInstagramMediaRetrievedNotification(_ :)), name: .instagramMediaRetrieved, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(HTMainViewController.handleInstagramMediaRetrievalFailedNotification(_ :)), name: .instagramMediaRetrievalFailed, object: nil)
//searchBarSetup
searchBar.delegate = self
searchBar.showsCancelButton = false
searchBar.placeholder = "Search a hashtag"
self.navigationItem.titleView = self.searchBar
self.navigationController?.isNavigationBarHidden = false
//menuButtonSetup
if revealViewController() != nil {
menuButton.target = revealViewController()
menuButton.action = #selector(SWRevealViewController.revealToggle(_:))
view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
}
//tableViewSetup
registerXibs()
tableView.delegate = self;
tableView.dataSource = self;
searchTwitterViewController = HTSearchTwitterViewController()
tableView.estimatedRowHeight = 220
tableView.rowHeight = UITableViewAutomaticDimension
tableView.allowsSelection = false
// Configure Refresh Control
let attributes = [ NSForegroundColorAttributeName : refreshControlTintColor ] as [String: Any]
refreshControl.tintColor = refreshControlTintColor
refreshControl.attributedTitle = NSAttributedString(string: "Fetching results ...", attributes: attributes)
refreshControl.addTarget(self, action: #selector(HTMainViewController.fetchMoreData(sender:)), for: .valueChanged)
tableView.refreshControl = refreshControl
let instaEngine = InstagramEngine.shared()
isInstagramConnected = instaEngine.accessToken != nil
}
func registerXibs() {
tableView.register(UINib(nibName: "HTBusyTableViewCell", bundle: nil), forCellReuseIdentifier: busyCellIdentifer)
tableView.register(TWTRTweetTableViewCell.self, forCellReuseIdentifier:tweetCellIdentifer)
tableView.register(UINib(nibName: "HTInstagramImageTableViewCell", bundle: nil), forCellReuseIdentifier: instagramImageCellIdentifer)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// if let nav = self.navigationController {
// nav.isNavigationBarHidden = false
// nav.navigationItem.titleView = self.searchBar
// }
}
override func viewDidAppear(_ animated: Bool) {
if(!isInstagramConnected && HTMainViewController.displayConnectInstagramAlert) {
//Show alert to connect instagram
let alert = UIAlertController(title: "Connect Instagram",
message: "Connect instagram to view more search results",
preferredStyle: UIAlertControllerStyle.actionSheet
)
alert.addAction(UIAlertAction(title: "Okay",
style: UIAlertActionStyle.default,
handler: {(alert: UIAlertAction!) in self.connectInstagram()}))
alert.addAction(UIAlertAction(title: "Cancel",
style: UIAlertActionStyle.default,
handler: {(alert: UIAlertAction!) in HTMainViewController.displayConnectInstagramAlert = false}))
self.present(alert, animated: true, completion: nil)
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func connectInstagram() {
if let nav = self.navigationController {
let instagramLoginVC = self.storyboard?.instantiateViewController(withIdentifier: "instagramLoginVC") as! HTInstagramLoginViewController
instagramLoginVC.delegate = self
nav.pushViewController(instagramLoginVC, animated: true)
}
}
// MARK: Actions
@IBAction func signOutButtonTapped(_ sender: Any) {
do {
try
FIRAuth.auth()?.signOut()
AppState.signedOut()
if let nav = self.navigationController?.navigationController {
nav.popToRootViewController(animated: true)// the root vc is the HTSignInViewController
}
}
catch {
let alert = UIAlertController(title: "Logout failed",
message: "Unable to logout",
preferredStyle: UIAlertControllerStyle.alert
)
self.present(alert, animated: true, completion: nil)
print ("signOutButtonTapped - sign out failed with \(sender)")
}
}
@objc private func fetchMoreData(sender: UIRefreshControl) {
let searchText = getSearchText()
let hasMetaData = ((twitterSearchMetaData != nil) || (instagramSearchMetaData != nil))
if (searchText.characters.count >= 2 && hasMetaData) {
var searchMetaData: [String: Any?]
searchMetaData = [twitterMetaDataKey:twitterSearchMetaData, instagramMetaDataKey:nil]
performSearch(searchText, searchMetaData);
}
else {
refreshControl.endRefreshing()
}
}
func performSearch(_ searchText:String, _ searchMetaData:[String: Any?]) {
if let twitterMetaData = searchMetaData[twitterMetaDataKey] {
HTTwitterAPIManager.sharedInstance.searchTwitter(withMetaData: twitterMetaData as! [String : Any?], andQuery: searchText)
}
}
func performSearch(_ searchText:String) {
//clear old search first
lastSearchText = searchText
DispatchQueue.main.async { [unowned self] in
self.datasource = [Any]()
self.tableView.reloadData();
self.twitterSearchMetaData = nil
}
self.refreshControl.beginRefreshing();
HTTwitterAPIManager.sharedInstance.searchTwitter(query: searchText)
self.twitterLoading = true;
if(isInstagramConnected) {
HTInstagramAPIManager.sharedInstance.searchInstagram(tag: searchText)
self.instagramLoading = true;
}
}
func invalidateSearch() {
self.searchTimer?.invalidate()
self.twitterSearchMetaData = nil;
self.twitterLoading = false;
self.instagramLoading = false;
refreshControl.endRefreshing();
}
// MARK: UISearchBarDelegate methods
public func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
let text = getSearchText()
guard text != lastSearchText else {
return
}
if (text.characters.count < 2) {
if self.searchTimer != nil {
self.invalidateSearch()
}
return
}
twitterSearchMetaData = nil;
DispatchQueue.main.async { [unowned self] in
if self.searchTimer != nil {
self.invalidateSearch()
}
self.searchTimer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: false, block: { (Timer) in
self.performSearch(text)
})
}
}
private func hasProcessed(twitterResults results:[TWTRTweet]) -> Bool {
var processedTweetsAlready = true
var onlyTweets = self.datasource.filter { $0 is TWTRTweet}
if(onlyTweets.isEmpty) {
processedTweetsAlready = false
}
if(processedTweetsAlready) {
let topTweet = onlyTweets[0] as! TWTRTweet
let latestTweetId = results[0].tweetID
if(topTweet.tweetID.caseInsensitiveCompare(latestTweetId) != ComparisonResult.orderedSame){
processedTweetsAlready = false
}
else {
print("Processed these tweets already!!")
}
}
return processedTweetsAlready
}
// MARK: - Notifications
public func handleTweetsRetrievedNotification(_ notification:NSNotification) {
//reload the table view here.....
DispatchQueue.main.async { [unowned self] in
if let tweets = notification.object as? [Any] {
if (!self.hasProcessed(twitterResults: tweets as! [TWTRTweet])) {
var tempDatasource:[Any] = [Any]()
tempDatasource += tweets
tempDatasource += self.datasource
self.datasource = tempDatasource
self.twitterSearchMetaData = notification.userInfo as! [String : Any]?
self.tableView.reloadData()
print("got \(tweets.count) tweets from twitter!");
}
}
self.twitterLoading = false
if (!self.instagramLoading) {
self.refreshControl.endRefreshing()
}
}
}
public func handleInstagramMediaRetrievedNotification(_ notification:NSNotification) {
let instagramMediaObj = notification.object as! [String:Any]
let instagramMedia = instagramMediaObj[Constants.InstagramAPI.instagramMediaKey] as! [InstagramMedia]
let pageInfo = instagramMediaObj[Constants.InstagramAPI.instagramPageInfoKey] as! InstagramPaginationInfo
self.instagramLoading = false
print("success get tagged media. nextMaxId: \(pageInfo.nextMaxId)")
for media:InstagramMedia in instagramMedia {
print("found - caption: \(media.caption)")
}
print("before \(datasource.count)")
self.datasource += instagramMedia as [Any]
print("after \(datasource.count)")
tableView.reloadData()
if (!self.twitterLoading) {
self.refreshControl.endRefreshing()
}
}
public func handleInstagramMediaRetrievalFailedNotification(_ notification:NSNotification) {
//TODO: get the error from the notification object and display alert to user.
print("Instagram media retrieval failed with error: \(notification.object)")
self.instagramLoading = false
}
func getSearchText() -> String {
var searchText = ""
if let text = searchBar.text {
searchText = text
searchText = searchText.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)
}
return (searchText.characters.count >= 2) ? searchText : lastSearchText
}
func getNextPageOfResults() {
//TODO: make call to twitter and instagram apis if connected.
var searchText = getSearchText()
if(searchText.characters.count >= 2) {
performSearch(searchText);
}
else {
refreshControl.endRefreshing()
}
}
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
var rows = 0
if(!datasource.isEmpty) {
rows = datasource.count
}
return rows
}
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var cell: UITableViewCell
let dataObj :Any = datasource[indexPath.row]
if dataObj is InstagramMedia {
let media:InstagramMedia = dataObj as! InstagramMedia
let instagramImageCell: HTInstagramImageCell = tableView.dequeueReusableCell(withIdentifier: instagramImageCellIdentifer) as! HTInstagramImageCell
instagramImageCell.media = media
if let caption = media.caption {
instagramImageCell.caption.text = caption.text
}
cell = instagramImageCell
}
else {
let tweet:TWTRTweet = datasource[indexPath.row] as! TWTRTweet
let tweetCell:TWTRTweetTableViewCell! = tableView.dequeueReusableCell(withIdentifier: tweetCellIdentifer) as! TWTRTweetTableViewCell
tweetCell.configure(with: tweet)
cell = tweetCell;
}
return cell
}
public func numberOfSections(in tableView: UITableView) -> Int {
return 1;
}
// MARK: - HTInstagramLoginDelegate methods
func authorizedInstagramSuccessfully(user:InstagramUser!) {
self.isInstagramConnected = true
if let nav = self.navigationController {
nav.popViewController(animated:true)
}
}
func authorizeInstagramFailed(error: Error?) {
//TODO: KC show alert to user with error
print("authorizeInstagramFailed with error: \(error)")
}
}
| [
-1
] |
091b387f1b4ce1678757067261cc9ee8c3212489 | c17c6ee1840d0e46e5865710f34ff0ff95da9354 | /OverridingTestUITests/OverridingTestUITests.swift | 0f6c28b934e58e76513d86e63c128eefac3f123b | [] | no_license | atsuo1203/OverridingTest | 9f96954d1829d70b1bf79203b2f99b81f9cc598b | b124044cac7cb66c3ce18681732716f6a7c0c660 | refs/heads/master | 2021-01-23T14:41:25.074613 | 2017-09-07T05:29:25 | 2017-09-07T05:29:25 | 102,695,228 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,277 | swift | //
// OverridingTestUITests.swift
// OverridingTestUITests
//
// Created by Atsuo Yonehara on 2017/09/07.
// Copyright © 2017年 Atsuo Yonehara. All rights reserved.
//
import XCTest
class OverridingTestUITests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
| [
155665,
354342,
229414,
102441,
354346,
278571,
282671,
229425,
229431,
288829,
288835,
307269,
233548,
311373,
311377,
223317,
315477,
315488,
45154,
280676,
313446,
233578,
194667,
278637,
284789,
131190,
235661,
311447,
153752,
284827,
311459,
299176,
184489,
284843,
295099,
299197,
280767,
139459,
309443,
176325,
131270,
227525,
299208,
301255,
280779,
227536,
311520,
280803,
307431,
295147,
286957,
227601,
278805,
311582,
233761,
278817,
282938,
278843,
287040,
311622,
323914,
201037,
289109,
379224,
323934,
239973,
381286,
285031,
313703,
416103,
278895,
287089,
291193,
311679,
313736,
227721,
190870,
291225,
285083,
293281,
285089,
289195,
299449,
293309,
278974,
291266,
278979,
278988,
326093,
281039,
160224,
279009,
291297,
279014,
279017,
281071,
279030,
293368,
279033,
279042,
233987,
283138,
309770,
279053,
182802,
303634,
279060,
279061,
279066,
291359,
293420,
289328,
283185,
23093,
244279,
234044,
309831,
55880,
281165,
301647,
281170,
309847,
295518,
279150,
287345,
301688,
287359,
291455,
303743,
301702,
279176,
287379,
227991,
295575,
289435,
303772,
221853,
314020,
279207,
295598,
285360,
342705,
299698,
287412,
154295,
314043,
291529,
287434,
225996,
303826,
279253,
295653,
289511,
285419,
289517,
279278,
170735,
312046,
125683,
230133,
199415,
234233,
242428,
279293,
289534,
299777,
291591,
295688,
322312,
285450,
285457,
295698,
166677,
221980,
234276,
283431,
289580,
164655,
285493,
230198,
285496,
301883,
281407,
289599,
293702,
318279,
281426,
279379,
295769,
201562,
281434,
230238,
301919,
293729,
281444,
303973,
308075,
310132,
295797,
295799,
207735,
279418,
308093,
291713,
158594,
228232,
279434,
308111,
289691,
283551,
289699,
293801,
279465,
304050,
289720,
289723,
19398,
213961,
183254,
304086,
234469,
314343,
304104,
183276,
234476,
203758,
320492,
287730,
240631,
312313,
214009,
312315,
234499,
293894,
322571,
234513,
238611,
293911,
197658,
113710,
312372,
203829,
238646,
238650,
308288,
336962,
349254,
238663,
300109,
207954,
296023,
281698,
230500,
322664,
279659,
234606,
300145,
230514,
238706,
187508,
279666,
312435,
302202,
285823,
150656,
234626,
285833,
234635,
228492,
308375,
285850,
296091,
302239,
300192,
306339,
234662,
249003,
208044,
302251,
294075,
64699,
228541,
283841,
148674,
312519,
283849,
290001,
189651,
279766,
189656,
279775,
304352,
298209,
304353,
302319,
234741,
208123,
279803,
228608,
234756,
177420,
312588,
300342,
286012,
181568,
279872,
294210,
279874,
304457,
230730,
234830,
222542,
224591,
238928,
296274,
357720,
300378,
292194,
230757,
281958,
134504,
284015,
234864,
296304,
230772,
310650,
224637,
306558,
179586,
294278,
296328,
296330,
368012,
306580,
234902,
224662,
282008,
282013,
290206,
148899,
282023,
279979,
173492,
284090,
228796,
228804,
306630,
300488,
306634,
302539,
370122,
234957,
310735,
312785,
222674,
280020,
280025,
144862,
286176,
280042,
300526,
308722,
288252,
290304,
228868,
218632,
302602,
294413,
304655,
230933,
302613,
282135,
302620,
230960,
288305,
290359,
157246,
282182,
292424,
288328,
286281,
292426,
290391,
128600,
235096,
306777,
300643,
282214,
294517,
288377,
290425,
280193,
282244,
239238,
288391,
282248,
179853,
286351,
229011,
280217,
323226,
179868,
302751,
282272,
282279,
286387,
300725,
286392,
302778,
296636,
282302,
282309,
296649,
280266,
306891,
302798,
9935,
280279,
282330,
294621,
282336,
294629,
282347,
282349,
323315,
67316,
284410,
288508,
282366,
288515,
280326,
300810,
282379,
216844,
280333,
284430,
300812,
278292,
278294,
282390,
282399,
315172,
186149,
294699,
284460,
280367,
300849,
282418,
280373,
282424,
282428,
280381,
345918,
280386,
188250,
284508,
284515,
276326,
296807,
282471,
292713,
282476,
292719,
280451,
282503,
67464,
305032,
315272,
315275,
282517,
294808,
239515,
294820,
294824,
126896,
300983,
288698,
294849,
214978,
280518,
24531,
231382,
294887,
317416,
298987,
278507,
311277,
278515
] |
e671020ceea27214fc45719ef32b400050a94a5a | fe00c1a936432f31c3b434ba8ca146ef4f20bb43 | /grainChainTest-ios/VIew/Log in/LoginInViewController.swift | 61738190e3e7db329e0333788da05c1e8cd96432 | [] | no_license | alfredofregoso/grainChain-ios | 8779a94c9669e199d8bdf8c5e1805742033a9af3 | 20d9c92796371b5b6bb7530099a3cb98707f03cf | refs/heads/master | 2020-04-02T00:42:01.706895 | 2018-10-23T03:01:29 | 2018-10-23T03:01:29 | 153,817,519 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,124 | swift | //
// LoginInViewController.swift
// grainChainTest-ios
//
// Created by Alfredo Fregoso on 10/18/18.
// Copyright © 2018 Alfredo Fregoso . All rights reserved.
//
import UIKit
class LoginInViewController: UIViewController {
@IBOutlet weak var userNameTextfield: UITextField!
@IBOutlet weak var passwordTextfield: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
userNameTextfield.text = "harvx_190878"
passwordTextfield.text = "supersecretpassword"
addGestures()
}
@IBAction func logInButtonClicked(_ sender: Any) {
if let user = userNameTextfield.text, let password = passwordTextfield.text {
APIService().signIn(userName: user, password: password) {
if (user == "harvx_190878" && password == "supersecretpassword") {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "MainTabController")
self.present(vc, animated: true, completion: nil)
}else {
self.presentAlert()
}
}
}
}
func addGestures() {
let hideKeyboard = UITapGestureRecognizer(target: self, action: #selector(tappedToHideKeyboard))
view.addGestureRecognizer(hideKeyboard)
}
@objc func tappedToHideKeyboard() {
view.endEditing(true)
}
func loginToTheViewController() {
}
func presentAlert() {
let alertController = UIAlertController(title: "Acceso denegado", message: "Tu usuario o contraseña son incorrectos", preferredStyle: .alert)
let alertAction = UIAlertAction(title: "Ok", style: .default) { (_) in
self.userNameTextfield.text = ""
self.passwordTextfield.text = ""
}
alertController.addAction(alertAction)
present(alertController, animated: true, completion: nil)
}
@objc func logInButtonClicked() {
loginToTheViewController()
}
}
| [
-1
] |
796ee40e6c85726751f58403e844027d573d547b | 09020aecc433dc46049ca4f474548257d3fc97ce | /MacLandmarks/LandmarkDetail.swift | 0f8293258b4fb0d6c9f56c8216051f8414f0f48e | [
"MIT"
] | permissive | tacshi/landmarks | 3cb5a092ed50fffc13d61c42af242f7d854a8bcc | 09859cce28577e653f195040441df3c3a1ac31f5 | refs/heads/main | 2023-05-14T00:40:37.019549 | 2021-01-30T13:03:11 | 2021-01-30T13:03:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,593 | swift | //
// LandmarkDetail.swift
// MacLandmarks
//
// Created by shibang on 2021/1/30.
//
import SwiftUI
import MapKit
struct LandmarkDetail: View {
@EnvironmentObject var modelData: ModelData
var landmark: Landmark
var landmarkIndex: Int {
modelData.landmarks.firstIndex(where: { $0.id == landmark.id })!
}
var body: some View {
ScrollView {
ZStack(alignment: Alignment(horizontal: .trailing, vertical: .top)) {
MapView(coordinate: landmark.locationCoordinate)
.ignoresSafeArea(edges: .top)
.frame(height: 300)
Button("Open in Maps") {
let destination = MKMapItem(placemark: MKPlacemark(coordinate: landmark.locationCoordinate))
destination.name = landmark.name
destination.openInMaps()
}
.padding()
}
VStack(alignment: .leading, spacing: 20) {
HStack(spacing: 24) {
CircleImage(image: landmark.image.resizable())
.frame(width: 160, height: 160)
VStack(alignment: .leading) {
HStack {
Text(landmark.name)
.font(.title)
.foregroundColor(.primary)
FavoriteButton(isSet: $modelData.landmarks[landmarkIndex].isFavorite)
.buttonStyle(PlainButtonStyle())
}
VStack(alignment: .leading) {
Text(landmark.park)
Text(landmark.state)
}
.font(.subheadline)
.foregroundColor(.secondary)
}
}
Divider()
Text("About \(landmark.name)")
.font(.title2)
Text(landmark.description)
}
.padding()
.frame(maxWidth: 700)
.offset(y: -50)
}
.navigationTitle(landmark.name)
}
}
struct LandmarkDetail_Previews: PreviewProvider {
static let modelData = ModelData()
static var previews: some View {
LandmarkDetail(landmark: modelData.landmarks[0])
.environmentObject(modelData)
.frame(width: 850, height: 700)
}
}
| [
372864,
372803,
372836,
372850,
363381,
377496
] |
db301ce9016752eb21daab7f937c79b5be40d57f | 2580c74ca8a1fead137b73ce96d60c4cd85c01a3 | /QXJS/class/view/companybrand/companyinfo/CompanyBrandNavView.swift | d949cb0daa6d95fb810643b319a248461fc3ea9d | [] | no_license | 460122775/QXJS | 9e07c3eaae0cb709a19bda95a9bca70e2f826b92 | c4441888172f996e47652b3f1699e254905548cc | refs/heads/master | 2021-01-17T14:53:55.674240 | 2016-07-15T13:56:00 | 2016-07-15T13:56:00 | 52,375,229 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,686 | swift | //
// CompanyInfoView.swift
// QXJS
//
// Created by Yachen Dai on 2/25/16.
// Copyright © 2016 qxjs. All rights reserved.
//
import UIKit
protocol CompanyBrandNavDelegate
{
func gotoThirdClassView(subView : UIView)
}
class CompanyBrandNavView: UIView, CompanyBrandNavDelegate{
@IBOutlet var navView: UIView!
@IBOutlet var navBtnView: UIView!
@IBOutlet var selectedView: UIView!
@IBOutlet weak var selectedViewLeading: NSLayoutConstraint!
@IBOutlet var cultureBtn: UIButton!
@IBOutlet var progressBtn: UIButton!
@IBOutlet var stuffBtn: UIButton!
@IBOutlet var honourBtn: UIButton!
@IBOutlet var brandBtn: UIButton!
@IBOutlet var contactBtn: UIButton!
var companyBrandDelegate : CompanyBrandDelegate?
var showImgDelegate : ShowImgDelegate?
var companyInfoView : CompanyInfoView?
var companyProgressView : CompanyProgressView?
var contactInfoView : ContactInfoView?
var companyBrandView : CompanyBrandView?
var honourView : HonourView?
var stuffView : StuffView?
var thirdClassView : UIView?
@IBOutlet var mainView: UIView!
override func drawRect(rect: CGRect)
{
// Drawing code
}
@IBAction func backBtnClick(sender: UIButton)
{
if thirdClassView != nil
{
thirdClassView?.removeFromSuperview()
thirdClassView = nil
self.navBtnView.hidden = false
}else{
companyBrandDelegate?.navBtnClick(sender)
}
}
@IBAction func cultureBtnClick(sender: UIButton)
{
selectedViewLeading.constant = cultureBtn.frame.origin.x
self.mainView.subviews.map { $0.removeFromSuperview() }
if companyInfoView == nil
{
companyInfoView = ((NSBundle.mainBundle().loadNibNamed("CompanyInfoView", owner: self, options: nil) as NSArray).lastObject as? CompanyInfoView)!
}
self.mainView.addSubview(companyInfoView!)
}
@IBAction func progressBtnClick(sender: UIButton)
{
selectedViewLeading.constant = progressBtn.frame.origin.x
self.mainView.subviews.map { $0.removeFromSuperview() }
if companyProgressView == nil
{
companyProgressView = ((NSBundle.mainBundle().loadNibNamed("CompanyProgressView", owner: self, options: nil) as NSArray).lastObject as? CompanyProgressView)!
}
self.mainView.addSubview(companyProgressView!)
}
@IBAction func stuffBtnClick(sender: UIButton)
{
selectedViewLeading.constant = stuffBtn.frame.origin.x
self.mainView.subviews.map { $0.removeFromSuperview() }
if stuffView == nil
{
stuffView = ((NSBundle.mainBundle().loadNibNamed("StuffView", owner: self, options: nil) as NSArray).lastObject as? StuffView)!
}
self.mainView.addSubview(stuffView!)
}
@IBAction func honourBtnClick(sender: UIButton)
{
selectedViewLeading.constant = honourBtn.frame.origin.x
self.mainView.subviews.map { $0.removeFromSuperview() }
if honourView == nil
{
honourView = ((NSBundle.mainBundle().loadNibNamed("HonourView", owner: self, options: nil) as NSArray).lastObject as? HonourView)!
honourView?.showImgDelegate = self.showImgDelegate
}
self.mainView.addSubview(honourView!)
}
@IBAction func brandBtnClick(sender: UIButton)
{
selectedViewLeading.constant = brandBtn.frame.origin.x
self.mainView.subviews.map { $0.removeFromSuperview() }
if companyBrandView == nil
{
companyBrandView = ((NSBundle.mainBundle().loadNibNamed("CompanyBrandView", owner: self, options: nil) as NSArray).lastObject as? CompanyBrandView)!
companyBrandView?.companyBrandNavDelegate = self
companyBrandView?.showImgDelegate = self.showImgDelegate
}
self.mainView.addSubview(companyBrandView!)
}
@IBAction func contactBtnClick(sender: UIButton)
{
selectedViewLeading.constant = contactBtn.frame.origin.x
self.mainView.subviews.map { $0.removeFromSuperview() }
if contactInfoView == nil
{
contactInfoView = ((NSBundle.mainBundle().loadNibNamed("ContactInfoView", owner: self, options: nil) as NSArray).lastObject as? ContactInfoView)!
}
self.mainView.addSubview(contactInfoView!)
}
func gotoThirdClassView(subView : UIView)
{
thirdClassView = subView
subView.frame.origin.y = self.navView.frame.size.height
self.navBtnView.hidden = true
self.addSubview(subView)
}
}
| [
-1
] |
b2bd1d1ae76cd52443cacdb1a4e5d0f14da832e6 | 2fd553af0a4997d184933df26d99ead14afac60a | /EmptyArchitectureProject/CorePlatforms/UIKit/Extensions/DeviceExtension.swift | c994e2c92cb634aecfadaf97cb3376d2cefcefdd | [] | no_license | wnifirami/EmptyArchitectureProject | 166e5eefa7ed35f4eb498bcbea9241fd003aa983 | ca852bc44b9ed72acbdad652eb42b267a60e58f7 | refs/heads/master | 2022-12-16T17:54:04.506883 | 2020-08-27T09:23:58 | 2020-08-27T09:23:58 | 290,730,693 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,717 | swift | //
// DeviceExtension.swift
// EmptyArchitectureProject
//
// Created by Rami Ounifi on 6/19/20.
// Copyright © 2020 Yellow. All rights reserved.
//
import Foundation
import UIKit
public extension UIDevice {
static let modelName: String = {
var systemInfo = utsname()
uname(&systemInfo)
let machineMirror = Mirror(reflecting: systemInfo.machine)
let identifier = machineMirror.children.reduce("") { identifier, element in
guard let value = element.value as? Int8, value != 0 else { return identifier }
return identifier + String(UnicodeScalar(UInt8(value)))
}
func mapToDevice(identifier: String) -> String { // swiftlint:disable:this cyclomatic_complexity
#if os(iOS)
switch identifier {
case "iPod5,1": return "iPod touch (5th generation)"
case "iPod7,1": return "iPod touch (6th generation)"
case "iPod9,1": return "iPod touch (7th generation)"
case "iPhone3,1", "iPhone3,2", "iPhone3,3": return "iPhone 4"
case "iPhone4,1": return "iPhone 4s"
case "iPhone5,1", "iPhone5,2": return "iPhone 5"
case "iPhone5,3", "iPhone5,4": return "iPhone 5c"
case "iPhone6,1", "iPhone6,2": return "iPhone 5s"
case "iPhone7,2": return "iPhone 6"
case "iPhone7,1": return "iPhone 6 Plus"
case "iPhone8,1": return "iPhone 6s"
case "iPhone8,2": return "iPhone 6s Plus"
case "iPhone9,1", "iPhone9,3": return "iPhone 7"
case "iPhone9,2", "iPhone9,4": return "iPhone 7 Plus"
case "iPhone8,4": return "iPhone SE"
case "iPhone10,1", "iPhone10,4": return "iPhone 8"
case "iPhone10,2", "iPhone10,5": return "iPhone 8 Plus"
case "iPhone10,3", "iPhone10,6": return "iPhone X"
case "iPhone11,2": return "iPhone XS"
case "iPhone11,4", "iPhone11,6": return "iPhone XS Max"
case "iPhone11,8": return "iPhone XR"
case "iPhone12,1": return "iPhone 11"
case "iPhone12,3": return "iPhone 11 Pro"
case "iPhone12,5": return "iPhone 11 Pro Max"
case "iPad2,1", "iPad2,2", "iPad2,3", "iPad2,4":return "iPad 2"
case "iPad3,1", "iPad3,2", "iPad3,3": return "iPad (3rd generation)"
case "iPad3,4", "iPad3,5", "iPad3,6": return "iPad (4th generation)"
case "iPad6,11", "iPad6,12": return "iPad (5th generation)"
case "iPad7,5", "iPad7,6": return "iPad (6th generation)"
case "iPad7,11", "iPad7,12": return "iPad (7th generation)"
case "iPad4,1", "iPad4,2", "iPad4,3": return "iPad Air"
case "iPad5,3", "iPad5,4": return "iPad Air 2"
case "iPad11,4", "iPad11,5": return "iPad Air (3rd generation)"
case "iPad2,5", "iPad2,6", "iPad2,7": return "iPad mini"
case "iPad4,4", "iPad4,5", "iPad4,6": return "iPad mini 2"
case "iPad4,7", "iPad4,8", "iPad4,9": return "iPad mini 3"
case "iPad5,1", "iPad5,2": return "iPad mini 4"
case "iPad11,1", "iPad11,2": return "iPad mini (5th generation)"
case "iPad6,3", "iPad6,4": return "iPad Pro (9.7-inch)"
case "iPad7,3", "iPad7,4": return "iPad Pro (10.5-inch)"
case "iPad8,1", "iPad8,2", "iPad8,3", "iPad8,4":return "iPad Pro (11-inch)"
case "iPad8,9", "iPad8,10": return "iPad Pro (11-inch) (2nd generation)"
case "iPad6,7", "iPad6,8": return "iPad Pro (12.9-inch)"
case "iPad7,1", "iPad7,2": return "iPad Pro (12.9-inch) (2nd generation)"
case "iPad8,5", "iPad8,6", "iPad8,7", "iPad8,8":return "iPad Pro (12.9-inch) (3rd generation)"
case "iPad8,11", "iPad8,12": return "iPad Pro (12.9-inch) (4th generation)"
case "AppleTV5,3": return "Apple TV"
case "AppleTV6,2": return "Apple TV 4K"
case "AudioAccessory1,1": return "HomePod"
case "i386", "x86_64": return "Simulator \(mapToDevice(identifier: ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"] ?? "iOS"))"
default: return identifier
}
#elseif os(tvOS)
switch identifier {
case "AppleTV5,3": return "Apple TV 4"
case "AppleTV6,2": return "Apple TV 4K"
case "i386", "x86_64": return "Simulator \(mapToDevice(identifier: ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"] ?? "tvOS"))"
default: return identifier
}
#endif
}
return mapToDevice(identifier: identifier)
}()
}
| [
145153,
62500,
256229,
105350,
198217,
168557,
194640,
56728,
19133
] |
5a011d471bac1e7934c8de5bb577605e80fb52e6 | 94a0d304d3b30c3ba8bfaba87e29fb5f96a0d531 | /iOS App/GCSAQ/GCSAQ/OldViewController.swift | d4a13e70e9970330a3ed76ed9fefff5429cedf37 | [] | no_license | anirudhr95/Quadcopter_final_year_project | 3135b4badb0c8ee5d97d15c24c406369eaeb4a47 | b0cfb93fd937a4abb0ebe6b0a88f71749d328320 | refs/heads/master | 2023-01-23T17:13:44.383525 | 2021-06-06T08:47:55 | 2021-06-06T08:47:55 | 76,859,203 | 1 | 0 | null | 2023-01-20T23:37:14 | 2016-12-19T12:12:33 | C | UTF-8 | Swift | false | false | 6,991 | swift | ////
//// ViewController.swift
//// Quadcopter
////
//// Created by Shyam Ravikumar on 4/11/15.
//// Copyright (c) 2015 Shyam Ravikumar. All rights reserved.
////
//
//import UIKit
//import CoreMotion
//import SceneKit
//import GLKit
//let laptop_ip:String = "172.20.10.3"
//var pMotionData:CGFloat = 0
//var yMotionData:CGFloat = 0
//var rMotionData:CGFloat = 0
//var opMotionData:CGFloat = 0
//var oyMotionData:CGFloat = 0
//var orMotionData:CGFloat = 0
//let maxAngle = 30.0
//let minChange:CGFloat = 5
//var connected : Bool = false
//var client:TCPClient = TCPClient(addr: laptop_ip, port:20000)
//var receivingMotionUpdates = false
//
//
//
//class OldViewController: UIViewController {
// let updateInterval = 0.3
// var ship = SCNNode()
// @IBOutlet weak var retryIfConnectionFailed: UIButton!
// @IBOutlet weak var connectionStatus: UILabel!
// @IBOutlet weak var modelView: SCNView!
// @IBOutlet weak var speedThrottleDisplay: UILabel!
//
//
// let manager:CMMotionManager = CMMotionManager()
//
// func setFailed(){
// connectionStatus.text = "Failed"
// connectionStatus.textColor = UIColor.redColor()
// speedThrottleDisplay.hidden = true
//
// retryIfConnectionFailed.hidden = false
// retryIfConnectionFailed.enabled = true
// ship.runAction(
// SCNAction.rotateToX(
// 0,
// y: degToRad(180),
// z: 0,
// duration: 0.1))
// if receivingMotionUpdates{
// manager.stopDeviceMotionUpdates()
// }
//
// }
// func setConnected(){
// connectionStatus.text="Connected"
// connectionStatus.textColor=UIColor.greenColor()
// retryIfConnectionFailed.hidden = true
// retryIfConnectionFailed.enabled = false
// speedThrottleDisplay.hidden = false
// motionStuff()
// }
// @IBAction func speedThrottle(sender: UISlider) {
//
// speedThrottleDisplay.text = "\(Int(sender.value * 100)) %"
//
//
// }
//
//
// @IBAction func speedNetworking(sender: UISlider) {
// let val = Int(sender.value * 100)
// print(val)
// if !sendThrottleData(val){
// setFailed()
// }
// }
// override func viewDidLoad() {
// super.viewDidLoad()
//
//
//
// // create a new scene
// let scene = SCNScene(named: "art.scnassets/ship.dae")!
//
// // create and add a camera to the scene
// let cameraNode = SCNNode()
// cameraNode.camera = SCNCamera()
// scene.rootNode.addChildNode(cameraNode)
//
// // place the camera
// cameraNode.position = SCNVector3(x: 0, y: 3, z: 14)
//
// // create and add a light to the scene
// let lightNode = SCNNode()
// lightNode.light = SCNLight()
// lightNode.light!.type = SCNLightTypeOmni
// lightNode.position = SCNVector3(x: 0, y: 10, z: 10)
// scene.rootNode.addChildNode(lightNode)
//
// // create and add an ambient light to the scene
// let ambientLightNode = SCNNode()
// ambientLightNode.light = SCNLight()
// ambientLightNode.light!.type = SCNLightTypeAmbient
// ambientLightNode.light!.color = UIColor.darkGrayColor()
// scene.rootNode.addChildNode(ambientLightNode)
//
// // retrieve the ship node
// ship = scene.rootNode.childNodeWithName("ship", recursively: true)!
//
// let scnView = modelView
//
// // set the scene to the view
// scnView.scene = scene
//
// // allows the user to manipulate the camera
// scnView.allowsCameraControl = false
//
// // show statistics such as fps and timing information
// scnView.showsStatistics = false
// // configure the view
// scnView.backgroundColor = UIColor.whiteColor()
//
// ship.runAction(
// SCNAction.rotateToX(
// 0,
// y: degToRad(180),
// z: 0,
// duration: 0.1))
// establishConnection(2)
// if connected{
// setConnected()
//
// }
// else{
// setFailed()
// }
// }
//
// override func shouldAutorotate() -> Bool {
// return false
// }
//
// override func prefersStatusBarHidden() -> Bool {
// return true
// }
//
// override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
// if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
// return UIInterfaceOrientationMask.AllButUpsideDown
// } else {
// return UIInterfaceOrientationMask.All
// }
// }
//
//
//
// func motionHandle(data : CMDeviceMotion?, error: NSError?) -> Void {
// if (data != nil) && (error != nil){
//
// pitch = (90-radToDeg(-data!.attitude.roll))
// yaw = radToDeg(-data!.attitude.yaw)
// roll = radToDeg(data!.attitude.pitch)
//
// if isMovementChangeBigEnough() {
//
// opMotionData = pitch
// oyMotionData = yaw
// orMotionData = roll
// if !sendMotionData(){
// self.setFailed()
// }
//
//
// }
//
// // println("Pitch : \(pitch)) Yaw: \(yaw) Roll: \(roll)")
//
//
//
// self.ship.runAction(
// SCNAction.rotateToX(
// degToRad(pitch),
// y : degToRad( 180 - yaw),
// z: degToRad(-roll),
// duration: self.updateInterval
// ))
//
//
// }
// }
// func motionStuff(){
//
// manager.deviceMotionUpdateInterval = updateInterval
// receivingMotionUpdates = true
// manager.startDeviceMotionUpdatesToQueue(NSOperationQueue.mainQueue(), withHandler: motionHandle)
//
// }
// var pitch: CGFloat{
// get{
// return pMotionData
// }
// set{
// pMotionData = newValue
//
// }
// }
// var yaw: CGFloat{
// get{
// return yMotionData
// }
// set{
// yMotionData = newValue
//
// }
// }
// var roll: CGFloat{
// get{
// return rMotionData
// }
// set{
//
// rMotionData = newValue
//
// }
//
// }
// func establishConnection(timeout : Int) {
//
// var (success,errmsg)=client.connect(timeout: timeout)
// print("Connection result is \(success) error message : \(errmsg)")
// if success{
// //发送数据
// var (success,errmsg)=client.send(str:"ping" )
// if success{
// //读取数据
// let data=client.read(1024*10)
// if let d=data{
// if let str=String(bytes: d, encoding: NSUTF8StringEncoding){
// print(str)
// if str=="success" {
// connected = true
// return
// }
//
// }
// }
// }else{
// print(errmsg)
// return
//
// }
// }
// else{
// print(errmsg)
//
// }
//
// }
// func isMovementChangeBigEnough() -> Bool {
// if (abs(pitch) > (abs(opMotionData) + minChange) || abs(yaw) > (abs(oyMotionData) + minChange) || abs(roll) > (abs(orMotionData) + minChange)){
// return true
// }
// else{
// return false
// }
// }
// func sendMotionData() -> Bool {
// var (success,err) = client.send(str : "\(Int(pitch)),\(Int(yaw)),\(Int(roll))")
// if !success{
// print(err)
// return false
// }
// return true
// }
// func sendThrottleData(speed : Int) -> Bool{
// var (success,err) = client.send(str: "\(speed)")
// if !success{
// print(err)
// return false
// }
// return true
// }
// func degToRad(angle : CGFloat) -> CGFloat{
// return CGFloat(GLKMathDegreesToRadians(Float(angle)))
// }
// func radToDeg(rad : Double) -> CGFloat{
// return CGFloat(GLKMathRadiansToDegrees(Float(rad)))
// }
//}
//
| [
-1
] |
16775b150194b80514329eca9cda481a3acaa4b8 | 47fa3849508ff813a0b6c24327a790da5f6a0c26 | /Tests/HtmlTests/AttributesTests.swift | 04c65bcdaa1735cdd5ef88a7ce15d37d7d64b60c | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | pointfreeco/swift-html | 563eefe5f820e759251439cc837d8676b3ceebb4 | be9d301d0d2ed432a57d10c5ab7a1183bd1afce8 | refs/heads/main | 2023-03-09T11:48:47.283369 | 2023-03-02T18:38:15 | 2023-03-02T18:38:15 | 144,326,022 | 714 | 53 | MIT | 2023-03-02T18:38:16 | 2018-08-10T19:42:31 | Swift | UTF-8 | Swift | false | false | 18,114 | swift | import Html
import XCTest
final class AttributesTests: XCTestCase {
func testAttributes() {
XCTAssertEqual(
"""
<th abbr="blob" colspan="1" headers="blob" rowspan="1" scope></th>
""",
render(
.th(attributes: [.abbr("blob"), .colspan(1), .headers("blob"), .rowspan(1), .scope(.auto)]))
)
XCTAssertEqual("<th scope=\"col\"></th>", render(.th(attributes: [.scope(.col)])))
XCTAssertEqual("<th scope=\"colgroup\"></th>", render(.th(attributes: [.scope(.colgroup)])))
XCTAssertEqual("<th scope=\"row\"></th>", render(.th(attributes: [.scope(.row)])))
XCTAssertEqual("<th scope=\"rowgroup\"></th>", render(.th(attributes: [.scope(.rowgroup)])))
XCTAssertEqual(
"<a href=\"/user/foo" onmouseover="alert(1)\">XSS</a>",
render(.a(attributes: [.href("/user/foo\" onmouseover=\"alert(1)")], "XSS"))
)
XCTAssertEqual("<a accesskey=\"a\"></a>", render(.a(attributes: [.accesskey("a")])))
XCTAssertEqual(
"""
<form action="/" name="blob" novalidate></form>
""",
render(.form(attributes: [.action("/"), .method(.get), .name("blob"), .novalidate(true)]))
)
XCTAssertEqual(
"""
<form action="/" method="post"></form>
""",
render(.form(attributes: [.action("/"), .method(.post), .novalidate(false)]))
)
XCTAssertEqual("<area alt=\"blob\">", render(.area(attributes: [.alt("blob")])))
XCTAssertEqual(
"""
<img alt="blob" crossorigin height="42" src="src" width="43">
""",
render(
.img(attributes: [
.alt("blob"), .crossorigin(.anonymous), .height(42), .src("src"), .width(43),
]))
)
XCTAssertEqual(
"""
<img crossorigin="use-credentials">
""",
render(.img(attributes: [.crossorigin(.useCredentials)]))
)
XCTAssertEqual(
"""
<img src="src1" srcset="src1 1x, src2 2x, src3 3x" height="42" width="43">
""",
render(
.img(attributes: [
.src("src1"), .srcset(["src3": .x(3), "src2": .x(2), "src1": .x(1)]), .height(42),
.width(43),
]))
)
XCTAssertEqual(
"""
<img src="src1" srcset="src1 42w, src2 84w, src3 126w" height="42" width="43">
""",
render(
.img(attributes: [
.src("src1"), .srcset(["src1": .w(42), "src2": .w(84), "src3": .w(126)]), .height(42),
.width(43),
]))
)
XCTAssertEqual(
"""
<input\
alt="blob"\
autofocus\
checked\
disabled\
form="form"\
height="42"\
max="10.0"\
max="11"\
maxlength="12"\
min="13.0"\
min="14"\
minlength="15"\
multiple\
name="blob name"\
pattern=".+"\
placeholder="..."\
readonly\
required\
src="src"\
step="2"\
width="43"\
>
""",
render(
.input(
attributes: [
.alt("blob"),
.autofocus(true),
.checked(true),
.disabled(true),
.form("form"),
.height(42),
.max(10 as Double),
.max(11 as Int),
.maxlength(12),
.min(13 as Double),
.min(14 as Int),
.minlength(15),
.multiple(true),
.name("blob name"),
.pattern(".+"),
.placeholder("..."),
.readonly(true),
.required(true),
.src("src"),
.step(2),
.width(43),
]
)
)
)
XCTAssertEqual(
"""
<input>
""",
render(
.input(attributes: [
.autofocus(false), .checked(false), .disabled(false), .readonly(false), .required(false),
]))
)
XCTAssertEqual(
"""
<input type="file" required accept=".pdf, image/*">
""",
render(.input(attributes: [.type(.file), .required(true), .accept(.file("pdf"), .image)]))
)
XCTAssertEqual(
"""
<input type="file" accept="application/javascript, text/html, .css">
""",
render(
.input(attributes: [.type(.file), .accept(.mime(.javascript), .mime(.html), .file(".css"))])
)
)
XCTAssertEqual(
"""
<script async charset="utf-8" defer nonce="blob" src="blob.js"></script>
""",
render(
.script(attributes: [
.async(true), .charset(.utf8), .defer(true), .nonce("blob"), .src("blob.js"),
]))
)
XCTAssertEqual(
"""
<script></script>
""",
render(.script(attributes: [.async(false), .defer(false)]))
)
XCTAssertEqual(
"""
<button autofocus disabled form="form" name="blob"></button>
""",
render(
.button(attributes: [.autofocus(true), .disabled(true), .form("form"), .name("blob")]))
)
XCTAssertEqual(
"""
<button></button>
""",
render(.button(attributes: [.autofocus(false), .disabled(false)]))
)
XCTAssertEqual(
"""
<select autofocus disabled form="form" name="blob" required><option selected>blob</option></select>
""",
render(
.select(
attributes: [
.autofocus(true), .disabled(true), .form("form"), .name("blob"), .required(true),
],
.option(attributes: [.selected(true)], "blob")
)
)
)
XCTAssertEqual(
"""
<select><option>blob</option></select>
""",
render(
.select(
attributes: [.autofocus(false), .disabled(false), .required(false)],
.option(attributes: [.selected(false)], "blob")
)
)
)
XCTAssertEqual(
"""
<textarea autofocus cols="80" disabled form="form" name="blob" placeholder="..." readonly required rows="24" wrap="hard"></textarea>
""",
render(
.textarea(
attributes: [
.autofocus(true),
.cols(80),
.disabled(true),
.form("form"),
.name("blob"),
.placeholder("..."),
.readonly(true),
.required(true),
.rows(24),
.wrap(.hard),
]
)
)
)
XCTAssertEqual(
"""
<textarea wrap="soft"></textarea>
""",
render(
.textarea(
attributes: [
.autofocus(false),
.disabled(false),
.readonly(false),
.required(false),
.wrap(.soft),
]
)
)
)
XCTAssertEqual(
"""
<audio autoplay controls loop muted preload src="src">\
<track src="captions" default kind="captions" label="blob" srclang="en">\
<track src="chapters" kind="chapters">\
<track src="descriptions" kind="descriptions">\
<track src="metadata" kind="metadata">\
<track src="subtitles" kind="subtitles">\
</audio>
""",
render(
.audio(
attributes: [
.autoplay(true), .controls(true), .loop(true), .muted(true), .preload(.auto),
.src("src"),
],
.track(
src: "captions",
attributes: [.default(true), .kind(.captions), .label("blob"), .srclang(.en)]),
.track(src: "chapters", attributes: [.kind(.chapters)]),
.track(src: "descriptions", attributes: [.kind(.descriptions)]),
.track(src: "metadata", attributes: [.kind(.metadata)]),
.track(src: "subtitles", attributes: [.kind(.subtitles)])
)
)
)
XCTAssertEqual(
"""
<audio preload="metadata"><track src="blob"></audio>
""",
render(
.audio(
attributes: [
.autoplay(false), .controls(false), .loop(false), .muted(false), .preload(.metadata),
],
.track(src: "blob")
)
)
)
XCTAssertEqual(
"""
<video autoplay controls height="42" loop muted poster="blob" preload="none" src="src" width="43">\
<track src="captions" default kind="captions" label="blob" srclang="en">\
<track src="chapters" kind="chapters">\
<track src="descriptions" kind="descriptions">\
<track src="metadata" kind="metadata">\
<track src="subtitles" kind="subtitles">\
</video>
""",
render(
.video(
attributes: [
.autoplay(true), .controls(true), .height(42), .loop(true), .muted(true),
.poster("blob"), .preload(.none), .src("src"), .width(43),
],
.track(
src: "captions",
attributes: [.default(true), .kind(.captions), .label("blob"), .srclang(.en)]),
.track(src: "chapters", attributes: [.kind(.chapters)]),
.track(src: "descriptions", attributes: [.kind(.descriptions)]),
.track(src: "metadata", attributes: [.kind(.metadata)]),
.track(src: "subtitles", attributes: [.kind(.subtitles)])
)
)
)
XCTAssertEqual(
"""
<video><track src="blob"></video>
""",
render(
.video(
attributes: [.autoplay(false), .controls(false), .loop(false), .muted(false)],
.track(src: "blob")
)
)
)
XCTAssertEqual("<meta charset=\"utf-8\">", render(.meta(attributes: [.charset(.utf8)])))
XCTAssertEqual(
"<blockquote cite=\"blob\"></blockquote>", render(.blockquote(attributes: [.cite("blob")])))
let date = Date(timeIntervalSinceReferenceDate: 0)
XCTAssertEqual(
"""
<del cite="blob" datetime="2001-01-01T00:00:00Z"></del>
""",
render(.del(attributes: [.cite("blob"), .datetime(date)]))
)
XCTAssertEqual("<q cite=\"blob\"></q>", render(.q(attributes: [.cite("blob")])))
XCTAssertEqual("<div class=\"blob\"></div>", render(.div(attributes: [.class("blob")])))
XCTAssertEqual(
"""
<td colspan="1" headers="blob" rowspan="1"></td>
""",
render(.td(attributes: [.colspan(1), .headers("blob"), .rowspan(1)]))
)
XCTAssertEqual("<a contenteditable></a>", render(.a(attributes: [.contenteditable(true)])))
XCTAssertEqual(
"<a contenteditable=\"false\"></a>", render(.a(attributes: [.contenteditable(false)])))
XCTAssertEqual("<a></a>", render(.a(attributes: [.contenteditable(.inherit)])))
XCTAssertEqual(
"<a data-blob=\"deadbeef\"></a>", render(.a(attributes: [.data("blob", "deadbeef")])))
XCTAssertEqual(
"<time datetime=\"2001-01-01T00:00:00Z\"></time>",
render(.time(attributes: [.datetime(date)])))
XCTAssertEqual("<a dir=\"ltr\"></a>", render(.a(attributes: [.dir(.ltr)])))
XCTAssertEqual("<a dir=\"rtl\"></a>", render(.a(attributes: [.dir(.rtl)])))
XCTAssertEqual("<a dir=\"auto\"></a>", render(.a(attributes: [.dir(.auto)])))
XCTAssertEqual(
"""
<fieldset disabled name="blob"></fieldset>
""",
render(.fieldset(attributes: [.disabled(true), .name("blob")]))
)
XCTAssertEqual("<fieldset></fieldset>", render(.fieldset(attributes: [.disabled(false)])))
XCTAssertEqual(
"<optgroup disabled></optgroup>", render(.optgroup(attributes: [.disabled(true)])))
XCTAssertEqual("<optgroup></optgroup>", render(.optgroup(attributes: [.disabled(false)])))
XCTAssertEqual("<a draggable=\"true\"></a>", render(.a(attributes: [.draggable(true)])))
XCTAssertEqual("<a draggable=\"false\"></a>", render(.a(attributes: [.draggable(false)])))
XCTAssertEqual("<a></a>", render(.a(attributes: [.draggable(.auto)])))
XCTAssertEqual(
"""
<form enctype=\"application/x-www-form-urlencoded\"></form>
""",
render(.form(attributes: [.enctype(.applicationXWwwFormUrlencoded)]))
)
XCTAssertEqual(
"""
<form enctype=\"multipart/form-data\"></form>
""",
render(.form(attributes: [.enctype(.multipartFormData)]))
)
XCTAssertEqual(
"""
<form enctype=\"text/plain\"></form>
""",
render(.form(attributes: [.enctype(.textPlain)]))
)
XCTAssertEqual(
"""
<label for="blob" form="form"></label>
""",
render(.label(attributes: [.for("blob"), .form("form")]))
)
XCTAssertEqual(
"""
<output for="blob" name="blob name"></output>
""",
render(.output(attributes: [.for("blob"), .name("blob name")]))
)
XCTAssertEqual(
"<canvas height=\"42\" width=\"43\"></canvas>",
render(.canvas(attributes: [.height(42), .width(43)])))
XCTAssertEqual(
"""
<iframe height="42" name="blob" sandbox src="src" srcdoc="Hello, world!" width="43"></iframe>
""",
render(
.iframe(
attributes: [
.height(42),
.name("blob"),
.sandbox(true),
.src("src"),
.srcdoc(.text("Hello, world!")),
.width(43),
]
)
)
)
XCTAssertEqual(
"""
<iframe></iframe>
""",
render(.iframe(attributes: [.sandbox(false)]))
)
XCTAssertEqual(
"""
<iframe sandbox="allow-forms allow-pointer-lock allow-popups allow-presentation allow-same-origin allow-scripts allow-top-navigation"></iframe>
""",
render(
.iframe(attributes: [
.sandbox([
.allowForms, .allowPointerLock, .allowPopups, .allowPresentation, .allowSameOrigin,
.allowScripts, .allowTopNavigation,
])
]))
)
XCTAssertEqual(
"""
<object height="42" name="blob" width="43"></object>
""",
render(.object(attributes: [.height(42), .name("blob"), .width(43)]))
)
XCTAssertEqual(
"<svg height=\"42\" width=\"43\"></svg>",
render(.svg(attributes: [.height(42), .width(43)], safe: "")))
XCTAssertEqual("<a hidden></a>", render(.a(attributes: [.hidden(true)])))
XCTAssertEqual("<a></a>", render(.a(attributes: [.hidden(false)])))
XCTAssertEqual(
"<a href=\"blob\" rel=\"alternate\"></a>",
render(.a(attributes: [.href("blob"), .rel(.alternate)])))
XCTAssertEqual(
"<area href=\"blob\" rel=\"alternate\">",
render(.area(attributes: [.href("blob"), .rel(.alternate)])))
XCTAssertEqual("<base href=\"blob\">", render(.base(attributes: [.href("blob")])))
XCTAssertEqual(
"<link href=\"blob\" rel=\"alternate\">",
render(.link(attributes: [.href("blob"), .rel(.alternate)])))
XCTAssertEqual(
"<a href=\"mailto:[email protected]\"></a>",
render(.a(attributes: [.mailto("[email protected]")])))
XCTAssertEqual(
"""
<a href="\
mailto:[email protected],[email protected]\
[email protected]&[email protected]&subject=Help!&body=I%20need%20somebody!\
"></a>
""",
render(
.a(
attributes: [
.mailto(
["[email protected]", "[email protected]"],
cc: ["[email protected]"],
bcc: ["[email protected]"],
subject: "Help!",
body: "I need somebody!"
)
]
)
)
)
XCTAssertEqual("<a id=\"blob\"></a>", render(.a(attributes: [.id("blob")])))
XCTAssertEqual("<a lang=\"en\"></a>", render(.a(attributes: [.lang(.en)])))
XCTAssertEqual("<details open></details>", render(.details(attributes: [.open(true)])))
XCTAssertEqual("<details></details>", render(.details(attributes: [.open(false)])))
XCTAssertEqual(
"<ol reversed start=\"1\"></ol>", render(.ol(attributes: [.reversed(true), .start(1)])))
XCTAssertEqual("<ol></ol>", render(.ol(attributes: [.reversed(false)])))
XCTAssertEqual("<area shape=\"circle\">", render(.area(attributes: [.shape(.circle)])))
XCTAssertEqual("<area shape=\"poly\">", render(.area(attributes: [.shape(.poly)])))
XCTAssertEqual("<area>", render(.area(attributes: [.shape(.rect)])))
XCTAssertEqual("<col span=\"1\">", render(.col(attributes: [.span(1)])))
XCTAssertEqual("<colgroup span=\"1\"></colgroup>", render(.colgroup(attributes: [.span(1)])))
XCTAssertEqual("<a spellcheck=\"true\"></a>", render(.a(attributes: [.spellcheck(true)])))
XCTAssertEqual("<a spellcheck=\"false\"></a>", render(.a(attributes: [.spellcheck(false)])))
XCTAssertEqual("<embed src=\"src\">", render(.embed(attributes: [.src("src")])))
XCTAssertEqual(
"<a style=\"display: none\"></a>", render(.a(attributes: [.style(safe: "display: none")])))
XCTAssertEqual("<a tabindex=\"1\"></a>", render(.a(attributes: [.tabindex(1)])))
XCTAssertEqual("<a target=\"_blank\"></a>", render(.a(attributes: [.target(.blank)])))
XCTAssertEqual("<a></a>", render(.a(attributes: [.target(.self)])))
XCTAssertEqual("<a target=\"_parent\"></a>", render(.a(attributes: [.target(.parent)])))
XCTAssertEqual("<a target=\"_top\"></a>", render(.a(attributes: [.target(.top)])))
XCTAssertEqual(
"<a target=\"custom\"></a>", render(.a(attributes: [.target(.init(rawValue: "custom"))])))
XCTAssertEqual("<a title=\"blob\"></a>", render(.a(attributes: [.title("blob")])))
XCTAssertEqual("<a translate=\"yes\"></a>", render(.a(attributes: [.translate(true)])))
XCTAssertEqual("<a translate=\"no\"></a>", render(.a(attributes: [.translate(false)])))
XCTAssertEqual(
"<button type=\"button\"></button>", render(.button(attributes: [.type(.button)])))
XCTAssertEqual("<button type=\"reset\"></button>", render(.button(attributes: [.type(.reset)])))
XCTAssertEqual(
"<button type=\"submit\"></button>", render(.button(attributes: [.type(.submit)])))
XCTAssertEqual("<ol type=\"1\"></ol>", render(.ol(attributes: [.type(.decimal)])))
XCTAssertEqual("<ol type=\"a\"></ol>", render(.ol(attributes: [.type(.lowerAlpha)])))
XCTAssertEqual("<ol type=\"A\"></ol>", render(.ol(attributes: [.type(.upperAlpha)])))
XCTAssertEqual("<ol type=\"i\"></ol>", render(.ol(attributes: [.type(.lowerRoman)])))
XCTAssertEqual("<ol type=\"I\"></ol>", render(.ol(attributes: [.type(.upperRoman)])))
}
}
| [
-1
] |
02a52de4c099bbe6dae7a7f4ee2e8a925a7a1b8f | 6b13d0f82ad71698625aa7949a102f62fef0746d | /CareKitStore/CareKitStore/Structs/Queries/OCKEventQuery.swift | 3a6a9cf5d0d7c2f8ea649fa4f744265b76c5c68f | [
"LicenseRef-scancode-bsd-3-clause-no-trademark",
"BSD-3-Clause"
] | permissive | giaoshbuging/CareKit | 1ee909f5db86f7a18de88d335dba9bbcf8e36582 | 348b1936df649ec33e32b9691dbcdbbe3e7fa10d | refs/heads/main | 2023-05-11T08:53:47.159034 | 2021-06-01T17:59:52 | 2021-06-01T17:59:52 | 373,340,026 | 1 | 0 | NOASSERTION | 2021-06-03T00:45:38 | 2021-06-03T00:45:37 | null | UTF-8 | Swift | false | false | 2,619 | swift | /*
Copyright (c) 2019, Apple Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import Foundation
/// A query that limits which events will be returned when fetching.
public struct OCKEventQuery: Equatable {
/// The date interval in which outcomes should match.
public var dateInterval: DateInterval
/// Initialize a new `OCKEventQuery` by specifying the start and end dates.
///
/// - Parameters:
/// - dateInterval: The date interval in which outcomes should match.
public init(dateInterval: DateInterval) {
self.dateInterval = dateInterval
}
/// Initialize a new `OCKEventQuery` by specifying a particular date.
///
/// - Parameters:
/// - date: The date from which the date interval will be created.
public init(for date: Date) {
let startOfDay = Calendar.current.startOfDay(for: date)
let endOfDay = Calendar.current.date(byAdding: DateComponents(day: 1, second: -1), to: startOfDay)!
self = Self(dateInterval: DateInterval(start: startOfDay, end: endOfDay))
}
}
| [
420151
] |
baaa5b8aabe7d2edf1822545511ca5f331c24b8a | 81813d379ae29a31a11a50d813d81674f0b0de2c | /A Sea of Quotes/A Sea of Quotes/Quote.swift | 04b3e0e31df335bbc789ff7cf4fe55c676a65ddb | [] | no_license | mayaah/ios-decal-proj4 | 3536822df3fe904b4440213531923f88ddd03fa1 | a3708d21f3befc0bcb6d4c581590e15a42167af3 | refs/heads/master | 2021-01-21T13:41:52.938690 | 2016-05-02T07:27:39 | 2016-05-02T07:27:39 | 55,557,772 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 954 | swift | //
// Quote.swift
// A Sea of Quotes
//
// Created by Maya Angelica on 4/24/16.
// Copyright © 2016 mayaah. All rights reserved.
//
import Foundation
class Quote {
var description : String!
var postURL : String!
var photoURL : String!
var photoData : NSData?
var saved : Bool = false
init(data : NSDictionary) {
let desc = getStringFromJSON(data, key: "summary")
self.description = desc
let post = getStringFromJSON(data, key: "post_url")
self.postURL = post
let photos = data["photos"] as! NSArray
let origSize = photos[0]["original_size"] as! NSDictionary
self.photoURL = getStringFromJSON(origSize, key: "url")
}
func getStringFromJSON(data: NSDictionary, key: String) -> String {
if let info = data[key] as? String {
return info
}
return ""
}
} | [
-1
] |
d9b2bc60d0b35c9e09b592aa696d3c63776c2f2b | 27f78f02102c5cd7cbeb74d74722f82ede7d1f05 | /QRWidget/QRWidgetApp.swift | 3528498b43b61cb0e56ef5a20145ff44caf2659e | [] | no_license | viikufa/QRWidget | 3c80584d6569ab2427c7f360050fc9cc06bea723 | 9f40160c4b653401adf3b37e91f3bb50c0c40256 | refs/heads/master | 2023-08-30T11:26:49.517262 | 2021-11-16T13:44:35 | 2021-11-16T13:44:35 | 428,411,054 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 224 | swift | //
// QRWidgetApp.swift
// QRWidget
//
// Created by Vitaliy on 15.11.2021.
//
import SwiftUI
@main
struct QRWidgetApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
| [
-1
] |
5728d9c7c070c2c76d17b81e109797e85c7e178f | af4f81af57eed92c17e75b0aa36fbcafdb2f6848 | /16_Automatic_reference_count.playground/Contents.swift | 082cde933c9065c6786bdc282fa12d3831f7e9fe | [] | no_license | yahanjunho/inflearn_swift_2.0 | f5e3584e663ed703992c30585a885a5de6560771 | 2ff0b051bba5d1863e6c24b604f7859a9d259b47 | refs/heads/master | 2021-06-29T04:38:35.443365 | 2017-09-17T14:38:17 | 2017-09-17T14:38:17 | 103,835,272 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,063 | swift | //: Playground - noun: a place where people can play
import UIKit
// 자동참조계수
// java는 가비지콜렉터를 사용함, 메모리 관리는 편리하나, 가비지컬렉터가 수시로 실행되어, 시스템에 부하를 준다. / full, minor등 수시로 수행
// C, C++은 개발자가 할당한 동적메모리를 직접 해제해야 한다. 에러의 가능성이 높다.
// 자동참조관리 기법
// 프로그램의 메모리 사용을 자동참조계수를 통해 추적하고 관리
// 필요없는 클래스의 인스턴스의 메모리를 자동적으로 해제
// 클래스의 인스턴스에만 적용
// ARC작동원리, ARC - Automatic Reference Counting
class Person {
var name: String
init(name: String) {
self.name = name
print("\(name) is being initialized")
}
deinit {
print("\(name) is deinitialized")
}
}
var reference1: Person?
var reference2: Person?
var reference3: Person?
reference1 = Person(name: "홍길동") // Person의 arc = 1, ARC가 Person인스턴스 메모리 유지 시작, 참조 +1
reference2 = reference1 // Person의 arc = 2, 참조 +2
reference3 = reference1 // Person의 arc = 3, 참조 +3
reference1 = nil // Person의 arc = 2, 참조 +2
reference2 = nil // Person의 arc = 1, 참조 +1
reference3 = nil // Person의 arc = 0 // 이 시점에서, Person의 인스턴스가 메모리 해제, deinit{} 호출함
// Person 인스턴스의 참조가 모두 없어져, ARC가 Person 인스턴스 메모리 할당 해제
// 강한참조순환
class Person_01 {
let name: String
var apartment: Apartment?
init(name: String) { self.name = name }
deinit { print("\(name) is being deinitialized") }
}
class Apartment {
let number: Int
var tenant: Person_01?
init(number: Int) { self.number = number }
deinit { print("Apartment #\(number) is being deinitialized") }}
var john: Person_01?
var number73: Apartment?
// Person과 Apartment가 1개 이상의 참조가 생겨, ARC가 각각의 인스턴스를 메모리 유지 시작
john = Person_01(name: "John Appleed") // person arc=1, reference count, fc
number73 = Apartment(number: 77) // apartment arc=1
// Person과 Apartment인스턴스가 서로를 강한 참조를 하게됨
john?.apartment = number73 // apartment arc=2
number73?.tenant = john // person arc=2
// 인스턴스를 참조하는 변수들을 해제시켜도, 인스턴스간의 강한 참조가 남아, 할당 해제가 되지 않는다.
// 참조할 방법이 존재하지 않는 객체들이 해제되지 않고 남아, 메모리를 차지함, 메모리 누수
// 인스턴스간 참조하는걸 해제할 방법이 없다. john?.apartment = number73 이렇게 할당후, john을 nil할당했으니...
// 직접, Person 인스턴스가 위치한 메모리 주소를 찾아서 해제하는 수밖에는 없다고 본다.
//john!.apartment = nil
//number73!.tenant = nil
john = nil // person arc=1
number73 = nil // apartment arc=1
// 해결
//var john: Person_01?
//var number73: Apartment?
//
//john = Person_01(name: "John Appleed") // person arc=1, reference count, fc
//number73 = Apartment(number: 77) // apartment arc=1
//
//john!.apartment = number73
//number73!.tenant = john
//
//john!.apartment = nil // 즉, 직접 john, number73을 nil할당하기전에, john과 number73객체가 직접 참조하는 변수에 대해 각각 nil로 할당 후에, john, number73을 nil로 할당한다. 근데 너무 어렵고 번거롭다? 실수할 가능성도 높다.
//number73!.tenant = nil
//
//john = nil
//number73 = nil
// 강한 참조 순환 방지 -> 약한 참조
// 약한 참조는 인스턴스가 다른 인스턴스를 참조할때, 참조 카운터를 유지하지 않고 참조함
// 참조하던 인스턴스가 할당 해제되면, nil을 할당
// 반드시 옵셔널 타입의 변수로 선언해야한다.
// 미소유참조
// 참조하는 인스턴스가 언제나 값을 가지고 있다고 간주
// 반드시 인스턴스를 참조하는게 확실할 때만 사용
class Person_02 {
let name: String
var apartment: Apartment_02?
init(name: String) { self.name = name }
deinit { print("\(name) is being deinitialized") }
}
class Apartment_02 {
let number: Int
weak var tenant: Person_02? // Apartment인스턴스가 Person인스턴스에 대해 약한 참조를 한다.
init(number: Int) { self.number = number }
deinit { print("Apartment #\(number) is being deinitialized") }}
var john_02: Person_02?
var number73_02: Apartment_02?
john_02 = Person_02(name: "John Appleed") // person_02 rc=1
number73_02 = Apartment_02(number: 73) // apartment_02 rc=1
john_02!.apartment = number73_02 // apartment_02 rc=2
number73_02!.tenant = john_02 // person_02 rc=1, 왜냐하면, weak키워드로 인한 약한참조
// Apartment인스턴스가 Person인스턴스에 대해, 약한 참조를 함
john_02 = nil
number73_02 = nil
// john_02가 nil이 되면, Person인스턴스에 대한 강한 참조가 없으므로, ARC가 Person인스턴스를 할당 해제시킨다.
// john_02가 nil이 되면서,john_02!.apartment = number73_02 구문도 아예 성립이 안되어, number73_02의 rc도 1이 줄어들고 결국 Apartment인스턴에 대한 강한 참조가 사라져, Apartment 인스턴스도 할당 해제된다.
// reference를 가지고 동작하지만, 인스턴스를 해제해야할지 판단할때는 사용하지 않는다.
// 즉 참조를 하되, 강한참조가 없을경우 인스턴스는 해제된다.
// 약한참조는 참조할 인스턴스가 존재하지 않을 가능성이 있으므로, 항상 옵셔널타입에 적용된다.
// unowned reference
// 약한 참조는 참조할 인스턴스가 존재하지 않을 가능성이 있으므로, 항상 옵셔널 타입에 적용된다.
// 옵셔널이 아닌, 프로퍼티가 강한 참조를 가지지 않게 하려면?
// 프로퍼티가 nil을 가지지 않는 것을 전제로하는 unowned reference를 사용한다.
// unowned 키워드를 프로퍼티 앞에 사용
// 미소유 참조
class Employee {
var name: String
var team: Team?
init(name: String) {
print("Employee init")
self.name = name
self.team = nil
}
deinit {
print("Employee deinit")
}
}
// Team클래스의 leader프로퍼티가 미소유 참조임
// Team클래스는 항상 leader프로퍼티를 가져야한다. (옵셔널이 아님)
// 하지만, 강한참조는 아니므로, 참조사이클이 생기지 않는다.
class Team {
var name: String
unowned var leader: Employee
init(name: String, leader: Employee) {
print("Team init")
self.name = name
self.leader = leader
}
deinit {
print("Team deinit")
}
}
var emp1: Employee? = Employee(name: "홍길동") // employee rc=1
var team1: Team? = Team(name: "개발팀", leader: emp1!) // team rc=1, employee rc=2
emp1!.team = team1 // team rc=2
team1 = nil // team rc=1
emp1 = nil // employee rc=1
| [
-1
] |
7b85266b058c02013796e7b232775e227857a422 | 9a38380349dfdfcb306ec428d9e6579a5a182e4e | /Lecture/CommonInputControls/CommonInputControls/AppDelegate.swift | 36495b70708fed6fc47bc7d5b7411dba398a0d55 | [
"MIT"
] | permissive | kaden-kykim/CICCC-iOS | 8d094c8ebe7d0745308b2f089d5f897e0aa469d1 | e8f3d0dccf93e24eab8838d4a04def29db01c55b | refs/heads/master | 2022-11-08T12:16:01.192736 | 2020-06-17T21:08:50 | 2020-06-17T21:08:50 | 255,718,473 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,421 | swift | //
// AppDelegate.swift
// CommonInputControls
//
// Created by Kaden Kim on 2020-04-17.
// Copyright © 2020 CICCC. 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,
213048,
385081,
376889,
393275,
376905,
327756,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
286831,
368752,
286844,
417924,
262283,
286879,
286888,
377012,
327871,
180416,
377036,
180431,
377046,
377060,
327914,
205036,
393456,
393460,
418043,
336123,
336128,
385280,
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,
410128,
393747,
254490,
188958,
385570,
33316,
197159,
377383,
352821,
188987,
418363,
369223,
385609,
385616,
352856,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
328378,
164538,
328386,
352968,
344776,
418507,
352971,
352973,
385742,
385748,
361179,
189153,
369381,
361195,
418553,
344831,
336643,
344835,
344841,
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,
345043,
386003,
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,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
345267,
386258,
328924,
66782,
222437,
328941,
386285,
386291,
345376,
353570,
345379,
410917,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181649,
181654,
230809,
181670,
181673,
181678,
181681,
337329,
181684,
181690,
361917,
181696,
337349,
181703,
337365,
271839,
329191,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
214610,
419410,
345701,
394853,
222830,
370297,
353919,
403075,
345736,
198280,
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,
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,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
338211,
395566,
248111,
362822,
436555,
190796,
379233,
354673,
321910,
248186,
420236,
379278,
272786,
354727,
338352,
330189,
338381,
338386,
256472,
338403,
338409,
248308,
199164,
330252,
199186,
330267,
354855,
10828,
199249,
346721,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
338660,
338664,
264941,
363251,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
330642,
355218,
412599,
207808,
379848,
396245,
330710,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
396328,
158761,
199728,
396336,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
339036,
412764,
257120,
265320,
248951,
420984,
330889,
347287,
248985,
339097,
44197,
380070,
339112,
249014,
126144,
330958,
330965,
265432,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
372015,
347441,
372018,
199988,
44342,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
175486,
249214,
175489,
249218,
249224,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
208311,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
249308,
339420,
339424,
249312,
339428,
339434,
249328,
69113,
372228,
208398,
380432,
175635,
339503,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
224897,
372353,
216707,
126596,
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,
421960,
356439,
430180,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
266453,
225493,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
397571,
389380,
61722,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
250199,
250202,
332125,
250210,
348522,
348525,
348527,
332152,
389502,
250238,
332161,
356740,
332172,
373145,
340379,
389550,
324030,
266687,
340451,
160234,
127471,
340472,
324094,
266754,
324099,
324102,
324111,
340500,
324117,
324131,
332324,
381481,
324139,
356907,
324142,
356916,
324149,
324155,
348733,
324164,
356934,
348743,
381512,
324170,
324173,
324176,
389723,
332380,
373343,
381545,
340627,
373398,
184982,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
332493,
357069,
357073,
332511,
332520,
340718,
332533,
348924,
389892,
373510,
389926,
152370,
348978,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
430939,
357211,
357214,
201579,
201582,
349040,
340849,
201588,
430965,
324472,
398201,
119674,
340858,
324475,
430972,
340861,
324478,
324481,
373634,
398211,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
422816,
324513,
398245,
201637,
324524,
340909,
324533,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
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,
341113,
349308,
210044,
349311,
160895,
152703,
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,
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,
333774,
358371,
350189,
350193,
350202,
333818,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
334011,
260289,
260298,
350410,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
325891,
350467,
350475,
375053,
268559,
350480,
432405,
350486,
325914,
350490,
325917,
350493,
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,
260801,
350917,
154317,
391894,
154328,
416473,
64230,
113388,
342766,
375535,
203506,
342776,
391937,
391948,
375568,
326416,
375571,
162591,
326441,
326451,
326454,
326460,
244540,
375612,
260924,
326467,
244551,
326473,
326477,
326485,
416597,
326490,
342874,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
326598,
359366,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
359451,
261147,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
384107,
367723,
187502,
384114,
343154,
212094,
351364,
384135,
384139,
384143,
351381,
384160,
384168,
367794,
384181,
367800,
384191,
351423,
384198,
326855,
244937,
253130,
343244,
146642,
359649,
343270,
351466,
351479,
384249,
343306,
261389,
359694,
253200,
261393,
384275,
245020,
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,
155351,
155354,
212699,
155363,
245475,
245483,
155371,
409335,
155393,
155403,
245525,
155422,
360223,
155438,
155442,
155447,
155461,
360261,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
262005,
147317,
425845,
262008,
262011,
155516,
155521,
155525,
360326,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
393169,
384977,
155611,
155619,
253923,
155621,
253926,
327654,
204784,
393203,
360438,
253943,
393206,
393212,
155646
] |
37ab38cbf828def9003387ebfac3b5fbe0ba105d | 452c33c0622ec36e93e6ff6637533a15a067a8a4 | /samples/client/petstore/swift4/rxswift/SwaggerClientTests/Pods/RxSwift/RxSwift/Concurrency/SynchronizedDisposeType.swift | ba729399b5081eb57dbe270f7305d21aba93180a | [
"Apache-2.0",
"MIT"
] | permissive | eric-erki/openapi-generator | 40c4294433bada9f693aca0c32326609e2234f9c | 0ea1ead59e41e4e8a959235dc8234d44447a9658 | refs/heads/master | 2023-01-07T03:33:36.315459 | 2019-09-20T18:13:33 | 2019-09-20T18:13:33 | 209,955,560 | 1 | 3 | Apache-2.0 | 2023-01-04T10:58:25 | 2019-09-21T09:09:49 | Java | UTF-8 | Swift | false | false | 400 | swift | //
// SynchronizedDisposeType.swift
// RxSwift
//
// Created by Krunoslav Zaher on 10/25/15.
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
protocol SynchronizedDisposeType: class, Disposable, Lock {
func _synchronized_dispose()
}
extension SynchronizedDisposeType {
func synchronizedDispose() {
lock(); defer { unlock() }
_synchronized_dispose()
}
}
| [
364,
38222,
112245,
15575,
137917
] |
6727ba9fa4e5749f1b6ffba427669cf700318ddf | 570d6a6fdfc0ec46ca071529e12348e80d5231c9 | /W3-homework/hw-w3/customview + cooklist/Week-3/Model/User.swift | 3dde6a91b52c4c3970e9e714a3c3fb107a94eaef | [
"MIT"
] | permissive | Yemeksepeti-Mobil-iOS-Bootcamp/Abdullah-Coban | 6ee73a4bea54a7f6639fb857d550aede03bb4eaa | 143a83eecc5fcdac467ce6fec98f5de2b6d88c08 | refs/heads/main | 2023-07-11T01:13:11.172258 | 2021-08-22T08:47:39 | 2021-08-22T08:47:39 | 380,024,475 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 265 | swift | //
// User.swift
// Week-3
//
// Created by Kerim Caglar on 3.07.2021.
//
import Foundation
struct User: Decodable {
let id: Int
let name: String
let email: String
let company: Company
}
struct Company: Decodable {
let name: String
}
| [
-1
] |
96256050989b448a4e8d95f03a5ee99263ec0144 | f173d5cf6a683195f6607931394eb4c6f092565f | /code/2072. Enumerations 08 - Enumerations/08 - Enumerations/Control Flow - End.playground/Pages/Challenge - For Loops.xcplaygroundpage/Contents.swift | f1b2a416264946488f64cd12d262828a6c84b4e7 | [
"MIT"
] | permissive | iOSDevLog/raywenderlich | ec4c775b18179be180d5e794553c0d6ed9ef2f97 | 8b81fbeb046abfeda95f9870c3c29b4998dbb12d | refs/heads/master | 2020-05-22T12:02:50.159112 | 2019-05-13T06:53:49 | 2019-05-13T06:53:49 | 186,328,282 | 4 | 2 | null | null | null | null | UTF-8 | Swift | false | false | 725 | swift | //: [Previous](@previous)
//: # Challenge Time - For Loops!
/*:
Create a constant called range and set it equal to a range starting at 1 and ending with 10 inclusive. Write a for loop which iterates over this range and prints the square of each number.
*/
let range = 1...10
for i in range {
let square = i * i
print(square)
}
/*:
The code below iterates over only even rows. Change this to use a where clause on the first for loop to skip even rows instead of using continue. Check that the sum is still 448 after your modifications.
*/
// TODO: Modify per instructions above
var sum = 0
for row in 0..<8 where row % 2 == 1 {
for column in 0..<8 {
sum += row * column
}
}
sum == 448
//: [Next](@next)
| [
-1
] |
f88a8bb0472da3f02cd77d4636552cec82431253 | f7ef1fa801bbd314a166aa9a5c48a21590de597e | /MovieInfoUrlSession/Favourite/FavouriteViewController.swift | 4ee1a0936294c68c1ce2d5d17c58adba3a269659 | [] | no_license | Zhyzhyrii/MovieInfoUrlSession | 152359735b5697cdb94f0c330d8f28879bac0f8d | 5bea48eb62ed146f5acb861e4b66930f047ad90a | refs/heads/master | 2020-07-13T21:42:52.645991 | 2019-12-05T21:17:05 | 2019-12-05T21:17:05 | 205,160,900 | 0 | 0 | null | 2019-12-05T20:47:18 | 2019-08-29T12:38:50 | Swift | UTF-8 | Swift | false | false | 3,368 | swift | //
// FavouriteViewController.swift
// MovieInfoUrlSession
//
// Created by Игорь on 11/4/19.
// Copyright (c) 2019 Igor Zhyzhyrii. All rights reserved.
//
// This file was generated by the Clean Swift Xcode Templates so
// you can apply clean architecture to your iOS and Mac projects,
// see http://clean-swift.com
//
import UIKit
protocol FavouriteDisplayLogic: class {
func displayMovies(viewModel: FavouriteModels.GetMovies.ViewModel)
func removeMovie(viewModel: FavouriteModels.RemoveMovie.ViewModel)
}
class FavouriteViewController: UITableViewController, FavouriteDisplayLogic {
var interactor: FavouriteBusinessLogic?
var router: (NSObjectProtocol & FavouriteRoutingLogic & FavouriteDataPassing)?
private var movies: [DisplayedDetails]!
// MARK: Object lifecycle
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
FavouriteConfigurator.shared.configure(with: self)
}
// MARK: View lifecycle
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
let request = FavouriteModels.GetMovies.Request()
interactor?.getMovies(request: request)
}
// MARK: Routing
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let scene = segue.identifier {
let selector = NSSelectorFromString("routeTo\(scene)WithSegue:")
if let router = router, router.responds(to: selector) {
router.perform(selector, with: segue)
}
}
}
func displayMovies(viewModel: FavouriteModels.GetMovies.ViewModel) {
movies = viewModel.displayedDetails
tableView.reloadData()
}
func removeMovie(viewModel: FavouriteModels.RemoveMovie.ViewModel) {
movies = viewModel.displayedDetails
tableView.reloadData()
}
}
// MARK: - Extension
extension FavouriteViewController {
// MARK: - Table view data source
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return movies.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! MovieCell
let movie = movies[indexPath.row]
cell.configure(with: movie)
return cell
}
}
extension FavouriteViewController {
//MARK: - Table view delegate
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let movieId = movies[indexPath.row].movieId
let request = FavouriteModels.SelectMovie.Request(movieId: movieId)
interactor?.selectMovie(request: request)
performSegue(withIdentifier: "DetailMovie", sender: nil)
}
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
let removedMovie = movies[indexPath.row]
let request = FavouriteModels.RemoveMovie.Request(removedMovie: removedMovie)
interactor?.removeMovie(request: request)
tableView.reloadData()
}
}
}
| [
-1
] |
5ab18582731a3be272f046e4b0da1854d29dd2ff | 236576b85ed1813c1ac72a0c26e0e44c94c05aef | /SwiftyStoreKit-macOS-Demo/ViewController.swift | d9a682a75acb6102604b29e49da115569cd5e143 | [
"MIT"
] | permissive | neoplastic/SwiftyStoreKit | 08a8a0e9ec11884b489b90d3d90fd1a46bab2053 | 7d34c2c9729ce1282f3fe1e1b550d9b1e682eba1 | refs/heads/master | 2020-04-15T06:38:02.473713 | 2017-06-03T17:50:24 | 2017-06-03T17:50:24 | 64,804,838 | 0 | 1 | null | 2016-08-03T01:31:09 | 2016-08-03T01:31:09 | null | UTF-8 | Swift | false | false | 10,819 | swift | //
// ViewController.swift
// SwiftStoreOSXDemo
//
// Created by phimage on 22/12/15.
//
// 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 Cocoa
import StoreKit
import SwiftyStoreKit
enum RegisteredPurchase: String {
case purchase1
case purchase2
case nonConsumablePurchase
case consumablePurchase
case autoRenewablePurchase
case nonRenewingPurchase
}
class ViewController: NSViewController {
let appBundleId = "com.musevisions.MacOS.SwiftyStoreKitDemo"
let purchase1Suffix = RegisteredPurchase.purchase1
let purchase2Suffix = RegisteredPurchase.autoRenewablePurchase
// MARK: actions
@IBAction func getInfo1(_ sender: Any?) {
getInfo(purchase1Suffix)
}
@IBAction func purchase1(_ sender: Any?) {
purchase(purchase1Suffix)
}
@IBAction func verifyPurchase1(_ sender: Any?) {
verifyPurchase(purchase1Suffix)
}
@IBAction func getInfo2(_ sender: Any?) {
getInfo(purchase2Suffix)
}
@IBAction func purchase2(_ sender: Any?) {
purchase(purchase2Suffix)
}
@IBAction func verifyPurchase2(_ sender: Any?) {
verifyPurchase(purchase2Suffix)
}
func getInfo(_ purchase: RegisteredPurchase) {
SwiftyStoreKit.retrieveProductsInfo([appBundleId + "." + purchase.rawValue]) { result in
self.showAlert(self.alertForProductRetrievalInfo(result))
}
}
func purchase(_ purchase: RegisteredPurchase) {
SwiftyStoreKit.purchaseProduct(appBundleId + "." + purchase.rawValue, atomically: true) { result in
if case .success(let purchase) = result {
// Deliver content from server, then:
if purchase.needsFinishTransaction {
SwiftyStoreKit.finishTransaction(purchase.transaction)
}
}
if let errorAlert = self.alertForPurchaseResult(result) {
self.showAlert(errorAlert)
}
}
}
@IBAction func restorePurchases(_ sender: Any?) {
SwiftyStoreKit.restorePurchases(atomically: true) { results in
for purchase in results.restoredPurchases where purchase.needsFinishTransaction {
// Deliver content from server, then:
SwiftyStoreKit.finishTransaction(purchase.transaction)
}
self.showAlert(self.alertForRestorePurchases(results))
}
}
@IBAction func verifyReceipt(_ sender: Any?) {
verifyReceipt(completion: { result in
self.showAlert(self.alertForVerifyReceipt(result))
})
}
func verifyReceipt(completion: @escaping (VerifyReceiptResult) -> Void) {
let appleValidator = AppleReceiptValidator(service: .production)
let password = "your-shared-secret"
SwiftyStoreKit.verifyReceipt(using: appleValidator, password: password, completion: completion)
}
func verifyPurchase(_ purchase: RegisteredPurchase) {
verifyReceipt { result in
switch result {
case .success(let receipt):
let productId = self.appBundleId + "." + purchase.rawValue
switch purchase {
case .autoRenewablePurchase:
let purchaseResult = SwiftyStoreKit.verifySubscription(
type: .autoRenewable,
productId: productId,
inReceipt: receipt
)
self.showAlert(self.alertForVerifySubscription(purchaseResult))
case .nonRenewingPurchase:
let purchaseResult = SwiftyStoreKit.verifySubscription(
type: .nonRenewing(validDuration: 60),
productId: productId,
inReceipt: receipt
)
self.showAlert(self.alertForVerifySubscription(purchaseResult))
default:
let purchaseResult = SwiftyStoreKit.verifyPurchase(
productId: productId,
inReceipt: receipt
)
self.showAlert(self.alertForVerifyPurchase(purchaseResult))
}
case .error(_):
self.showAlert(self.alertForVerifyReceipt(result))
}
}
}
}
// MARK: User facing alerts
extension ViewController {
func alertWithTitle(_ title: String, message: String) -> NSAlert {
let alert: NSAlert = NSAlert()
alert.messageText = title
alert.informativeText = message
alert.alertStyle = NSAlertStyle.informational
return alert
}
func showAlert(_ alert: NSAlert, handler: ((NSModalResponse) -> Void)? = nil) {
if let window = NSApplication.shared().keyWindow {
alert.beginSheetModal(for: window) { (response: NSModalResponse) in
handler?(response)
}
} else {
let response = alert.runModal()
handler?(response)
}
}
func alertForProductRetrievalInfo(_ result: RetrieveResults) -> NSAlert {
if let product = result.retrievedProducts.first {
let priceString = product.localizedPrice!
return alertWithTitle(product.localizedTitle, message: "\(product.localizedDescription) - \(priceString)")
} else if let invalidProductId = result.invalidProductIDs.first {
return alertWithTitle("Could not retrieve product info", message: "Invalid product identifier: \(invalidProductId)")
} else {
let errorString = result.error?.localizedDescription ?? "Unknown error. Please contact support"
return alertWithTitle("Could not retrieve product info", message: errorString)
}
}
func alertForPurchaseResult(_ result: PurchaseResult) -> NSAlert? {
switch result {
case .success(let purchase):
print("Purchase Success: \(purchase.productId)")
return alertWithTitle("Thank You", message: "Purchase completed")
case .error(let error):
print("Purchase Failed: \(error)")
switch error.code {
case .unknown: return alertWithTitle("Purchase failed", message: "Unknown error. Please contact support")
case .clientInvalid: // client is not allowed to issue the request, etc.
return alertWithTitle("Purchase failed", message: "Not allowed to make the payment")
case .paymentCancelled: // user cancelled the request, etc.
return nil
case .paymentInvalid: // purchase identifier was invalid, etc.
return alertWithTitle("Purchase failed", message: "The purchase identifier was invalid")
case .paymentNotAllowed: // this device is not allowed to make the payment
return alertWithTitle("Purchase failed", message: "The device is not allowed to make the payment")
}
}
}
func alertForRestorePurchases(_ results: RestoreResults) -> NSAlert {
if results.restoreFailedPurchases.count > 0 {
print("Restore Failed: \(results.restoreFailedPurchases)")
return alertWithTitle("Restore failed", message: "Unknown error. Please contact support")
} else if results.restoredPurchases.count > 0 {
print("Restore Success: \(results.restoredPurchases)")
return alertWithTitle("Purchases Restored", message: "All purchases have been restored")
} else {
print("Nothing to Restore")
return alertWithTitle("Nothing to restore", message: "No previous purchases were found")
}
}
func alertForVerifyReceipt(_ result: VerifyReceiptResult) -> NSAlert {
switch result {
case .success(let receipt):
print("Verify receipt Success: \(receipt)")
return self.alertWithTitle("Receipt verified", message: "Receipt verified remotely")
case .error(let error):
print("Verify receipt Failed: \(error)")
switch error {
case .noReceiptData:
return alertWithTitle("Receipt verification", message: "No receipt data. Try again.")
case .networkError(let error):
return alertWithTitle("Receipt verification", message: "Network error while verifying receipt: \(error)")
default:
return alertWithTitle("Receipt verification", message: "Receipt verification failed: \(error)")
}
}
}
func alertForVerifySubscription(_ result: VerifySubscriptionResult) -> NSAlert {
switch result {
case .purchased(let expiryDate):
print("Product is valid until \(expiryDate)")
return alertWithTitle("Product is purchased", message: "Product is valid until \(expiryDate)")
case .expired(let expiryDate):
print("Product is expired since \(expiryDate)")
return alertWithTitle("Product expired", message: "Product is expired since \(expiryDate)")
case .notPurchased:
print("This product has never been purchased")
return alertWithTitle("Not purchased", message: "This product has never been purchased")
}
}
func alertForVerifyPurchase(_ result: VerifyPurchaseResult) -> NSAlert {
switch result {
case .purchased:
print("Product is purchased")
return alertWithTitle("Product is purchased", message: "Product will not expire")
case .notPurchased:
print("This product has never been purchased")
return alertWithTitle("Not purchased", message: "This product has never been purchased")
}
}
}
| [
181546,
181548
] |
7b9079cf4906f3d191f058e400984b48bee78dc4 | ef63457ceac10d23c9ad4f68e15b2a1a2608b8fc | /AppDelegate.swift | 52ca195901e5de0fc2039e184c34f12b5ad7a5d1 | [] | no_license | charliehey1/FormalDinnerApp | c1c329ce65cf65e6402dc4a3aa17c76b57bbe641 | bf19727ec4365626d781658f08f721a4f0b15923 | refs/heads/master | 2021-05-17T03:29:07.156573 | 2020-03-27T17:29:10 | 2020-03-27T17:29:10 | 250,599,182 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,421 | swift | //
// AppDelegate.swift
// Formal Dinner2
//
// Created by Simon Burke on 2/25/20.
// Copyright © 2020 Simon Burke. 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,
385081,
376889,
393275,
376905,
327756,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
286831,
368752,
286844,
262283,
286879,
286888,
377012,
327871,
377036,
180431,
377046,
377060,
327914,
205036,
393456,
393460,
418043,
336123,
336128,
385280,
262404,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
262472,
344403,
213332,
65880,
262496,
418144,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
328206,
410128,
393747,
254490,
188958,
385570,
33316,
197159,
377383,
352821,
188987,
418363,
369223,
385609,
385616,
352856,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
336512,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
328378,
164538,
328386,
352968,
344776,
418507,
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,
361360,
222128,
345035,
345043,
386003,
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,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
386258,
328924,
66782,
222437,
386285,
328941,
386291,
345376,
353570,
345379,
410917,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181654,
230809,
181670,
181673,
181678,
181681,
337329,
181684,
181690,
361917,
181696,
337349,
181703,
337365,
271839,
329191,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
345701,
394853,
222830,
370297,
403070,
403075,
345736,
198280,
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,
345930,
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,
329832,
329855,
329867,
329885,
411805,
346272,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
321786,
379134,
411903,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
338211,
395566,
248111,
362822,
436555,
190796,
321879,
379233,
354673,
321910,
248186,
420236,
379278,
354727,
338352,
330189,
338381,
338386,
338403,
338409,
248308,
199164,
330252,
199186,
420376,
330267,
354855,
10828,
199249,
346721,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
338660,
338664,
264941,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
330642,
355218,
412599,
207808,
379848,
396245,
330710,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
396328,
158761,
199728,
396336,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
183383,
339036,
412764,
257120,
265320,
248951,
420984,
330889,
347287,
248985,
339097,
44197,
380070,
339112,
249014,
126144,
330958,
330965,
265432,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
372015,
347441,
372018,
199988,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
175486,
249214,
175489,
249218,
249224,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
388542,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
249308,
339420,
339424,
249312,
339428,
339434,
249328,
69113,
372228,
339461,
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,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
225103,
257871,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
339814,
225127,
257896,
274280,
257901,
225137,
339826,
257908,
225141,
257912,
225148,
257916,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
405533,
430129,
266294,
217157,
421960,
356439,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
266453,
225493,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
397571,
389380,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
348502,
250199,
250202,
332125,
250210,
348522,
348525,
348527,
332152,
389502,
250238,
332161,
356740,
332172,
373145,
340379,
389550,
324030,
266687,
340451,
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,
373343,
381545,
340627,
184982,
373398,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
332493,
357069,
357073,
332511,
332520,
340718,
332533,
348924,
389892,
373510,
389926,
152370,
348978,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
430939,
357211,
357214,
201579,
201582,
349040,
340849,
201588,
430965,
381813,
324472,
398201,
119674,
340858,
324475,
430972,
340861,
324478,
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,
381946,
349180,
439294,
431106,
209943,
209946,
250914,
357410,
185380,
357418,
209965,
209968,
209971,
209975,
209979,
209987,
209990,
341071,
349267,
250967,
210010,
341091,
210025,
210027,
210030,
210036,
210039,
341113,
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,
259421,
365921,
333154,
251235,
374117,
333162,
234866,
390516,
333175,
357755,
251271,
136590,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
415207,
366056,
366061,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
333399,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
333498,
210631,
333511,
358099,
153302,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
210695,
268041,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
366387,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
259938,
399206,
268143,
358255,
399215,
358259,
341876,
333689,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
358339,
333774,
358371,
350189,
350193,
350202,
333818,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
334011,
260289,
260298,
350410,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
325891,
350467,
350475,
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,
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,
375612,
260924,
326467,
244551,
326473,
326477,
326485,
416597,
326490,
342874,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
326598,
359366,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
359451,
261147,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
384107,
367723,
187502,
384114,
343154,
212094,
351364,
384135,
384139,
384143,
351381,
384151,
384160,
384168,
367794,
244916,
384181,
367800,
384188,
384191,
351423,
384198,
326855,
244937,
384201,
253130,
343244,
384208,
146642,
384224,
359649,
343270,
351466,
384246,
351479,
384249,
343306,
384269,
359694,
261389,
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,
253943,
245460,
155351,
155354,
212699,
245475,
155363,
245483,
155371,
409335,
155393,
155403,
245525,
155422,
360223,
155438,
155442,
155447,
155461,
360261,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
262005,
147317,
425845,
262008,
262011,
155516,
155521,
155525,
360326,
376714,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
393169,
384977,
155611,
155619,
253923,
155621,
253926,
327654,
204784,
393203,
360438,
393206,
393212,
155646
] |
784be578b494a0f78f6688e986f06d0e5ec2707b | 56c4dedfda788c94f477e50928606c482395d3bd | /MathForFun/CompareGame.swift | 4f8cf882a3ca25519688b71f7431a24e35000328 | [] | no_license | sajanshrestha2019/learning_kid | fa7813f058ccf688b263316c4b964a44baaa323c | 3fb574f3c990c76b7c11af2646c4e372fb0d3606 | refs/heads/master | 2023-06-11T00:29:39.718179 | 2021-07-04T20:30:32 | 2021-07-04T20:30:32 | 380,831,185 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 165 | swift | //
// CompareGame.swift
// MathForFun
//
// Created by Sajan Shrestha on 6/4/20.
// Copyright © 2020 Sajan Shrestha. All rights reserved.
//
import Foundation
| [
-1
] |
756efa85cbf9e65acd1ddca84d243e2d12f6c9e1 | 3d737663bcbfdb307041b80ccd137db8ea158f62 | /Sources/ThirdParty/Box/MutableBox.swift | ff160767b468c6e8ee16f2a1dbc7ee469a93f2a3 | [
"MIT"
] | permissive | attackgithub/ello-ios | 7616b3ecad5eaf8de9db64d802edc39459aa7aac | c854d5f32e55cfce32c2dcd94e9c9add72801c0e | refs/heads/master | 2020-09-15T13:07:00.030969 | 2019-11-04T14:27:50 | 2019-11-04T14:27:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 961 | swift | // Copyright (c) 2014 Rob Rix. All rights reserved.
/// Wraps a type `T` in a mutable reference type.
///
/// While this, like `Box<T>` could be used to work around limitations of value types, it is much more useful for sharing a single mutable value such that mutations are shared.
///
/// As with all mutable state, this should be used carefully, for example as an optimization, rather than a default design choice. Most of the time, `Box<T>` will suffice where any `BoxType` is needed.
final class MutableBox<T>: MutableBoxType, CustomStringConvertible {
/// Initializes a `MutableBox` with the given value.
init(_ value: T) {
self.value = value
}
/// The (mutable) value wrapped by the receiver.
var value: T
/// Constructs a new MutableBox by transforming `value` by `f`.
func map<U>(_ f: (T) -> U) -> MutableBox<U> {
return MutableBox<U>(f(value))
}
// MARK: Printable
var description: String {
return String(describing: value)
}
}
| [
227104,
363924,
130741
] |
9fe3960d02313ffaba4c587e937cff9f7cb1a89f | 0d32966275752fc2b19575803455a1250d7193ef | /SimpleStyleExample/SimpleStyleExample/AppStyles.swift | 5941a5deaab46318ae9a11cbad81abdbce6dccca | [
"MIT"
] | permissive | cjazz/SimpleStyleExample | edeacfd79685efd974bc8cf57bb27f1f7758f4c2 | ff9a350dd9eb0be9d5ed2d078797985ee62a56cf | refs/heads/master | 2020-09-06T20:18:24.700922 | 2019-11-08T20:11:18 | 2019-11-08T20:11:18 | 220,539,466 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 777 | swift | //
// AppStyles.swift
// SimpleStyleExample
//
//
import SwiftUI
//MARK: Buttons
struct GreenButtonStyle: ViewModifier {
func body(content: Content) -> some View {
return content
.foregroundColor(.white)
.background(Color.GreenColor)
.frame(minWidth: 44, minHeight: 44)
.cornerRadius(8)
}
}
struct BlueButtonStyle: ViewModifier {
func body(content: Content) -> some View {
return content
.foregroundColor(.white)
.background(Color.BlueColor)
.frame(minWidth: 44, minHeight: 44)
.cornerRadius(8)
}
}
//MARK: Colors (from Assets.xcassets)
extension Color {
static let BlueColor = Color("BlueColor")
static let GreenColor = Color("GreenColor")
static let AppBackgroundColor = Color("AppBackgroundColor")
}
| [
-1
] |
5fe37d99bcff6926b72ce857fde560b1091d4382 | f47425e01d6b82db33770d42804d19274832ac62 | /IvoryTower/MainTabViewControllers/MyAcademicVC/SchoolFolderVC.swift | 1f83a696bab06969be10301e727d9825329bf5f1 | [] | no_license | Fermionic-Lyu/IvoryTower | 0a9e27630f6e51513de890f0b37d285b7e3791d5 | e47e56864ba0a5d97d525a2025e18024bfcc9f74 | refs/heads/master | 2020-03-08T13:06:19.197163 | 2018-04-05T02:19:38 | 2018-04-05T02:19:38 | 128,149,045 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,193 | swift | //
// SchoolFolderVC.swift
// IvoryTower
//
// Created by Can Lyu on 2018/4/2.
// Copyright © 2018年 Can Lyu. All rights reserved.
//
import UIKit
class SchoolFolderVC : UIViewController , UITableViewDelegate, UITableViewDataSource {
let tableView : UITableView = UITableView()
override func viewDidLoad() {
super.viewDidLoad()
initView()
}
func initView() {
title = "学校收藏夹"
initTableView()
view.addSubview(tableView)
}
func initTableView() {
tableView.frame = view.bounds
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "ApplicationCell")
tableView.delegate = 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 {
let cell = tableView.dequeueReusableCell(withIdentifier: "ApplicationCell", for: indexPath)
return cell
}
}
| [
249324
] |
579ee86b03abde2818856ece133d21d028c2001a | 3235fa08b6e164053f498e2718612f0ddd18f532 | /IOS8SwiftAirdropTutorial/IOS8SwiftAirdropTutorialTests/IOS8SwiftAirdropTutorialTests.swift | da5df99a50cf01eb70d363debf1657bafdb47de6 | [
"MIT"
] | permissive | amar28187/ioscreator | 0d2cf72c09d509ed44c03c6a4a906e90ab341907 | bafc4f8f9ce6130e671877254e99c40d1a5f1c1a | refs/heads/master | 2020-12-29T01:23:22.257442 | 2018-06-05T07:31:52 | 2018-06-05T07:31:52 | 34,299,241 | 0 | 0 | MIT | 2018-06-05T07:31:53 | 2015-04-21T02:28:57 | Objective-C | UTF-8 | Swift | false | false | 958 | swift | //
// IOS8SwiftAirdropTutorialTests.swift
// IOS8SwiftAirdropTutorialTests
//
// Created by Arthur Knopper on 16/05/15.
// Copyright (c) 2015 Arthur Knopper. All rights reserved.
//
import UIKit
import XCTest
class IOS8SwiftAirdropTutorialTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
XCTAssert(true, "Pass")
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
// Put the code you want to measure the time of here.
}
}
}
| [
276492,
305179,
278558,
307231,
313375,
102437,
227370,
360491,
276534,
159807,
276543,
286788,
280649,
223316,
315476,
223318,
288857,
227417,
194652,
194656,
276577,
309345,
227428,
43109,
276582,
276585,
223340,
276589,
278638,
227439,
276592,
131189,
223350,
276603,
276606,
292992,
141450,
311435,
215178,
311438,
276627,
276632,
184475,
196773,
129203,
299187,
131256,
176314,
280762,
223419,
299198,
309444,
227528,
276682,
278742,
278746,
280802,
276709,
276710,
276715,
233715,
227576,
157944,
211193,
168188,
276753,
276760,
309529,
278810,
299293,
282919,
262450,
315706,
278846,
164162,
311621,
280902,
227658,
276813,
278863,
6481,
6482,
276821,
6489,
323935,
276835,
321894,
416104,
276847,
285040,
278898,
280961,
178571,
227725,
178578,
190871,
293274,
61857,
61859,
278954,
278961,
278965,
293303,
276920,
278969,
33211,
276925,
278978,
278985,
278993,
287198,
227809,
358882,
227813,
279013,
279022,
281072,
279039,
276998,
287241,
279050,
186893,
303631,
223767,
223769,
277017,
291358,
277029,
293419,
277048,
301634,
369220,
277066,
295519,
277094,
66150,
166507,
277101,
287346,
277111,
279164,
277118,
291454,
184962,
303746,
152203,
225933,
277133,
133774,
225936,
277138,
277142,
230040,
164512,
225956,
285353,
225962,
209581,
205487,
285361,
303793,
154291,
299699,
293556,
154294,
342706,
285371,
199366,
225997,
164563,
277204,
226004,
203477,
279252,
226007,
119513,
201442,
226019,
285415,
342762,
277227,
230134,
234234,
209660,
279294,
234241,
226051,
234245,
209670,
277254,
234250,
226058,
234253,
234256,
234263,
234268,
105246,
228129,
234277,
234280,
279336,
289576,
234283,
234286,
234289,
234294,
230199,
234301,
162621,
289598,
234304,
234305,
162626,
281408,
293693,
277316,
234311,
234312,
299849,
234317,
277325,
277327,
293711,
234323,
234326,
277339,
234331,
301918,
234335,
279392,
349026,
234340,
234343,
234346,
234349,
277360,
234355,
213876,
277366,
234360,
234361,
279417,
209785,
177019,
277370,
234366,
234367,
158593,
234372,
226181,
113542,
213894,
226184,
234377,
277381,
228234,
234381,
295824,
226194,
234387,
234386,
234392,
234395,
324507,
234400,
279456,
277410,
234404,
289703,
234409,
275371,
234412,
234413,
236461,
234419,
234425,
234427,
287677,
234430,
234436,
275397,
234438,
226249,
234444,
234445,
52172,
183248,
234450,
234451,
234454,
234457,
275418,
234463,
234466,
277479,
179176,
234472,
234473,
234477,
234482,
287731,
277492,
314355,
234492,
234495,
277505,
234498,
234500,
277509,
277510,
234503,
234506,
230410,
234509,
277517,
197647,
277518,
295953,
277523,
234517,
230423,
281625,
234522,
197657,
281626,
175132,
234530,
234531,
234534,
275495,
234539,
275500,
310317,
234542,
277550,
275505,
234548,
234555,
277563,
7229,
7230,
7231,
234560,
156733,
277566,
238651,
230463,
234565,
207938,
234569,
300111,
207953,
277585,
296018,
234577,
296019,
234583,
234584,
275547,
277596,
234594,
230499,
281700,
300135,
234603,
281707,
275565,
156785,
312434,
275571,
234612,
300151,
234616,
398457,
234622,
300158,
285828,
302213,
275590,
234631,
234632,
253063,
277640,
302217,
275591,
234642,
226451,
308372,
275607,
119963,
234652,
234656,
330913,
306338,
234659,
234663,
275625,
300201,
208043,
226479,
238769,
226481,
208058,
277690,
230588,
283840,
279747,
279760,
290000,
189652,
363744,
195811,
298212,
304356,
285929,
279792,
298228,
204022,
234742,
228600,
208124,
204041,
292107,
277792,
339234,
199971,
304421,
277800,
277803,
113966,
277806,
226608,
226609,
300343,
277821,
277824,
277825,
226624,
15686,
277831,
226632,
294218,
177484,
222541,
277838,
277841,
296273,
222548,
277844,
277845,
314709,
283991,
357719,
224605,
224606,
218462,
142689,
230756,
277862,
163175,
281962,
173420,
277868,
284014,
277871,
279919,
181625,
277882,
142716,
275838,
275839,
277890,
277891,
275847,
277896,
277897,
281992,
230799,
112017,
296338,
277907,
206228,
306579,
226711,
226712,
310692,
279974,
277927,
282024,
277936,
277939,
279989,
296375,
277946,
277949,
296387,
415171,
163269,
296391,
300487,
277962,
282060,
277965,
280013,
312782,
284116,
277974,
228823,
228824,
277977,
277980,
226781,
277983,
277988,
310757,
316902,
277993,
277994,
296425,
277997,
278002,
306677,
300542,
306693,
153095,
192010,
149007,
65041,
282136,
204313,
278060,
286254,
194110,
276040,
366154,
276045,
276046,
286288,
280147,
300630,
243292,
147036,
282213,
317032,
222832,
276085,
276088,
278140,
188031,
276097,
192131,
276100,
276101,
229001,
310923,
278160,
282259,
276116,
276117,
276120,
278170,
280220,
276126,
282273,
282276,
278191,
278195,
276148,
296628,
198324,
286388,
278201,
276156,
278214,
323276,
276173,
302797,
212688,
302802,
276179,
276180,
286423,
216795,
216796,
276195,
153319,
313065,
280300,
419569,
276210,
276219,
194303,
288512,
311042,
288516,
276238,
227091,
184086,
294678,
284442,
278299,
276253,
276257,
278307,
288547,
159533,
276279,
276282,
276283,
276287,
345919,
276294,
282438,
276298,
216918,
276311,
307031,
237408,
282474,
288619,
276332,
110452,
276344,
194429,
40853,
44952,
247712,
294823,
276394,
276401,
276408,
161722,
290746,
276413,
276421,
276430,
231375,
153552,
153554,
276444,
280541,
276454,
276459,
296941,
278518
] |
209e56427f039c9185260d874924c7431d75d050 | 487a0f3df7a53fd34225bc0c52c3f478800d81d8 | /Game-of-Life/Models/WebviewModel.swift | 38e322774341f643f03d56c11bf128c9130db03b | [] | no_license | GiPyoK/Game-of-Life | 85b2516549db464f42f1a36f2fdfcdd12b8a15ea | 9f2625309c8e7ad6b342d6108b3b9feb00fce718 | refs/heads/master | 2022-11-24T13:39:19.896171 | 2020-07-31T21:59:30 | 2020-07-31T21:59:30 | 282,956,911 | 0 | 0 | null | 2020-07-31T21:59:31 | 2020-07-27T16:41:00 | Swift | UTF-8 | Swift | false | false | 654 | swift | //
// Webview.swift
// Game-of-Life
//
// Created by Gi Pyo Kim on 7/30/20.
// Copyright © 2020 gipgip. All rights reserved.
//
import Foundation
import SwiftUI
import WebKit
struct WebviewModel: UIViewRepresentable {
var url: String
func makeUIView(context: Context) -> WKWebView {
guard let url = URL(string: self.url) else {
return WKWebView()
}
let request = URLRequest(url: url)
let wkWebview = WKWebView()
wkWebview.load(request)
return wkWebview
}
func updateUIView(_ uiView: UIViewType, context: Context) {
}
}
| [
333163
] |
3568715db3b7f33d6dc30e793282a887277f7a20 | 908231ba4bd97793c2f8f8e51a9d227879f161cb | /Bow Ties/Bowtie+CoreDataClass.swift | e53729b3c1587990f7deb407ebb4c44a77ce5372 | [] | no_license | qiao-zhang/CDbT | e0db889e4d9b39bec6a11543828f33ae3738677e | f7efeff2b3c032bf5a6e9b3fc10a7b4c32e754d7 | refs/heads/master | 2021-01-11T17:51:32.370561 | 2017-02-09T19:08:29 | 2017-02-09T19:08:29 | 79,846,635 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 234 | swift | //
// Bowtie+CoreDataClass.swift
// CDbT
//
// Created by Qiao Zhang on 1/23/17.
// Copyright © 2017 Qiao Zhang. All rights reserved.
//
import Foundation
import CoreData
@objc(Bowtie)
public class Bowtie: NSManagedObject {
}
| [
-1
] |
d0f8faa9dfa957de8e634c140465f9d7ebe8c9c2 | 0517ba85544ea13366fa68c4a40d288fd769ee2c | /MovieSwift/MovieSwift/views/components/movieDetail/MovieDetail.swift | b98233ac0a5129f378abd707ff874519b604d754 | [
"Apache-2.0"
] | permissive | danglu999/MovieSwiftUI | 282af8abd62a6adda930fdf71435949681d57b62 | b6c12860572eb16754919aa46f077c58b0bdfcd4 | refs/heads/master | 2023-05-09T01:32:20.463971 | 2021-06-01T12:10:59 | 2021-06-01T12:10:59 | 370,699,197 | 0 | 0 | Apache-2.0 | 2021-05-25T13:17:26 | 2021-05-25T13:17:25 | null | UTF-8 | Swift | false | false | 8,552 | swift | //
// MovieDetail.swift
// MovieSwift
//
// Created by Thomas Ricouard on 09/06/2019.
// Copyright © 2019 Thomas Ricouard. All rights reserved.
//
import SwiftUI
import SwiftUIFlux
import Combine
import UI
struct MovieDetail: ConnectedView {
struct Props {
let movie: Movie
let characters: [People]?
let credits: [People]?
let recommended: [Movie]?
let similar: [Movie]?
let reviewsCount: Int?
let videos: [Video]?
}
let movieId: Int
// MARK: View States
@State var isAddSheetPresented = false
@State var isCreateListFormPresented = false
@State var isAddedToListBadgePresented = false
@State var selectedPoster: ImageData?
// MARK: Computed Props
func map(state: AppState, dispatch: @escaping DispatchFunction) -> Props {
var characters: [People]?
var credits: [People]?
var recommended: [Movie]?
var similar: [Movie]?
if let peopleIds = state.peoplesState.peoplesMovies[movieId]?.sorted() {
let peoples = peopleIds.compactMap{ state.peoplesState.peoples[$0] }
characters = peoples.filter{ $0.character != nil}
credits = peoples.filter{ $0.department != nil }
if let recommendedIds = state.moviesState.recommended[movieId] {
recommended = recommendedIds.compactMap{ state.moviesState.movies[$0] }
}
if let simillarIds = state.moviesState.similar[movieId] {
similar = simillarIds.compactMap{ state.moviesState.movies[$0] }
}
}
return Props(movie: state.moviesState.movies[movieId]!,
characters: characters,
credits: credits,
recommended: recommended,
similar: similar,
reviewsCount: state.moviesState.reviews[movieId]?.count ?? nil,
videos: state.moviesState.videos[movieId])
}
// MARK: - Fetch
func fetchMovieDetails() {
store.dispatch(action: MoviesActions.FetchDetail(movie: movieId))
store.dispatch(action: PeopleActions.FetchMovieCasts(movie: movieId))
store.dispatch(action: MoviesActions.FetchRecommended(movie: movieId))
store.dispatch(action: MoviesActions.FetchSimilar(movie: movieId))
store.dispatch(action: MoviesActions.FetchMovieReviews(movie: movieId))
store.dispatch(action: MoviesActions.FetchVideos(movie: movieId))
}
// MARK: - View actions
func displaySavedBadge() {
isAddedToListBadgePresented = true
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
self.isAddedToListBadgePresented = false
}
}
func onAddButton() {
isAddSheetPresented.toggle()
}
// MARK: - Computed views
func addActionSheet(props: Props) -> ActionSheet {
var buttons: [Alert.Button] = []
let wishlistButton = ActionSheet.wishlistButton(store: store, movie: movieId) {
self.displaySavedBadge()
}
let seenButton = ActionSheet.seenListButton(store: store, movie: movieId) {
self.displaySavedBadge()
}
let customListButtons = ActionSheet.customListsButttons(store: store, movie: movieId) {
self.displaySavedBadge()
}
let createListButton: Alert.Button = .default(Text("Create list")) {
self.isCreateListFormPresented = true
}
let cancelButton = Alert.Button.cancel {
}
buttons.append(wishlistButton)
buttons.append(seenButton)
buttons.append(contentsOf: customListButtons)
buttons.append(createListButton)
buttons.append(cancelButton)
let sheet = ActionSheet(title: Text("Add or remove \(props.movie.userTitle) from your lists"),
message: nil,
buttons: buttons)
return sheet
}
// MARK: - Body
func peopleRow(role: String, people: People?) -> some View {
Group {
if people != nil {
NavigationLink(destination: PeopleDetail(peopleId: people!.id)) {
HStack(alignment: .center, spacing: 0) {
Text(role + ": ").font(.callout)
Text(people!.name).font(.body).foregroundColor(.secondary)
}
}
}
}
}
func peopleRows(props: Props) -> some View {
Group {
peopleRow(role: "Director", people: props.credits?.filter{ $0.department == "Directing" }.first)
}
}
func topSection(props: Props) -> some View {
Section {
MovieCoverRow(movieId: movieId)
MovieButtonsRow(movieId: movieId, showCustomListSheet: $isAddSheetPresented)
if props.reviewsCount ?? 0 > 0 {
NavigationLink(destination: MovieReviews(movie: self.movieId)) {
Text("\(props.reviewsCount!) reviews")
.foregroundColor(.steam_blue)
.lineLimit(1)
}
}
if !props.movie.overview.isEmpty {
MovieOverview(movie: props.movie)
}
}
}
func bottomSection(props: Props) -> some View {
Section {
if props.movie.keywords?.keywords?.isEmpty == false {
MovieKeywords(keywords: props.movie.keywords!.keywords!)
}
if props.characters?.isEmpty == false {
MovieCrosslinePeopleRow(title: "Cast",
peoples: props.characters ?? [])
}
if props.credits?.isEmpty == false {
peopleRows(props: props)
MovieCrosslinePeopleRow(title: "Crew",
peoples: props.credits ?? [])
}
if props.similar?.isEmpty == false {
MovieCrosslineRow(title: "Similar Movies", movies: props.similar ?? [])
}
if props.recommended?.isEmpty == false {
MovieCrosslineRow(title: "Recommended Movies", movies: props.recommended ?? [])
}
if props.movie.images?.posters?.isEmpty == false {
MoviePostersRow(posters: props.movie.images!.posters!.prefix(8).map{ $0 },
selectedPoster: $selectedPoster)
}
if props.movie.images?.backdrops?.isEmpty == false {
MovieBackdropsRow(backdrops: props.movie.images!.backdrops!.prefix(8).map{ $0 })
}
}
}
func body(props: Props) -> some View {
ZStack(alignment: .bottom) {
List {
topSection(props: props)
bottomSection(props: props)
}
.navigationBarTitle(Text(props.movie.userTitle), displayMode: .large)
.navigationBarItems(trailing: Button(action: onAddButton) {
Image(systemName: "text.badge.plus").imageScale(.large)
})
.onAppear {
self.fetchMovieDetails()
}
.actionSheet(isPresented: $isAddSheetPresented, content: { addActionSheet(props: props) })
.sheet(isPresented: $isCreateListFormPresented,
content: { CustomListForm(editingListId: nil)
.environmentObject(store) })
.disabled(selectedPoster != nil)
.blur(radius: selectedPoster != nil ? 30 : 0)
.scaleEffect(selectedPoster != nil ? 0.8 : 1)
NotificationBadge(text: "Added successfully",
color: .blue,
show: $isAddedToListBadgePresented).padding(.bottom, 10)
ImagesCarouselView(posters: props.movie.images?.posters ?? [],
selectedPoster: $selectedPoster)
.blur(radius: selectedPoster != nil ? 0 : 10)
.scaleEffect(selectedPoster != nil ? 1 : 1.2)
.opacity(selectedPoster != nil ? 1 : 0)
}
}
}
// MARK: - Preview
#if DEBUG
struct MovieDetail_Previews : PreviewProvider {
static var previews: some View {
NavigationView {
MovieDetail(movieId: sampleMovie.id).environmentObject(sampleStore)
}.navigationViewStyle(StackNavigationViewStyle())
}
}
#endif
| [
-1
] |
d5cf3b98eae7592fd202f3644d3209d972684d0d | 69c7f1193469a979da5c96c0554dc52988083092 | /piwigo/Image/Parameters/Tags/TagsViewController.swift | 8fa14b0ae1167408ebfc433e7ccffa6f7059517e | [
"MIT"
] | permissive | Piwigo/Piwigo-Mobile | bcb8c9534caccc647a26ff038f0f2c848b9b0184 | 47f0dc561af17b31cee684743258455af33c2614 | refs/heads/master | 2023-08-16T20:25:18.654828 | 2023-07-15T16:02:17 | 2023-07-15T16:02:17 | 30,383,871 | 92 | 33 | MIT | 2023-07-15T16:02:19 | 2015-02-05T23:18:07 | Swift | UTF-8 | Swift | false | false | 17,239 | swift | //
// TagsViewController.swift
// piwigo
//
// Created by Spencer Baker on 2/18/15.
// Copyright (c) 2015 bakercrew. All rights reserved.
//
// Converted to Swift 5.1 by Eddy Lelièvre-Berna on 17/07/2020.
//
import UIKit
import CoreData
import piwigoKit
protocol TagsViewControllerDelegate: NSObjectProtocol {
func didSelectTags(_ selectedTags: Set<Tag>)
}
class TagsViewController: UITableViewController {
weak var delegate: TagsViewControllerDelegate?
private var updateOperations: [BlockOperation] = [BlockOperation]()
// Called before uploading images (Tag class)
private var selectedTagIds = Set<Int32>()
func setPreselectedTagIds(_ preselectedTagIds: Set<Int32>?) {
selectedTagIds = preselectedTagIds ?? Set<Int32>()
}
// MARK: - Core Data Objects
var user: User!
lazy var mainContext: NSManagedObjectContext = {
guard let context: NSManagedObjectContext = user?.managedObjectContext else {
fatalError("!!! Missing Managed Object Context !!!")
}
return context
}()
// MARK: - Core Data Providers
lazy var tagProvider: TagProvider = {
let provider : TagProvider = TagProvider.shared
return provider
}()
// MARK: - Core Data Source
lazy var tagPredicates: [NSPredicate] = {
let andPredicates = [NSPredicate(format: "server.path == %@", NetworkVars.serverPath)]
return andPredicates
}()
lazy var selectedTagsPredicate: NSPredicate = {
var andPredicates = tagPredicates
andPredicates.append(NSPredicate(format: "tagId IN $tagIds"))
return NSCompoundPredicate(andPredicateWithSubpredicates: andPredicates)
}()
func getSelectedVars() -> [String : Any] {
return ["tagIds" : selectedTagIds]
}
lazy var fetchSelectedTagsRequest: NSFetchRequest = {
// Sort tags by name i.e. the order in which they are presented in the web UI
let fetchRequest = Tag.fetchRequest()
fetchRequest.sortDescriptors = [NSSortDescriptor(key: #keyPath(Tag.tagName), ascending: true,
selector: #selector(NSString.localizedCaseInsensitiveCompare(_:)))]
fetchRequest.predicate = selectedTagsPredicate.withSubstitutionVariables(getSelectedVars())
fetchRequest.fetchBatchSize = 20
return fetchRequest
}()
lazy var selectedTags: NSFetchedResultsController<Tag> = {
let tags = NSFetchedResultsController(fetchRequest: fetchSelectedTagsRequest,
managedObjectContext: mainContext,
sectionNameKeyPath: nil, cacheName: nil)
tags.delegate = self
return tags
}()
var searchQuery = ""
lazy var nonSelectedTagsPredicate: NSPredicate = {
var andPredicates = tagPredicates
andPredicates.append(NSPredicate(format: "NOT (tagId IN $tagIds)"))
andPredicates.append(NSPredicate(format: "tagName LIKE[c] $query"))
return NSCompoundPredicate(andPredicateWithSubpredicates: andPredicates)
}()
func getNonSelectedVars() -> [String : Any] {
return ["tagIds" : selectedTagIds,
"query" : "*" + searchQuery + "*"]
}
lazy var fetchNonSelectedTagsRequest: NSFetchRequest = {
// Sort tags by name i.e. the order in which they are presented in the web UI
let fetchRequest = Tag.fetchRequest()
fetchRequest.sortDescriptors = [NSSortDescriptor(key: #keyPath(Tag.tagName), ascending: true,
selector: #selector(NSString.localizedCaseInsensitiveCompare(_:)))]
fetchRequest.predicate = nonSelectedTagsPredicate.withSubstitutionVariables(getNonSelectedVars())
fetchRequest.fetchBatchSize = 20
return fetchRequest
}()
lazy var nonSelectedTags: NSFetchedResultsController<Tag> = {
let tags = NSFetchedResultsController(fetchRequest: fetchNonSelectedTagsRequest,
managedObjectContext: mainContext,
sectionNameKeyPath: nil, cacheName: nil)
tags.delegate = self
return tags
}()
// MARK: - View Lifecycle
@IBOutlet var tagsTableView: UITableView!
private var letterIndex: [String] = []
var allTagNames = Set<String>()
let searchController = UISearchController(searchResultsController: nil)
var addAction: UIAlertAction?
private var addBarButton: UIBarButtonItem?
private var hudViewController: UIViewController?
override func viewDidLoad() {
super.viewDidLoad()
// Add search bar
initSearchBar()
// Use the TagsProvider to fetch tag data. On completion,
// handle general UI updates and error alerts on the main queue.
NetworkUtilities.checkSession(ofUser: user) {
self.tagProvider.fetchTags(asAdmin: self.user.hasAdminRights) { error in
guard let error = error else { return } // Done if no error
// Show an alert if there was an error.
DispatchQueue.main.async {
self.dismissPiwigoError(withTitle: TagError.fetchFailed.localizedDescription,
message: error.localizedDescription) { }
}
}
} failure: { error in
// Show an alert if there was an error.
DispatchQueue.main.async {
self.dismissPiwigoError(withTitle: TagError.fetchFailed.localizedDescription,
message: error.localizedDescription) { }
}
}
// Title
title = NSLocalizedString("tags", comment: "Tags")
// Add button for Admins and some Community users
if user.hasAdminRights {
addBarButton = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(requestNewTagName))
navigationItem.setRightBarButton(addBarButton, animated: false)
}
}
@objc func applyColorPalette() {
// Background color of the view
view.backgroundColor = .piwigoColorBackground()
// Navigation bar
let attributes = [
NSAttributedString.Key.foregroundColor: UIColor.piwigoColorWhiteCream(),
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 17)
]
navigationController?.navigationBar.titleTextAttributes = attributes
navigationController?.navigationBar.prefersLargeTitles = false
navigationController?.navigationBar.barStyle = AppVars.shared.isDarkPaletteActive ? .black : .default
navigationController?.navigationBar.tintColor = .piwigoColorOrange()
navigationController?.navigationBar.barTintColor = .piwigoColorBackground()
navigationController?.navigationBar.backgroundColor = .piwigoColorBackground()
// Table view
tagsTableView?.separatorColor = .piwigoColorSeparator()
tagsTableView?.indicatorStyle = AppVars.shared.isDarkPaletteActive ? .white : .black
tagsTableView?.reloadData()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Set colors, fonts, etc.
applyColorPalette()
// Initialise data source
do {
try selectedTags.performFetch()
try nonSelectedTags.performFetch()
} catch {
debugPrint("Error: \(error)")
}
// Refresh table
tagsTableView.reloadData()
// Register palette changes
NotificationCenter.default.addObserver(self, selector: #selector(applyColorPalette),
name: .pwgPaletteChanged, object: nil)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
// Dismiss search bar
searchController.dismiss(animated: false)
// Return list of selected tags
delegate?.didSelectTags(Set(selectedTags.fetchedObjects ?? []))
}
deinit {
// Unregister palette changes
NotificationCenter.default.removeObserver(self, name: .pwgPaletteChanged, object: nil)
}
// MARK: - UITableView - Header
private func getContentOfHeader(inSection section: Int) -> String {
if section == 0 {
return NSLocalizedString("tagsHeader_selected", comment: "Selected")
} else {
return NSLocalizedString("tagsHeader_notSelected", comment: "Not Selected")
}
}
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
let title = getContentOfHeader(inSection: section)
return TableViewUtilities.shared.heightOfHeader(withTitle: title,
width: tableView.frame.size.width)
}
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let title = getContentOfHeader(inSection: section)
return TableViewUtilities.shared.viewOfHeader(withTitle: title)
}
// MARK: - UITableView Rows & Cells
override func numberOfSections(in tableView: UITableView) -> Int {
return 2
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
switch section {
case 0:
let objects = selectedTags.fetchedObjects
return objects?.count ?? 0
case 1:
let objects = nonSelectedTags.fetchedObjects
return objects?.count ?? 0
default:
fatalError("Unknown tableView section!")
}
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "TagTableViewCell", for: indexPath) as? TagTableViewCell else {
print("Error: tableView.dequeueReusableCell does not return a TagTableViewCell!")
return TagTableViewCell()
}
switch indexPath.section {
case 0 /* Selected tags */:
cell.configure(with: selectedTags.object(at: indexPath), andEditOption: .remove)
case 1 /* Non-selected tags */:
let indexPath1 = IndexPath(row: indexPath.row, section: 0)
cell.configure(with: nonSelectedTags.object(at: indexPath1), andEditOption: .add)
default:
fatalError("Unknown tableView section!")
}
return cell
}
// MARK: - UITableViewDelegate Methods
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
switch indexPath.section {
case 0 /* Selected tags */:
// Tapped selected tag
let currentTag = selectedTags.object(at: indexPath)
// Remove tag from list of selected tags
selectedTagIds.remove(currentTag.tagId)
// Update fetch requests and perform fetches
do {
fetchSelectedTagsRequest.predicate = selectedTagsPredicate.withSubstitutionVariables(getSelectedVars())
try selectedTags.performFetch()
fetchNonSelectedTagsRequest.predicate = nonSelectedTagsPredicate.withSubstitutionVariables(getNonSelectedVars())
try nonSelectedTags.performFetch()
// Determine new indexPath of deselected tag
if let indexOfTag = nonSelectedTags.fetchedObjects?.firstIndex(where: {$0.tagId == currentTag.tagId}) {
let insertPath = IndexPath(row: indexOfTag, section: 1)
// Move cell from top to bottom section
tableView.moveRow(at: indexPath, to: insertPath)
// Update icon of cell
if let indexPaths = tableView.indexPathsForVisibleRows,
indexPaths.contains(insertPath) {
tableView.reloadRows(at: [insertPath], with: .automatic)
}
}
}
catch {
debugPrint("••> Could not perform fetch!!!")
}
case 1 /* Non-selected tags */:
// Tapped non selected tag
let indexPath1 = IndexPath(row: indexPath.row, section: 0)
let currentTag = nonSelectedTags.object(at: indexPath1)
// Add tag to list of selected tags
selectedTagIds.insert(currentTag.tagId)
// Update fetch requests and perform fetches
do {
fetchSelectedTagsRequest.predicate = selectedTagsPredicate.withSubstitutionVariables(getSelectedVars())
try selectedTags.performFetch()
fetchNonSelectedTagsRequest.predicate = nonSelectedTagsPredicate.withSubstitutionVariables(getNonSelectedVars())
try nonSelectedTags.performFetch()
// Determine new indexPath of selected tag
if let indexOfTag = selectedTags.fetchedObjects?.firstIndex(where: {$0.tagId == currentTag.tagId}) {
let insertPath = IndexPath(row: indexOfTag, section: 0)
// Move cell from bottom to top section
tableView.moveRow(at: indexPath, to: insertPath)
// Update icon of cell
if let indexPaths = tableView.indexPathsForVisibleRows,
indexPaths.contains(insertPath) {
tableView.reloadRows(at: [insertPath], with: .automatic)
}
}
}
catch {
debugPrint("••> Could not perform fetch!!!")
}
default:
fatalError("Unknown tableView section!")
}
}
}
// MARK: - NSFetchedResultsControllerDelegate
extension TagsViewController: NSFetchedResultsControllerDelegate {
func controllerWillChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
// Initialise update operations
updateOperations.removeAll(keepingCapacity: false)
// Begin the update
tableView.beginUpdates()
}
func controller(_ controller: NSFetchedResultsController<NSFetchRequestResult>, didChange anObject: Any, at indexPath: IndexPath?, for type: NSFetchedResultsChangeType, newIndexPath: IndexPath?) {
// Initialisation
var hasTagsInSection1 = false
if controller == nonSelectedTags {
hasTagsInSection1 = true
}
// Collect operation changes
switch type {
case .insert:
// Insert tag into the right list of tags
guard var newIndexPath = newIndexPath else { return }
if hasTagsInSection1 { newIndexPath.section = 1 }
updateOperations.append( BlockOperation { [weak self] in
print("••> Insert tag item at \(newIndexPath)")
self?.tagsTableView?.insertRows(at: [newIndexPath], with: .automatic)
})
case .update:
guard var indexPath = indexPath else { return }
if hasTagsInSection1 { indexPath.section = 1 }
updateOperations.append( BlockOperation { [weak self] in
print("••> Update tag item at \(indexPath)")
self?.tableView?.reloadRows(at: [indexPath], with: .automatic)
})
case .move:
guard var indexPath = indexPath, var newIndexPath = newIndexPath else { return }
if hasTagsInSection1 {
indexPath.section = 1
newIndexPath.section = 1
}
updateOperations.append( BlockOperation { [weak self] in
print("••> Move tag item from \(indexPath) to \(newIndexPath)")
self?.tableView?.moveRow(at: indexPath, to: newIndexPath)
})
case .delete:
guard var indexPath = indexPath else { return }
if hasTagsInSection1 { indexPath.section = 1 }
updateOperations.append( BlockOperation { [weak self] in
print("••> Delete tag item at \(indexPath)")
self?.tableView?.deleteRows(at: [indexPath], with: .automatic)
})
@unknown default:
fatalError("TagsViewController: unknown NSFetchedResultsChangeType")
}
}
func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
// Do not update items if the album is not presented.
if view.window == nil { return }
// Any update to perform?
if updateOperations.isEmpty || view.window == nil { return }
// Perform all updates
tableView?.performBatchUpdates({ () -> Void in
for operation: BlockOperation in self.updateOperations {
operation.start()
}
})
// End updates
tableView.endUpdates()
}
}
| [
-1
] |
80d7b19f14bcd4d0b37087167b430a267c19e7e7 | 40674e93924408f07bbb7093461e4f91851cb2d2 | /pholio01/UploadTask/UploadPresenter.swift | 155f6c0029fa1610b3c84515b6fefb94d7e329fa | [] | no_license | chrislasers/pholio01 | 427525988fb22629adc3a988f9f267c53581b370 | 5a5c7d1069aa542c7f0778bda40334b2dbb35724 | refs/heads/master | 2022-06-21T10:30:01.239006 | 2022-06-04T17:40:39 | 2022-06-04T17:40:39 | 138,263,507 | 0 | 1 | null | 2018-08-04T02:13:34 | 2018-06-22T06:26:02 | Swift | UTF-8 | Swift | false | false | 3,526 | swift | //
// UploadPresenter.swift
// pholio01
//
// Created by Chris Ransom on 6/2/18.
// Copyright © 2018 Chris Ransom. All rights reserved.
//
import UIKit
import FirebaseCore
import FirebaseDatabase
import FirebaseAuth
import Firebase
import FirebaseStorage
import SwiftValidator
import Photos
import FirebaseFirestore
import FirebaseCore
class UploadPresenter: NSObject {
weak var viewController: SelectImageVC?
let userID = Auth.auth().currentUser?.uid
var ref: DatabaseReference!
//let collection = Firestore.firestore().collection("PHOTOS").document((Auth.auth().currentUser?.uid)!).updateData
let collection = Firestore.firestore().collection("PHOTOS")
private let imageUploadManager = ImageUploadManager()
lazy var queue: OperationQueue = {
let queue = OperationQueue()
queue.maxConcurrentOperationCount = 1
return queue
}()
var uploadedURLs: [URL] = []
init(viewController: SelectImageVC?) {
self.viewController = viewController
}
// MARK: Uploading content
func createCar(with images: [UIImage]) {
// 1. Upload the images 1-by-1
for image in images {
let imageUploadOperation = UploadImageOperation(image: image)
imageUploadOperation.onProgress = { [unowned self] (progress) in
if let viewController = self.viewController {
let viewWidth = viewController.progressView.frame.width
let partWidth = viewWidth / CGFloat(images.count)
var progressPart = partWidth * CGFloat(progress)
if self.uploadedURLs.count > 0 {
progressPart += (CGFloat(self.uploadedURLs.count) * partWidth)
}
self.viewController?.updateProgressView(with: Float(progressPart)/Float(viewWidth))
}
}
imageUploadOperation.onDidUpload = { [unowned self] (url) in
if let url = url {
self.uploadedURLs.append(url)
print("Success URL")
} else {
print("No Image URLs")
}
}
if let lastOp = queue.operations.last {
imageUploadOperation.addDependency(lastOp)
}
queue.addOperation(imageUploadOperation)
queue.isSuspended = false
}
// 2. Create the car object with the image urls, title, price
let finishOperation = BlockOperation { [unowned self] in
self.CreateCar(imageURLs: self.uploadedURLs.compactMap({ $0.absoluteString }) )
}
if let lastOp = queue.operations.last {
finishOperation.addDependency(lastOp)
}
queue.addOperation(finishOperation)
queue.isSuspended = false
}
func CreateCar(imageURLs: [String]) {
let car = Car(objectID: nil, imageURLs: imageURLs)
collection.addDocument(data: car.dictionary()) { [unowned self] (error) in
if let error = error {
print("Queue Error Occured")
print(error.localizedDescription)
} else {
self.viewController?.performSegue(withIdentifier: "toAddPhoto", sender: nil)
}
}
}
}
| [
-1
] |
69527cc57a94accf9508f8083fe248207a1b6043 | aa4892d488f3c67bb6c567f63a1fa53955e2ea26 | /Exercise#1/PhotosTableViewCell.swift | 7a40d2ccc852bd99fbda1b8cf4e558b1ba1a3648 | [] | no_license | ohhmaar/instagram-example-2 | b2fdfbdd6db87ed970bed6133c42081ffa38d5cf | 80a346d2a9855573ddfdbb4b94e7f9af7e4ad7c2 | refs/heads/master | 2021-01-16T01:01:42.834967 | 2015-05-18T03:47:06 | 2015-05-18T03:47:06 | 35,795,355 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 608 | swift | //
// PhotosTableViewCell.swift
// Exercise#1
//
// Created by Omar Basrawi on 4/23/15.
// Copyright (c) 2015 Omar Basrawi. All rights reserved.
//
import UIKit
class PhotosTableViewCell: UITableViewCell {
@IBOutlet weak var photoImageView: UIImageView!
@IBOutlet weak var detailPhotoView: UIImageView!
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
}
}
| [
159072,
301925,
293670,
300392,
217192,
306996,
314425,
280156
] |
2d77d9e4093a07db0f0497b56377fe78f9d8ec87 | 21aad12f14a8f4d9760aff32a201d3b6029d919c | /TestViperLogin/AppDelegate.swift | 3c68c587389d15e89fe3b3646c55923962a1d3b4 | [] | no_license | royalthings/TestViperLogin | 605e28c26c4788b65ea142a358a07ec8f82cfda3 | 3c7509a5dd2d340eecfecfedaf21348288cb3137 | refs/heads/master | 2020-09-16T10:22:45.452026 | 2019-11-24T12:31:56 | 2019-11-24T12:31:56 | 223,740,859 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,419 | swift | //
// AppDelegate.swift
// TestViperLogin
//
// Created by Дмитрий Ага on 11/24/19.
// Copyright © 2019 Дмитрий Ага. 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,
385081,
376889,
393275,
376905,
327756,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
286831,
368752,
286844,
262283,
286879,
286888,
377012,
327871,
180416,
377036,
180431,
377046,
377060,
327914,
205036,
393456,
393460,
336123,
418043,
336128,
385280,
262404,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
262472,
344403,
213332,
65880,
418144,
262496,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
328206,
410128,
393747,
254490,
188958,
385570,
33316,
197159,
377383,
352821,
188987,
418363,
369223,
385609,
385616,
352856,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
336512,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
164538,
328378,
328386,
352968,
344776,
418507,
352971,
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,
197468,
254812,
361309,
361315,
361322,
328573,
377729,
369542,
361360,
222128,
345035,
345043,
386003,
386011,
386018,
386022,
435187,
328702,
328714,
361489,
386069,
336921,
386073,
336925,
345118,
377887,
328746,
345133,
345138,
386101,
361536,
197707,
189520,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
386258,
328924,
66782,
222437,
386285,
328941,
386291,
345376,
353570,
345379,
410917,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181649,
181654,
230809,
181670,
181673,
181678,
337329,
181681,
181684,
181690,
361917,
181696,
337349,
181703,
337365,
271839,
329191,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
419362,
394786,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
345701,
394853,
222830,
370297,
403070,
403075,
345736,
198280,
345749,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
337592,
419512,
419517,
337599,
419527,
419530,
419535,
272081,
394966,
419542,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
141051,
337659,
337668,
362247,
395021,
362255,
321299,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
345930,
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,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
338211,
395566,
248111,
362822,
436555,
190796,
321879,
379233,
354673,
321910,
248186,
420236,
379278,
354727,
338352,
330189,
338381,
338386,
338403,
338409,
248308,
199164,
330252,
199186,
420376,
330267,
354855,
10828,
199249,
346721,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
338660,
338664,
264941,
363251,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
330642,
355218,
412599,
207808,
379848,
396245,
330710,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
396328,
158761,
396336,
199728,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
339036,
412764,
257120,
265320,
248951,
420984,
330889,
347287,
248985,
339097,
44197,
380070,
339112,
249014,
330958,
330965,
265432,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
372015,
347441,
372018,
199988,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
175486,
249214,
175489,
249218,
249224,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
388542,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
249308,
339420,
249312,
339424,
339428,
339434,
249328,
69113,
372228,
339461,
208398,
380432,
175635,
339503,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
224897,
372353,
216707,
339588,
126596,
421508,
224904,
224909,
159374,
11918,
339601,
224913,
126610,
224916,
224919,
126616,
208538,
224922,
224926,
224929,
224932,
224936,
257704,
224942,
257712,
224947,
257716,
257720,
224953,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
224993,
257761,
257764,
224999,
339695,
225012,
257787,
225020,
339710,
257790,
225025,
257794,
339721,
257801,
257804,
225038,
257807,
372499,
167700,
225043,
225048,
257819,
225053,
184094,
225058,
339747,
339749,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
257871,
225103,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
339814,
225127,
257896,
274280,
257901,
225137,
339826,
257908,
225141,
257912,
225148,
257916,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
405533,
430129,
266294,
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,
266453,
225493,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
397571,
389380,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
348502,
250199,
250202,
332125,
250210,
348522,
348525,
348527,
332152,
250238,
389502,
332161,
356740,
332172,
373145,
340379,
389550,
324030,
266687,
340451,
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,
373343,
381545,
340627,
184982,
373398,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
332493,
357069,
357073,
332511,
332520,
340718,
332533,
348924,
373510,
389926,
152370,
348978,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
357211,
430939,
357214,
201579,
201582,
349040,
340849,
201588,
430965,
381813,
324472,
398201,
119674,
324475,
430972,
340861,
324478,
340858,
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,
381946,
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,
341113,
210044,
349308,
152703,
160895,
349311,
210052,
210055,
349319,
210067,
210071,
210077,
210080,
210084,
251044,
185511,
210088,
210095,
210098,
210107,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
251128,
218360,
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,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
333399,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
333498,
333511,
210631,
358099,
153302,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
366387,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
259938,
399206,
358255,
399215,
268143,
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,
350410,
260298,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
325891,
350467,
350475,
194828,
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,
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,
326416,
375568,
162591,
326441,
326451,
326454,
244540,
326460,
375612,
260924,
326467,
244551,
326473,
326477,
326485,
416597,
342874,
326490,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
359366,
326598,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
261147,
359451,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
367723,
384107,
187502,
384114,
343154,
212094,
351364,
384135,
384139,
384143,
351381,
384151,
384160,
384168,
367794,
244916,
384181,
367800,
384188,
351423,
326855,
244937,
384201,
253130,
343244,
384208,
146642,
384224,
359649,
343270,
351466,
384246,
351479,
343306,
261389,
359694,
261393,
384275,
384283,
245020,
384288,
245029,
171302,
351534,
376110,
245040,
425276,
212291,
384323,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
154999,
253303,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
425649,
155322,
425662,
155327,
245460,
155351,
155354,
212699,
245475,
155363,
245483,
409335,
155393,
155403,
245525,
155422,
360223,
155438,
155442,
155447,
155461,
360261,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
262005,
147317,
425845,
262008,
262011,
155516,
155521,
155525,
360326,
376714,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
393169,
384977,
155611,
155619,
253923,
155621,
327654,
253926,
204784,
393203,
360438,
253943,
393206,
393212,
155646
] |
d94fe4c83f2727dd2a7d5868fea0daa8dc742306 | 89877898da9b7cc391ab45c8fe0590a2d51d119a | /WatchKit-Basics/SousChef/SousChef/Controllers/RecipesController.swift | b96c2dd04b4980a23285db78f18ea3d18fd5fcc3 | [] | no_license | AnYuan/PlayWithWatchKit | da49dd202d948efd6d0627049eebfe0f3d1ce1b4 | 6216faf3b2750fc73c66edca4a8d1a9595c6cc39 | refs/heads/master | 2020-05-17T19:49:50.373807 | 2018-03-13T01:34:38 | 2018-03-13T01:34:38 | 32,138,119 | 8 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 1,682 | swift | //
// RecipesController.swift
// SousChef
//
// Created by Ryan Nystrom on 11/24/14.
// Copyright (c) 2014 Ray Wenderlich. All rights reserved.
//
import UIKit
import SousChefKit
class RecipesController: UITableViewController {
var recipeStore = RecipeStore()
func reloadContent() {
recipeStore = RecipeStore()
tableView.reloadData()
}
override func viewDidLoad() {
super.viewDidLoad()
// hack for Xcode 6
navigationController?.tabBarItem.selectedImage = UIImage(named: "bookmark-full")
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let identifier = segue.identifier
if identifier == "RecipeDetailSegue" {
// pass through the selected recipe
if let path = tableView.indexPathForSelectedRow() {
let recipe = recipeStore.recipes[path.row]
let destination = segue.destinationViewController as RecipeDetailController
destination.recipe = recipe
}
}
}
// MARK: UITableViewDataSource
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return recipeStore.recipes.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("RecipeCell", forIndexPath: indexPath) as RecipeCell
let recipe = recipeStore.recipes[indexPath.row]
cell.recipeLabel.text = recipe.name
if let url = recipe.imageURL {
cell.thumbnailView.sd_setImageWithURL(url)
}
return cell
}
}
| [
-1
] |
a1bc0423b20b5582a9b6b73fef3e6374cb61a7d4 | 548c1f582114e047a5d15ee1cd67f984cd2cf7d5 | /iOS-Swift/10.9.0 App with News, Chat, Cart and User/10.9.0 App with News, Chat, Cart and User/AaSwift/Aa/AbIf/Conf.swift | 7eeba27d0692a1f962b4644519e9ca1f6e33c56b | [] | no_license | hi-iwi/Note | bd4ced003a7d69e5a3c2c8dc7082ed3698591fe3 | 9ea8471f911c4e51430cd51a66f34daad17c8610 | refs/heads/master | 2022-02-05T03:45:14.452938 | 2019-07-10T02:00:02 | 2019-07-10T02:00:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 24 | swift | struct Conf {
}
| [
-1
] |
196d366b796bdf70653abdaeb5cbd952c6637ca4 | 22a7b9de53559c9477748952bd20d9249af2a01d | /Sources/JDCloudSDKClouddnsservice/API/GetDomainQueryCountResponse.swift | 4ea801bec6aadc138e1f50e8583b68ca75f8cdbb | [
"Apache-2.0"
] | permissive | shijunLee/jdcloud-sdk-ios | 2c7ecd959c2ee0c85611c662b5f0d7ab068dcff7 | 0df62bd84f2315b3e56dc01c35a328647430ec96 | refs/heads/master | 2020-04-13T18:29:58.041118 | 2018-12-28T06:40:33 | 2018-12-28T06:40:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,014 | swift | /* Copyright 2018 JDCLOUD.COM
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.
域名
云解析OpenAPI域名接口
OpenAPI spec version: v1
Contact:
NOTE: This class is auto generated by the jdcloud code generator program.
*/
import Foundation
import JDCloudSDKCore
@objc(GetDomainQueryCountResponse)
public class GetDomainQueryCountResponse:NSObject,Codable
{
var requestId:String?;
var error:ServiceError?;
var result:GetDomainQueryCountResult?;
enum GetDomainQueryCountResponseCodingKeys: String, CodingKey {
case requestId
case error
case result
}
required public init(from decoder: Decoder) throws {
let decoderContainer = try decoder.container(keyedBy: GetDomainQueryCountResponseCodingKeys.self)
self.requestId = try decoderContainer.decodeIfPresent(String?.self, forKey: .requestId) ?? nil
self.error = try decoderContainer.decodeIfPresent(ServiceError?.self, forKey: .error) ?? nil
self.result = try decoderContainer.decodeIfPresent(GetDomainQueryCountResult?.self, forKey: .result) ?? nil
}
}
public extension GetDomainQueryCountResponse{
public func encode(to encoder: Encoder) throws {
var encoderContainer = encoder.container(keyedBy: GetDomainQueryCountResponseCodingKeys.self)
try encoderContainer.encode(requestId, forKey: .requestId)
try encoderContainer.encode(error, forKey: .error)
try encoderContainer.encode(result, forKey: .result)
}
} | [
-1
] |
cc53a2e320431e24f75bae481479dd6c0485273f | 7d905b69fd23a5429136be48e1724d715ebd2f03 | /HTMLParser/HTMLElement.swift | 62b83cbe312c4ed805ba9caba14dbc62644c4204 | [] | no_license | HCLarsen/HTMLParser | 43995bfdc2ea854e43343203f291868ed55c9aa6 | c168f952edf96344ca57678ff2d4148ee074c208 | refs/heads/master | 2021-01-11T11:58:23.464410 | 2017-01-27T07:47:44 | 2017-01-27T07:47:44 | 76,711,379 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,096 | swift | //
// HTMLElement.swift
// HTMLParser
//
// Created by Chris Larsen on 2016-12-14.
// Copyright © 2016 Larsen Tech. All rights reserved.
//
import Foundation
class HTMLElement {
private(set) var name = ""
private(set) var attributes = [String: String]()
var children = [HTMLElement]()
var content: String?
weak var parent: HTMLElement?
init(element: String) {
/// Parses an HTML opening tag from the given string, and returns it as an HTMLElement object.
let scanner = Scanner(string: element.trimmingCharacters(in: ["<", ">", "/"]))
var nsName: NSString?
var attrName: String
var attrValue: String
let alphaCharacters = CharacterSet.alphanumerics
scanner.scanUpTo(" ", into: &nsName)
if let name = nsName {
self.name = name as String
}
var key = 0
while !scanner.isAtEnd {
key += 1
attrName = ""
attrValue = ""
scanner.scanUpToCharacters(from: alphaCharacters, into: &nsName)
scanner.scanCharacters(from: alphaCharacters, into: &nsName)
if let name = nsName as String? {
attrName = name.lowercased()
}
if scanner.scanCharacters(from: ["="], into: &nsName) {
scanner.scanCharacters(from: ["\""], into: &nsName)
scanner.scanUpToCharacters(from: ["\""], into: &nsName)
if let value = nsName {
attrValue = value.trimmingCharacters(in: ["\"", " "])
}
scanner.scanCharacters(from: ["\""], into: &nsName)
} else {
attrValue = ""
}
self.attributes[attrName] = attrValue
}
}
func addChild(child: HTMLElement) {
/// Adds a given HTMLElement as a child element.
self.children.append(child)
}
func id() -> String? {
/// Returns the id of the element, or nil if no id exists.
return self.attributes["id"]
}
func classes() -> [String]? {
/// Returns the classes of the element as an array of strings. Returns nil if there are no classes.
var array: [String]?
if let classes = self.attributes["class"] {
array = classes.components(separatedBy: " ")
}
return array
}
func simpleDescription(indent: Int) -> String {
/// Returns a simple description of the HTML element and its children.
var string = "\(indents(indent))Tag: \(self.name)\n"
if let content = self.content {
string += "\(indents(indent))Content: \(content)\n"
}
if self.children.count > 0 {
string += "\(indents(indent))Children:\n"
for child in self.children {
string += "\(child.simpleDescription(indent: indent + 1))"
}
}
return string
}
func fullDescription() -> String {
/// Returns a very detailed description of the HTML element.
var string = "Tag: \(self.name)\n"
if let parent = self.parent {
string += "Parent: \(parent.name)\n"
}
if let content = self.content {
string += "Content: \(content)\n"
}
if self.attributes.count > 0 {
var attributeString = "Attributes: \n"
for attribute in attributes {
attributeString += "\t\(attribute.key): \(attribute.value)\n"
}
string += attributeString
}
if self.children.count > 0 {
string += "Child elements:\n"
for child in self.children {
string += "\t\(child.name)\n"
}
}
return string
}
func indents(_ num: Int) -> String {
var string = ""
if num > 0 {
for _ in 1...num {
string += "\t"
}
}
return string
}
}
| [
-1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.