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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bb0b44b5e52d91c50b62c4bb8b2548ffa017a198 | 294dc1d91d879c419e46d8db472896ba9b7609df | /View Controllers/SplashController.swift | 2f169498672990663c7d2a4065ab3fab4c1c1bed | [] | no_license | davidmarro1234/app-ied-marro | fd1ef22dff3b71b8ea1d62692f955774c724b96d | 783c60257546dd8123f5102c3cc9bc37c2d696e7 | refs/heads/master | 2020-05-25T05:20:45.059701 | 2019-05-20T14:47:06 | 2019-05-20T14:47:06 | 187,647,441 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 858 | swift | //
// SplashController.swift
// David Marro
//
// Created by David Marro on 08/04/2019.
// Copyright © 2019 David Marro. All rights reserved.
//
import UIKit
class SplashController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
//controllare se c'è un utente connesso
if LoginUtility.utenteConnesso == nil{
// nessun utente connesso
// vado alla pagina di Login
performSegue(withIdentifier: "vaiAlLogin", sender: self)
}
else{
// utente connesso
// vado alla pagina home
performSegue(withIdentifier: "VaiAllaHome", sender: self)
}
}
}
| [
-1
] |
e7c4f36639f2b8ab7baf6323fd7c29dd26f587ea | 73ae1ba209ec7dcdd48c7407b1613ab015d1dcc6 | /Simple_Calculator/UnderlinedButton.swift | 8696ce1b9141fb5a81e122a54059ddb091ce08dd | [] | no_license | jaems33/simple-calculator | a3c38d067e1ad834c8d65e13a624581b111e03a7 | 833aa7c8f864aebcd7140a1c89119236aeb58d21 | refs/heads/master | 2021-01-10T23:48:49.229095 | 2016-10-14T03:25:55 | 2016-10-14T03:25:55 | 70,094,018 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,777 | swift | //
// UnderlinedButton.swift
// Simple_Calculator
//
// Created by James Teow on 10/6/16.
// Copyright © 2016 James Teow. All rights reserved.
//
import Foundation
import UIKit
public class UnderlinedButton: UIButton {
fileprivate let borderColor = UIColor(red: 255.0/255.0, green: 255.0/255.0, blue: 255.0/255.0, alpha: 0.1)
fileprivate let borderColorHighlight = UIColor.white
public var label = UILabel()
fileprivate var firstTimeLoaded = false
fileprivate var desiredText = String()
fileprivate var fontSize = CGFloat()
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.contentScaleFactor = 9.0
self.setTitleColor(UIColor(red: 255.0/255.0, green: 255.0/255.0, blue: 255.0/255.0, alpha: 0.0), for: .normal)
self.addBorder(side: .Bottom, color: borderColor, borderwidth: 1)
desiredText = self.currentTitle!
fontSize = self.titleLabel!.font.pointSize
}
override public func titleRect(forContentRect contentRect: CGRect) -> CGRect {
let position = CGPoint(x: 0, y: 0)
let size = CGSize(width: self.bounds.size.width, height: self.bounds.size.height)
let contentRectRefined = CGRect(origin: position, size: size)
return super.titleRect(forContentRect: contentRectRefined)
}
// When the button gets re-sized, make sure to re-size the bottom border too
override public func layoutSubviews() {
super.layoutSubviews()
if firstTimeLoaded == false {
self.resizeBorder()
createLabel()
firstTimeLoaded = true
}
}
public func createLabel(){
var ascenderAdjustment = CGFloat(0)
var fontName = "DIN-Regular"
if (fontSize != 24.0){
fontName = "DIN-Light"
ascenderAdjustment = CGFloat(5)
}
label = UILabel(frame: CGRect(x: 0, y: 0, width: self.bounds.width, height: self.bounds.height - ascenderAdjustment))
label.font = UIFont(name: fontName, size: fontSize)
label.textAlignment = NSTextAlignment.center
label.baselineAdjustment = UIBaselineAdjustment(rawValue: 5)!
label.text = desiredText
label.textColor = UIColor.white
self.addSubview(label)
}
public func touchState(){
label.transform = CGAffineTransform(scaleX: 1.8, y: 1.8)
self.highlightBorder(color: borderColorHighlight)
}
public func touchOffState(){
UIView.animate(withDuration: 0.1, animations: {
self.label.transform = CGAffineTransform(scaleX: 1, y: 1)
}, completion: nil)
self.borderReturnToNormal(color: borderColor)
}
}
| [
-1
] |
fce736c763345565b0af765b707e74be5605c213 | 2fe90547847c76e587eb75bfcaf8e96110ae7893 | /todo_Monika_C0767722/Model/DataManager.swift | 1f3b327e6f5b6d1f8f88458ac8f2b4a8b8fb9cfd | [] | no_license | monikasharma26/todo_Monika_C0767722 | ee3529b3eb97ae6547a17b60f4f2bfc1f3d2b129 | 121db2dff71d5107f36ea52f19719e53da76913f | refs/heads/master | 2022-11-13T05:43:26.918503 | 2020-07-14T02:42:56 | 2020-07-14T02:42:56 | 279,465,167 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,975 | swift | //
// DataManager.swift
// todo_Monika_C0767722
//
// Created by S@i on 2020-06-26.
// Copyright © 2020 S@i. All rights reserved.
//
import Foundation
import CoreData
/*class PersistenceManager {
private init() {}
static let shared = PersistenceManager()
var context: NSManagedObjectContext {
return PersistenceManager.persistentContainer.viewContext
}
class func getContext() -> NSManagedObjectContext {
return PersistenceManager.persistentContainer.viewContext
}
// MARK: - Core Data stack
static var persistentContainer: NSPersistentContainer = {
/*
The persistent container for the application. This implementation
creates and returns a container, having loaded the store for the
application to it. This property is optional since there are legitimate
error conditions that could cause the creation of the store to fail.
*/
let container = NSPersistentContainer(name: "todo_Monika_C0767722")
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
/*
Typical reasons for an error here include:
* The parent directory does not exist, cannot be created, or disallows writing.
* The persistent store is not accessible, due to permissions or data protection when the device is locked.
* The device is out of space.
* The store could not be migrated to the current model version.
Check the error message to determine what the actual problem was.
*/
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
return container
}()
class func saveContext () {
let context = PersistenceManager.persistentContainer.viewContext
if context.hasChanges {
do {
try context.save()
} catch {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
}
}
func fetch<T: NSManagedObject>(type: T.Type, completion: @escaping ([T]) -> Void) {
let request = NSFetchRequest<T>(entityName: String(describing: type))
do {
let objects = try context.fetch(request)
completion(objects.reversed())
} catch {
completion([])
}
}
func update<T: NSManagedObject>(type: T.Type, todo: NSManagedObject, completion: @escaping(_: NSManagedObject?) -> Void) {
let request = NSFetchRequest<T>(entityName: String(describing: type))
do {
let objects = try context.fetch(request)
for object in objects where object == todo {
completion(object)
}
} catch {
completion(nil)
}
}
func delete<T: NSManagedObject>(type: T.Type, todo: NSManagedObject, completion: @escaping(_: Bool) -> Void) {
let request = NSFetchRequest<T>(entityName: String(describing: type))
do {
let objects = try context.fetch(request)
for object in objects where object == todo {
context.delete(todo)
do {
try context.save()
completion(true)
} catch {
completion(false)
}
}
} catch {
completion(false)
}
}
func search<T: NSManagedObject>(type: T.Type, keyword: String, completion: @escaping(_: [T]) -> Void) {
let request = NSFetchRequest<T>(entityName: String(describing: type))
let predicate = NSPredicate(format: "title contains[cd] %@ OR desc contains[cd] %@", keyword, keyword)
request.predicate = predicate
do {
let objects = try context.fetch(request)
completion(objects.reversed())
} catch {
completion([])
}
}
}
*/
| [
-1
] |
2d2daaf424c39d3b91f22ee4c8744e40fa3d1ef9 | 54a918e1ac474a32c6c6be3197ddb72c1ec83a75 | /Chatter/Controllers/seconderyViews/ChatViewController.swift | ef21544dce03aecd95d4037c2f947705b7b642ef | [] | no_license | nivackerman/Chatter | 22ad0b85c60d2e5e6fc0a5f9c10e0ab29c57367a | 43ab95dd03b3f11efebe3f19809f17a802fa1c3e | refs/heads/master | 2021-01-14T19:06:13.898459 | 2020-04-12T17:43:27 | 2020-04-12T17:43:27 | 242,723,442 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 42,863 | swift | //
// ChatViewController.swift
// Chatter
//
// Created by Avihai Shabtai on 24/02/2020.
// Copyright © 2020 Niv-Ackerman. All rights reserved.
//
import UIKit
import JSQMessagesViewController
import ProgressHUD
import IQAudioRecorderController
import IDMPhotoBrowser
import AVFoundation
import AVKit
import FirebaseFirestore
@available(iOS 13.0, *)
class ChatViewController: JSQMessagesViewController ,UIImagePickerControllerDelegate , UINavigationControllerDelegate, IQAudioRecorderViewControllerDelegate {
var typingCounter = 0
let appDelegate = UIApplication.shared.delegate as! AppDelegate
var messages: [JSQMessage] = []
var objectMessages: [NSDictionary] = []
var loadedMessages: [NSDictionary] = []
var allPictureMessages: [String] = []
var isGroup: Bool?
var group: NSDictionary?
var withUsers: [FUser] = []
var typingListener: ListenerRegistration?
var updatedChatListener: ListenerRegistration?
var newChatListener: ListenerRegistration?
var jsqAvatarDictionary: NSMutableDictionary?
var avatarImageDictionary: NSMutableDictionary?
var showAvatars = true
var firstLoad: Bool?
var initialLoadComplete = true
let legitType = [kAUDIO,kVIDEO,kTEXT,kLOCATION,kPICTURE]
var maxMessagesNumber = 0
var minMessagesNumber = 0
var loadOld = false
var loadedMessagesCount = 0
var chatRoonmId: String!
var membarIds: [String]!
var membersToPush: [String]!
var titleName: String!
var outgoingBubble = JSQMessagesBubbleImageFactory()?.outgoingMessagesBubbleImage(with: UIColor.jsq_messageBubbleBlue())
var incomingBubble = JSQMessagesBubbleImageFactory()?.incomingMessagesBubbleImage(with: UIColor.jsq_messageBubbleLightGray())
//MARK: CustomHeaders
let leftBarButtonView: UIView = {
let view = UIView(frame: CGRect(x: 0, y: 0, width: 200, height: 44))
return view
}()
let avatarButton: UIButton = {
let button = UIButton(frame: CGRect(x: -10, y: 0, width: 35, height: 35))
return button
}()
let titleLabel: UILabel = {
let title = UILabel(frame: CGRect(x: 30, y: 10, width: 140, height: 25))
title.textAlignment = .left
title.font = UIFont(name: title.font.fontName, size: 17)
return title
}()
let subTitleLabel: UILabel = {
let subTitle = UILabel(frame: CGRect(x: 30, y: 25, width: 140, height: 25))
subTitle.textAlignment = .left
subTitle.font = UIFont(name: subTitle.font.fontName, size: 10)
return subTitle
}()
override func viewWillAppear(_ animated: Bool) {
clearRecentCounter(chatRoomId: chatRoonmId)
}
override func viewWillDisappear(_ animated: Bool) {
clearRecentCounter(chatRoomId: chatRoonmId)
}
//fix for iphone x
override func viewDidLayoutSubviews() {
perform(Selector(("jsq_updateCollectionViewInsets")))
}
//end of iphone x fix
override func viewDidLoad() {
super.viewDidLoad()
createTypingObserver()
loadUserDefaults()
JSQMessagesCollectionViewCell.registerMenuAction(#selector(delete))
navigationItem.largeTitleDisplayMode = .never
self.navigationItem.leftBarButtonItems = [UIBarButtonItem(image: UIImage(named: "Back"), style: .plain, target: self, action: #selector(self.backAction))]
if isGroup! {
getCurrentGroup(withId: chatRoonmId)
}
collectionView.collectionViewLayout.incomingAvatarViewSize = CGSize.zero
collectionView.collectionViewLayout.outgoingAvatarViewSize = CGSize.zero
jsqAvatarDictionary = [ : ]
setCustomTitle()
loadMessages()
self.senderId = FUser.currentId()
self.senderDisplayName = FUser.currentUser()!.firstname
//fix for iphone x
let constraints = perform(Selector(("toolbarBottomLayoutGuide")))?.takeUnretainedValue() as! NSLayoutConstraint
constraints.priority = UILayoutPriority(rawValue: 1000)
self.inputToolbar.bottomAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.bottomAnchor).isActive = true
//end of iphone x fix
//custom send bottom
self.inputToolbar.contentView.rightBarButtonItem.setImage(UIImage(named: "mic"), for: .normal)
self.inputToolbar.contentView.rightBarButtonItem.setTitle("", for: .normal)
}
//MARK: JSQMessages dataSource functions
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = super.collectionView(collectionView, cellForItemAt: indexPath) as! JSQMessagesCollectionViewCell
let data = messages[indexPath.row]
//set text color
if data.senderId == FUser.currentId() {
cell.textView?.textColor = .white
} else {
cell.textView?.textColor = .black
}
return cell
}
override func collectionView(_ collectionView: JSQMessagesCollectionView!, messageDataForItemAt indexPath: IndexPath!) -> JSQMessageData! {
return messages[indexPath.row]
}
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return messages.count
}
override func collectionView(_ collectionView: JSQMessagesCollectionView!, messageBubbleImageDataForItemAt indexPath: IndexPath!) -> JSQMessageBubbleImageDataSource! {
let data = messages[indexPath.row]
if data.senderId == FUser.currentId() {
return outgoingBubble
} else {
return incomingBubble
}
}
override func collectionView(_ collectionView: JSQMessagesCollectionView!, attributedTextForCellTopLabelAt indexPath: IndexPath!) -> NSAttributedString! {
if indexPath.item % 3 == 0 {
let message = messages[indexPath.row]
return JSQMessagesTimestampFormatter.shared()?.attributedTimestamp(for: message.date)
}
return nil
}
override func collectionView(_ collectionView: JSQMessagesCollectionView!, layout collectionViewLayout: JSQMessagesCollectionViewFlowLayout!, heightForCellTopLabelAt indexPath: IndexPath!) -> CGFloat {
if indexPath.item % 3 == 0 {
return kJSQMessagesCollectionViewCellLabelHeightDefault
}
return 0.0
}
override func collectionView(_ collectionView: JSQMessagesCollectionView!, attributedTextForCellBottomLabelAt indexPath: IndexPath!) -> NSAttributedString! {
let message = objectMessages[indexPath.row]
let status: NSAttributedString!
let attributedStringColor = [NSAttributedString.Key.foregroundColor : UIColor.darkGray]
switch message[kSTATUS] as! String {
case kDELIVERED:
status = NSAttributedString(string: kDELIVERED)
case kREAD:
let statusText = "Read" + " " + readTimeFrom(dateString: message[kREADDATE] as! String)
status = NSAttributedString(string: statusText, attributes: attributedStringColor)
default:
status = NSAttributedString(string: "✔︎")
}
if indexPath.row == (messages.count - 1) {
return status
} else {
return NSAttributedString(string: "")
}
}
override func collectionView(_ collectionView: JSQMessagesCollectionView!, layout collectionViewLayout: JSQMessagesCollectionViewFlowLayout!, heightForCellBottomLabelAt indexPath: IndexPath!) -> CGFloat {
let data = messages[indexPath.row]
if data.senderId == FUser.currentId() {
return kJSQMessagesCollectionViewCellLabelHeightDefault
} else {
return 0.0
}
}
override func collectionView(_ collectionView: JSQMessagesCollectionView!, avatarImageDataForItemAt indexPath: IndexPath!) -> JSQMessageAvatarImageDataSource! {
let message = messages[indexPath.row]
var avatar: JSQMessageAvatarImageDataSource
if let testAvatar = jsqAvatarDictionary!.object(forKey: message.senderId) {
avatar = testAvatar as! JSQMessageAvatarImageDataSource
} else {
avatar = JSQMessagesAvatarImageFactory.avatarImage(with: UIImage(named: "avatarPlaceholder"), diameter: 70)
}
return avatar
}
//MARK: JSQmessages Delegate functions
override func didPressAccessoryButton(_ sender: UIButton!) {
let camera = Camera(delegate_: self)
let optionMenu = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
let takePhotoOrVideo = UIAlertAction(title: "Camera", style: .default) { (action) in
camera.PresentMultyCamera(target: self, canEdit: false)
}
let sharedPhoto = UIAlertAction(title: "Photo Liabrary", style: .default) { (action) in
camera.PresentPhotoLibrary(target: self, canEdit: false)
}
let sharedVideo = UIAlertAction(title: "Video Liabrary", style: .default) { (action) in
camera.PresentVideoLibrary(target: self, canEdit: false)
}
let sharedLoction = UIAlertAction(title: "Share Loction", style: .default) { (action) in
if self.haveAccessToUserLocation() {
self.sendMessage(text: nil, date: Date(), picture: nil, location: kLOCATION, video: nil, audio: nil)
}
}
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel) { (action) in
}
let image = UIImageView(image: UIImage(named: "camera")?.withRenderingMode(.alwaysTemplate))
image.tintColor = UIColor(red: 0, green: 122/255, blue: 255/255, alpha: 1)
takePhotoOrVideo.setValue(image.image, forKey: "image")
sharedPhoto.setValue(UIImage(named: "picture"), forKey: "image")
sharedVideo.setValue(UIImage(named: "video"), forKey: "image")
sharedLoction.setValue(UIImage(named: "location"), forKey: "image")
optionMenu.addAction(takePhotoOrVideo)
optionMenu.addAction(sharedPhoto)
optionMenu.addAction(sharedVideo)
optionMenu.addAction(sharedLoction)
optionMenu.addAction(cancelAction)
self.present(optionMenu, animated: true , completion: nil)
}
override func didPressSend(_ button: UIButton!, withMessageText text: String!, senderId: String!, senderDisplayName: String!, date: Date!) {
if text != "" {
self.sendMessage(text: text, date: date, picture: nil, location: nil, video: nil, audio: nil)
updateSendButton(isSend: false)
}else {
let audioVC = AudioViewController(delegate_: self)
audioVC.presentAudioRecorder(target: self)
}
}
override func collectionView(_ collectionView: JSQMessagesCollectionView!, header headerView: JSQMessagesLoadEarlierHeaderView!, didTapLoadEarlierMessagesButton sender: UIButton!) {
self.loadMoreMessages(maxNumber: maxMessagesNumber, minNumber: minMessagesNumber)
self.collectionView.reloadData()
}
override func collectionView(_ collectionView: JSQMessagesCollectionView!, didTapMessageBubbleAt indexPath: IndexPath!) {
let messageDictionary = objectMessages[indexPath.row]
let messageType = messageDictionary[kTYPE] as! String
switch messageType {
case kPICTURE:
let message = messages[indexPath.row]
let mediaItem = message.media as! JSQPhotoMediaItem
let photos = IDMPhoto.photos(withImages: [mediaItem.image])
let browser = IDMPhotoBrowser(photos: photos)
self.present(browser!, animated: true, completion: nil)
case kLOCATION:
print("location")
let message = messages[indexPath.row]
let mediaItem = message.media as! JSQLocationMediaItem
let mapView = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "MapViewController") as! MapViewController
mapView.location = mediaItem.location
self.navigationController?.pushViewController(mapView, animated: true)
case kVIDEO:
let message = messages[indexPath.row]
let mediaItem = message.media as! VideoMessage
let player = AVPlayer(url: mediaItem.fileURL! as URL)
let moviewPlayer = AVPlayerViewController()
let session = AVAudioSession.sharedInstance()
try! session.setCategory(.playAndRecord, mode: .default, options: .defaultToSpeaker)
moviewPlayer.player = player
self.present(moviewPlayer, animated: true) {
moviewPlayer.player!.play()
}
default:
print("unkown mess tapped")
}
}
override func collectionView(_ collectionView: JSQMessagesCollectionView!, didTapAvatarImageView avatarImageView: UIImageView!, at indexPath: IndexPath!) {
let senderId = messages[indexPath.row].senderId
var selectedUser: FUser?
if senderId == FUser.currentId() {
selectedUser = FUser.currentUser()
} else {
for user in withUsers {
if user.objectId == senderId {
selectedUser = user
}
}
}
presentUserProfile(forUser: selectedUser!)
}
//for multimedia messages delete option
override func collectionView(_ collectionView: UICollectionView, shouldShowMenuForItemAt indexPath: IndexPath) -> Bool {
super.collectionView(collectionView, shouldShowMenuForItemAt: indexPath)
return true
}
override func collectionView(_ collectionView: UICollectionView, canPerformAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) -> Bool {
if messages[indexPath.row].isMediaMessage {
if action.description == "delete:" {
return true
} else {
return false
}
} else {
if action.description == "delete:" || action.description == "copy:" {
return true
} else {
return false
}
}
}
override func collectionView(_ collectionView: JSQMessagesCollectionView!, didDeleteMessageAt indexPath: IndexPath!) {
let messageId = objectMessages[indexPath.row][kMESSAGEID] as! String
objectMessages.remove(at: indexPath.row)
messages.remove(at: indexPath.row)
//delete message from firebase
OutgoingMessages.deleteMessage(withId: messageId, chatRoomId: chatRoonmId,membersToPush:membersToPush)
}
//MARK: Sand Messages
func sendMessage(text: String?, date: Date , picture: UIImage?,location: String?,video: NSURL?, audio: String?){
var outgoingMessage: OutgoingMessages?
let currenUser = FUser.currentUser()!
//text massage
if let text = text {
let ecryptedText = Encryption.encryptText(chatRoomId: chatRoonmId, message: text)
outgoingMessage = OutgoingMessages(message: ecryptedText, senderId: currenUser.objectId, senderName: currenUser.firstname, date: date, status: kDELIVERED, type: kTEXT)
}
//picture message
if let pic = picture {
uploadImage(image: pic, chatRoomId: chatRoonmId, view: self.navigationController!.view) { (imageLink) in
if imageLink != nil {
let ecryptedText = Encryption.encryptText(chatRoomId: self.chatRoonmId, message: "[\(kPICTURE)]")
outgoingMessage = OutgoingMessages(message: ecryptedText, pictureLink: imageLink!, senderId: currenUser.objectId, senderName: currenUser.firstname, date: date, status: kDELIVERED, type: kPICTURE)
JSQSystemSoundPlayer.jsq_playMessageSentSound()
self.finishSendingMessage()
outgoingMessage?.sendMessage(chatRoomID: self.chatRoonmId, messageDictionary: outgoingMessage!.messageDictionary, memberIds: self.membarIds, membersToPush: self.membersToPush)
}
}
return
}
//send video
if let video = video {
let videoData = NSData(contentsOfFile: video.path!)
let dataThumbnail = videoThumbnail(video: video).jpegData(compressionQuality: 0.3)
uploadVideo(video: videoData!, chatRoomId: chatRoonmId, view: self.navigationController!.view) { (videoLink) in
if videoLink != nil {
let ecryptedText = Encryption.encryptText(chatRoomId: self.chatRoonmId, message: "[\(kVIDEO)]")
outgoingMessage = OutgoingMessages(message: ecryptedText, video: videoLink!, thumbNail: dataThumbnail! as NSData, senderId: currenUser.objectId, senderName: currenUser.firstname, date: date, status: kDELIVERED, type: kVIDEO)
JSQSystemSoundPlayer.jsq_playMessageSentSound()
self.finishSendingMessage()
outgoingMessage?.sendMessage(chatRoomID: self.chatRoonmId, messageDictionary: outgoingMessage!.messageDictionary, memberIds: self.membarIds, membersToPush: self.membersToPush)
}
}
return
}
//send audio
if let audioPath = audio {
uploadAudio(autioPath: audioPath, chatRoomId: chatRoonmId, view: (self.navigationController?.view)!) { (audioLink) in
if audioLink != nil {
let ecryptedText = Encryption.encryptText(chatRoomId: self.chatRoonmId, message: "[\(kAUDIO)]")
outgoingMessage = OutgoingMessages(message: ecryptedText, audio: audioLink!, senderId: currenUser.objectId, senderName: currenUser.firstname, date: date, status: kDELIVERED, type: kAUDIO)
JSQSystemSoundPlayer.jsq_playMessageSentSound()
self.finishSendingMessage()
outgoingMessage!.sendMessage(chatRoomID: self.chatRoonmId, messageDictionary: outgoingMessage!.messageDictionary, memberIds: self.membarIds, membersToPush: self.membersToPush)
}
}
return
}
//send location message
if location != nil {
let lat: NSNumber = NSNumber(value: appDelegate.coordinates!.latitude)
let long: NSNumber = NSNumber(value: appDelegate.coordinates!.longitude)
let ecryptedText = Encryption.encryptText(chatRoomId: chatRoonmId, message: "[\(kLOCATION)]")
outgoingMessage = OutgoingMessages(message: ecryptedText, latitude: lat, longitude: long, senderId: currenUser.objectId, senderName: currenUser.firstname, date: date, status: kDELIVERED, type: kLOCATION)
}
JSQSystemSoundPlayer.jsq_playMessageSentSound()
self.finishSendingMessage()
outgoingMessage!.sendMessage(chatRoomID: chatRoonmId, messageDictionary: outgoingMessage!.messageDictionary, memberIds: membarIds, membersToPush: membersToPush)
}
//MARK: LoadMessages
func loadMessages() {
//to update message status
updatedChatListener = reference(.Message).document(FUser.currentId()).collection(chatRoonmId).addSnapshotListener({ (snapshot, error) in
guard let snapshot = snapshot else { return }
if !snapshot.isEmpty {
snapshot.documentChanges.forEach({ (diff) in
if diff.type == .modified {
self.updateMessage(messageDictionary: diff.document.data() as NSDictionary)
}
})
}
})
// get last 11 messages
reference(.Message).document(FUser.currentId()).collection(chatRoonmId).order(by: kDATE, descending: true).limit(to: 11).getDocuments { (snapshot, error) in
guard let snapshot = snapshot else {
self.initialLoadComplete = true
self.listenForNewChats()
return
}
let sorted = ((dictionaryFromSnapshots(snapshots: snapshot.documents)) as NSArray).sortedArray(using: [NSSortDescriptor(key: kDATE, ascending: true)]) as! [NSDictionary]
//remove bad messages
self.loadedMessages = self.removeBedMeassages(allMessages: sorted)
self.insertMessages()
self.finishReceivingMessage(animated: true)
self.initialLoadComplete = true
self.getPictureMessages()
self.getOldMessagesInBackground()
self.listenForNewChats()
}
}
func listenForNewChats() {
var lastMessageDate = "0"
if loadedMessages.count > 0 {
lastMessageDate = loadedMessages.last![kDATE] as! String
}
newChatListener = reference(.Message).document(FUser.currentId()).collection(chatRoonmId).whereField(kDATE, isGreaterThan: lastMessageDate).addSnapshotListener({ (snapshot, error) in
guard let snapshot = snapshot else { return }
if !snapshot.isEmpty {
for diff in snapshot.documentChanges {
if (diff.type == .added) {
let item = diff.document.data() as NSDictionary
if let type = item[kTYPE] {
if self.legitType.contains(type as! String) {
//this is for picture messages
if type as! String == kPICTURE {
self.addNewPictureMessageLink(link: item[kPICTURE] as! String)
}
if self.insertInitalLoadMessages(messageDitionary: item) {
JSQSystemSoundPlayer.jsq_playMessageReceivedSound()
}
self.finishReceivingMessage()
}
}
}
}
}
})
}
func getOldMessagesInBackground() {
if loadedMessages.count > 10 {
let firstMessageDate = loadedMessages.first![kDATE] as! String
reference(.Message).document(FUser.currentId()).collection(chatRoonmId).whereField(kDATE, isLessThan: firstMessageDate).getDocuments { (snapshot, error) in
guard let snapshot = snapshot else { return }
let sorted = ((dictionaryFromSnapshots(snapshots: snapshot.documents)) as NSArray).sortedArray(using: [NSSortDescriptor(key: kDATE, ascending: true)]) as! [NSDictionary]
self.loadedMessages = self.removeBedMeassages(allMessages: sorted) + self.loadedMessages
self.getPictureMessages()
self.maxMessagesNumber = self.loadedMessages.count - self.loadedMessagesCount - 1
self.minMessagesNumber = self.maxMessagesNumber - kNUMBEROFMESSAGES
}
}
}
//MARK:insert messages
func insertMessages()
{
maxMessagesNumber = loadedMessages.count - loadedMessagesCount
minMessagesNumber = maxMessagesNumber - kNUMBEROFMESSAGES
if minMessagesNumber < 0
{
minMessagesNumber = 0
}
for i in minMessagesNumber ..< maxMessagesNumber {
let messageDictionary = loadedMessages[i]
//insert message
insertInitalLoadMessages(messageDitionary: messageDictionary)
loadedMessagesCount += 1
}
self.showLoadEarlierMessagesHeader = (loadedMessagesCount != loadedMessages.count)
}
func insertInitalLoadMessages(messageDitionary: NSDictionary) -> Bool {
let incomingMessage = IncomingMessage(collectionView_: self.collectionView!)
//check if incoming
if (messageDitionary[kSENDERID] as! String) != FUser.currentId() {
OutgoingMessages.updateMessage(withId: messageDitionary[kMESSAGEID] as! String, chatRoomId: chatRoonmId, memberIds: membarIds)
}
let message = incomingMessage.createMessage(messageDictionary: messageDitionary, chatRoomId: chatRoonmId)
if message != nil {
objectMessages.append(messageDitionary)
messages.append(message!)
}
return isIncoming(messageDictionary: messageDitionary)
}
func updateMessage(messageDictionary: NSDictionary) {
for index in 0 ..< objectMessages.count {
let temp = objectMessages[index]
if messageDictionary[kMESSAGEID] as! String == temp[kMESSAGEID] as! String {
objectMessages[index] = messageDictionary
self.collectionView!.reloadData()
}
}
}
//MARK: LoadMoreMessages
func loadMoreMessages(maxNumber: Int, minNumber: Int) {
if loadOld {
maxMessagesNumber = minNumber - 1
minMessagesNumber = maxMessagesNumber - kNUMBEROFMESSAGES
}
if minMessagesNumber < 0 {
minMessagesNumber = 0
}
for i in (minMessagesNumber ... maxMessagesNumber).reversed() {
let messageDictionary = loadedMessages[i]
insertNewMessage(messageDictionary: messageDictionary)
loadedMessagesCount += 1
}
loadOld = true
self.showLoadEarlierMessagesHeader = (loadedMessagesCount != loadedMessages.count)
}
func insertNewMessage(messageDictionary: NSDictionary) {
let incomingMessage = IncomingMessage(collectionView_: self.collectionView!)
let message = incomingMessage.createMessage(messageDictionary: messageDictionary, chatRoomId: chatRoonmId)
objectMessages.insert(messageDictionary, at: 0)
messages.insert(message!, at: 0)
}
//MARK:IBAction
@objc func backAction()
{
clearRecentCounter(chatRoomId: chatRoonmId)
removeListeners()
// self.navigationController?.popViewController(animated: true)
self.navigationController?.popToRootViewController(animated: true)
}
@objc func infoButtonPressed() {
let mediaVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "mediaView") as! PicturesCollectionViewController
mediaVC.allImageLinks = allPictureMessages
self.navigationController?.pushViewController(mediaVC, animated: true)
}
@objc func showGroup() {
let groupVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "groupView") as! GroupViewController
groupVC.group = group!
self.navigationController?.pushViewController(groupVC, animated: true)
}
@objc func showUserProfile() {
let profileVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "profileView") as! ProfileViewTableViewController
profileVC.user = withUsers.first!
self.navigationController?.pushViewController(profileVC, animated: true)
}
func presentUserProfile(forUser: FUser) {
let profileVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "profileView") as! ProfileViewTableViewController
profileVC.user = forUser
self.navigationController?.pushViewController(profileVC, animated: true)
}
//MARK: Typing Indicator
func createTypingObserver() {
typingListener = reference(.Typing).document(chatRoonmId).addSnapshotListener({ (snapshot, error) in
guard let snapshot = snapshot else { return }
if snapshot.exists {
for data in snapshot.data()! {
if data.key != FUser.currentId() {
let typing = data.value as! Bool
self.showTypingIndicator = typing
if typing {
self.scrollToBottom(animated: true)
}
}
}
} else {
reference(.Typing).document(self.chatRoonmId).setData([FUser.currentId() : false])
}
})
}
func typingCounterStart() {
typingCounter += 1
typingCounterSave(typing: true)
self.perform(#selector(self.typingCounterStop), with: nil, afterDelay: 2.0)
}
@objc func typingCounterStop() {
typingCounter -= 1
if typingCounter == 0 {
typingCounterSave(typing: false)
}
}
func typingCounterSave(typing: Bool) {
reference(.Typing).document(chatRoonmId).updateData([FUser.currentId() : typing])
}
//MARK: UITextViewDelegate
override func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
typingCounterStart()
return true
}
//MARK: CustomSendButton
override func textViewDidChange(_ textView: UITextView) {
if textView.text != "" {
updateSendButton(isSend: true)
}else{
updateSendButton(isSend: false)
}
}
func updateSendButton(isSend: Bool) {
if isSend {
self.inputToolbar.contentView.rightBarButtonItem.setImage(UIImage(named: "send"), for: .normal)
}else {
self.inputToolbar.contentView.rightBarButtonItem.setImage(UIImage(named: "mic"), for: .normal)
}
}
//MARK: IQAudioDelegate
func audioRecorderController(_ controller: IQAudioRecorderViewController, didFinishWithAudioAtPath filePath: String) {
controller.dismiss(animated: true, completion: nil)
self.sendMessage(text: nil, date: Date(), picture: nil, location: nil, video: nil, audio: filePath)
}
func audioRecorderControllerDidCancel(_ controller: IQAudioRecorderViewController) {
controller.dismiss(animated: true, completion: nil)
}
//MARK: UpdateUI
func setCustomTitle() {
leftBarButtonView.addSubview(avatarButton)
leftBarButtonView.addSubview(titleLabel)
leftBarButtonView.addSubview(subTitleLabel)
let infoButton = UIBarButtonItem(image: UIImage(named: "info"), style: .plain, target: self, action: #selector(self.infoButtonPressed))
self.navigationItem.rightBarButtonItem = infoButton
let leftBarButtonItem = UIBarButtonItem(customView: leftBarButtonView)
self.navigationItem.leftBarButtonItems?.append(leftBarButtonItem)
if isGroup! {
avatarButton.addTarget(self, action: #selector(self.showGroup), for: .touchUpInside)
} else {
avatarButton.addTarget(self, action: #selector(self.showUserProfile), for: .touchUpInside)
}
getUsersFromFirestore(withIds: membarIds) { (withUsers) in
self.withUsers = withUsers
self.getAvatarImages()
if !self.isGroup! {
self.setUIForSingleChat()
}
}
}
func setUIForSingleChat() {
let withUser = withUsers.first!
imageFromData(pictureData: withUser.avatar) { (image) in
if image != nil {
avatarButton.setImage(image!.circleMasked, for: .normal)
}
}
titleLabel.text = withUser.fullname
// if withUser.isOnline {
// subTitleLabel.text = "Online"
// } else {
// subTitleLabel.text = "Offline"
// }
avatarButton.addTarget(self, action: #selector(self.showUserProfile), for: .touchUpInside)
}
func setUIForGroupChat() {
imageFromData(pictureData: (group![kAVATAR] as! String)) { (image) in
if image != nil {
avatarButton.setImage(image!.circleMasked, for: .normal)
}
}
titleLabel.text = titleName
subTitleLabel.text = ""
}
//MARK: UIImagePickerController delegate
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
let video = info[UIImagePickerController.InfoKey.mediaURL] as? NSURL
let picture = info[UIImagePickerController.InfoKey.originalImage] as? UIImage
sendMessage(text: nil, date: Date(), picture: picture, location: nil, video: video, audio: nil)
picker.dismiss(animated: true, completion: nil)
}
//MARK: GetAvatars
func getAvatarImages() {
if showAvatars {
collectionView?.collectionViewLayout.incomingAvatarViewSize = CGSize(width: 30, height: 30)
collectionView?.collectionViewLayout.outgoingAvatarViewSize = CGSize(width: 30, height: 30)
//get current user avatar
avatarImageFrom(fUser: FUser.currentUser()!)
for user in withUsers {
avatarImageFrom(fUser: user)
}
}
}
func avatarImageFrom(fUser: FUser) {
if fUser.avatar != "" {
dataImageFromString(pictureString: fUser.avatar) { (imageData) in
if imageData == nil {
return
}
if self.avatarImageDictionary != nil {
//update avatar if we had one
self.avatarImageDictionary!.removeObject(forKey: fUser.objectId)
self.avatarImageDictionary!.setObject(imageData!, forKey: fUser.objectId as NSCopying)
} else {
self.avatarImageDictionary = [fUser.objectId : imageData!]
}
self.createJSQAvatars(avatarDictionary: self.avatarImageDictionary)
}
}
}
func createJSQAvatars(avatarDictionary: NSMutableDictionary?) {
let defaultAvatar = JSQMessagesAvatarImageFactory.avatarImage(with: UIImage(named: "avatarPlaceholder"), diameter: 70)
if avatarDictionary != nil {
for userId in membarIds {
if let avatarImageData = avatarDictionary![userId] {
let jsqAvatar = JSQMessagesAvatarImageFactory.avatarImage(with: UIImage(data: avatarImageData as! Data), diameter: 70)
self.jsqAvatarDictionary!.setValue(jsqAvatar, forKey: userId)
} else {
self.jsqAvatarDictionary!.setValue(defaultAvatar, forKey: userId)
}
}
self.collectionView.reloadData()
}
}
//MARK: Location access
func haveAccessToUserLocation() -> Bool {
if appDelegate.locationManager != nil {
return true
} else {
ProgressHUD.showError("Please give access tp loacation in Settings.")
return false
}
}
//MARK: Helper function
func loadUserDefaults() {
firstLoad = userDefaults.bool(forKey: kFIRSTRUN)
if !firstLoad! {
userDefaults.set(true, forKey: kFIRSTRUN)
userDefaults.set(showAvatars, forKey: kSHOWAVATAR)
userDefaults.synchronize()
}
showAvatars = userDefaults.bool(forKey: kSHOWAVATAR)
checkForBackgroundImage()
}
func checkForBackgroundImage() {
if userDefaults.object(forKey: kBACKGROUBNDIMAGE) != nil {
self.collectionView.backgroundColor = .clear
let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height))
imageView.image = UIImage(named: userDefaults.object(forKey: kBACKGROUBNDIMAGE) as! String)!
imageView.contentMode = .scaleAspectFill
self.view.insertSubview(imageView, at: 0)
}
}
func addNewPictureMessageLink(link: String) {
allPictureMessages.append(link)
}
func getPictureMessages() {
allPictureMessages = []
for message in loadedMessages {
if message[kTYPE] as! String == kPICTURE {
allPictureMessages.append(message[kPICTURE] as! String)
}
}
}
func readTimeFrom(dateString: String) -> String {
let date = dateFormatter().date(from: dateString)
let currentDateFormat = dateFormatter()
currentDateFormat.dateFormat = "HH:mm"
return currentDateFormat.string(from: date!)
}
func removeBedMeassages(allMessages : [NSDictionary]) -> [NSDictionary]
{
var tempMessages = allMessages
for message in tempMessages{
if message[kTYPE] != nil {
if !self.legitType.contains(message[kTYPE] as! String){
//remove the message
tempMessages.remove(at: tempMessages.index(of:message)!)
}
} else {
tempMessages.remove(at: tempMessages.index(of:message)!)
}
}
return tempMessages
}
func isIncoming(messageDictionary: NSDictionary) -> Bool {
if FUser.currentId() == messageDictionary[kSENDERID] as! String {
return false
}else {
return true
}
}
func removeListeners() {
if typingListener != nil {
typingListener!.remove()
}
if newChatListener != nil {
newChatListener!.remove()
}
if updatedChatListener != nil {
updatedChatListener!.remove()
}
}
func getCurrentGroup(withId: String) {
reference(.Group).document(withId).getDocument { (snapshot, error) in
guard let snapshot = snapshot else { return }
if snapshot.exists {
self.group = snapshot.data() as! NSDictionary
self.setUIForGroupChat()
}
}
}
}
extension JSQMessagesInputToolbar {
override open func didMoveToWindow() {
super.didMoveToWindow()
guard let window = window else { return }
if #available(iOS 11.0, *) {
let anchor = window.safeAreaLayoutGuide.bottomAnchor
bottomAnchor.constraint(lessThanOrEqualToSystemSpacingBelow: anchor, multiplier: 1.0).isActive = true
}
}
}
| [
-1
] |
5e086342f3d72cfe0e42706a0a42ef9dadfc66ba | e8fc16b2954a99b0def0696346d154e22cab54c7 | /shizApp/AppDelegate.swift | 5a535fa163060cb9070d5789490e1921ba7b4973 | [] | no_license | nazca-and-condor/shiz-app | 60ee067a55756f615702564f83b4e01f13ad4d42 | de3b4c803131fdc02af661907d05b76d5abbdd8c | refs/heads/master | 2020-06-09T02:31:11.284213 | 2019-06-23T14:22:26 | 2019-06-23T14:22:26 | 193,353,454 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,167 | swift | //
// AppDelegate.swift
// shizApp
//
// Created by Shizuka on 2019/06/22.
// Copyright © 2019 shizuka. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
229432,
204856,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
287238,
320007,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
287365,
311942,
303751,
352905,
279178,
287371,
311946,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
164509,
303773,
172705,
287394,
172707,
303780,
287390,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
213895,
304007,
304009,
304011,
230284,
304013,
295822,
279438,
213902,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
279929,
181626,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
279991,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
288214,
280021,
239064,
288217,
329177,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
288499,
419570,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
354653,
313700,
280937,
313705,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
150025,
338440,
330244,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
182926,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
240519,
322440,
314249,
338823,
183184,
142226,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
290174,
298365,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
324757,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
148946,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
44948,
298901,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
176311,
299191,
307385,
307386,
307388,
258235,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
176592,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
283142,
127494,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
242206,
135710,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
292433,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
201603,
226182,
234375,
308105,
226185,
234379,
324490,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
226220,
291754,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
275384,
324536,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
226245,
234437,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
308226,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
234648,
300189,
324766,
119967,
234653,
283805,
234657,
324768,
242852,
300197,
234661,
283813,
234664,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
226500,
283844,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
275725,
349464,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
227440,
316917,
308727,
292343,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
276053,
284247,
317015,
284249,
243290,
284251,
276052,
284253,
300638,
284255,
235097,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
284290,
325250,
284292,
292485,
292479,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
276160,
358080,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
292843,
276460,
292845,
276464,
178161,
227314,
276466,
325624,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
292876,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
243779,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
227426,
276579,
227430,
276583,
309354,
301167,
276590,
350321,
350313,
350316,
284786,
350325,
252022,
276595,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309491,
227571,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
342707,
154292,
318132,
277173,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
293706,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
293817,
293820,
203715,
326603,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
64966,
245191,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286313,
40554,
286312,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
278227,
286420,
229076,
286425,
319194,
278235,
301163,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
1955337829dc94f74973197ea4dbfb5df8f81207 | 91e855cd9fd291ff99aff438d8c4e9fc962097bc | /Todoey/Models /Item.swift | a4c27bcec34c8d3018f37db533af29a6eabe37ec | [] | no_license | oluwaseunola/ToDoApp | 6f1b770fcef1e612393fedfd2aecd2c6a5c91a22 | dc53fa9155d671ac1c01893643326396596e20d5 | refs/heads/master | 2023-04-20T16:02:29.196871 | 2021-05-04T17:14:52 | 2021-05-04T17:14:52 | 364,329,110 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 504 | swift | //
// Item.swift
// Todoey
//
// Created by Seun Olalekan on 2021-04-28.
// Copyright © 2021 App Brewery. All rights reserved.
//
import Foundation
import RealmSwift
class Item: Object {
@objc dynamic var name: String = ""
@objc dynamic var checked: Bool = false
@objc dynamic var dateCreated: Date?
// here, the fromType is the type and the propery is the forward property of the relationship
var parentCategory = LinkingObjects(fromType: Category.self, property:"items")
}
| [
-1
] |
704f699f0127f667bf6add6520c2376bf9437b63 | f25cf555f3a2b46c18ceefd9b2f34ff80cebdf25 | /tippyTests/tippyTests.swift | db1579b0c6922ff06113ebb7f7fbcdf2fffa5559 | [
"Apache-2.0"
] | permissive | conkeyfeng/tipCal | 5e445154bf9167dad92049e0624f7c0f87ce9b3f | 6253ac704e565630fb20baf16492c8c892c8ee85 | refs/heads/master | 2021-01-17T19:23:31.282223 | 2016-07-12T07:26:31 | 2016-07-12T07:26:31 | 63,104,585 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 970 | swift | //
// tippyTests.swift
// tippyTests
//
// Created by Chenyang Feng on 7/10/16.
// Copyright © 2016 Chenyang Feng. All rights reserved.
//
import XCTest
@testable import tippy
class tippyTests: 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,
305179,
278558,
307231,
313375,
239650,
229413,
292902,
354343,
204840,
354345,
227370,
223274,
278570,
233517,
155694,
360491,
229424,
309295,
282672,
237620,
229430,
276534,
180280,
159807,
288833,
288834,
286788,
280649,
311372,
311374,
315476,
223316,
280661,
278615,
223318,
307289,
288857,
227417,
354393,
315487,
237663,
45153,
309345,
280675,
227428,
280677,
194656,
313447,
276582,
131178,
194666,
278634,
276589,
278638,
288879,
227439,
299121,
284788,
204916,
223350,
233590,
280694,
131191,
237689,
131189,
292988,
131198,
215166,
292992,
278655,
194691,
227460,
280712,
215178,
141450,
311435,
235662,
311438,
278670,
276627,
278677,
276632,
284825,
284826,
278685,
311458,
278691,
233636,
196773,
299174,
284841,
233642,
284842,
278704,
239793,
129203,
299187,
131256,
227513,
278714,
223419,
295098,
280762,
299198,
280768,
227524,
309444,
280778,
276682,
282831,
280795,
227548,
229597,
301279,
311519,
280802,
176362,
286958,
233715,
157944,
211193,
168188,
278797,
309529,
278810,
282909,
299293,
278816,
282913,
233762,
237857,
217380,
211235,
211238,
282919,
262450,
280887,
278842,
315706,
282939,
307517,
287041,
260418,
287043,
139589,
280902,
319813,
227654,
311621,
227658,
276813,
6481,
6482,
278869,
305495,
6489,
379225,
323935,
276835,
321894,
416104,
280939,
276847,
285040,
242033,
313713,
199029,
311681,
280961,
227725,
240016,
178578,
178582,
190871,
293274,
285084,
61857,
285090,
61859,
289189,
299441,
278961,
278965,
293303,
61880,
283064,
278970,
276920,
33211,
276925,
278978,
127427,
127428,
291267,
283075,
278989,
281040,
278993,
326100,
278999,
328152,
176601,
188894,
287198,
279008,
160225,
285150,
227809,
358882,
227813,
279013,
279018,
311786,
279022,
291311,
281072,
309744,
279029,
279032,
279039,
291333,
276998,
287241,
279050,
186893,
303631,
283153,
279057,
303636,
279062,
223767,
279065,
223769,
291358,
182817,
180771,
293419,
244269,
283182,
283184,
236081,
234036,
23092,
279094,
277048,
70209,
309830,
70215,
55881,
281166,
281171,
287318,
285271,
297560,
309846,
295519,
66150,
277094,
111208,
279144,
279146,
277101,
313966,
281199,
295536,
287346,
277111,
287352,
301689,
279164,
291454,
184962,
303746,
279177,
152203,
277133,
133774,
287374,
117397,
227990,
230040,
295576,
314009,
303771,
221852,
205471,
285353,
279210,
287404,
295599,
205487,
285361,
303793,
299699,
299700,
342706,
166582,
289462,
314040,
287417,
158394,
285371,
293556,
285373,
287422,
303803,
199366,
287433,
225995,
154316,
225997,
287439,
279252,
226004,
203477,
226007,
96984,
287452,
289502,
226019,
279269,
285415,
342762,
277227,
293612,
230125,
289518,
312047,
279280,
199414,
154359,
230134,
299770,
234234,
221948,
279294,
205568,
242433,
295682,
299776,
234241,
285444,
209670,
291592,
322313,
226058,
234250,
234253,
295697,
291604,
166676,
234263,
285466,
283419,
291612,
234268,
293664,
234277,
283430,
279336,
289576,
262954,
293672,
295724,
234283,
234286,
285487,
301871,
164656,
303920,
262962,
234289,
312108,
234294,
230199,
285497,
293693,
162621,
234301,
281408,
295744,
289598,
162626,
277316,
160575,
318278,
234311,
234312,
299849,
283467,
234317,
277325,
201551,
293711,
234323,
281427,
234326,
281433,
234331,
301918,
295776,
279392,
293730,
349026,
303972,
234340,
234343,
230248,
177001,
234346,
308076,
400239,
234355,
207732,
174963,
277366,
209783,
228215,
209785,
279417,
177019,
234360,
234361,
277370,
234366,
234367,
158593,
308092,
234372,
226181,
113542,
287622,
213894,
228233,
228234,
226184,
277381,
308107,
56208,
308112,
234386,
295824,
234387,
293781,
234392,
324506,
324507,
277403,
310176,
234400,
310178,
279456,
189348,
234404,
283558,
289703,
279464,
293800,
234409,
275371,
236461,
293806,
304051,
234419,
234425,
234427,
287677,
189374,
234430,
234436,
234438,
19399,
213960,
279498,
316364,
52172,
234444,
234445,
183248,
234451,
234454,
234457,
50143,
234463,
234466,
314342,
277479,
234472,
234473,
326635,
203757,
289774,
183279,
234477,
234482,
287731,
277492,
314355,
295927,
304122,
234498,
234500,
277509,
134150,
277510,
322570,
230410,
234506,
234514,
277523,
277524,
140310,
230423,
197657,
281626,
281625,
175132,
189474,
234531,
300068,
234534,
310317,
234542,
238639,
300084,
312373,
203830,
234548,
234555,
238651,
277563,
308287,
230463,
234560,
207938,
234565,
238664,
234569,
300111,
234577,
296019,
234583,
234584,
234587,
277597,
304222,
113760,
281697,
302177,
230499,
281700,
285798,
322663,
300135,
228458,
207979,
279660,
281706,
275565,
15471,
144496,
156785,
312434,
275571,
234609,
285814,
300151,
279672,
234616,
398457,
160891,
285820,
300158,
234622,
150657,
187521,
234625,
285828,
279685,
285830,
222343,
302216,
302213,
253063,
228491,
234632,
275591,
234638,
234642,
308372,
185493,
296086,
238743,
283802,
119962,
296092,
300187,
119963,
285851,
302240,
330913,
306338,
234656,
234659,
234663,
275625,
300202,
281771,
300201,
249002,
238765,
279728,
238769,
226481,
208058,
277690,
230588,
64700,
228540,
228542,
283840,
302274,
279747,
283847,
283852,
279760,
290000,
189652,
279765,
189653,
279774,
304351,
298208,
363744,
195811,
298212,
304356,
279785,
228588,
298221,
234733,
279792,
298228,
302325,
234742,
204022,
228600,
292091,
216315,
208124,
228609,
234755,
292107,
312587,
173334,
277792,
339234,
199971,
304421,
277800,
279854,
113966,
226608,
298291,
300343,
102437,
222524,
286013,
226624,
286018,
113987,
279875,
15686,
300359,
304456,
226632,
294218,
234827,
177484,
222541,
296270,
234831,
238927,
296273,
224586,
314709,
283991,
357719,
218462,
222559,
224606,
142689,
292195,
294243,
230756,
281957,
163175,
281962,
284014,
306542,
279920,
296307,
181625,
290173,
306559,
306560,
224640,
179587,
298374,
281992,
142729,
368011,
230799,
112017,
234898,
306579,
224661,
282007,
318875,
310692,
279974,
282022,
282024,
279984,
286129,
173491,
304564,
279989,
296375,
292283,
228795,
296387,
415171,
163269,
300487,
296392,
306631,
280010,
296391,
310732,
302540,
280013,
64975,
312782,
306639,
310736,
222675,
284116,
212442,
228827,
286172,
226781,
239068,
280032,
144867,
310757,
187878,
316902,
280041,
296425,
282096,
306673,
308723,
306677,
280055,
300535,
288249,
286202,
290300,
286205,
302590,
290301,
294400,
230913,
282114,
228861,
306692,
306693,
300542,
192010,
296461,
149007,
304656,
282129,
65041,
308756,
282136,
204313,
282141,
302623,
306723,
286244,
278060,
286254,
288309,
194110,
288318,
280130,
282183,
218696,
288327,
276040,
366154,
292425,
276045,
228943,
286288,
280147,
290390,
300630,
306776,
147036,
243292,
239198,
157281,
286306,
282213,
317032,
310889,
222832,
276085,
314998,
288378,
188031,
294529,
192131,
239237,
282246,
286343,
282245,
229001,
288392,
290443,
310923,
323217,
239250,
302739,
282259,
276120,
229020,
298654,
282271,
276126,
282273,
302754,
282276,
229029,
298661,
40613,
40614,
40615,
282280,
290471,
298667,
300714,
278191,
286388,
198324,
296628,
286391,
280251,
282303,
286399,
280257,
218819,
282312,
306890,
280267,
302797,
282318,
276173,
9936,
212688,
302802,
280278,
286423,
280280,
278233,
18138,
278234,
67292,
216795,
282327,
298712,
278240,
276195,
282339,
153319,
313065,
12010,
280300,
239341,
282348,
419569,
276210,
282355,
282358,
313081,
229113,
286459,
276219,
300794,
194303,
194304,
282369,
288512,
278272,
67332,
311042,
288516,
280327,
216839,
280329,
300811,
276238,
321295,
284431,
278291,
278293,
294678,
282391,
116505,
284442,
278299,
310131,
276253,
286494,
282400,
313120,
315171,
282409,
284459,
294700,
159533,
280366,
282417,
200498,
296755,
280372,
276282,
276283,
280380,
282427,
276287,
345919,
282434,
280390,
276294,
280392,
282438,
276298,
304977,
307025,
413521,
18262,
216918,
307031,
280410,
284507,
188251,
300894,
237408,
284512,
284514,
296806,
276327,
292712,
282474,
288619,
288620,
280430,
292720,
282480,
313203,
300918,
276344,
194429,
305026,
67463,
282504,
315273,
315274,
279217,
243597,
110480,
184208,
40853,
282518,
282519,
44952,
214937,
214938,
294809,
239514,
298909,
294814,
247712,
300963,
292771,
294823,
298920,
284587,
292782,
282549,
276408,
288697,
290746,
294843,
98239,
214977,
294850,
280514,
163781,
276421,
280519,
284619,
344013,
276430,
231375,
301008,
153554,
194515,
276444,
280541,
298980,
292837,
294886,
317415,
292836,
276454,
276459,
296941,
278512,
311282,
282612,
292858,
290811
] |
44ff825a517cb82e601c04385beb4dfbaeb80f7e | c570c0000307d2e9bf399ebd42f6d1eaff3a41eb | /RNDM/ViewController.swift | 0f5f181c0953647a1dade155c61eba94ceee66dc | [] | no_license | KokiTabayashi/RNDM | 5c61c485d8d7e14bbda5903966cfc079566723c3 | 9acaf0ba12a83f56817e717d76de61ee96c08e87 | refs/heads/master | 2020-03-19T01:05:35.540605 | 2018-05-31T02:40:11 | 2018-05-31T02:40:11 | 135,522,097 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 513 | swift | //
// ViewController.swift
// RNDM
//
// Created by Koki Tabayashi on 2018/05/30.
// Copyright © 2018年 Koki Tabayashi. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
293888,
277508,
279046,
275466,
324528,
278543,
309264,
234511,
279064,
236057,
286234,
282145,
295460,
284197,
296487,
286249,
197677,
237616,
360501,
234551,
237624,
300089,
288827,
238653,
226878,
277057,
288321,
286786,
129604,
284740,
226887,
243786,
300107,
288332,
158285,
278606,
226896,
212561,
228945,
284240,
300116,
300629,
276054,
237655,
307288,
284242,
292435,
212573,
338529,
200802,
276580,
284261,
281701,
281703,
306791,
286314,
356460,
277612,
164974,
307311,
281202,
284276,
284277,
294518,
314996,
300149,
287350,
276597,
284287,
278657,
281218,
284289,
281221,
284293,
284298,
303242,
311437,
285837,
226447,
227984,
303760,
234641,
278675,
349332,
226454,
226455,
226456,
282262,
226458,
280219,
284315,
284317,
278686,
299165,
285855,
302235,
228000,
284323,
225955,
278693,
282275,
287399,
284328,
100521,
234665,
280231,
284336,
307379,
276150,
286390,
280760,
277180,
282301,
283839,
285377,
280770,
280772,
228548,
228551,
280775,
284361,
276167,
298189,
287437,
313550,
229585,
307410,
290004,
284373,
290006,
189655,
226009,
298202,
298204,
280797,
298207,
278752,
290016,
363743,
298211,
290020,
284391,
280808,
277224,
228585,
234223,
358127,
312049,
286963,
289524,
280821,
226038,
286965,
333048,
288501,
234232,
358139,
204027,
286462,
280832,
276736,
278786,
230147,
358147,
278791,
226055,
299786,
312586,
287231,
295696,
300817,
296216,
278298,
329499,
287005,
281373,
287007,
295711,
228127,
276256,
278304,
281380,
282917,
234279,
315177,
130346,
282922,
289578,
312107,
282926,
283433,
234423,
293682,
113972,
159541,
289596,
283453,
278845,
289600,
279360,
288579,
283461,
300358,
238920,
234829,
298830,
287055,
296272,
279380,
276309,
295766,
307029,
279386,
298843,
188253,
323933,
308064,
200549,
227688,
303977,
306540,
293742,
299374,
199024,
216433,
278897,
290166,
310649,
292730,
333179,
207738,
290175,
224643,
313733,
324491,
304012,
234380,
304015,
300432,
310673,
306578,
227740,
275358,
285087,
289697,
234402,
284586,
144811,
276396,
277420,
277422,
279982,
286126,
297903,
305582,
230323,
291755,
277429,
277430,
277935,
277432,
277433,
277434,
282548,
292277,
278973,
291774,
296374,
130487,
281530,
10179,
298951,
165832,
289224,
306633,
288205,
286158,
280015,
311761,
301012,
280029,
286175,
276959,
276965,
168936,
294889,
286189,
183278,
298989,
277487,
282095,
308721,
227315,
237556,
292341,
296436,
310773,
286204,
290303
] |
42b8c1261c016ea01a1446da4b5ec736c1132adb | ab62208be2bbfdd18349c6eda04a884fea484345 | /Classes:Files/ProfileTableCell.swift | 6e38801c90165b137087d0ae47abeadd156d9c90 | [] | no_license | csmattjohnston/iOSExerciseApp | 3d71ec363421b6cd26dfac3639a69c2335518a4d | c41da416fe4c8633b802638fde1940bca0071339 | refs/heads/master | 2020-12-05T02:41:40.064618 | 2016-09-11T21:32:04 | 2016-09-11T21:32:04 | 67,311,897 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 537 | swift | //
// ProfileTableCellTableViewCell.swift
// Created by Matthieu on 5/15/16.
// Copyright © 2016 Sir. All rights reserved.
//
import UIKit
class ProfileTableCell: UITableViewCell {
@IBOutlet weak var aboutSectionLabel: UILabel!
@IBOutlet weak var buddyNumber: UILabel!
@IBOutlet weak var commitmentNumber: UILabel!
@IBOutlet weak var profilePhotosLabel: UILabel!
@IBOutlet weak var commitmentLabel: UILabel!
@IBOutlet weak var buddiesLabel: UILabel!
@IBOutlet weak var profileImage: UIImageView!
}
| [
-1
] |
2994296ec4886efd37efc61450b5244e591ef353 | a321eb8669ea4389286d97a39aacb5be36657227 | /chainup-ios/Chainup/Tool/SwiftyGuesturesView/SwiftyGuesturesView/Classes/GHGuesturesNodeView.swift | 4f3242d8d2dec2dd639cb5d0797d654d19e8f81b | [] | no_license | exup-cloud/cloudios-sdk | ea5ba9eef027bd17a450623f1594790a6d192bbf | 4a8a859642118f197465e860cb1a4065f2e53803 | refs/heads/master | 2021-02-12T05:02:53.642059 | 2020-08-10T12:12:46 | 2020-08-10T12:12:46 | 244,562,859 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 9,553 | swift | //
// GHGuesturesNodeView.swift
// SwiftyGuesturesView
//
// Created by wuguanghui on 2017/8/22.
// Copyright © 2017年 wuguanghui. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
import UIKit
// MARK: - 节点状态类型
public enum NodeState : Int {
case normal // 普通
case selected // 选中
case warning // 警告
}
// MARK: - 每个节点
public class GHGuesturesNodeView: UIView {
// MARK: - property / 变量声明
// MARK: -外圈边框
public lazy var outLineSLayer : CAShapeLayer = {
let outLineSLayer = CAShapeLayer()
outLineSLayer.strokeColor = UIColor.clear.cgColor
// HexToColor(hex: "#1663D2").cgColor
outLineSLayer.lineWidth = GH_Scale(1)
outLineSLayer.fillColor = UIColor.clear.cgColor
return outLineSLayer
}()
// MARK: -内圈圆形
public lazy var innerAreaSLayer : CAShapeLayer = {
let innerAreaSLayer = CAShapeLayer()
innerAreaSLayer.strokeColor = UIColor.clear.cgColor
innerAreaSLayer.lineWidth = GH_Scale(1)
innerAreaSLayer.fillColor = UIColor.clear.cgColor
return innerAreaSLayer
}()
// MARK: -中心实点
public lazy var innerPointSLayer : CAShapeLayer = {
let innerPointSLayer = CAShapeLayer()
innerPointSLayer.strokeColor = UIColor.clear.cgColor
innerPointSLayer.lineWidth = GH_Scale(1)
innerPointSLayer.fillColor = UIColor.ThemeLabel.colorDark.cgColor
return innerPointSLayer
}()
// MARK: -三角形箭头
public lazy var triAnchorView : GHTriangleAnchorView = {
let triAnchorView = GHTriangleAnchorView(frame: self.frame)
triAnchorView.isHidden = true
self.addSubview(triAnchorView)
return triAnchorView
}()
// MARK: -节点状态
public var nodeState : NodeState = .normal {
willSet {
self.nodeState = newValue
}
didSet {
let status = nodeState
switch status {
case .normal:
let clearCG = UIColor.clear.cgColor
self.outLineSLayer.strokeColor = clearCG
// HexToColor(hex: "#1663D2").cgColor
self.innerAreaSLayer.fillColor = clearCG
self.innerPointSLayer.fillColor = UIColor.ThemeLabel.colorDark.cgColor
self.triAnchorView.taSLayer.fillColor = clearCG
self.triAnchorView.isHidden = true;
case .selected:
let selectCG = UIColor.ThemeView.highlight.cgColor
// RGB(82, 146, 252).cgColor
self.outLineSLayer.strokeColor = selectCG
self.innerAreaSLayer.fillColor = UIColor.clear.cgColor
self.innerPointSLayer.fillColor = selectCG
self.triAnchorView.taSLayer.fillColor = selectCG
case .warning:
let warningCG = UIColor.ThemeState.fail.cgColor
self.outLineSLayer.strokeColor = warningCG
self.innerAreaSLayer.fillColor = UIColor.clear.cgColor
self.innerPointSLayer.fillColor = warningCG
self.triAnchorView.taSLayer.fillColor = warningCG
}
}
}
// MARK: - life cycle / 生命周期
public override init(frame: CGRect) {
super.init(frame: frame)
layer.addSublayer(outLineSLayer)
// layer.addSublayer(innerAreaSLayer)
layer.addSublayer(innerPointSLayer)
nodeState = .normal
}
public required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
public override func layoutSubviews() {
super.layoutSubviews()
let outLinePath = UIBezierPath(ovalIn: bounds)
outLineSLayer.path = outLinePath.cgPath
let dwidth = (width / 3) * 2
let ddwidth = (width / 6)
let dddwidth = (width / 3)
innerAreaSLayer.frame = CGRect(x: ddwidth,
y: ddwidth,
width : dwidth,
height: dwidth)
let innerAreaPath = UIBezierPath(ovalIn: innerAreaSLayer.bounds)
innerAreaSLayer.path = innerAreaPath.cgPath
// innerPointSLayer.frame = CGRect(x: ddwidth * 2.5,
// y: ddwidth * 2.5,
// width : ddwidth,
// height: ddwidth)
innerPointSLayer.frame = CGRect(x: (width - 12) / 2 ,
y: (width - 12) / 2 ,
width : 12,
height: 12)
let innerPointPath = UIBezierPath(ovalIn: innerPointSLayer.bounds)
innerPointSLayer.path = innerPointPath.cgPath
triAnchorView.frame = bounds
}
// MARK: - public method / 公共方法
// MARK: -起点、△X、△Y
public func anchorWithStartPointXY(_ startPoint:CGPoint, x:Float, y:Float) {
var anchor : Float = 0
if x > 0 {
anchor = 90 + radiansToDegrees(atan(y/x))
} else if x == 0 {
if y > 0 {
anchor = 180
} else {
anchor = 0
}
} else {
anchor = 270 + radiansToDegrees(atan(y/x))
}
triAnchorView.angle = anchor
triAnchorView.isHidden = true
triAnchorView.frame = bounds
}
}
// MARK: - 三角形箭头
public class GHTriangleAnchorView: UIView {
// MARK: - property / 变量声明
// MARK: -三角实点
public lazy var taSLayer : CAShapeLayer = {
let taSLayer = CAShapeLayer()
return taSLayer
}()
// MARK: -半径
public var radius : CGFloat = 0 {
willSet {
self.radius = newValue
}
}
// MARK: -角度
public var angle : Float = 0 {
willSet {
self.angle = newValue
}
didSet {
let length : CGFloat = 1
let width : CGFloat = GH_Scale(5)
let innerLinePath = UIBezierPath()
let cx = centerPoint.x + mysinf(degreesToRadians(angle)) * GH_Scale(10)
let cy = centerPoint.y - mycosf(degreesToRadians(angle)) * GH_Scale(10)
let center = CGPoint(x: cx, y: cy)
let sx = center.x + radius * length * mysinf(degreesToRadians(angle))
let sy = center.y - radius * length * mycosf(degreesToRadians(angle))
let startPoint = CGPoint(x: sx, y: sy)
let mx = center.x + width * mysinf(degreesToRadians(angle + 90.0))
let my = center.y - width * mycosf(degreesToRadians(angle + 90.0))
let middlePoint = CGPoint(x: mx, y: my)
let ex = center.x + width * mysinf(degreesToRadians(angle + 270.0))
let ey = center.y - width * mycosf(degreesToRadians(angle + 270.0))
let endPoint = CGPoint(x: ex, y: ey)
innerLinePath.move(to: startPoint)
innerLinePath.addLine(to: middlePoint)
innerLinePath.addLine(to: endPoint)
innerLinePath.addLine(to: startPoint)
taSLayer.path = innerLinePath.cgPath
}
}
// MARK: -旋转中心点
public var centerPoint : CGPoint = CGPoint(x:0,y:0) {
willSet {
self.centerPoint = newValue
}
}
// MARK: - life cycle / 生命周期
public override init(frame: CGRect) {
super.init(frame: frame)
radius = GH_Scale(8)
backgroundColor = .clear
layer.addSublayer(taSLayer)
}
public required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
public override func layoutSubviews() {
super.layoutSubviews()
taSLayer.frame = frame
centerPoint = CGPoint(x: width/2, y: height/2)
}
public func mysinf(_ dTrAngle:Float) -> CGFloat {
return CGFloat(sinf(dTrAngle))
}
public func mycosf(_ dTrAngle:Float) -> CGFloat {
return CGFloat(cosf(dTrAngle))
}
}
| [
-1
] |
f5e27c124193f33158eeaf7a6813727121417737 | a338343c8e1948a2c17d6d728bde74578528186b | /Pitch-Perfect/new-pro/AppDelegate.swift | e69e7d34b82d991a065090150c52facb80f00220 | [] | no_license | conc35/Pitch-Perfect | 9d3835e9c0a56f8307c0549b9286e19f0a1cd103 | 844ae1c7ca3b41afdedb01f36bd6be4c22b66b92 | refs/heads/master | 2020-06-26T03:23:14.756478 | 2019-07-29T19:06:31 | 2019-07-29T19:06:31 | 199,511,605 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,182 | swift | //
// AppDelegate.swift
// new-pro
//
// Created by Wael Yazqi on 2019-03-24.
// Copyright © 2019 Wael Yazqi. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
204856,
229432,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
254563,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
189169,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
304009,
304011,
230284,
304013,
295822,
279438,
189325,
189329,
295825,
304019,
189331,
213902,
58262,
304023,
304027,
279452,
234648,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
132165,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
66690,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
279929,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
148946,
288214,
239064,
329177,
288217,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
370279,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
419555,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
354656,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
436684,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
281095,
223752,
150025,
338440,
240132,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
256716,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
240519,
183184,
289687,
240535,
224151,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
241821,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
176311,
299191,
307386,
258235,
307388,
307385,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
276052,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
176592,
127440,
315860,
176597,
283095,
127447,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
283142,
127494,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
316294,
201603,
226182,
308105,
234375,
226185,
234379,
324490,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
226245,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
324757,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
177318,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
226500,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
349451,
275725,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
178006,
317271,
284502,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
399252,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
350186,
292843,
276460,
276464,
178161,
227314,
276466,
325624,
350200,
276472,
317435,
276476,
276479,
276482,
350210,
276485,
317446,
178181,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
178224,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
243779,
325700,
284739,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
227430,
301167,
276583,
350321,
276590,
284786,
276595,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309491,
227571,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
318132,
342707,
154292,
277173,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
342749,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
293706,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
276579,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
384302,
285999,
277804,
113969,
277807,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
146765,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
302617,
286233,
302621,
286240,
146977,
187936,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
280021,
188252,
237409,
294776,
360317,
294785,
327554,
360322,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
65b7952310c5bc01f3acc09fced35c1bc756f90b | e37d28d11f9e76cb3908827e5f4382ce78017381 | /CoreDataDemo/View/PersonTableViewCell.swift | 229c21b130247debcad392bc7d28a38e5e673504 | [] | no_license | neha275/CoreDataDemo | 4f8e1579e652adcc39eb0b801d2a5ed8c41f6a49 | 0318e86ee9296e4bf6722d05b41a8ac9c8eaf68a | refs/heads/main | 2023-04-11T08:24:22.047912 | 2021-04-25T01:15:50 | 2021-04-25T01:15:50 | 342,627,994 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 538 | swift | //
// PersonTableViewCell.swift
// CoreDataDemo
//
// Created by Neha Gupta on 26/02/21.
//
import UIKit
class PersonTableViewCell: UITableViewCell {
@IBOutlet weak var lblName: UILabel!
@IBOutlet weak var lblAge: 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
}
}
| [
225060,
382280,
323561,
358868,
358876
] |
cee5dbdd60001993a91297223e3791834b7da404 | d1b9500367e49bbe8b80f4c754d7681dc3ffd005 | /Source/SwiftyPromise.swift | addf41a17f75d5a5f0b02278a43b3c085cd036ad | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | weiyupeng/SwiftyUI | 2e9b5790665467a9fa7f10ddde0969d5c92118f4 | 1529e10ec4d0264931934c637149e3c37105b7ef | refs/heads/master | 2022-08-02T02:40:37.991790 | 2020-06-01T19:16:56 | 2020-06-01T19:16:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,899 | swift | //
// SwiftyPromise.swift
// SwiftyUI
//
// Created by Haochen Wang on 10/14/17.
// Copyright © 2017 Haochen Wang. All rights reserved.
//
import Foundation
public enum ThreadPerform: Int {
case main
case background
}
private struct Task
{
var identifier: String?
var perform: ThreadPerform
var op : Operation
private init(_ identifier : String? = nil, _ perform: ThreadPerform = .background, _ op: Operation)
{
self.identifier = identifier
self.perform = perform
self.op = op
}
static func create(_ identifier : String? = nil, _ perform: ThreadPerform = .background, _ op: Operation) -> Task
{
return Task(identifier, perform, op)
}
func start()
{
switch perform {
case .main:
OperationQueue.main.addOperation(op)
case .background:
SwiftyThreadPool.defalut.add(op, withIdentifier: identifier)
}
}
}
private extension Operation
{
func complete(with block: (() -> Void)?) -> Operation
{
completionBlock = block
return self
}
}
public final class Promise<T>
{
private var tasks: [Task] = []
private var alwaysTasks: [Task] = []
private var errorBlock : ((Error) -> Void)?
private var isError : Bool = false
private var value: T?
private final func operationBuild(_ work: (() throws -> Void)?) -> Operation
{
return BlockOperation {
var work = work
if work == nil { work = {} }
do {
try work!()
}
catch let error {
self.isError = true
self.errorBlock?(error)
}
}.complete(with: { [weak self] in
guard let strongSelf = self else { return }
strongSelf.fire()
})
}
private final func operationBuildT(_ work: @escaping (_ update: (T?) -> (), _ value: T?) throws -> ()) -> Operation
{
return BlockOperation {
do {
try work(self.update, self.value)
}
catch let error {
self.isError = true
self.errorBlock?(error)
}
}.complete(with: { [weak self] in
guard let strongSelf = self else { return }
strongSelf.fire()
})
}
private init(_ identifier : String? = nil, _ perform: ThreadPerform = .background, _ work: (() throws -> Void)?)
{
tasks.append(.create(identifier, perform, operationBuild(work)))
}
private init(_ identifier : String? = nil, _ perform: ThreadPerform = .background, work: @escaping (_ update: (T?) -> Void, _ value: T?) throws -> Void)
{
tasks.append(.create(identifier, perform, operationBuildT(work)))
}
@discardableResult
public final class func firstly(with identifier : String? = nil, on perform: ThreadPerform = .background, _ work: (() throws -> Void)?) -> Promise
{
return Promise(identifier, perform, work)
}
@discardableResult
public final class func firstly(with identifier : String? = nil, on perform: ThreadPerform = .background, work: @escaping (_ update: (T?) -> Void, _ value: T?) throws -> Void) -> Promise
{
return Promise(identifier, perform, work: work)
}
@discardableResult
public final func then(with identifier : String? = nil, on perform: ThreadPerform = .background, _ work: (() throws -> Void)?) -> Promise
{
tasks.append(.create(identifier, perform, operationBuild(work)))
return self
}
public final func then(with identifier : String? = nil, on perform: ThreadPerform = .background, work: @escaping (_ update: (T?) -> (), _ value: T?) throws -> Void) -> Promise
{
tasks.append(.create(identifier, perform, operationBuildT(work)))
return self
}
public final func always(with identifier : String? = nil, on perform: ThreadPerform = .background, _ work: (() throws -> Void)?) -> Promise
{
let task : Task = .create(identifier, perform, operationBuild(work))
task.op.completionBlock = nil
alwaysTasks.append(task)
return self
}
public final func `catch`(_ errorBlock : ((Error) -> Void)? = nil)
{
self.errorBlock = errorBlock
for (_, task) in alwaysTasks.enumerated().reversed()
{
task.start()
}
alwaysTasks.removeAll()
fire()
}
private final func update(_ value: T?)
{
self.value = value
}
private final func fire()
{
guard isError == false else {
tasks.removeAll()
return
}
guard let task = tasks.first else { return }
task.start()
tasks.removeFirst()
}
}
| [
-1
] |
99636df4ec755e467db6f687ca935427ba8c531f | fdd6aac955a8c67946cd76d587e82c926dc27e0f | /TokoPedia/SearchViewController.swift | 824a0ceb5ab3c19518e3d671bff7d12aa77b2c8e | [] | no_license | gurunglaxman0/TokoPedia | 9ee89fb85edcfdba31b49ba3de0ac2178402e6b7 | 6e46108eb5aac3f50b81da3edfeb785b3f6331d5 | refs/heads/master | 2020-03-19T05:36:31.091062 | 2018-06-19T08:24:01 | 2018-06-19T08:24:01 | 135,947,394 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,751 | swift | //
// SearchViewController.swift
// TokoPedia
//
// Created by Mukesh mac on 02/06/18.
// Copyright © 2018 Lakshman. All rights reserved.
//
import UIKit
import Moya
import RxCocoa
import RxSwift
import JGProgressHUD
class SearchViewController: UIViewController {
@IBOutlet weak var filterBtn: UIButton!
let progressHUD = JGProgressHUD(style: .dark)
@IBOutlet weak var collectionView: UICollectionView!
var q = ""
let rows = "10"
var start = 0
var fshop = ""
var official = true
var wholesale = true
var pmax = 80000
var pmin = 100
var searchProvider = MoyaProvider<SearchServices>()
var searchViewModel = SearchViewModel(with: [])
var total_data: Int?
var disposeBag = DisposeBag()
var shopTypes:[ShopType] = []
override func viewDidLoad() {
super.viewDidLoad()
fetchResult()
filterBtn.rx.controlEvent(.touchUpInside).subscribe { [weak self] (_) in
guard let strongSelf = self else {return}
let vc = UIStoryboard.main.instantiate(.filterVC) as! FilterViewController
vc.shops = strongSelf.shopTypes
vc.maxPrice = Double(strongSelf.pmax)
vc.minPrice = Double(strongSelf.pmin)
strongSelf.present(vc, animated: true, completion: nil)
vc.wholeSale.value = strongSelf.wholesale
vc.applyBtn.rx.controlEvent(.touchUpInside).subscribe({ (_) in
vc.dismiss(animated:true , completion: nil)
strongSelf.pmin = Int(vc.minPrice)
strongSelf.pmax = Int(vc.maxPrice)
strongSelf.wholesale = vc.wholeSale.value
strongSelf.shopTypes = vc.shops
var official = false
var fshop = ""
for shop in vc.shops {
if shop.id == 1 {
official = true
} else if shop.id == 2 {
fshop = "2"
}
}
strongSelf.official = official
strongSelf.fshop = fshop
strongSelf.searchViewModel.items = []
strongSelf.fetchResult()
}).disposed(by: strongSelf.disposeBag)
}.disposed(by: disposeBag)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func fetchResult(){
progressHUD.show(in: view)
searchProvider.request(.search(q: q, rows: rows, start: "\(start)", fshop: fshop, official: "\(official)", wholesale: "\(wholesale)", pmax: "\(pmax)", pmin: "\(pmin)")) { [weak self] (result) in
guard let strongSelf = self else {return}
strongSelf.progressHUD.dismiss(animated: true)
switch result {
case .success(let response):
do {
let json = try JSONSerialization.jsonObject(with: response.data, options: .allowFragments)
guard let jsonObj = json as? [String: Any], let itemData = jsonObj["data"] as? [[String: Any]] else {return}
// print(json)
let result = itemData.map({ (item) -> SearchItemViewModel in
let name = item["name"] as? String
let price = item["price"] as? String
let image_uri = item["image_uri"] as? String
let image_uri_700 = item["image_uri_700"] as? String
return SearchItemViewModel(name: name ?? "", price: price ?? "", image_uri: image_uri ?? "", image_uri_700: image_uri_700 ?? "")
})
strongSelf.searchViewModel.items.append(contentsOf: result)
strongSelf.collectionView.reloadData()
if let header = jsonObj["header"] as? [String: Any] {
strongSelf.total_data = (header["total_data"] as? Int)
}
} catch {
print("\(error.localizedDescription)")
}
break
case .failure(let error):
print("\(error)")
break
}
}
}
}
extension SearchViewController: UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return searchViewModel.items.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CellId", for: indexPath) as! SearchViewCell
cell.configure(withViewModel: searchViewModel.items[indexPath.item])
return cell
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let width = (view.frame.width-20)/2 - 2
return CGSize(width: width, height: 255)
}
func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
if indexPath.row + 1 == searchViewModel.items.count {
if searchViewModel.items.count < (total_data ?? 0) {
start += 10
fetchResult()
}
}
}
}
| [
-1
] |
5ba2c6aeae5f39ff1c4614bcca5a41d2a4aef731 | 973107b97a72f5c804d56645bef35e5c105c3f5c | /File Templates/Swift/Struct.xctemplate/Public/___FILEBASENAME___.swift | b58af47907be1c68f04dae0bf33ec77f2b76a445 | [] | no_license | kkla320/Templates | 91c3b4ddf55bad6182a00be260dfbf99fcff7d5a | bceb254a05291efd5f9feb9d3ada4a77ace7e3af | refs/heads/master | 2023-02-09T17:11:16.252135 | 2021-01-03T21:24:08 | 2021-01-03T21:24:08 | 326,273,646 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 62 | swift | //___FILEHEADER___
public struct ___FILEBASENAME___ {
}
| [
-1
] |
fb111c3dc2284ec86e4a7d7ead1d1ddb959f0b3f | 7238acfb4fc3c788593b5e01d341003506bff2d7 | /LYZXSwiftProject/LYZXSwiftProject/Main/HuanJiaoCenter/controller/YOHuanJiaoMainViewController.swift | 71d3fac55f917926cb2e567fa0d55aaa2aeb9037 | [] | no_license | zouyaya/swift_project | 57c679c99811ce861a0f39da6b6cdd00434ac454 | 885aa8307013783c006d111cfaf1a44e70178029 | refs/heads/master | 2023-02-27T07:33:31.834653 | 2021-02-04T07:48:07 | 2021-02-04T07:48:07 | 264,097,249 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 863 | swift | //
// YOHuanJiaoMainViewController.swift
// LYZXSwiftProject
//
// Created by yangou on 2020/5/18.
// Copyright © 2020 hello. All rights reserved.
//
import UIKit
class YOHuanJiaoMainViewController: YOBaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.view.backgroundColor = .colorWithHexStringWithoutAlpha("0xffffff")
self.navBar.titleLabel.text = "患教中心"
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
a667b59ff2fd3edc67044e616313925feea4e116 | c297f34865a0f348ba3899e2537ec0b1ac495d1f | /sample-code/session-7/SwiftUIDemo/SwiftUIDemo/SceneDelegate.swift | cde367d8a96c4d67d96da955353b819d515b1f09 | [] | no_license | uchicago-mobi/mpcs-51030-winter-2020-section-2 | 46239ce695c263332ec17da3da392ae89f8bbda3 | 76549fcc7726671437c7850dfcd647966c478dcf | refs/heads/master | 2020-12-03T09:49:18.418649 | 2020-03-04T23:11:42 | 2020-03-04T23:11:42 | 231,272,386 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,798 | swift | //
// SceneDelegate.swift
// SwiftUIDemo
//
// Created by Susan Stevens on 2/17/20.
// Copyright © 2020 Susan Stevens. All rights reserved.
//
import UIKit
import SwiftUI
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).
// Create the SwiftUI view that provides the window contents.
let contentView = ContentView().environmentObject(Preferences())
// Use a UIHostingController as window root view controller.
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = UIHostingController(rootView: contentView)
self.window = window
window.makeKeyAndVisible()
}
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
| [
325633,
325637,
163849,
333838,
346140,
163892,
16444,
337980,
217158,
243782,
395340,
327757,
200786,
286804,
329816,
217180,
368736,
342113,
180322,
329833,
286833,
252021,
342134,
286845,
286851,
329868,
250008,
329886,
286880,
135328,
192674,
333989,
286889,
430257,
180418,
350411,
180432,
350417,
350423,
350426,
385243,
334047,
356580,
346344,
327915,
350449,
338161,
350454,
321787,
336124,
350459,
350462,
336129,
350465,
350469,
325895,
194829,
350477,
43279,
350481,
350487,
356631,
338201,
325915,
350491,
325918,
182559,
350494,
325920,
350500,
194854,
350505,
350510,
248112,
332081,
307507,
340276,
336181,
356662,
264502,
332091,
332098,
201030,
332107,
190797,
334162,
332118,
321880,
332126,
332130,
250211,
340328,
250217,
348523,
348528,
182642,
321911,
332153,
334204,
332158,
250239,
332162,
348548,
332175,
160152,
340380,
326059,
373169,
342453,
334263,
338363,
324032,
336326,
338387,
248279,
369119,
334306,
338404,
334312,
338411,
104940,
375279,
162289,
328178,
328180,
248309,
328183,
340473,
199165,
328190,
324095,
328193,
98819,
324100,
324103,
164362,
248332,
199182,
328207,
324112,
330254,
186898,
342546,
340501,
324118,
334359,
342551,
324122,
334364,
330268,
340512,
191012,
332325,
324134,
197160,
324141,
324143,
334386,
324156,
334397,
188990,
324161,
324165,
219719,
324171,
324174,
324177,
244309,
334425,
326240,
340580,
174696,
244330,
248427,
191085,
346736,
338544,
334466,
336517,
344710,
119432,
213642,
148106,
162446,
330384,
326291,
340628,
342685,
340639,
336549,
332460,
336556,
332464,
164535,
336568,
174775,
248505,
174778,
244410,
328379,
332473,
223936,
328387,
332484,
332487,
154318,
332494,
342737,
154329,
183006,
139998,
189154,
338661,
338665,
332521,
330479,
342769,
340724,
332534,
338680,
342777,
344832,
207620,
336644,
191240,
328462,
326417,
336660,
199455,
336676,
336681,
334633,
326444,
215854,
328498,
152371,
326452,
271154,
326455,
340792,
348983,
244542,
326463,
326468,
328516,
336709,
127815,
244552,
328520,
326474,
328523,
336712,
342857,
326479,
355151,
330581,
326486,
136024,
330585,
326494,
326503,
201580,
326508,
201583,
326511,
211826,
340850,
330612,
201589,
340859,
324476,
328574,
340863,
351105,
324482,
324488,
324496,
330643,
324502,
252823,
324511,
324514,
252838,
201638,
211885,
252846,
324525,
5040,
5047,
324539,
324542,
340940,
345046,
330711,
248794,
340958,
248799,
340964,
338928,
328690,
359411,
244728,
330750,
328703,
199681,
328710,
338951,
330761,
328715,
330769,
209944,
336922,
209948,
248863,
345119,
250915,
357411,
250917,
158759,
328747,
209966,
209969,
330803,
209973,
209976,
339002,
339010,
209988,
209991,
347208,
248905,
330827,
197708,
330830,
248915,
345172,
183384,
156762,
343132,
339037,
322660,
326764,
210028,
326767,
345200,
330869,
361591,
210042,
210045,
152704,
160896,
330886,
351366,
384136,
384140,
337048,
210072,
248986,
384152,
210078,
384158,
210081,
384161,
251045,
210085,
210089,
339118,
337072,
210096,
337076,
210100,
345268,
249015,
324792,
367801,
339133,
384189,
343232,
384192,
210116,
244934,
326858,
322763,
333003,
384202,
343246,
384209,
333010,
146644,
330966,
210139,
328925,
66783,
384225,
343272,
351467,
328942,
251123,
384247,
384250,
242947,
206084,
115973,
343307,
384270,
333075,
384276,
333079,
251161,
384284,
245021,
384290,
208167,
171304,
245032,
245042,
251190,
44343,
345400,
208189,
343366,
126279,
337224,
251211,
337230,
331089,
337235,
263509,
331094,
365922,
175458,
208228,
343394,
175461,
343399,
337252,
345449,
175464,
197987,
333164,
99692,
343410,
234867,
331124,
175478,
155000,
378232,
249210,
175484,
337278,
249215,
245121,
249219,
245128,
249225,
181644,
249228,
136591,
245137,
181650,
249235,
112021,
181655,
245143,
175514,
245146,
343453,
245149,
245152,
245155,
355749,
40358,
181671,
245158,
333222,
245163,
181679,
327090,
337330,
210357,
343478,
146878,
181697,
54724,
327108,
181704,
339401,
327112,
384457,
327116,
327118,
208338,
366035,
343509,
337366,
249310,
249313,
333285,
329195,
343540,
343545,
253445,
339464,
337416,
249355,
329227,
175637,
345626,
366118,
339504,
206397,
333387,
214611,
333400,
339553,
343650,
333415,
245358,
333423,
222831,
138865,
339572,
126597,
339593,
126611,
333472,
245410,
345763,
245415,
337588,
337601,
337607,
333512,
210632,
339664,
358100,
245463,
212700,
181982,
153311,
333535,
225000,
337643,
245487,
339696,
337647,
245495,
141052,
337661,
333566,
339711,
225027,
337671,
339722,
249617,
321300,
245528,
333593,
116512,
184096,
339748,
358192,
399166,
325441,
247618,
325447,
341831,
329545,
341835,
323404,
354124,
337743,
339795,
354132,
341844,
247639,
337751,
358235,
341852,
313181,
413539,
339818,
327532,
339827,
358260,
341877,
325494,
182136,
186233,
1914,
333690,
243584,
325505,
333699,
339845,
247692,
333709,
247701,
329625,
327590,
333737,
337845,
184245,
190393,
327613,
333767,
350153,
346059,
311244,
358348,
247760,
212945,
333777,
219094,
419810,
329699,
358372,
327655,
247790,
380919,
333819
] |
8e5177195701b4cd0f7621407482c187f7229b26 | f154d7d75baee75c1d89c15b00217a6d0f219368 | /QuophoTests/QuophoTests.swift | 261d31568f7e490c5c9f56cbb7bc2f4c33c9b3cd | [] | no_license | cweggler/quopho | 3d449632efcca523dc206ea04b466da2d42fcf93 | 54d87f22588466922bdf157855a0f7b7c27be44c | refs/heads/master | 2020-05-18T10:49:53.250820 | 2019-05-15T00:49:56 | 2019-05-15T00:49:56 | 184,361,755 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 884 | swift | //
// QuophoTests.swift
// QuophoTests
//
// Created by Cara on 4/23/19.
// Copyright © 2019 Cara. All rights reserved.
//
import XCTest
@testable import Quopho
class QuophoTests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
241692,
223268,
329765,
315432,
315434,
102445,
241716,
319542,
243767,
325694,
254027,
329814,
338007,
200794,
321637,
319591,
315498,
319598,
333955,
319629,
325776,
317587,
333991,
333992,
338119,
321745,
334042,
356576,
317664,
327904,
338150,
321772,
327929,
12542,
313608,
338197,
325912,
315673,
237856,
151847,
325931,
321840,
127284,
332085,
336183,
332089,
332101,
319821,
323920,
325968,
354655,
242023,
242029,
246127,
250226,
246136,
139640,
246137,
317820,
211326,
313727,
242058,
108944,
317852,
121245,
141728,
246178,
315810,
108972,
311727,
377264,
334260,
319930,
311738,
336317,
311745,
324039,
129483,
317901,
242139,
195045,
127465,
330218,
319981,
109042,
324097,
342536,
322078,
242237,
322120,
340558,
244310,
332378,
242277,
344680,
311941,
184973,
334481,
316049,
111253,
111258,
318107,
318130,
164533,
109241,
248517,
363211,
242386,
334547,
318173,
330474,
129773,
322291,
312052,
312053,
191235,
336648,
264968,
322316,
117517,
326414,
312079,
322319,
207640,
326429,
336671,
318250,
318252,
353069,
328499,
353078,
342847,
353094,
353095,
244568,
244570,
322395,
109409,
242529,
351077,
275303,
242541,
246641,
330609,
109428,
269178,
240518,
109447,
316298,
58253,
326553,
318364,
127902,
240552,
353195,
316333,
347055,
326581,
316343,
330689,
248796,
340961,
340974,
320507,
328700,
330754,
328706,
320516,
330763,
324625,
322582,
320536,
326685,
336929,
324666,
336960,
21569,
314436,
214086,
250956,
339030,
156764,
314467,
250981,
318572,
316526,
337017,
324760,
3246,
318639,
337077,
353482,
283853,
316627,
330984,
353523,
128251,
320770,
322824,
242954,
328971,
353551,
251153,
126237,
333090,
208164,
130348,
326966,
318775,
312634,
312635,
216386,
193859,
331090,
318805,
314720,
314726,
314728,
333160,
327024,
243056,
312689,
327025,
116084,
314739,
327031,
314751,
318848,
314758,
304524,
112018,
9619,
314783,
314791,
245161,
241066,
316842,
314798,
150965,
210358,
366037,
210392,
310748,
103909,
245223,
191981,
333300,
191990,
323087,
329232,
316946,
175639,
374296,
245287,
312880,
312889,
243274,
224851,
196187,
345700,
120427,
204397,
138863,
325231,
224883,
247416,
323196,
325245,
337535,
339584,
312965,
245412,
323236,
206504,
61101,
321199,
337591,
321207,
323263,
323264,
321219,
212685,
333517,
333520,
245457,
241361,
313041,
333521,
241365,
181975,
321249,
325346,
333542,
325371,
319233,
323346,
321302,
339745,
241442,
241441,
341796,
247590,
321337,
319292,
325439,
315202,
325445,
153415,
159562,
325457,
307039,
345955,
325484,
313199,
325492,
241528,
317304,
325503,
182144,
339841,
241540,
247686,
243591,
325518,
329622,
337815,
118685,
319392,
200627,
174019,
313319,
174057,
327661,
362480,
329712,
325619,
333817,
313339
] |
bcb3751447bdc4d94d3a425b995a32d29342f06b | 620eba4a58ace88591e2eef9fbb85ad63428949b | /hoopeu/Classes/Login/Models/LHSUserInfoModel.swift | 839562df6936c813de9ec5508fd65757d47fbc1e | [
"MIT"
] | permissive | gouyz/hoopeu | 2e0dd524bfdc56d3821fe3df48dd16e2446de038 | 8e4be9dbd61db09014589a9763cb0ec0b88472f0 | refs/heads/master | 2021-06-28T02:59:46.947518 | 2020-12-07T12:59:23 | 2020-12-07T12:59:23 | 192,770,011 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 493 | swift | //
// LHSUserInfoModel.swift
// LazyHuiService
// 用户信息model
// Created by gouyz on 2017/6/21.
// Copyright © 2017年 gouyz. All rights reserved.
//
import UIKit
@objcMembers
class LHSUserInfoModel: LHSBaseModel {
/// 用户id
var id : String? = ""
/// 用户手机号
var phone : String? = ""
/// 用户的姓名(昵称)
var nickname : String? = ""
/// 用户邮箱
var email : String? = ""
/// 头像
var head : String? = ""
}
| [
-1
] |
4a5d267e3fd9bfe15c4ebe4e7ff25148283df3b9 | ab7ce5e438f67a0da46f5b62ace5289e292a84fb | /TranswideLogisticsDriver/TranswideLogisticsDriverTests/TranswideLogisticsDriverTests.swift | 08b69f1c57ab5da13edac715e44ecb20302e3586 | [] | no_license | RanaFaheem82/TWL-DRIVER | fa7371fcb8791014f41b0931cf493819efc2b2cd | 52084200c7b6de699200b06571dcd3ee3fcf9494 | refs/heads/master | 2022-12-24T12:22:39.945570 | 2020-09-21T09:06:45 | 2020-09-21T09:06:45 | 284,506,468 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 958 | swift | //
// TranswideLogisticsDriverTests.swift
// TranswideLogisticsDriverTests
//
// Created by apple on 4/29/20.
// Copyright © 2020 apple. All rights reserved.
//
import XCTest
@testable import TranswideLogisticsDriver
class TranswideLogisticsDriverTests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
354316,
317467,
241692,
16419,
223268,
329765,
315432,
325674,
315434,
243759,
176175,
321583,
124975,
241716,
319542,
243767,
124984,
241720,
352315,
325694,
313416,
196691,
329814,
338007,
200794,
356447,
254048,
321637,
329829,
319591,
319598,
333940,
333955,
241808,
323729,
325776,
317587,
333991,
333992,
333996,
241843,
125109,
180408,
182456,
338119,
346314,
321745,
334042,
379100,
194782,
356576,
338150,
321772,
385262,
327929,
356602,
243962,
12542,
125183,
194820,
125188,
313608,
321800,
125193,
125199,
125203,
338197,
334103,
325912,
315673,
125208,
237856,
125217,
151847,
338218,
325931,
321840,
98610,
332083,
127284,
125235,
336183,
125240,
332089,
315706,
241986,
182598,
323916,
319821,
348492,
325968,
215385,
272729,
332123,
354655,
391520,
106847,
242023,
160110,
246127,
250226,
246136,
246137,
315770,
139640,
106874,
317820,
211326,
313727,
362881,
240002,
248194,
332167,
242058,
311691,
108944,
293274,
317852,
121245,
39324,
246178,
315810,
108972,
311727,
377264,
334260,
319930,
336317,
342466,
254406,
324039,
129483,
317901,
6606,
334290,
242139,
369116,
256477,
242148,
242149,
195045,
127465,
330218,
319981,
109042,
319987,
254456,
324097,
240131,
342536,
348682,
254488,
322078,
207393,
375333,
377386,
197167,
174648,
348732,
242237,
352829,
322120,
340558,
244310,
332378,
354911,
436832,
242277,
244327,
344680,
295536,
313971,
244347,
311941,
344715,
330379,
184973,
326287,
316049,
311954,
334481,
346772,
111253,
316053,
352917,
111258,
111259,
318107,
363163,
344738,
318130,
109241,
248517,
363211,
242386,
334547,
318173,
338662,
246503,
330474,
342763,
418546,
322291,
312052,
312053,
344827,
191235,
336648,
264968,
322316,
117517,
326414,
312079,
322319,
207640,
326429,
336671,
318252,
353069,
353078,
355130,
342847,
355139,
252741,
353094,
353095,
355146,
355154,
244568,
244570,
322395,
355165,
109409,
351077,
342887,
201577,
326505,
355178,
242541,
330609,
246641,
246648,
361337,
269178,
359299,
240518,
109447,
316298,
349067,
236428,
426895,
355217,
326553,
318364,
127902,
240544,
256935,
353195,
140204,
347055,
252847,
326581,
353216,
330689,
330708,
248796,
248797,
340961,
64485,
52200,
123881,
340974,
383982,
316405,
349175,
320507,
330754,
357379,
320516,
353290,
330763,
320527,
324625,
330772,
418837,
322582,
320536,
201755,
326685,
252958,
336929,
345132,
359478,
324666,
324667,
336960,
21569,
214086,
361543,
250956,
314448,
341073,
353367,
156764,
156765,
314467,
250981,
253029,
318572,
316526,
337017,
363641,
150657,
349318,
177296,
326804,
324760,
339100,
339102,
343203,
253099,
3246,
318639,
339130,
322749,
343234,
259268,
353479,
353480,
353481,
353482,
244940,
283853,
333011,
148696,
357595,
359647,
330984,
222440,
328940,
353524,
128251,
363771,
316669,
320770,
322824,
242954,
328971,
318733,
353551,
251153,
349462,
245019,
320796,
126237,
208164,
109861,
369956,
130348,
318775,
312634,
116026,
216386,
193859,
345415,
312648,
372043,
331090,
120148,
316765,
234850,
314726,
333160,
327024,
327025,
312689,
316787,
116084,
314741,
243056,
314739,
249205,
314751,
318848,
388487,
304524,
112018,
9619,
212375,
357786,
212382,
314783,
333220,
314789,
314791,
245161,
316842,
241066,
314798,
150965,
210358,
329173,
366037,
210390,
210392,
210391,
310748,
103909,
245223,
361963,
54765,
191981,
321009,
251378,
343542,
323080,
329225,
253451,
253452,
359950,
323089,
316946,
398869,
175639,
374296,
349726,
187938,
245287,
347694,
312880,
312889,
425535,
349763,
124485,
243274,
333388,
333393,
196187,
44635,
345700,
323172,
374372,
243307,
312940,
120427,
204397,
138863,
333430,
247416,
323196,
325245,
175741,
337535,
339584,
312965,
224901,
345752,
255649,
245412,
323236,
61101,
321199,
364207,
224946,
337591,
224958,
323263,
323264,
321219,
333509,
319177,
245457,
241361,
333523,
241365,
181975,
321247,
325346,
333542,
345833,
294638,
360177,
325371,
274172,
124669,
319233,
323331,
323346,
321302,
325404,
255776,
241441,
241442,
325410,
339745,
341796,
247590,
333610,
317232,
319288,
259899,
319292,
325439,
315202,
325445,
153415,
339783,
159562,
325457,
337745,
241495,
362327,
345955,
384873,
325484,
313199,
325492,
317304,
333688,
241528,
124798,
325503,
55167,
327557,
247686,
325515,
325518,
337815,
118685,
319392,
253856,
354212,
313254,
333735,
323507,
124852,
243637,
188348,
174019,
321480,
212942,
212951,
360417,
313319,
337895,
174057,
327661,
362480,
333817
] |
59f96b8c4256105993b3bc9a66216d66edc31ea0 | 8995ec29e99242bf797b09f22631971281fc0824 | /Sources/Predicate/BidirectionalCollection+PredicateProtocol.swift | f8a0ec0fbea12b933a34c80e98e7d521f185577b | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | YOCKOW/SwiftPredicate | 6e8939388b0cec47e85ed4062b33f28c0fefaf72 | b99f6b76050d2bb626f4228518f25e65f20ac0f8 | refs/heads/main | 2022-04-27T20:42:43.707060 | 2022-04-04T07:57:07 | 2022-04-04T07:57:07 | 145,388,881 | 2 | 0 | MIT | 2022-04-04T07:57:08 | 2018-08-20T08:29:22 | Swift | UTF-8 | Swift | false | false | 1,020 | swift | /***************************************************************************************************
BidirectionalCollection+PredicateProtocol.swift
© 2018 YOCKOW.
Licensed under MIT License.
See "LICENSE.txt" for more information.
**************************************************************************************************/
extension BidirectionalCollection {
#if swift(>=4.1.50)
#else
public func lastIndex(where predicate: (Element) throws -> Bool) rethrows -> Index? {
var ii = self.endIndex
while true {
ii = self.index(before:ii)
if try predicate(self[ii]) { return ii }
if ii == self.startIndex { break }
}
return nil
}
#endif
/// Returns the index of the last element in the collection that matches the given predicate.
public func lastIndex<Predicate>(where predicate:Predicate) -> Index?
where Predicate:PredicateProtocol, Predicate.Variable == Element
{
return self.lastIndex(where:{ predicate.evaluate(with:$0) })
}
}
| [
-1
] |
af46b97a2d4e013f8f47157daddac46b339d3fc0 | 6940c7a95d1ea2e8acafcaac107bda22e9ece080 | /AppDelegate.swift | f7707de9578bdcb698d6f36fcf3408b9f57bb31a | [] | no_license | Tilapia75/Food | a91e7f4e554e26c163813b7a39e51a79d3c774b8 | cac2aea91ce8b20a296066f3e05d9e4b0ac18341 | refs/heads/master | 2020-03-21T09:49:05.809771 | 2018-06-23T17:14:14 | 2018-06-23T17:14:14 | 138,419,154 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,171 | swift | //
// AppDelegate.swift
// Food
//
// Created by Louie Serrano on 6/16/18.
// Copyright © 2018 L.A.L.I. LLC. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
294924,
229388,
229391,
327695,
229394,
229397,
229399,
229402,
229405,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
204856,
229432,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
286922,
286924,
286926,
319694,
131281,
278743,
278747,
295133,
155872,
319716,
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,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312006,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
304009,
304011,
230284,
304013,
295822,
279438,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
234648,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
230334,
304063,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
132165,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
279661,
205934,
164973,
312432,
279669,
337018,
279679,
304258,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
148946,
280021,
239064,
329177,
288217,
280027,
288220,
288214,
239070,
288218,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
320998,
288234,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
181854,
370272,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
190118,
321195,
296622,
321200,
337585,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
304968,
280393,
280402,
173907,
313171,
313176,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
280823,
280825,
280827,
280830,
280831,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
354653,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
150025,
338440,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
150066,
158262,
158266,
289342,
281154,
322115,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
240519,
183184,
289687,
240535,
297883,
289694,
289696,
289700,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282261,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
241813,
307352,
299164,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
323763,
184503,
176311,
299191,
307386,
258235,
307388,
307385,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
184579,
282893,
291089,
282906,
291104,
233766,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127434,
315856,
176592,
315860,
176597,
127447,
299481,
176605,
242143,
127457,
291299,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
283142,
127494,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
316294,
201603,
226182,
308105,
234375,
324490,
226185,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
226245,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
234501,
308231,
234504,
234507,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
324757,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
226500,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
275725,
349464,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
358126,
276206,
358128,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
178006,
317271,
284502,
276315,
292700,
317279,
284511,
227175,
292715,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
292776,
276395,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276452,
292839,
276455,
292843,
276464,
178161,
227314,
325624,
317435,
276479,
276482,
276485,
317446,
276490,
292876,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
325700,
292934,
243785,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
227430,
301167,
276583,
350321,
276590,
284786,
276595,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
285061,
317833,
178572,
285070,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
318132,
342707,
154292,
277173,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
203491,
228069,
277223,
342760,
56041,
285417,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
277329,
162643,
310100,
301911,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
276579,
293811,
293817,
293820,
203715,
326603,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
130345,
277801,
113964,
277804,
285997,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
277832,
277836,
294221,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
302603,
65038,
302614,
302617,
286233,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
188252,
237409,
360317,
294785,
327554,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
311283,
278516,
237562
] |
03992691bd735ad4ee24490d9ca00f3744596224 | 662c2fcb5db1d757220cf89e57e65ece8cfba654 | /Onboarding/Controller/Cells/ItemCell.swift | f9d83ab387c328c7dd12b67ef773093d3be4ba81 | [] | no_license | atleastzero/Onboarding | d92ac35dbc6892d228cd28462c693880f40b67f3 | 16e9c70f324d87a12f2efad163f77722b7908d19 | refs/heads/master | 2020-12-27T11:54:58.050268 | 2020-03-10T00:58:14 | 2020-03-10T00:58:14 | 237,894,152 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,088 | swift | //
// ItemCell.swift
// Onboarding
//
// Created by Megan OBryan on 3/4/20.
// Copyright © 2020 Makeschool. All rights reserved.
//
import UIKit
class ItemCell: UITableViewCell {
var favoriteButton: UIButton! = {
let button = UIButton()
button.translatesAutoresizingMaskIntoConstraints = false
button.setTitleColor(UIColor.black, for: .normal)
button.layer.cornerRadius = 10
button.layer.masksToBounds = true
button.backgroundColor = .yellow
return button
}()
var itemLabel: UILabel! = {
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
label.textColor = UIColor.black
label.layer.masksToBounds = true
return label
}()
override func awakeFromNib() {
super.awakeFromNib()
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.setup()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.setup()
}
func setup() {
self.contentView.addSubview(favoriteButton)
favoriteButton.topAnchor.constraint(equalTo: self.contentView.topAnchor).isActive = true
favoriteButton.bottomAnchor.constraint(equalTo: self.contentView.bottomAnchor).isActive = true
favoriteButton.leadingAnchor.constraint(equalTo: self.contentView.leadingAnchor).isActive = true
favoriteButton.trailingAnchor.constraint(equalTo: self.contentView.trailingAnchor).isActive = true
self.contentView.addSubview(itemLabel)
itemLabel.centerYAnchor.constraint(equalToSystemSpacingBelow: self.contentView.centerYAnchor, multiplier: 1.0).isActive = true
itemLabel.centerXAnchor.constraint(equalToSystemSpacingAfter: self.contentView.centerXAnchor, multiplier: 1.0).isActive = true
}
}
| [
-1
] |
fd167746c93b165dcb1ec5dbc7caf745ddba0c48 | 2dd4c2a9c0391f1c593f61b2089ecbf3db82b20e | /zat-chat/AppDelegate.swift | fd7964989561de43d9f03932c1108c6c489a5690 | [] | no_license | jhaff/zat-chat | 6e4e9ba528d4efb6a91e71f4a664fb4bed917f8b | 0db07beb47de5b06284858c72871ca44c529e1af | refs/heads/master | 2022-11-14T23:40:50.486808 | 2020-06-27T21:39:52 | 2020-06-27T21:39:52 | 274,507,965 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,570 | swift | //
// AppDelegate.swift
// zat-chat
//
// Created by Jacob Haff on 6/23/20.
// Copyright © 2020 Jacob Haff. All rights reserved.
//
import UIKit
import Firebase
import IQKeyboardManagerSwift
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
let db = Firestore.firestore()
print(db)
IQKeyboardManager.shared.enable = true
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.
}
}
| [
337415,
164361,
328714,
324111,
186897,
342545,
175635,
334358,
209943,
342550,
336921,
333850,
330267,
342554,
346139,
248862,
420376,
250914,
158761,
324149,
206395,
324155,
209987,
324164,
333386,
324173,
341071,
324176,
374864,
214610,
250967,
352856,
332380,
339036,
342111,
180320,
341091,
333413,
174695,
248425,
210027,
327275,
245357,
222830,
338543,
345199,
342133,
210039,
210044,
152703,
333439,
334465,
126596,
210052,
330889,
162445,
159374,
330383,
126610,
210067,
326290,
250004,
184982,
210071,
98968,
337047,
342679,
342683,
248985,
210077,
329885,
339097,
210080,
332453,
210088,
332459,
210095,
332463,
337071,
210098,
164534,
249014,
248504,
332471,
333498,
334011,
337592,
223934,
327871,
180416,
337599,
328386,
210115,
332483,
332486,
326855,
384198,
343244,
332493,
339662,
180431,
333009,
358099,
224981,
330965,
333014,
181977,
210138,
334045,
189153,
224993,
356578,
343270,
224999,
332520,
338664,
327914,
351466,
337645,
342766,
346355,
251128,
342776,
275706,
337659,
225020,
344831,
225025,
207619,
343306,
325914,
199452,
245020,
182558,
325917,
345887,
336675,
328484,
245029,
208166,
338211,
339747,
339749,
225066,
358191,
332080,
225073,
152370,
340275,
336180,
356660,
399159,
332090,
244540,
325440,
247617,
201028,
336708,
325446,
244551,
336711,
337222,
323402,
332106,
341834,
343365,
345930,
334161,
341843,
247637,
332117,
250199,
337750,
348502,
250202,
341851,
313180,
250210,
208227,
251235,
333154,
343398,
175463,
201579,
246123,
326507,
201582,
343409,
234866,
378227,
327539,
201588,
175477,
330610,
154999,
333689,
249208,
324472,
248186,
243579,
175483,
324475,
249214,
250238,
324478,
324481,
325504,
333698,
324484,
400259,
245127,
324487,
249227,
225165,
236430,
324495,
245136,
324498,
330642,
247700,
324501,
181654,
245142,
252822,
175513,
245145,
329623,
225180,
245148,
333724,
245151,
343450,
158618,
245154,
118691,
355748,
245157,
375208,
337833,
245162,
326058,
211884,
324524,
327084,
338352,
181684,
184244,
324533,
324538,
146876,
324541,
327107,
334275,
216517,
326598,
337349,
346057,
216522,
340939,
366034,
343507,
345043,
337365,
248792,
340957,
369118,
334304,
329697,
338403,
332152,
340963,
358371,
334311,
339434,
359407,
328177,
210420,
244726,
337398,
333818,
324094
] |
e3c4c0117011ce1c6e7cba63b9ae8956fa59589a | aeb5c0ed4e129e2ec8b335b4ae6bda9e7bfe4992 | /Table View/Table View/ViewController.swift | 4b831992bce30203f01745c69eac006b4e979677 | [] | no_license | pratulpatwari/swift-practice | aa775b322c8272ca14e16296a935fe69928cc9db | f0ca72ce3d0bed24f2bc6b914e955beb3c7a5c1d | refs/heads/master | 2021-05-24T11:02:36.235918 | 2020-04-06T15:03:12 | 2020-04-06T15:03:12 | 253,530,178 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,605 | swift | //
// ViewController.swift
// Table View
//
// Created by pratul patwari on 5/31/18.
// Copyright © 2018 pratul patwari. All rights reserved.
//
import UIKit
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
let cellContent = ["Jordan", "Mahesh", "Jay", "Angad"]
// public can be replaced with internal which means the scope of this method will be in this class
// this will set and return the number of rows in table view controller
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
return cellContent.count
}
// this will return the index of cell and define each cell and add content to it
internal func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell{
// this identifier is the cell which is set by us in UI
let cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: "Cell")
//cell.textLabel?.text = "Top Row" // this is setting the content of cell. This will eventually be replaced by data coming from service call
cell.textLabel?.text = cellContent[indexPath.row]
return cell
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
-1
] |
10abcbb4cc8aa09d12e88ea035ab522487de06d9 | 68dcd59cf5fe60f5ecdb8579dd6cfb5c8338eb56 | /DistilleryTestApp/CoreLayer/BaseRouter/BaseRouter.swift | 77f9c060c10696aa609f6189a35f1cac38cc4a9d | [] | no_license | Sou1reaver/DistilleryTestApp | 387614e31f2aa3c5e23f047f2cce5f231720b5c7 | c840f92d8af650ea27e2c4e80397c86c1fe87e75 | refs/heads/master | 2021-09-10T17:02:15.790425 | 2018-03-29T20:55:47 | 2018-03-29T20:55:47 | 118,224,906 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 851 | swift | //
// BaseRouter.swift
// DistilleryTestApp
//
// Created by Vladimir Gordienko on 23.01.18.
// Copyright © 2018 Vladimir Gordienko. All rights reserved.
//
import UIKit
protocol BaseRouter {
associatedtype SourceViewController
}
extension BaseRouter {
func openModule(_ module: UIViewController?,
from viewController: SourceViewController?,
transitionClosure: (_ source: SourceViewController, _ destination: UIViewController) -> Void) {
guard let `module` = module else {
print("BaseRouter Error: Assemble search venues module error")
return
}
guard let sourceVC = viewController else {
print("BaseRouter Error: source view contoller is nil")
return
}
transitionClosure(sourceVC, module)
}
}
| [
-1
] |
7f86ac235ee86e7ab62ce1a01a215ba75a20d573 | 096d3c454ac381c7d289b66dcc40840a2d5f5fb3 | /CoreData_Pracice/delete_from_coreData/practice/practiceUITests/practiceUITests.swift | 8c97c912b9916780bc549ba42788efbefb7b00c4 | [] | no_license | DanMint/IOS-apps | a0560a79841c148aacc26a23938f19e854f892e5 | 422f2968e54d65b280710e31acc2c33a125442a0 | refs/heads/main | 2023-07-18T06:07:31.843128 | 2021-09-10T22:14:45 | 2021-09-10T22:14:45 | 395,453,688 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,428 | swift | //
// practiceUITests.swift
// practiceUITests
//
// Created by Daniel mints on 9/3/21.
//
import XCTest
class practiceUITests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testLaunchPerformance() throws {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
}
}
| [
360463,
155665,
376853,
344106,
253996,
385078,
163894,
180279,
319543,
352314,
213051,
376892,
32829,
286787,
352324,
237638,
352327,
385095,
393291,
163916,
368717,
311373,
196687,
278607,
311377,
254039,
426074,
368732,
180317,
32871,
352359,
221292,
278637,
385135,
319599,
376945,
131190,
385147,
131199,
426124,
196758,
49308,
65698,
311459,
49317,
377008,
377010,
180409,
295099,
377025,
377033,
164043,
417996,
254157,
368849,
368850,
139478,
229591,
385240,
254171,
147679,
147680,
311520,
205034,
254189,
286957,
254193,
344312,
336121,
262403,
147716,
385291,
368908,
180494,
262419,
368915,
254228,
319764,
278805,
377116,
254250,
311596,
131374,
418095,
336177,
368949,
180534,
155968,
287040,
311622,
270663,
319816,
368969,
254285,
180559,
377168,
344402,
229716,
368982,
270703,
139641,
385407,
385409,
270733,
106893,
385423,
385433,
213402,
385437,
254373,
156069,
385448,
385449,
311723,
115116,
385463,
319931,
278974,
336319,
336323,
188870,
278988,
278992,
262619,
377309,
377310,
369121,
369124,
279014,
270823,
279017,
311787,
213486,
360945,
139766,
393719,
279030,
377337,
279033,
254459,
410108,
410109,
262657,
377346,
279042,
279053,
410126,
262673,
385554,
393745,
303635,
279060,
279061,
254487,
410138,
279066,
188957,
377374,
385569,
385578,
377388,
197166,
393775,
418352,
33339,
352831,
33344,
385603,
377419,
385612,
303693,
426575,
385620,
369236,
115287,
189016,
270938,
287327,
279143,
279150,
287345,
352885,
352886,
344697,
189054,
287359,
385669,
369285,
311944,
344714,
311950,
377487,
311953,
287379,
336531,
180886,
426646,
352921,
377499,
221853,
344737,
295591,
352938,
295598,
418479,
279215,
279218,
164532,
336565,
287418,
377531,
303802,
377534,
377536,
66243,
385737,
287434,
385745,
279249,
303826,
369365,
369366,
385751,
230105,
361178,
352989,
352990,
418529,
295649,
385763,
295653,
369383,
230120,
361194,
312046,
418550,
344829,
279293,
205566,
197377,
434956,
312076,
295698,
418579,
426772,
197398,
426777,
221980,
344864,
197412,
336678,
262952,
189229,
262957,
164655,
197424,
328495,
197428,
336693,
230198,
377656,
426809,
197433,
222017,
295745,
377669,
197451,
369488,
279379,
385878,
385880,
295769,
197467,
435038,
230238,
279393,
303973,
279398,
385895,
197479,
385901,
197489,
295799,
164730,
336765,
254851,
369541,
172936,
320394,
426894,
189327,
377754,
172971,
140203,
377778,
304050,
189365,
377789,
189373,
345030,
345034,
279499,
418774,
386007,
386009,
418781,
386016,
123880,
418793,
320495,
222193,
435185,
271351,
214009,
312313,
435195,
328701,
312317,
386049,
328705,
418819,
410629,
377863,
189448,
230411,
320526,
361487,
435216,
386068,
254997,
336928,
336930,
410665,
345137,
361522,
312372,
238646,
238650,
320571,
386108,
410687,
336962,
238663,
377927,
361547,
205911,
156763,
361570,
214116,
230500,
214119,
402538,
279659,
173168,
230514,
238706,
279666,
312435,
377974,
66684,
377986,
279686,
402568,
222344,
140426,
337037,
386191,
410772,
222364,
418975,
124073,
402618,
148674,
402632,
148687,
402641,
189651,
419028,
279766,
189656,
304353,
279780,
222441,
279789,
386288,
66802,
271607,
369912,
386296,
369913,
419066,
386300,
279803,
386304,
320769,
369929,
419097,
320795,
115997,
222496,
320802,
304422,
369964,
353581,
116014,
66863,
312628,
345397,
345398,
386363,
222523,
345418,
353611,
337228,
337226,
353612,
230730,
296269,
353617,
222542,
238928,
296274,
378201,
230757,
296304,
312688,
337280,
353672,
263561,
296328,
296330,
304523,
370066,
9618,
411028,
279955,
370072,
148899,
148900,
361928,
337359,
329168,
312785,
329170,
222674,
353751,
280025,
239069,
329181,
320997,
361958,
271850,
280042,
280043,
271853,
329198,
411119,
337391,
116209,
296434,
386551,
288252,
312830,
271880,
198155,
329231,
304655,
370200,
222754,
157219,
157220,
394793,
312879,
288305,
288319,
288322,
280131,
288328,
353875,
99937,
345697,
312937,
271980,
206447,
403057,
42616,
337533,
280193,
370307,
419462,
149127,
149128,
419464,
288391,
411275,
214667,
239251,
345753,
198304,
255651,
337590,
370359,
280252,
280253,
321217,
239305,
296649,
403149,
313042,
345813,
370390,
272087,
345817,
337638,
181992,
345832,
345835,
288492,
141037,
313082,
288508,
288515,
173828,
395018,
395019,
116491,
395026,
124691,
116502,
435993,
345882,
411417,
321308,
255781,
362281,
378666,
403248,
378673,
345910,
182070,
182071,
436029,
345918,
337734,
280396,
272207,
272208,
337746,
395092,
362326,
345942,
370526,
345950,
362336,
255844,
296807,
214894,
362351,
214896,
313200,
313204,
124795,
182145,
280451,
67464,
305032,
337816,
124826,
329627,
239515,
436130,
354210,
436135,
10153,
313257,
362411,
370604,
362418,
411587,
280517,
362442,
346066,
231382,
354268,
436189,
403421,
329696,
354273,
403425,
190437,
354279,
436199,
174058,
337899,
354283,
247787,
329707,
296942,
247786,
436209,
313322,
124912,
239610,
182277,
346117,
403463,
43016,
354312,
354311,
354310,
313356,
436235,
419857,
305173,
436248,
223269,
346153,
354346,
313388,
124974,
272432,
403507,
378933,
378934,
436283,
288835,
403524,
436293,
313415,
239689,
436304,
329812,
223317,
411738,
272477,
280676,
313446,
395373,
288878,
346237,
215165,
436372,
329884,
378186,
362658,
436388,
215204,
125108,
133313,
395458,
338118,
436429,
346319,
321744,
379102,
387299,
18661,
379110,
338151,
125166,
149743,
379120,
436466,
125170,
411892,
436471,
395511,
313595,
436480,
125184,
272644,
125192,
338187,
338188,
125197,
395536,
125200,
338196,
272661,
379157,
125204,
125215,
125216,
338217,
125225,
321839,
125236,
362809,
379193,
395591,
289109,
272730,
436570,
215395,
239973,
280938,
321901,
354671,
362864,
354672,
272755,
354678,
199030,
223611,
248188,
313726,
436609,
240003,
436613,
395653,
395660,
264591,
272784,
420241,
240020,
190870,
43416,
190872,
289185,
436644,
289195,
272815,
436659,
338359,
436677,
289229,
281038,
281039,
256476,
420326,
166403,
322057,
420374,
322077,
289328,
330291,
322119,
191065,
436831,
117350,
420461,
313970,
346739,
346741,
420473,
297600,
166533,
363155,
346771,
264855,
363161,
289435,
436897,
248494,
166581,
355006,
363212,
363228,
436957,
322269,
436960,
264929,
338658,
289511,
330473,
346859,
330476,
289517,
215790,
199415,
289534,
322302,
35584,
133889,
322312,
346889,
264971,
322320,
166677,
207639,
363295,
355117,
191285,
273209,
355129,
273211,
355136,
355138,
420680,
355147,
355148,
355153,
281426,
387927,
363353,
363354,
281434,
322396,
420702,
363361,
363362,
412516,
355173,
355174,
281444,
207724,
355182,
207728,
420722,
314240,
158594,
330627,
240517,
265094,
387977,
396171,
355216,
224146,
224149,
256918,
256919,
256920,
240543,
256934,
273336,
289720,
289723,
273341,
330688,
379845,
363462,
19398,
273353,
191445,
207839,
347104,
314343,
134124,
412653,
248815,
257007,
347122,
437245,
257023,
125953,
396292,
330759,
347150,
330766,
412692,
330789,
248871,
281647,
412725,
257093,
404550,
314437,
207954,
339031,
404582,
257126,
265318,
322664,
265323,
396395,
404589,
273523,
363643,
248960,
150656,
363658,
404622,
224400,
265366,
347286,
429209,
339101,
429216,
339106,
380069,
265381,
3243,
208044,
322733,
421050,
339131,
265410,
183492,
273616,
421081,
339167,
298209,
421102,
363769,
52473,
208123,
52476,
412926,
437504,
322826,
388369,
380178,
429332,
126229,
412963,
257323,
437550,
273713,
298290,
208179,
159033,
347451,
216387,
372039,
257353,
257354,
109899,
437585,
331091,
150868,
314708,
372064,
429410,
437602,
281958,
388458,
265579,
306541,
314734,
314740,
314742,
421240,
314745,
224637,
388488,
298378,
306580,
282008,
396697,
314776,
282013,
290206,
396709,
298406,
241067,
314797,
380335,
355761,
421302,
134586,
380348,
216510,
380350,
216511,
306630,
200136,
273865,
306634,
339403,
372172,
413138,
421338,
437726,
429540,
3557,
3559,
191980,
282097,
191991,
265720,
216575,
290304,
372226,
437766,
323083,
208397,
323088,
413202,
413206,
388630,
175640,
216610,
372261,
347693,
323120,
396850,
200245,
323126,
290359,
134715,
323132,
421437,
396865,
282182,
413255,
273992,
265800,
421452,
265809,
396885,
290391,
265816,
396889,
306777,
388699,
396896,
323171,
388712,
388713,
314997,
290425,
339579,
396927,
282248,
224907,
396942,
405140,
274071,
323226,
208547,
208548,
405157,
388775,
282279,
364202,
421556,
224951,
224952,
306875,
282302,
323262,
323265,
241360,
241366,
224985,
282330,
159462,
372458,
397040,
12017,
323315,
274170,
200444,
175874,
249606,
323335,
282379,
216844,
372497,
397076,
421657,
339746,
216868,
257831,
167720,
241447,
421680,
282418,
274234,
241471,
339782,
315209,
159563,
241494,
339799,
307038,
274276,
282471,
274288,
372592,
274296,
339840,
315265,
372625,
282517,
298912,
118693,
438186,
126896,
151492,
380874,
372699,
323554,
380910,
380922,
380923,
274432,
372736,
241695,
315431,
430120,
102441,
315433,
430127,
405552,
282671,
241717,
249912,
225347,
307269,
421958,
233548,
176209,
381013,
53334,
315477,
200795,
356446,
323678,
438374,
176231,
438378,
233578,
217194,
422000,
249976,
266361,
422020,
168069,
381061,
168070,
381071,
241809,
323730,
430231,
200856,
422044,
192670,
192671,
299166,
258213,
299176,
323761,
184498,
266427,
356550,
299208,
372943,
266447,
258263,
356575,
307431,
438512,
372979,
389364,
381173,
135416,
356603,
184574,
266504,
217352,
61720,
381210,
315674,
282908,
389406,
282912,
233761,
438575,
315698,
266547,
397620,
332084,
438583,
127292,
438592,
332100,
323914,
201037,
397650,
348499,
250196,
348501,
389465,
332128,
110955,
242027,
242028,
160111,
250227,
315768,
291193,
438653,
291200,
266628,
340356,
242059,
225684,
373141,
373144,
291225,
389534,
397732,
373196,
176602,
242138,
184799,
291297,
201195,
324098,
233987,
340489,
397841,
283154,
258584,
397855,
291359,
348709,
348710,
397872,
283185,
234037,
340539,
266812,
438850,
348741,
381515,
348748,
430681,
332379,
242274,
184938,
373357,
184942,
176751,
389744,
356983,
356984,
209529,
356990,
291455,
373377,
422529,
201348,
152196,
356998,
348807,
356999,
316044,
316050,
275102,
176805,
340645,
422567,
176810,
160441,
422591,
291529,
225996,
135888,
242385,
234216,
373485,
373486,
21239,
275193,
348921,
234233,
242428,
299777,
430853,
430860,
62222,
430880,
234276,
234290,
152372,
160569,
430909,
160576,
348999,
283466,
234330,
275294,
381791,
127840,
357219,
439145,
177002,
308075,
242540,
242542,
381811,
201590,
177018,
398205,
340865,
291713,
349066,
316299,
349068,
234382,
308111,
381840,
308113,
390034,
373653,
430999,
209820,
381856,
398244,
185252,
422825,
381872,
177074,
398268,
349122,
398275,
373705,
127945,
340960,
398305,
340967,
398313,
234476,
127990,
349176,
201721,
349179,
234499,
357380,
398370,
357413,
357420,
300087,
21567,
308288,
398405,
349254,
218187,
250955,
300109,
234578,
250965,
439391,
250982,
398444,
62574,
357487,
300147,
119925,
349304,
234626,
349315,
349317,
234635,
373902,
177297,
324761,
234655,
234662,
373937,
373939,
324790,
300215,
218301,
283841,
283846,
259275,
316628,
259285,
357594,
414956,
251124,
316661,
292092,
439550,
439563,
242955,
414989,
259346,
349458,
259347,
382243,
382246,
382257,
292145,
382264,
333115,
193853,
193858,
251212,
406862,
234830,
259408,
283990,
357720,
300378,
300379,
316764,
374110,
234864,
259449,
382329,
357758,
243073,
357763,
112019,
398740,
234902,
374189,
251314,
284086,
259513,
54719,
292291,
300490,
300526,
259569,
251379,
300539,
398844,
210429,
366081,
316951,
374297,
153115,
431646,
349727,
431662,
374327,
210489,
235069,
349764,
292424,
292426,
128589,
333389,
333394,
349780,
128600,
235096,
300643,
300645,
415334,
54895,
366198,
210558,
210559,
415360,
325246,
333438,
415369,
431754,
210569,
267916,
415376,
259741,
153252,
399014,
210601,
202413,
317102,
415419,
259780,
333508,
267978,
333522,
325345,
333543,
431861,
284410,
161539,
284425,
300812,
284430,
366358,
169751,
431901,
341791,
325411,
186148,
186149,
333609,
399148,
202541,
431918,
284460,
153392,
431935,
415555,
325444,
153416,
325449,
341837,
415566,
431955,
325460,
317268,
341846,
300893,
259937,
382820,
276326,
415592,
292713,
292719,
325491,
341878,
276343,
350072,
333687,
317305,
112510,
325508,
333700,
243590,
325514,
350091,
350092,
350102,
350108,
333727,
219046,
284584,
292783,
300983,
128955,
219102,
292835,
6116,
317416,
432114,
325620,
415740,
268286,
415744,
333827,
243720,
399372,
153618,
358418,
178215,
325675,
243763,
358455,
325695,
399433,
333902,
104534,
194667,
260206,
432241,
284789,
374913,
374914,
415883,
333968,
153752,
333990,
104633,
260285,
227517,
268479,
374984,
301270,
301271,
334049,
325857,
268515,
383208,
317676,
260337,
260338,
432373,
375040,
309504,
260355,
432387,
375052,
194832,
325904,
391448,
334104,
268570,
178459,
186660,
268581,
334121,
358698,
317738,
260396,
325930,
432435,
358707,
178485,
358710,
14654,
268609,
227655,
383309,
383327,
391521,
366948,
416101,
416103,
383338,
432503,
432511,
211327,
227721,
285074,
252309,
39323,
285083,
317851,
285089,
375211,
334259,
129461,
342454,
358844,
293309,
317889,
326083,
416201,
129484,
154061,
416206,
326093,
432608,
285152,
195044,
391654,
432616,
334315,
375281,
293368,
317949,
334345,
432650,
309770,
342537,
342549,
342560,
416288,
350758,
350759,
358951,
358952,
293420,
219694,
219695,
375345,
432694,
244279,
309831,
375369,
375373,
416334,
301647,
416340,
244311,
416353,
260705,
375396,
268901,
244326,
244345,
334473,
375438,
326288,
285348,
293552,
342705,
285362,
383668,
342714,
39616,
383708,
342757,
269036,
432883,
203511,
342775,
383740,
416509,
359166,
162559,
375552,
432894,
228099,
285443,
285450,
383755,
326413,
285467,
326428,
318247,
342827,
391980,
318251,
375610,
301883,
342846,
416577,
416591,
244569,
375644,
252766,
293729,
351078,
342888,
392057,
211835,
269179,
392065,
260995,
400262,
392071,
424842,
236427,
252812,
400271,
392080,
400282,
7070,
211871,
359332,
359333,
293801,
326571,
252848,
326580,
261045,
261046,
326586,
359365,
211913,
326602,
342990,
252878,
433104,
56270,
359380,
433112,
433116,
359391,
187372,
343020,
383980,
203758,
383994,
171009,
384004,
433166,
384015,
433173,
293911,
326684,
252959,
384031,
375848,
318515,
203829,
261191,
375902,
375903,
392288,
253028,
351343,
187505,
138354,
187508,
384120,
302202,
285819,
392317,
343166,
384127,
392320,
285823,
285833,
285834,
318602,
228492,
253074,
326803,
187539,
359574,
285850,
351389,
302239,
253098,
302251,
367791,
367792,
367798,
64699,
294075,
228541,
343230,
367809,
253124,
113863,
351445,
310496,
195809,
253168,
351475,
351489,
367897,
367898,
245018,
130342,
130344,
130347,
261426,
212282,
294210,
359747,
359748,
146760,
146763,
114022,
253288,
425327,
425331,
163190,
327030,
384379,
253316,
294278,
384391,
318860,
253339,
253340,
318876,
343457,
245160,
359860,
359861,
343480,
310714,
228796,
228804,
425417,
310731,
327122,
425434,
310747,
310758,
253431,
359931,
187900,
343552,
245249,
228868,
409095,
359949,
294413,
253456,
302613,
253462,
146976,
245290,
245291,
343606,
163385,
425534,
138817,
147011,
147020,
179800,
196184,
343646,
212574,
204386,
155238,
204394,
138862,
310896,
188021,
294517,
286351,
188049,
425624,
229021,
245413,
286387,
384693,
376502,
286392,
302778,
409277,
286400,
319176,
409289,
425682,
286419,
294621,
245471,
155360,
294629,
212721,
163575,
286457,
286463,
319232,
360194,
409355,
155408,
417556,
294699,
319289,
384826,
409404,
409416,
376661,
237397,
368471,
425820,
368486,
384871,
425832,
368489,
40809,
409446,
417648,
417658,
360315,
253828,
327556,
311183,
425875,
294806,
294808,
253851,
376733,
204702,
319393,
294820,
253868,
204722,
188349,
98240,
212947,
212953,
360416,
294887,
253930,
327666,
385011
] |
6359058c74db23a40cfe8892073e10903b72cc87 | a9aa4aef5205bd6ebcab357532add7a1b2a0837e | /iTunesClient/View Models/AlbumDetailViewModel.swift | c5cdbd92f38f42d9971fbab0f092130ea6a19e65 | [
"MIT"
] | permissive | samyanez94/iTunes-Search-App | 3296aa26dd38abd49aa92ac2419070c9279310bd | 54bdac68e9b11d348247c0653f87295d24c80d8c | refs/heads/master | 2021-07-20T03:21:41.453814 | 2020-04-28T00:44:59 | 2020-04-28T03:29:15 | 137,091,100 | 0 | 0 | null | 2018-06-22T17:32:01 | 2018-06-12T15:22:36 | Swift | UTF-8 | Swift | false | false | 812 | swift | //
// AlbumDetailViewModel.swift
// iTunesClient
//
// Created by Samuel Yanez on 6/16/18.
// Copyright © 2018 Samuel Yanez. All rights reserved.
//
import Foundation
import UIKit
struct AlbumDetailViewModel {
/// Title
let title: String
/// Release date
let releaseDate: String
/// Genre
let genre: String
/// Artwork URL
let artworkURL: URL?
/// Explicitness
let isExplict: Bool
}
extension AlbumDetailViewModel {
init(album: Album) {
self.title = album.censoredName
self.genre = album.genre.rawValue
self.releaseDate = DateFormatter(format: "MMM dd, yyyy").string(from: album.releaseDate)
self.artworkURL = album.artworkURL(size: 400)
self.isExplict = album.explicitness == .explicit
}
}
| [
-1
] |
124605c13f54616c807b478bcc978f5266688044 | 674a89d554dd8ec5138728b03c57baf968daa4b4 | /MobDevLab1/Controllers/PhotoCollection/MyCollectionViewLayout.swift | 1420e4e91de654eafd517746322b571dbcbd74a8 | [] | no_license | dimakryshtal/MobDevLab7 | 30479907a86e2251bbcf9388de80bd2da466fc5e | 469232fc55c983d0dd6d263b8ae53fea7df253b3 | refs/heads/main | 2023-05-03T04:00:09.801103 | 2021-05-21T18:56:23 | 2021-05-21T18:56:23 | 367,608,448 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,196 | swift | //
// MyCollectionViewLayout.swift
// MobDevLab1
//
// Created by Dima on 15.03.2021.
//
import UIKit
protocol MyCollectionViewLayoutDelegate: AnyObject {
func collectionView(_ collectionView: UICollectionView, heightForPhotoAtIndexPath indexPath: IndexPath) -> CGFloat
}
class MyCollectionViewLayout: UICollectionViewLayout {
weak var delegate: MyCollectionViewLayoutDelegate?
private let cellPadding: CGFloat = 1
private var cache: [UICollectionViewLayoutAttributes] = []
private var contentHeight: CGFloat = 0
private var contentWidth: CGFloat {
guard let collectionView = collectionView else {
return 0
}
let insets = collectionView.contentInset
return collectionView.bounds.width - (insets.left + insets.right)
}
override func invalidateLayout() {
super.invalidateLayout()
contentHeight = 0
cache = []
}
override var collectionViewContentSize: CGSize {
return CGSize(width: contentWidth, height: contentHeight)
}
override func prepare() {
guard cache.isEmpty, let collectionView = collectionView else {
return
}
let xOffset: [CGFloat] = [0, contentWidth/5*3, 0, contentWidth/5,contentWidth/5*2]
var yOffset:CGFloat = 0
for item in 0..<collectionView.numberOfItems(inSection: 0) {
let indexPath = IndexPath(item: item, section: 0)
var frame:CGRect?
let photoHeight = delegate?.collectionView(collectionView,heightForPhotoAtIndexPath: indexPath) ?? 180
let height = cellPadding * 2 + photoHeight - 2
if ((indexPath[1] + 1) % 6 == 1) {
frame = CGRect(x: xOffset[0], y: yOffset, width: height, height: height)
} else if((indexPath[1] + 1) % 6 == 2 || (indexPath[1] + 1) % 6 == 3) {
frame = CGRect(x: xOffset[1], y: yOffset, width: height, height: height)
yOffset += (indexPath[1] + 1) % 6 == 2 ? height : height/2
} else {
frame = CGRect(x: xOffset[indexPath[1] % 6 - 1], y: yOffset, width: height, height: height)
yOffset += (indexPath[1] + 1) % 6 == 0 ? height : 0
}
let insetFrame = frame!.insetBy(dx: cellPadding, dy: cellPadding)
let attributes = UICollectionViewLayoutAttributes(forCellWith: indexPath)
attributes.frame = insetFrame
cache.append(attributes)
contentHeight = max(contentHeight, frame!.maxY)
}
}
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
var visibleLayoutAttributes: [UICollectionViewLayoutAttributes] = []
for attributes in cache {
if attributes.frame.intersects(rect) {
visibleLayoutAttributes.append(attributes)
}
}
return visibleLayoutAttributes
}
override func layoutAttributesForItem(at indexPath: IndexPath) -> UICollectionViewLayoutAttributes? {
return cache[indexPath.item]
}
}
| [
-1
] |
1608f9af3531adc6776647b4f3da6b12d4ad2371 | 813d7f3dcbe369e1e28b7d591faed80a3b2fd2e3 | /Hey Coacher/hey-coacher/Globals.swift | 5da823a4512171e10371f6efae06adb36cd3aefd | [] | no_license | al2114/hey-coacher | 3ce8a6a5dfe8c557bb1112647ad4636de9854847 | 377b3599831a9c2256f599ecbdf019c938425816 | refs/heads/master | 2021-03-27T10:29:56.573926 | 2017-06-29T18:36:45 | 2017-06-29T18:36:45 | 91,473,391 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,678 | swift | //
// RemoteEngine.swift
// hey-coacher
//
// Created by Andrew Li on 30/05/2017.
// Copyright © 2017 imperial-smartbike. All rights reserved.
//
import Foundation
var heartrate: Int = 93
var cadence: Float = 23.4
var pace: TimeInterval = TimeInterval(438)
var distance: Float = 0.7
var interval: TimeInterval = TimeInterval(140)
var userID: Int = 34
var sessionID: Int = 70
var speechEnabled: Bool = true
import UIKit
// Parity based on operand mod
func mod(_ a: Int, _ n: Int) -> Int {
precondition(n > 0, "modulus must be positive")
let r = a % n
return r >= 0 ? r : r + n
}
func timeToString(_ time:TimeInterval) -> String {
var timeString = ""
let minutes = Int(time) / 60
let seconds = Int(time) % 60
if minutes != 0 {
timeString += "\(String(minutes)) minutes"
if seconds != 0 {
timeString += " and \(String(seconds)) seconds"
}
}
else {
timeString += "\(String(seconds)) seconds"
}
return timeString
}
func paceToString(_ pace:Double) -> String {
if !pace.isFinite{
return "n/a"
}
else {
var paceString = ""
let minutes = Int(pace) / 60
let seconds = Int(pace) % 60
paceString += "\(minutes) minutes"
if seconds != 0 {
paceString += " and \(seconds) seconds"
}
return "\(paceString) per kilometer"
}
}
func distanceToString(_ distance:Double) -> String {
let hundreds = Int(distance/100)%10
let km = Int(distance/100)/10
var distanceString = "\(km)"
if hundreds != 0 {
distanceString += ".\(hundreds)"
}
return "\(distanceString) km"
}
extension String {
func deleteSpaces() -> String {
return components(separatedBy: .whitespaces).joined()
}
func deleteHTMLTag() -> String {
return self.replacingOccurrences(of:"<[^>]+>", with: "", options: String.CompareOptions.regularExpression, range: nil)
}
func deleteLines() -> String {
return components(separatedBy: CharacterSet.newlines).joined()
}
mutating func formatting() -> String{
self = self.deleteLines()
self = self.deleteSpaces()
self = self.deleteHTMLTag()
return self
}
mutating func format() -> String{
self = self.deleteLines()
self = self.deleteHTMLTag()
let idx = self.index(self.startIndex, offsetBy: 4)
self = self.substring(from: idx)
return self
}
}
func jsonToDictionary(text: String) -> [String: Any]? {
if let data = text.data(using: .utf8) {
do {
return try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any]
} catch {
print(error.localizedDescription)
}
}
return nil
}
| [
-1
] |
be6329da6b8f4acb11ca6d39f8c34f4b6e16c180 | 57ba89ac06e1a743ef0a413b1a24c6a1eb9cb2ec | /VIPERUsersApp/Viper/Router.swift | cb73c31e966a3d601c38c2ee9bff73c756a5ea3f | [] | no_license | DavidAML3/VIPERUsersApp | 088a1af1267f45c16719d8b12b739b7327bb79f7 | 4530095690476b32d20103c029731738f74de82d | refs/heads/master | 2023-07-30T17:13:10.835759 | 2021-09-10T04:49:26 | 2021-09-10T04:49:26 | 404,935,074 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 933 | swift | //
// Router.swift
// VIPERUsersApp
//
// Created by David Andres Mejia Lopez on 9/09/21.
//
import Foundation
import UIKit
// object
// entry point
typealias EntryPoint = AnyView & UIViewController
protocol AnyRouter {
var entry: EntryPoint? { get }
static func start() -> AnyRouter
}
class UserRouter: AnyRouter {
var entry: EntryPoint?
static func start() -> AnyRouter {
let router = UserRouter()
// Assign VIP
var view: AnyView = UserViewController()
var presenter: AnyPresenter = UserPresenter()
var interactor: AnyInteractor = UserInteractor()
view.presenter = presenter
interactor.presenter = presenter
presenter.router = router
presenter.view = view
presenter.interactor = interactor
router.entry = view as? EntryPoint
return router
}
}
| [
-1
] |
cb27f49662f20824f4aa9da984b9b625a0b89c21 | 47932e041979216a135488bc69cca3f7e10c2c28 | /AthenaHacks/Views/CharityCategoryCell.swift | 00c9e580e8fd56f3480b1fe923a080fd6ae522b7 | [] | no_license | allisonreiss/BeneFIT | 3f4836e782507d61ea5173699a37a5abfe96ee7a | d004d1f70366949046d5b5cb8f1cd8e8ad0881ba | refs/heads/master | 2021-09-07T17:24:28.845438 | 2018-02-26T20:15:03 | 2018-02-26T20:15:03 | 122,787,828 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 529 | swift | //
// CharityCategoryCell.swift
// AthenaHacks
//
// Created by Sarah Gemperle on 2/25/18.
// Copyright © 2018 Allison Reiss. All rights reserved.
//
import UIKit
class CharityCategoryCell: UITableViewCell {
@IBOutlet weak var charityCategoryLab: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
| [
320001,
337412,
227845,
333831,
227849,
227852,
333837,
372750,
372753,
196114,
372754,
327190,
328214,
287258,
370207,
243746,
287266,
281636,
327224,
327225,
307277,
327248,
235604,
235611,
213095,
213097,
310894,
213109,
148600,
403068,
410751,
300672,
373913,
148637,
148638,
276639,
148648,
300206,
361651,
327360,
223437,
291544,
306907,
337627,
176358,
271087,
325874,
338682,
276746,
276756,
203542,
261406,
349470,
396065,
111912,
369458,
369461,
282934,
342850,
342851,
151881,
430412,
283471,
283472,
270679,
287067,
350050,
270691,
257898,
330602,
179568,
317296,
317302,
244600,
179578,
179580,
211843,
213891,
36743,
209803,
211370,
288690,
281014,
430546,
430547,
180695,
180696,
284131,
344039,
196076,
310778,
305661
] |
201bbc9336ae9e0798dbb0cb384e5d1b17c61123 | 6344cdb7ba0b325ae2775342b59a7deeb75e1f7f | /peekabooTests/ContentViewTests.swift | 62a85b9b2aa84d1c97ac25f119adc54fc473720c | [] | no_license | MrSmart00/peekaboo | c62bdd7b3a4225db5ce00f51e5f7b87ece1c7cd6 | 0c9403a0d51fdaa7f619cdb88d2068a2706aab1f | refs/heads/main | 2023-05-08T23:58:44.388203 | 2021-06-06T11:10:18 | 2021-06-06T11:10:18 | 373,875,114 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,079 | swift | //
// ContentViewTests.swift
// peekabooTests
//
// Created by 日野森寛也 on 2021/06/06.
//
import XCTest
import SwiftUI
@testable import peekaboo
import SnapshotTesting
class ContentViewTests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func test_スナップショットテスト() throws {
let view = ContentView()
SnapshotConfig.DeviceName.allCases.forEach { deviceName in
assertSnapshot(
matching: view,
as: .image(
precision: SnapshotConfig.precision,
layout: .device(config: deviceName.viewImageConfig),
traits: .init(userInterfaceStyle: .light)
),
named: deviceName.rawValue
)
}
}
}
| [
-1
] |
d703c010641f2f4d95867705fc71d9b453e59014 | 11e1afad8c3c769117c8a0ae45c26fbb22221583 | /Sources/Protos/storage/clouddms/logging/v1/clouddms_stackdriver_logs.pb.BC.swift | 0a18a97daa5efdecc0629bc14292074d14558d7f | [] | no_license | gregfajen/swift-control-plane | 381d382d3b5c12e609ab28dca19a7b352f5707df | 33eb8d98d23acb32b5063548616fb1a3829f7c2c | refs/heads/master | 2022-07-28T21:18:29.060106 | 2020-11-11T04:31:52 | 2020-11-11T04:31:52 | 268,634,907 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 65,182 | swift | // DO NOT EDIT.
// swift-format-ignore-file
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: storage/clouddms/logging/v1/clouddms_stackdriver_logs.proto
//
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import Foundation
import SwiftProtobuf
// If the compiler emits an error on this type, it is because this file
// was generated by a version of the `protoc` Swift plug-in that is
// incompatible with the version of SwiftProtobuf to which you are linking.
// Please ensure that you are building against the same version of the API
// that was used to generate this file.
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
typealias Version = _2
}
/// The database engines.
public enum Storage_Clouddms_Logging_V1_DatabaseEngine: SwiftProtobuf.Enum {
public typealias RawValue = Int
/// The source database engine of the migration job is unknown.
case unspecified // = 0
/// The source engine is MySQL.
case mysql // = 1
/// The source engine is PostgreSQL.
case postgresql // = 2
case UNRECOGNIZED(Int)
public init() {
self = .unspecified
}
public init?(rawValue: Int) {
switch rawValue {
case 0: self = .unspecified
case 1: self = .mysql
case 2: self = .postgresql
default: self = .UNRECOGNIZED(rawValue)
}
}
public var rawValue: Int {
switch self {
case .unspecified: return 0
case .mysql: return 1
case .postgresql: return 2
case .UNRECOGNIZED(let i): return i
}
}
}
#if swift(>=4.2)
extension Storage_Clouddms_Logging_V1_DatabaseEngine: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Storage_Clouddms_Logging_V1_DatabaseEngine] = [
.unspecified,
.mysql,
.postgresql,
]
}
#endif // swift(>=4.2)
/// The database providers.
public enum Storage_Clouddms_Logging_V1_DatabaseProvider: SwiftProtobuf.Enum {
public typealias RawValue = Int
/// The database provider is unknown.
case unspecified // = 0
/// CloudSQL runs the database.
case cloudsql // = 1
/// RDS runs the database.
case rds // = 2
case UNRECOGNIZED(Int)
public init() {
self = .unspecified
}
public init?(rawValue: Int) {
switch rawValue {
case 0: self = .unspecified
case 1: self = .cloudsql
case 2: self = .rds
default: self = .UNRECOGNIZED(rawValue)
}
}
public var rawValue: Int {
switch self {
case .unspecified: return 0
case .cloudsql: return 1
case .rds: return 2
case .UNRECOGNIZED(let i): return i
}
}
}
#if swift(>=4.2)
extension Storage_Clouddms_Logging_V1_DatabaseProvider: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Storage_Clouddms_Logging_V1_DatabaseProvider] = [
.unspecified,
.cloudsql,
.rds,
]
}
#endif // swift(>=4.2)
/// A message defining the database engine and provider.
public struct Storage_Clouddms_Logging_V1_DatabaseType {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
/// The database provider.
public var provider: Storage_Clouddms_Logging_V1_DatabaseProvider = .unspecified
/// The database engine.
public var engine: Storage_Clouddms_Logging_V1_DatabaseEngine = .unspecified
public var unknownFields = SwiftProtobuf.UnknownStorage()
public init() {}
}
/// Migration job as stored in Stackdriver logs.
/// NEXT_TAG = 36.
public struct Storage_Clouddms_Logging_V1_LoggedMigrationJob {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
/// The unique identifier for a migration job.
public var name: String {
get {return _storage._name}
set {_uniqueStorage()._name = newValue}
}
/// Labels.
public var labels: Dictionary<String,String> {
get {return _storage._labels}
set {_uniqueStorage()._labels = newValue}
}
/// The display name.
public var displayName: String {
get {return _storage._displayName}
set {_uniqueStorage()._displayName = newValue}
}
/// The current migration job state.
public var state: Storage_Clouddms_Logging_V1_LoggedMigrationJob.State {
get {return _storage._state}
set {_uniqueStorage()._state = newValue}
}
/// The current migration job phase.
public var phase: Storage_Clouddms_Logging_V1_LoggedMigrationJob.Phase {
get {return _storage._phase}
set {_uniqueStorage()._phase = newValue}
}
/// The migration job type.
public var type: Storage_Clouddms_Logging_V1_LoggedMigrationJob.TypeEnum {
get {return _storage._type}
set {_uniqueStorage()._type = newValue}
}
/// An optional dump path (gs://[BUCKET_NAME]/[OBJECT_NAME]).
public var dumpPath: String {
get {return _storage._dumpPath}
set {_uniqueStorage()._dumpPath = newValue}
}
/// The migration job source connection profile name.
public var source: String {
get {return _storage._source}
set {_uniqueStorage()._source = newValue}
}
/// The migration job destination connection profile name.
public var destination: String {
get {return _storage._destination}
set {_uniqueStorage()._destination = newValue}
}
/// the migration job duration in seconds.
public var duration: SwiftProtobuf.Google_Protobuf_Duration {
get {return _storage._duration ?? SwiftProtobuf.Google_Protobuf_Duration()}
set {_uniqueStorage()._duration = newValue}
}
/// Returns true if `duration` has been explicitly set.
public var hasDuration: Bool {return _storage._duration != nil}
/// Clears the value of `duration`. Subsequent reads from it will return its default value.
public mutating func clearDuration() {_uniqueStorage()._duration = nil}
/// Type of connectivity to source database.
public var connectivityType: Storage_Clouddms_Logging_V1_LoggedMigrationJob.ConnectivityType {
get {return _storage._connectivityType}
set {_uniqueStorage()._connectivityType = newValue}
}
/// The error details in case of state FAILED.
public var error: Google_Rpc_Status {
get {return _storage._error ?? Google_Rpc_Status()}
set {_uniqueStorage()._error = newValue}
}
/// Returns true if `error` has been explicitly set.
public var hasError: Bool {return _storage._error != nil}
/// Clears the value of `error`. Subsequent reads from it will return its default value.
public mutating func clearError() {_uniqueStorage()._error = nil}
/// The time when this migration job was completed. Should only be set when the
/// phase of the migration job is COMPLETED.
public var endTime: SwiftProtobuf.Google_Protobuf_Timestamp {
get {return _storage._endTime ?? SwiftProtobuf.Google_Protobuf_Timestamp()}
set {_uniqueStorage()._endTime = newValue}
}
/// Returns true if `endTime` has been explicitly set.
public var hasEndTime: Bool {return _storage._endTime != nil}
/// Clears the value of `endTime`. Subsequent reads from it will return its default value.
public mutating func clearEndTime() {_uniqueStorage()._endTime = nil}
/// The indicative source database.
public var sourceDatabase: Storage_Clouddms_Logging_V1_DatabaseType {
get {return _storage._sourceDatabase ?? Storage_Clouddms_Logging_V1_DatabaseType()}
set {_uniqueStorage()._sourceDatabase = newValue}
}
/// Returns true if `sourceDatabase` has been explicitly set.
public var hasSourceDatabase: Bool {return _storage._sourceDatabase != nil}
/// Clears the value of `sourceDatabase`. Subsequent reads from it will return its default value.
public mutating func clearSourceDatabase() {_uniqueStorage()._sourceDatabase = nil}
/// The indicative destination database.
public var destinationDatabase: Storage_Clouddms_Logging_V1_DatabaseType {
get {return _storage._destinationDatabase ?? Storage_Clouddms_Logging_V1_DatabaseType()}
set {_uniqueStorage()._destinationDatabase = newValue}
}
/// Returns true if `destinationDatabase` has been explicitly set.
public var hasDestinationDatabase: Bool {return _storage._destinationDatabase != nil}
/// Clears the value of `destinationDatabase`. Subsequent reads from it will return its default value.
public mutating func clearDestinationDatabase() {_uniqueStorage()._destinationDatabase = nil}
public var unknownFields = SwiftProtobuf.UnknownStorage()
/// The migration job states enum.
public enum State: SwiftProtobuf.Enum {
public typealias RawValue = Int
/// The state of the migration job is unknown.
case unspecified // = 0
/// The migration job is down for maintenance.
case maintenance // = 1
/// The migration job is in draft mode and fully editable.
case draft // = 2
/// The migration job is being created.
case creating // = 3
/// The migration job is created, not started and is fully editable.
case notStarted // = 4
/// The migration job is running
case running // = 5
/// The migration job failed.
case failed // = 6
/// The migration job has been completed.
case completed // = 7
/// The migration job is being deleted.
case deleting // = 8
/// The migration job is being stopped.
case stopping // = 9
/// The migration job is currently stopped.
case stopped // = 10
/// The migration job has been deleted.
case deleted // = 11
/// The migration job is being updated.
case updating // = 12
/// The migration job is starting.
case starting // = 13
/// The migration job is restarting.
case restarting // = 14
/// The migration job is resuming.
case resuming // = 15
case UNRECOGNIZED(Int)
public init() {
self = .unspecified
}
public init?(rawValue: Int) {
switch rawValue {
case 0: self = .unspecified
case 1: self = .maintenance
case 2: self = .draft
case 3: self = .creating
case 4: self = .notStarted
case 5: self = .running
case 6: self = .failed
case 7: self = .completed
case 8: self = .deleting
case 9: self = .stopping
case 10: self = .stopped
case 11: self = .deleted
case 12: self = .updating
case 13: self = .starting
case 14: self = .restarting
case 15: self = .resuming
default: self = .UNRECOGNIZED(rawValue)
}
}
public var rawValue: Int {
switch self {
case .unspecified: return 0
case .maintenance: return 1
case .draft: return 2
case .creating: return 3
case .notStarted: return 4
case .running: return 5
case .failed: return 6
case .completed: return 7
case .deleting: return 8
case .stopping: return 9
case .stopped: return 10
case .deleted: return 11
case .updating: return 12
case .starting: return 13
case .restarting: return 14
case .resuming: return 15
case .UNRECOGNIZED(let i): return i
}
}
}
/// The migration job phases enum.
public enum Phase: SwiftProtobuf.Enum {
public typealias RawValue = Int
/// The phase of the migration job is unknown.
case unspecified // = 0
/// The migration job is in the full dump phase.
case fullDump // = 1
/// The migration job is CDC phase.
case cdc // = 2
/// The migration job is running the promote phase.
case promoteInProgress // = 3
/// Only RDS flow - waiting for source writes to stop
case waitingForSourceWritesToStop // = 4
/// Only RDS flow - the sources writes stopped, waiting for dump to begin
case preparingTheDump // = 5
case UNRECOGNIZED(Int)
public init() {
self = .unspecified
}
public init?(rawValue: Int) {
switch rawValue {
case 0: self = .unspecified
case 1: self = .fullDump
case 2: self = .cdc
case 3: self = .promoteInProgress
case 4: self = .waitingForSourceWritesToStop
case 5: self = .preparingTheDump
default: self = .UNRECOGNIZED(rawValue)
}
}
public var rawValue: Int {
switch self {
case .unspecified: return 0
case .fullDump: return 1
case .cdc: return 2
case .promoteInProgress: return 3
case .waitingForSourceWritesToStop: return 4
case .preparingTheDump: return 5
case .UNRECOGNIZED(let i): return i
}
}
}
/// The migration job types.
public enum TypeEnum: SwiftProtobuf.Enum {
public typealias RawValue = Int
/// The type of the migration job is unknown.
case unspecified // = 0
/// The migration job is a one time migration.
case oneTime // = 1
/// The migration job is a continuous migration.
case continuous // = 2
case UNRECOGNIZED(Int)
public init() {
self = .unspecified
}
public init?(rawValue: Int) {
switch rawValue {
case 0: self = .unspecified
case 1: self = .oneTime
case 2: self = .continuous
default: self = .UNRECOGNIZED(rawValue)
}
}
public var rawValue: Int {
switch self {
case .unspecified: return 0
case .oneTime: return 1
case .continuous: return 2
case .UNRECOGNIZED(let i): return i
}
}
}
/// Type of connectivity to source database.
public enum ConnectivityType: SwiftProtobuf.Enum {
public typealias RawValue = Int
/// No data defined.
case unspecified // = 0
/// Connect using static IO
case staticIp // = 1
/// Use reverse SSH connectivity.
case reverseSsh // = 2
/// Use VPC Peering connectivity.
case vpcPeering // = 3
case UNRECOGNIZED(Int)
public init() {
self = .unspecified
}
public init?(rawValue: Int) {
switch rawValue {
case 0: self = .unspecified
case 1: self = .staticIp
case 2: self = .reverseSsh
case 3: self = .vpcPeering
default: self = .UNRECOGNIZED(rawValue)
}
}
public var rawValue: Int {
switch self {
case .unspecified: return 0
case .staticIp: return 1
case .reverseSsh: return 2
case .vpcPeering: return 3
case .UNRECOGNIZED(let i): return i
}
}
}
public init() {}
fileprivate var _storage = _StorageClass.defaultInstance
}
#if swift(>=4.2)
extension Storage_Clouddms_Logging_V1_LoggedMigrationJob.State: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Storage_Clouddms_Logging_V1_LoggedMigrationJob.State] = [
.unspecified,
.maintenance,
.draft,
.creating,
.notStarted,
.running,
.failed,
.completed,
.deleting,
.stopping,
.stopped,
.deleted,
.updating,
.starting,
.restarting,
.resuming,
]
}
extension Storage_Clouddms_Logging_V1_LoggedMigrationJob.Phase: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Storage_Clouddms_Logging_V1_LoggedMigrationJob.Phase] = [
.unspecified,
.fullDump,
.cdc,
.promoteInProgress,
.waitingForSourceWritesToStop,
.preparingTheDump,
]
}
extension Storage_Clouddms_Logging_V1_LoggedMigrationJob.TypeEnum: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Storage_Clouddms_Logging_V1_LoggedMigrationJob.TypeEnum] = [
.unspecified,
.oneTime,
.continuous,
]
}
extension Storage_Clouddms_Logging_V1_LoggedMigrationJob.ConnectivityType: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Storage_Clouddms_Logging_V1_LoggedMigrationJob.ConnectivityType] = [
.unspecified,
.staticIp,
.reverseSsh,
.vpcPeering,
]
}
#endif // swift(>=4.2)
/// An MySQL database connection profile.
public struct Storage_Clouddms_Logging_V1_MySqlConnectionProfile {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
/// The database version.
public var version: Storage_Clouddms_Logging_V1_MySqlConnectionProfile.Version = .unspecified
/// The Cloud SQL id for a Cloud SQL instance.
public var cloudSqlID: String = String()
public var unknownFields = SwiftProtobuf.UnknownStorage()
/// The MySQL database version.
public enum Version: SwiftProtobuf.Enum {
public typealias RawValue = Int
/// Unspecified version.
case unspecified // = 0
/// MySQL 5.5.
case v55 // = 1
/// MySQL 5.6.
case v56 // = 2
/// MySQL 5.7.
case v57 // = 3
/// MySQL 8.0.
case v80 // = 4
case UNRECOGNIZED(Int)
public init() {
self = .unspecified
}
public init?(rawValue: Int) {
switch rawValue {
case 0: self = .unspecified
case 1: self = .v55
case 2: self = .v56
case 3: self = .v57
case 4: self = .v80
default: self = .UNRECOGNIZED(rawValue)
}
}
public var rawValue: Int {
switch self {
case .unspecified: return 0
case .v55: return 1
case .v56: return 2
case .v57: return 3
case .v80: return 4
case .UNRECOGNIZED(let i): return i
}
}
}
public init() {}
}
#if swift(>=4.2)
extension Storage_Clouddms_Logging_V1_MySqlConnectionProfile.Version: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Storage_Clouddms_Logging_V1_MySqlConnectionProfile.Version] = [
.unspecified,
.v55,
.v56,
.v57,
.v80,
]
}
#endif // swift(>=4.2)
/// An PostgreSQL connection profile.
public struct Storage_Clouddms_Logging_V1_PostgreSqlConnectionProfile {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
/// The database version.
public var version: Storage_Clouddms_Logging_V1_PostgreSqlConnectionProfile.Version = .unspecified
/// The Cloud SQL id for a Cloud SQL instance.
public var cloudSqlID: String = String()
public var unknownFields = SwiftProtobuf.UnknownStorage()
/// The PostgreSQL database version.
public enum Version: SwiftProtobuf.Enum {
public typealias RawValue = Int
/// Unspecified version.
case unspecified // = 0
/// PostgreSQL 9.6.
case v96 // = 1
/// PostgreSQL 11.
case v11 // = 2
case UNRECOGNIZED(Int)
public init() {
self = .unspecified
}
public init?(rawValue: Int) {
switch rawValue {
case 0: self = .unspecified
case 1: self = .v96
case 2: self = .v11
default: self = .UNRECOGNIZED(rawValue)
}
}
public var rawValue: Int {
switch self {
case .unspecified: return 0
case .v96: return 1
case .v11: return 2
case .UNRECOGNIZED(let i): return i
}
}
}
public init() {}
}
#if swift(>=4.2)
extension Storage_Clouddms_Logging_V1_PostgreSqlConnectionProfile.Version: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Storage_Clouddms_Logging_V1_PostgreSqlConnectionProfile.Version] = [
.unspecified,
.v96,
.v11,
]
}
#endif // swift(>=4.2)
/// A CloudSQL connection profile.
public struct Storage_Clouddms_Logging_V1_CloudSqlConnectionProfile {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
/// The Cloud SQL id.
public var cloudSqlID: String = String()
public var unknownFields = SwiftProtobuf.UnknownStorage()
public init() {}
}
/// An producer connection profile definition.
/// NEXT_TAG = 18.
public struct Storage_Clouddms_Logging_V1_LoggedConnectionProfile {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
/// The unique identifier for a connection profile.
public var name: String = String()
/// Labels.
public var labels: Dictionary<String,String> = [:]
/// The current connection profile state.
public var state: Storage_Clouddms_Logging_V1_LoggedConnectionProfile.State = .unspecified
/// The display name.
public var displayName: String = String()
/// The connection profile definition
public var connectionProfile: Storage_Clouddms_Logging_V1_LoggedConnectionProfile.OneOf_ConnectionProfile? = nil
/// A MySQL database connection profile.
public var mysql: Storage_Clouddms_Logging_V1_MySqlConnectionProfile {
get {
if case .mysql(let v)? = connectionProfile {return v}
return Storage_Clouddms_Logging_V1_MySqlConnectionProfile()
}
set {connectionProfile = .mysql(newValue)}
}
/// A PostgreSQL database connection profile.
public var postgresql: Storage_Clouddms_Logging_V1_PostgreSqlConnectionProfile {
get {
if case .postgresql(let v)? = connectionProfile {return v}
return Storage_Clouddms_Logging_V1_PostgreSqlConnectionProfile()
}
set {connectionProfile = .postgresql(newValue)}
}
/// A CloudSQL database connection profile.
public var cloudsql: Storage_Clouddms_Logging_V1_CloudSqlConnectionProfile {
get {
if case .cloudsql(let v)? = connectionProfile {return v}
return Storage_Clouddms_Logging_V1_CloudSqlConnectionProfile()
}
set {connectionProfile = .cloudsql(newValue)}
}
/// The error details in case of state FAILED.
public var error: Google_Rpc_Status {
get {return _error ?? Google_Rpc_Status()}
set {_error = newValue}
}
/// Returns true if `error` has been explicitly set.
public var hasError: Bool {return self._error != nil}
/// Clears the value of `error`. Subsequent reads from it will return its default value.
public mutating func clearError() {self._error = nil}
/// The database provider.
public var provider: Storage_Clouddms_Logging_V1_DatabaseProvider = .unspecified
public var unknownFields = SwiftProtobuf.UnknownStorage()
/// The connection profile definition
public enum OneOf_ConnectionProfile: Equatable {
/// A MySQL database connection profile.
case mysql(Storage_Clouddms_Logging_V1_MySqlConnectionProfile)
/// A PostgreSQL database connection profile.
case postgresql(Storage_Clouddms_Logging_V1_PostgreSqlConnectionProfile)
/// A CloudSQL database connection profile.
case cloudsql(Storage_Clouddms_Logging_V1_CloudSqlConnectionProfile)
#if !swift(>=4.1)
public static func ==(lhs: Storage_Clouddms_Logging_V1_LoggedConnectionProfile.OneOf_ConnectionProfile, rhs: Storage_Clouddms_Logging_V1_LoggedConnectionProfile.OneOf_ConnectionProfile) -> Bool {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch (lhs, rhs) {
case (.mysql, .mysql): return {
guard case .mysql(let l) = lhs, case .mysql(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.postgresql, .postgresql): return {
guard case .postgresql(let l) = lhs, case .postgresql(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.cloudsql, .cloudsql): return {
guard case .cloudsql(let l) = lhs, case .cloudsql(let r) = rhs else { preconditionFailure() }
return l == r
}()
default: return false
}
}
#endif
}
/// The connection profile states enum.
public enum State: SwiftProtobuf.Enum {
public typealias RawValue = Int
/// The state of the connection profile is unknown.
case unspecified // = 0
/// The connection profile is in draft mode and fully editable.
case draft // = 1
/// The connection profile is being created.
case creating // = 2
/// The connection profile is ready.
case ready // = 3
/// The connection profile is being updated.
case updating // = 4
/// The connection profile is being deleted.
case deleting // = 5
/// The connection profile has been deleted.
case deleted // = 6
/// The last action on the connection profile failed.
case failed // = 7
case UNRECOGNIZED(Int)
public init() {
self = .unspecified
}
public init?(rawValue: Int) {
switch rawValue {
case 0: self = .unspecified
case 1: self = .draft
case 2: self = .creating
case 3: self = .ready
case 4: self = .updating
case 5: self = .deleting
case 6: self = .deleted
case 7: self = .failed
default: self = .UNRECOGNIZED(rawValue)
}
}
public var rawValue: Int {
switch self {
case .unspecified: return 0
case .draft: return 1
case .creating: return 2
case .ready: return 3
case .updating: return 4
case .deleting: return 5
case .deleted: return 6
case .failed: return 7
case .UNRECOGNIZED(let i): return i
}
}
}
public init() {}
fileprivate var _error: Google_Rpc_Status? = nil
}
#if swift(>=4.2)
extension Storage_Clouddms_Logging_V1_LoggedConnectionProfile.State: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
public static var allCases: [Storage_Clouddms_Logging_V1_LoggedConnectionProfile.State] = [
.unspecified,
.draft,
.creating,
.ready,
.updating,
.deleting,
.deleted,
.failed,
]
}
#endif // swift(>=4.2)
/// Log definition for Migration Job event
public struct Storage_Clouddms_Logging_V1_MigrationJobEventLog {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
/// The migration job resource
public var migrationJob: Storage_Clouddms_Logging_V1_LoggedMigrationJob {
get {return _migrationJob ?? Storage_Clouddms_Logging_V1_LoggedMigrationJob()}
set {_migrationJob = newValue}
}
/// Returns true if `migrationJob` has been explicitly set.
public var hasMigrationJob: Bool {return self._migrationJob != nil}
/// Clears the value of `migrationJob`. Subsequent reads from it will return its default value.
public mutating func clearMigrationJob() {self._migrationJob = nil}
/// Timestamp of the event
public var occurrenceTimestamp: SwiftProtobuf.Google_Protobuf_Timestamp {
get {return _occurrenceTimestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()}
set {_occurrenceTimestamp = newValue}
}
/// Returns true if `occurrenceTimestamp` has been explicitly set.
public var hasOccurrenceTimestamp: Bool {return self._occurrenceTimestamp != nil}
/// Clears the value of `occurrenceTimestamp`. Subsequent reads from it will return its default value.
public mutating func clearOccurrenceTimestamp() {self._occurrenceTimestamp = nil}
/// Event code
public var code: Int32 = 0
/// Event message
public var textMessage: String = String()
/// Original event data
public var originalCause: Storage_Clouddms_Logging_V1_MigrationJobEventLog.OneOf_OriginalCause? = nil
/// Original event code
public var originalCode: Int32 {
get {
if case .originalCode(let v)? = originalCause {return v}
return 0
}
set {originalCause = .originalCode(newValue)}
}
/// Original event message
public var originalMessage: String {
get {
if case .originalMessage(let v)? = originalCause {return v}
return String()
}
set {originalCause = .originalMessage(newValue)}
}
public var unknownFields = SwiftProtobuf.UnknownStorage()
/// Original event data
public enum OneOf_OriginalCause: Equatable {
/// Original event code
case originalCode(Int32)
/// Original event message
case originalMessage(String)
#if !swift(>=4.1)
public static func ==(lhs: Storage_Clouddms_Logging_V1_MigrationJobEventLog.OneOf_OriginalCause, rhs: Storage_Clouddms_Logging_V1_MigrationJobEventLog.OneOf_OriginalCause) -> Bool {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch (lhs, rhs) {
case (.originalCode, .originalCode): return {
guard case .originalCode(let l) = lhs, case .originalCode(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.originalMessage, .originalMessage): return {
guard case .originalMessage(let l) = lhs, case .originalMessage(let r) = rhs else { preconditionFailure() }
return l == r
}()
default: return false
}
}
#endif
}
public init() {}
fileprivate var _migrationJob: Storage_Clouddms_Logging_V1_LoggedMigrationJob? = nil
fileprivate var _occurrenceTimestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil
}
/// Log definition for Connection Profile event
public struct Storage_Clouddms_Logging_V1_ConnectionProfileEventLog {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
/// The connection profilr resource
public var connectionProfile: Storage_Clouddms_Logging_V1_LoggedConnectionProfile {
get {return _connectionProfile ?? Storage_Clouddms_Logging_V1_LoggedConnectionProfile()}
set {_connectionProfile = newValue}
}
/// Returns true if `connectionProfile` has been explicitly set.
public var hasConnectionProfile: Bool {return self._connectionProfile != nil}
/// Clears the value of `connectionProfile`. Subsequent reads from it will return its default value.
public mutating func clearConnectionProfile() {self._connectionProfile = nil}
/// Timestamp of the event
public var occurrenceTimestamp: SwiftProtobuf.Google_Protobuf_Timestamp {
get {return _occurrenceTimestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()}
set {_occurrenceTimestamp = newValue}
}
/// Returns true if `occurrenceTimestamp` has been explicitly set.
public var hasOccurrenceTimestamp: Bool {return self._occurrenceTimestamp != nil}
/// Clears the value of `occurrenceTimestamp`. Subsequent reads from it will return its default value.
public mutating func clearOccurrenceTimestamp() {self._occurrenceTimestamp = nil}
/// Event code
public var code: Int32 = 0
/// Event message
public var textMessage: String = String()
/// Original event data
public var originalCause: Storage_Clouddms_Logging_V1_ConnectionProfileEventLog.OneOf_OriginalCause? = nil
/// Original event code
public var originalCode: Int32 {
get {
if case .originalCode(let v)? = originalCause {return v}
return 0
}
set {originalCause = .originalCode(newValue)}
}
/// Original event message
public var originalMessage: String {
get {
if case .originalMessage(let v)? = originalCause {return v}
return String()
}
set {originalCause = .originalMessage(newValue)}
}
public var unknownFields = SwiftProtobuf.UnknownStorage()
/// Original event data
public enum OneOf_OriginalCause: Equatable {
/// Original event code
case originalCode(Int32)
/// Original event message
case originalMessage(String)
#if !swift(>=4.1)
public static func ==(lhs: Storage_Clouddms_Logging_V1_ConnectionProfileEventLog.OneOf_OriginalCause, rhs: Storage_Clouddms_Logging_V1_ConnectionProfileEventLog.OneOf_OriginalCause) -> Bool {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch (lhs, rhs) {
case (.originalCode, .originalCode): return {
guard case .originalCode(let l) = lhs, case .originalCode(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.originalMessage, .originalMessage): return {
guard case .originalMessage(let l) = lhs, case .originalMessage(let r) = rhs else { preconditionFailure() }
return l == r
}()
default: return false
}
}
#endif
}
public init() {}
fileprivate var _connectionProfile: Storage_Clouddms_Logging_V1_LoggedConnectionProfile? = nil
fileprivate var _occurrenceTimestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil
}
// MARK: - Code below here is support for the SwiftProtobuf runtime.
fileprivate let _protobuf_package = "storage.clouddms.logging.v1"
extension Storage_Clouddms_Logging_V1_DatabaseEngine: SwiftProtobuf._ProtoNameProviding {
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
0: .same(proto: "DATABASE_ENGINE_UNSPECIFIED"),
1: .same(proto: "MYSQL"),
2: .same(proto: "POSTGRESQL"),
]
}
extension Storage_Clouddms_Logging_V1_DatabaseProvider: SwiftProtobuf._ProtoNameProviding {
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
0: .same(proto: "DATABASE_PROVIDER_UNSPECIFIED"),
1: .same(proto: "CLOUDSQL"),
2: .same(proto: "RDS"),
]
}
extension Storage_Clouddms_Logging_V1_DatabaseType: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".DatabaseType"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "provider"),
2: .same(proto: "engine"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeSingularEnumField(value: &self.provider) }()
case 2: try { try decoder.decodeSingularEnumField(value: &self.engine) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if self.provider != .unspecified {
try visitor.visitSingularEnumField(value: self.provider, fieldNumber: 1)
}
if self.engine != .unspecified {
try visitor.visitSingularEnumField(value: self.engine, fieldNumber: 2)
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: Storage_Clouddms_Logging_V1_DatabaseType, rhs: Storage_Clouddms_Logging_V1_DatabaseType) -> Bool {
if lhs.provider != rhs.provider {return false}
if lhs.engine != rhs.engine {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension Storage_Clouddms_Logging_V1_LoggedMigrationJob: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".LoggedMigrationJob"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "name"),
2: .same(proto: "labels"),
3: .standard(proto: "display_name"),
4: .same(proto: "state"),
5: .same(proto: "phase"),
6: .same(proto: "type"),
7: .standard(proto: "dump_path"),
8: .same(proto: "source"),
9: .same(proto: "destination"),
10: .same(proto: "duration"),
11: .standard(proto: "connectivity_type"),
12: .same(proto: "error"),
13: .standard(proto: "end_time"),
14: .standard(proto: "source_database"),
15: .standard(proto: "destination_database"),
]
fileprivate class _StorageClass {
var _name: String = String()
var _labels: Dictionary<String,String> = [:]
var _displayName: String = String()
var _state: Storage_Clouddms_Logging_V1_LoggedMigrationJob.State = .unspecified
var _phase: Storage_Clouddms_Logging_V1_LoggedMigrationJob.Phase = .unspecified
var _type: Storage_Clouddms_Logging_V1_LoggedMigrationJob.TypeEnum = .unspecified
var _dumpPath: String = String()
var _source: String = String()
var _destination: String = String()
var _duration: SwiftProtobuf.Google_Protobuf_Duration? = nil
var _connectivityType: Storage_Clouddms_Logging_V1_LoggedMigrationJob.ConnectivityType = .unspecified
var _error: Google_Rpc_Status? = nil
var _endTime: SwiftProtobuf.Google_Protobuf_Timestamp? = nil
var _sourceDatabase: Storage_Clouddms_Logging_V1_DatabaseType? = nil
var _destinationDatabase: Storage_Clouddms_Logging_V1_DatabaseType? = nil
static let defaultInstance = _StorageClass()
private init() {}
init(copying source: _StorageClass) {
_name = source._name
_labels = source._labels
_displayName = source._displayName
_state = source._state
_phase = source._phase
_type = source._type
_dumpPath = source._dumpPath
_source = source._source
_destination = source._destination
_duration = source._duration
_connectivityType = source._connectivityType
_error = source._error
_endTime = source._endTime
_sourceDatabase = source._sourceDatabase
_destinationDatabase = source._destinationDatabase
}
}
fileprivate mutating func _uniqueStorage() -> _StorageClass {
if !isKnownUniquelyReferenced(&_storage) {
_storage = _StorageClass(copying: _storage)
}
return _storage
}
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
_ = _uniqueStorage()
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeSingularStringField(value: &_storage._name) }()
case 2: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufString,SwiftProtobuf.ProtobufString>.self, value: &_storage._labels) }()
case 3: try { try decoder.decodeSingularStringField(value: &_storage._displayName) }()
case 4: try { try decoder.decodeSingularEnumField(value: &_storage._state) }()
case 5: try { try decoder.decodeSingularEnumField(value: &_storage._phase) }()
case 6: try { try decoder.decodeSingularEnumField(value: &_storage._type) }()
case 7: try { try decoder.decodeSingularStringField(value: &_storage._dumpPath) }()
case 8: try { try decoder.decodeSingularStringField(value: &_storage._source) }()
case 9: try { try decoder.decodeSingularStringField(value: &_storage._destination) }()
case 10: try { try decoder.decodeSingularMessageField(value: &_storage._duration) }()
case 11: try { try decoder.decodeSingularEnumField(value: &_storage._connectivityType) }()
case 12: try { try decoder.decodeSingularMessageField(value: &_storage._error) }()
case 13: try { try decoder.decodeSingularMessageField(value: &_storage._endTime) }()
case 14: try { try decoder.decodeSingularMessageField(value: &_storage._sourceDatabase) }()
case 15: try { try decoder.decodeSingularMessageField(value: &_storage._destinationDatabase) }()
default: break
}
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
if !_storage._name.isEmpty {
try visitor.visitSingularStringField(value: _storage._name, fieldNumber: 1)
}
if !_storage._labels.isEmpty {
try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufString,SwiftProtobuf.ProtobufString>.self, value: _storage._labels, fieldNumber: 2)
}
if !_storage._displayName.isEmpty {
try visitor.visitSingularStringField(value: _storage._displayName, fieldNumber: 3)
}
if _storage._state != .unspecified {
try visitor.visitSingularEnumField(value: _storage._state, fieldNumber: 4)
}
if _storage._phase != .unspecified {
try visitor.visitSingularEnumField(value: _storage._phase, fieldNumber: 5)
}
if _storage._type != .unspecified {
try visitor.visitSingularEnumField(value: _storage._type, fieldNumber: 6)
}
if !_storage._dumpPath.isEmpty {
try visitor.visitSingularStringField(value: _storage._dumpPath, fieldNumber: 7)
}
if !_storage._source.isEmpty {
try visitor.visitSingularStringField(value: _storage._source, fieldNumber: 8)
}
if !_storage._destination.isEmpty {
try visitor.visitSingularStringField(value: _storage._destination, fieldNumber: 9)
}
if let v = _storage._duration {
try visitor.visitSingularMessageField(value: v, fieldNumber: 10)
}
if _storage._connectivityType != .unspecified {
try visitor.visitSingularEnumField(value: _storage._connectivityType, fieldNumber: 11)
}
if let v = _storage._error {
try visitor.visitSingularMessageField(value: v, fieldNumber: 12)
}
if let v = _storage._endTime {
try visitor.visitSingularMessageField(value: v, fieldNumber: 13)
}
if let v = _storage._sourceDatabase {
try visitor.visitSingularMessageField(value: v, fieldNumber: 14)
}
if let v = _storage._destinationDatabase {
try visitor.visitSingularMessageField(value: v, fieldNumber: 15)
}
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: Storage_Clouddms_Logging_V1_LoggedMigrationJob, rhs: Storage_Clouddms_Logging_V1_LoggedMigrationJob) -> Bool {
if lhs._storage !== rhs._storage {
let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
let _storage = _args.0
let rhs_storage = _args.1
if _storage._name != rhs_storage._name {return false}
if _storage._labels != rhs_storage._labels {return false}
if _storage._displayName != rhs_storage._displayName {return false}
if _storage._state != rhs_storage._state {return false}
if _storage._phase != rhs_storage._phase {return false}
if _storage._type != rhs_storage._type {return false}
if _storage._dumpPath != rhs_storage._dumpPath {return false}
if _storage._source != rhs_storage._source {return false}
if _storage._destination != rhs_storage._destination {return false}
if _storage._duration != rhs_storage._duration {return false}
if _storage._connectivityType != rhs_storage._connectivityType {return false}
if _storage._error != rhs_storage._error {return false}
if _storage._endTime != rhs_storage._endTime {return false}
if _storage._sourceDatabase != rhs_storage._sourceDatabase {return false}
if _storage._destinationDatabase != rhs_storage._destinationDatabase {return false}
return true
}
if !storagesAreEqual {return false}
}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension Storage_Clouddms_Logging_V1_LoggedMigrationJob.State: SwiftProtobuf._ProtoNameProviding {
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
0: .same(proto: "STATE_UNSPECIFIED"),
1: .same(proto: "MAINTENANCE"),
2: .same(proto: "DRAFT"),
3: .same(proto: "CREATING"),
4: .same(proto: "NOT_STARTED"),
5: .same(proto: "RUNNING"),
6: .same(proto: "FAILED"),
7: .same(proto: "COMPLETED"),
8: .same(proto: "DELETING"),
9: .same(proto: "STOPPING"),
10: .same(proto: "STOPPED"),
11: .same(proto: "DELETED"),
12: .same(proto: "UPDATING"),
13: .same(proto: "STARTING"),
14: .same(proto: "RESTARTING"),
15: .same(proto: "RESUMING"),
]
}
extension Storage_Clouddms_Logging_V1_LoggedMigrationJob.Phase: SwiftProtobuf._ProtoNameProviding {
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
0: .same(proto: "PHASE_UNSPECIFIED"),
1: .same(proto: "FULL_DUMP"),
2: .same(proto: "CDC"),
3: .same(proto: "PROMOTE_IN_PROGRESS"),
4: .same(proto: "WAITING_FOR_SOURCE_WRITES_TO_STOP"),
5: .same(proto: "PREPARING_THE_DUMP"),
]
}
extension Storage_Clouddms_Logging_V1_LoggedMigrationJob.TypeEnum: SwiftProtobuf._ProtoNameProviding {
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
0: .same(proto: "TYPE_UNSPECIFIED"),
1: .same(proto: "ONE_TIME"),
2: .same(proto: "CONTINUOUS"),
]
}
extension Storage_Clouddms_Logging_V1_LoggedMigrationJob.ConnectivityType: SwiftProtobuf._ProtoNameProviding {
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
0: .same(proto: "CONNECTIVITY_TYPE_UNSPECIFIED"),
1: .same(proto: "STATIC_IP"),
2: .same(proto: "REVERSE_SSH"),
3: .same(proto: "VPC_PEERING"),
]
}
extension Storage_Clouddms_Logging_V1_MySqlConnectionProfile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".MySqlConnectionProfile"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "version"),
2: .standard(proto: "cloud_sql_id"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeSingularEnumField(value: &self.version) }()
case 2: try { try decoder.decodeSingularStringField(value: &self.cloudSqlID) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if self.version != .unspecified {
try visitor.visitSingularEnumField(value: self.version, fieldNumber: 1)
}
if !self.cloudSqlID.isEmpty {
try visitor.visitSingularStringField(value: self.cloudSqlID, fieldNumber: 2)
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: Storage_Clouddms_Logging_V1_MySqlConnectionProfile, rhs: Storage_Clouddms_Logging_V1_MySqlConnectionProfile) -> Bool {
if lhs.version != rhs.version {return false}
if lhs.cloudSqlID != rhs.cloudSqlID {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension Storage_Clouddms_Logging_V1_MySqlConnectionProfile.Version: SwiftProtobuf._ProtoNameProviding {
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
0: .same(proto: "VERSION_UNSPECIFIED"),
1: .same(proto: "V5_5"),
2: .same(proto: "V5_6"),
3: .same(proto: "V5_7"),
4: .same(proto: "V8_0"),
]
}
extension Storage_Clouddms_Logging_V1_PostgreSqlConnectionProfile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".PostgreSqlConnectionProfile"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "version"),
2: .standard(proto: "cloud_sql_id"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeSingularEnumField(value: &self.version) }()
case 2: try { try decoder.decodeSingularStringField(value: &self.cloudSqlID) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if self.version != .unspecified {
try visitor.visitSingularEnumField(value: self.version, fieldNumber: 1)
}
if !self.cloudSqlID.isEmpty {
try visitor.visitSingularStringField(value: self.cloudSqlID, fieldNumber: 2)
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: Storage_Clouddms_Logging_V1_PostgreSqlConnectionProfile, rhs: Storage_Clouddms_Logging_V1_PostgreSqlConnectionProfile) -> Bool {
if lhs.version != rhs.version {return false}
if lhs.cloudSqlID != rhs.cloudSqlID {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension Storage_Clouddms_Logging_V1_PostgreSqlConnectionProfile.Version: SwiftProtobuf._ProtoNameProviding {
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
0: .same(proto: "VERSION_UNSPECIFIED"),
1: .same(proto: "V9_6"),
2: .same(proto: "V11"),
]
}
extension Storage_Clouddms_Logging_V1_CloudSqlConnectionProfile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".CloudSqlConnectionProfile"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .standard(proto: "cloud_sql_id"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeSingularStringField(value: &self.cloudSqlID) }()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if !self.cloudSqlID.isEmpty {
try visitor.visitSingularStringField(value: self.cloudSqlID, fieldNumber: 1)
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: Storage_Clouddms_Logging_V1_CloudSqlConnectionProfile, rhs: Storage_Clouddms_Logging_V1_CloudSqlConnectionProfile) -> Bool {
if lhs.cloudSqlID != rhs.cloudSqlID {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension Storage_Clouddms_Logging_V1_LoggedConnectionProfile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".LoggedConnectionProfile"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "name"),
2: .same(proto: "labels"),
3: .same(proto: "state"),
4: .standard(proto: "display_name"),
100: .same(proto: "mysql"),
101: .same(proto: "postgresql"),
102: .same(proto: "cloudsql"),
5: .same(proto: "error"),
6: .same(proto: "provider"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeSingularStringField(value: &self.name) }()
case 2: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufString,SwiftProtobuf.ProtobufString>.self, value: &self.labels) }()
case 3: try { try decoder.decodeSingularEnumField(value: &self.state) }()
case 4: try { try decoder.decodeSingularStringField(value: &self.displayName) }()
case 5: try { try decoder.decodeSingularMessageField(value: &self._error) }()
case 6: try { try decoder.decodeSingularEnumField(value: &self.provider) }()
case 100: try {
var v: Storage_Clouddms_Logging_V1_MySqlConnectionProfile?
if let current = self.connectionProfile {
try decoder.handleConflictingOneOf()
if case .mysql(let m) = current {v = m}
}
try decoder.decodeSingularMessageField(value: &v)
if let v = v {self.connectionProfile = .mysql(v)}
}()
case 101: try {
var v: Storage_Clouddms_Logging_V1_PostgreSqlConnectionProfile?
if let current = self.connectionProfile {
try decoder.handleConflictingOneOf()
if case .postgresql(let m) = current {v = m}
}
try decoder.decodeSingularMessageField(value: &v)
if let v = v {self.connectionProfile = .postgresql(v)}
}()
case 102: try {
var v: Storage_Clouddms_Logging_V1_CloudSqlConnectionProfile?
if let current = self.connectionProfile {
try decoder.handleConflictingOneOf()
if case .cloudsql(let m) = current {v = m}
}
try decoder.decodeSingularMessageField(value: &v)
if let v = v {self.connectionProfile = .cloudsql(v)}
}()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if !self.name.isEmpty {
try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
}
if !self.labels.isEmpty {
try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufString,SwiftProtobuf.ProtobufString>.self, value: self.labels, fieldNumber: 2)
}
if self.state != .unspecified {
try visitor.visitSingularEnumField(value: self.state, fieldNumber: 3)
}
if !self.displayName.isEmpty {
try visitor.visitSingularStringField(value: self.displayName, fieldNumber: 4)
}
if let v = self._error {
try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
}
if self.provider != .unspecified {
try visitor.visitSingularEnumField(value: self.provider, fieldNumber: 6)
}
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch self.connectionProfile {
case .mysql?: try {
guard case .mysql(let v)? = self.connectionProfile else { preconditionFailure() }
try visitor.visitSingularMessageField(value: v, fieldNumber: 100)
}()
case .postgresql?: try {
guard case .postgresql(let v)? = self.connectionProfile else { preconditionFailure() }
try visitor.visitSingularMessageField(value: v, fieldNumber: 101)
}()
case .cloudsql?: try {
guard case .cloudsql(let v)? = self.connectionProfile else { preconditionFailure() }
try visitor.visitSingularMessageField(value: v, fieldNumber: 102)
}()
case nil: break
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: Storage_Clouddms_Logging_V1_LoggedConnectionProfile, rhs: Storage_Clouddms_Logging_V1_LoggedConnectionProfile) -> Bool {
if lhs.name != rhs.name {return false}
if lhs.labels != rhs.labels {return false}
if lhs.state != rhs.state {return false}
if lhs.displayName != rhs.displayName {return false}
if lhs.connectionProfile != rhs.connectionProfile {return false}
if lhs._error != rhs._error {return false}
if lhs.provider != rhs.provider {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension Storage_Clouddms_Logging_V1_LoggedConnectionProfile.State: SwiftProtobuf._ProtoNameProviding {
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
0: .same(proto: "STATE_UNSPECIFIED"),
1: .same(proto: "DRAFT"),
2: .same(proto: "CREATING"),
3: .same(proto: "READY"),
4: .same(proto: "UPDATING"),
5: .same(proto: "DELETING"),
6: .same(proto: "DELETED"),
7: .same(proto: "FAILED"),
]
}
extension Storage_Clouddms_Logging_V1_MigrationJobEventLog: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".MigrationJobEventLog"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .standard(proto: "migration_job"),
2: .standard(proto: "occurrence_timestamp"),
3: .same(proto: "code"),
4: .standard(proto: "text_message"),
200: .standard(proto: "original_code"),
201: .standard(proto: "original_message"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeSingularMessageField(value: &self._migrationJob) }()
case 2: try { try decoder.decodeSingularMessageField(value: &self._occurrenceTimestamp) }()
case 3: try { try decoder.decodeSingularInt32Field(value: &self.code) }()
case 4: try { try decoder.decodeSingularStringField(value: &self.textMessage) }()
case 200: try {
if self.originalCause != nil {try decoder.handleConflictingOneOf()}
var v: Int32?
try decoder.decodeSingularInt32Field(value: &v)
if let v = v {self.originalCause = .originalCode(v)}
}()
case 201: try {
if self.originalCause != nil {try decoder.handleConflictingOneOf()}
var v: String?
try decoder.decodeSingularStringField(value: &v)
if let v = v {self.originalCause = .originalMessage(v)}
}()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if let v = self._migrationJob {
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
}
if let v = self._occurrenceTimestamp {
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
}
if self.code != 0 {
try visitor.visitSingularInt32Field(value: self.code, fieldNumber: 3)
}
if !self.textMessage.isEmpty {
try visitor.visitSingularStringField(value: self.textMessage, fieldNumber: 4)
}
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch self.originalCause {
case .originalCode?: try {
guard case .originalCode(let v)? = self.originalCause else { preconditionFailure() }
try visitor.visitSingularInt32Field(value: v, fieldNumber: 200)
}()
case .originalMessage?: try {
guard case .originalMessage(let v)? = self.originalCause else { preconditionFailure() }
try visitor.visitSingularStringField(value: v, fieldNumber: 201)
}()
case nil: break
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: Storage_Clouddms_Logging_V1_MigrationJobEventLog, rhs: Storage_Clouddms_Logging_V1_MigrationJobEventLog) -> Bool {
if lhs._migrationJob != rhs._migrationJob {return false}
if lhs._occurrenceTimestamp != rhs._occurrenceTimestamp {return false}
if lhs.code != rhs.code {return false}
if lhs.textMessage != rhs.textMessage {return false}
if lhs.originalCause != rhs.originalCause {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension Storage_Clouddms_Logging_V1_ConnectionProfileEventLog: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".ConnectionProfileEventLog"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .standard(proto: "connection_profile"),
2: .standard(proto: "occurrence_timestamp"),
3: .same(proto: "code"),
4: .standard(proto: "text_message"),
200: .standard(proto: "original_code"),
201: .standard(proto: "original_message"),
]
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeSingularMessageField(value: &self._connectionProfile) }()
case 2: try { try decoder.decodeSingularMessageField(value: &self._occurrenceTimestamp) }()
case 3: try { try decoder.decodeSingularInt32Field(value: &self.code) }()
case 4: try { try decoder.decodeSingularStringField(value: &self.textMessage) }()
case 200: try {
if self.originalCause != nil {try decoder.handleConflictingOneOf()}
var v: Int32?
try decoder.decodeSingularInt32Field(value: &v)
if let v = v {self.originalCause = .originalCode(v)}
}()
case 201: try {
if self.originalCause != nil {try decoder.handleConflictingOneOf()}
var v: String?
try decoder.decodeSingularStringField(value: &v)
if let v = v {self.originalCause = .originalMessage(v)}
}()
default: break
}
}
}
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if let v = self._connectionProfile {
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
}
if let v = self._occurrenceTimestamp {
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
}
if self.code != 0 {
try visitor.visitSingularInt32Field(value: self.code, fieldNumber: 3)
}
if !self.textMessage.isEmpty {
try visitor.visitSingularStringField(value: self.textMessage, fieldNumber: 4)
}
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch self.originalCause {
case .originalCode?: try {
guard case .originalCode(let v)? = self.originalCause else { preconditionFailure() }
try visitor.visitSingularInt32Field(value: v, fieldNumber: 200)
}()
case .originalMessage?: try {
guard case .originalMessage(let v)? = self.originalCause else { preconditionFailure() }
try visitor.visitSingularStringField(value: v, fieldNumber: 201)
}()
case nil: break
}
try unknownFields.traverse(visitor: &visitor)
}
public static func ==(lhs: Storage_Clouddms_Logging_V1_ConnectionProfileEventLog, rhs: Storage_Clouddms_Logging_V1_ConnectionProfileEventLog) -> Bool {
if lhs._connectionProfile != rhs._connectionProfile {return false}
if lhs._occurrenceTimestamp != rhs._occurrenceTimestamp {return false}
if lhs.code != rhs.code {return false}
if lhs.textMessage != rhs.textMessage {return false}
if lhs.originalCause != rhs.originalCause {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
| [
-1
] |
d323b32f8cf1af632de8c17d89e0d54d15788260 | 8fa573554e4647027f8a28a5bc317fc36a4b4050 | /Indoorway Test/Indoorway Test/NetworkLayer/APIService.swift | 68b061b868b5c8da447bb47636a9d0450de70b09 | [] | no_license | chaserunner/indoorway_test | acac62487133a1480e7dcdd8047ac2c21db1e6ad | e4a8ccf607f8077007f7618928847ddad7f380c8 | refs/heads/master | 2021-01-16T18:11:42.966566 | 2017-08-13T21:01:40 | 2017-08-13T21:01:40 | 100,051,464 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 2,401 | swift | //
// APIService.swift
// Indoorway Test
//
// Created by Illia Lukisha on 13.08.17.
// Copyright © 2017 Illia Lukisha. All rights reserved.
//
import ObjectMapper
import RealmSwift
import RxSwift
import RxRealm
import Alamofire
enum Path {
case photo(index: Int)
var path : String {
switch self {
case let .photo(index):
return "photos/\(index)"
}
}
}
struct APIService {
static private func requestObject<T>(at path: String, using method: HTTPMethod, with parameters: [String: Any] = [:], and realm: Realm? = nil) -> Observable<T> where T: Object, T: Mappable {
return NetworkManager.sharedInstance.request(path: path, method: method, parameters: parameters)
.flatMap { (response) -> Observable<T> in
if let error = response as? NSError {
return Observable<T>.error(error)
}
guard let json = response as? [String: Any], let object = Mapper<T>().map(JSONObject: json) else {
return Observable<T>.error(NSError(domain: path,
code: -1,
userInfo: [NSLocalizedDescriptionKey: "Object mapping failed"]))
}
autoreleasepool {
let _realm: Realm?
if realm != nil {
_realm = realm
} else {
_realm = try? Realm()
}
if let _realm = _realm {
try? _realm.write {
_realm.create(T.self, value: object.toJSON(), update: true)
}
}
}
return Observable<T>.just(object)
}
.observeOn(MainScheduler.instance)
}
static func getObject<T>(from path: String, with parameters: [String: Any] = [:], and realm: Realm? = nil) -> Observable<T> where T: Object, T: Mappable {
return requestObject(at: path, using: .get, with: parameters)
}
static func postObject<T>(to path: String, with parameters: [String: Any] = [:], and realm: Realm? = nil) -> Observable<T> where T: Object, T: Mappable {
return requestObject(at: path, using: .post, with: parameters)
}
}
| [
-1
] |
4d005927292b10498117246242eb7c68fe8b4f87 | 6db71b2fd25e0ed72059f1fcff3cc44a3b09047c | /InstagramClone/Controllers/HomeViewController.swift | 71c8a164eb02b60d0993e008937a4d0d62d89edd | [] | no_license | tushards2001/InstagramClone | ce555a2b33ce2890927c2ec1eb862d2cbee7bc53 | 6a9073c1764759668a93cd6a67dd943a1fa9e058 | refs/heads/master | 2021-05-05T00:36:50.945090 | 2018-02-05T08:03:03 | 2018-02-05T08:03:03 | 119,549,749 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,707 | swift | //
// HomeViewController.swift
// InstagramClone
//
// Created by MacBookPro on 1/31/18.
// Copyright © 2018 basicdas. All rights reserved.
//
import UIKit
import Kingfisher
class HomeViewController: UIViewController {
var posts = [Post]()
let refreshControl = UIRefreshControl()
let timestampFormatter: DateFormatter = {
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .short
return dateFormatter
}()
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
configureTableView()
reloadTimeline()
}
func configureTableView() {
// remove separators for empty cells
tableView.tableFooterView = UIView()
// remove separators from cells
tableView.separatorStyle = .none
refreshControl.addTarget(self, action: #selector(reloadTimeline), for: .valueChanged)
tableView.addSubview(refreshControl)
}
@objc func reloadTimeline() {
UserService.timeline { (posts) in
self.posts = posts
if self.refreshControl.isRefreshing {
self.refreshControl.endRefreshing()
}
self.tableView.reloadData()
}
}
}
extension HomeViewController: UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return posts.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 3
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let post = posts[indexPath.section]
switch indexPath.row {
case 0:
let cell = tableView.dequeueReusableCell(withIdentifier: "PostHeaderCell", for: indexPath) as! PostHeaderCell
cell.backgroundColor = UIColor.white
cell.usernameLabel.text = post.poster.username
return cell
case 1:
let cell = tableView.dequeueReusableCell(withIdentifier: "PostImageCell", for: indexPath) as! PostImageCell
cell.backgroundColor = UIColor.white
let imageUrl = URL(string: post.imageURL)
cell.postImageView.kf.setImage(with: imageUrl)
return cell
case 2:
let cell = tableView.dequeueReusableCell(withIdentifier: "PostActionCell", for: indexPath) as! PostActionCell
cell.backgroundColor = UIColor.white
cell.delegate = self
return cell
default:
fatalError("Error: unexpected indexPath.")
}
}
func configureCell(_ cell: PostActionCell, with post: Post) {
cell.likeCountLabel.text = "\(post.likeCount) Likes"
cell.timeAgoLabel.text = timestampFormatter.string(from: post.creationDate)
cell.likeButton.isSelected = post.isLiked
}
}
extension HomeViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
switch indexPath.row {
case 0:
return PostHeaderCell.height
case 1:
let post = posts[indexPath.section]
return post.imageHeight
case 2:
return PostActionCell.height
default:
fatalError()
}
}
}
extension HomeViewController: PostActionCellDelegate {
func didTapLikeButton(_ likeButton: UIButton, on cell: PostActionCell) {
guard let indexPath = tableView.indexPath(for: cell) else {
return
}
likeButton.isUserInteractionEnabled = false
let post = posts[indexPath.section]
LikeService.setIsLiked(!post.isLiked, for: post) { (success) in
defer {
likeButton.isUserInteractionEnabled = true
}
guard success else { return }
post.likeCount += !post.isLiked ? 1 : -1
post.isLiked = !post.isLiked
// 8
guard let cell = self.tableView.cellForRow(at: indexPath) as? PostActionCell
else { return }
// 9
DispatchQueue.main.async {
self.configureCell(cell, with: post)
}
}
}
}
| [
-1
] |
94a2ce7683b4771c516fe03dd29eabd6e258d8f1 | 36d75599c17ed057d63711dfbc39610851c96803 | /ShuTu/Libraries/TLPhotoPicker/Classes/TLPhotoLibrary.swift | 25e6174746035d6056852af791700595f15e1d64 | [] | no_license | YvanMasterAll/yvan.ios.JianKe | 57226b136e92da05b2e27d65de9a749b33443269 | a80884a1928d0c14e7438645c08e00f087c779bc | refs/heads/master | 2021-09-10T11:15:00.196836 | 2018-03-25T10:56:14 | 2018-03-25T10:56:14 | 113,850,104 | 0 | 0 | null | 2018-01-22T11:32:14 | 2017-12-11T11:20:07 | Swift | UTF-8 | Swift | false | false | 11,707 | swift | //
// TLPhotoLibrary.swift
// TLPhotosPicker
//
// Created by wade.hawk on 2017. 5. 3..
// Copyright © 2017년 wade.hawk. All rights reserved.
//
import Foundation
import Photos
protocol TLPhotoLibraryDelegate: class {
func loadCameraRollCollection(collection: TLAssetsCollection)
func loadCompleteAllCollection(collections: [TLAssetsCollection])
func focusCollection(collection: TLAssetsCollection)
}
class TLPhotoLibrary {
weak var delegate: TLPhotoLibraryDelegate? = nil
lazy var imageManager: PHCachingImageManager = {
return PHCachingImageManager()
}()
deinit {
// print("deinit TLPhotoLibrary")
}
@discardableResult
func livePhotoAsset(asset: PHAsset, size: CGSize = CGSize(width: 720, height: 1280), progressBlock: Photos.PHAssetImageProgressHandler? = nil, completionBlock:@escaping (PHLivePhoto,Bool)-> Void ) -> PHImageRequestID {
let options = PHLivePhotoRequestOptions()
options.deliveryMode = .opportunistic
options.isNetworkAccessAllowed = true
options.progressHandler = progressBlock
let scale = min(UIScreen.main.scale,2)
let targetSize = CGSize(width: size.width*scale, height: size.height*scale)
let requestId = self.imageManager.requestLivePhoto(for: asset, targetSize: targetSize, contentMode: .aspectFill, options: options) { (livePhoto, info) in
let complete = (info?["PHImageResultIsDegradedKey"] as? Bool) == false
if let livePhoto = livePhoto {
completionBlock(livePhoto,complete)
}
}
return requestId
}
@discardableResult
func videoAsset(asset: PHAsset, size: CGSize = CGSize(width: 720, height: 1280), progressBlock: Photos.PHAssetImageProgressHandler? = nil, completionBlock:@escaping (AVPlayerItem?, [AnyHashable : Any]?) -> Void ) -> PHImageRequestID {
let options = PHVideoRequestOptions()
options.isNetworkAccessAllowed = true
options.deliveryMode = .automatic
options.progressHandler = progressBlock
let requestId = self.imageManager.requestPlayerItem(forVideo: asset, options: options, resultHandler: { playerItem, info in
completionBlock(playerItem,info)
})
return requestId
}
@discardableResult
func imageAsset(asset: PHAsset, size: CGSize = CGSize(width: 160, height: 160), options: PHImageRequestOptions? = nil, completionBlock:@escaping (UIImage,Bool)-> Void ) -> PHImageRequestID {
var options = options
if options == nil {
options = PHImageRequestOptions()
options?.isSynchronous = false
options?.deliveryMode = .opportunistic
options?.isNetworkAccessAllowed = true
}
let scale = min(UIScreen.main.scale,2)
let targetSize = CGSize(width: size.width*scale, height: size.height*scale)
let requestId = self.imageManager.requestImage(for: asset, targetSize: targetSize, contentMode: .aspectFill, options: options) { image, info in
let complete = (info?["PHImageResultIsDegradedKey"] as? Bool) == false
if let image = image {
completionBlock(image,complete)
}
}
return requestId
}
func cancelPHImageRequest(requestId: PHImageRequestID) {
self.imageManager.cancelImageRequest(requestId)
}
@discardableResult
class func cloudImageDownload(asset: PHAsset, size: CGSize = PHImageManagerMaximumSize, progressBlock: @escaping (Double) -> Void, completionBlock:@escaping (UIImage?)-> Void ) -> PHImageRequestID {
let options = PHImageRequestOptions()
options.isSynchronous = false
options.isNetworkAccessAllowed = true
options.deliveryMode = .opportunistic
options.version = .current
options.resizeMode = .exact
options.progressHandler = { (progress,error,stop,info) in
progressBlock(progress)
}
let requestId = PHCachingImageManager().requestImageData(for: asset, options: options) { (imageData, dataUTI, orientation, info) in
if let data = imageData,let _ = info {
completionBlock(UIImage(data: data))
}else{
completionBlock(nil)//error
}
}
return requestId
}
@discardableResult
class func fullResolutionImageData(asset: PHAsset) -> UIImage? {
let options = PHImageRequestOptions()
options.isSynchronous = true
options.resizeMode = .none
options.isNetworkAccessAllowed = false
options.version = .current
var image: UIImage? = nil
_ = PHCachingImageManager().requestImageData(for: asset, options: options) { (imageData, dataUTI, orientation, info) in
if let data = imageData {
image = UIImage(data: data)
}
}
return image
}
class func fullResolutionImagePath(asset: PHAsset, handler: @escaping (String) -> Swift.Void) {
var imagePath = ""
let option = PHContentEditingInputRequestOptions.init()
option.canHandleAdjustmentData = {(adjustmeta: PHAdjustmentData)
-> Bool in
return true
}
asset.requestContentEditingInput(with: option) { (contentEditingInput:PHContentEditingInput?, info: [AnyHashable : Any]) in
let originPath = contentEditingInput!.fullSizeImageURL!.absoluteString
imagePath = String(originPath[originPath.index(originPath.startIndex, offsetBy: 7)...])
handler(imagePath)
}
}
}
//MARK: - Load Collection
extension TLPhotoLibrary {
func getOption() -> PHFetchOptions {
let options = PHFetchOptions()
let sortOrder = [NSSortDescriptor(key: "creationDate", ascending: false)]
options.sortDescriptors = sortOrder
return options
}
func fetchResult(collection: TLAssetsCollection?, maxVideoDuration:TimeInterval?=nil, options: PHFetchOptions? = nil) -> PHFetchResult<PHAsset>? {
guard let phAssetCollection = collection?.phAssetCollection else { return nil }
let options = options ?? getOption()
if let duration = maxVideoDuration, phAssetCollection.assetCollectionSubtype == .smartAlbumVideos {
options.predicate = NSPredicate(format: "mediaType = %i AND duration < %f", PHAssetMediaType.video.rawValue, duration + 1)
}
return PHAsset.fetchAssets(in: phAssetCollection, options: options)
}
func fetchCollection(configure: TLPhotosPickerConfigure) {
let allowedVideo = configure.allowedVideo
let useCameraButton = configure.usedCameraButton
let mediaType = configure.mediaType
let maxVideoDuration = configure.maxVideoDuration
let options = configure.fetchOption ?? getOption()
func getAlbum(subType: PHAssetCollectionSubtype, result: inout [TLAssetsCollection]) {
let fetchCollection = PHAssetCollection.fetchAssetCollections(with: .album, subtype: subType, options: nil)
var collections = [PHAssetCollection]()
fetchCollection.enumerateObjects { (collection, index, _) in
//Why this? : Can't getting image for cloud shared album
if collection.assetCollectionSubtype != .albumCloudShared {
collections.append(collection)
}
}
for collection in collections {
if !result.contains(where: { $0.localIdentifier == collection.localIdentifier }) {
var assetsCollection = TLAssetsCollection(collection: collection)
assetsCollection.fetchResult = PHAsset.fetchAssets(in: collection, options: options)
if assetsCollection.count > 0 {
result.append(assetsCollection)
}
}
}
}
@discardableResult
func getSmartAlbum(subType: PHAssetCollectionSubtype, useCameraButton: Bool = false, result: inout [TLAssetsCollection]) -> TLAssetsCollection? {
let fetchCollection = PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: subType, options: nil)
if let collection = fetchCollection.firstObject, !result.contains(where: { $0.localIdentifier == collection.localIdentifier }) {
var assetsCollection = TLAssetsCollection(collection: collection)
assetsCollection.fetchResult = PHAsset.fetchAssets(in: collection, options: options)
if assetsCollection.count > 0 || useCameraButton {
result.append(assetsCollection)
return assetsCollection
}
}
return nil
}
if let mediaType = mediaType {
options.predicate = maxVideoDuration != nil && mediaType == PHAssetMediaType.video ? NSPredicate(format: "mediaType = %i AND duration < %f", mediaType.rawValue, maxVideoDuration! + 1) : NSPredicate(format: "mediaType = %i", mediaType.rawValue)
} else if !allowedVideo {
options.predicate = NSPredicate(format: "mediaType = %i", PHAssetMediaType.image.rawValue)
} else if let duration = maxVideoDuration {
options.predicate = NSPredicate(format: "mediaType = %i OR (mediaType = %i AND duration < %f)", PHAssetMediaType.image.rawValue, PHAssetMediaType.video.rawValue, duration + 1)
}
DispatchQueue.global(qos: .userInteractive).async { [weak self] in
var assetCollections = [TLAssetsCollection]()
//Camera Roll
let camerarollCollection = getSmartAlbum(subType: .smartAlbumUserLibrary, useCameraButton: useCameraButton, result: &assetCollections)
if var cameraRoll = camerarollCollection {
cameraRoll.useCameraButton = useCameraButton
assetCollections[0] = cameraRoll
DispatchQueue.main.async {
self?.delegate?.focusCollection(collection: cameraRoll)
self?.delegate?.loadCameraRollCollection(collection: cameraRoll)
}
}
//Selfies
getSmartAlbum(subType: .smartAlbumSelfPortraits, result: &assetCollections)
//Panoramas
getSmartAlbum(subType: .smartAlbumPanoramas, result: &assetCollections)
//Favorites
getSmartAlbum(subType: .smartAlbumFavorites, result: &assetCollections)
//get all another albums
getAlbum(subType: .any, result: &assetCollections)
if allowedVideo {
//Videos
getSmartAlbum(subType: .smartAlbumVideos, result: &assetCollections)
}
//Album
let albumsResult = PHCollectionList.fetchTopLevelUserCollections(with: nil)
albumsResult.enumerateObjects({ (collection, index, stop) -> Void in
guard let collection = collection as? PHAssetCollection else { return }
var assetsCollection = TLAssetsCollection(collection: collection)
assetsCollection.fetchResult = PHAsset.fetchAssets(in: collection, options: options)
if assetsCollection.count > 0, !assetCollections.contains(where: { $0.localIdentifier == collection.localIdentifier }) {
assetCollections.append(assetsCollection)
}
})
DispatchQueue.main.async {
self?.delegate?.loadCompleteAllCollection(collections: assetCollections)
}
}
}
}
| [
218940,
206013
] |
0100d41c18b734a0da276007805c0373d53b6592 | 864e47c3351fd447364754e35e58be688e7b8363 | /iOS/Mail-Direct/Mail-DirectTests/Mail_DirectTests.swift | 99353f16e9da6130d5475f3532c350068b9ea3d9 | [
"Apache-2.0"
] | permissive | Randellcar/MailDirect | 78e0583d8608eda0a11e56eb7e0a493d8a34bf8f | b4a435a1d4c15339964367aac8e08d9e03b1ad89 | refs/heads/master | 2021-06-16T12:44:06.236105 | 2017-05-12T05:46:39 | 2017-05-12T05:46:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 990 | swift | //
// Mail_DirectTests.swift
// Mail-DirectTests
//
// Created by Randell Carrido on 4/7/17.
// Copyright © 2017 AmethystWorks. All rights reserved.
//
import XCTest
@testable import Mail_Direct
class Mail_DirectTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
313357,
98333,
102437,
292902,
354345,
233517,
155694,
282672,
180280,
288834,
286788,
311372,
223316,
315476,
307289,
227428,
278638,
223350,
131191,
215164,
131198,
292992,
284826,
299174,
153776,
184505,
227513,
295098,
301279,
311519,
286958,
227578,
184570,
184575,
282909,
282913,
233762,
280887,
315706,
287041,
287043,
139589,
227654,
168281,
321894,
416104,
280939,
199029,
291192,
227725,
240016,
190871,
61857,
285090,
61859,
289189,
278970,
293306,
291267,
278989,
281037,
285150,
279008,
279013,
291311,
309744,
279029,
233978,
291333,
279050,
283153,
303636,
291358,
180771,
293419,
244269,
283184,
234036,
289332,
115270,
293448,
377418,
281166,
295536,
287346,
287352,
189057,
152203,
117397,
230040,
289434,
221852,
279206,
295599,
303793,
166582,
289462,
285371,
285372,
285373,
285374,
287422,
303803,
66242,
287433,
289502,
234217,
342762,
230125,
289518,
199414,
228088,
205568,
242433,
299776,
285444,
322313,
166676,
262951,
312108,
285487,
262962,
230199,
293693,
295746,
281433,
230234,
279392,
303972,
400239,
295798,
209785,
177019,
291712,
308107,
56208,
308112,
289698,
283558,
310182,
236461,
289727,
279498,
326635,
203757,
304110,
295927,
312314,
277509,
230410,
277524,
293910,
230423,
197657,
281626,
300068,
238639,
238651,
349255,
277597,
230499,
300135,
322663,
207979,
312434,
160891,
285820,
285828,
279685,
285830,
302213,
228491,
296086,
238743,
187544,
296092,
330913,
300202,
279728,
238769,
294074,
228542,
302274,
279747,
283847,
283852,
189652,
310497,
298212,
290022,
234733,
298221,
279792,
228600,
208124,
130338,
130343,
298291,
286018,
113987,
230729,
177484,
222541,
296270,
314709,
357719,
230756,
281957,
230765,
306542,
296303,
306559,
148867,
294275,
298374,
142729,
296335,
306579,
318875,
310692,
282022,
310701,
292292,
306631,
296392,
300489,
310732,
280013,
312782,
222675,
228827,
280032,
280041,
296433,
306673,
280055,
300536,
290300,
290301,
296448,
230913,
306692,
296461,
282141,
230943,
288309,
290358,
280130,
288326,
282183,
288327,
290390,
128599,
235095,
300630,
306776,
300644,
222832,
314998,
294529,
288392,
290443,
310923,
188048,
323217,
282271,
302754,
282276,
229029,
282280,
286391,
306874,
280251,
282303,
286399,
212688,
282327,
286423,
278233,
278234,
67292,
294622,
278240,
288491,
280300,
239341,
284401,
323316,
229113,
313081,
286459,
288516,
216839,
282378,
321295,
278293,
282417,
200498,
296755,
345919,
282438,
307025,
280410,
300894,
296806,
282474,
288619,
288620,
280430,
313203,
300918,
194429,
67463,
110480,
282518,
282519,
298909,
311199,
298920,
292782,
294843,
280514,
344013,
301008,
294886,
296941,
311282,
292858
] |
d2e37ee67e57909038269a14ab5a115196a7bae4 | 501b7655f38d3f7fd2feecbccafd9a9f5f7733b5 | /Yelp/MapKitHelper.swift | 8d4c5359c1fd06623bc48c4c480c8e0e53e5f80f | [] | no_license | udaymitra/Yelp | 90120dc3d1ddc8de092ceee5de4a964fcd5d2358 | 08388f8540ca7f0a7e8eb175a924d193774a9700 | refs/heads/master | 2021-01-10T02:03:51.442728 | 2015-09-28T06:11:56 | 2015-09-28T06:11:56 | 43,190,453 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,535 | swift | //
// MapKitHelper.swift
// Yelp
//
// Created by Soumya on 9/26/15.
// Copyright © 2015 Soumya. All rights reserved.
//
import Foundation
import MapKit
// Ended up not using this class
func MapBoundsFromCenterAndDistance(location: CLLocationCoordinate2D, distanceInMeters: Double) -> MapBounds {
let span = MKCoordinateRegionMakeWithDistance(location, distanceInMeters, distanceInMeters).span
var northWestCorner = CLLocationCoordinate2D()
var southEastCorner = CLLocationCoordinate2D()
northWestCorner.latitude = location.latitude + (span.latitudeDelta / 2)
if (northWestCorner.latitude > 90) {
northWestCorner.latitude = 90
}
northWestCorner.longitude = location.longitude - (span.longitudeDelta / 2)
if (northWestCorner.longitude < -180) {
northWestCorner.longitude += 180
}
southEastCorner.latitude = location.latitude - (span.latitudeDelta / 2)
if (southEastCorner.latitude < -90) {
southEastCorner.latitude = -90
}
southEastCorner.longitude = location.longitude + (span.longitudeDelta / 2)
if (southEastCorner.longitude > 180) {
southEastCorner.longitude -= 180
}
return MapBounds(northWest: northWestCorner, southEast: southEastCorner)
}
class MapBounds {
var northWest : CLLocationCoordinate2D
var southEast : CLLocationCoordinate2D
init(northWest : CLLocationCoordinate2D, southEast : CLLocationCoordinate2D) {
self.northWest = northWest
self.southEast = southEast
}
}
| [
-1
] |
be2122f1684519a62279b49af708e05361a2552a | 08724e4506fca131e9a6d8cd2636f2481a7dd60d | /InsulinProjectBSL/Workers/HeaderinSectionWorker/HeaderInSectionWorker.swift | 76c80f208181d8d5650cf4a3a0af1050f76f0347 | [] | no_license | Pavel71/MyBSL | c71ea4c6206712e7ad401be21397b3c88d707e3d | 34c65c25c60687a1fa6870cd129caf91097098ff | refs/heads/master | 2022-12-09T00:45:40.032120 | 2020-09-03T09:40:10 | 2020-09-03T09:40:10 | 289,276,830 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,110 | swift | //
// HeaderInSectionWorker.swift
// InsulinProjectBSL
//
// Created by PavelM on 05/09/2019.
// Copyright © 2019 PavelM. All rights reserved.
//
import Foundation
protocol HeaderInSectionWorkerProtocol {
var isExpanded:Bool {get set}
}
class HeaderInSectionWorker {
var arraySectionAllProductsExpanded = [Bool]()
var arraySectionFavoritsExpanded = [Bool]()
var arraySectionMealsExpanded = [Bool]()
var isDefaultListMeal = true
var isDefaultListAllProducts = true
var isDefaultListFavorits = true
// func updateViewModelByExpandSection(oldViewModel: [HeaderInSectionWorkerProtocol], newViewModel:[HeaderInSectionWorkerProtocol]) -> [HeaderInSectionWorkerProtocol] {
//
// fillSectionExpandedArray(viewModels: oldViewModel,arraySection: &arraySectionDefault)
// let updateViewModel = setSectionExpandedInViewModel(viewModels: newViewModel, arraySection: &arraySectionDefault)
//
// return updateViewModel
// }
func getIsDefaultListBySegment(segment: Segment) -> Bool {
switch segment {
case .allProducts: return isDefaultListAllProducts
case .favorits: return isDefaultListFavorits
case .meals: return isDefaultListMeal
}
}
func changeIsDefaultlistByCategory(segment: Segment) {
switch segment {
case .allProducts:
self.isDefaultListAllProducts = !isDefaultListAllProducts
case .favorits:
self.isDefaultListFavorits = !isDefaultListFavorits
case .meals:
self.isDefaultListMeal = !isDefaultListMeal
}
}
func updateOneSection(section: Int, currentSegment: Segment) {
switch currentSegment {
case .allProducts:
arraySectionAllProductsExpanded[section] = !arraySectionAllProductsExpanded[section]
case .favorits:
arraySectionFavoritsExpanded[section] = !arraySectionFavoritsExpanded[section]
case .meals:
arraySectionMealsExpanded[section] = !arraySectionMealsExpanded[section]
}
}
// Этот метод иде для foodViewController
func updateViewModelByExpandSection(newViewModel:[HeaderInSectionWorkerProtocol], with segment: Segment) -> [HeaderInSectionWorkerProtocol] {
var updateViewModel: [HeaderInSectionWorkerProtocol]
switch segment {
case .allProducts:
updateViewModel = setSectionExpandedInViewModel(viewModels: newViewModel,arraySection:&arraySectionAllProductsExpanded)
case .favorits:
updateViewModel = setSectionExpandedInViewModel(viewModels: newViewModel,arraySection: &arraySectionFavoritsExpanded)
case .meals:
updateViewModel = setSectionExpandedInViewModel(viewModels: newViewModel,arraySection: &arraySectionMealsExpanded)
}
return updateViewModel
}
func fillSectionExpandedArrayBySegment(viewModels: [HeaderInSectionWorkerProtocol],segment: Segment) {
switch segment {
case .allProducts:
fillSectionExpandedArray(viewModels: viewModels, arraySection: &arraySectionAllProductsExpanded)
case .favorits:
fillSectionExpandedArray(viewModels: viewModels, arraySection: &arraySectionFavoritsExpanded)
case .meals:
fillSectionExpandedArray(viewModels: viewModels, arraySection: &arraySectionMealsExpanded)
}
}
private func fillSectionExpandedArray(viewModels: [HeaderInSectionWorkerProtocol],arraySection: inout [Bool]) {
arraySection.removeAll()
viewModels.forEach { (viewModel) in
arraySection.append(viewModel.isExpanded)
}
}
// Изменим переданный массив
private func setSectionExpandedInViewModel(viewModels: [HeaderInSectionWorkerProtocol],arraySection: inout [Bool]) -> [HeaderInSectionWorkerProtocol] {
var viewModels = viewModels
if !arraySection.isEmpty && arraySection.count == viewModels.count {
for (index,isExpanded) in arraySection.enumerated() {
viewModels[index].isExpanded = isExpanded
}
}
return viewModels
}
}
| [
-1
] |
6d9516e3c850bc76091523b318da22af94d10ebe | b0333b3b90efe4746d3324495d235c2f8fbb8164 | /Capstone-Project/serviceWithBidCell.swift | e20e4462010fb21ca03ce031807c5946f3043618 | [] | no_license | alialebrahim/Capstone-Project | fc53dfa2c47481436037f73e8eff59c7b0c51e87 | ca3451ddf8cfb9af97bd1a1623df6cf9e01329ef | refs/heads/master | 2020-04-06T04:10:27.580642 | 2016-12-25T19:24:49 | 2016-12-25T19:24:49 | 65,278,052 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 833 | swift | //
// serviceWithBidCell.swift
// Capstone-Project
//
// Created by Ali Alibrahim on 11/13/16.
// Copyright © 2016 Ali Alebrahim. All rights reserved.
//
import UIKit
class serviceWithBidCell: UITableViewCell {
@IBOutlet weak var containerView: UIView!
@IBOutlet weak var bid: UILabel!
@IBOutlet weak var title: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
containerView.layer.cornerRadius = 5
containerView.layer.borderColor = UIColor(hex: 0x404040).cgColor
containerView.layer.borderWidth = 1
containerView.clipsToBounds = true
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
| [
-1
] |
2e2a5acb6f2e03a07507c2d1f925c4aa1c1fecc9 | 73df3a06cc0bd2a41c5f8628630493169c5e6eb2 | /4. Easy Browser/Easy Browser/Easy Browser/AppDelegate.swift | 91fc547c83c15bbf36cec945a7b578c661255758 | [] | no_license | tmsm1999/iOS-Development | f019cc7bb5f516ffa6d0cc87f268087a480a0f07 | e4dc2faa7507717baf152e6e54522e41e0021ace | refs/heads/master | 2021-01-02T20:01:38.939090 | 2020-06-21T20:46:57 | 2020-06-21T20:46:57 | 239,778,003 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,430 | swift | //
// AppDelegate.swift
// Easy Browser
//
// Created by Tomás Santiago on 15/02/2020.
// Copyright © 2020 Tomás Santiago. 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,
327871,
180416,
180431,
377046,
377060,
327914,
205036,
393456,
393460,
418043,
336123,
336128,
385280,
262404,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
262472,
344403,
213332,
65880,
418144,
262496,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
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,
164538,
328378,
328386,
352968,
344776,
418507,
385742,
385748,
361179,
139997,
189153,
369381,
418553,
344831,
336643,
344835,
344841,
336659,
418580,
418585,
434970,
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,
345138,
386101,
197707,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
386258,
328924,
66782,
222437,
328941,
386285,
386291,
345376,
353570,
345379,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181654,
230809,
181670,
181673,
181681,
337329,
181684,
181690,
361917,
181696,
337349,
181703,
337365,
271839,
329191,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419410,
345701,
394853,
222830,
370297,
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,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
337659,
141051,
337668,
362247,
395021,
362255,
321299,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
345964,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436132,
337833,
362413,
337844,
346057,
247759,
346063,
329697,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
329832,
329855,
329867,
329885,
411805,
346272,
100524,
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,
330267,
354855,
10828,
199249,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
338660,
338664,
264941,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
355175,
387944,
355179,
330610,
330642,
355218,
207808,
379848,
396245,
248792,
248798,
347105,
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,
175486,
249214,
175489,
249218,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
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,
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,
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,
430274,
225475,
389320,
225484,
225487,
225490,
225493,
266453,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
389380,
356640,
356643,
356646,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
250199,
250202,
332125,
250210,
348525,
332152,
389502,
250238,
332161,
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,
389892,
389926,
152370,
348978,
340789,
348982,
398139,
127814,
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,
201637,
398245,
324524,
340909,
324533,
5046,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
349180,
439294,
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,
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,
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,
415278,
415281,
415285,
415290,
415293,
349761,
415300,
333386,
333399,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
333498,
210631,
333511,
358099,
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,
333818,
350202,
350206,
350213,
268298,
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,
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,
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,
203506,
342776,
391937,
391948,
375568,
326416,
375571,
162591,
326441,
326451,
326454,
326460,
244540,
260924,
326467,
244551,
326473,
326477,
326485,
326490,
342874,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
359295,
351104,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
326598,
359366,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
359451,
261147,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
384107,
367723,
187502,
343154,
384114,
212094,
351364,
384135,
384139,
384143,
351381,
384151,
384160,
384168,
367794,
244916,
384181,
367800,
384188,
384191,
351423,
326855,
244937,
384201,
253130,
343244,
384208,
146642,
384224,
359649,
343270,
351466,
384246,
351479,
343306,
261389,
359694,
253200,
384275,
384283,
245020,
384288,
245029,
171302,
351534,
376110,
245040,
425276,
384323,
212291,
343365,
212303,
367965,
343393,
343398,
367980,
343409,
253303,
154999,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
425649,
155322,
425662,
155327,
245460,
155351,
155354,
212699,
245475,
155363,
245483,
409335,
155393,
155403,
245525,
155422,
360223,
155442,
155447,
155461,
360261,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
262005,
147317,
262008,
262011,
155516,
155521,
155525,
360326,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
384977,
393169,
155611,
155619,
253923,
155621,
253926,
327654,
393203,
360438,
393206,
393212,
155646
] |
3e1d3239c4a8c64c154ea61edba49c0aa4b8a88c | 68b6c7842fd9d69c37d512c4750a05c5c8586b45 | /BeyondMe/Resume.swift | 21b0da616e4e1d9728d9344a3e02f764b7cc0cfd | [] | no_license | JosephSon505/BeyondMe | 2cf3b0de97efcf94dfbc552d8574b3ccfc80e1c1 | 93adfe314bca69c87fb92bdf51036be23bdbffd2 | refs/heads/master | 2020-12-10T21:56:25.967634 | 2020-01-14T00:30:03 | 2020-01-14T00:30:03 | 233,721,818 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 12,004 | swift | //
// ViewController.swift
// BeyondMe
//
// Created by Joseph Son on 11/26/19.
// Copyright © 2019 Joseph Son. All rights reserved.
//
import UIKit
import FirebaseAuth
import FirebaseFirestore
import FirebaseDatabase
import MessageUI
let db = Firestore.firestore()
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, MFMessageComposeViewControllerDelegate, MFMailComposeViewControllerDelegate {
// MARK: - Variables and Outlets
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var editButton: UIButton!
var sectionHeaderHeight: CGFloat = 0.0
var model = ResumeModel.shared
var email: String = ""
// MARK: - Setup and Initialization
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
editButton.setTitle("Edit", for: .normal)
tableView.dataSource = self
tableView.delegate = self
self.getEmail()
sectionHeaderHeight = tableView.dequeueReusableCell(withIdentifier: "headerCell")?.contentView.bounds.height ?? 0
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
model.clearAllData()
self.readDatabase()
}
// MARK: Table Initialization
// enable editting the table to rearrange
func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
if sourceIndexPath.section == 0 {
model.rearrangeEducation(from: sourceIndexPath.row, to: destinationIndexPath.row)
} else {
model.rearrageWorkExperience(from: sourceIndexPath.row, to: destinationIndexPath.row)
}
}
// 2 different sections for education and work experience
func numberOfSections(in tableView: UITableView) -> Int {
return 2
}
// Get custom header cells
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
// HeaderTableViewCell is a custom cells
let cell = tableView.dequeueReusableCell(withIdentifier: "headerCell") as! HeaderTableViewCell
// setup the header with the correct title
if section == 0 {
cell.setup(title: "Education")
} else {
cell.setup(title: "Work Experience")
}
return cell.contentView
}
// full section header --> does not get cut off
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return sectionHeaderHeight
}
// return the amount of elements in each section
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 {
return model.getEducationsCount()
} else {
return model.getWorkExperiencesCount()
}
}
// return the correct custom cell for their respective sections
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// EducationCell and WorkCell are both custom cells
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "educationCell") as! EducationCell
if let education = model.educations(at: indexPath.row) {
print(education)
cell.setup(school: education.getSchool(), major: education.getMajor(), gpa: education.getGPA(), gradDay: education.getGradDate())
}
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "workCell") as! WorkCell
if let we = model.workExperiences(at: indexPath.row) {
cell.setup(company: we.getCompany(), position: we.getPosition(), startDate: we.getStartDate(), endDate: we.getEndDate())
}
return cell
}
}
// MARK: - iMessage Functions
func messageComposeViewController(_ controller: MFMessageComposeViewController, didFinishWith result: MessageComposeResult) {
switch (result) {
case .cancelled:
print("Message was cancelled")
dismiss(animated: true, completion: nil)
case .failed:
print("Message failed")
dismiss(animated: true, completion: nil)
case .sent:
print("Message was sent")
dismiss(animated: true, completion: nil)
default:
break
}
}
func sendMessage() {
let composeVC = MFMessageComposeViewController()
composeVC.messageComposeDelegate = self
// Configure the fields of the interface.
composeVC.recipients = []
composeVC.body = formatIntoMessage()
// Present the view controller modally.
if MFMessageComposeViewController.canSendText() {
self.present(composeVC, animated: true, completion: nil)
} else {
print("Can't send messages.")
}
}
// MARK: - Email
public func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
controller.dismiss(animated: true)
}
func sendEmail(type: String){
let message = formatIntoMessage()
if MFMailComposeViewController.canSendMail() {
let mail = MFMailComposeViewController()
mail.mailComposeDelegate = self
mail.setToRecipients([])
mail.setSubject(type)
mail.setMessageBody(message, isHTML: false)
present(mail, animated: true)
}
}
// MARK: - Helper Functions
// read education and work experiences from database
private func readDatabase() {
let settings = db.settings
db.settings = settings
db.collection("Education").getDocuments() { (querySnapshot, err) in
if let err = err {
print("Error getting documents: \(err)")
} else {
for users in querySnapshot!.documents {
if users.documentID == self.email {
let educations = users.data()
for education in educations.values {
let curr = education as! NSDictionary
let school: String = curr["School"] as! String
let major: String = curr["Major"] as! String
let gpa:String = curr["GPA"] as! String
let gradDate: String = curr["GradDate"] as! String
self.model.addEducation(school: school, major: major, gpa: gpa, gradDate: gradDate)
}
}
}
self.tableView.reloadData()
}
}
db.collection("Work Experience").getDocuments() { (querySnapshot, err) in
if let err = err {
print("Error getting documents: \(err)")
} else {
for document in querySnapshot!.documents {
if document.documentID == self.email {
let workExperience = document.data()
for we in workExperience.values {
let curr = we as! NSDictionary
let company = curr["Company"] as! String
let position = curr["Position"] as! String
let startDate = curr["StartDate"] as! String
let endDate = curr["EndDate"] as! String
self.model.addWorkExperience(company: company, position: position, startDate: startDate, endDate: endDate)
}
}
}
self.tableView.reloadData()
}
}
}
// get the current user's email
private func getEmail() {
if let userEmail = Auth.auth().currentUser?.email {
email = userEmail
}
}
// switch view controllers
private func switchVC(VC: String) {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let newVC = storyboard.instantiateViewController(withIdentifier: VC)
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.window?.rootViewController = newVC
}
// tap share button
func didTapContact() {
let alert = UIAlertController(title: "Share",
message: "How would you like to share your resume?",
preferredStyle: UIAlertController.Style.actionSheet)
alert.addAction(UIAlertAction(title: "Email",
style: UIAlertAction.Style.default) {
AlertAction in
self.sendEmail(type: "Resume")
})
alert.addAction(UIAlertAction(title: "Message",
style: UIAlertAction.Style.default) {
AlertAction in
self.sendMessage()
})
alert.addAction(UIAlertAction(title: "Cancel",
style: UIAlertAction.Style.cancel))
self.present(alert, animated: true) {
}
}
// formats resume into string
private func formatIntoMessage() -> String {
var message = "EDUCATION\n\n"
let educations = model.getEducations()
for edu in educations {
message.append("School: \(edu.getSchool())\n")
message.append("Major: \(edu.getMajor())\n")
message.append("GPA: \(edu.getGPA())\n")
message.append("Graduation Date: \(edu.getGradDate())\n\n")
}
message.append("\n")
message.append("WORK EXPERIENCE\n\n")
let workExperiences = model.getWorkExperiences()
for we in workExperiences {
message.append("Company: \(we.getCompany())\n")
message.append("Position: \(we.getPosition())\n")
message.append("Start Date: \(we.getStartDate())\n")
message.append("End Date: \(we.getEndDate())\n\n")
}
return message
}
// MARK: - IBActions
// log out function
@IBAction func logoutButtonPressed(_ sender: UIButton) {
do {
try Auth.auth().signOut()
} catch let error {
print(error)
}
// switch to loginViewController
self.switchVC(VC: "LoginVC")
}
// enable / disable the editting function for the table
@IBAction func editButtonPressed(_ sender: UIButton) {
tableView.isEditing = editButton.titleLabel?.text == "Edit" ? true : false
editButton.setTitle(editButton.titleLabel?.text == "Edit" ? "Done" : "Edit", for: .normal)
}
@IBAction func shareButtonPressed(_ sender: UIButton) {
didTapContact()
}
// MARK: - Prepare for Segue
// determine which setting to land on: adding education or adding work experience
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "education" {
if let addVC = segue.destination as? AddViewController {
addVC.purpose = "Education"
}
} else {
if let addVC = segue.destination as? AddViewController {
addVC.purpose = "Work"
}
}
segue.destination.modalPresentationStyle = .fullScreen
}
}
| [
-1
] |
58f5ee5d45b04333e051ab870d1542ef9053e22f | e45bbf434a34a2403bc52bf3dc5ffbb329834679 | /initial/TDDRandomGameModelTests/TDDRandomGameModelTests.swift | f055e599024f7e656fa0dd8d00c7b3c45182d4b6 | [] | no_license | JCSooHwanCho/TDDInRealWorld-Swift | 3c056a2d4a86a285949cedfd97e060f88c4dda87 | 7a1427f5d0c18af79c1abd5aadf96f3dd38fe04a | refs/heads/master | 2023-04-06T09:29:12.634387 | 2021-04-13T05:06:38 | 2021-04-13T05:06:38 | 357,167,623 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 934 | swift | //
// TDDRandomGameModelTests.swift
// TDDRandomGameModelTests
//
// Created by Joshua on 2021/04/12.
//
import XCTest
@testable import TDDRandomGameModel
class TDDRandomGameModelTests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() throws {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
360462,
16419,
229413,
204840,
344107,
155694,
229430,
319542,
163896,
180280,
352315,
376894,
352326,
196691,
385116,
237663,
254048,
319591,
221290,
352368,
204916,
131191,
196760,
426138,
173,
32941,
377009,
295098,
417988,
417994,
139479,
254170,
229597,
311519,
205035,
385262,
336120,
344313,
327929,
147717,
368905,
180493,
254226,
368916,
262421,
377114,
237856,
237857,
311597,
98610,
180535,
336183,
319821,
344401,
377169,
368981,
155990,
368984,
106847,
98657,
270701,
270706,
139640,
246137,
106874,
311685,
106888,
385417,
311691,
385422,
213403,
385454,
311727,
377264,
311738,
33211,
336317,
336320,
311745,
254406,
188871,
328152,
287198,
319981,
319987,
254456,
377338,
377343,
254465,
139792,
303636,
393751,
254488,
377376,
377386,
197167,
385588,
352829,
115270,
385615,
426576,
369235,
139872,
139892,
344696,
287352,
311941,
336518,
311945,
369289,
344715,
311949,
287374,
377489,
311954,
352917,
230040,
271000,
377497,
303771,
377500,
205471,
344738,
139939,
205487,
303793,
336564,
287417,
287422,
377539,
164560,
385747,
361176,
418520,
287452,
369385,
418546,
312052,
172792,
344827,
221948,
344828,
205568,
295682,
197386,
434957,
426774,
197399,
426775,
344865,
197411,
295724,
197422,
353070,
164656,
295729,
353078,
197431,
336702,
353109,
377686,
230234,
189275,
435039,
295776,
303972,
385893,
246643,
295798,
246648,
361337,
254850,
369538,
426895,
295824,
353195,
140204,
377772,
304051,
230332,
377790,
353215,
213957,
345033,
386006,
418776,
50143,
123881,
271350,
295927,
328700,
328706,
410627,
320516,
295942,
386056,
353290,
377869,
320527,
238610,
418837,
140310,
336929,
369701,
345132,
238639,
312373,
238651,
361535,
377926,
361543,
361566,
304222,
173166,
377972,
377983,
402565,
386189,
337039,
238743,
238765,
238769,
402613,
353479,
353481,
353482,
402634,
189653,
419029,
148696,
296153,
304351,
222440,
328940,
353523,
386294,
386301,
320770,
386306,
328971,
353551,
320796,
222494,
369956,
353584,
345396,
386359,
116026,
378172,
312648,
337225,
304456,
230729,
238927,
353616,
378209,
386412,
312689,
296307,
116084,
337281,
148867,
378244,
296329,
296335,
9619,
370071,
173491,
304564,
353719,
361927,
271843,
361963,
296433,
321009,
329225,
296461,
304656,
329232,
370197,
402985,
394794,
288309,
312889,
288327,
239198,
99938,
312940,
222832,
370296,
247416,
337534,
337535,
263809,
288392,
239250,
419478,
345752,
255649,
321199,
337591,
403148,
9936,
9937,
370388,
272085,
345814,
181975,
345821,
321247,
321249,
345833,
345834,
67315,
173814,
288512,
288516,
321302,
345879,
321310,
255776,
247590,
362283,
378668,
296755,
345919,
436031,
403267,
345929,
337745,
255829,
18262,
362327,
345951,
362337,
345955,
296806,
214895,
313199,
362352,
124798,
182144,
305026,
329622,
337815,
436131,
354212,
436137,
362417,
362431,
174019,
214984,
321480,
362443,
329695,
436191,
354272,
313319,
354280,
247785,
337895,
174057,
436205,
247791,
362480,
43014,
354316,
313357,
321583,
346162,
124984,
288828,
436285,
288833,
288834,
436292,
403525,
436301,
338001,
338003,
280661,
329814,
338007,
280675,
280677,
43110,
321637,
329829,
436329,
215164,
215166,
280712,
346271,
436383,
362659,
239793,
182456,
379071,
149703,
338119,
346314,
321745,
387296,
280802,
379106,
346346,
321772,
436470,
149760,
411906,
125199,
272658,
272660,
125217,
338218,
321840,
379186,
321860,
289110,
215385,
272729,
354676,
354677,
313727,
436608,
362881,
240002,
436611,
248194,
395659,
108944,
190871,
149916,
420253,
141728,
289189,
108972,
272813,
338356,
436661,
289232,
256477,
174593,
420369,
322078,
207393,
289332,
174648,
338489,
338490,
297560,
354911,
436832,
436834,
191082,
420463,
346737,
313971,
346740,
420471,
330379,
117396,
346772,
264856,
289434,
363163,
346779,
314040,
363211,
363230,
264928,
338662,
330474,
289518,
363263,
35583,
191235,
264968,
322316,
117517,
322319,
166676,
207640,
289576,
191283,
273207,
355130,
289598,
355137,
355139,
355146,
355154,
322395,
355165,
355178,
207727,
330609,
207732,
158593,
224145,
355217,
256922,
289690,
420773,
289703,
256935,
363438,
347055,
289727,
273344,
330689,
363458,
379844,
19399,
330708,
248796,
248797,
207838,
347103,
52200,
347123,
240630,
257024,
330754,
330763,
330772,
248872,
314436,
248901,
257094,
314448,
339030,
314467,
257125,
273515,
404593,
363641,
363644,
150657,
248961,
330888,
363669,
339100,
380061,
429214,
199839,
265379,
249002,
306346,
44203,
3246,
421048,
265412,
290000,
134366,
298208,
298212,
298213,
330984,
298221,
298228,
437505,
322824,
257305,
126237,
339234,
109861,
372009,
412971,
306494,
216386,
224586,
331090,
314710,
372054,
159066,
314720,
380271,
314739,
208244,
249204,
314741,
290173,
306559,
314751,
298374,
314758,
314760,
142729,
388487,
314766,
290207,
314783,
314789,
314791,
396711,
396712,
380337,
380338,
150965,
380357,
339398,
306639,
413137,
429542,
372227,
323080,
323089,
175639,
388632,
396827,
134686,
355876,
347694,
265798,
265804,
396882,
44635,
396895,
323172,
224883,
314998,
323196,
175741,
339584,
339585,
224901,
298661,
61101,
364207,
224946,
110268,
224958,
323264,
274115,
306890,
241361,
241365,
298720,
339715,
323331,
339720,
372496,
323346,
249626,
339745,
257830,
421672,
339783,
216918,
241495,
241528,
339841,
315273,
315274,
372626,
380821,
118685,
298909,
323507,
290745,
274371,
151497,
372701,
298980,
380908,
241692,
315432,
315434,
102445,
233517,
176175,
241716,
241720,
225351,
315465,
307289,
315487,
356447,
438377,
233589,
266357,
422019,
241808,
381073,
323729,
299174,
405687,
258239,
389313,
299203,
299209,
372941,
266449,
307435,
438511,
381172,
356602,
184575,
381208,
315673,
151839,
233762,
217380,
151847,
332083,
127284,
332085,
332089,
438596,
332101,
323913,
348492,
323916,
323920,
250192,
348500,
168281,
332123,
332127,
242023,
160110,
242033,
291192,
340357,
225670,
332167,
242058,
373134,
242078,
315810,
315811,
381347,
340398,
127427,
324039,
373197,
242139,
160225,
291311,
291333,
340490,
348682,
258581,
234036,
315960,
348732,
242237,
70209,
348742,
70215,
348749,
381517,
340558,
332378,
201308,
242277,
111208,
184940,
373358,
389745,
209530,
356989,
373375,
152195,
348806,
316049,
111253,
316053,
111258,
111259,
176808,
299699,
422596,
422599,
291530,
225995,
242386,
422617,
422626,
234217,
299759,
291585,
430849,
291592,
62220,
422673,
430865,
291604,
422680,
152365,
422703,
422709,
152374,
160571,
430910,
160575,
160580,
348998,
381773,
201551,
242529,
349026,
357218,
308076,
242541,
177019,
185211,
308092,
398206,
291712,
381829,
316298,
349067,
349072,
390045,
185250,
185254,
373687,
349121,
381897,
373706,
316364,
340955,
340974,
349171,
349175,
201720,
127992,
357379,
308243,
201755,
357414,
357423,
300084,
324666,
324667,
308287,
218186,
341073,
439384,
300135,
316520,
357486,
144496,
300150,
291959,
300151,
160891,
300158,
349316,
349318,
373903,
169104,
177296,
119962,
300187,
300188,
300201,
300202,
373945,
259268,
62665,
283852,
259280,
316627,
333011,
357595,
234742,
128251,
439562,
292107,
242954,
414990,
251153,
177428,
349462,
382258,
300343,
382269,
177484,
406861,
259406,
234831,
251213,
374109,
316765,
333160,
316787,
382330,
357762,
112017,
234898,
259475,
275859,
357786,
251298,
333220,
374191,
300489,
366037,
210390,
210391,
210392,
210393,
144867,
54765,
251378,
308723,
300536,
210433,
259599,
308756,
398869,
374296,
374299,
308764,
423453,
349726,
431649,
169518,
431663,
194110,
349763,
218696,
292425,
128587,
333388,
333393,
128599,
333408,
374372,
300644,
415338,
243307,
120427,
54893,
325231,
333430,
325245,
194180,
415375,
153251,
300714,
210603,
415420,
333503,
259781,
333509,
333517,
333520,
325346,
153319,
325352,
325371,
243472,
366360,
325404,
341796,
333610,
399147,
431916,
366381,
300848,
259899,
325439,
325445,
153415,
341836,
415567,
325457,
317269,
341847,
350044,
128862,
292712,
423789,
325492,
276341,
341879,
317304,
333688,
112509,
55167,
325503,
333701,
243591,
317323,
325515,
325518,
333722,
350109,
292771,
415655,
243637,
301008,
153554,
219101,
292836,
292837,
317415,
325619,
432116,
333817,
292858,
415741,
333828,
358410,
399373,
317467,
145435,
325674,
243759,
129076,
243767,
358456,
325694,
194666,
260207,
432240,
333940,
333955,
415881,
104587,
235662,
325776,
317587,
284826,
333991,
333996,
194782,
301279,
317664,
243962,
375039,
194820,
375051,
325905,
334103,
325912,
211235,
432421,
211238,
358703,
358709,
366930,
383332,
383336,
211326,
317831,
252308,
39324,
121245,
342450,
293303,
293310,
342466,
416197,
129483,
342476,
317901,
6606,
334290,
342498,
358882,
334309,
195045,
391655,
432618,
375276,
342536,
416286,
375333,
244269,
375343,
23092,
375351,
244281,
301638,
309830,
293448,
55881,
416341,
416351,
268899,
39530,
244347,
326287,
375440,
334481,
318106,
318107,
342682,
318130,
383667,
293556,
39614,
375526,
342762,
342763,
293612,
154359,
432893,
162561,
383754,
310036,
326429,
293664,
326433,
342820,
400166,
293672,
375609,
342847,
252741,
293711,
244568,
244570,
351077,
342887,
326505,
269178,
400252,
211836,
359298,
359299,
260996,
113542,
392074,
318364,
310176,
310178,
293800,
359338,
236461,
252847,
326581,
326587,
359364,
326601,
211914,
359381,
433115,
343005,
64485,
326635,
187374,
383983,
383982,
359406,
318461,
293886,
293893,
433165,
384016,
433174,
252958,
359478,
203830,
359495,
392290,
253029,
351344,
187506,
285814,
392318,
384131,
302216,
326804,
351390,
343203,
253099,
253100,
318639,
367799,
113850,
294074,
302274,
367810,
343234,
351446,
359647,
195808,
310497,
302325,
351478,
261377,
245019,
253216,
130348,
261425,
351537,
286013,
146762,
294218,
294219,
318805,
425304,
163175,
327024,
318848,
253317,
384393,
368011,
318864,
318868,
310692,
245161,
286129,
286132,
343476,
228795,
425405,
302531,
425418,
286172,
245223,
359930,
286202,
302590,
253451,
253452,
359950,
146964,
253463,
187938,
286244,
245287,
245292,
425535,
196164,
179801,
196187,
343647,
310889,
204397,
138863,
188016,
294529,
229001,
188048,
425626,
302754,
40614,
384695,
327358,
319177,
212685,
384720,
302802,
212716,
212717,
294638,
360177,
319233,
360195,
286494,
409394,
319292,
360252,
360264,
376669,
245599,
425825,
425833,
417654,
188292,
253829,
327557,
294807,
376732,
311199,
319392,
253856,
294823,
327596,
294843,
188348,
237504,
294850,
384964,
344013,
212942,
212946,
24532,
212951,
360417,
311281,
311282
] |
ebaa22a1114c5fbcb6c01db097978b57bbce3a0f | e3fb680ba1567e291c19a90b275a0b294c7ae852 | /Demo/Utils/AutoLayoutUtils.swift | 2340240ef2b3de1a0cfacdd7b9ea45c2b5be9190 | [
"LicenseRef-scancode-unicode",
"BSD-2-Clause"
] | permissive | stephan-tolksdorf/STULabel | cf4dbf885f89da73aca84620179fead83b185e7e | d7223af2bfa279ee562710f6f7af557d4d6e6cc6 | refs/heads/master | 2023-08-17T15:00:16.775799 | 2023-08-12T15:23:59 | 2023-08-12T15:23:59 | 139,011,725 | 117 | 23 | NOASSERTION | 2023-08-11T14:31:10 | 2018-06-28T11:55:13 | Objective-C++ | UTF-8 | Swift | false | false | 34,840 | swift | // Copyright 2017–2018 Stephan Tolksdorf
import STULabelSwift
func roundToDisplayScale(_ value: CGFloat) -> CGFloat {
let displayScale = stu_mainScreenScale()
return round(displayScale*value)/displayScale
}
public protocol ViewOrLayoutGuide : NSObjectProtocol {
var layoutViewAndBounds: (view: UIView, bounds: CGRect) { get }
var leadingAnchor: NSLayoutXAxisAnchor { get }
var trailingAnchor: NSLayoutXAxisAnchor { get }
var leftAnchor: NSLayoutXAxisAnchor { get }
var rightAnchor: NSLayoutXAxisAnchor { get }
var topAnchor: NSLayoutYAxisAnchor { get }
var bottomAnchor: NSLayoutYAxisAnchor { get }
var widthAnchor: NSLayoutDimension { get }
var heightAnchor: NSLayoutDimension { get }
var centerXAnchor: NSLayoutXAxisAnchor { get }
var centerYAnchor: NSLayoutYAxisAnchor { get }
}
extension UIView : ViewOrLayoutGuide {
public var layoutViewAndBounds: (view: UIView, bounds: CGRect) {
return (self, self.bounds)
}
}
extension UILayoutGuide : ViewOrLayoutGuide {
public var layoutViewAndBounds: (view: UIView, bounds: CGRect) {
return (owningView!, layoutFrame)
}
}
extension UILayoutPriority {
public static func +(lhs: UILayoutPriority, rhs: Float) -> UILayoutPriority {
let raw = lhs.rawValue + rhs
return UILayoutPriority(rawValue:raw)
}
public static func -(lhs: UILayoutPriority, rhs: Float) -> UILayoutPriority {
let raw = lhs.rawValue - rhs
return UILayoutPriority(rawValue:raw)
}
}
let leq: NSLayoutConstraint.Relation = .lessThanOrEqual
let geq: NSLayoutConstraint.Relation = .greaterThanOrEqual
let eq: NSLayoutConstraint.Relation = .equal
extension Array where Element == NSLayoutConstraint {
@inline(__always)
func activate() { NSLayoutConstraint.activate(self) }
@inline(__always)
func deactivate() { NSLayoutConstraint.deactivate(self) }
}
extension Sequence where Element == [NSLayoutConstraint] {
@inline(__always)
func activate() { NSLayoutConstraint.activate([NSLayoutConstraint](self.joined())) }
@inline(__always)
func deactivate() { NSLayoutConstraint.deactivate([NSLayoutConstraint](self.joined())) }
}
extension Array {
public mutating func ensureFreeCapacity(_ n: Int) {
let neededCapacity = self.count + n
let capacity = self.capacity
if neededCapacity > capacity {
reserveCapacity(Swift.max(2*capacity, neededCapacity))
}
}
}
// MARK: - Compound constraints
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide, horizontallyWithin item2: ViewOrLayoutGuide)
{
constraints.ensureFreeCapacity(2)
constrain(&constraints, item1, .leading, .greaterThanOrEqual, item2, .leading)
constrain(&constraints, item2, .trailing, .greaterThanOrEqual, item1, .trailing)
}
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide, leadingWithin item2: ViewOrLayoutGuide)
{
constraints.ensureFreeCapacity(2)
constrain(&constraints, item1, .leading, .equal, item2, .leading)
constrain(&constraints, item2, .trailing, .greaterThanOrEqual, item1, .trailing)
}
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide, trailingWithin item2: ViewOrLayoutGuide)
{
constraints.ensureFreeCapacity(2)
constrain(&constraints, item1, .leading, .greaterThanOrEqual, item2, .leading)
constrain(&constraints, item2, .trailing, .equal, item1, .trailing)
}
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide, verticallyWithin item2: ViewOrLayoutGuide)
{
constraints.ensureFreeCapacity(2)
constrain(&constraints, item1, .top, .greaterThanOrEqual, item2, .top)
constrain(&constraints, item2, .bottom, .greaterThanOrEqual, item1, .bottom)
}
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide, topWithin item2: ViewOrLayoutGuide)
{
constraints.ensureFreeCapacity(2)
constrain(&constraints, item1, .top, .equal, item2, .top)
constrain(&constraints, item2, .bottom, .greaterThanOrEqual, item1, .bottom)
}
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide, bottomWithin item2: ViewOrLayoutGuide)
{
constraints.ensureFreeCapacity(2)
constrain(&constraints, item1, .top, .greaterThanOrEqual, item2, .top)
constrain(&constraints, item2, .bottom, .equal, item1, .bottom)
}
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide,
horizontallyCenteredWithin item2: ViewOrLayoutGuide)
{
constraints.ensureFreeCapacity(2)
constrain(&constraints, item1, .centerX, .equal, item2, .centerX)
constrain(&constraints, item2, .width, .greaterThanOrEqual, item1, .width)
}
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide,
verticallyCenteredWithin item2: ViewOrLayoutGuide)
{
constraints.ensureFreeCapacity(2)
constrain(&constraints, item1, .centerY, .equal, item2, .centerY)
constrain(&constraints, item2, .height, .greaterThanOrEqual, item1, .height)
}
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide, within item2: ViewOrLayoutGuide)
{
constraints.ensureFreeCapacity(4)
constrain(&constraints, item1, horizontallyWithin: item2)
constrain(&constraints, item1, verticallyWithin: item2)
}
public func constrain(_ item1: ViewOrLayoutGuide, within item2: ViewOrLayoutGuide)
-> [NSLayoutConstraint]
{
var cs = [NSLayoutConstraint]()
constrain(&cs, item1, within: item2)
return cs
}
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide, toHorizontalEdgesOf item2: ViewOrLayoutGuide)
{
constraints.ensureFreeCapacity(2)
constrain(&constraints, item1, .leading, .equal, item2, .leading)
constrain(&constraints, item2, .trailing, .equal, item1, .trailing)
}
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide, toVerticalEdgesOf item2: ViewOrLayoutGuide)
{
constraints.ensureFreeCapacity(2)
constrain(&constraints, item1, .top, .equal, item2, .top)
constrain(&constraints, item2, .bottom, .equal, item1, .bottom)
}
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide, toEdgesOf item2: ViewOrLayoutGuide)
{
constraints.ensureFreeCapacity(4)
constrain(&constraints, item1, toHorizontalEdgesOf: item2)
constrain(&constraints, item1, toVerticalEdgesOf: item2)
}
public func constrain(_ item1: ViewOrLayoutGuide, toEdgesOf item2: ViewOrLayoutGuide)
-> [NSLayoutConstraint]
{
var cs = [NSLayoutConstraint]()
constrain(&cs, item1, toEdgesOf: item2)
return cs
}
enum HorizontalAlignmentWithinContainer {
case leading
case trailing
case center
case any
}
@inline(__always)
func constrain(_ constraints: inout [NSLayoutConstraint],
topToBottom items: [ViewOrLayoutGuide], spacing: CGFloat = 0,
loose: Bool = false,
within container:ViewOrLayoutGuide? = nil,
horizontalAlignment: HorizontalAlignmentWithinContainer? = nil)
{
guard !items.isEmpty else { return }
constraints.ensureFreeCapacity(items.count
+ (container == nil ? -1
: 1 + (horizontalAlignment != nil ? items.count : 0)))
let rel: NSLayoutConstraint.Relation = loose ? .greaterThanOrEqual : .equal
if let c = container {
if let alignment = horizontalAlignment {
for item in items {
switch alignment {
case .leading:
constrain(&constraints, item, leadingWithin: c)
case .trailing:
constrain(&constraints, item, trailingWithin: c)
case .center:
constrain(&constraints, item, horizontallyCenteredWithin: c)
case .any:
constrain(&constraints, item, horizontallyWithin: c)
}
}
}
constrain(&constraints, items.first!, .top, rel, c, .top)
}
for i in 1..<items.count {
constrain(&constraints, items[i], .top, rel, items[i - 1], .bottom, plus: spacing)
}
if let c = container {
constrain(&constraints, c, .bottom, .greaterThanOrEqual, items.last!, .bottom)
}
}
enum VerticalAlignmentWithinContainer {
case top
case bottom
case center
case any
}
@inline(__always)
func constrain(_ constraints: inout [NSLayoutConstraint],
leadingToTrailing items: [ViewOrLayoutGuide], spacing: CGFloat = 0,
loose: Bool = false,
within container: ViewOrLayoutGuide? = nil,
verticalAlignment: VerticalAlignmentWithinContainer? = nil)
{
guard !items.isEmpty else { return }
constraints.ensureFreeCapacity(items.count
+ (container == nil ? -1
: 1 + (verticalAlignment != nil ? items.count : 0)))
let rel: NSLayoutConstraint.Relation = loose ? .greaterThanOrEqual : .equal
if let c = container {
if let alignment = verticalAlignment {
for item in items {
switch alignment {
case .top:
constrain(&constraints, item, topWithin: c)
case .bottom:
constrain(&constraints, item, bottomWithin: c)
case .center:
constrain(&constraints, item, verticallyCenteredWithin: c)
case .any:
constrain(&constraints, item, verticallyWithin: c)
}
}
}
constrain(&constraints, items.first!, .leading, rel, c, .leading)
}
for i in 1..<items.count {
constrain(&constraints, items[i], .leading, rel, items[i - 1], .trailing, plus: spacing)
}
if let c = container {
constrain(&constraints, c, .trailing, .greaterThanOrEqual, items.last!, .trailing)
}
}
// MARK: - LayoutAnchor constraint helpers
@inline(__always)
public func constrain<T>(_ anchor1: NSLayoutAnchor<T>,
_ relation: NSLayoutConstraint.Relation,
_ anchor2: NSLayoutAnchor<T>,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
let c: NSLayoutConstraint
switch relation {
case .equal: c = anchor1.constraint(equalTo: anchor2, constant: offset)
case .lessThanOrEqual: c = anchor1.constraint(lessThanOrEqualTo: anchor2, constant: offset)
case .greaterThanOrEqual: c = anchor1.constraint(greaterThanOrEqualTo: anchor2, constant: offset)
@unknown case _: fatalError()
}
if priority != .required {
c.priority = priority
}
return c
}
@inline(__always)
public func constrain(_ anchor: NSLayoutDimension,
_ relation: NSLayoutConstraint.Relation,
_ constant: CGFloat = 0, priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
let c: NSLayoutConstraint
switch relation {
case .equal: c = anchor.constraint(equalToConstant: constant)
case .lessThanOrEqual: c = anchor.constraint(lessThanOrEqualToConstant: constant)
case .greaterThanOrEqual: c = anchor.constraint(greaterThanOrEqualToConstant: constant)
@unknown case _: fatalError()
}
if priority != .required {
c.priority = priority
}
return c
}
@inline(__always)
public func constrain(_ anchor1: NSLayoutDimension,
_ relation: NSLayoutConstraint.Relation,
_ anchor2: NSLayoutDimension,
multipliedBy multiplier: CGFloat, plus offset: CGFloat = 0,
priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
let c: NSLayoutConstraint
switch relation {
case .equal:
c = anchor1.constraint(equalTo: anchor2, multiplier: multiplier, constant: offset)
case .lessThanOrEqual:
c = anchor1.constraint(lessThanOrEqualTo: anchor2, multiplier: multiplier, constant: offset)
case .greaterThanOrEqual:
c = anchor1.constraint(greaterThanOrEqualTo: anchor2, multiplier: multiplier, constant: offset)
@unknown case _:
fatalError()
}
if priority != .required {
c.priority = priority
}
return c
}
@inline(__always)
public func constrain(_ anchor: NSLayoutYAxisAnchor,
_ relation: NSLayoutConstraint.Relation,
_ label: STULabel, _ baseline: STUFirstOrLastBaseline,
plusLineHeightMultipliedBy lineHeightMultiple: CGFloat,
plus offset: CGFloat, priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
let c = anchor.stu_constraint(relation, to: baseline, of: label,
plusLineHeightMultipliedBy: lineHeightMultiple, plus: offset)
if priority != .required {
c.priority = priority
}
return c
}
@inline(__always)
public func constrain(_ anchor: NSLayoutYAxisAnchor,
_ relation: NSLayoutConstraint.Relation,
positionAbove label: STULabel, _ baseline: STUFirstOrLastBaseline,
spacingMultipliedBy multiplier: CGFloat = 1,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
let c = anchor.stu_constraint(relation, toPositionAbove: baseline, of: label,
spacingMultiplier: multiplier, offset: offset)
if priority != .required {
c.priority = priority
}
return c
}
@inline(__always)
public func constrain(_ anchor: NSLayoutYAxisAnchor,
_ relation: NSLayoutConstraint.Relation,
positionBelow label: STULabel, _ baseline: STUFirstOrLastBaseline,
spacingMultipliedBy multiplier: CGFloat = 1,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
let c = anchor.stu_constraint(relation, toPositionBelow: baseline, of: label,
spacingMultiplier: multiplier, offset: offset)
if priority != .required {
c.priority = priority
}
return c
}
// MARK: - Simple constraints
// We need so many different overloads here because we want to enforce all preconditions at the
// type level (including e.g. that a leading/trailing attribute must only be constrained to
// a second leading/trailing attribute) and do that in a way that doesn't hinder's Xcode's auto
// completion.
@inline(__always)
public func constrain(_ item1: ViewOrLayoutGuide, _ attribute1: LayoutLeftRightAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: ViewOrLayoutGuide, _ attribute2: LayoutLeftRightCenterXAttribute,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
return constrain(attribute1.anchor(item1), relation, attribute2.anchor(item2),
plus: offset, priority: priority)
}
@inline(__always)
public func constrain(_ item1: ViewOrLayoutGuide, _ attribute1: LayoutCenterXAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: ViewOrLayoutGuide, _ attribute2: LayoutXAxisAttribute,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
return constrain(attribute2.anchor(item1), relation, attribute2.anchor(item2),
plus: offset, priority: priority)
}
@inline(__always)
public func constrain(_ item1: ViewOrLayoutGuide, _ attribute1: LayoutLeadingTrailingAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: ViewOrLayoutGuide, _ attribute2: LayoutLeadingTrailingCenterXAttribute,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
return constrain(attribute1.anchor(item1), relation, attribute2.anchor(item2),
plus: offset, priority: priority)
}
@inline(__always)
public func constrain(_ item1: ViewOrLayoutGuide, _ attribute1: LayoutYAxisAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: ViewOrLayoutGuide, _ attribute2: LayoutYAxisAttribute,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
return constrain(attribute1.anchor(item1), relation, attribute2.anchor(item2),
plus: offset, priority: priority)
}
@inline(__always)
public func constrain(_ item1: ViewOrLayoutGuide, _ attribute1: LayoutYAxisAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: UILayoutSupport, _ attribute2: LayoutTopBottomAttribute,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
return constrain(attribute1.anchor(item1), relation, attribute2.anchor(item2),
plus: offset, priority: priority)
}
@inline(__always)
public func constrain(_ item1: UILayoutSupport, _ attribute1: LayoutTopBottomAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: ViewOrLayoutGuide, _ attribute2: LayoutYAxisAttribute,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
return constrain(attribute1.anchor(item1), relation, attribute2.anchor(item2),
plus: offset, priority: priority)
}
@inline(__always)
public func constrain(_ item1: ViewOrLayoutGuide, _ attribute1: LayoutDimensionAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: ViewOrLayoutGuide, _ attribute2: LayoutDimensionAttribute,
multipliedBy multiplier: CGFloat = 1, plus offset: CGFloat = 0,
priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
return constrain(attribute1.anchor(item1), relation, attribute2.anchor(item2),
multipliedBy: multiplier, plus: offset, priority: priority)
}
@inline(__always)
public func constrain(_ item: ViewOrLayoutGuide, _ attribute: LayoutDimensionAttribute,
_ relation: NSLayoutConstraint.Relation,
_ constant: CGFloat, priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
return constrain(attribute.anchor(item), relation, constant, priority: priority)
}
@inline(__always)
public func constrain(_ item1: UIView, _ attribute1: LayoutBaselineAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: ViewOrLayoutGuide, _ attribute2: LayoutYAxisAttribute,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
return constrain(attribute1.anchor(item1), relation, attribute2.anchor(item2),
plus: offset, priority: priority)
}
@inline(__always)
public func constrain(_ item1: ViewOrLayoutGuide, _ attribute1: LayoutYAxisAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: UIView, _ attribute2: LayoutBaselineAttribute,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
return constrain(attribute1.anchor(item1), relation, attribute2.anchor(item2),
plus: offset, priority: priority)
}
@inline(__always)
public func constrain(_ item1: UIView, _ attribute1: LayoutBaselineAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: UIView, _ attribute2: LayoutBaselineAttribute,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
return constrain(attribute1.anchor(item1), relation, attribute2.anchor(item2),
plus: offset, priority: priority)
}
@inline(__always)
public func constrain(_ item1: ViewOrLayoutGuide, _ attribute1: LayoutYAxisAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: STULabel, _ attribute2: STUFirstOrLastBaseline,
plusLineHeightMultipliedBy lineHeightMultiple: CGFloat,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
return constrain(attribute1.anchor(item1), relation, item2, attribute2,
plusLineHeightMultipliedBy: lineHeightMultiple, plus: offset, priority: priority)
}
@inline(__always)
public func constrain(_ item1: UIView, _ attribute1: LayoutBaselineAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: STULabel, _ attribute2: STUFirstOrLastBaseline,
plusLineHeightMultipliedBy lineHeightMultiple: CGFloat,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
return constrain(attribute1.anchor(item1), relation, item2, attribute2,
plusLineHeightMultipliedBy: lineHeightMultiple, plus: offset, priority: priority)
}
@inline(__always)
public func constrain(_ item: UIView, _ attribute: LayoutBaselineAttribute,
_ relation: NSLayoutConstraint.Relation,
positionAbove label: STULabel, _ baseline: STUFirstOrLastBaseline,
spacingMultipliedBy spacingMultiplier: CGFloat = 1, plus offset: CGFloat = 0,
priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
return constrain(attribute.anchor(item), relation, positionAbove: label, baseline,
spacingMultipliedBy: spacingMultiplier, plus: offset, priority: priority)
}
@inline(__always)
public func constrain(_ item: UIView, _ attribute: LayoutBaselineAttribute,
_ relation: NSLayoutConstraint.Relation,
positionBelow label: STULabel, _ baseline: STUFirstOrLastBaseline,
spacingMultipliedBy spacingMultiplier: CGFloat = 1, plus offset: CGFloat = 0,
priority: UILayoutPriority = .required)
-> NSLayoutConstraint
{
return constrain(attribute.anchor(item), relation, positionBelow: label, baseline,
spacingMultipliedBy: spacingMultiplier, plus: offset, priority: priority)
}
// MARK: - Simple constraints (inout [NSLayoutConstraint])
@inline(__always)
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide, _ attribute1: LayoutLeftRightAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: ViewOrLayoutGuide, _ attribute2: LayoutLeftRightCenterXAttribute,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
{
constraints.append(constrain(item1, attribute1, relation, item2, attribute2,
plus: offset, priority: priority))
}
@inline(__always)
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide, _ attribute1: LayoutCenterXAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: ViewOrLayoutGuide, _ attribute2: LayoutXAxisAttribute,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
{
constraints.append(constrain(item1, attribute1, relation, item2, attribute2,
plus: offset, priority: priority))
}
@inline(__always)
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide, _ attribute1: LayoutLeadingTrailingAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: ViewOrLayoutGuide, _ attribute2: LayoutLeadingTrailingCenterXAttribute,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
{
constraints.append(constrain(item1, attribute1, relation, item2, attribute2,
plus: offset, priority: priority))
}
@inline(__always)
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide, _ attribute1: LayoutYAxisAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: ViewOrLayoutGuide, _ attribute2: LayoutYAxisAttribute,
plus offset: CGFloat = 0,
priority: UILayoutPriority = .required)
{
constraints.append(constrain(item1, attribute1, relation, item2, attribute2,
plus: offset, priority: priority))
}
@inline(__always)
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide, _ attribute1: LayoutYAxisAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: UILayoutSupport, _ attribute2: LayoutTopBottomAttribute,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
{
constraints.append(constrain(item1, attribute1, relation, item2, attribute2,
plus: offset, priority: priority))
}
@inline(__always)
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: UILayoutSupport, _ attribute1: LayoutTopBottomAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: ViewOrLayoutGuide, _ attribute2: LayoutYAxisAttribute,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
{
constraints.append(constrain(item1, attribute1, relation, item2, attribute2,
plus: offset, priority: priority))
}
@inline(__always)
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide, _ attribute1: LayoutDimensionAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: ViewOrLayoutGuide, _ attribute2: LayoutDimensionAttribute,
multipliedBy multiplier: CGFloat = 1, plus offset: CGFloat = 0,
priority: UILayoutPriority = .required)
{
constraints.append(constrain(item1, attribute1, relation, item2, attribute2,
multipliedBy: multiplier, plus: offset, priority: priority))
}
@inline(__always)
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item: ViewOrLayoutGuide, _ attribute: LayoutDimensionAttribute,
_ relation: NSLayoutConstraint.Relation,
_ constant: CGFloat,
priority: UILayoutPriority = .required)
{
constraints.append(constrain(item, attribute, relation, constant, priority: priority))
}
@inline(__always)
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: UIView, _ attribute1: LayoutBaselineAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: ViewOrLayoutGuide, _ attribute2: LayoutYAxisAttribute,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
{
constraints.append(constrain(item1, attribute1, relation, item2, attribute2,
plus: offset, priority: priority))
}
@inline(__always)
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide, _ attribute1: LayoutYAxisAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: UIView, _ attribute2: LayoutBaselineAttribute,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
{
constraints.append(constrain(item1, attribute1, relation, item2, attribute2,
plus: offset, priority: priority))
}
@inline(__always)
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: UIView, _ attribute1: LayoutBaselineAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: UIView, _ attribute2: LayoutBaselineAttribute,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
{
constraints.append(constrain(item1, attribute1, relation, item2, attribute2,
plus: offset, priority: priority))
}
@inline(__always)
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: ViewOrLayoutGuide, _ attribute1: LayoutYAxisAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: STULabel, _ attribute2: STUFirstOrLastBaseline,
plusLineHeightMultipliedBy lineHeightMultiple: CGFloat,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
{
constraints.append(constrain(item1, attribute1, relation, item2, attribute2,
plusLineHeightMultipliedBy: lineHeightMultiple, plus: offset,
priority: priority))
}
@inline(__always)
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item1: UIView, _ attribute1: LayoutBaselineAttribute,
_ relation: NSLayoutConstraint.Relation,
_ item2: STULabel, _ attribute2: STUFirstOrLastBaseline,
plusLineHeightMultipliedBy lineHeightMultiple: CGFloat,
plus offset: CGFloat = 0, priority: UILayoutPriority = .required)
{
constraints.append(constrain(item1, attribute1, relation, item2, attribute2,
plusLineHeightMultipliedBy: lineHeightMultiple, plus: offset,
priority: priority))
}
@inline(__always)
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item: UIView, _ attribute: LayoutBaselineAttribute,
_ relation: NSLayoutConstraint.Relation,
positionAbove label: STULabel, _ baseline: STUFirstOrLastBaseline,
spacingMultipliedBy spacingMultiplier: CGFloat = 1, plus offset: CGFloat = 0,
priority: UILayoutPriority = .required)
{
return constraints.append(constrain(item, attribute, relation,
positionAbove: label, baseline,
spacingMultipliedBy: spacingMultiplier, plus: offset,
priority: priority))
}
@inline(__always)
public func constrain(_ constraints: inout [NSLayoutConstraint],
_ item: UIView, _ attribute: LayoutBaselineAttribute,
_ relation: NSLayoutConstraint.Relation,
positionBelow label: STULabel, _ baseline: STUFirstOrLastBaseline,
spacingMultipliedBy spacingMultiplier: CGFloat = 1, plus offset: CGFloat = 0,
priority: UILayoutPriority = .required)
{
return constraints.append(constrain(item, attribute, relation,
positionBelow: label, baseline,
spacingMultipliedBy: spacingMultiplier, plus: offset,
priority: priority))
}
// MARK: - Layout attribute enums
public enum LayoutXAxisAttribute {
case left
case right
case leading
case trailing
case centerX
@inline(__always)
public func anchor(_ item: ViewOrLayoutGuide) -> NSLayoutXAxisAnchor {
switch self {
case .left: return item.leftAnchor
case .right: return item.rightAnchor
case .leading: return item.leadingAnchor
case .trailing: return item.trailingAnchor
case .centerX: return item.centerXAnchor
}
}
}
public enum LayoutCenterXAttribute {
case centerX
@inline(__always)
public func anchor(_ item: ViewOrLayoutGuide) -> NSLayoutXAxisAnchor {
switch self {
case .centerX: return item.centerXAnchor
}
}
}
public enum LayoutLeftRightAttribute {
case left
case right
@inline(__always)
public func anchor(_ item: ViewOrLayoutGuide) -> NSLayoutXAxisAnchor {
switch self {
case .left: return item.leftAnchor
case .right: return item.rightAnchor
}
}
}
public enum LayoutLeftRightCenterXAttribute {
case left
case right
case centerX
@inline(__always)
public func anchor(_ item: ViewOrLayoutGuide) -> NSLayoutXAxisAnchor {
switch self {
case .left: return item.leftAnchor
case .right: return item.rightAnchor
case .centerX: return item.centerXAnchor
}
}
}
public enum LayoutLeadingTrailingAttribute {
case leading
case trailing
@inline(__always)
public func anchor(_ item: ViewOrLayoutGuide) -> NSLayoutXAxisAnchor {
switch self {
case .leading: return item.leadingAnchor
case .trailing: return item.trailingAnchor
}
}
}
public enum LayoutLeadingTrailingCenterXAttribute {
case leading
case trailing
case centerX
@inline(__always)
public func anchor(_ item: ViewOrLayoutGuide) -> NSLayoutXAxisAnchor {
switch self {
case .leading: return item.leadingAnchor
case .trailing: return item.trailingAnchor
case .centerX: return item.centerXAnchor
}
}
}
public enum LayoutYAxisAttribute {
case top
case bottom
case centerY
@inline(__always)
public func anchor(_ item: ViewOrLayoutGuide) -> NSLayoutYAxisAnchor {
switch self {
case .top: return item.topAnchor
case .bottom: return item.bottomAnchor
case .centerY: return item.centerYAnchor
}
}
}
public enum LayoutTopBottomAttribute {
case top
case bottom
@inline(__always)
public func anchor(_ item: UILayoutSupport) -> NSLayoutYAxisAnchor {
switch self {
case .top: return item.topAnchor
case .bottom: return item.bottomAnchor
}
}
}
public enum LayoutBaselineAttribute {
case firstBaseline
case lastBaseline
@inline(__always)
public func anchor(_ item: UIView) -> NSLayoutYAxisAnchor {
switch self {
case .firstBaseline: return item.firstBaselineAnchor
case .lastBaseline: return item.lastBaselineAnchor
}
}
}
public enum LayoutDimensionAttribute {
case width
case height
@inline(__always)
public func anchor(_ item: ViewOrLayoutGuide) -> NSLayoutDimension {
switch self {
case .width: return item.widthAnchor
case .height: return item.heightAnchor
}
}
}
| [
-1
] |
b8b3d7d777d6ccb4901184d16c73097f36c31d1e | d234a95e6d46f08359a062f2ae2cb4fb8e131cc1 | /Africa/Africa/Model/LocationModel.swift | afc42471bb870519eaeef27567ad3bdf371aa49a | [] | no_license | timscodebase/iOS-14-Apps | 92945cdfa3287860ad18c9fd71d16d1976c3abc8 | 0101d6778e3306b61421f137b08c0774892a7a1a | refs/heads/main | 2023-06-11T19:52:41.448814 | 2021-07-01T23:13:24 | 2021-07-01T23:13:24 | 382,177,275 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 333 | swift |
import Foundation
import MapKit
struct NationalParkLocation: Codable, Identifiable {
var id: String
var name: String
var image: String
var latitude: Double
var longitude: Double
// Computed Property
var location: CLLocationCoordinate2D {
CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
}
}
| [
358595,
358494
] |
1752a16bbc1208930214147a4f82e2002c1c4895 | 443fd56adeddc053e06c44cd14d41905cbee0ec3 | /Example/Tests/Tests.swift | 01188bfc917d48dbd90d1e8cc564742ebd83d3b8 | [
"MIT"
] | permissive | badalpub1991/BASReport | 9fde313c362ba0b50f5a157bbeb34e0377004e2a | 0eb03eede166f650ccb54ef3a1d5b7dd4fe1be19 | refs/heads/master | 2020-08-10T15:04:53.087349 | 2020-05-24T06:48:15 | 2020-05-24T06:48:15 | 214,365,030 | 16 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 746 | swift | import XCTest
import BASReport
class Tests: 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.measure() {
// Put the code you want to measure the time of here.
}
}
}
| [
276492,
360491,
159807,
276543,
280649,
223318,
288857,
227417,
194652,
276577,
43109,
276582,
276585,
223340,
276589,
227439,
276592,
276603,
276606,
141450,
311435,
276627,
184475,
196773,
129203,
176314,
227528,
278742,
278746,
276709,
276710,
276715,
233715,
157944,
227576,
168188,
276753,
276760,
278810,
262450,
278846,
164162,
278863,
276821,
276835,
276847,
278898,
178571,
278954,
278965,
276920,
278969,
278985,
176594,
227813,
279022,
186893,
223767,
223769,
277017,
277029,
301634,
369220,
277066,
166507,
277101,
277118,
184962,
225933,
225936,
277138,
277142,
164512,
225956,
225962,
209581,
154291,
154294,
199366,
225997,
164563,
277204,
119513,
363231,
201442,
209660,
234241,
226051,
209670,
277254,
234256,
234268,
105246,
348959,
228129,
234280,
234283,
234286,
234301,
234304,
162626,
234311,
234312,
234317,
277327,
234323,
234326,
277339,
234335,
234340,
234343,
234346,
234349,
277360,
213876,
277366,
234361,
234367,
234372,
234377,
234381,
226194,
234387,
234392,
279456,
277410,
234404,
234409,
275371,
234412,
234419,
234430,
275397,
234438,
226249,
234450,
234451,
234454,
234457,
275418,
234463,
234466,
179176,
234482,
234492,
277505,
234498,
277510,
234503,
234506,
234509,
277517,
197647,
277518,
295953,
234517,
281625,
234530,
234534,
275495,
234539,
275500,
310317,
277550,
275505,
234548,
277563,
7229,
7230,
230463,
7231,
156733,
234560,
277566,
234565,
234569,
207953,
277585,
296018,
234583,
234584,
275547,
277596,
234594,
234603,
281707,
275565,
234612,
300150,
398457,
234622,
275590,
253063,
234631,
277640,
302217,
226451,
277651,
275607,
119963,
234652,
275625,
208043,
226479,
203989,
363744,
195811,
285929,
204022,
204041,
199971,
277800,
277803,
113966,
277806,
226608,
226609,
277821,
277824,
277825,
277831,
226632,
277838,
277841,
222548,
277844,
277845,
224605,
224606,
142689,
277862,
173420,
277868,
277871,
279919,
226675,
277882,
142716,
275838,
275839,
277890,
277891,
275847,
277896,
277897,
230799,
296338,
277907,
206228,
226711,
226712,
277927,
277936,
277939,
296375,
277946,
277949,
296387,
277962,
282060,
277965,
277974,
228823,
228824,
277977,
277980,
277983,
277988,
296425,
277993,
277994,
277997,
278002,
153095,
192010,
65041,
204313,
278060,
276040,
366154,
276046,
243292,
298590,
276088,
278140,
276097,
276100,
276101,
278160,
276116,
276117,
276120,
278170,
280220,
276126,
278191,
278195,
276148,
296628,
278201,
276156,
278214,
323276,
9936,
9937,
276179,
276180,
216795,
216796,
276195,
313065,
419569,
276210,
276219,
227091,
184086,
278299,
276257,
278307,
288547,
276279,
276282,
276283,
276287,
276294,
276311,
276332,
110452,
255872,
44952,
247712,
276394,
276401,
276408,
161722,
276413,
153552,
153566,
278518
] |
7efc10038c9445accb2310cf08e9d857747fe190 | 1fb29b4cee69744092547016a974d865486bd596 | /mac/AppKit/Swift/NSWindow/NSWindowSB_doc/NSWindowSB_doc/ViewController.swift | cad763e8cfe2e4cf2f3f9580314703a99f4fcde8 | [] | no_license | johndpope/workbook | e9fe991b18d477a7013824a016ea490403bf2b47 | 484722549e0c5fe85913996db4fbde41ee371a1d | refs/heads/master | 2021-01-17T07:32:31.716558 | 2015-03-26T14:38:11 | 2015-03-26T14:38:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,363 | swift | //
// ViewController.swift
// NSWindowSB_doc
//
// Created by air on 2015/02/17.
// Copyright (c) 2015年 oomori. All rights reserved.
//
import Cocoa
class ViewController: NSViewController {
var windowArray : NSMutableArray = []
@IBAction func function001(sender: AnyObject) {
var window : NSWindow = NSWindow(contentRect: NSMakeRect(0, 0, 800, 600), styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask, backing: .Buffered, defer: false)
windowArray.addObject(window)
window.center()
window.title = "Minimal Swift WebKit Browser"
window.orderFront(self)
window.makeKeyAndOrderFront(self)
}
//NSWindowSB_doc windowController()
@IBAction func function002(sender: AnyObject) {
var window : NSWindow = NSWindow(contentRect: NSMakeRect(0, 0, 300, 200), styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask, backing: .Buffered, defer: false)
windowArray.addObject(window)
window.center()
window.title = "Window"
window.orderFront(self)
window.makeKeyAndOrderFront(self)
//ウインドウのNSWinodowControllerを取得
var windowContoroller : NSWindowController = sender.window.windowController() as NSWindowController
NSLog("%@",windowContoroller.description )
windowContoroller.close()
}
//NSWindowSB_doc
@IBAction func function003(sender: AnyObject) {
}
//NSWindowSB_doc
@IBAction func function004(sender: AnyObject) {
}
//NSWindowSB_doc
@IBAction func function005(sender: AnyObject) {
}
//NSWindowSB_doc
@IBAction func function006(sender: AnyObject) {
}
//NSWindowSB_doc
@IBAction func function007(sender: AnyObject) {
}
//NSWindowSB_doc
@IBAction func function008(sender: AnyObject) {
}
//NSWindowSB_doc
@IBAction func function009(sender: AnyObject) {
}
//NSWindowSB_doc
@IBAction func function010(sender: AnyObject) {
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override var representedObject: AnyObject? {
didSet {
// Update the view, if already loaded.
}
}
}
| [
-1
] |
a8364196211eb17bdf0ff5be5ba1a88341e645a0 | 321ecd69ad476fa08fe6280b5250ecc62ee8f256 | /SecondKadai/NameViewController.swift | ff058c8cb6a83037d935007e3de83398d16d26a9 | [] | no_license | take0327take/SecondKadaiApp | b1883a170cfb4c7aa84befc40e04bd184aa192ed | 5839d412144d36190ccbf90682a840eea79202ba | refs/heads/master | 2020-09-10T23:18:54.887806 | 2016-08-21T06:40:45 | 2016-08-21T06:40:45 | 66,181,507 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,077 | swift | //
// NameViewController.swift
// SecondKadai
//
// Created by TakeshiTakeuchi on 2016/08/21.
// Copyright © 2016年 jp.techacademy.takeshi.takeuchi. All rights reserved.
//
import UIKit
class NameViewController: UIViewController {
@IBOutlet weak var label: UILabel!
var name :String! = "name"
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view
let result = name
label.text = "こんにちは、 \(result) さん"
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
07e70e9a38f575d80b8dd7387a3de4e30616d992 | e85667f91bcbd75c8561af080527ce420451ba7b | /FlyportAppTests/MapViewModelTests.swift | 27f41458ece305e075528ad0a6fd21d8b9d4a028 | [] | no_license | DovydasKi/FlyportApp | 3ca418426ca97b22685778bd814319878ddb3fc0 | a2bf214029fe45127c25ed1887f809ed5a1531d3 | refs/heads/master | 2023-05-02T02:12:26.407762 | 2021-05-25T05:19:12 | 2021-05-25T05:19:12 | 335,014,054 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 641 | swift | //
// MapViewModelTests.swift
// FlyportAppTests
//
// Created by Dovydas Kiriliauskas on 2021-03-21.
// Copyright © 2021 Dovydas Kiriliauskas. All rights reserved.
//
import XCTest
@testable import FlyportApp
class MapViewModelTests: XCTestCase {
public func testInit() {
let viewModel = MapViewModel(number: "123", mapType: .registration)
XCTAssertEqual(viewModel.title, LocalizationKeys.yourRegistrationTable.localized())
XCTAssertEqual(viewModel.number, "123")
XCTAssertEqual(viewModel.destinationTitle, LocalizationKeys.yourRegistrationTable.localized() + "123")
XCTAssertEqual(viewModel.coordinates.count, 4)
}
}
| [
-1
] |
f63cb2fa89ea78d699e6880e9579fd0fcff3fd40 | 7d6856eb7b3af41ac77a31f6fed6627f73c683c1 | /tutorialspoint.swift | 97ac6ccb3a7dab8adc52f0c0a1cddd21bb080688 | [] | no_license | kurt/swift-basics | ff15ddb70b8887fc09a7587ba4d208aa37d169a2 | 151c0f2ba78efe10cfd3d31b03875db67f4046ae | refs/heads/master | 2022-12-18T17:23:52.671776 | 2020-09-17T04:28:01 | 2020-09-17T04:28:01 | 296,217,355 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 713 | swift |
// this produces an error because Swift is type checking...
//-------------------------
//var varA = 42
//varA = "This is hello"
//print(varA)
//-------------------------
// varA is inferred to be of type Int
var varA = 42
print(varA)
// varB is inferred to be of type Double
var varB = 3.14159
print(varB)
// varC is also inferred to be of type Double
var varC = 3 + 0.14159
print(varC)
print("Items to print", separator: "Value " , terminator: "Value")
// E.g. of print statement.
print("Value one")
// prints "Value one \n" Adds, \n as terminator and " " as separator by default
print("Value one","Value two", separator: " Next Value" , terminator: " End")
//prints "Value one Next Value Value two End" | [
-1
] |
5a6c0a3c0369bae403c44ad673af7ab36e7f01fa | 4202c1f8187d293af5be78d7cd4d73839be792e7 | /InstagramAcademy/Controllers/CoreTabs/ExploreViewController.swift | e8b3adddefd9bf046d3008200ceac32a48fd5747 | [] | no_license | HieuTong/InstagramAcademy | 828e97def1dabd4ba8b3c8faae2f21f95d7936f9 | f614776fe003898c74211bfcbe9085fc7e361dde | refs/heads/master | 2023-05-30T04:51:22.311200 | 2021-06-13T06:33:23 | 2021-06-13T06:33:23 | 363,358,552 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,327 | swift | //
// ExploreViewController.swift
// InstagramAcademy
//
// Created by HieuTong on 5/1/21.
//
import UIKit
class ExploreViewController: UIViewController {
private let searchBar: UISearchBar = {
let searchBar = UISearchBar()
searchBar.placeholder = "Search"
searchBar.backgroundColor = .secondarySystemBackground
return searchBar
}()
private var models = [UserPost]()
private var collectionView: UICollectionView?
private var tabbedSearchCollectionView: UICollectionView?
private let dimmedView: UIView = {
let view = UIView()
view.backgroundColor = .black
view.alpha = 0
view.isHidden = true
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .systemBackground
configureSearchBar()
configureExploreCollection()
configureDimmedView()
configureTabbedSearch()
}
private func configureSearchBar() {
navigationController?.navigationBar.topItem?.titleView = searchBar
searchBar.delegate = self
}
private func configureExploreCollection() {
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .vertical
layout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
layout.itemSize = CGSize(width: (view.width - 4) / 3, height: (view.width - 4) / 3)
layout.minimumLineSpacing = 1
layout.minimumInteritemSpacing = 1
collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
collectionView?.register(PhotoCollectionViewCell.self, forCellWithReuseIdentifier: PhotoCollectionViewCell.identifier)
collectionView?.delegate = self
collectionView?.dataSource = self
guard let collectionView = collectionView else { return }
view.addSubview(collectionView)
}
private func configureTabbedSearch() {
let layout = UICollectionViewFlowLayout()
layout.itemSize = CGSize(width: view.width / 3, height: 52)
layout.scrollDirection = .horizontal
tabbedSearchCollectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
tabbedSearchCollectionView?.backgroundColor = .yellow
tabbedSearchCollectionView?.isHidden = true
guard let tabbedSearchCollectionView = tabbedSearchCollectionView else { return }
tabbedSearchCollectionView.delegate = self
tabbedSearchCollectionView.dataSource = self
view.addSubview(tabbedSearchCollectionView)
}
private func configureDimmedView() {
view.addSubview(dimmedView)
let gesture = UITapGestureRecognizer(target: self, action: #selector(didCancelSearch))
gesture.numberOfTouchesRequired = 1
gesture.numberOfTapsRequired = 1
dimmedView.addGestureRecognizer(gesture)
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
collectionView?.frame = view.bounds
dimmedView.frame = view.bounds
tabbedSearchCollectionView?.frame = CGRect(x: 0, y: view.safeAreaInsets.top, width: view.width, height: 60)
}
}
extension ExploreViewController: UISearchBarDelegate {
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
didCancelSearch()
guard let text = searchBar.text, !text.isEmpty else { return }
query(text)
}
func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) {
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Cancel", style: .plain, target: self, action: #selector(didCancelSearch))
dimmedView.isHidden = false
UIView.animate(withDuration: 0.2) {
self.dimmedView.alpha = 0.4
} completion: { (_) in
self.tabbedSearchCollectionView?.isHidden = false
}
}
@objc private func didCancelSearch() {
searchBar.resignFirstResponder()
navigationItem.rightBarButtonItem = nil
self.tabbedSearchCollectionView?.isHidden = true
UIView.animate(withDuration: 0.2) {
self.dimmedView.alpha = 0
} completion: { (_) in
self.dimmedView.isHidden = true
}
}
private func query(_ text: String) {
//perfom the search in the back end
}
}
extension ExploreViewController: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
if collectionView == tabbedSearchCollectionView {
return 0
}
return 100
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
if collectionView == tabbedSearchCollectionView {
return UICollectionViewCell()
}
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: PhotoCollectionViewCell.identifier, for: indexPath) as! PhotoCollectionViewCell
// cell.configure(with: )
cell.configureImage(debug: "test")
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
if collectionView == tabbedSearchCollectionView {
//change search context
return
}
collectionView.deselectItem(at: indexPath, animated: true)
// let model = models[indexPath.row]
let user = User(username: "joe", name: (first: "", last: ""), birthDate: Date(), profilePhoto: URL(string: "https://www.google.com")!, gender: .female, counts: UserCount(followers: 1, following: 1, posts: 1), joinDate: Date())
let post = UserPost(postType: .photo, thumbnailImage: URL(string: "https://www.google.com")!, postURL: URL(string: "https://www.google.com")!, caption: nil, likeCount: [], comments: [], createDate: Date(), taggedUsers: [], owner: user)
let vc = PostViewController(model: post)
vc.title = post.postType.rawValue
vc.navigationItem.largeTitleDisplayMode = .never
navigationController?.pushViewController(vc, animated: true)
}
}
| [
-1
] |
9e067210df6b93878e850538373ddbbe9f17a6bc | eac7e2953f608166d27bed6a15525d7d2a91a1d6 | /VacationSpots/VacationImage.swift | f42d202fee1adc5a7bb10c97dd51946338ec8aa4 | [] | no_license | colbygatte/VacationSpots | 28ffc18d43fecf938c28598d02110539dd55d546 | ae4d1611dddfeb7d75a2f477987a4f42d5906fcf | refs/heads/master | 2021-01-13T09:29:08.265225 | 2016-10-28T14:50:36 | 2016-10-28T14:50:36 | 72,075,895 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 381 | swift | //
// VacationImage.swift
// VacationSpots
//
// Created by Colby Gatte on 10/26/16.
// Copyright © 2016 colbyg. All rights reserved.
//
import UIKit
class VacationImage: NSObject {
var imageDescription: String!
var image: UIImage!
init(_ image: UIImage, description: String) {
self.image = image
self.imageDescription = description
}
}
| [
-1
] |
482734460a6d173429180d08756a681cbe139073 | 555c8ab3b9d79d15292ecccd42bba778538d95a5 | /COOKBOOK/Views/AboutUs/AboutUsView.swift | 4cdd8660a8f0aab9208dbd9253073ddab4c5e3a9 | [] | no_license | Z1Z0/COOKBOOK | 0f9ce50bd15766e108af9b6e077a382024dc2328 | 77b1e4a94ac808290884d3affe0171b07eb48141 | refs/heads/master | 2022-11-25T16:09:52.439936 | 2020-07-21T20:59:02 | 2020-07-21T20:59:02 | 237,779,862 | 1 | 0 | null | 2020-03-12T19:48:28 | 2020-02-02T14:02:49 | Swift | UTF-8 | Swift | false | false | 6,824 | swift | //
// AboutUsView.swift
// COOKBOOK
//
// Created by Ahmed Abd Elaziz on 4/25/20.
// Copyright © 2020 Ahmed Abd Elaziz. All rights reserved.
//
import Foundation
import UIKit
import Firebase
@objc protocol GoToAboutUsDelegate: class {
@objc func goToAboutUs()
}
class AboutUsView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
layoutUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
fileprivate let widthConstant: CGFloat = 1.3
weak var delegate: GoToAboutUsDelegate?
lazy var scrollView: UIScrollView = {
let scrollView = UIScrollView()
scrollView.backgroundColor = .white
scrollView.translatesAutoresizingMaskIntoConstraints = false
return scrollView
}()
func setupScrollViewConstraints() {
NSLayoutConstraint.activate([
scrollView.topAnchor.constraint(equalTo: topAnchor),
scrollView.bottomAnchor.constraint(equalTo: bottomAnchor),
scrollView.leadingAnchor.constraint(equalTo: leadingAnchor),
scrollView.trailingAnchor.constraint(equalTo: trailingAnchor)
])
}
lazy var cookbookLabel: UILabel = {
let cookbookLabel = UILabel()
cookbookLabel.text = "COOKBOOK"
cookbookLabel.textColor = .customDarkGray()
cookbookLabel.font = UIFont(name: "AvenirNext-Bold", size: 28)
cookbookLabel.translatesAutoresizingMaskIntoConstraints = false
return cookbookLabel
}()
func setupCookbookLabelConstraints() {
NSLayoutConstraint.activate([
cookbookLabel.centerXAnchor.constraint(equalTo: centerXAnchor),
cookbookLabel.topAnchor.constraint(equalTo: scrollView.topAnchor, constant: 16)
])
}
lazy var cookingImage: UIImageView = {
let cookingImage = UIImageView()
cookingImage.image = UIImage(named: "cookingvector")
cookingImage.contentMode = .scaleAspectFill
cookingImage.clipsToBounds = true
cookingImage.translatesAutoresizingMaskIntoConstraints = false
return cookingImage
}()
func setupCookingImageConstraints() {
NSLayoutConstraint.activate([
cookingImage.topAnchor.constraint(equalTo: cookbookLabel.bottomAnchor, constant: 16),
cookingImage.centerXAnchor.constraint(equalTo: centerXAnchor),
cookingImage.widthAnchor.constraint(equalToConstant: (self.frame.width / 2) + 50),
cookingImage.heightAnchor.constraint(equalToConstant: (self.frame.width / 2) + 50)
])
}
lazy var aboutCookbookLabel: UILabel = {
let aboutCookbookLabel = UILabel()
aboutCookbookLabel.textColor = .customLightDarkGray()
aboutCookbookLabel.numberOfLines = 0
aboutCookbookLabel.font = UIFont(name: "AvenirNext-Medium", size: 16)
aboutCookbookLabel.translatesAutoresizingMaskIntoConstraints = false
return aboutCookbookLabel
}()
func setupAboutCookbookLabelConstraints() {
NSLayoutConstraint.activate([
aboutCookbookLabel.topAnchor.constraint(equalTo: cookingImage.bottomAnchor, constant: 16),
aboutCookbookLabel.centerXAnchor.constraint(equalTo: centerXAnchor),
aboutCookbookLabel.widthAnchor.constraint(equalToConstant: frame.width / widthConstant)
])
}
lazy var informationLabel: UILabel = {
let informationLabel = UILabel()
informationLabel.textColor = .customDarkGray()
informationLabel.font = UIFont(name: "AvenirNext-DemiBold", size: 16)
informationLabel.numberOfLines = 0
informationLabel.translatesAutoresizingMaskIntoConstraints = false
return informationLabel
}()
func setupInformationLabelConstraints() {
NSLayoutConstraint.activate([
informationLabel.topAnchor.constraint(equalTo: aboutCookbookLabel.bottomAnchor, constant: 16),
informationLabel.centerXAnchor.constraint(equalTo: centerXAnchor),
informationLabel.widthAnchor.constraint(equalToConstant: frame.width / widthConstant)
])
}
lazy var sendEmailButton: UIButton = {
let sendEmailButton = UIButton(type: .system)
sendEmailButton.setTitle("Contact us", for: .normal)
sendEmailButton.titleLabel?.font = UIFont(name: "AvenirNext-Bold", size: 14)
sendEmailButton.backgroundColor = .CustomGreen()
sendEmailButton.setTitleColor(.white, for: .normal)
sendEmailButton.layer.cornerRadius = 8.0
sendEmailButton.addTarget(delegate, action: #selector(delegate?.goToAboutUs), for: .touchUpInside)
sendEmailButton.translatesAutoresizingMaskIntoConstraints = false
return sendEmailButton
}()
func setupSendEmailButtonConstraints() {
NSLayoutConstraint.activate([
sendEmailButton.topAnchor.constraint(equalTo: informationLabel.bottomAnchor, constant: 16),
sendEmailButton.heightAnchor.constraint(equalToConstant: 55),
sendEmailButton.widthAnchor.constraint(equalToConstant: frame.width / widthConstant),
sendEmailButton.centerXAnchor.constraint(equalTo: centerXAnchor),
sendEmailButton.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor, constant: -80)
])
}
lazy var banner: GADBannerView = {
var banner = GADBannerView()
banner = GADBannerView(adSize: kGADAdSizeBanner)
banner.adUnitID = "ca-app-pub-3727927641788977/2917288980"
banner.load(GADRequest())
banner.translatesAutoresizingMaskIntoConstraints = false
return banner
}()
func setupBannerConstraints() {
NSLayoutConstraint.activate([
banner.centerXAnchor.constraint(equalTo: centerXAnchor),
banner.heightAnchor.constraint(equalToConstant: 50),
banner.widthAnchor.constraint(equalToConstant: 350),
banner.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -16)
])
}
func addSubviews() {
addSubview(scrollView)
addSubview(banner)
scrollView.addSubview(cookbookLabel)
scrollView.addSubview(cookingImage)
scrollView.addSubview(aboutCookbookLabel)
scrollView.addSubview(informationLabel)
scrollView.addSubview(sendEmailButton)
}
func layoutUI() {
addSubviews()
setupBannerConstraints()
setupScrollViewConstraints()
setupCookbookLabelConstraints()
setupCookingImageConstraints()
setupAboutCookbookLabelConstraints()
setupInformationLabelConstraints()
setupSendEmailButtonConstraints()
}
}
| [
-1
] |
08786bf1dea1584edbb6498a757c1ef2b6cb5072 | 0683722f33e4cf10f349bb4cb1d6acf16c212db9 | /Source/XCode/Modules/RecipeStore/RecipeStoreTests/RecipeStoreSpecs/RecipeStoreSpecs.swift | ca0fc15516bf757fca5dde2c8e73074a7591dab2 | [
"MIT"
] | permissive | CS-Development/DevelopTogetherProject | daba31538110decc099622f1b838b7e214c8be72 | 0bd5744187237dfa9cfda4b53ecbc15ed3ef792d | refs/heads/main | 2023-06-23T19:59:46.229537 | 2021-07-19T10:50:07 | 2021-07-19T10:50:07 | 348,423,792 | 0 | 2 | MIT | 2021-07-19T10:50:08 | 2021-03-16T16:50:16 | Swift | UTF-8 | Swift | false | false | 1,578 | swift | //
// RecipeStoreSpecs.swift
// RecipeStoreTests
//
// Created by Christian Slanzi on 05.05.21.
//
import Foundation
protocol RecipeStoreSpecs {
func test_retrieve_deliversEmptyOnEmptyCache() throws
func test_retrieve_hasNoSideEffectsOnEmptyCache() throws
func test_retrieve_deliversFoundValuesOnNonEmptyCache() throws
func test_retrieve_hasNoSideEffectsOnNonEmptyCache() throws
func test_insert_deliversNoErrorOnEmptyCache() throws
func test_insert_deliversNoErrorOnNonEmptyCache() throws
func test_insert_overridesPreviouslyInsertedCacheValues() throws
func test_delete_deliversNoErrorOnEmptyCache() throws
func test_delete_hasNoSideEffectsOnEmptyCache() throws
func test_delete_deliversNoErrorOnNonEmptyCache() throws
func test_delete_emptiesPreviouslyInsertedCache() throws
func test_storeSideEffects_runSerially() throws
}
protocol FailableRetrieveRecipeStoreSpecs: RecipeStoreSpecs {
func test_retrieve_deliversFailureOnRetrievalError() throws
func test_retrieve_hasNoSideEffectsOnFailure() throws
}
protocol FailableInsertRecipeStoreSpecs: RecipeStoreSpecs {
func test_insert_deliversErrorOnInsertionError() throws
func test_insert_hasNoSideEffectsOnInsertionError() throws
}
protocol FailableDeleteRecipeStoreSpecs: RecipeStoreSpecs {
func test_delete_deliversErrorOnDeletionError() throws
func test_delete_hasNoSideEffectsOnDeletionError() throws
}
typealias FailableRecipeStoreSpecs = FailableRetrieveRecipeStoreSpecs & FailableInsertRecipeStoreSpecs & FailableDeleteRecipeStoreSpecs
| [
-1
] |
e3e9d60469d953711122c6d7de228b62a8422b43 | 10de51138bc1192c31ff2b513061f726f9aa220c | /173.swift | a87c31b7c43da45d4ee09b84b46b4e43632955e9 | [
"WTFPL"
] | permissive | LispLY/leetcode-solutions | ddd2c9da804bbd36c6ff196077ee32ce15b5ad9d | 840b453e7191db5c171af50ec8bfe9d8923957b9 | refs/heads/master | 2023-04-09T22:09:12.705466 | 2021-04-11T08:16:28 | 2021-04-11T08:16:28 | 284,222,931 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,292 | swift | /**
* Definition for a binary tree node.
* public class TreeNode {
* public var val: Int
* public var left: TreeNode?
* public var right: TreeNode?
* public init() { self.val = 0; self.left = nil; self.right = nil; }
* public init(_ val: Int) { self.val = val; self.left = nil; self.right = nil; }
* public init(_ val: Int, _ left: TreeNode?, _ right: TreeNode?) {
* self.val = val
* self.left = left
* self.right = right
* }
* }
*/
class BSTIterator {
private var nodes = [TreeNode]()
private func pushLeftChildren(_ node: TreeNode?) {
var node = node
while node != nil {
nodes.append(node!)
node = node?.left
}
}
init(_ root: TreeNode?) {
guard let root = root else { return }
pushLeftChildren(root)
}
func next() -> Int {
let result = nodes.removeLast()
if let right = result.right {
pushLeftChildren(right)
}
return result.val
}
func hasNext() -> Bool {
return !nodes.isEmpty
}
}
/**
* Your BSTIterator object will be instantiated and called as such:
* let obj = BSTIterator(root)
* let ret_1: Int = obj.next()
* let ret_2: Bool = obj.hasNext()
*/ | [
-1
] |
3e89a910a20ca3ed4d8529f824c9e821860ea50c | 7628aac98e384124d74724354d3b54475aaca4c0 | /GetDonate/GetDonate/AppConstant/GDFont.swift | e35a89b741e3bd44224e678d057fdd62bb3438e4 | [] | no_license | ahmedkhder/gd-ios | fa7066a7bb5a972837ed3e1bf24cc6acb715d262 | 8286e855df4c9556e8cab08bbf515d3e759068a1 | refs/heads/main | 2023-02-28T22:39:25.466186 | 2021-02-05T23:15:37 | 2021-02-05T23:15:37 | 327,593,487 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 410 | swift | //
// GDFont.swift
// GetDonate
//
// Created by Shiva Kr. on 25/01/21.
//
import Foundation
import UIKit
enum Font: String {
case Bold = "Roboto-Bold"
case Light = "Roboto-Light"
case Medium = "Roboto-Medium"
case Regular = "Roboto-Regular"
case SemiBold = "Roboto-SemiBold"
func of(size : CGFloat) -> UIFont {
return UIFont(name: self.rawValue, size: size)!
}
}
| [
-1
] |
d608bad8e3e11f6189d539c0a7cd7272746ad74b | d81b6a06a6ff3dfa6dd3fe7f24b24a2d4e01fae7 | /FitnessApp/HomeViewController.swift | 8b3687e3bfb4b91603018a54410b06dc1fce49a9 | [
"MIT"
] | permissive | 5stralia/FitnessApp | 0cfa29671c0a9cde8ac3dce51f435f0a368e0a5b | acb267be6ea391826d0682b2e979ce0a5046a25a | refs/heads/main | 2023-06-11T18:20:35.121688 | 2021-06-21T14:16:52 | 2021-06-21T14:16:52 | 279,562,037 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,245 | swift | //
// ViewController.swift
// FitnessApp
//
// Created by 최호주 on 2021/06/02.
//
import UIKit
class HomeViewController: UIViewController {
@IBOutlet weak var goalDescriptionLabel: UILabel!
@IBOutlet weak var goalStatusLabel: UILabel!
@IBOutlet weak var initialGoadStatusLabel: UILabel!
@IBOutlet weak var currentGoadStatusLabel: UILabel!
@IBOutlet weak var finishedGoalStatusLabel: UILabel!
@IBOutlet weak var startDataLabel: UILabel!
@IBOutlet weak var tagsLabel: UILabel!
@IBOutlet weak var todayDateLabel: UILabel!
@IBOutlet weak var todayDescriptionLabel: UILabel!
@IBOutlet weak var progressBarWidthConstraint: NSLayoutConstraint!
private var isSetGoal: Bool = false
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if !self.isSetGoal {
let settingGoalViewController = SettingGoalViewController()
settingGoalViewController.modalPresentationStyle = .fullScreen
self.present(settingGoalViewController, animated: false, completion: nil)
self.isSetGoal.toggle()
}
}
}
| [
-1
] |
87e43f1240890ecaa1aa6334b1745b88bff08acb | 2fed0e8b6904e29b9a48722182a7d57c10044490 | /Kadai2/ViewController.swift | 62fad1a159a5faf99ec3cfc5e8398ab992fe9fd3 | [] | no_license | Hiroatsu-v/Hiroatsu_Kadai2 | 7f256fc21f8a9500d2d2ca546c05a33db5887ff1 | 79b0be3acb90b9a35ba3dfd254cb8b5e884ad844 | refs/heads/main | 2023-07-14T12:40:48.200322 | 2021-07-21T23:05:05 | 2021-07-21T23:05:05 | 387,434,353 | 0 | 1 | null | 2021-07-21T21:19:06 | 2021-07-19T11:04:14 | Swift | UTF-8 | Swift | false | false | 1,105 | swift | //
// ViewController.swift
// Kadai2
//
// Created by Hiroatsu on 2021/07/19.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet private weak var textField1: UITextField!
@IBOutlet private weak var textField2: UITextField!
@IBOutlet private weak var segmentedControl: UISegmentedControl!
@IBOutlet private weak var resultLabel: UILabel!
@IBAction private func calculateButton(_ sender: UIButton) {
let number1 = Double(textField1.text!) ?? 0
let number2 = Double(textField2.text!) ?? 0
switch segmentedControl.selectedSegmentIndex {
case 0:
resultLabel.text = String(number1 + number2)
case 1:
resultLabel.text = String(number1 - number2)
case 2:
resultLabel.text = String(number1 * number2)
case 3:
if number2 == 0 {
resultLabel.text = "割る数には0以外を入力してください"
} else {
resultLabel.text = String(number1 / number2)
}
default:
break
}
}
}
| [
-1
] |
2b90cb06ecbe2566cbf91babbf94d71a1bd42e5e | e8af9d3e2c519f4bac30a45070962230e5ad4dec | /Verifier_new/Verifier_new/Dashboard/Profile/Settings/SettingsProfileViewController.swift | 0b6b568ade2ef819c74bda5117abb96a29f505b9 | [] | no_license | Datastore24Kirill/project | 9ec32e23320f6a54b2365b1bc3cb9d0ed06b6ecd | c989195bdab47840a5d73c53d5702fcdb6b37744 | refs/heads/master | 2020-05-20T05:36:02.291908 | 2019-05-26T09:05:22 | 2019-05-26T09:05:22 | 185,408,530 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,647 | swift | //
// SettingsProfileViewController.swift
// Verifier_new
//
// Created by Кирилл Ковыршин on 18/12/2018.
// Copyright © 2018 Verifier. All rights reserved.
//
import UIKit
class SettingsProfileViewController: VerifierAppDefaultViewController, SettingsProfileViewControllerDelegate, UITableViewDelegate, UITableViewDataSource {
//MARK: - OUTLETS
@IBOutlet var settingsProfileView: SettingsProfileView!
@IBOutlet weak var tableView: UITableView!
//MARK: - PROPERTIES
var settingsLabel = [String]()
var verificationStatus: Int?
let cellReuseIdentifier = "SettingsСell"
let model = SettingsProfileModel()
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
settingsProfileView.localizationView()
settingsLabel = ["Profile.Settings.EditProfile".localized(),
"Profile.Settings.ChangePassword".localized(),
"Profile.Settings.VerProfile".localized(),
"Profile.Settings.ChangeLanguage".localized(),
"Profile.Settings.Documents".localized()]
tableView.reloadData()
}
override func viewDidLoad() {
super.viewDidLoad()
print("LOAD")
model.delegate = self
tableView.delegate = self
tableView.dataSource = self
tableView.tableFooterView = UIView()
}
//MARK: - ACTIONS
@IBAction func backButtonAction(_ sender: Any) {
self.navigationController?.hidesBottomBarWhenPushed = false
self.navigationController?.popViewController(animated: false)
}
@IBAction func logoutButtonAction(_ sender: Any) {
self.showSpinner()
model.logout()
}
//MARK UITableViewDELEGATE
// number of rows in table view
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.settingsLabel.count
}
// create a cell for each table view row
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// create a new cell if needed or reuse an old one
let cell = tableView.dequeueReusableCell(withIdentifier: cellReuseIdentifier, for: indexPath) as! SettingsProfileTableCell
// set the text from the data model
print("\(settingsLabel[indexPath.row])")
if indexPath.row == 2 {
switch verificationStatus {
case 1:
//На проверке
cell.settingsLabel?.text = ""
cell.isHidden = true
return UITableViewCell()
case 2:
//Верифицирован
cell.settingsLabel?.text = ""
cell.isHidden = true
return UITableViewCell()
default:
cell.settingsLabel?.text = settingsLabel[indexPath.row]
}
} else {
cell.settingsLabel?.text = settingsLabel[indexPath.row]
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
var height: CGFloat = 44
if indexPath.row == 2 {
switch verificationStatus {
case 1:
height = 0
case 2:
height = 0
default:
return height
}
}
return height
}
// method to run when table view cell is tapped
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print("You tapped cell number \(indexPath.row).")
tableView.deselectRow(at: indexPath, animated: true)
switch indexPath.row {
case 0:
let storyboard = InternalHelper.StoryboardType.dashboard.getStoryboard()
let indentifier = ViewControllers.profileEditVC.rawValue
if let profileEditVC = storyboard.instantiateViewController(withIdentifier: indentifier) as? ProfileEditViewController {
self.navigationController?.pushViewController(profileEditVC, animated: true)
}
case 1:
let storyboard = InternalHelper.StoryboardType.dashboard.getStoryboard()
let indentifier = ViewControllers.changePasswordVC.rawValue
if let changePasswordVC = storyboard.instantiateViewController(withIdentifier: indentifier) as? ChangePasswordViewController {
self.navigationController?.pushViewController(changePasswordVC, animated: true)
}
case 2:
let storyboard = InternalHelper.StoryboardType.dashboard.getStoryboard()
let indentifier = ViewControllers.verificationVC.rawValue
if let verificationVC = storyboard.instantiateViewController(withIdentifier: indentifier) as? VerificationViewController {
self.navigationController?.pushViewController(verificationVC, animated: true)
}
case 3:
let storyboard = InternalHelper.StoryboardType.dashboard.getStoryboard()
let indentifier = ViewControllers.changeLanguageVC.rawValue
if let changeLanguageVC = storyboard.instantiateViewController(withIdentifier: indentifier) as? ChangeLanguageViewController {
self.navigationController?.pushViewController(changeLanguageVC, animated: true)
}
case 4:
let storyboard = InternalHelper.StoryboardType.dashboard.getStoryboard()
let indentifier = ViewControllers.documentsVC.rawValue
if let documentsVC = storyboard.instantiateViewController(withIdentifier: indentifier) as? DocumentsViewController {
self.navigationController?.pushViewController(documentsVC, animated: true)
}
default:
break
}
}
//MARK: - DELEGATE
func showAlertError(with title: String?, message: String?) {
showAlert(title: title ?? "", message: message ?? "")
}
func hideSpinnerView() {
super.hideSpinner()
}
}
class SettingsProfileTableCell: UITableViewCell {
//MARK: - OUTLETS
@IBOutlet weak var settingsLabel: UILabel!
}
| [
-1
] |
903078354924f6f0cefa25c417af3b60063d9e7a | 750509a662fb744e89d772b765e3b5b92fdafda8 | /ShARe/Views/ARViewController.swift | 4905e613f8a3e163da6f6a171408f9706870ef66 | [] | no_license | Andrei-O/ShARe | 61fedd8fe699214896ac2124970208c3fd7049b6 | c56e5f03e4d613c574f78ebee94758cf5fe7bc70 | refs/heads/master | 2020-11-24T23:13:54.250385 | 2019-12-16T14:56:10 | 2019-12-16T14:56:10 | 228,381,327 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,235 | swift | //
// ARViewController.swift
// ShARe
//
// Created by Andrei Ostafciuc on 16/12/2019.
// Copyright © 2019 Andrei Ostafciuc. All rights reserved.
//
import UIKit
import ARKit
import MultipeerConnectivity
class ARViewController: UIViewController {
//MARK: - Outlets
@IBOutlet weak var sceneView: ARSCNView!
//MARK: - Properties
private var multipeerSession: MultipeerSession!
//MARK: - Lifecycle
override func viewDidLoad() {
super.viewDidLoad()
multipeerSession = MultipeerSession(receivedDataHandler: handleReceivedPeerData)
setupUI()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
setupARSceneConfiguration()
toggleIdleTimer(enabled: true)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
sceneView.session.pause()
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
toggleIdleTimer(enabled: false)
}
//MARK: - Setup
private func setupUI() {
}
private func setupARSceneConfiguration() {
guard ARWorldTrackingConfiguration.isSupported else { fatalError(LocalizedStrings.ARScreen.arFrameworkNotSupported) }
let configuration = ARWorldTrackingConfiguration()
configuration.planeDetection = .horizontal
sceneView.session.run(configuration)
#if DEBUG
sceneView.debugOptions = [ARSCNDebugOptions.showFeaturePoints]
#endif
}
private func toggleIdleTimer(enabled: Bool) {
UIApplication.shared.isIdleTimerDisabled = enabled
}
//MARK: - Actions
@IBAction func handleSceneTap(_ sender: UITapGestureRecognizer) {
let touchPoint = sender.location(in: sceneView)
let hitTestResults = sceneView.hitTest(touchPoint, types: [.existingPlaneUsingGeometry, .estimatedHorizontalPlane])
guard let firstHitTestResult = hitTestResults.first else { return }
let anchor = ARAnchor(name: "plant", transform: firstHitTestResult.worldTransform)
sceneView.session.add(anchor: anchor)
//notify connected peers about the object that we just placed in the scene
}
//MARK: - Helper functions
private func handleReceivedPeerData(data: Data, peerID: MCPeerID) {
print("Received data from peer: \(peerID.displayName)")
}
private func loadObject() -> SCNNode? {
return SCNNode(name: ARSceneConstants.VirtualObjects.resourceName)
}
}
//MARK: - Delegates
extension ARViewController: ARSCNViewDelegate {
func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {
// load new object
guard let anchorName = anchor.name,
anchorName.hasPrefix("plant"),
let objectNode = loadObject() else { return }
node.addChildNode(objectNode)
}
}
extension ARViewController: ARSessionDelegate {
func session(_ session: ARSession, cameraDidChangeTrackingState camera: ARCamera) {
}
}
| [
-1
] |
ebd65e2553262579f9bdb4bb7cc99f30c5dc5ff9 | 0d6cdce1349493e7648e55ef3adf9dad2a8fdae5 | /arraysAndLoops.playground/Contents.swift | 01196070507a53aae8a45610b16fc9baac2a2428 | [] | no_license | Braveheart22/iOS-9-beginner-to-professional | 27c9879df0d9d4b73d25eb00942a7da2b1f73ce3 | 688c28fc1affeefdee67f97f8a6b1820ab470e76 | refs/heads/master | 2020-12-25T13:51:30.100029 | 2016-06-28T19:06:09 | 2016-06-28T19:06:09 | 60,201,828 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 842 | swift | //: Playground - noun: a place where people can play
import UIKit
var oddNumbers = [Int]()
for i in 0 ..< 100 {
if i % 2 != 0 {
oddNumbers.append(i)
}
}
print(oddNumbers)
var sums = [Int]()
for i in 0 ..< oddNumbers.count {
sums.append(oddNumbers[i] + 5)
}
var x = 0
repeat {
print("The sum is: \(sums[x])")
x += 1
} while x < sums.count
print(sums)
for i in 0...10 {
print ("\(i) times 5 is \(i * 5)")
}
let somePoint = (0, 300123456789)
switch somePoint {
case (0, 0):
print("(0, 0) is at the origin")
case (_, 0):
print("(\(somePoint.0), 0) is on the x-axis")
case (0, _):
print("(0, \(somePoint.1)) is on the y-axis")
case (-2...2, -2...2):
print("(\(somePoint.0), \(somePoint.1)) is inside the box")
default:
print("(\(somePoint.0), \(somePoint.1)) is outside of the box")
}
| [
-1
] |
5350499ac94200cdf4e428b7899dd4d126ee47d9 | 5059241056cb2566fd31c397a190f0caa63a99fa | /StockAsyncDisplay/NetworkService.swift | d4f45c34d8f18e56fb052767ef585e90defdb010 | [] | no_license | OptTrader/StockAsyncDisplay | ca14e36ce8aa6a3d7cd22bdf282a510a7da8e040 | 1d58502269b743be390703c257c5e71f75f78102 | refs/heads/master | 2021-01-22T02:35:07.755267 | 2017-03-01T06:58:16 | 2017-03-01T06:58:16 | 81,060,230 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,446 | swift | //
// NetworkService.swift
// StockAsyncDisplay
//
// Created by Chris Kong on 1/1/17.
// Copyright © 2017 Chris Kong. All rights reserved.
//
import Foundation
import Alamofire
import SwiftyJSON
typealias JSONDictionary = Dictionary<String, Any>
typealias StockModelCallback = ([Stock]) -> Void
final class NetworkService {
lazy var session: URLSession = URLSession.shared
func endpointForQuotes(symbols: Array<String>) -> String {
let symbolsString: String = symbols.joined(separator: "\", \"")
let query = "select * from yahoo.finance.quotes where symbol in (\"\(symbolsString) \")&format=json&diagnostics=true&env=store://datatables.org/alltableswithkeys&callback="
let encodedQuery = query.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlHostAllowed)
let endpoint = "https://query.yahooapis.com/v1/public/yql?q=" + encodedQuery!
return endpoint
}
func fetchQuotesFromSymbols(symbols: Array<String>, completion: @escaping (_ results: [JSONDictionary]?, _ error: Error?) -> ()) {
let urlString = self.endpointForQuotes(symbols: symbols)
guard let url = URL(string: urlString) else {
fatalError()
}
session.dataTask(with: url) { (data, response, error) in
DispatchQueue.main.async(execute: {
do {
let jsonDict = try JSONSerialization.jsonObject(with: data!, options: JSONSerialization.ReadingOptions.mutableContainers) as! NSDictionary
let quotes = ((jsonDict.object(forKey: "query") as! NSDictionary).object(forKey: "results") as! NSDictionary).object(forKey: "quote") as! [JSONDictionary]
completion(quotes, nil)
} catch let underlyingError {
completion(nil, underlyingError)
}
})
}.resume()
}
func requestEquityData(symbols: Array<String>, onSuccess: StockModelCallback?, onError: ErrorCallback?) {
UIApplication.shared.isNetworkActivityIndicatorVisible = true
let urlString = endpointForQuotes(symbols: symbols)
Alamofire.request(urlString)
.validate(statusCode: 200..<300)
.responseJSON { response in
UIApplication.shared.isNetworkActivityIndicatorVisible = false
guard response.result.error == nil else {
print(response.result.error!)
onError?(APIManagerError.network(error: response.result.error!))
return
}
guard let value = response.result.value else {
print("didn't get array of objects as JSON from API")
onError?(APIManagerError.objectSerialization(reason: "Did not get JSON dictionary in response"))
return
}
let json = JSON(value)
guard let jsonArray = json["query"]["results"]["quote"].array else {
print("JSON not parsed as expected array")
onError?(APIManagerError.jsonError(reason: "JSON parsing error"))
return
}
let stockQuotesArray = jsonArray.flatMap { Stock(json: $0) }
onSuccess?(stockQuotesArray)
}
}
}
| [
-1
] |
60cf7e09d541dc968a0388ae21c4d16f4f8bfa3f | 63eab339ab512951ad149c22c938b184ce145dbf | /Lemmy-iOS/Sources/Core/Base/Actionable.swift | a3e15bb868519f5f623f297979adcbbfdde17322 | [
"MIT"
] | permissive | komolbek/Lemmy-iOS | a7b80c65401118becf8744b9c68f30947f9bd299 | b5697f48bcc2b37c8de89995d795681815675d68 | refs/heads/master | 2023-03-26T17:43:00.307407 | 2021-03-22T11:40:35 | 2021-03-22T11:40:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,281 | swift | //
// BlockObject.swift
// Lemmy-iOS
//
// Created by uuttff8 on 17.02.2021.
// Copyright © 2021 Anton Kuzmin. All rights reserved.
//
import UIKit
protocol Actionable {
associatedtype T = Self
func addAction(for controlEvent: UIControl.Event, action: ((T) -> Void)?)
}
private class ClosureSleeve<T> {
let closure: ((T) -> Void)?
let sender: T
init (sender: T, _ closure: ((T) -> Void)?) {
self.closure = closure
self.sender = sender
}
@objc func invoke() {
closure?(sender)
}
}
extension Actionable where Self: UIControl {
func addAction(for controlEvent: UIControl.Event, action: ((Self) -> Void)?) {
let previousSleeve = objc_getAssociatedObject(self, String(controlEvent.rawValue))
objc_removeAssociatedObjects(previousSleeve as Any)
removeTarget(previousSleeve, action: nil, for: controlEvent)
let sleeve = ClosureSleeve(sender: self, action)
addTarget(sleeve, action: #selector(ClosureSleeve<Self>.invoke), for: controlEvent)
objc_setAssociatedObject(self, String(controlEvent.rawValue),
sleeve,
objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN)
}
}
extension UIControl: Actionable {}
| [
-1
] |
d6e03f60330c4a7f93c27b31f7325dc9b6688d66 | 0aa1c58ca7bea8a47571f269e7a41d113fbbee20 | /ComparePrices/UI/Common/AddCircleButton.swift | 1b7e039d447637b13d9fd9e96a4818243d3ae23e | [] | no_license | auto-ororo/compare-prices-ios | 1b309d99475e76be960e769a9ef2fc21e9d321ac | 564c2ef1debd04e55f0674a23af2ecf1c094a7f1 | refs/heads/develop | 2023-04-24T01:20:52.673608 | 2021-05-30T14:33:05 | 2021-05-30T14:33:05 | 334,386,594 | 0 | 0 | null | 2021-05-30T14:33:06 | 2021-01-30T10:33:23 | Swift | UTF-8 | Swift | false | false | 859 | swift | //
// AddCircleButton.swift
// ComparePrices
//
// Created by ororo on 2021/04/30.
//
import SFSafeSymbols
import SwiftUI
struct AddCircleButton: View {
var action: () -> Void
var body: some View {
Button(action: action,
label: {
Image(systemSymbol: SFSymbol.plus)
.foregroundColor(.white)
.font(.system(size: 24))
})
.frame(width: 60, height: 60)
.background(R.color.primary.color)
.cornerRadius(30.0)
.shadow(color: R.color.elevation.color, radius: 3, x: 3, y: 3)
.padding(EdgeInsets(top: 0, leading: 0, bottom: 16.0, trailing: 16.0))
}
}
struct AddCircleButton_Previews: PreviewProvider {
static var previews: some View {
AddCircleButton(action: {})
}
}
| [
-1
] |
871b47bee7269b37234f28a3e2b6bec6b1e2091d | 4f4e02a3b54e123355a9e5d9c30e131d41747952 | /AEPTarget/Sources/Target+PublicAPI.swift | 91123a3c98a4f41c8d995f5245aea6a594843c5d | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | shtomar-adb/aepsdk-target-ios | a38d349c80b3f0fa62c3767696867d98a4e7c5d5 | 72e2ef7345cf8c0fa309c2157ed8c56d3d7fe418 | refs/heads/main | 2023-06-23T23:57:54.887571 | 2021-07-12T20:09:17 | 2021-07-12T20:09:17 | 390,127,758 | 0 | 0 | NOASSERTION | 2021-07-27T21:09:42 | 2021-07-27T21:09:41 | null | UTF-8 | Swift | false | false | 17,381 | swift | /*
Copyright 2021 Adobe. All rights reserved.
This file is licensed to you 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 REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
import AEPCore
import AEPServices
import Foundation
@objc public extension Target {
/// true if the response content event listener is already registered, false otherwise
private static var isResponseListenerRegister: Bool = false
/// `Dictionary` to keep track of pending target request
@nonobjc
private static var pendingTargetRequest: ThreadSafeDictionary<String, TargetRequest> = ThreadSafeDictionary()
/// Prefetch multiple Target mboxes simultaneously.
///
/// Executes a prefetch request to your configured Target server with the TargetPrefetchObject list provided
/// in the prefetchObjectArray parameter. This prefetch request will use the provided parameters for all of
/// the prefetches made in this request. The callback will be executed when the prefetch has been completed, returning
/// an error object, nil if the prefetch was successful or error description if the prefetch was unsuccessful.
/// The prefetched mboxes are cached in memory for the current application session and returned when requested.
/// - Parameters:
/// - prefetchArray: an array of AEPTargetPrefetch objects representing the desired mboxes to prefetch
/// - targetParameters: a TargetParameters object containing parameters for all the mboxes in the request array
/// - completion: the callback `closure` which will be called after the prefetch is complete. The parameter in the callback will be nil if the prefetch completed successfully, or will contain error message otherwise
@objc(prefetchContent:withParameters:callback:)
static func prefetchContent(_ prefetchArray: [TargetPrefetch], with targetParameters: TargetParameters? = nil, _ completion: ((Error?) -> Void)?) {
let completion = completion ?? { _ in }
guard !prefetchArray.isEmpty else {
Log.error(label: Target.LOG_TAG, "Failed to prefetch Target request (the provided request list for mboxes is empty or nil)")
completion(TargetError(message: TargetError.ERROR_EMPTY_PREFETCH_LIST))
return
}
var prefetchDataArray = [[String: Any]]()
for prefetch in prefetchArray {
if let dict = prefetch.asDictionary() {
prefetchDataArray.append(dict)
} else {
Log.error(label: Target.LOG_TAG, "Failed to prefetch Target request (the provided prefetch object can't be converted to [String: Any] dictionary), prefetch => \(prefetch)")
completion(TargetError(message: TargetError.ERROR_INVALID_REQUEST))
return
}
}
var eventData: [String: Any] = [TargetConstants.EventDataKeys.PREFETCH_REQUESTS: prefetchDataArray]
if let targetParametersDict = targetParameters?.asDictionary() {
eventData[TargetConstants.EventDataKeys.TARGET_PARAMETERS] = targetParametersDict
}
let event = Event(name: TargetConstants.EventName.PREFETCH_REQUESTS, type: EventType.target, source: EventSource.requestContent, data: eventData)
MobileCore.dispatch(event: event) { responseEvent in
guard let responseEvent = responseEvent else {
completion(TargetError(message: TargetError.ERROR_TIMEOUT))
return
}
if let errorMessage = responseEvent.data?[TargetConstants.EventDataKeys.PREFETCH_ERROR] as? String {
completion(TargetError(message: errorMessage))
return
}
completion(.none)
}
}
/// Retrieves content for multiple Target mbox locations at once.
/// Executes a batch request to your configured Target server for multiple mbox locations. Any prefetched content
/// which matches a given mbox location is returned and not included in the batch request to the Target server.
/// Each object in the array contains a callback function, which will be invoked when content is available for
/// its given mbox location.
/// - Parameters:
/// - requestArray: An array of AEPTargetRequestObject objects to retrieve content
/// - targetParameters: a TargetParameters object containing parameters for all locations in the requests array
@objc(retrieveLocationContent:withParameters:)
static func retrieveLocationContent(_ requestArray: [TargetRequest], with targetParameters: TargetParameters? = nil) {
if requestArray.isEmpty {
Log.error(label: Target.LOG_TAG, "Failed to retrieve location content target request \(TargetError.ERROR_NULL_EMPTY_REQUEST_MESSAGE)")
return
}
var targetRequestsArray = [[String: Any]]()
var tempIdToRequest: [String: TargetRequest] = [:]
for request in requestArray {
if request.name.isEmpty {
// If the callback is present call with default content
if let callback = request.contentCallback {
callback(request.defaultContent)
}
Log.debug(label: Target.LOG_TAG, "TargetRequest removed because mboxName is empty.")
continue
}
guard let requestDictionary = request.asDictionary() else {
Log.error(label: Target.LOG_TAG, "Failed to convert Target request to [String: Any] dictionary), prefetch => \(String(describing: request))")
continue
}
tempIdToRequest[request.responsePairId] = request
targetRequestsArray.append(requestDictionary)
}
if targetRequestsArray.isEmpty {
Log.error(label: Target.LOG_TAG, "Failed to retrieve location content target request is empty")
return
}
// Register the response content event listener
registerResponseContentEventListener()
var eventData = [TargetConstants.EventDataKeys.LOAD_REQUESTS: targetRequestsArray] as [String: Any]
if let targetParametersDict = targetParameters?.asDictionary() {
eventData[TargetConstants.EventDataKeys.TARGET_PARAMETERS] = targetParametersDict
}
let event = Event(name: TargetConstants.EventName.LOAD_REQUEST, type: EventType.target, source: EventSource.requestContent, data: eventData)
// Update the pending target request dictionary with
// key = `event.id-request.responsePairId`, value = `TargetRequest` object
for (responsePairId, targetRequest) in tempIdToRequest {
pendingTargetRequest["\(event.id)-\(responsePairId)"] = targetRequest
}
Log.trace(label: Target.LOG_TAG, "retrieveLocationContent - Event dispatched \(event.name), \(event.id.uuidString)")
MobileCore.dispatch(event: event)
}
/// Sets the custom visitor ID for Target.
/// Sets a custom ID to identify visitors (profiles). This ID is preserved between app upgrades,
/// is saved and restored during the standard application backup process, and is removed at uninstall or
/// when AEPTarget.resetExperience is called.
/// - Parameter id: a string pointer containing the value of the third party id (custom visitor id)
static func setThirdPartyId(_ id: String?) {
let eventData = [TargetConstants.EventDataKeys.THIRD_PARTY_ID: id ?? ""]
let event = Event(name: TargetConstants.EventName.REQUEST_IDENTITY, type: EventType.target, source: EventSource.requestIdentity, data: eventData)
MobileCore.dispatch(event: event)
}
/// Gets the custom visitor ID for Target
/// This ID will be reset when the `resetExperience()` API is called.
/// - Parameter completion: the callback `closure` will be invoked to return the thirdPartyId value or `nil` if no third-party ID is set
static func getThirdPartyId(_ completion: @escaping (String?, Error?) -> Void) {
let event = Event(name: TargetConstants.EventName.REQUEST_IDENTITY, type: EventType.target, source: EventSource.requestIdentity, data: nil)
MobileCore.dispatch(event: event) { responseEvent in
guard let responseEvent = responseEvent else {
let error = "Request to get third party id failed, \(TargetError.ERROR_TIMEOUT)"
completion(nil, TargetError(message: error))
Log.error(label: Target.LOG_TAG, error)
return
}
guard let eventData = responseEvent.data else {
let error = "Unable to handle response, event data is nil."
completion(nil, TargetError(message: error))
Log.error(label: Target.LOG_TAG, error)
return
}
guard let thirdPartyId = eventData[TargetConstants.EventDataKeys.THIRD_PARTY_ID] as? String else {
let error = "Unable to handle response, No third party id available."
completion(nil, TargetError(message: error))
Log.error(label: Target.LOG_TAG, error)
return
}
completion(thirdPartyId, nil)
}
}
/// Gets the Test and Target user identifier.
/// Retrieves the TnT ID returned by the Target server for this visitor. The TnT ID is set to the
/// Mobile SDK after a successful call to prefetch content or load requests.
///
/// This ID is preserved between app upgrades, is saved and restored during the standard application
/// backup process, and is removed at uninstall or when AEPTarget.resetExperience is called.
///
/// - Parameter completion: the callback `closure` invoked with the current tnt id or `nil` if no tnt id is set.
static func getTntId(_ completion: @escaping (String?, Error?) -> Void) {
let event = Event(name: TargetConstants.EventName.REQUEST_IDENTITY, type: EventType.target, source: EventSource.requestIdentity, data: nil)
MobileCore.dispatch(event: event) { responseEvent in
guard let responseEvent = responseEvent else {
let error = "Request to get third party id failed, \(TargetError.ERROR_TIMEOUT)"
completion(nil, TargetError(message: error))
Log.error(label: Target.LOG_TAG, error)
return
}
guard let eventData = responseEvent.data else {
let error = "Unable to handle response, event data is nil."
completion(nil, TargetError(message: error))
Log.error(label: Target.LOG_TAG, error)
return
}
guard let tntId = eventData[TargetConstants.EventDataKeys.TNT_ID] as? String else {
let error = "Unable to handle response, No tntid available."
completion(nil, TargetError(message: error))
Log.error(label: Target.LOG_TAG, error)
return
}
completion(tntId, nil)
}
}
/// Sets the Target preview restart deep link.
/// Set the Target preview URL to be displayed when the preview mode is restarted.
static func resetExperience() {
let eventData = [TargetConstants.EventDataKeys.RESET_EXPERIENCE: true]
let event = Event(name: TargetConstants.EventName.REQUEST_RESET, type: EventType.target, source: EventSource.requestReset, data: eventData)
MobileCore.dispatch(event: event)
}
/// Clears prefetched mboxes.
/// Clears the cached prefetched AEPTargetPrefetchObject array.
static func clearPrefetchCache() {
let eventData = [TargetConstants.EventDataKeys.CLEAR_PREFETCH_CACHE: true]
let event = Event(name: TargetConstants.EventName.CLEAR_PREFETCH_CACHE, type: EventType.target, source: EventSource.requestReset, data: eventData)
MobileCore.dispatch(event: event)
}
/// Sets the Target preview restart deep link.
/// Set the Target preview URL to be displayed when the preview mode is restarted.
/// - Parameter deeplink: the URL which will be set for preview restart
@objc(setPreviewRestartDeepLink:)
static func setPreviewRestartDeepLink(_ deeplink: URL) {
let eventData = [TargetConstants.EventDataKeys.PREVIEW_RESTART_DEEP_LINK: deeplink.absoluteString]
let event = Event(name: TargetConstants.EventName.SET_PREVIEW_DEEPLINK, type: EventType.target, source: EventSource.requestContent, data: eventData)
MobileCore.dispatch(event: event)
}
/// Sends a display notification to Target for given prefetched mboxes. This helps Target record location display events.
/// - Parameters:
/// - names: (required) an array of displayed location names
/// - targetParameters: for the displayed location
@objc(displayedLocations:withTargetParameters:)
static func displayedLocations(_ names: [String], targetParameters: TargetParameters? = nil) {
if names.isEmpty {
Log.error(label: LOG_TAG, "Failed to send display notification, List of Mbox names must not be empty.")
return
}
var eventData = [TargetConstants.EventDataKeys.MBOX_NAMES: names, TargetConstants.EventDataKeys.IS_LOCATION_DISPLAYED: true] as [String: Any]
if let targetParametersDict = targetParameters?.asDictionary() {
eventData[TargetConstants.EventDataKeys.TARGET_PARAMETERS] = targetParametersDict
}
let event = Event(name: TargetConstants.EventName.LOCATIONS_DISPLAYED, type: EventType.target, source: EventSource.requestContent, data: eventData)
MobileCore.dispatch(event: event)
}
/// Sends a click notification to Target if a click metric is defined for the provided location name.
/// Click notification can be sent for a location provided a load request has been executed for that prefetched or regular mbox
/// location before, indicating that the mbox was viewed. This request helps Target record the clicked event for the given location or mbox.
///
/// - Parameters:
/// - mboxName: String value representing the name for location/mbox
/// - targetParameters: a TargetParameters object containing parameters for the location clicked
@objc(clickedLocation:withTargetParameters:)
static func clickedLocation(_ name: String, targetParameters: TargetParameters? = nil) {
if name.isEmpty {
Log.error(label: LOG_TAG, "Failed to send click notification, Mbox name must not be empty or nil.")
return
}
var eventData = [TargetConstants.EventDataKeys.MBOX_NAME: name, TargetConstants.EventDataKeys.IS_LOCATION_CLICKED: true] as [String: Any]
if let targetParametersDict = targetParameters?.asDictionary() {
eventData[TargetConstants.EventDataKeys.TARGET_PARAMETERS] = targetParametersDict
}
let event = Event(name: TargetConstants.EventName.LOCATION_CLICKED, type: EventType.target, source: EventSource.requestContent, data: eventData)
MobileCore.dispatch(event: event)
}
/// Registers the response content event listener
private static func registerResponseContentEventListener() {
// Only register the listener once
if !isResponseListenerRegister {
MobileCore.registerEventListener(type: EventType.target, source: EventSource.responseContent, listener: handleResponseEvent(_:))
isResponseListenerRegister = true
}
}
/// Handles the response event with event name as `TargetConstants.EventName.TARGET_REQUEST_RESPONSE`
/// - Parameters:
/// - event: Response content event with content
private static func handleResponseEvent(_ event: Event) {
if event.name != TargetConstants.EventName.TARGET_REQUEST_RESPONSE {
return
}
guard let id = event.data?[TargetConstants.EventDataKeys.TARGET_RESPONSE_EVENT_ID] as? String,
let responsePairId = event.data?[TargetConstants.EventDataKeys.TARGET_RESPONSE_PAIR_ID] as? String
else {
Log.error(label: LOG_TAG, "Missing response pair id for the target request in the response event")
return
}
let searchId = "\(id)-\(responsePairId)"
// Remove and use the target request from the map
guard let targetRequest = pendingTargetRequest.removeValue(forKey: searchId) else {
Log.error(label: LOG_TAG, "Missing target request for the \(searchId)")
return
}
guard let callback = targetRequest.contentCallback else {
Log.warning(label: LOG_TAG, "Missing callback for target request with pair id the \(responsePairId)")
return
}
let content = event.data?[TargetConstants.EventDataKeys.TARGET_CONTENT] as? String ?? targetRequest.defaultContent
callback(content)
}
}
| [
-1
] |
9b449f978262dddfa5ab768ba11a1c74e3b467e5 | 2050641b3a65fb602c50aa49fd1286d7fd709510 | /XCE-FACTOR/Extensions/DataTypesExtensions.swift | 2db5226e84f6b74b7e265023eae697149f78a600 | [] | no_license | arendarsky/AvatarAppIos | 0aae097a61dad4e8cdc23999d0be3c2d2ed5ef44 | ce26eedcd537803decb46df8e38541d17ebaa5c6 | refs/heads/master | 2021-07-11T08:03:30.540256 | 2020-07-31T16:50:54 | 2020-07-31T16:50:54 | 234,376,883 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,409 | swift | //
//MARK: DataTypesExtensions.swift
// AvatarAppIos
//
// Created by Владислав on 08.04.2020.
// Copyright © 2020 Владислав. All rights reserved.
//
import Foundation
///
//MARK:- ====== String
///
///
public extension String {
//MARK:- Find First index of symbol in string
func firstIndexOf(char: Character) -> Int? {
for (i, t) in self.enumerated() {
if t == char {
return i
}
}
return nil
}
//MARK:- Find Last index of symbol in string
func lastIndexOf(char: Character) -> Int? {
var res: Int? = nil
for (i, t) in self.enumerated() {
if t == char {
res = i
}
}
return res
}
//MARK:- Return Some Symbol N times
///Repeats string by given N times
///
///❗️prefer using `repeating(_ times: Int)` method instead
///```
///print("a".times(5))
/////"aaaaa"
///```
func times(_ N: Int) -> String {
var s = ""
for _ in 0..<N {
s += self
}
return s
}
//MARK:- Repeating wrapper over standard method
///This method wraps the standard String init method "`String(repeating: String, count: Int)`" in more convenient way to use
///
///If "`times`" is less than or equal 0, returns empty string
///```
///print("a".repeating(5))
/////"aaaaa"
///```
func repeating(_ times: Int) -> String {
return times > 0 ? String(repeating: self, count: times) : ""
}
//MARK:- Validate String as Email
var isValidEmail: Bool {
if !(self.contains("@") && self.contains(".")) {
return false
}
let a = self.firstIndexOf(char: "@")!
let b = self.lastIndexOf(char: ".")!
if !(a > 0 && a + 1 < b) {
return false
}
return true
}
//MARK:- Formatted Time Interval
///Formats time interval from given date (ISO 8601) to now in convenient way of mins, hours, etc.
///
///1. Date must be in UTC+03:00 (Moscow) w/o specified timezone, e.g. "2020-04-18T18:06:52.711Z"
///(18 Apr 2020, 18:06 in Moscow)
///Otherwise, will return incorrect interval.
///2. Returns "-/-" if date is not in ISO 8601, or if formatting failed.
func formattedTimeIntervalToNow() -> String {
///values in seconds:
let minute = 60
let hour = 60 * minute
let day = 24 * hour
let week = 7 * day
let month = 30 * day
//let year = 365 * day
let formatter = ISO8601DateFormatter()
formatter.timeZone = TimeZone(secondsFromGMT: +3 * hour)
formatter.formatOptions = [
.withFullDate,
.withFullTime,
.withDashSeparatorInDate,
.withFractionalSeconds
]
let strDate = self.last == "Z" ? self : self+"Z"
guard let date = formatter.date(from: strDate) else {
return "-/-"
}
//print("Input:", date)
///current time w/ correction to UTC+03:00
//print("Now:", Date(timeInterval: Double(3*hour), since: Date()))
let seconds = Int(Date().timeIntervalSince(date)) + 3 * hour
switch seconds {
case month...:
return "\(seconds / month)мес."
case week...:
return "\(seconds / week)нед."
case day...:
return "\(seconds / day)дн."
case hour...:
return "\(seconds / hour)ч."
case minute...:
return "\(seconds / minute)м."
default:
return "Только что"
}
}
}
///
//MARK:- ====== Double
///
///
public extension Double {
//MARK:- Round number to specified decimal places
func rounded(places: Int) -> Double {
let multiplier = pow(10, Double(places))
return (self * multiplier).rounded(.toNearestOrEven) / multiplier
}
}
///
//MARK:- ====== Int
///
///
public extension Int {
enum LikeType {
case shortForm, fullForm
}
//MARK:- Format Likes
func formattedToLikes(_ form : LikeType) -> String {
guard form != .fullForm else {
return "\(self)"
}
//let likeSymbol: String = "♡"
let number = Double(self)
let Billion = 1e9
let Million = 1e6
let Thousand = 1e3
//var formattedLikes = ""
switch number {
//greater than:
case Billion...:
let res = Double(number) / Billion
//formattedLikes = " \(res.rounded(places: 1))B"
return "\(res.rounded(places: 1))B"
case Million...:
let res = Double(number) / Million
//formattedLikes = " \(res.rounded(places: 1))M"
return "\(res.rounded(places: 1))M"
case Thousand...:
let res = Double(number) / Thousand
//formattedLikes = " \(res.rounded(places: 1))K"
return "\(res.rounded(places: 1))K"
default:
//formattedLikes = " \(self)"
return "\(self)"
}
}
//MARK:- Count Deadline
///useful for adding to a periodic time observer
func countDeadline(deadline: Int, deadline2: Int? = nil, condition: Bool = false, handler: (() -> Void)?, handler2: (() -> Void)? = nil) -> Int {
if condition {
return 0
}
if self == deadline {
handler?()
return self + 1
}
if self > deadline2 ?? deadline {
handler2?()
return 0
}
return self + 1
}
}
enum TimeIntervalNames {
case minute, hour, day, week, year, leapYear
var seconds: Double {
switch self {
case .minute:
return 60
case .hour:
return 60 * 60
case .day:
return 24 * 60 * 60
case .week:
return 7 * 24 * 60 * 60
case .year:
return 365 * 24 * 60 * 60
case .leapYear:
return 366 * 24 * 60 * 60
}
}
}
extension TimeInterval {
//MARK:- Seconds In
///Returns time interval in seconds for widely-used types of time
static func secondsIn(_ time: TimeIntervalNames) -> Double {
return time.seconds
}
}
| [
-1
] |
35ab6ea3ded21eae2adfd1aaf215103263c460b4 | 8238379a3263229086071f5cb537df0e04f274a6 | /AHA selfcare/PrivacyPolicy/TermsandPolicyViewController.swift | 2c062083dd4cb7ec19d0e9a5bd406ae34661296e | [] | no_license | rajasekaranDG/Selfcare | 8ad62d41624df00e68f4b1663fd5ccdcba244bf0 | 262111214cb6a6b038adae7661f2268947b5743f | refs/heads/master | 2020-03-18T09:02:31.335838 | 2018-06-11T07:03:59 | 2018-06-11T07:03:59 | 134,541,958 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 4,275 | swift | //
// TermsandPolicyViewController.swift
// AHA selfcare
//
// Created by Leo Chelliah on 29/05/18.
// Copyright © 2018 Sivachandiran. All rights reserved.
//
import UIKit
class TermsandPolicyViewController: UIViewController,UITableViewDataSource,UITableViewDelegate {
var privacyArray = [String]()
var mainViewController: UIViewController!
@IBOutlet weak var tablePrivacy : UITableView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.navigationController?.navigationBar.isHidden = true
self.tablePrivacy.register(UINib(nibName: "TermsandPrivacyTableViewCell", bundle: nil), forCellReuseIdentifier: "TermsandPrivacyTableViewCell")
self.privacyArray = ["Terms & Conditions","Privacy Policy","End User License Ageement"]
}
override var preferredStatusBarStyle: UIStatusBarStyle {
return.lightContent
}
@IBAction func menuClick(_ sender : Any) {
self.slideMenuController()?.toggleLeft()
}
// MARK:- TableView Delegates
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return privacyArray.count
}
// func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
// return 150;
// }
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableViewAutomaticDimension
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "TermsandPrivacyTableViewCell", for: indexPath as IndexPath) as! TermsandPrivacyTableViewCell
cell.selectionStyle = .none
if(indexPath.row%2 == 0){
cell.backgroundColor = UIColor(red: 240.0/255.0, green: 240.0/255.0, blue:240.0/255.0, alpha: 1.000)
}
else {
cell.backgroundColor = UIColor.white
}
cell.lblTitle.text = self.privacyArray[indexPath.row]
// cell.buttonSelect.addTarget(self, action: #selector(AssessmentViewController.assessmentSelectClick(_:)), for: .touchUpInside)
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == 0 {
let privacypolicyVC = PrivacyPolicyViewController(nibName : "PrivacyPolicyViewController" , bundle : nil)
privacypolicyVC.urlString = "http://ahahealth.io/terms-and-conditions/"
privacypolicyVC.titleString = "Terms and Conditions"
self.navigationController?.pushViewController(privacypolicyVC, animated: true)
}
else if indexPath.row == 1 {
let privacypolicyVC = PrivacyPolicyViewController(nibName : "PrivacyPolicyViewController" , bundle : nil)
privacypolicyVC.urlString = "http://ahahealth.io/privacy-policy/"
privacypolicyVC.titleString = "Privacy policy"
self.navigationController?.pushViewController(privacypolicyVC, animated: true)
}
else if indexPath.row == 2 {
let privacypolicyVC = PrivacyPolicyViewController(nibName : "PrivacyPolicyViewController" , bundle : nil)
privacypolicyVC.urlString = "http://ahahealth.io/end-user-licence-agreement/"
privacypolicyVC.titleString = "End User License Agreement"
self.navigationController?.pushViewController(privacypolicyVC, animated: true)
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
0dd482ad17a52b0513d6469390704c024860e86c | 01d26a48b8db7150d109959f87ee5b57758ca56e | /hackadeira/Hackadeira/Controllers/PlantCardCell.swift | 727b97f63020a3fb8c93039bd1e004577e442edd | [
"MIT"
] | permissive | emersonvictor/hackadeira | 56042eb6cc856d39ce9f622dc068b8f56db379b7 | de8ebad8e30171884e9feab3b914139600f7b0a4 | refs/heads/master | 2020-09-07T05:05:01.209078 | 2019-11-12T12:19:49 | 2019-11-12T12:19:49 | 220,664,042 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,403 | swift | //
// PlantCardCell.swift
// Hackadeira
//
// Created by Emerson Victor on 09/11/19.
// Copyright © 2019 hackadeira. All rights reserved.
//
import UIKit
class PlantCardCell: UICollectionViewCell {
// MARK: - Propeties
@IBOutlet weak var image: UIImageView!
@IBOutlet weak var nickname: UILabel!
@IBOutlet weak var commonName: UILabel!
@IBOutlet var leafs: [UIImageView]!
@IBOutlet weak var bgView: UIView!
var status: Status! {
didSet {
switch self.status {
case .green:
for imageView in self.leafs {
imageView.image = UIImage(named: "green-leaf")
}
case .yellow:
for imageView in self.leafs {
imageView.image = UIImage(named: "gray-leaf")
}
self.leafs[1].image = UIImage(named: "yellow-leaf")
self.leafs[0].image = UIImage(named: "yellow-leaf")
case .red:
for imageView in self.leafs {
imageView.image = UIImage(named: "gray-leaf")
}
self.leafs[1].image = UIImage(named: "red-leaf")
case .none:
print("none")
}
}
}
// MARK: - Initializer
override func awakeFromNib() {
super.awakeFromNib()
}
}
| [
-1
] |
15fc9b3cb7602ece99f4049432c5cc1b70a9a4f3 | bfed5ffd5ab25cea939258e7d155d9f81778a4aa | /Dinas-Swift/Dinas-Swift/DinasAttribute.swift | 24b35464de3f1daa2164192613c57787b232c989 | [
"MIT"
] | permissive | ziooooo/Dinas-Swift | a7f6ce1f8f4f230da06f9050122441eac4f201d5 | 0b790db0759c6d42cc66db5083c350125bcf6044 | refs/heads/master | 2020-03-19T13:03:09.027374 | 2018-07-04T07:26:16 | 2018-07-04T07:26:16 | 136,557,388 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,054 | swift | //
// DinasAttribute.swift
// Dinas-Swift
//
// Created by ziooooo on 2018/6/7.
// Copyright © 2018年 ccc. All rights reserved.
//
import UIKit
enum DinasFrameAttributeType: Int {
case top = 0
case left
case bottom
case right
case width
case height
case centerX
case centerY
}
protocol DinasAttribute {}
struct DinasFrameAttribute: DinasAttribute {
private(set) var type: DinasFrameAttributeType!
init(type: DinasFrameAttributeType) {
self.type = type
}
}
struct DinasEqualToAttribute: DinasAttribute {
private(set) var target: DinasTargetProtocol!
init(target: DinasTargetProtocol) {
self.target = target
}
}
struct DinasMultiplierAttribute: DinasAttribute {
private(set) var multiplier: CGFloat!
init(multiplier: CGFloat) {
self.multiplier = multiplier
}
}
struct DinasOffsetAttribute: DinasAttribute {
private(set) var offset: CGFloat!
init(offset: CGFloat) {
self.offset = offset
}
}
| [
-1
] |
ec45016efcbfe018607075a08c906cc13e818e4c | b2c95f4da874ede8510b0d01462b19c2fea96608 | /PRMessageKit/Pods/InputBarAccessoryView/Sources/Views/SeparatorLine.swift | 5b693871db024f4433aab668d2965ab70232d0e0 | [
"MIT"
] | permissive | iOS-SOPT-iNNovation/iJoom | 4d76e48c0e8e51bbb3471d92dfc805bdddcd9413 | 8a76707dc982d1d9c4fd34b0fecd398773f07c1e | refs/heads/master | 2021-07-04T00:26:19.924478 | 2021-05-11T13:12:00 | 2021-05-11T13:12:00 | 237,371,970 | 3 | 1 | MIT | 2020-02-02T05:13:19 | 2020-01-31T06:15:58 | null | UTF-8 | Swift | false | false | 2,611 | swift | //
// SeparatorLine.swift
// InputBarAccessoryView
//
// Copyright © 2017-2019 Nathan Tannar.
//
// 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.
//
// Created by Nathan Tannar on 10/4/17.
//
import UIKit
/**
A UIView thats intrinsicContentSize is overrided so an exact height can be specified
## Important Notes ##
1. Default height is 1 pixel
2. Default backgroundColor is UIColor.lightGray
3. Intended to be used in an `InputStackView`
*/
open class SeparatorLine: UIView {
// MARK: - Properties
/// The height of the line
open var height: CGFloat = 1.0 / UIScreen.main.scale {
didSet {
constraints.filter { $0.identifier == "height" }.forEach { $0.constant = height } // Assumes constraint was given an identifier
invalidateIntrinsicContentSize()
}
}
open override var intrinsicContentSize: CGSize {
return CGSize(width: super.intrinsicContentSize.width, height: height)
}
// MARK: - Initialization
public override init(frame: CGRect) {
super.init(frame: frame)
setup()
}
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setup()
}
/// Sets up the default properties
open func setup() {
if #available(iOS 13, *) {
backgroundColor = .systemGray
} else {
backgroundColor = .lightGray
}
translatesAutoresizingMaskIntoConstraints = false
setContentHuggingPriority(.defaultHigh, for: .vertical)
}
}
| [
152841,
108429,
27794,
297624,
289063,
362023,
314156,
329779,
12599,
241849,
213179,
229436,
241856,
370112,
241858,
127700,
106583,
229212,
293981,
177379,
115812,
364264,
336235,
294139,
187263
] |
7751378eba6115e4741b5e2eafa27b81b3e0bfa3 | 98df6a43b41edb60f187d37975460b6ac9d28b15 | /Metal181116/Metal181116Tests/Metal181116Tests.swift | 3b73b4032a2eb2c83e1489bd3e44b1ee453c842c | [] | no_license | ButtFly/LYDemoArray | f4fd6a0c50aab7b5da6ed4359220be7c6e2ea534 | 6ca71f0886565e11e9194bec8ef51aad0495ccff | refs/heads/master | 2020-04-04T18:33:30.135525 | 2018-12-13T02:47:14 | 2018-12-13T02:47:14 | 156,168,454 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 917 | swift | //
// Metal181116Tests.swift
// Metal181116Tests
//
// Created by 余河川 on 2018/11/16.
// Copyright © 2018 余河川. All rights reserved.
//
import XCTest
@testable import Metal181116
class Metal181116Tests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
282633,
313357,
182296,
241692,
98333,
239650,
16419,
229413,
102437,
354343,
315432,
354345,
325674,
223274,
315434,
292902,
204840,
243759,
309295,
229424,
278570,
344107,
233517,
124975,
319542,
253999,
124984,
346162,
229430,
358456,
325694,
288833,
288834,
352326,
313416,
254027,
311372,
354385,
196691,
315476,
280661,
329814,
278615,
338007,
354393,
200794,
307289,
309345,
280675,
227428,
321637,
329829,
319591,
280677,
315497,
194666,
315498,
313447,
278634,
319598,
288879,
352368,
299121,
333940,
284788,
233589,
280694,
288889,
237689,
292988,
313469,
215164,
131198,
215166,
278655,
292992,
333955,
194691,
280712,
215178,
241808,
323729,
325776,
317587,
278677,
284826,
278685,
346271,
311458,
278691,
49316,
233636,
333991,
333992,
284842,
323236,
32941,
278704,
239793,
241843,
278708,
125109,
131256,
182456,
280762,
184505,
299198,
379071,
280768,
299203,
301251,
309444,
338119,
282831,
321745,
254170,
301279,
317664,
356576,
280802,
338150,
176362,
321772,
286958,
125169,
338164,
327929,
184570,
243962,
184575,
125183,
309503,
125188,
194820,
313608,
125193,
321800,
375051,
180493,
125198,
125199,
325905,
254226,
125203,
319763,
338197,
334103,
325912,
315673,
309529,
125208,
299293,
237856,
278816,
125217,
233762,
211235,
217380,
305440,
282919,
151847,
325931,
321840,
98610,
125235,
332083,
332085,
280887,
125240,
332089,
278842,
282939,
315706,
287041,
241986,
260418,
321860,
319813,
182598,
280902,
332101,
323916,
319821,
254286,
348492,
325968,
323920,
250192,
6481,
344401,
348500,
366929,
155990,
366930,
6489,
272729,
332123,
379225,
106847,
391520,
354655,
323935,
321894,
242023,
280939,
242029,
246127,
354676,
246136,
139640,
246137,
291192,
317820,
211326,
313727,
311681,
240002,
248194,
362881,
225670,
332167,
311691,
395659,
227725,
395661,
240016,
108944,
190871,
291224,
293274,
317852,
121245,
283038,
141728,
61857,
246178,
315810,
315811,
285090,
61859,
289189,
375207,
108972,
340398,
311727,
377264,
61873,
334260,
61880,
283064,
319930,
311738,
278970,
336317,
293310,
311745,
278978,
127427,
127428,
283075,
324039,
188871,
317901,
281040,
278993,
326100,
278999,
328152,
176601,
242139,
369116,
285150,
287198,
279008,
358882,
342498,
242148,
242149,
195045,
279013,
279018,
319981,
291311,
281072,
109042,
319987,
279029,
279032,
233978,
279039,
301571,
291333,
342536,
287241,
279050,
340490,
283153,
289304,
279065,
342553,
322078,
291358,
182817,
375333,
377386,
283184,
23092,
315960,
338490,
242237,
352829,
70209,
115270,
70215,
322120,
301638,
348742,
55881,
348749,
281166,
309846,
244310,
332378,
295519,
354911,
436832,
242277,
66150,
244327,
111208,
344680,
191082,
313966,
281199,
313971,
244347,
279164,
189057,
311941,
348806,
279177,
369289,
330379,
344715,
184973,
287374,
326287,
311949,
316049,
311954,
334481,
330387,
111253,
316053,
330388,
352917,
227990,
111258,
111259,
289434,
230040,
271000,
205471,
342682,
279206,
295590,
287404,
295599,
303793,
318130,
299699,
299700,
164533,
166582,
338613,
230072,
109241,
314040,
287417,
158394,
342713,
285373,
66242,
248517,
363211,
334547,
279252,
318173,
289502,
363230,
295652,
279269,
338662,
246503,
285415,
330474,
342762,
346858,
129773,
289518,
322291,
312052,
312053,
199414,
154359,
228088,
35583,
299776,
205568,
162561,
191235,
363263,
285444,
264968,
322316,
117517,
326414,
312079,
322319,
166676,
207640,
285466,
283419,
326429,
336671,
281377,
326433,
344865,
279336,
318250,
295724,
353069,
318252,
152365,
312108,
328499,
242485,
353078,
230199,
353079,
293693,
336702,
279362,
420677,
353094,
353095,
299849,
283467,
293711,
281427,
353109,
244568,
281433,
244570,
322395,
230234,
109409,
293730,
303972,
351077,
275303,
342887,
201577,
326505,
242541,
246641,
330609,
228215,
246648,
209785,
269178,
177019,
279417,
361337,
254850,
359298,
240518,
109447,
287622,
228233,
316298,
228234,
236428,
58253,
308107,
56208,
308112,
295824,
209817,
324506,
324507,
318364,
127902,
240544,
289698,
189348,
324517,
289703,
353195,
140204,
316333,
353197,
316343,
353216,
349121,
363458,
19399,
213960,
326601,
279498,
316364,
338899,
340955,
248796,
248797,
207838,
50143,
130016,
340961,
64485,
314342,
123881,
324586,
289774,
183279,
304110,
320494,
340974,
316405,
240630,
295927,
201720,
304122,
320507,
328700,
318461,
314362,
328706,
320516,
134150,
230410,
320527,
146448,
324625,
330772,
316437,
140310,
322582,
320536,
418837,
197657,
281626,
201755,
336929,
300068,
357414,
248872,
345132,
238639,
322612,
252980,
300084,
359478,
324666,
238651,
302139,
308287,
21569,
214086,
359495,
238664,
300111,
314448,
341073,
339030,
353367,
156764,
277597,
304222,
156765,
113760,
314467,
281700,
250981,
285798,
322663,
300136,
316520,
228458,
207979,
318572,
316526,
15471,
357486,
187506,
353397,
337017,
160891,
285820,
341115,
363644,
150657,
187521,
248961,
349316,
279685,
349318,
222343,
228491,
228493,
285838,
177296,
169104,
162961,
326804,
185493,
296086,
308372,
187544,
324760,
119962,
300187,
296092,
300188,
339102,
302240,
343203,
300201,
300202,
253099,
238765,
318639,
279728,
337077,
367799,
339130,
208058,
230588,
64700,
343234,
367810,
259268,
353479,
353480,
283847,
62665,
353481,
244940,
283853,
353482,
283852,
290000,
333011,
316627,
189653,
228563,
148696,
296153,
357595,
279774,
298208,
310497,
298212,
304356,
290022,
330984,
328940,
228588,
234733,
253167,
279792,
353523,
353524,
298228,
228600,
216315,
208124,
316669,
388349,
363771,
228609,
320770,
279814,
322824,
242954,
312587,
292107,
318733,
328971,
251153,
177428,
245019,
320796,
126237,
130338,
333090,
208164,
130343,
351537,
345396,
318775,
300343,
116026,
222524,
306494,
216386,
193859,
279875,
286018,
345415,
312648,
230729,
224586,
372043,
177484,
251213,
238927,
296273,
331090,
120148,
318805,
314710,
283991,
279920,
316765,
222559,
314720,
292195,
230756,
294243,
314726,
314728,
333160,
230765,
243056,
327024,
327025,
316787,
116084,
314741,
296307,
312689,
314739,
327031,
306559,
224640,
314751,
318848,
179587,
378244,
314758,
298374,
314760,
388487,
368011,
304524,
314766,
296335,
112017,
112018,
306579,
234898,
282007,
357786,
318875,
314783,
290207,
333220,
314789,
282022,
314791,
279974,
245161,
316842,
282024,
241066,
314798,
286129,
173491,
150965,
210358,
284089,
228795,
292283,
302529,
302531,
292292,
163268,
339398,
300487,
296392,
380357,
280010,
415171,
361927,
280013,
300489,
370123,
148940,
310732,
64975,
312782,
327121,
222675,
366037,
210390,
210391,
353750,
210393,
228827,
239068,
286172,
280032,
310757,
187878,
245223,
280041,
361963,
329197,
191981,
54765,
329200,
321009,
282096,
306673,
333300,
251378,
191990,
343542,
280055,
288249,
300536,
343543,
286205,
290301,
210433,
282114,
228867,
366083,
323080,
329225,
230921,
253452,
323087,
304656,
329232,
316946,
146964,
398869,
175639,
374296,
308764,
282141,
349726,
282146,
306723,
245287,
245292,
349741,
169518,
230959,
312880,
286254,
288309,
290358,
312889,
235070,
288318,
280130,
349763,
124485,
56902,
282183,
288327,
288326,
292425,
243274,
333388,
128587,
286288,
333393,
290390,
128599,
235095,
300630,
196187,
343647,
323172,
345700,
374372,
282213,
310889,
323178,
243307,
312940,
204397,
54893,
325231,
138863,
222832,
224883,
314998,
247416,
288378,
366203,
323196,
325245,
175741,
235135,
337535,
294529,
312965,
282245,
323207,
224901,
282246,
288392,
229001,
310923,
188048,
323217,
239250,
282259,
345752,
229020,
282271,
255649,
282276,
229029,
298661,
245412,
206504,
282280,
40613,
298667,
40614,
61101,
40615,
321199,
337591,
321207,
296632,
319162,
280251,
286399,
323264,
323263,
282303,
321219,
218819,
319177,
306890,
280267,
212685,
333517,
333520,
313041,
241361,
333521,
245457,
241365,
302802,
333523,
280278,
278233,
18138,
280280,
298712,
278234,
294622,
321247,
278240,
298720,
325346,
153319,
12010,
280300,
239341,
212716,
212717,
282348,
284401,
282358,
229113,
313081,
286459,
325371,
124669,
194303,
278272,
319233,
175873,
323331,
323332,
216839,
280327,
280329,
284429,
278291,
321302,
294678,
366360,
116505,
249626,
284442,
325404,
286494,
321310,
282400,
241441,
241442,
325410,
339745,
341796,
247590,
257830,
294700,
317232,
300848,
282417,
321337,
282427,
319292,
360252,
325439,
315202,
307011,
325445,
153415,
345929,
341836,
325457,
337747,
18262,
280410,
370522,
188251,
307039,
345951,
362337,
284514,
345955,
296806,
292712,
288619,
325484,
280430,
313199,
292720,
362352,
313203,
325492,
317304,
333688,
241528,
194429,
124798,
325503,
315264,
339841,
182144,
305026,
327557,
253829,
243591,
282504,
333701,
67463,
325515,
243597,
325518,
329622,
337815,
294807,
282518,
282519,
124824,
214937,
118685,
298909,
319392,
292771,
354212,
313254,
333735,
294823,
284587,
292782,
323507,
200627,
243637,
124852,
288697,
294843,
214977,
280514,
294850,
163781,
151497,
247757,
344013,
212946,
219101,
280541,
298980,
292837,
294886,
292836,
337895,
247785,
253929,
296941,
327661,
124911,
329712,
362480,
325619,
282612,
333817,
313339
] |
a62d85958e516579458a47da371878abe0b46437 | f16d5142ec5af6c140d5b3e5a56a85165e5c6a44 | /SimpleFactory/Calculate_Demo/Calculate_Demo/Operate.swift | c0e87e896bdb7ad43eb5062010c0a7521b92a4b5 | [] | no_license | angryBearLX/DesignPattern | 7268ca8cc910e25fd4aa31fdcd40ad6efe4bcbc0 | b43f3a0b4a07ba849d6ba702aa5af7b844d5f516 | refs/heads/master | 2016-08-12T04:58:59.991776 | 2015-11-19T09:27:15 | 2015-11-19T09:27:15 | 46,481,585 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,498 | swift | //
// Operate.swift
// Calculate_demo
//
// Created by Liu on 15/11/18.
// Copyright © 2015年 AngryBear. All rights reserved.
//
import Foundation
class Operate {
var number1:Int64 = 0
var number2:Int64 = 0
func getResult() -> Int64 {
return 0
}
}
class AddOperation: Operate {
override func getResult() -> Int64 {
let result: Int64 = self.number1 + self.number2
return result
}
}
class SubtractOperation: Operate {
override func getResult() -> Int64 {
let result: Int64 = self.number1 - self.number2
return result
}
}
class MultiplyOperation: Operate {
override func getResult() -> Int64 {
let result: Int64 = self.number1*self.number2
return result
}
}
class DivideOperation: Operate {
override func getResult() -> Int64 {
let result: Int64 = self.number2 != 0 ? self.number1/self.number2 : 0
return result
}
}
class OperateFactory {
class func createOperation(operateStr: Character) -> Operate? {
var operateObj: Operate?
switch operateStr {
case "+":
operateObj = AddOperation()
break
case "-":
operateObj = SubtractOperation()
break
case "*":
operateObj = MultiplyOperation()
break
case "/":
operateObj = DivideOperation()
break
default:
break
}
return operateObj
}
} | [
-1
] |
cdd0d6f74310318912d56f80b8f71a1bbafbf1d8 | 82163c7d0a924db7a935e5302a492db324577242 | /AnnTest/Scenes/PreviewImage/PreviewImageViewController.swift | d783ff8f1152e96192f02ef66aad9f7abeb5628a | [] | no_license | Monserg/AnnTest | 1d0a8bec61e745dacc564e4c965bac08c80934b3 | 6fc644691a0b8c0622633249ba985e69c9f39108 | refs/heads/main | 2023-01-10T21:07:10.495292 | 2020-11-09T06:23:46 | 2020-11-09T06:23:46 | 310,381,203 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 934 | swift | //
// PreviewImageViewController.swift
// AnnTest
//
// Created by Sergey Monastyrskiy on 06.11.2020.
//
import UIKit
import Combine
class PreviewImageViewController: UIViewController {
// MARK: - Properties
private var imageSubscriber: AnyCancellable?
// MARK: - IBOutlets
@IBOutlet weak var imageView: UIImageView!
@IBOutlet var previewImageViewModel: PreviewImageViewModel!
// MARK: - Class functions
override func viewDidLoad() {
super.viewDidLoad()
view.showLoading()
title = "Image preview"
bindViewModel()
downloadImage()
}
private func bindViewModel() {
imageSubscriber = previewImageViewModel.$image.receive(on: DispatchQueue.main).assign(to: \.image, on: imageView)
}
private func downloadImage() {
previewImageViewModel.downloadImage {
self.view.stopLoading()
}
}
}
| [
-1
] |
d0d4a9e4d96deef87c7a71e3b19139cff3d8f468 | b4e9cccfe5785feda6161ccb24870824757059f7 | /Toka/RedesSocialesVC.swift | aea3175dfd14efd9203ff7140bec3cfbb504d802 | [] | no_license | mariodavalos/Toka | 6882d531e319ca2451b215905aedbd33e5c6c556 | 1cb9eda0cff48d42f99d9ec10502ee6c5c8aa41d | refs/heads/master | 2020-01-23T22:01:14.751185 | 2016-11-25T00:13:26 | 2016-11-25T00:13:26 | 74,712,590 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,281 | swift | //
// RedesSocialesVC.swift
// Toka
//
// Created by Martin Viruete Gonzalez on 20/06/16.
// Copyright © 2016 oOMovil. All rights reserved.
//
import UIKit
class RedesSocialesVC: UIViewController {
@IBOutlet weak var webView: UIWebView!
@IBOutlet weak var buttonFacebook: UIButton!
@IBOutlet weak var buttonTwitter: UIButton!
@IBOutlet weak var buttonLinkedIn: UIButton!
@IBOutlet weak var buttonYouTube: UIButton!
var index: Int = 0
override func viewDidLoad() {
super.viewDidLoad()
self.loadWebView()
}
@IBAction func cargarRedSocial(sender: UIButton){
self.index = sender.tag
self.apagarBotones()
switch self.index {
case 0: self.buttonFacebook.setImage(UIImage(named: "ios_redes_fb_act"), forState: .Normal)
case 1: self.buttonTwitter.setImage(UIImage(named: "ios_redes_tw_act"), forState: .Normal)
case 2: self.buttonLinkedIn.setImage(UIImage(named: "ios_redes_in_act"), forState: .Normal)
case 3: self.buttonYouTube.setImage(UIImage(named: "ios_redes_yt_act"), forState: .Normal)
default: return
}
self.loadWebView()
}
func loadWebView(){
var urlString: String?
switch self.index {
case 0: urlString = "https://www.facebook.com/TokaMx/"
case 1: urlString = "https://twitter.com/Toka_mx"
case 2: urlString = "https://www.linkedin.com/company/toka-investment-sa-de-cv-sofom-enr"
case 3: urlString = "https://www.youtube.com/channel/UCEQj5EcJjrlpecacWQn81jQ"
default: urlString = nil
}
if urlString != nil{
guard let url = NSURL(string: urlString!) else { return }
let request = NSURLRequest(URL: url)
self.webView.loadRequest(request)
}
}
func apagarBotones(){
self.buttonFacebook.setImage(UIImage(named: "ios_redes_fb_off"), forState: .Normal)
self.buttonTwitter.setImage(UIImage(named: "ios_redes_tw_off"), forState: .Normal)
self.buttonLinkedIn.setImage(UIImage(named: "ios_redes_in_off"), forState: .Normal)
self.buttonYouTube.setImage(UIImage(named: "ios_redes_yt_off"), forState: .Normal)
}
}
| [
-1
] |
74db4621e2cac72d3c2c4646d6d0148edb107d4d | 843b7a85b285dc291d4af9f1118279369552b43f | /Udacity_TVOS/YoutubeAPI.swift | b06c6e1e19cca9934705ce68b834cfc92be85179 | [] | no_license | inailuy/Udacity_TVOS | a6fa1f1372f09d8f66b01f4b0f71f07b2c9dfb00 | 0fa1508503a0530b312024fd8f67b92acc05a9aa | refs/heads/master | 2021-01-19T02:59:40.109028 | 2016-07-16T04:31:36 | 2016-07-16T04:31:36 | 62,976,113 | 5 | 3 | null | null | null | null | UTF-8 | Swift | false | false | 4,648 | swift | //
// YoutubeAPI.swift
// Udacity_TVOS
//
// Created by inailuy on 7/8/16.
//
//
import Foundation
import UIKit
let baseURL = "https://www.googleapis.com/youtube/v3/"
let playlistItemsSuffix = "playlistItems?"
let playlistSuffix = "playlists?"
let suffixParameters = "part=snippet&maxResults=50"
let channelId = "&channelId=UCBVCi5JbYmfG3q5MEuoWdOw"
let APIkey = "&key=AIzaSyBV2lTiVQqrpoxkUdgCtQ7utwRVwjgNFTg"
let YoutubePostNotification = "fetchedAllPlaylists"
class YoutubeAPI {
static let sharedInstance = YoutubeAPI()
var playlist: Playlist!
var playlistItems: Playlist!
var imageDictionary = NSMutableDictionary()
func getPlaylistModel() {
let string = baseURL + playlistSuffix + suffixParameters + channelId + APIkey
let url = NSURL(string: string)
SVProgressHUD.show()
let task = NSURLSession.sharedSession().dataTaskWithURL(url!, completionHandler: {(data, reponse, error) in
if error == nil {
do {
let jsonResults = try NSJSONSerialization.JSONObjectWithData(data!, options: [])
self.playlist = Playlist(dictionary: jsonResults as! NSDictionary)
NSNotificationCenter.defaultCenter().postNotificationName(YoutubePostNotification, object: nil)
SVProgressHUD.dismiss()
//print(jsonResults)
} catch {
// failure
print("Fetch failed: \((error as NSError).localizedDescription)")
}
}
})
task.resume()
}
func getNextPlaylistModel() {
let pageToken = "&pageToken=" + playlist.nextPageToken!
let string = baseURL + playlistSuffix + suffixParameters + channelId + pageToken + APIkey
let url = NSURL(string: string)
SVProgressHUD.show()
let task = NSURLSession.sharedSession().dataTaskWithURL(url!, completionHandler: {(data, reponse, error) in
if error == nil {
do {
let jsonResults = try NSJSONSerialization.JSONObjectWithData(data!, options: [])
// creating new array to later insert new items
var array = self.playlist.items
self.playlist = Playlist(dictionary: jsonResults as! NSDictionary)
array.appendContentsOf(self.playlist.items)
self.playlist.items = array
NSNotificationCenter.defaultCenter().postNotificationName(YoutubePostNotification, object: nil)
SVProgressHUD.dismiss()
} catch {
// failure
print("Fetch failed: \((error as NSError).localizedDescription)")
}
}
})
task.resume()
}
func getPlaylistItems(playlistId: String) {
let urlString = baseURL + playlistItemsSuffix + suffixParameters + "&playlistId=" + playlistId + APIkey
let url = NSURL(string: urlString)
SVProgressHUD.show()
let task = NSURLSession.sharedSession().dataTaskWithURL(url!, completionHandler: {(data, reponse, error) in
if error == nil {
do {
let jsonResults = try NSJSONSerialization.JSONObjectWithData(data!, options: [])
self.playlistItems = Playlist(dictionary: jsonResults as! NSDictionary)
NSNotificationCenter.defaultCenter().postNotificationName(YoutubePostNotification, object: nil)
SVProgressHUD.dismiss()
//print(jsonResults)
} catch {
// failure
print("Fetch failed: \((error as NSError).localizedDescription)")
}
}
})
task.resume()
}
func loadImages(inputURL: String, completion: (result: UIImage) -> Void) {
if let img = imageDictionary[inputURL] { // check if image already exists
completion(result: img as! UIImage)
} else {
let imgUrl = NSURL(string: inputURL)
let task = NSURLSession.sharedSession().dataTaskWithURL(imgUrl!, completionHandler: {(data, reponse, error) in
if error == nil {
let img = UIImage(data: data!)
self.imageDictionary.setValue(img, forKey: inputURL)
dispatch_async(dispatch_get_main_queue(), {
completion(result: img!)
})
}
})
task.resume()
}
}
} | [
-1
] |
8ba0d4cb789c80e5c19056ab569e1c21aea9e768 | 099dc6d8ba40e8ef34d6191b24cf046835f63a63 | /Zircles/Utils/SeedManagement.swift | aa89dc464d6bbeb49c7bf9157741163b6d9b3e90 | [
"MIT"
] | permissive | zcash-hackworks/zircles-ios | 60f2db98d507d0099d338fa59c959e14ebe5d78c | 0f7ed09c8119aabee9b5b879241ae0114ecc175b | refs/heads/master | 2022-11-14T04:40:34.302629 | 2020-07-08T16:00:05 | 2020-07-08T16:00:05 | 272,740,306 | 2 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 4,682 | swift | //
// SeedManagement.swift
// wallet
//
// Created by Francisco Gindre on 1/23/20.
// Copyright © 2020 Francisco Gindre. All rights reserved.
//
import Foundation
import KeychainSwift
import ZcashLightClientKit
final class SeedManager {
enum SeedManagerError: Error {
case alreadyImported
case uninitializedWallet
}
static var `default`: SeedManager = SeedManager()
private static let zECCWalletKeys = "zECCWalletKeys"
private static let zECCWalletSeedKey = "zEECWalletSeedKey"
private static let zECCWalletBirthday = "zECCWalletBirthday"
private static let zECCWalletPhrase = "zECCWalletPhrase"
private let keychain = KeychainSwift()
func importBirthday(_ height: BlockHeight) throws {
guard keychain.get(Self.zECCWalletBirthday) == nil else {
throw SeedManagerError.alreadyImported
}
keychain.set(String(height), forKey: Self.zECCWalletBirthday)
}
func exportBirthday() throws -> BlockHeight {
guard let birthday = keychain.get(Self.zECCWalletBirthday),
let value = BlockHeight(birthday) else {
throw SeedManagerError.uninitializedWallet
}
return value
}
func importSeed(_ seed: [UInt8]) throws {
guard keychain.get(Self.zECCWalletSeedKey) == nil else { throw SeedManagerError.alreadyImported }
keychain.set(Data(seed), forKey: Self.zECCWalletSeedKey)
}
func exportSeed() throws -> [UInt8] {
guard let seedData = keychain.getData(Self.zECCWalletSeedKey) else { throw SeedManagerError.uninitializedWallet }
return [UInt8](seedData)
}
func importPhrase(bip39 phrase: String) throws {
guard keychain.get(Self.zECCWalletPhrase) == nil else { throw SeedManagerError.alreadyImported }
keychain.set(phrase, forKey: Self.zECCWalletPhrase)
}
func exportPhrase() throws -> String {
guard let seed = keychain.get(Self.zECCWalletPhrase) else { throw SeedManagerError.uninitializedWallet }
return seed
}
func saveKeys(_ keys: [String]) {
keychain.set(keys.joined(separator: ";"), forKey: Self.zECCWalletKeys)
}
func getKeys() -> [String]? {
keychain.get(Self.zECCWalletKeys)?.split(separator: ";").map{String($0)}
}
/**
*/
func nukePhrase() {
keychain.delete(Self.zECCWalletPhrase)
}
/**
Use carefully: Deletes the keys from the keychain
*/
func nukeKeys() {
keychain.delete(Self.zECCWalletKeys)
}
/**
Use carefully: Deletes the seed from the keychain.
*/
func nukeSeed() {
keychain.delete(Self.zECCWalletSeedKey)
}
/**
Use carefully: deletes the wallet birthday from the keychain
*/
func nukeBirthday() {
keychain.delete(Self.zECCWalletBirthday)
}
/**
There's no fate but what we make for ourselves - Sarah Connor
*/
func nukeWallet() {
for key in keychain.allKeys {
keychain.delete(key)
}
}
}
extension SeedManager: SeedProvider {
func seed() -> [UInt8] {
(try? exportSeed()) ?? []
}
}
extension SeedManager {
func saveKeys(_ key: String, phrase: String,height: BlockHeight, spendingKey: String) throws {
guard keychain.get(heightKey(key)) == nil else {
throw SeedManagerError.alreadyImported
}
keychain.set(String(height), forKey: heightKey(key))
guard keychain.get(phraseKey(key)) == nil else {
throw SeedManagerError.alreadyImported
}
keychain.set(String(phrase), forKey: phraseKey(key))
guard keychain.get(spendingKeyKey(key)) == nil else {
throw SeedManagerError.alreadyImported
}
keychain.set(String(spendingKey), forKey: spendingKeyKey(key))
}
func getZircleKeys(_ key: String) throws -> (height: BlockHeight, phrase: String, spendingKey: String)? {
guard let heightString = keychain.get(heightKey(key)),
let height = BlockHeight(heightString),
let phrase = keychain.get(phraseKey(key)),
let spendingKey = keychain.get(spendingKeyKey(key)) else {
return nil
}
return (height: height, phrase: phrase, spendingKey: spendingKey)
}
func heightKey(_ key: String) -> String {
key+"+height"
}
func phraseKey(_ key: String) -> String {
key+"+phrase"
}
func spendingKeyKey(_ key: String) -> String {
key+"+spending"
}
}
| [
-1
] |
c64ffaf1b2c8fc314796d3d9ce807676c5d62510 | 919ba46cfb2b8bfda9894412e19935cb94d12857 | /Library/Styles/BarButtonItemStyles.swift | 10512537a35d59cb46a93e5366e0ceba09b80d88 | [
"Apache-2.0",
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-facebook-software-license"
] | permissive | ContentSquare/ios-oss | a99a59bc649d4932603db2d3a41d7f51c347ebfc | 2774a761fca5bf62008f5c27f28413bae6ab8ed9 | refs/heads/master | 2022-04-06T10:57:59.942258 | 2020-02-12T17:52:49 | 2020-02-12T17:52:49 | 191,758,679 | 1 | 0 | Apache-2.0 | 2020-02-12T17:52:50 | 2019-06-13T12:27:51 | Swift | UTF-8 | Swift | false | false | 1,125 | swift | import Prelude
import Prelude_UIKit
import UIKit
public let baseBarButtonItemStyle =
UIBarButtonItem.lens.tintColor .~ .ksr_dark_grey_500
public let plainBarButtonItemStyle = baseBarButtonItemStyle
<> UIBarButtonItem.lens.style .~ .plain
<> UIBarButtonItem.lens.titleTextAttributes(for: .normal) .~ [
NSAttributedString.Key.font: UIFont.ksr_subhead(size: 15)
]
public let doneBarButtonItemStyle = baseBarButtonItemStyle
<> UIBarButtonItem.lens.style .~ .done
<> UIBarButtonItem.lens.title %~ { _ in Strings.Done() }
<> UIBarButtonItem.lens.titleTextAttributes(for: .normal) .~ [
NSAttributedString.Key.font: UIFont.ksr_headline(size: 15)
]
public let iconBarButtonItemStyle = baseBarButtonItemStyle
<> UIBarButtonItem.lens.title .~ nil
public let closeBarButtonItemStyle = iconBarButtonItemStyle
<> UIBarButtonItem.lens.image .~ image(named: "icon--cross")
public let shareBarButtonItemStyle = iconBarButtonItemStyle
<> UIBarButtonItem.lens.image .~ image(named: "icon--share")
<> UIBarButtonItem.lens.accessibilityLabel %~ { _ in Strings.dashboard_accessibility_label_share_project() }
| [
-1
] |
be5507ed2acb7eecbdd28f0c24a779e7819122b5 | 64e80e2616f11dd35ee76c4419dcabf67cf1ec82 | /Pokedex/Presentador/Home/HomeViewController.swift | 6b757ee459ba2181ffbf0a71566c23792d90e457 | [] | no_license | MagdielPm/Pokedex | 12a35f79bb481d464f3743640ef7fdf352ace4af | cb875a25df3fc7c4bef006d8ca199425954252a6 | refs/heads/master | 2020-06-12T00:48:24.515811 | 2019-07-02T20:40:21 | 2019-07-02T20:40:21 | 194,140,401 | 1 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 7,122 | swift | //
// HomeViewController.swift
// Pokedex
//
// Created by InternGuest on 6/20/19.
// Copyright © 2019 InternGuest. All rights reserved.
//
import UIKit
class HomeViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource {
@IBOutlet weak var txtSearch: UITextField!
@IBOutlet weak var btnAll: UIButton!
@IBOutlet weak var cvPokemones: UICollectionView!
var realPokemones = [Pokemon.init(number: 1, name: "Bulbasaur", type: [.grass, .poison], img: UIImage(named: "Pruebaxd")!),
Pokemon.init(number: 2, name: "Ivysaur", type: [.grass, .poison], img: UIImage(named: "Pruebaxd")!),
Pokemon.init(number: 3, name: "Venusaur", type: [.grass, .poison], img: UIImage(named: "Pruebaxd")!),
Pokemon.init(number: 4, name: "Charmander", type: [.fire], img: UIImage(named: "Pruebaxd")!),
Pokemon.init(number: 5, name: "Charmeleon", type: [.fire], img: UIImage(named: "Pruebaxd")!),
Pokemon.init(number: 6, name: "Charizard", type: [.fire, .flying], img: UIImage(named: "Pruebaxd")!),
Pokemon.init(number: 7, name: "Squirtle", type: [.water], img: UIImage(named: "Pruebaxd")!),
Pokemon.init(number: 8, name: "Wartortle", type: [.water], img: UIImage(named: "Pruebaxd")!),
Pokemon.init(number: 9, name: "Blastoise", type: [.water], img: UIImage(named: "Pruebaxd")!)]
override func viewDidLoad() {
super.viewDidLoad()
let searchImage = UIImage(named: "search")
self.navigationController?.isNavigationBarHidden = true
addImageTo(txtField: txtSearch, andImage: searchImage!)
cvPokemones.delegate = self
cvPokemones.dataSource = self
registerCell()
txtSearch.addTarget(self, action: #selector(searchRecords(_ :)), for: .editingChanged)
}
func getOriginalData() -> [Pokemon]{
return [Pokemon.init(number: 1, name: "Bulbasaur", type: [.grass, .poison], img: UIImage(named: "Pruebaxd")!),
Pokemon.init(number: 2, name: "Ivysaur", type: [.grass, .poison], img: UIImage(named: "Pruebaxd")!),
Pokemon.init(number: 3, name: "Venusaur", type: [.grass, .poison], img: UIImage(named: "Pruebaxd")!),
Pokemon.init(number: 4, name: "Charmander", type: [.fire], img: UIImage(named: "Pruebaxd")!),
Pokemon.init(number: 5, name: "Charmeleon", type: [.fire], img: UIImage(named: "Pruebaxd")!),
Pokemon.init(number: 6, name: "Charizard", type: [.fire, .flying], img: UIImage(named: "Pruebaxd")!),
Pokemon.init(number: 7, name: "Squirtle", type: [.water], img: UIImage(named: "Pruebaxd")!),
Pokemon.init(number: 8, name: "Wartortle", type: [.water], img: UIImage(named: "Pruebaxd")!),
Pokemon.init(number: 9, name: "Blastoise", type: [.water], img: UIImage(named: "Pruebaxd")!)]
}
func searchPokemon( for searchString: String? ){
realPokemones = getOriginalData()
var pokemonUpdate : [Pokemon] = []
if let pokemonToSearch: String = searchString {
for pokes in realPokemones{
let range = pokes.name.lowercased().range(of: pokemonToSearch, options: .caseInsensitive, range: nil, locale: nil)
if range != nil {
pokemonUpdate.append(pokes)
}
}
}
self.realPokemones = pokemonUpdate
self.cvPokemones.reloadData()
}
func searchByType(name: String){
realPokemones = getOriginalData()
var pokemonUpdate : [Pokemon] = []
if name != "ALL" {
for pokes in realPokemones{
let pokemonTypes = pokes.type.filter({ $0.title == name })
if !pokemonTypes.isEmpty {
pokemonUpdate.append(pokes)
}
}
self.realPokemones = pokemonUpdate
}
self.cvPokemones.reloadData()
}
@objc func searchRecords(_ textField: UITextField){
realPokemones = getOriginalData()
if !textField.text!.isEmpty {
searchPokemon(for: textField.text!)
}else{
self.cvPokemones.reloadData()
}
}
override func viewWillAppear(_ animated: Bool) {
self.navigationController?.isNavigationBarHidden = true
}
func addImageTo(txtField: UITextField, andImage img: UIImage){
let leftImageView = UIImageView(frame: CGRect(x: 100, y: 0, width:img.size.width,height: img.size.height))
leftImageView.image = img
txtField.leftView = leftImageView
txtField.leftViewMode = .always
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return realPokemones.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! ListCollectionViewCell
cell.number.text = "#\(realPokemones[indexPath.item].number)"
cell.name.text = realPokemones[indexPath.item].name
cell.ImageView.image = realPokemones[indexPath.item].img
if realPokemones[indexPath.item].type.count == 1 {
cell.DoubleLabel.isHidden = true
cell.oneType.text = realPokemones[indexPath.item].type[0].title
cell.oneType.backgroundColor = realPokemones[indexPath.item].type[0].color
}else{
cell.DoubleLabel.isHidden = false
cell.firstType.text = realPokemones[indexPath.item].type[0].title
cell.firstType.backgroundColor = realPokemones[indexPath.item].type[0].color
cell.secondType.text = realPokemones[indexPath.item].type[1].title
cell.secondType.backgroundColor = realPokemones[indexPath.item].type[1].color
}
return cell
}
func registerCell(){
cvPokemones.register(ListCollectionViewCell.self, forCellWithReuseIdentifier: "Cell")
let nib = UINib(nibName: String(describing: ListCollectionViewCell.self), bundle: nil)
cvPokemones.register(nib, forCellWithReuseIdentifier: "Cell")
}
@IBAction func changeToTypeView(_ sender: Any) {
let storyboard = UIStoryboard(name: "TypeView", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "TypeView") as! TypeViewController
viewController.delegate = self
self.navigationController?.pushViewController(viewController, animated : true)
}
}
extension HomeViewController: TypeViewControllerDelegate{
func didUserSelectFilter(name: String) {
searchByType(name: name)
}
}
| [
-1
] |
835bdfaec2072c7b423ffb04b4c6bb7aee046389 | 3be36d52cf65f2b2519eae96e47c4909ddf007a1 | /Proton/Sources/Core/RichTextEditorContext.swift | 4ae61c127e479aeef815bab3fc01a19af5849654 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | HevenHoo/proton | 635dd1249bdced6fee4b4bfd6775d49305c2ec3c | bcd682e456b44bc36b81c37bc0b8ae496de73c53 | refs/heads/master | 2022-07-05T06:57:34.987589 | 2020-05-12T09:36:55 | 2020-05-12T09:36:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,385 | swift | //
// RichTextViewContext.swift
// Proton
//
// Created by Rajdeep Kwatra on 7/1/20.
// Copyright © 2020 Rajdeep Kwatra. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
import UIKit
import CoreServices
class RichTextEditorContext: RichTextViewContext {
static let `default` = RichTextEditorContext()
func textViewDidBeginEditing(_ textView: UITextView) {
guard textView.delegate === self else { return }
activeTextView = textView as? RichTextView
guard let richTextView = activeTextView else { return }
activeTextView?.richTextViewDelegate?.richTextView(richTextView, didReceiveFocusAt: textView.selectedRange)
let range = textView.selectedRange
var attributes = richTextView.typingAttributes
let contentType = attributes[.blockContentType] as? EditorContent.Name ?? .unknown
attributes[.blockContentType] = nil
richTextView.richTextViewDelegate?.richTextView(richTextView, didChangeSelection: range, attributes: attributes, contentType: contentType)
}
func textViewDidEndEditing(_ textView: UITextView) {
guard textView.delegate === self else { return }
defer {
activeTextView = nil
}
guard let richTextView = activeTextView else { return }
activeTextView?.richTextViewDelegate?.richTextView(richTextView, didLoseFocusFrom: textView.selectedRange)
}
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
guard textView.delegate === self else { return true }
guard let richTextView = activeTextView else { return true }
// if backspace
var handled = false
if text.isEmpty {
richTextView.richTextViewDelegate?.richTextView(richTextView, didReceiveKey: .backspace, modifierFlags: [], at: range, handled: &handled)
guard handled == false else {
return false
}
let substring = textView.attributedText.attributedSubstring(from: range)
guard substring.length > 0,
let attachment = substring.attribute(.attachment, at: 0, effectiveRange: nil) as? Attachment,
attachment.selectBeforeDelete else {
return true
}
if attachment.isSelected {
return true
} else {
attachment.isSelected = true
return false
}
}
if text == "\n" {
richTextView.richTextViewDelegate?.richTextView(richTextView, didReceiveKey: .enter, modifierFlags: [], at: range, handled: &handled)
guard handled == false else {
return false
}
}
if text == "\t" {
richTextView.richTextViewDelegate?.richTextView(richTextView, didReceiveKey: .tab, modifierFlags: [], at: range, handled: &handled)
guard handled == false else {
return false
}
}
applyFontFixForEmojiIfRequired(in: richTextView, at: range)
return true
}
func textViewDidChange(_ textView: UITextView) {
guard textView.delegate === self else { return }
guard let richTextView = activeTextView else { return }
applyFontFixForEmojiIfRequired(in: richTextView, at: textView.selectedRange)
richTextView.richTextViewDelegate?.richTextView(richTextView, didChangeTextAtRange: richTextView.selectedRange)
}
// This func is required to handle a bug in NSTextStorage/UITextView where after inserting an emoji character, the
// typing attributes are set to default Menlo font. This causes the editor to lose the applied font that exists before the emoji
// character. The code looks for existing font information before emoji char and resets that in the typing attributes.
private func applyFontFixForEmojiIfRequired(in textView: RichTextView, at range: NSRange) {
guard let font = textView.typingAttributes[.font] as? UIFont,
font.isAppleEmoji else {
return
}
textView.typingAttributes[.font] = getDefaultFont(textView: textView, before: range)
}
private func getDefaultFont(textView: RichTextView, before range: NSRange) -> UIFont {
var fontToApply: UIFont?
let traversalRange = NSRange(location: 0, length: range.location)
textView.enumerateAttribute(.font, in: traversalRange, options: [.longestEffectiveRangeNotRequired, .reverse]) { font, fontRange, stop in
if let font = font as? UIFont,
font.isAppleEmoji == false {
fontToApply = font
stop.pointee = true
}
}
return fontToApply ?? textView.richTextStorage.defaultFont
}
}
| [
-1
] |
8ebaa1c914ac4a0a643b8385c10f120d3585e9ca | 4efa63e5a8ad330578bae2be1de0ae69ed64c002 | /ZuYu2/ZuYu2/view/GdShopCell.swift | d23e7a3b9addeca12bc45147d94a2b21dcecf004 | [
"MIT"
] | permissive | MoMoLiangyu/qianxingzuyu | 43436260f4ec333388848c70f87eda283704e540 | 4b252b8c5135b34d1412857be039e04a2326b79e | refs/heads/master | 2023-06-04T03:16:09.595319 | 2021-06-26T13:37:37 | 2021-06-26T13:37:37 | 380,501,827 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,147 | swift | //
// GdShopCell.swift
// ZuYu2
//
// Created by million on 2020/8/16.
// Copyright © 2020 million. All rights reserved.
//
import UIKit
class GdShopCell: UITableViewCell {
@IBOutlet weak var mContentView: UIView!
@IBOutlet weak var lineView: UIView!
@IBOutlet weak var shopImgV: UIImageView!
@IBOutlet weak var nameLbl: UILabel!
@IBOutlet weak var addressLbl: UILabel!
@IBOutlet weak var viewBtn: UIButton!
public static var fitHeight : CGFloat = 88+15
let index = Int.random(in: 0..<3)
/// line view background color
let colorsSet1 : [[CGColor]] = [
[UIColor(red: 0.41, green: 0.73, blue: 1, alpha: 1).cgColor, UIColor(red: 0.31, green: 0.65, blue: 1, alpha: 1).cgColor],
[UIColor(red: 1, green: 0.8, blue: 0, alpha: 1).cgColor, UIColor(red: 1, green: 0.75, blue: 0.11, alpha: 1).cgColor],
[UIColor(red: 1, green: 0.47, blue: 0.44, alpha: 1).cgColor, UIColor(red: 1, green: 0.36, blue: 0.36, alpha: 1).cgColor],
]
///view btn background color
let colorsSet2 : [[CGColor]] = [
[UIColor(red: 0.3, green: 0.78, blue: 1, alpha: 1).cgColor, UIColor(red: 0.22, green: 0.65, blue: 1, alpha: 1).cgColor],
[UIColor(red: 1, green: 0.8, blue: 0, alpha: 1).cgColor, UIColor(red: 1, green: 0.76, blue: 0.16, alpha: 1).cgColor],
[UIColor(red: 1, green: 0.47, blue: 0.44, alpha: 1).cgColor, UIColor(red: 1, green: 0.36, blue: 0.36, alpha: 1).cgColor],
]
/// shadow color
let colorSet3 : [UIColor] = [
UIColor(red: 0, green: 0.62, blue: 1, alpha: 1),
UIColor(red: 1, green: 0.73, blue: 0, alpha: 1),
UIColor(red: 1, green: 0.03, blue: 0, alpha: 1),
]
func addLayer(for view : UIView, _ colors : [Any]?, _ startPoint : CGPoint = .zero, _ endPoint : CGPoint = .zero) {
let bgLayer = CAGradientLayer()
bgLayer.colors = colors
bgLayer.locations = [0, 1]
bgLayer.frame = view.bounds
bgLayer.startPoint = startPoint
bgLayer.endPoint = endPoint
view.layer.insertSublayer(bgLayer, at: 0)
}
lazy var tempView = { () -> UIView in
let view = UIView(frame: .zero)
return view
}()
override func awakeFromNib() {
super.awakeFromNib()
viewBtn.backgroundColor = UIColor.clear
mContentView.addShadow(ofColor: UIColor(red: 0, green: 0, blue: 0, alpha: 0.14), radius: 16, offset: CGSize(width: 0, height: 2), opacity: 1)
viewBtn.addShadow(ofColor: colorSet3[index], radius: 5, offset: CGSize(width: 0, height: 2), opacity: 1)
}
override func layoutSubviews() {
super.layoutSubviews()
tempView = UIView(frame: viewBtn.bounds)
tempView.cornerRadius = 12
viewBtn.insertSubview(tempView, at: 0)
addLayer(for: tempView, colorsSet2[index])
addLayer(for: lineView, colorsSet1[index])
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
| [
-1
] |
c7a1ed04ee1c7edaf604286787b7161a40e29539 | 6d6b639d6c21e92bb3bf0e758a4bf8729c0abe5c | /CZInstagram/CZInstagram/FLUX/FeedDetails/FeedDetailsAction.swift | b6c3fa222b1f23d6ac64034a151c46084200dca1 | [
"MIT"
] | permissive | searchkuldeepsingh/CZInstagram | 24e4370348796de06657bb379ec4ff391fbe4b07 | 29295eb3574a0236bb9ca55c393fb72502878a5f | refs/heads/master | 2022-02-16T15:03:04.617659 | 2019-07-27T04:44:48 | 2019-07-27T04:44:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 818 | swift | //
// FeedDetailsActions.swift
// CZInstagram
//
// Created by Cheng Zhang on 1/4/17.
// Copyright © 2017 Cheng Zhang. All rights reserved.
//
import CZUtils
import ReactiveListViewKit
// MARK: - Actions
enum FeedDetailsAction: Action {
case requestFetchingFeeds(FetchingFeedsType)
case fetchingFeeds(FetchingFeedsType)
case gotCachedFeeds
case fetchedFeeds
}
class FetchCommentsCommand: Command {
typealias StateType = FeedDetailsState
let type: FetchingFeedsType
let viewModel: FeedDetailsViewModel
init(type: FetchingFeedsType,
viewModel: FeedDetailsViewModel) {
self.type = type
self.viewModel = viewModel
}
public func execute(state: FeedDetailsState, store: Store<FeedDetailsState>) {
viewModel.fetchFeeds(type: type)
}
}
| [
-1
] |
0a2169b442d305fcca90b52981851ca0c8d39f88 | 804ac8f941ce2e8ec23e82b385907d18d1d971ae | /Marvel HeroesTests/ViewControllerTests.swift | c25bc9e80d54100c550dff292d71f680231d53d3 | [
"MIT"
] | permissive | KTMarc/Marvel-Heroes | 5abd01330e7bb3cb3ddfbc07455656412fe46878 | 1474ca478b7275587dec7ed7d2a65cb53b5dc04a | refs/heads/master | 2021-06-15T21:27:40.539029 | 2017-08-02T19:37:58 | 2017-08-02T19:37:58 | 56,168,729 | 0 | 0 | null | 2016-11-23T22:03:36 | 2016-04-13T16:35:31 | Swift | UTF-8 | Swift | false | false | 2,730 | swift | //
// ViewControllerTests.swift
// Marvel Heroes
//
// Created by Marc Humet Sors on 11/29/16.
// Copyright © 2016 SPM. All rights reserved.
//
import XCTest
@testable import Marvel_Heroes
class ViewControllerTests: XCTestCase {
var viewController: MasterViewController!
override func setUp() {
super.setUp()
let storyboard = UIStoryboard(name: "Main",
bundle: Bundle.main)
let navigationController = storyboard.instantiateInitialViewController() as! UINavigationController
viewController = navigationController.topViewController as! MasterViewController
UIApplication.shared.keyWindow!.rootViewController = viewController
// Test and Load the View at the Same Time!
XCTAssertNotNil(navigationController.view)
XCTAssertNotNil(viewController.view)
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testTheNumberOfItemsInCollectionView() {
//let spyDelegate = SpyDelegate()
//viewController.testingDelegate = spyDelegate
//weak var expectation = self.expectation(description: "SomethingWithDelegate calls the delegate as the result of an async method completion")
//spyDelegate.asyncExpectation = expectation
//spyDelegate.updateModel()
sleep(10)
print("---------------------------------------------------------")
print(self.viewController.collection.numberOfItems(inSection: 0))
XCTAssertGreaterThan(self.viewController.countItems, 2)
// waitForExpectations(timeout: 30) { error in
// if let error = error {
// XCTFail("waitForExpectationsWithTimeout errored: \(error)")
// }
// guard let result = spyDelegate.somethingWithDelegateAsyncResult else {
// XCTFail("Expected delegate to be called")
// return
// }
// print("---------------------------------------------------------")
// print(self.viewController.collection.numberOfItems(inSection: 0))
// XCTAssertGreaterThan(self.viewController.countItems, 2)
// XCTAssertTrue(result)
// }
}
}
//TODO: Test Comic Cell loading called testThatWeCanAsyncDownloadImagesInComicCells
// let cell = ComicCell()
// let xMen = Comic(title: "All-New X-Men (2012) #31", comicId: 48534, thumbnailUrl: "http://i.annihil.us/u/prod/marvel/i/mg/5/60/53f4faa231041.jpg")
// let model = ComicCellModel(comic: xMen )
| [
-1
] |
a233239e52f82b4c05b6d6b04f59186ff3ae08e1 | 04d5d07590f3fc5130380a9ad04783dc8f576566 | /AmbeoAADemo/AmbeoAADemo/Additional View Controllers/VirtualObjectSelectionViewController.swift | 11cbdc72c5d467925e4a12be74966808433e3f7c | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | johndpope/Dreamscape | f4d5cf95f9b3ea2570913623608bf4a0ec9b43e8 | 63623facec24bf8ed3aeee20ac0f47f32d40b1bf | refs/heads/master | 2020-04-05T09:12:54.922521 | 2018-06-07T15:38:44 | 2018-06-07T15:38:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,818 | swift | /**
* Copyright (c) Sennheiser Electronic GmbH & Co. KG, 2018. All Rights Reserved.
*
* Distributed as part of the AMBEO Augmented Audio Developers Program.
* You may only use this code under the terms stated in LICENSE.md, which was distributed alongside this code.
*/
import UIKit
import ARKit
// MARK: - ObjectCell
class ObjectCell: UITableViewCell {
static let reuseIdentifier = "ObjectCell"
@IBOutlet weak var objectTitleLabel: UILabel!
@IBOutlet weak var objectImageView: UIImageView!
@IBOutlet weak var vibrancyView: UIVisualEffectView!
var objectName = "" {
didSet {
objectTitleLabel.text = objectName.capitalized
}
}
func setObjectCellImage(named: String) {
objectImageView.image = UIImage(named: named)
}
}
// MARK: - VirtualObjectSelectionViewControllerDelegate
/// A protocol for reporting which objects have been selected.
protocol VirtualObjectSelectionViewControllerDelegate: class {
func virtualObjectSelectionViewController(_ selectionViewController: VirtualObjectSelectionViewController, didSelectObject: VirtualObject)
func virtualObjectSelectionViewController(_ selectionViewController: VirtualObjectSelectionViewController, didDeselectObject: VirtualObject)
}
/** A custom table view controller to allow users to select `VirtualObject`s for placement in the scene. */
class VirtualObjectSelectionViewController: UITableViewController {
/// The collection of `VirtualObject`s to select from.
var virtualObjects = [VirtualObject]()
/// The rows of the currently selected `VirtualObject`s.
var selectedVirtualObjectRows = IndexSet()
/// The rows of the 'VirtualObject's that are currently allowed to be placed.
var enabledVirtualObjectRows = Set<Int>()
weak var delegate: VirtualObjectSelectionViewControllerDelegate?
override func viewDidLoad() {
super.viewDidLoad()
tableView.separatorEffect = UIVibrancyEffect(blurEffect: UIBlurEffect(style: .light))
}
override func viewWillLayoutSubviews() {
preferredContentSize = CGSize(width: 250, height: tableView.contentSize.height)
}
func updateObjectAvailability(for planeAnchor: ARPlaneAnchor?) {
var newEnabledVirtualObjectRows = Set<Int>()
for (row, object) in VirtualObjectLoader.availableObjects.enumerated() {
// Enable row if item can be placed at the current location
if object.isPlacementValid(on: planeAnchor) {
newEnabledVirtualObjectRows.insert(row)
}
// Enable row always if item is already placed, in order to allow the user to remove it.
if selectedVirtualObjectRows.contains(row) {
newEnabledVirtualObjectRows.insert(row)
}
}
// Only reload changed rows
let changedRows = newEnabledVirtualObjectRows.symmetricDifference(enabledVirtualObjectRows)
enabledVirtualObjectRows = newEnabledVirtualObjectRows
let indexPaths = changedRows.map { row in IndexPath(row: row, section: 0) }
DispatchQueue.main.async {
self.tableView.reloadRows(at: indexPaths, with: .automatic)
}
}
// MARK: - UITableViewDelegate
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let cellIsEnabled = enabledVirtualObjectRows.contains(indexPath.row)
guard cellIsEnabled else { return }
let object = virtualObjects[indexPath.row]
// Check if the current row is already selected, then deselect it.
if selectedVirtualObjectRows.contains(indexPath.row) {
delegate?.virtualObjectSelectionViewController(self, didDeselectObject: object)
} else {
// user selected an object
delegate?.virtualObjectSelectionViewController(self, didSelectObject: object)
}
dismiss(animated: true, completion: nil)
}
// MARK: - UITableViewDataSource
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return virtualObjects.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: ObjectCell.reuseIdentifier, for: indexPath) as? ObjectCell else {
fatalError("Expected `\(ObjectCell.self)` type for reuseIdentifier \(ObjectCell.reuseIdentifier). Check the configuration in Main.storyboard.")
}
cell.objectName = virtualObjects[indexPath.row].config.displayName
cell.setObjectCellImage(named: virtualObjects[indexPath.row].config.modelName)
if selectedVirtualObjectRows.contains(indexPath.row) {
cell.accessoryType = .checkmark
} else {
cell.accessoryType = .none
}
let cellIsEnabled = enabledVirtualObjectRows.contains(indexPath.row)
if cellIsEnabled {
cell.vibrancyView.alpha = 1.0
} else {
cell.vibrancyView.alpha = 0.1
}
return cell
}
override func tableView(_ tableView: UITableView, didHighlightRowAt indexPath: IndexPath) {
let cellIsEnabled = enabledVirtualObjectRows.contains(indexPath.row)
guard cellIsEnabled else { return }
let cell = tableView.cellForRow(at: indexPath)
cell?.backgroundColor = UIColor.lightGray.withAlphaComponent(0.5)
}
override func tableView(_ tableView: UITableView, didUnhighlightRowAt indexPath: IndexPath) {
let cellIsEnabled = enabledVirtualObjectRows.contains(indexPath.row)
guard cellIsEnabled else { return }
let cell = tableView.cellForRow(at: indexPath)
cell?.backgroundColor = .clear
}
}
| [
-1
] |
967c4a728d15e6923397d8476b7290220fb6fbac | 6d7eafc15a38da4aa82028a76b2877cfe8f96ccb | /PlagiarismChecker/Classes/CopyleaksApi.swift | d4283b656ada4676dfe1c21e38ff0d4de64518a7 | [
"MIT"
] | permissive | EugeneVegner/sws-copyleaks-sdk-test | 22c2df665fc460ee4ad6455e4564d824ae775086 | e5da4f77f50d5321281f83abc384c49cfbc775d3 | refs/heads/master | 2020-12-25T14:33:10.697160 | 2016-08-22T14:50:09 | 2016-08-22T14:50:09 | 66,249,340 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 10,183 | swift | /*
* The MIT License(MIT)
*
* Copyright(c) 2016 Copyleaks LTD (https://copyleaks.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
import Foundation
import MobileCoreServices
// MARK: - Convenience
public class CopyleaksApi {
/* Private Api parameters */
private var rout: String = ""
private var method: CopyleaksHTTPMethod = .GET
private var parameters: [String: AnyObject]? = nil
/**
The background completion handler closure provided by the UIApplicationDelegate
'application:handleEventsForBackgroundURLSession:completionHandler: method. By setting the background
completion handler, the SessionDelegate `sessionDidFinishEventsForBackgroundURLSession` closure implementation
will automatically call the handler.
*/
public var backgroundCompletionHandler: (() -> Void)?
let queue = dispatch_queue_create(nil, DISPATCH_QUEUE_SERIAL)
public let session: NSURLSession
public let delegate: CopyleaksSessionDelegate
/* Copyleaks headers */
private var headers: [String: String] = [String: String]()
/* Init Api */
public init (
method: CopyleaksHTTPMethod,
rout: String,
parameters: [String: AnyObject]? = nil,
headers: [String: String]? = nil)
{
self.method = method
self.rout = rout
self.parameters = parameters
if headers != nil {
self.headers = headers!
}
// Configure default headers
self.headers[CopyleaksConst.cacheControlHeader] = CopyleaksConst.cacheControlValue
self.headers[CopyleaksConst.contentTypeHeader] = CopyleaksHTTPContentType.JSON
self.headers[CopyleaksConst.userAgentHeader] = CopyleaksConst.userAgentValue
self.headers[CopyleaksConst.acceptLanguageHeader] = CopyleaksConst.defaultAcceptLanguage
// Configure Authorization header
if let token = CopyleaksToken.getAccessToken()?.generateAccessToken() {
self.headers["Authorization"] = token
}
let config = NSURLSessionConfiguration.defaultSessionConfiguration()
config.HTTPAdditionalHeaders = self.headers
self.delegate = CopyleaksSessionDelegate()
self.session = NSURLSession(configuration: config, delegate: delegate, delegateQueue: nil)
delegate.sessionDidFinishEventsForBackgroundURLSession = { [weak self] session in
guard let strongSelf = self else { return }
dispatch_async(dispatch_get_main_queue()) { strongSelf.backgroundCompletionHandler?() }
}
}
// MARK: - Request Methods
/* Request constructor */
private func configureRequest(
_ URL: NSURL,
body: NSData? = nil) -> NSMutableURLRequest
{
let mutableURLRequest = NSMutableURLRequest(URL: URL)
mutableURLRequest.HTTPMethod = method.rawValue
for (headerField, headerValue) in headers {
mutableURLRequest.setValue(headerValue, forHTTPHeaderField: headerField)
}
if let data = body {
mutableURLRequest.HTTPBody = data
}
return mutableURLRequest
}
/**
Creates a request
- parameter body: The Copyleaks request body. Dafault value is 'nil'.
- returns: The created request.
*/
public func request(body: NSData? = nil) -> CopyleaksRequest
{
let components = NSURLComponents()
components.scheme = "https"
components.host = CopyleaksConst.serviceHost
components.path = "/" + CopyleaksConst.serviceVersion + "/" + rout
let mutableURLRequest = self.configureRequest(
components.URL!,
body: body)
do {
if parameters != nil {
let options = NSJSONWritingOptions()
let data = try NSJSONSerialization.dataWithJSONObject(parameters!, options: options)
mutableURLRequest.HTTPBody = data
}
} catch {
assert(true, "Incorrect encoding")
}
var dataTask: NSURLSessionDataTask!
dispatch_sync(queue) { dataTask = self.session.dataTaskWithRequest(mutableURLRequest.mutableCopy() as! NSMutableURLRequest) }
let request = CopyleaksRequest(session: session, task: dataTask)
delegate[request.delegate.task] = request.delegate
request.resume()
return request
}
// MARK: - Upload Methods
/**
Creates a request for uploading File to the specified URL request.
- parameter fileURL: The File URL.
- parameter language: The Language Code that identifies the language of the content.
- returns: The created upload request.
*/
public func uploadFile (
_ fileURL : NSURL,
language: String)
-> CopyleaksRequest
{
let components = NSURLComponents()
components.scheme = "https"
components.host = CopyleaksConst.serviceHost
components.path = "/" + CopyleaksConst.serviceVersion + "/" + rout
components.query = "language=" + language
let boundary = generateBoundary()
var uploadData = NSMutableData()
uploadData.appendData("--\(boundary)\r\n".dataUsingEncoding(NSUTF8StringEncoding)!)
if let
fileName = fileURL.lastPathComponent,
pathExtension = fileURL.pathExtension,
uploadFile: NSData = NSFileManager.defaultManager().contentsAtPath(fileURL.absoluteString)
{
let mimeType = mimeTypeForPathExtension(pathExtension)
uploadData.appendData("Content-Disposition: form-data; name=\"file\"; filename=\"\(fileName).\(pathExtension)\"\r\n".dataUsingEncoding(NSUTF8StringEncoding)!)
uploadData.appendData("Content-Type: \(mimeType)\r\n".dataUsingEncoding(NSUTF8StringEncoding)!)
let strBase64:String = uploadFile.base64EncodedStringWithOptions(.Encoding64CharacterLineLength)
uploadData.appendData("Content-Transfer-Encoding: binary\r\n\r\n\(strBase64)".dataUsingEncoding(NSUTF8StringEncoding)!)
uploadData.appendData("\r\n".dataUsingEncoding(NSUTF8StringEncoding)!)
}
uploadData.appendData("--\(boundary)--\r\n\r\n".dataUsingEncoding(NSUTF8StringEncoding)!)
// Configure headers
headers["Accept"] = "application/json"
headers[CopyleaksConst.contentTypeHeader] = "multipart/form-data;boundary="+boundary
headers["Content-Length"] = String(uploadData.length)
let mutableURLRequest = self.configureRequest(
components.URL!,
body: uploadData)
var uploadTask: NSURLSessionUploadTask!
dispatch_sync(queue) {
uploadTask = self.session.uploadTaskWithRequest(mutableURLRequest, fromData: uploadData)
//uploadTask = self.session.dataTaskWithRequest(mutableURLRequest)
}
let request = CopyleaksRequest(session: session, task: uploadTask)
delegate[request.delegate.task] = request.delegate
request.resume()
return request
}
/* Configure MIME type from path */
private func mimeTypeForPathExtension(pathExtension: String) -> String {
if let
id = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension, nil)?.takeRetainedValue(),
contentType = UTTypeCopyPreferredTagWithClass(id, kUTTagClassMIMEType)?.takeRetainedValue()
{
return contentType as String
}
return "application/octet-stream"
}
/* Boundary generator */
private func generateBoundary() -> String {
return String(format: "copyleaks.boundary.%08x%08x", arc4random(), arc4random())
}
/**
Callbacks optional headers
Copyleaks API supports two types of completion callbacks that are invoked once the process has
been completed, with or without success.
When using callbacks, there is no need to check the request's status manually. We will automatically
inform you when the process has completed running and the results are ready.
*/
public func configureOptionalHeaders(
_ httpCallback: String? = nil,
_ emailCallback: String? = nil,
_ clientCustomMessage: String? = nil,
_ allowPartialScan: Bool = false)
{
if Copyleaks.sharedSDK.sandboxMode {
headers["copyleaks-sandbox-mode"] = "true"
}
if allowPartialScan {
headers["copyleaks-allow-partial-scan"] = "true"
}
if let val = httpCallback {
headers["copyleaks-http-callback"] = val
}
if let val = emailCallback {
headers["copyleaks-email-callback"] = val
}
if let val = clientCustomMessage {
headers["copyleaks-client-custom-Message"] = val
}
}
}
| [
-1
] |
745135c2a125ed03253002ded73742334c636539 | ef09d52c31366713f414a859f37c9144e8076f63 | /SwiftExtensions/UIScreen.swift | c6fc73bbad18068fbfab8d6aca695bf82a43b546 | [] | no_license | k4ety/SwiftExtensions | e6a9c434f4df0d918122becb4990bd3eeaea41ae | ddaedd5cd8f7aeb4edafca2fd1dbbdd83e189119 | refs/heads/master | 2020-07-03T17:39:41.495242 | 2019-08-13T23:16:46 | 2019-08-13T23:16:46 | 201,988,265 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 229 | swift | //
// UIScreen.swift
// SwiftExtensions
//
// Created by Paul King on 10/25/17.
//
public extension UIScreen {
var isZoomedMode: Bool {
return abs(UIScreen.main.nativeScale - UIDevice.current.normalScale) > 0.1
}
}
| [
-1
] |
7b07a7afca0712ef6bdd8fec33557ea44b20fb7d | 3fdc5cc07933a1ba81ddf263dc36f78e18aaf2bb | /features/fixtures/shared/scenarios/UserSessionOverrideScenario.swift | 0d3d9dec2fc2713540ae8e194826d90eba6167f2 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | bugsnag/bugsnag-cocoa | a4a3f80b971f1a968a9f930bc35b7fe9c94bd479 | 2f373f21b965f1b13d7070662e2d35f46c17d975 | refs/heads/master | 2023-08-31T14:55:09.882083 | 2023-07-24T15:00:22 | 2023-07-24T15:00:22 | 12,458,757 | 229 | 148 | MIT | 2023-09-11T10:03:42 | 2013-08-29T11:44:03 | Objective-C | UTF-8 | Swift | false | false | 1,021 | swift | //
// UserSessionOverrideScenario.swift
// iOSTestApp
//
// Created by Jamie Lynch on 26/05/2020.
// Copyright © 2020 Bugsnag. All rights reserved.
//
import Foundation
/**
* Sends a session to Bugsnag which overrides the user information
*/
internal class UserSessionOverrideScenario: Scenario {
override func startBugsnag() {
self.config.autoTrackSessions = false;
super.startBugsnag()
}
override func run() {
Bugsnag.setUser("abc", withEmail: nil, andName: nil)
Bugsnag.addOnSession { (session) -> Bool in
session.setUser("sessionCustomId", withEmail: "sessionCustomEmail", andName: "sessionCustomName")
return true
}
Bugsnag.startSession()
let error = NSError(domain: "UserIdScenario", code: 100, userInfo: nil)
Bugsnag.notifyError(error) { (event) -> Bool in
event.setUser("errorCustomId", withEmail: "errorCustomEmail", andName: "errorCustomName")
return true
}
}
}
| [
-1
] |
599216ff307ff04485433bcab3571e6d5698292b | de1aeb746feeb1b0b194f559d441fa52907459f7 | /ThreeSixtyViewModel/TalkDetails.swift | 7089352cfd49bdf21523fce7ecc195ae2d527e7a | [] | no_license | ganchau/ThreeSixtyMVVM | 82b22321bdfea871a7b3b8b9f374a248c1ec6e27 | e47fa3123d789f3c05ef98f3c74c86812c23b745 | refs/heads/master | 2021-01-16T21:59:52.990033 | 2015-10-05T19:33:48 | 2015-10-05T19:33:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,429 | swift | //
// TalkDetails.swift
// ThreeSixtyViewModel
//
// Created by Brad Dillon on 10/4/15.
// Copyright © 2015 POSSIBLE Mobile. All rights reserved.
//
import Foundation
class TalkDetailsViewModel: TalkDetailsViewModelProtocol {
private let talk: Talk
private let store: Store
init(store s: Store, talk t: Talk) {
store = s
talk = t
talkTitle = Dynamic<String>(talk.name ?? "")
talkDescription = Dynamic<String>(talk.details ?? "")
talkLocation = Dynamic<String>(talk.location ?? "")
talkDate = Dynamic<String>("")
talkTime = Dynamic<String>("")
_speakerDetailsViewModel = SpeakerDetailsViewModel(store: s)
if let date = talk.date {
self.talkDate.value = self.dateFormatter.stringFromDate(date) ?? ""
self.talkTime.value = self.timeFormatter.stringFromDate(date) ?? ""
}
}
func refresh(completion: (() -> Void)?) {
fetchTalk(talk.identifier!, store: store) { (talk) -> Void in
self.talkTitle.value = talk.name ?? ""
self.talkDescription.value = talk.details ?? ""
self.talkLocation.value = talk.location ?? ""
if let date = talk.date {
self.talkDate.value = self.dateFormatter.stringFromDate(date)
self.talkTime.value = self.timeFormatter.stringFromDate(date)
}
self._speakerDetailsViewModel.speaker = talk.speaker
self._speakerDetailsViewModel.refresh {
completion?()
}
}
}
let talkTitle: Dynamic<String>
let talkDescription: Dynamic<String>
let talkLocation: Dynamic<String>
let talkDate: Dynamic<String>
let talkTime: Dynamic<String>
lazy var dateFormatter: NSDateFormatter = {
let formatter = NSDateFormatter()
formatter.dateStyle = .MediumStyle
formatter.timeStyle = .NoStyle
return formatter
}()
lazy var timeFormatter: NSDateFormatter = {
let formatter = NSDateFormatter()
formatter.dateStyle = .NoStyle
formatter.timeStyle = .LongStyle
return formatter
}()
private let _speakerDetailsViewModel: SpeakerDetailsViewModel
var speakerDetailsViewModel: SpeakerDetailsViewModelProtocol {
return _speakerDetailsViewModel
}
}
| [
-1
] |
34fe9f69c2e143b4765da5af1df894bcdeb355b1 | 91c97532f64cc554368be116994dda8996600e33 | /week-2/nov-2-sortagram/Playgrounds/4. SizeClasses/SizeClasses/ViewController.swift | 166423241da25fc48df021d808a65079ff7b8da2 | [] | no_license | codefellows/sea-d47-ios | b6fd126f67ae098ea22c872f81c39ae1ad77b936 | 50c7e5153ceed1af93681d3c8b6b2ebfe6265100 | refs/heads/master | 2016-08-11T16:03:05.784095 | 2015-12-09T23:54:20 | 2015-12-09T23:54:20 | 45,000,721 | 8 | 4 | null | 2015-11-16T18:28:12 | 2015-10-26T22:15:34 | Objective-C | UTF-8 | Swift | false | false | 513 | swift | //
// ViewController.swift
// SizeClasses
//
// Created by Michael Babiy on 10/19/15.
// Copyright © 2015 Michael Babiy. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
279041,
279046,
277512,
215562,
275466,
278543,
281107,
279064,
281118,
282143,
295460,
284197,
289318,
296487,
296489,
286249,
304174,
309807,
300086,
286775,
279096,
234551,
300089,
234043,
288827,
238653,
226878,
288321,
277057,
286786,
129604,
301637,
226887,
293961,
286796,
158285,
226896,
212561,
284242,
292435,
300629,
276054,
237655,
307288,
282202,
40545,
200802,
281701,
284261,
281703,
306791,
286314,
296042,
164974,
307311,
312433,
281202,
284275,
277108,
300149,
314996,
276087,
287350,
234619,
284287,
284289,
276099,
276612,
280710,
285321,
284298,
303242,
278157,
311437,
226447,
234641,
349332,
117399,
280219,
282270,
285855,
228000,
282275,
225955,
278693,
287399,
326311,
100521,
313007,
277171,
307379,
284341,
286390,
300727,
282301,
283839,
277696,
285377,
280770,
227523,
302788,
228548,
228551,
279751,
280775,
279754,
282311,
230604,
284361,
276686,
298189,
282320,
229585,
302286,
307410,
230608,
189655,
302295,
226009,
282329,
363743,
282338,
249062,
277224,
228585,
282346,
288490,
237564,
358127,
312049,
286963,
280821,
120054,
226038,
234232,
282357,
280826,
286965,
358139,
282365,
286462,
280832,
282368,
300288,
358147,
230147,
226055,
282377,
299786,
312586,
300817,
302865,
302866,
282389,
288251,
282393,
278298,
329499,
228127,
315170,
282403,
281380,
233767,
283433,
130346,
282411,
293682,
159541,
282426,
289596,
283453,
307516,
279360,
289088,
288577,
293700,
300358,
238920,
234829,
296272,
279380,
307029,
289112,
279386,
241499,
308064,
227688,
303977,
313706,
290303,
306540,
299374,
293742,
162672,
199024,
276849,
278897,
277367,
277369,
292730,
333179,
207738,
280445,
303998,
290175,
280446,
275842,
224643,
311684,
313733,
304008,
324491,
304012,
304015,
300432,
226705,
310673,
277406,
285087,
234402,
289187,
284580,
276396,
289196,
286126,
277935,
324528,
289199,
370093,
282035,
230323,
292277,
296374,
130487,
234423,
277432,
278968,
289204,
293308,
278973,
288183,
295874,
299973,
298951,
165832,
306633,
286158,
280015,
310734,
301012,
301016,
163289,
286175,
294600,
234465,
276965,
168936,
294889,
231405,
183278,
282095,
227315,
296436,
237556,
281078,
302580,
236022,
310773,
290299,
233980,
287231
] |
30324cfce3557a314f04e24b0c7c3f41007e04fe | 82cfc8ff87416bcfffa8d2d447ddc0803109a93c | /OnTheMap/ParseClient.swift | 37f42e2bb390dbf4191c58f60c11f3c4ffd6684d | [] | no_license | circlelights/OnTheMap | 3e3bce915eea2df71ea7e89ebacbe3250ad18873 | 82c1af65e1947071e2d345937c8206026d418749 | refs/heads/master | 2020-12-30T13:20:49.598727 | 2018-08-09T23:54:43 | 2018-08-09T23:54:43 | 91,203,472 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 507 | swift | //
// ParseClient.swift
// OnTheMap
//
// Created by Jason Isler on 5/13/17.
// Copyright © 2017 Developer2017. All rights reserved.
//
import Foundation
class ParseClient : NSObject {
// shared session
var session = URLSession.shared
// MARK: Shared Instance
class func sharedInstance() -> ParseClient {
struct Singleton {
static var sharedInstance = ParseClient()
}
return Singleton.sharedInstance
}
}
| [
-1
] |
48d0d05bcd635ca6f27aa6f146a12145e14d36ca | a540aa09530c3d945fed7e16031a6454c9b2e795 | /ExampleFramework/NavigationBarView.swift | ccd2002aa006f33eb5629eb59c8c5f0f41054273 | [
"MIT"
] | permissive | DSanzh/ExampleFramework | 808c9f1450cea3e668ac34a99fb595c00f57dabf | d64c4455836db022fba0c322dbf91d060cdc7c11 | refs/heads/master | 2020-03-21T22:45:05.857669 | 2018-06-30T06:25:21 | 2018-06-30T06:25:21 | 139,145,110 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,838 | swift | //
// NavigationBarView.swift
// ExampleCore
//
// Created by Sanzhar on 6/29/18.
// Copyright © 2018 Sanzhar. All rights reserved.
//
import UIKit
import EasyPeasy
public class NavigationBarView: UIView {
lazy var titleLabel = KTLabel()
lazy var backButton = KTButton(withImage: UIImage())//.then{
lazy var rightButton = UIButton()
public init(withTitle title: String) {
super.init(frame: .zero)
rightButton.isHidden = true
setupView(title)
setupConstraints()
}
required public init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) in NavigationBarView has not been implemented")
}
}
extension NavigationBarView {
public func setupView(_ title: String) {
backgroundColor = .white
[backButton, titleLabel, rightButton].forEach{
addSubview($0)
}
titleLabel.text = title
}
public func setupConstraints() {
titleLabel.easy.layout([
Bottom(12),
CenterX()
])
backButton.easy.layout([
Left(20),
CenterY().to(titleLabel),
Width(16),
Height(28)
])
rightButton.easy.layout([
Right(15),
CenterY().to(titleLabel),
Height(25),
Width(25)
])
}
@objc public func returnViewController() {
print("returnViewController")
if let viewController = self.window?.rootViewController {
viewController.navigationController?.popViewController(animated: true)
if let nav = viewController.navigationController {
nav.popViewController(animated: true)
} else {
viewController.dismiss(animated: true, completion: nil)
}
}
}
}
| [
-1
] |
218d7c367a6a6b93fc21b880af9168a5456aeb0c | 9376811943b07b89c819ea0a665cb71a0d19e27e | /JYFoundation/Common/JYStack.swift | 10de3d892496cb6d72d0806ac34189a15b2614f4 | [
"MIT"
] | permissive | jayasme/JYFoundation | 69f24d28c11d27b2f7a7259cb790cc2d98e05e3f | 8623ffc81021e5648c399fba1015995b495cb3bc | refs/heads/master | 2023-04-06T20:44:55.148434 | 2023-03-25T15:32:18 | 2023-03-25T15:32:18 | 156,820,245 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 844 | swift | //
// JYStack.swift
// JYFoundation
//
// Created by 荣超 on 2023/3/19.
// Copyright © 2023 jayasme. All rights reserved.
//
import Foundation
public class JYStack<Element> {
private var capacity: Int
private var data: [Element] = []
public var count: Int {
return self.data.count
}
public init(capacity: Int = 0) {
self.capacity = capacity
}
public func push(element: Element) {
if (self.capacity > 0 && self.data.count >= self.capacity) {
self.data.remove(at: 0)
}
self.data += element
}
public func pop() -> Element? {
guard self.data.count > 0 else {
return nil
}
return self.data.removeLast()
}
public func clear() {
self.data.removeAll()
}
}
| [
-1
] |
e1e40f8151f7e378b3ffd28e3f1ee61e2f0ee38d | adbbb14f3bdaad85ae4db982fa3499fbeb4f687c | /hncloud/Object/API/HealthAPI.swift | c3f4afe16a3053ba63c9e2a0b094325d80b90fc2 | [] | no_license | ExternalComboTeam/HNStart | 054d7f1cccadec9690c8000a53104a392bab5f5e | c12f458239f1a0a21b6a28904c01b0d7820276f9 | refs/heads/master | 2020-04-13T06:57:19.299291 | 2019-01-01T18:12:40 | 2019-01-01T18:12:40 | 163,035,840 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 2,045 | swift | //
// HealthAPI.swift
// hncloud
//
// Created by 辰 on 2018/12/27.
// Copyright © 2018 HNCloud. All rights reserved.
//
import SwiftyJSON
class HealthAPI: API {
/// 上傳血糖
class func bloodsugar(_ completionHandler: ((JSON) -> Void)?) {
let url = domain + "add_bloodsugar.php"
baseRequest(url, .post, ["date": "",
"sid": UserInfo.share.sid], completionHandler)
}
/// 血糖查詢
class func search(bloodsugar date: String, _ completionHandler: ((JSON) -> Void)?) {
let url = domain + "search_bloodsugar.php"
baseRequest(url, .post, ["date": date,
"sid": UserInfo.share.sid], completionHandler)
}
/// 上傳血壓、心率、血氧
class func pressure(sys: String, dia: String, heartrate: String, spo: String, _ completionHandler: ((JSON) -> Void)?) {
let url = domain + "add_bloodpressure.php"
baseRequest(url, .post, ["sid": UserInfo.share.sid,
"spo2": spo,
"sys": sys,
"heartrate": heartrate,
"dia": dia], completionHandler)
}
/// 上傳校正血壓
class func update(pressure sys: Int, dia: Int, _ completionHandler: ((JSON) -> Void)?) {
let url = domain + "search_bloodsugar.php"
baseRequest(url, .post, ["sys": sys,
"dia": dia,
"sid": UserInfo.share.sid], completionHandler)
}
/// 上傳整天心率(24小時) add_heartrate24.php
class func heartrate(date: String, time: String, _ completionHandler: ((JSON) -> Void)?) {
let url = domain + "search_bloodsugar.php"
baseRequest(url, .post, ["date": date,
"gender": UserInfo.share.gender.apiValue,
"t01 - t24": time,
"sid": UserInfo.share.sid], completionHandler)
}
///
}
| [
-1
] |
d6984172cb6d16700609707ccf6998bd7814e33d | 715479d9049d8283799b4be32a0aa88f7ff7cfd4 | /Pitch Perfect/Pitch Perfect/RecordSoundsViewController.swift | 11f41cf6a0ea73631b454e49a947d80c8fa0bd53 | [] | no_license | Desdecardo/pitch-perfect_2 | cffc6788752b0aeb667dc098f55e63a05ae2f9d6 | fe3aceb931d9db6368d060ebf05df7cf06f7f441 | refs/heads/master | 2016-09-05T14:22:08.360502 | 2015-04-05T03:19:34 | 2015-04-05T03:19:34 | 33,428,882 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,407 | swift | //
// RecordSoundsViewController.swift
// Pitch Perfect
//
// Created by Phil Feinstein on 3/29/15.
// Copyright (c) 2015 Phil Feinstein. All rights reserved.
//
import UIKit
import AVFoundation
class RecordSoundsViewController: UIViewController, AVAudioRecorderDelegate {
@IBOutlet weak var Instruction: UILabel!
@IBOutlet weak var RecordButton: UIButton!
@IBOutlet weak var Recording: UILabel!
@IBOutlet weak var StopButton: UIButton!
var audioRecorder:AVAudioRecorder!
var recordedAudio:RecordedAudio!
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
override func viewWillAppear(animated: Bool) {
Instruction.hidden = false
StopButton.hidden = true
RecordButton.enabled = true
}
@IBAction func RecordSound(sender: UIButton) {
Instruction.hidden = true
Recording.hidden = false
StopButton.hidden = false
RecordButton.enabled = false
let dirPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as String
let currentDateTime = NSDate()
let formatter = NSDateFormatter()
formatter.dateFormat = "ddMMyyyy-HHmmss"
let recordingName = formatter.stringFromDate(currentDateTime)+".wav"
let pathArray = [dirPath, recordingName]
let filePath = NSURL.fileURLWithPathComponents(pathArray)
println(filePath)
var session = AVAudioSession.sharedInstance()
session.setCategory(AVAudioSessionCategoryPlayAndRecord, error: nil)
audioRecorder = AVAudioRecorder(URL: filePath, settings: nil, error: nil)
audioRecorder.delegate = self
audioRecorder.meteringEnabled = true
audioRecorder.prepareToRecord()
audioRecorder.record()
}
func audioRecorderDidFinishRecording(recorder: AVAudioRecorder!, successfully flag: Bool) {
if (flag){
recordedAudio = RecordedAudio()
recordedAudio.filePathUrl = recorder.url
recordedAudio.title = recorder.url.lastPathComponent
self.performSegueWithIdentifier("StopRecording", sender: recordedAudio)
}else{
println("recording unsuccessful!")
RecordButton.enabled = true
StopButton.hidden = true
Instruction.hidden = false
}
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if (segue.identifier == "StopRecording"){
let playSoundsVC:PlaySoundsViewController = segue.destinationViewController as PlaySoundsViewController
let data = sender as RecordedAudio
playSoundsVC.receivedAudio = data
}else{
println("recording unsuccessful!")
RecordButton.enabled = true
StopButton.hidden = true
Instruction.hidden = false
}
}
@IBAction func StopButton(sender: UIButton) {
audioRecorder.stop()
var audioSession = AVAudioSession.sharedInstance()
audioSession.setActive(false, error: nil)
Recording.hidden = true
RecordButton.enabled = true
Instruction.hidden = false
}
}
| [
277200,
276741
] |
79bd296a35d36874b04b40f215714c5a38fdd8dd | b89882be97fa8fed629684a6aaae4eb0f173fc46 | /AR/AR/Service/LegsService.swift | 5a39ac159b26fd602013722c3bb6bed884fa1f77 | [] | no_license | arepina/AR | 1922faec06433e49a498bdf692f9f4f76d7381e5 | 7e39681856a7166df934ac6ab4bc32a10776d832 | refs/heads/master | 2020-04-05T03:47:54.817293 | 2019-09-24T18:08:05 | 2019-09-24T18:08:05 | 156,527,655 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,383 | swift | //
// LegsService.swift
// AR
//
// Created by Анастасия on 26/04/2019.
// Copyright © 2019 Anastasia. All rights reserved.
//
import Foundation
import CoreLocation
import SceneKit
import MapKit
class LegsService{
var legs: [Leg] = []
var currentLeg: Leg = Leg(steps: [])
var currentLegIndex = 0
var offsetInLeg: CGFloat = 0.0
var lengthTailFromPrevLeg: CGFloat? = nil
var stepStart: CGPoint = CGPoint()
var stepEnd: CGPoint = CGPoint()
func getLegs(route: [CGPoint]) -> [Leg] {
guard route.count >= 2 else { return [] }
let legsCount = Array(zip(route, route.skip(1))).count
while currentLegIndex < legsCount { // iterate all the route legs
let leg = CGLine(point1: route[currentLegIndex], point2: route[currentLegIndex + 1])
if let lengthTail = lengthTailFromPrevLeg { // check if we are at the start of the leg
stepStart = route[currentLegIndex] // start of the leg
if leg.contains(point: leg.point(atDistance: lengthTail)) {
// current leg contains the step which does not fitted into prev one
containNotFittedSteps(route: route, lengthTail: lengthTail, leg: leg)
} else { // it is not the prev leg step -> create a new leg
doNotContainNotFittedSteps(route: route, lengthTail: lengthTail)
}
continue // continue collection of the steps for the current or the new leg
}
//we are in the old leg and add the itermeditary steps below until we reach the leg end
stepStart = leg.point(atDistance: offsetInLeg)
if leg.contains(point: leg.point(atDistance: offsetInLeg + CGFloat(5.0))) {
// check if the 5m away from start step is still in the leg
stillInLeg(route: route, leg: leg)
} else { // the step is not in the leg
if stepStart ~= route[currentLegIndex + 1] { // check if start is not the end now
break
}
notStillInLeg(route: route)
}
}
if currentLeg.steps.count > 0 { // add the final leg to the list if it is not empty
legs.append(currentLeg)
}
return legs
}
func notStillInLeg(route: [CGPoint]){
stepEnd = route[currentLegIndex + 1] // we have reached the end of the leg
let step = Step(point: stepStart) // final point
currentLeg.steps.append(step) // add the final point to the current leg
currentLegIndex += 1 // switch to the new leg
offsetInLeg = 0.0 // move the new leg start
lengthTailFromPrevLeg = CGFloat(5.0)
}
func stillInLeg(route: [CGPoint], leg: CGLine){
stepEnd = leg.point(atDistance: offsetInLeg + CGFloat(5.0))
currentLeg.steps.append(Step(point: stepStart)) // add the step to current leg
legs.append(currentLeg) // add the leg to the leg list
currentLeg = Leg(steps: [])
if stepEnd == route[currentLegIndex + 1] { // check wherether we reached the end on the leg
offsetInLeg = 0.0 // new leg
currentLegIndex += 1
} else {
offsetInLeg = offsetInLeg + CGFloat(5.0) // old leg
}
lengthTailFromPrevLeg = nil
}
func containNotFittedSteps(route: [CGPoint], lengthTail: CGFloat, leg: CGLine){
stepEnd = leg.point(atDistance: lengthTail)
currentLeg.steps.append(Step(point: stepStart)) // add the step to the current leg
legs.append(currentLeg) // add the current leg to the legs list
currentLeg = Leg(steps: [])
if stepEnd == route[currentLegIndex + 1] { // check if our step is the leg end
offsetInLeg = 0.0 // move to the new leg
currentLegIndex += 1
} else {
offsetInLeg = lengthTail // remain in the current one
}
lengthTailFromPrevLeg = nil
}
func doNotContainNotFittedSteps(route: [CGPoint], lengthTail: CGFloat){
stepEnd = route[currentLegIndex + 1]
let step = Step(point: stepStart)
currentLeg.steps.append(step)
currentLegIndex += 1 // switch to the new leg
offsetInLeg = 0.0 // clear the offset from start
lengthTailFromPrevLeg = lengthTail
}
}
| [
-1
] |
57f202737125b5c98241cd619e1e0db11ae1cfe8 | e24261fec7230f643367360ff384896f3e497c84 | /CDASecurity/CDASecurity/SceneDelegate.swift | 5486f10d85e5931bc76a5d303735280b7ceaeb05 | [] | no_license | alexynonan/CDA | c3f97580d644037225d134916bff80cee9246fd1 | 74c4596c5f1e5c03e6a109899e355270f03f6163 | refs/heads/main | 2023-04-18T21:15:15.120519 | 2021-05-08T13:57:55 | 2021-05-08T13:57:55 | 364,606,687 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,290 | swift | //
// SceneDelegate.swift
// CDASecurity
//
// Created by Alexander on 5/05/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,
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,
270687,
262497,
418145,
262501,
213354,
262508,
246124,
262512,
213374,
385420,
393613,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
164362,
328207,
410129,
393748,
262679,
377372,
188959,
385571,
377384,
197160,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
385610,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
377473,
336513,
385671,
148106,
213642,
377485,
352919,
98969,
344745,
361130,
336556,
434868,
164535,
336568,
164539,
328379,
328387,
352969,
344777,
385743,
385749,
139998,
189154,
369382,
361196,
418555,
344832,
336644,
344837,
344843,
328462,
361231,
394002,
336660,
418581,
418586,
434971,
369436,
262943,
369439,
418591,
418594,
336676,
418600,
418606,
369464,
361274,
328516,
336709,
328520,
336712,
361289,
328523,
336715,
361300,
213848,
426842,
361307,
197469,
361310,
254813,
361318,
344936,
361323,
361335,
328574,
369544,
361361,
222129,
345036,
115661,
386004,
345046,
386012,
386019,
328690,
435188,
328703,
328710,
418822,
328715,
377867,
361490,
386070,
271382,
336922,
345119,
377888,
345134,
345139,
361525,
386102,
361537,
377931,
345172,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
386168,
410746,
361594,
214150,
345224,
386187,
345247,
361645,
345268,
402615,
361657,
337093,
402636,
328925,
165086,
66783,
165092,
222438,
386286,
328942,
386292,
206084,
328967,
345377,
353572,
345380,
345383,
263464,
337207,
345400,
378170,
369979,
386366,
337224,
337230,
337235,
353634,
337252,
402792,
271731,
378232,
337278,
271746,
181639,
353674,
181644,
181650,
181655,
230810,
181671,
181674,
181679,
181682,
181687,
370105,
181691,
181697,
361922,
337350,
181704,
337366,
271841,
329192,
361961,
329195,
116211,
337399,
402943,
337416,
329227,
419341,
419345,
329234,
419351,
345626,
419357,
345631,
370208,
419360,
394787,
419363,
370214,
419369,
394796,
419377,
419386,
206397,
214594,
419401,
419404,
353868,
419408,
214611,
419412,
403040,
345702,
222831,
370298,
353920,
403073,
403076,
345737,
198282,
403085,
403092,
345750,
419484,
345758,
345763,
419492,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
337601,
403139,
337607,
419528,
419531,
272083,
394967,
419545,
345819,
419548,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
362274,
378664,
354107,
345916,
354112,
370504,
329545,
345932,
370510,
354132,
337751,
370520,
247639,
313181,
182110,
354143,
354157,
345965,
345968,
345971,
345975,
403321,
1914,
354173,
395148,
247692,
337809,
247701,
329625,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
346059,
346064,
247760,
346069,
419810,
329699,
354275,
190440,
354314,
346140,
436290,
378956,
395340,
436307,
338005,
100454,
329833,
329853,
329857,
329868,
411806,
329886,
346273,
362661,
100525,
379067,
387261,
256193,
395467,
411862,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
387314,
436474,
321787,
379135,
411905,
411917,
379154,
395539,
387350,
387353,
338201,
182559,
338212,
362823,
436556,
321880,
362844,
379234,
354674,
321911,
420237,
379279,
354728,
338353,
338382,
272849,
248279,
256474,
182755,
338404,
330225,
248309,
248332,
330254,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
191085,
338544,
346736,
191093,
346743,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
355029,
264919,
256735,
338661,
264942,
363252,
338680,
264965,
338701,
256787,
363294,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
355151,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
355185,
412600,
207809,
379849,
396246,
330711,
248794,
437219,
257009,
265208,
265215,
199681,
338951,
330761,
330769,
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,
388348,
339199,
396552,
175376,
175397,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
126279,
437576,
437584,
331089,
437588,
331094,
396634,
175451,
437596,
429408,
175458,
175461,
175464,
265581,
175478,
249210,
175484,
175487,
249215,
249219,
175491,
249225,
249228,
249235,
175514,
175517,
396703,
396706,
175523,
355749,
396723,
388543,
380353,
216518,
380364,
339406,
372177,
339414,
413143,
249303,
339418,
339421,
249310,
339425,
249313,
339429,
339435,
249329,
69114,
372229,
208399,
380433,
175637,
405017,
134689,
339504,
265779,
413251,
265796,
265806,
224854,
224858,
257636,
224871,
372328,
257647,
372338,
224885,
224888,
224891,
224895,
372354,
421509,
126597,
224905,
11919,
224911,
224914,
126611,
224917,
224920,
126618,
208539,
224923,
224927,
224930,
224933,
257705,
224939,
224943,
257713,
224949,
257717,
257721,
224954,
257725,
224960,
257733,
224966,
224970,
257740,
224976,
257745,
339664,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
225013,
257788,
225021,
339711,
257791,
225027,
257796,
339722,
257802,
257805,
225039,
257808,
249617,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
257825,
225059,
339748,
225068,
257837,
413485,
225071,
225074,
257843,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
257869,
257872,
225105,
397140,
225109,
257881,
225113,
257884,
257887,
225120,
257891,
413539,
225128,
257897,
339818,
225138,
339827,
257909,
225142,
372598,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
372698,
372704,
372707,
356336,
380919,
372739,
405534,
266295,
266298,
217158,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
192640,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
250012,
225439,
135328,
225442,
438434,
192674,
225445,
225448,
438441,
356521,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
356580,
225511,
217319,
225515,
225519,
381177,
397572,
381212,
356638,
356641,
356644,
356647,
266537,
356650,
389417,
356656,
332081,
307507,
340276,
356662,
397623,
332091,
225599,
201030,
348489,
332107,
151884,
430422,
348503,
250203,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
250239,
389507,
348548,
356741,
332175,
160152,
373146,
340380,
373149,
70048,
356783,
373169,
324032,
201158,
340452,
127473,
217590,
340473,
324095,
324100,
324103,
324112,
340501,
324118,
340512,
332325,
324134,
381483,
356908,
324141,
324143,
356917,
324150,
324156,
168509,
348734,
324161,
324165,
356935,
381513,
348745,
324171,
324174,
324177,
389724,
332381,
373344,
340580,
348777,
381546,
119432,
340628,
184983,
373399,
258723,
332460,
332464,
332473,
381626,
332484,
332487,
332494,
357070,
357074,
332512,
332521,
340724,
332534,
155647,
373499,
348926,
389927,
348979,
152371,
348983,
340792,
398141,
357202,
389971,
357208,
389979,
430940,
357212,
357215,
439138,
201580,
201583,
349041,
340850,
430967,
324473,
398202,
119675,
324476,
430973,
340859,
340863,
324479,
324482,
373635,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
373672,
324525,
111539,
324534,
5047,
324539,
324542,
398280,
349129,
340940,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
381947,
201724,
431100,
349181,
431107,
209944,
209948,
357411,
250915,
250917,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
209996,
431180,
341072,
349268,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
152704,
160896,
349313,
210053,
210056,
349320,
373905,
259217,
210068,
210072,
210078,
210081,
210085,
210089,
210096,
210100,
324792,
210108,
357571,
210116,
210128,
210132,
333016,
210139,
210144,
218355,
218361,
275709,
128254,
275713,
242947,
275717,
275723,
349460,
333079,
251161,
349486,
349492,
415034,
210261,
365912,
259423,
374113,
251236,
374118,
333164,
234867,
390518,
357756,
374161,
112021,
349591,
333222,
259516,
415168,
366035,
415187,
366039,
415192,
415194,
415197,
415200,
333285,
415208,
366057,
366064,
415217,
415225,
423424,
415258,
415264,
366118,
415271,
382503,
349739,
144940,
415279,
415282,
415286,
210488,
415291,
415295,
349762,
333396,
374359,
333400,
366173,
423529,
423533,
210547,
415354,
333440,
267910,
267929,
333512,
259789,
366301,
333535,
153311,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
366349,
210707,
399129,
333595,
210720,
358192,
366384,
210740,
366388,
358201,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
341852,
350046,
399200,
358256,
268144,
358260,
341877,
325494,
333690,
325505,
333699,
399244,
333709,
333725,
333737,
382891,
350153,
358348,
333777,
219094,
399318,
358372,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
219144,
268299,
333838,
350225,
186388,
350232,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
342113,
252021,
342134,
374904,
333998,
334012,
260299,
350411,
350417,
350423,
350426,
350449,
358645,
350459,
350462,
350465,
350469,
268553,
350477,
268560,
350481,
432406,
350487,
325915,
350491,
325918,
350494,
325920,
350500,
194854,
350505,
358701,
391469,
350510,
358705,
358714,
358717,
383307,
358738,
334162,
383331,
383334,
391531,
383342,
334204,
268669,
391564,
366991,
334224,
268702,
342431,
375209,
375220,
334263,
326087,
358857,
195041,
334312,
104940,
375279,
416255,
350724,
186898,
342546,
350740,
342551,
334359,
342555,
334364,
416294,
350762,
252463,
358962,
334386,
334397,
358973,
252483,
219719,
399957,
334425,
326240,
334466,
334469,
162446,
326291,
342680,
342685,
260767,
342711,
244410,
260798,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
64231,
113389,
342769,
203508,
375541,
342777,
391938,
391949,
375569,
326417,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
326452,
326455,
375613,
244542,
260925,
375616,
326463,
326468,
342857,
326474,
326479,
326486,
416599,
342875,
326494,
433001,
400238,
326511,
211826,
211832,
392061,
351102,
359296,
260993,
252801,
351105,
400260,
211846,
342931,
400279,
252823,
392092,
400286,
252838,
359335,
211885,
252846,
400307,
351169,
359362,
351172,
170950,
359367,
326599,
359383,
359389,
383968,
359411,
261109,
261112,
244728,
383999,
261130,
261148,
359452,
211999,
261155,
261160,
261166,
359471,
375868,
343132,
384099,
384102,
367724,
384108,
343155,
384115,
212095,
351366,
384136,
384140,
384144,
351382,
384152,
384158,
384161,
351399,
384169,
367795,
244917,
384182,
367801,
384189,
351424,
384192,
343232,
367817,
244938,
384202,
253132,
326858,
384209,
146644,
351450,
384225,
359650,
343272,
351467,
384247,
351480,
384250,
351483,
351492,
343307,
384270,
261391,
359695,
253202,
261395,
384276,
384284,
245021,
384290,
253218,
245032,
171304,
384299,
351535,
376111,
245042,
326970,
384324,
343366,
212296,
212304,
367966,
343394,
367981,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
384398,
245137,
245143,
245146,
245149,
343453,
245152,
245155,
155045,
245158,
40358,
245163,
114093,
327090,
343478,
359867,
384444,
146878,
327108,
327112,
384457,
359887,
359891,
368093,
155103,
343535,
343540,
368120,
343545,
409092,
253445,
359948,
359951,
245295,
359984,
343610,
400977,
400982,
179803,
155241,
245358,
155255,
155274,
368289,
245410,
425652,
425663,
155328,
245463,
155352,
155356,
212700,
155364,
245477,
155372,
245487,
212723,
409336,
155394,
155404,
245528,
155423,
360224,
155439,
204592,
155444,
155448,
417596,
384829,
384831,
360262,
155463,
155477,
376665,
155484,
261982,
425823,
376672,
155488,
155492,
327532,
261997,
376686,
262000,
262003,
327542,
147319,
262006,
262009,
425846,
262012,
155517,
155523,
155526,
360327,
376715,
155532,
262028,
262031,
262034,
262037,
262040,
262043,
155550,
253854,
262046,
262049,
262052,
327590,
155560,
155563,
155566,
393152,
311244,
393170,
155604,
155620,
253924,
155622,
327655,
253927,
360432,
393204,
360439,
253944,
393209,
393215
] |
0c57a726e0bd9ac725106bbe9b6c865d16317a69 | f55ebf93809b7be1de87a423ee115490c1bc1532 | /2_AAE 복사본/AAE/AppDelegate.swift | a27c45c4ee02044f91478a38637c6c17f47d5834 | [] | no_license | GeekInTheClass/Coffee-in-Seoul | dc79e08433ed57e99f013d414b9d0d7b5327efd4 | c0bc9598e1080d3803c728a3eacb40467feac0d4 | refs/heads/master | 2021-01-12T04:59:10.064781 | 2017-01-12T09:51:10 | 2017-01-12T09:51:10 | 77,818,510 | 0 | 6 | null | 2017-01-09T05:41:35 | 2017-01-02T07:47:02 | Swift | UTF-8 | Swift | false | false | 2,169 | swift | //
// AppDelegate.swift
// AAE
//
// Created by cscoi006 on 2017. 1. 6..
// Copyright © 2017년 Community. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
286776,
319544,
286778,
204856,
229432,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
278983,
319945,
278986,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
295583,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
303987,
328563,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
304009,
304011,
304013,
295822,
279438,
189325,
189329,
295825,
304019,
189331,
213902,
58262,
304023,
304027,
279452,
234648,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
132165,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
279929,
181631,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
288214,
280021,
239064,
329177,
288217,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
230923,
304651,
304653,
370187,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
239202,
370279,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
280302,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
288895,
321670,
215175,
288909,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
280919,
248153,
215387,
354653,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
436684,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
281095,
223752,
150025,
338440,
240132,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
240519,
183184,
142226,
289687,
240535,
224151,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
216376,
380226,
298306,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
224641,
281987,
298372,
314756,
281990,
224647,
298377,
314763,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
290305,
306694,
192008,
323084,
282127,
290321,
282130,
290325,
282133,
241175,
290328,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
298822,
315211,
307027,
315221,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
241581,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
307374,
307376,
299185,
323763,
184503,
176311,
299191,
307386,
258235,
307388,
307385,
307390,
176316,
299200,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
299225,
233701,
307432,
282881,
282893,
323854,
291089,
282906,
291104,
233766,
307508,
315701,
332086,
307510,
307512,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
276052,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127431,
127434,
315856,
176592,
315860,
176597,
127447,
283095,
299481,
176605,
242143,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
283142,
127497,
233994,
135689,
127500,
233998,
127506,
234003,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
316294,
201603,
226182,
308105,
234375,
226185,
234379,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
226200,
234398,
291742,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
226245,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
324757,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
226500,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
349451,
275725,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
316811,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
284255,
284258,
292452,
292454,
284263,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
284290,
325250,
284292,
292485,
292479,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
292681,
153417,
358224,
276308,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
292729,
317306,
284540,
292734,
325512,
276365,
317332,
358292,
284564,
399252,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292784,
358326,
161718,
358330,
276410,
276411,
276418,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
350186,
292843,
276460,
292845,
276464,
178161,
227314,
276466,
325624,
350200,
276472,
317435,
276476,
276479,
276482,
350210,
276485,
317446,
178181,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
178224,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
243779,
325700,
284739,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
227430,
301167,
276583,
350321,
276590,
284786,
276595,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
309491,
227571,
309494,
243960,
276735,
227583,
227587,
276739,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
113167,
309779,
317971,
309781,
277011,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
23094,
277054,
219714,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170619,
309885,
309888,
277122,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
318132,
342707,
154292,
277173,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
113378,
228069,
277223,
342760,
285417,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
301884,
310080,
293696,
277317,
277322,
293706,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
276579,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
293917,
293939,
318516,
277561,
277564,
310336,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
64768,
310531,
285958,
138505,
228617,
318742,
277798,
130345,
113964,
285997,
384302,
285999,
113969,
318773,
318776,
286010,
417086,
286016,
302403,
294211,
384328,
294221,
146765,
294223,
326991,
179547,
146784,
302436,
294246,
327015,
310632,
327017,
351594,
351607,
310648,
310651,
310657,
351619,
294276,
310659,
327046,
253320,
310665,
318858,
310672,
351633,
310689,
130468,
228776,
277932,
310703,
310710,
130486,
310712,
310715,
302526,
228799,
302534,
310727,
245191,
64966,
163272,
302541,
302543,
310737,
228825,
163290,
310749,
310755,
187880,
310764,
286188,
310772,
40440,
212472,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
302617,
286233,
302621,
286240,
146977,
187936,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
278238,
229086,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
360322,
40851,
294811,
237470,
319390,
40865,
319394,
294817,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
591b6efe0ad260118ddb015d48da61b5bb43c915 | 017a5ae184aedc86b239e8a07e8d6c2a206b938f | /SAParallaxViewControllerSwiftExample/SAParallaxViewControllerSwiftExample/AppDelegate.swift | b8e951ecb1fcca6ab91e40a497f426acb3987d42 | [
"MIT"
] | permissive | Omnistyle/SAParallaxViewControllerSwift | 68429d8d580f25c3b08297c5390a1952884fb8c6 | a159e3671c111069a1fbc72b77cef6cd75dee5d5 | refs/heads/master | 2020-06-21T01:20:02.426893 | 2016-12-03T18:15:03 | 2016-12-03T18:15:03 | 74,813,426 | 0 | 0 | null | 2016-11-26T08:17:20 | 2016-11-26T08:17:20 | null | UTF-8 | Swift | false | false | 2,207 | swift | //
// AppDelegate.swift
// SAParallaxViewControllerSwiftExample
//
// Created by 鈴木大貴 on 2015/01/30.
// Copyright (c) 2015年 鈴木大貴. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
229388,
294924,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
278556,
229405,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
319544,
204856,
229432,
286776,
286778,
352318,
286791,
237640,
278605,
286797,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
131209,
303241,
417930,
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,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
287032,
155966,
278849,
319809,
319810,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
279010,
287202,
279015,
172520,
319978,
279020,
172526,
279023,
311791,
172529,
279027,
319989,
164343,
180727,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
287238,
172550,
303623,
320007,
172552,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
189039,
189040,
172655,
172656,
352880,
189044,
172660,
295538,
287349,
287355,
287360,
295553,
287365,
295557,
311942,
303751,
352905,
279178,
287371,
311946,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
287390,
295583,
303773,
172705,
287394,
164509,
303780,
172702,
287398,
172707,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
279231,
328384,
287423,
287427,
312006,
107208,
107212,
172748,
287436,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
279267,
312035,
295654,
279272,
312048,
230128,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
369433,
230169,
295707,
328476,
295710,
230175,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
304005,
295813,
304007,
320391,
213895,
304009,
304011,
230284,
304013,
213902,
279438,
189325,
189329,
295822,
189331,
304019,
279445,
58262,
304023,
295825,
279452,
234648,
410526,
279461,
279462,
304042,
213931,
304055,
230327,
287675,
197564,
304063,
238528,
304065,
189378,
213954,
156612,
295873,
213963,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
295949,
197645,
230413,
320528,
140312,
295961,
238620,
197663,
304164,
189479,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
296004,
132165,
336964,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
361576,
296040,
205931,
296044,
164973,
205934,
279661,
312432,
279669,
337018,
189562,
279679,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
165038,
238766,
230576,
238770,
304311,
230592,
279750,
312518,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
222525,
296253,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
296264,
238919,
320840,
296267,
296271,
222545,
230739,
312663,
337244,
222556,
230752,
312676,
230760,
173418,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
181626,
304506,
279929,
181631,
312711,
312712,
296331,
288140,
230800,
288144,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
280021,
288214,
222676,
239064,
288217,
288218,
280027,
288220,
329177,
239070,
288224,
288226,
370146,
280036,
288229,
280038,
288230,
288232,
280034,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
148990,
321022,
206336,
402942,
296446,
296450,
230916,
230919,
214535,
370187,
304651,
304653,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
280152,
288344,
239194,
280158,
403039,
370272,
181854,
239202,
370279,
312938,
280183,
280185,
280188,
280191,
280194,
116354,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
280264,
206536,
206539,
206541,
206543,
280276,
313044,
321239,
280283,
18140,
313052,
288478,
313055,
321252,
313066,
280302,
288494,
280304,
313073,
419570,
288499,
321266,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
194130,
280402,
173907,
313176,
280419,
321381,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
10170,
296890,
288700,
296894,
280515,
190403,
296900,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
313340,
239612,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
280671,
149599,
149601,
321634,
223327,
149603,
329830,
280681,
313451,
223341,
280687,
215154,
280691,
313458,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
280755,
288947,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
321740,
313548,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
240011,
199051,
289166,
240017,
297363,
190868,
297365,
240021,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
305594,
289210,
281024,
289218,
289221,
289227,
436684,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
281084,
240124,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
281095,
223752,
338440,
150025,
240132,
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,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
207661,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
183172,
158596,
338823,
322440,
314249,
240519,
183184,
240535,
289687,
224151,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
298306,
380226,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
308418,
216436,
306549,
298358,
314743,
306552,
306555,
314747,
298365,
290171,
290174,
224641,
281987,
314756,
298372,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
282025,
314793,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
282133,
290325,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
323229,
282269,
298655,
323231,
61092,
282277,
306856,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
282328,
306904,
298714,
52959,
282337,
216801,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
307009,
413506,
241475,
307012,
298822,
148946,
315211,
282446,
307027,
315221,
282454,
315223,
241496,
323414,
241498,
307035,
307040,
282465,
110433,
241509,
110438,
298860,
110445,
282478,
282481,
110450,
315251,
315249,
315253,
315255,
339838,
282499,
315267,
315269,
241544,
282505,
241546,
241548,
298896,
282514,
298898,
241556,
298901,
44948,
282520,
241560,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
315482,
315483,
217179,
192605,
233567,
200801,
299105,
217188,
299109,
307303,
315495,
356457,
307307,
45163,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
184479,
299167,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
323763,
176311,
299191,
307385,
307386,
258235,
307388,
176316,
307390,
184503,
299200,
184512,
307394,
307396,
299204,
184518,
307399,
323784,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
282931,
307508,
315701,
307510,
332086,
151864,
307512,
176435,
307515,
168245,
282942,
307518,
151874,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
291226,
242075,
283033,
291231,
61855,
283042,
291238,
291241,
194657,
127403,
127405,
127407,
291247,
299440,
299444,
127413,
283062,
291254,
194660,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
176592,
315856,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
291299,
340454,
242152,
291305,
127466,
176620,
127474,
291314,
291317,
135672,
233979,
291323,
291330,
283142,
127497,
233994,
135689,
291341,
233998,
127506,
234003,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
135844,
299684,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
225998,
299726,
226002,
119509,
226005,
226008,
242396,
299740,
201444,
299750,
283368,
234219,
283372,
381677,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
242450,
234258,
242452,
234261,
348950,
201496,
234264,
234266,
283421,
234269,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
283452,
160572,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
242511,
234319,
234321,
234324,
201557,
185173,
234329,
234333,
308063,
234336,
234338,
349027,
242530,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
234370,
201603,
291714,
234373,
316294,
226182,
234375,
308105,
226185,
234379,
291716,
234384,
234388,
234390,
226200,
234393,
209818,
308123,
324504,
324508,
234396,
234398,
291742,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
234410,
291754,
226220,
291756,
324522,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
234431,
242623,
324544,
324546,
234434,
324548,
226245,
234437,
234439,
226239,
234443,
291788,
193486,
234446,
193488,
234449,
275406,
316370,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
324599,
234487,
234490,
234493,
234496,
316416,
234501,
308231,
234504,
234507,
234510,
234515,
300054,
234519,
316439,
234520,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
234549,
300085,
300088,
234556,
234558,
316479,
234561,
308291,
316483,
234563,
234568,
234570,
316491,
300108,
234572,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
300133,
234597,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
300148,
234614,
398455,
144506,
234618,
275579,
234620,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
226453,
308373,
234647,
275608,
275606,
234650,
308379,
324757,
283805,
234653,
300189,
119967,
324766,
324768,
234657,
242852,
283813,
234661,
300197,
234664,
275626,
234667,
316596,
308414,
300223,
234687,
316610,
300226,
283844,
300229,
308420,
308422,
226500,
234692,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
316663,
275703,
300284,
275710,
300287,
300289,
292097,
161027,
300292,
300294,
275719,
177419,
300299,
283917,
242957,
300301,
177424,
349451,
275725,
349464,
415009,
283939,
259367,
283951,
292143,
300344,
226617,
243003,
283963,
226628,
283973,
300357,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
324978,
136562,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
284084,
284087,
292279,
144826,
144828,
144830,
144832,
284099,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
259565,
259567,
308720,
300527,
226802,
292338,
316917,
308727,
292343,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
308790,
284215,
316983,
194103,
284218,
194101,
226877,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
292433,
284243,
276052,
284245,
300628,
284247,
317015,
235097,
243290,
284251,
276053,
284253,
300638,
284255,
284249,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
276086,
284278,
292470,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
284290,
325250,
284292,
292485,
276098,
292479,
284297,
317066,
284299,
317068,
276109,
284301,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
276137,
284329,
317098,
284331,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
276166,
284358,
358089,
284362,
276170,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
284386,
358114,
358116,
276197,
317158,
358119,
284392,
325353,
284394,
358122,
284397,
276206,
284399,
358126,
358128,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
284418,
317187,
358146,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
186139,
300828,
300830,
276255,
325408,
300832,
300834,
284449,
317221,
227109,
358183,
186151,
276268,
300845,
194351,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
153417,
292681,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
284511,
317279,
227175,
292715,
300912,
284529,
292721,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
284564,
358292,
284566,
317332,
399252,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
317353,
276395,
292776,
292784,
276402,
358326,
161718,
276410,
276411,
358330,
276418,
276425,
301009,
301011,
301013,
292823,
301015,
301017,
358360,
292828,
276446,
153568,
276448,
276452,
276455,
292839,
350186,
292843,
276460,
276464,
178161,
276466,
227314,
276472,
350200,
325624,
317435,
276476,
276479,
276482,
350210,
276485,
317446,
178181,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
243733,
317468,
243740,
317472,
325666,
243751,
292904,
276528,
178224,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
243779,
325700,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
194654,
227423,
350302,
178273,
227426,
309346,
309348,
350308,
227430,
276583,
309350,
350313,
309352,
301163,
350316,
309354,
276590,
292968,
227440,
350321,
284786,
276595,
301167,
350325,
350328,
292985,
301178,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
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,
309455,
276689,
309462,
301272,
276699,
309468,
194780,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
227571,
309491,
309494,
243960,
227583,
276735,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
276766,
211232,
317729,
276775,
211241,
325937,
276789,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
276843,
293227,
276848,
293232,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
236043,
317963,
342541,
55822,
113167,
317971,
309779,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
318020,
301636,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
285320,
277128,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
342707,
154292,
277173,
318132,
293555,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
293666,
285474,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
293706,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
277368,
15224,
236408,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
276579,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
228330,
318442,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
285690,
244731,
121850,
293882,
302075,
293887,
277504,
277507,
277511,
277519,
293908,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
310344,
277577,
293960,
277583,
203857,
310355,
293971,
310359,
236632,
277594,
138332,
277598,
285792,
203872,
277601,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
302205,
285821,
392326,
285831,
253064,
302218,
285835,
294026,
384148,
162964,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
204023,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
228617,
138505,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
384302,
285999,
277804,
113969,
277807,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
146765,
294221,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
310659,
351619,
294276,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
64966,
245191,
163272,
302534,
310727,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
286169,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
302621,
187936,
146977,
286240,
187939,
40484,
294435,
40486,
286246,
286248,
40488,
278057,
40491,
245288,
294439,
294440,
310831,
294443,
294445,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
400976,
212560,
228944,
40533,
147032,
40537,
40539,
278109,
40541,
40544,
40548,
40550,
286312,
286313,
40552,
40554,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
302793,
294601,
343757,
212690,
278227,
286420,
319187,
229076,
286425,
319194,
278235,
229086,
278238,
286432,
294625,
294634,
302838,
319226,
286460,
171774,
278274,
302852,
278277,
302854,
311048,
294664,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
188252,
237409,
294776,
360317,
294785,
327554,
360322,
40840,
40851,
294803,
188312,
294811,
319390,
237470,
40865,
319394,
294817,
294821,
311209,
180142,
294831,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
ad6f6fb69a95c915b22245f9d0caae9d7083c18a | 6888e4c7325090f57ace058451bc994c1d42d6bd | /VKHackathon/CardModel.swift | 13adcef84b6f527c2de895af867fd0fc32afac99 | [] | no_license | own2pwn/vkhack18 | c2d6435077d15d5be74cfe4e95aa4b6cdb7df6ed | d72293f565482530ca435350dbdc17e6631e4851 | refs/heads/master | 2020-04-05T18:41:21.962290 | 2018-11-11T08:00:47 | 2018-11-11T08:00:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 401 | swift | //
// CardModel.swift
// VKHackathon
//
// Created by Mikhail Lutskiy on 09/11/2018.
// Copyright © 2018 Mikhail Lutskii. All rights reserved.
//
import Foundation
import RealmSwift
class CardModel: Object {
@objc dynamic var bankName = ""
@objc dynamic var cardId = ""
@objc dynamic var cardExpire = ""
@objc dynamic var cardType = ""
@objc dynamic var cardCurrency = ""
}
| [
-1
] |
5ad7340fb6f313e6596e2a4c5e7d121c58f376cf | e205895ffdb922d9e7a35669fdbd67d83959309e | /Angry Birds/Custom Nodes/GameCamera.swift | b99d5e425091f628cae504c8fe067778059e28da | [] | no_license | Raghav-Prakash/Angry-Birds | e42f0f842ca10de70faae40f1bc6451a66d4395f | b2631886bb32c26964f0f9068dbe7d82bf82d01c | refs/heads/master | 2020-03-25T22:11:16.719603 | 2018-08-13T21:31:46 | 2018-08-13T21:31:46 | 144,209,548 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,253 | swift | //
// GameCamera.swift
// Angry Birds
//
// Created by Raghav Prakash on 8/12/18.
// Copyright © 2018 Raghav Prakash. All rights reserved.
//
import SpriteKit
class GameCamera: SKCameraNode {
//MARK: - Add constraints to a node (in this case the camera node) given the scene and TileMapNode frame
func addConstraints(with scene: SKScene, and frame: CGRect, to node: SKNode?) {
// Get the scaled size
let scaledSize = CGSize(width: scene.size.width * xScale, height: scene.size.height * yScale)
// Set up an inset rectangle on our frame for the camera to be inset (constrained)
let xInset = min(scaledSize.width / 2, frame.size.width / 2)
let yInset = min(scaledSize.height / 2, frame.size.height / 2)
let frameInsetRect = frame.insetBy(dx: xInset, dy: yInset)
// From the inset Rectangle, get the x-coordinate range and y-coordinate range
let xRange = SKRange(lowerLimit: frameInsetRect.minX, upperLimit: frameInsetRect.maxX)
let yRange = SKRange(lowerLimit: frameInsetRect.minY, upperLimit: frameInsetRect.maxY)
let frameEdgeConstraint = SKConstraint.positionX(xRange, y: yRange)
// Add the frameEdgeConstraint to the array of constraints in our SKCameraNode
self.constraints = [frameEdgeConstraint]
}
}
| [
-1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.