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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b4e3ea915b06a9dad23d1692f82749fab315640a | efee6e197756b8350accb1530ec30fd670fb7ae0 | /ScheduleManager/Model/Database/Local/UsersLocalProtocol.swift | b1f040912f9e48af441633acf4ed7c80ce9ae569 | [] | no_license | jokerphuongnam/ScheduleManagerIOS | dd2d9f4f5808f34f269bac1519e1f38db5f5bac2 | dc9a15c549d600f60eaea254509dd66f777dcef9 | refs/heads/master | 2023-07-01T04:12:25.869303 | 2021-08-10T12:30:57 | 2021-08-10T12:30:57 | 394,646,518 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 56 | swift | import Foundation
protocol UsersLocalProtocol {
}
| [
-1
] |
ebaf27b0b06cb360fd5794cf2f01dcddd21e4aaf | f4d5f2d1253e02e29d7ed370ba4a20c98c4f986a | /SimpleApps/MovieBox/MovieBoxTests/Movies/Models/MovieTests.swift | d52937ac51c1f165064d04bc964141f53c4b7710 | [] | no_license | nhattuong92/ios-advance | b22cb37ff8aac17cbc7179f3b3d0044af0a37c39 | a68925cb93b9b438d7bf700e7b9c5c3ef2fedc24 | refs/heads/main | 2023-07-18T00:58:17.859923 | 2021-08-27T15:24:20 | 2021-08-27T15:24:20 | 357,564,845 | 5 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 1,809 | swift | //
// MovieTests.swift
// MovieBoxTests
//
// Created by Thomas Ngo on 29/7/21.
// Copyright © 2021 Thomas Ngo. All rights reserved.
//
import XCTest
@testable import MovieBox
final class MovieTests: XCTestCase {
private func givenMovie(posterPath: String?) -> Movie {
return Movie(adult: nil, backdropPath: nil,
genreIds: nil, id: 1, originalLanguage: nil,
originalTitle: nil, overview: nil,
popularity: nil, posterPath: posterPath,
releaseDate: nil, title: nil,
video: nil, voteAverage: nil,
voteCount: nil)
}
func testPoster_getPosterThumbnailURL_success() {
// given
let poster = givenMovie(posterPath: "/abc.png")
// when
let result = poster.getPosterThumbnailURL()
// then
XCTAssertEqual(result?.absoluteString, "\(Constants.baseImageURL)/w185\(poster.posterPath ?? "")")
}
func testPoster_getPosterThumbnailURL_posterPathNilReturnNil() {
// given
let poster = givenMovie(posterPath: nil)
// when
let result = poster.getPosterThumbnailURL()
// then
XCTAssertNil(result)
}
func testPoster_getPosterURL_success() {
// given
let poster = givenMovie(posterPath: "/abc.png")
// when
let result = poster.getPosterURL()
// then
XCTAssertEqual(result?.absoluteString, "\(Constants.baseImageURL)/w300\(poster.posterPath ?? "")")
}
func testPoster_getPosterURL_posterPathNilReturnNil() {
// given
let poster = givenMovie(posterPath: nil)
// when
let result = poster.getPosterURL()
// then
XCTAssertNil(result)
}
}
| [
-1
] |
fb6088f0281b42d1a0c79de2ae32d022be4d680e | c1401ef091ec5e5ccff4742b575559a4dfc9d260 | /Marguerite/DefaultsHelper.swift | 1eb3e0548c4efecbd0c8823de3e8a9a02b3c6ecb | [] | no_license | sujianping/Marguerite | 5fdf46a0242be86b1582a3789d3d2387678b7683 | 1f9ebaece135629dd23ddfe79c2228ca13f67f6d | refs/heads/master | 2021-01-21T03:41:17.053069 | 2015-09-14T23:45:18 | 2015-09-14T23:45:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,519 | swift | //
// DefaultsHelper.swift
// Portfolio
//
// Created by Andrew Finke on 1/23/15.
// Copyright (c) 2015 ATFinke Productions. All rights reserved.
//
class DefaultsHelper: NSObject {
static let appGroupDefaults = NSUserDefaults(suiteName: appGroupIdentifier)
/**
Gets an NSUserDefaults NSData value and unarchives it
- parameter key: The NSUserDefaults key
- returns: The object
*/
class func getObjectForKey(key : String) -> AnyObject? {
return appGroupDefaults?.objectForKey(key)
}
/**
Saves an object as NSData to NSUserDefaults for specified key
- parameter object: The bool value
- parameter key: The NSUserDefaults key
*/
class func saveDataForKey(object : AnyObject, key : String) {
appGroupDefaults?.setObject(object, forKey: key)
appGroupDefaults?.synchronize()
}
/**
Gets an NSUserDefaults key bool value
- parameter key: The NSUserDefaults key
- returns: value The bool value
*/
class func key(key : String) -> Bool {
if let defaults = appGroupDefaults {
return defaults.boolForKey(key)
}
return false
}
/**
Sets an NSUserDefaults key to a bool value
- parameter value: The bool value
- parameter key: The NSUserDefaults key
*/
class func keyIs(value : Bool, key : String) {
appGroupDefaults?.setBool(value, forKey: key)
appGroupDefaults?.synchronize()
}
}
| [
-1
] |
287a1d16be259006477dc084f4b640855a0f2071 | 469382ee6308790ddd19c35f165af36328e9b81f | /Test_Techinique/View/ClassementFeedCell.swift | f6af15f07e50eb7e8dd991c6596e532ac5627a87 | [] | no_license | Coiado/Test_Techinique | fc710d227d312a532ec6d3869b74a32147c4dc31 | 5792b48f4f4e3d55a3b5bca083d7685866678ea5 | refs/heads/master | 2021-05-11T16:16:44.016412 | 2018-01-17T00:07:33 | 2018-01-17T00:07:33 | 117,757,467 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,313 | swift | //
// ClassementFeedCell.swift
// Test_Techinique
//
// Created by Lucas Coiado Mota on 16/01/18.
// Copyright © 2018 Lucas Coiado Mota. All rights reserved.
//
import UIKit
class ClassementFeedCell: CombinationFeedCell {
override func setupViews() {
super.setupViews()
fetchFoods()
addSubview(collectionView)
collectionView.translatesAutoresizingMaskIntoConstraints = false
addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|[v0]|", options: NSLayoutFormatOptions(), metrics: nil, views: ["v0" : collectionView]))
addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|[v0]|", options: NSLayoutFormatOptions(), metrics: nil, views: ["v0" : collectionView]))
self.collectionView.register(ClassementCell.self, forCellWithReuseIdentifier: cellId)
}
override func fetchFoods() {
FoodManager.shared.combinationFetch(){ starters,dishes,desert in
self.combinations = []
for i in starters{
for j in dishes{
for k in desert{
let calories = i.calories!+j.calories!+k.calories!
self.combinations.append(Combination(starter: i.name, dish: j.name, desert: k.name, calories: (calories))!)
}
}
}
self.collectionView.reloadData()
}
}
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellId, for: indexPath) as! ClassementCell
let calories = Int(self.combinations[indexPath.item].calories!)
if calories <= 550 && calories >= 450{
cell.gradeLabel.text = "A"
}else if calories <= 600 && calories >= 400{
cell.gradeLabel.text = "B"
}else if calories <= 650 && calories >= 350{
cell.gradeLabel.text = "C"
}else if calories <= 700 && calories >= 300{
cell.gradeLabel.text = "D"
}else {
cell.gradeLabel.text = ""
}
cell.combination = self.combinations[indexPath.item]
return cell
}
}
| [
-1
] |
fe177d042129661568fc3e30f6585019c7ba4bc8 | 8f467eecdd76ce8560c0d972875f0285b8141c9f | /Project/ServiceOrientedArchitecture/Services/NetworkingServices/AuthNetworkServices.swift | f73ba1a12281bd18bc7f8b37a7ca408e186f7554 | [] | no_license | Arohak/CoordinatorBack | 3bf0d863bbbf581401fb4b100243eff40312874b | 84306ac10087e83ce931b1b96d1db4e8225259c7 | refs/heads/master | 2020-06-24T12:49:17.708415 | 2019-05-11T08:25:55 | 2019-05-11T08:25:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 895 | swift | //
// AuthNetworkServices.swift
// HauteCurator
//
// Created by Pavle Pesic on 1/20/19.
// Copyright © 2019 Pavle Pesic. All rights reserved.
//
import Foundation
class AuthNetworkServices {
// MARK: - Vars & Lets
private let apiManager: APIManager
func getUser(handler: @escaping (Swift.Result<ChooseLoginRegister.User, AlertMessage>) -> Void) {
self.apiManager.call(type: RequestItemsType.getUser) { (res: Result<ChooseLoginRegister.User, AlertMessage>) in
switch res {
case .success(let user):
handler(.success(user))
break
case .failure(let message):
handler(.failure(message))
break
}
}
}
// MARK: - Initialization
init(apiManager: APIManager) {
self.apiManager = apiManager
}
}
| [
-1
] |
92fe0526ac72173382a1b4289331e892e874fe86 | 6046675476fec4a1f8fe07b2e9b57ca05a5d9aa8 | /twitter/MenuProfileCell.swift | f0dfd40e7cee17d0d1121f9527fa82adb19337c2 | [] | no_license | 6zz/twitter-redux | 515fe1936b205c43e2abc4f5f11dd8246ed533bf | 7e52c1570dbbc6f3a3325e11fcb578b4e16cd4c3 | refs/heads/master | 2020-05-13T16:05:31.300474 | 2015-09-21T23:26:43 | 2015-09-21T23:26:43 | 42,788,048 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 868 | swift | //
// MenuProfileCell.swift
// twitter
//
// Created by Shawn Zhu on 9/20/15.
// Copyright © 2015 Shawn Zhu. All rights reserved.
//
import UIKit
class MenuProfileCell: UITableViewCell {
@IBOutlet weak var profileImageView: UIImageView!
@IBOutlet weak var userLabel: UILabel!
@IBOutlet weak var userDescriptionLabel: UILabel!
var user: User! {
didSet {
profileImageView.setImageWithURL(NSURL(string: user.profileImageUrl!))
userLabel.text = user.name!
userDescriptionLabel.text = user.tagline!
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
| [
-1
] |
a537cb8a53ed0e7768be36a7f778bbf0b4b6ef9c | b0f981f4045b09b8c643ab71719cb7128b605d20 | /THEm/THEm/profViewController.swift | 604add47b51a89ffcae55dc476cbf92a0fc1155c | [] | no_license | Teyoung-Hong/THEm_ios | d0b907d2da61dab3d5e5d2fedf5a42dd0fa240dc | 35989ee6e698d592642800299565b505c22beef1 | refs/heads/master | 2020-04-08T18:33:47.867273 | 2018-11-29T05:58:53 | 2018-11-29T05:58:53 | 159,613,713 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 949 | swift | //
// profViewController.swift
// THEm
//
// Created by Teyoung Hong on 2018/11/27.
// Copyright © 2018年 Lish Inc. All rights reserved.
//
import UIKit
class profViewController: UIViewController {
@IBOutlet weak var nameLbl: UILabel!
@IBOutlet weak var ageLbl: UILabel!
@IBOutlet weak var sexLbl: UILabel!
@IBOutlet weak var u_name_lbl: UILabel!
@IBOutlet weak var age_lbl: UILabel!
@IBOutlet weak var sex_lbl: UILabel!
@IBOutlet weak var toEditBtn: UIBarButtonItem!
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(_ animated: Bool) {
let appDelegate:AppDelegate = UIApplication.shared.delegate as! AppDelegate
}
@IBAction func toEditBtnTapped(_ sender: Any) {
let goProfEdit = storyboard!.instantiateViewController(withIdentifier: "profEdit")
self.present(goProfEdit, animated: true, completion: nil)
}
}
| [
-1
] |
93a19025f7e88d885b569ba75f2e154334e3954b | ea1cc3dda5bf08ddde90ba2aad07eae54cbe21b7 | /TrashClassifier/MenuViewController.swift | c7b40747f65ff8d088796049406385223ffb3c35 | [] | no_license | leo4life2/DeepTrash | 93e40ff6a50a66f67d05d0ce3550362c3d5c570b | 4bf3a424d238b64b4ce59c91a04d5ccce8444078 | refs/heads/master | 2020-06-19T16:06:39.621742 | 2019-07-13T23:56:27 | 2019-07-13T23:56:27 | 196,776,186 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 954 | swift | //
// MenuViewController.swift
// TrashClassifier
//
// Created by Leo on 2019/7/14.
// Copyright © 2019 leo. All rights reserved.
//
import UIKit
class MenuViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "toId"{
let dest = segue.destination as! ViewController
dest.menuVC = self
} else {
let dest = segue.destination as! GameViewController
dest.menuVC = self
}
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
}
| [
-1
] |
a69917cf27cbb4825900b2b4492d8cd9674e685e | 024aeb065be00717a1825621638498eb581d103c | /SwiftReader/AppDelegate.swift | c5d3194d7ebfb0f70c6268dff5a41699b9e8ab7b | [] | no_license | msegeya/iPhone-App-Dev-With-Swift | 92dd2829113b396d2d3623b2b68ad6421818525c | a7f7e2bc01a024c6f67adb0093ceba04acba1f73 | refs/heads/master | 2021-01-22T18:51:16.343448 | 2015-05-29T17:19:48 | 2015-05-29T17:19:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,138 | swift | //
// AppDelegate.swift
// SwiftReader
//
// Created by Derek Jensen on 5/15/15.
// Copyright (c) 2015 Derek Jensen. All rights reserved.
//
import UIKit
import CoreData
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
// Saves changes in the application's managed object context before the application terminates.
self.saveContext()
}
// MARK: - Core Data stack
lazy var applicationDocumentsDirectory: NSURL = {
// The directory the application uses to store the Core Data store file. This code uses a directory named "com.kreatived.SwiftReader" in the application's documents Application Support directory.
let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
return urls[urls.count-1] as! NSURL
}()
lazy var managedObjectModel: NSManagedObjectModel = {
// The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model.
let modelURL = NSBundle.mainBundle().URLForResource("SwiftReader", withExtension: "momd")!
return NSManagedObjectModel(contentsOfURL: modelURL)!
}()
lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator? = {
// The persistent store coordinator for the application. This implementation creates and return a coordinator, having added the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail.
// Create the coordinator and store
var coordinator: NSPersistentStoreCoordinator? = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel)
let url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("SwiftReader.sqlite")
var error: NSError? = nil
var failureReason = "There was an error creating or loading the application's saved data."
if coordinator!.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: nil, error: &error) == nil {
coordinator = nil
// Report any error we got.
var dict = [String: AnyObject]()
dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data"
dict[NSLocalizedFailureReasonErrorKey] = failureReason
dict[NSUnderlyingErrorKey] = error
error = NSError(domain: "YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict)
// Replace this with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
NSLog("Unresolved error \(error), \(error!.userInfo)")
abort()
}
return coordinator
}()
lazy var managedObjectContext: NSManagedObjectContext? = {
// Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) This property is optional since there are legitimate error conditions that could cause the creation of the context to fail.
let coordinator = self.persistentStoreCoordinator
if coordinator == nil {
return nil
}
var managedObjectContext = NSManagedObjectContext()
managedObjectContext.persistentStoreCoordinator = coordinator
return managedObjectContext
}()
// MARK: - Core Data Saving support
func saveContext () {
if let moc = self.managedObjectContext {
var error: NSError? = nil
if moc.hasChanges && !moc.save(&error) {
// Replace this implementation with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
NSLog("Unresolved error \(error), \(error!.userInfo)")
abort()
}
}
}
}
| [
277514,
277003,
280085,
278551,
278042,
276510,
281635,
194085,
277030,
228396,
277038,
223280,
278577,
280132,
282203,
189025,
292450,
285796,
279148,
278125,
285296,
227455,
278656,
228481,
276611,
226440,
278665,
280205,
225934,
188050,
278674,
276629,
283803,
278687,
277154,
282274,
278692,
226469,
228009,
287402,
227499,
278700,
278705,
276149,
278711,
279223,
278718,
283838,
228544,
279753,
229068,
227533,
164566,
201439,
278751,
226031,
203532,
181516,
277262,
276751,
278287,
284432,
278289,
276755,
278808,
278297,
282910,
281379,
282915,
277306,
278844,
280382,
282433,
277826,
164166,
226634,
276313,
278877,
280415,
277344,
276321,
227687,
279405,
278896,
277363,
275828,
281972,
278902,
280439,
276347,
228220,
213886,
279422,
278916,
284557,
191374,
293773,
288147,
214934,
277912,
276892,
278943,
282016,
230320,
230322,
281011,
283058,
277941,
286130,
276923,
278971,
282558,
299970,
280007,
288200,
284617,
286157,
281041,
283091,
282075,
294390,
282616
] |
3b0aac4143d19d18aa9db69935d0c78db96d25de | f4e79f32c315b9035ac125177bbcfdae3fac7765 | /Demo1-Login/Demo1-Login/ViewController.swift | 93b150cc49d32b3b51ae1204716446d6672c2ee5 | [] | no_license | kphungry/MVVMDemo | adcb64d65cb6cbb43cb938f5643d8064b3fe7aa5 | d72e2ad841862c2116b84ff1ca5ba1a18713cb27 | refs/heads/master | 2021-01-22T10:51:44.892801 | 2017-03-15T08:26:27 | 2017-03-15T08:26:27 | 82,046,394 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 518 | swift | //
// ViewController.swift
// Demo1-Login
//
// Created by 周文杰 on 2017/3/14.
// Copyright © 2017年 zwj. All rights reserved.
//
import UIKit
import Result
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,
307212,
281107,
279064,
300057,
294433,
295460,
284197,
296489,
292915,
281142,
300089,
290875,
238653,
286786,
129604,
228932,
243786,
284235,
288331,
228945,
203858,
280146,
284242,
300629,
307288,
212573,
309347,
309349,
309351,
309353,
286314,
296042,
277612,
311913,
164974,
307311,
312433,
284275,
277108,
284277,
189557,
284279,
294518,
292478,
284289,
278657,
284298,
278675,
349332,
307353,
284315,
284317,
282275,
284323,
287399,
198315,
313007,
284336,
302767,
307379,
276150,
280760,
184504,
282301,
296638,
283839,
277696,
285377,
280770,
285378,
280772,
280775,
284361,
230604,
298189,
302286,
287437,
230608,
317137,
239310,
299727,
290004,
284373,
290006,
189655,
302295,
239314,
298202,
282329,
280797,
278749,
298206,
363743,
290020,
301284,
277224,
280808,
199402,
280810,
228585,
234223,
286963,
289524,
286965,
120054,
226038,
280826,
286462,
276736,
280832,
309506,
292102,
278791,
282377,
312586,
295699,
278298,
329499,
287004,
281373,
287007,
281380,
233767,
283433,
130346,
282411,
289596,
278845,
283453,
279360,
293700,
283461,
300358,
238920,
311624,
296272,
230737,
290299,
289112,
230745,
241499,
281436,
188253,
292701,
311645,
289120,
289121,
227688,
296811,
306540,
290303,
293742,
300400,
304551,
315250,
277364,
284534,
207738,
292730,
291709,
290175,
183173,
298375,
324491,
233869,
304015,
310673,
304531,
226196,
304536,
284570,
294812,
304540,
284574,
277406,
284576,
284577,
289187,
284580,
289190,
289191,
304550,
305577,
284586,
291755,
289196,
370093,
279982,
286126,
297903,
305582,
285103,
324528,
282548,
230323,
144822,
130487,
293816,
292280,
127418,
293308,
278973,
291774,
10179,
296901,
306633,
286158,
280015,
310734,
311761,
286162,
301012,
292824,
280030,
279011,
289771,
282095,
293874,
293875,
302580,
236022,
288251,
287231
] |
af789c70fbe1f16cf94335178fc932ca4dfed3ec | 60ca4535ec23fd0cc99454cc3c73eb6eba224e85 | /Widdit/Controlllers/Auth/WDTSignUpSituationViewController.swift | 6eb1a1f11a148023da1d8623d83668851e2b3544 | [] | no_license | ItsMcCants/Widdit | 598688442d43d8bceaae3a6000ca7d2b8b2bec6a | d18b1af7d49fe6884c6ef20a542841391b379a03 | refs/heads/master | 2020-04-05T13:33:11.380290 | 2017-05-05T10:29:15 | 2017-05-05T10:29:15 | 83,402,418 | 1 | 0 | null | 2017-05-05T10:29:16 | 2017-02-28T07:22:10 | Swift | UTF-8 | Swift | false | false | 2,107 | swift | //
// WDTSignUpSituationViewController.swift
// Widdit
//
// Created by JH Lee on 06/03/2017.
// Copyright © 2017 Widdit. All rights reserved.
//
import UIKit
class WDTSignUpSituationViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet weak var m_tblSituation: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
m_tblSituation.rowHeight = UITableViewAutomaticDimension
m_tblSituation.estimatedRowHeight = 44
}
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.
}
*/
@IBAction func onClickBtnSkip(_ sender: Any) {
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.startApplication(true)
}
// MARK: - UITableViewDataSource
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 3
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = Bundle.main.loadNibNamed(String(describing: WDTProfileSituationTableViewCell.self), owner: nil, options: nil)?.first as! WDTProfileSituationTableViewCell
if indexPath.row == 0 {
cell.setView(.School)
} else if indexPath.row == 1 {
cell.setView(.Job)
} else {
cell.setView(.Open)
}
return cell
}
// MARK: - UITableViewDelegate
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 20
}
}
| [
-1
] |
90e4449445cf820a17d370f89611c4d24a68f507 | 8ad2cc2b85d200c6c5253bc19f22b64a77f042e8 | /3/11022/11022/main.swift | a6cba19fc56c20aa2c282ef4d9a8cbdfaf13928c | [] | no_license | seydouxxx/baekjoonByStep | 0aa688d1869ac24eb7c39dc953c5f773a7984da8 | 4e4033ab3d8131196b5bebabfd780920fcf0c631 | refs/heads/main | 2023-08-06T16:57:47.161835 | 2021-10-09T12:15:40 | 2021-10-09T12:15:40 | 413,756,831 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 808 | swift | //문제
//두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.
//
//입력
//첫째 줄에 테스트 케이스의 개수 T가 주어진다.
//
//각 테스트 케이스는 한 줄로 이루어져 있으며, 각 줄에 A와 B가 주어진다. (0 < A, B < 10)
//
//출력
//각 테스트 케이스마다 "Case #x: A + B = C" 형식으로 출력한다. x는 테스트 케이스 번호이고 1부터 시작하며, C는 A+B이다.
//
//예제 입력 1
//5
//1 1
//2 3
//3 4
//9 8
//5 2
//예제 출력 1
//Case #1: 1 + 1 = 2
//Case #2: 2 + 3 = 5
//Case #3: 3 + 4 = 7
//Case #4: 9 + 8 = 17
//Case #5: 5 + 2 = 7
(1...Int(readLine()!)!).forEach { i in
let n = readLine()!.split{$0==" "}.map{Int(String($0))!}
print("Case #\(i): \(n[0]) + \(n[1]) = \(n[0]+n[1])")
}
| [
-1
] |
72e2ce4e88ee54dd9d9eeef22cf7fe6d5bf442f2 | 409acbd1fe4d13d60f482568f071615f340625f3 | /FLScene/Classes/logic/Controllers/ItemFinderController.swift | 31205ebd5de942f1633ce1177e384482789017fd | [
"MIT"
] | permissive | skorulis/FLScene-lib | 9329243f15a9432f4178981725014fecf37a62c9 | 0cd02d8c1de073f276655ec086781981c2c88d26 | refs/heads/master | 2020-03-25T20:27:13.198965 | 2018-09-19T21:59:18 | 2018-09-19T21:59:18 | 144,131,737 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 482 | swift | //
// ItemFinderController.swift
// Pods
//
// Created by Alexander Skorulis on 9/9/18.
//
import Foundation
class ItemFinderController: NSObject {
let ref:ReferenceController
init(ref:ReferenceController) {
self.ref = ref
}
func findItem(attributes:ItemAttributes) -> ItemModel {
let itemRef = ref.itemsArray.filter { $0.attributes?.contains(attributes) ?? false }.first!
return ItemModel(ref: itemRef)
}
}
| [
-1
] |
6c8b57fe30003653d48e45e20ce52b5f3b641647 | 8eab8100cf9a24cb6cefde866e0ced03982e291c | /IOS Projects/Catch Me UI Game/CatchMe AppUITests/CatchMe_AppUITests.swift | be0caa4f9bd1485911287fd01f5084d0e22027c6 | [] | no_license | MehdadZaman/Mobile-Development | 01ff46b7d36a3817b39eec32be03da5f7cb80235 | 0de786ab27204d56100ce7c5e94e129fe257ab8e | refs/heads/master | 2022-11-14T04:41:38.121123 | 2020-07-04T21:14:57 | 2020-07-04T21:14:57 | 268,011,934 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,488 | swift | //
// CatchMe_AppUITests.swift
// CatchMe AppUITests
//
// Created by user175434 on 6/14/20.
// Copyright © 2020 mehdadzaman. All rights reserved.
//
import XCTest
class CatchMe_AppUITests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testLaunchPerformance() throws {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTOSSignpostMetric.applicationLaunch]) {
XCUIApplication().launch()
}
}
}
}
| [
360463,
376853,
344106,
253996,
163894,
385078,
352314,
376892,
32829,
352324,
352327,
385095,
163916,
368717,
254039,
426074,
368732,
180317,
32871,
352359,
221292,
385135,
376945,
385147,
426124,
196758,
49308,
65698,
49317,
377008,
377010,
377025,
377033,
164043,
417996,
254157,
368849,
368850,
139478,
385240,
254171,
147679,
147680,
205034,
254189,
254193,
344312,
336121,
262403,
147716,
368908,
180494,
368915,
254228,
262419,
377116,
254250,
131374,
418095,
336177,
180534,
155968,
270663,
368969,
254285,
180559,
377168,
344402,
270703,
385407,
385409,
106893,
270733,
385423,
385433,
213402,
385437,
254373,
385449,
115116,
385463,
336319,
336323,
188870,
262619,
377309,
377310,
369121,
369124,
270823,
213486,
360945,
139766,
393719,
377337,
254459,
410108,
410109,
262657,
377346,
410126,
393745,
385554,
262673,
254487,
410138,
188957,
377374,
385569,
385578,
377388,
197166,
393775,
418352,
33339,
352831,
33344,
385603,
426575,
369236,
385620,
270938,
352885,
352886,
344697,
369285,
385669,
344714,
377487,
180886,
426646,
352921,
377499,
344737,
352938,
418479,
164532,
336565,
377531,
377534,
377536,
385737,
385745,
369365,
369366,
385751,
361178,
352989,
352990,
418529,
295649,
385763,
369383,
361194,
418550,
344829,
197377,
434956,
418579,
426772,
197398,
426777,
344864,
197412,
336678,
189229,
197424,
197428,
336693,
377656,
426809,
197433,
377669,
197451,
369488,
385878,
385880,
197467,
435038,
385895,
197479,
385901,
197489,
164730,
254851,
369541,
172936,
426894,
377754,
172971,
377778,
189362,
189365,
377789,
345034,
418774,
386007,
418781,
386016,
123880,
418793,
222193,
435185,
271351,
435195,
328701,
328705,
386049,
418819,
410629,
377863,
189448,
361487,
435216,
386068,
254997,
336928,
336930,
410665,
345137,
361522,
386108,
410687,
377927,
361547,
156763,
361570,
214116,
214119,
402538,
173168,
377974,
66684,
402568,
140426,
386191,
410772,
222364,
418975,
124073,
402618,
402632,
402641,
419028,
222441,
386288,
66802,
271607,
369912,
369913,
419066,
386296,
386304,
369929,
419097,
115997,
222496,
369964,
353581,
116014,
66863,
345397,
345398,
386363,
337226,
345418,
337228,
353612,
353611,
378186,
353617,
378201,
337280,
353672,
263561,
9618,
370066,
411028,
370072,
148900,
361928,
337359,
329168,
329170,
353751,
361958,
271850,
271853,
329198,
411119,
116209,
386551,
271880,
198155,
329231,
370200,
157219,
157220,
394793,
353875,
271980,
206447,
42616,
337533,
370307,
419462,
149127,
149128,
419464,
214667,
411275,
345753,
255651,
337590,
370359,
403149,
345813,
370390,
272087,
345817,
337638,
181992,
345832,
345835,
141037,
173828,
395018,
395019,
395026,
411417,
345882,
435993,
255781,
362281,
378666,
403248,
378673,
182070,
182071,
345910,
436029,
337734,
272207,
272208,
337746,
395092,
345942,
362326,
370526,
345950,
362336,
255844,
214894,
362351,
214896,
182145,
337816,
329627,
354210,
436130,
436135,
10153,
362411,
370604,
362418,
411587,
362442,
346066,
354268,
436189,
403421,
329696,
354273,
403425,
354279,
436199,
174058,
247787,
329707,
354283,
247786,
337899,
436209,
346117,
182277,
354310,
354312,
43016,
354311,
403463,
436235,
419857,
436248,
346153,
272432,
403507,
378933,
378934,
436283,
403524,
436293,
436304,
329812,
411738,
272477,
395373,
346237,
436372,
362658,
436388,
133313,
395458,
338118,
436429,
346319,
379102,
387299,
18661,
379110,
149743,
379120,
436466,
411892,
395511,
436471,
436480,
272644,
338187,
338188,
395536,
338196,
157973,
272661,
379157,
338217,
362809,
379193,
395591,
272730,
436570,
215395,
362864,
272755,
354678,
436609,
395653,
436613,
395660,
264591,
272784,
420241,
436644,
272815,
436659,
338359,
436677,
256476,
420326,
166403,
420374,
330291,
191065,
436831,
420461,
346739,
346741,
420473,
166533,
346771,
363155,
264855,
363161,
436897,
355006,
363228,
436957,
436960,
264929,
338658,
346859,
330476,
35584,
133889,
346889,
207639,
363295,
355117,
191285,
355129,
273209,
273211,
355136,
355138,
420680,
355147,
355148,
355153,
387927,
363353,
363354,
420702,
363361,
363362,
412516,
355173,
355174,
207724,
355182,
207728,
420722,
330627,
265094,
387977,
396171,
355216,
224146,
224149,
256918,
256919,
256920,
256934,
273336,
273341,
330688,
379845,
363462,
273353,
207839,
347104,
134124,
412653,
248815,
257007,
347122,
437245,
257023,
125953,
396292,
330759,
347150,
330766,
412692,
330789,
248871,
412725,
257093,
404550,
339031,
257126,
265318,
404582,
265323,
396395,
404589,
273523,
363643,
248960,
363658,
404622,
224400,
347286,
265366,
339101,
429216,
380069,
265381,
421050,
339131,
265410,
183492,
273616,
339167,
421102,
52473,
363769,
52476,
412926,
437504,
388369,
380178,
429332,
412963,
257323,
273713,
208179,
159033,
347451,
257353,
257354,
109899,
437585,
331091,
150868,
372064,
429410,
437602,
388458,
265579,
421240,
388488,
396697,
396709,
380335,
355761,
421302,
134586,
380348,
216510,
216511,
380350,
200136,
273865,
339403,
372172,
413138,
437726,
429540,
3557,
3559,
265720,
216575,
372226,
437766,
208397,
413202,
413206,
388630,
175640,
372261,
347693,
323120,
396850,
200245,
323126,
134715,
421437,
396865,
413255,
265800,
273992,
421452,
265809,
396885,
265816,
396889,
388699,
396896,
388712,
388713,
339579,
396927,
224907,
396942,
405140,
274071,
208547,
208548,
405157,
388775,
364202,
421556,
224951,
224952,
224985,
159462,
372458,
397040,
12017,
274170,
175874,
249606,
372497,
397076,
421657,
339746,
257831,
167720,
421680,
421686,
274234,
339782,
339799,
274276,
274288,
372592,
274296,
372625,
118693,
438186,
151492,
380874,
380910,
380922,
380923,
274432,
372736,
430120,
430127,
405552,
249912,
225347,
421958,
176209,
381013,
53334,
200795,
356446,
438374,
176231,
438378,
422000,
249976,
266361,
422020,
168069,
381061,
168070,
381071,
430231,
200856,
422044,
192670,
192671,
258213,
430263,
266427,
266447,
372943,
258263,
356575,
438512,
372979,
389364,
381173,
135416,
356603,
266504,
61720,
381210,
389406,
438575,
266547,
332084,
397620,
438583,
127292,
438592,
332100,
397650,
348499,
250196,
348501,
389465,
332128,
110955,
160111,
250227,
438653,
340356,
266628,
225684,
373141,
373144,
389534,
397732,
373196,
184799,
201195,
324098,
340489,
397841,
258584,
397855,
348709,
348710,
397872,
340539,
266812,
438850,
348741,
381515,
348748,
430681,
332379,
184938,
373357,
184942,
176751,
389744,
356983,
356984,
209529,
356990,
373377,
422529,
152196,
201348,
356998,
348807,
356999,
275102,
340645,
176805,
422567,
176810,
160441,
422591,
135888,
373485,
373486,
21239,
348921,
275193,
430853,
430860,
62222,
430880,
152372,
160569,
430909,
160576,
348999,
439118,
381791,
127840,
357219,
439145,
381811,
201590,
398205,
340865,
349066,
349068,
381840,
390034,
373653,
430999,
381856,
185252,
398244,
422825,
381872,
398268,
349122,
398275,
127945,
373705,
340960,
398305,
340967,
398313,
127990,
349176,
201721,
349179,
357380,
398370,
357413,
357420,
398405,
250955,
218187,
250965,
439391,
250982,
398444,
62574,
357487,
119925,
349304,
349315,
349317,
373902,
373937,
373939,
324790,
218301,
259275,
259285,
357594,
414956,
251124,
439550,
439563,
414989,
349458,
259346,
382243,
382246,
382257,
382264,
333115,
193853,
251212,
406862,
259408,
374110,
382329,
259449,
357758,
357763,
112019,
398740,
374189,
251314,
259513,
54719,
259569,
251379,
398844,
210429,
366081,
153115,
431646,
349727,
431662,
374327,
210489,
235069,
128589,
333389,
333394,
349780,
415334,
54895,
366198,
210558,
210559,
415360,
210569,
415369,
431754,
267916,
415376,
259741,
153252,
399014,
210601,
202413,
415419,
259780,
333508,
267978,
333522,
325345,
333543,
325357,
431861,
366358,
169751,
431901,
341791,
399148,
202541,
431918,
153392,
431935,
415555,
325444,
325449,
341837,
415566,
431955,
325460,
341846,
259937,
382820,
415592,
325491,
341878,
333687,
350072,
276343,
112510,
325508,
333700,
243590,
350091,
350092,
350102,
350108,
333727,
128955,
219102,
6116,
432114,
415740,
268286,
415744,
399372,
358418,
153618,
178215,
358455,
399433,
333902,
104534,
260206,
432241,
374913,
374914,
415883,
333968,
333990,
104633,
260285,
268479,
374984,
334049,
268515,
383208,
260337,
260338,
432373,
375040,
432387,
260355,
375052,
194832,
325904,
391448,
268570,
178459,
186660,
268581,
334121,
358698,
325930,
260396,
358707,
432435,
178485,
358710,
14654,
268609,
383309,
383327,
366948,
416101,
383338,
432503,
432511,
252309,
39323,
375211,
334259,
129461,
342454,
358844,
326083,
416201,
129484,
154061,
416206,
432608,
432616,
334315,
375281,
334345,
432650,
342549,
342560,
416288,
350758,
350759,
358951,
358952,
219694,
219695,
432694,
375369,
375373,
416334,
416340,
244311,
260705,
416353,
375396,
268901,
244345,
375438,
326288,
383668,
342714,
39616,
383708,
269036,
432883,
342775,
203511,
383740,
416509,
359166,
162559,
375552,
432894,
383755,
326413,
326428,
342827,
391980,
416577,
244569,
375644,
252766,
342888,
392057,
211835,
392065,
260995,
400262,
392071,
424842,
236427,
252812,
400271,
392080,
400282,
211871,
359332,
359333,
326571,
252848,
326580,
261045,
261046,
326586,
359365,
211913,
326602,
252878,
342990,
433104,
359380,
433112,
433116,
359391,
343020,
187372,
383980,
383994,
171009,
384004,
433166,
384015,
433173,
326684,
252959,
384031,
375848,
261191,
375902,
375903,
392288,
253028,
351343,
187505,
138354,
384120,
392317,
343166,
384127,
392320,
253074,
326803,
359574,
351389,
253098,
367791,
367792,
367798,
343230,
367809,
253124,
113863,
351445,
195809,
253168,
351475,
351489,
367897,
367898,
130347,
261426,
212282,
359747,
359748,
146763,
114022,
253288,
425327,
425331,
327030,
163190,
384379,
253316,
384391,
253339,
253340,
343457,
245160,
359860,
359861,
343480,
425417,
327122,
425434,
253431,
359931,
187900,
343552,
409095,
359949,
253456,
253462,
146976,
245290,
245291,
343606,
163385,
425534,
147011,
147020,
196184,
179800,
343646,
155238,
204394,
138862,
188021,
425624,
245413,
384693,
376502,
409277,
409289,
425682,
245471,
212721,
163575,
360194,
409355,
155408,
417556,
204600,
384826,
409404,
360253,
409416,
376661,
368471,
425820,
368486,
409446,
425832,
40809,
368489,
384871,
417648,
417658,
360315,
253828,
425875,
253851,
376733,
253868,
188349,
212947,
212953,
360416,
253930,
385011
] |
7d2958216b4b8234c86f6989618e17b254a58de7 | dc74acb48b5bac4dad63fa7460ec0dd48b81beff | /SwaggerClient/Classes/Swaggers/Models/PostTellersRequest.swift | 822b745e173991e416637c05e7c2e49c125bbff0 | [] | no_license | kangbreder/Swagger-codegen | cd6bbc7ba2653dfbefef7bb5d59e3e04ea5c5077 | 6b77816bfbe2b7380f917d2d625b2cfdd3619973 | refs/heads/master | 2022-06-28T04:11:36.746173 | 2019-07-18T19:31:50 | 2019-07-18T19:31:50 | 197,645,187 | 0 | 0 | null | 2022-05-20T21:03:05 | 2019-07-18T19:28:09 | Java | UTF-8 | Swift | false | false | 1,238 | swift | //
// PostTellersRequest.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
public struct PostTellersRequest: Codable {
public enum Status: String, Codable {
case invalid = "INVALID"
case pending = "PENDING"
case active = "ACTIVE"
case inactive = "INACTIVE"
case closed = "CLOSED"
}
public var officeId: Int64?
public var name: String?
public var _description: String?
public var status: Status?
public var locale: String?
public var dateFormat: String?
public var startDate: Date?
public init(officeId: Int64?, name: String?, _description: String?, status: Status?, locale: String?, dateFormat: String?, startDate: Date?) {
self.officeId = officeId
self.name = name
self._description = _description
self.status = status
self.locale = locale
self.dateFormat = dateFormat
self.startDate = startDate
}
public enum CodingKeys: String, CodingKey {
case officeId
case name
case _description = "description"
case status
case locale
case dateFormat
case startDate
}
}
| [
-1
] |
04a593cbfa94e5d06cf0c38d5b99795340723bf1 | 51f5aef921daa6040e2aed46f7b7f00ce4c97e1f | /LookALikeChat/View Controllers/ChannelListViewControllerCell.swift | 6de2091ff59a5d1dbd5f692e0c4e4f0f3d013bc7 | [] | no_license | megavolt605/LookALikeChat | 0e87df57c79089dde14fb5eda0ba9a89450f2971 | 125896089a2e7b1b5628d39dc5c5b48f10298e66 | refs/heads/master | 2021-03-30T21:48:30.245291 | 2018-04-09T19:23:03 | 2018-04-09T19:23:03 | 124,532,040 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 568 | swift | //
// ChannelListViewControllerCell.swift
// LookALikeChat
//
// Created by Igor Smirnov on 21/03/2018.
// Copyright © 2018 Complex Numbers. All rights reserved.
//
import UIKit
class ChannelListViewControllerCell: UITableViewCell {
@IBOutlet weak var channelNameLabel: UILabel!
@IBOutlet weak var channelOwnerLabel: UILabel!
func setupCell(with model: ChannelModel) {
channelNameLabel.text = model.name
channelOwnerLabel.text = model.owner.nick
}
}
class ChannelListViewControllerCreateChannelCell: UITableViewCell {
}
| [
-1
] |
af3cf064f1471d94d65a0d71f73feefa65189b04 | 7212fc8bc8478aad797cf6d32dbe301d3860f19c | /tp-01/TaskManager/Sources/TaskManager/main.swift | ff0bdd7f10ec1ae0a0bde5503d283b9e2764c1e3 | [] | no_license | AlexandraBoudry/outils-formels-modelisation | 432e5cdfa787c97d1bfa15c14a067ba67b9d635e | f6b85d842f94e580572931267ce231bae3ac1ae8 | refs/heads/master | 2021-09-03T21:01:30.106007 | 2018-01-12T00:24:03 | 2018-01-12T00:24:03 | 105,260,518 | 0 | 0 | null | 2017-09-29T10:29:33 | 2017-09-29T10:29:33 | null | UTF-8 | Swift | false | false | 3,298 | swift | import TaskManagerLib
let taskManager = createTaskManager()
// Show here an example of sequence that leads to the described problem.
// For instance:
// let m1 = create.fire(from: [taskPool: 0, processPool: 0, inProgress: 0])
// let m2 = spawn.fire(from: m1!)
// ...
let create = taskManager.transitions.filter{$0.name=="create"}[0]
let spawn = taskManager.transitions.filter{$0.name=="spawn"}[0]
let exec = taskManager.transitions.filter{$0.name=="exec"}[0]
let success = taskManager.transitions.filter{$0.name=="success"}[0]
let fail = taskManager.transitions.filter{$0.name=="fail"}[0]
let taskPool = taskManager.places.filter{$0.name=="taskPool"}[0]
let processPool = taskManager.places.filter{$0.name=="processPool"}[0]
let inProgress = taskManager.places.filter{$0.name=="inProgress"}[0]
let m1 = create.fire(from:[taskPool: 0, processPool: 0, inProgress: 0])
print(m1!)
let m2 = spawn.fire(from: m1!)
print(m2!)
let m3 = spawn.fire(from: m2!)
print(m3!)
let m4 = exec.fire(from: m3!)
print(m4!)
let m5 = exec.fire(from: m4!)
print(m5!)
let m6 = success.fire(from: m5!)
print(m6!)
let m7 = fail.fire(from: m6!)
print(m7!)
// Dans le cas original, cela pose problème lorsque l'on a une tâche et deux processus car le deuxième processus
//peut executer la tâche alors qu'elle a déjà été executée avec un processus.Toutefois, le deuxième processus resta
//bloqué dans inProgress et la seule façon de le suprimer sera de tirer fail.
let correctTaskManager = createCorrectTaskManager()
// Show here that you corrected the problem.
// For instance:
// let m1 = create.fire(from: [taskPool: 0, processPool: 0, inProgress: 0])
// let m2 = spawn.fire(from: m1!)
// ...
let create2 = correctTaskManager.transitions.filter{$0.name=="create"}[0]
let spawn2 = correctTaskManager.transitions.filter{$0.name=="spawn"}[0]
let exec2 = correctTaskManager.transitions.filter{$0.name=="exec"}[0]
let success2 = correctTaskManager.transitions.filter{$0.name=="success"}[0]
let fail2 = correctTaskManager.transitions.filter{$0.name=="fail"}[0]
let taskPool2 = correctTaskManager.places.filter{$0.name=="taskPool"}[0]
let processPool2 = correctTaskManager.places.filter{$0.name=="processPool"}[0]
let inProgress2 = correctTaskManager.places.filter{$0.name=="inProgress"}[0]
let newPlace2 = correctTaskManager.places.filter{$0.name=="newPlace"}[0]
let m21 = create2.fire(from:[taskPool2: 0, processPool2: 0, inProgress2: 0, newPlace2: 0])
print(m21!)
let m22 = spawn2.fire(from: m21!)
print(m22!)
let m23 = spawn2.fire(from: m22!)
print(m23!)
let m24 = exec2.fire(from: m23!)
print(m24!)
let m25 = success2.fire(from: m24!)
print(m25!)
// En ajoutant une place en précondition de exec, la suite où on tire deux fois de suite exec n'est plus possible.
//En effet, exec ne pourra être tiré que si une nouvelle tâche est créée.
//Le processus attendra d'avoir une tâche pour pouvoir s'exécuter. Une fois la tâche exécutée avec le processus,
//soit on tire success, soit on tire fail. Dans le cas où sucess est tiré, la tâche et le prcessus sont détruits.
//Dans le cas où fail est tiré, le processus est détruit et un token est placé dans newPlace afin d'attendre un nouveau
//processus pour pouvoir tirer exéc à nouveau afin de traiter la tâche.
| [
-1
] |
f283e9b722f8ecc7eee3d351a78f38662449b361 | 4044862985fb2d0fd24133f4be928cacb9f473a5 | /6_1/ViewController.swift | c59f1cc99b83e5c48f690845c4393a961ce2cc85 | [] | no_license | aaaRele/Swift_6_1 | 44223280e7ebb8404eca221648cfabc597d6ffe6 | f789d4bfedc7c5ab58b1d9ee729931571b79a6b9 | refs/heads/master | 2020-04-12T01:10:57.836902 | 2018-12-18T03:23:59 | 2018-12-18T03:23:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 341 | swift | //
// ViewController.swift
// 6_1
//
// Created by student on 2018/12/5.
// Copyright © 2018年 wyf. 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.
}
}
| [
374273,
240520,
316810,
312078,
319888,
317972,
316949,
308374,
316825,
318489,
190120,
241069,
319291,
111292,
294845,
219715,
312273,
310742,
320726,
320728,
316769,
318568,
317673,
326639,
312051,
311284,
316665,
313341
] |
0437978e061c9c8e75f04497a923265013f4b540 | 67748171255113de847d725770f62661cc9be7d3 | /Swift Class.xctemplate/UITableViewCellFinalSwift/___FILEBASENAME___.swift | c7f701b56d99b2891cb653c80f627828b925c308 | [
"MIT"
] | permissive | lovesunstar/SwiftXcodeTemplate | ffcf31129fbd5f811d8bb2a2c4e8b9983a9323c7 | c979e15d5b0792aed519fe9bdd902e6012951f8e | refs/heads/master | 2021-01-10T08:17:12.833214 | 2016-01-15T06:40:46 | 2016-01-15T06:40:46 | 48,834,064 | 2 | 1 | null | 2016-01-15T06:40:48 | 2015-12-31T04:56:29 | Shell | UTF-8 | Swift | false | false | 527 | swift | //
// ___FILENAME___
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
//___COPYRIGHT___
//
import UIKit
/// <#Class description#>
final class ___FILEBASENAMEASIDENTIFIER___: ___VARIABLE_cocoaTouchSubclass___ {
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
| [
-1
] |
5550e7dff9d060e6fb299aef6fe0f3fe1e03dc9e | b0e75df044c5d76dad6e6e68142e53916e727a87 | /SystemSounds-Example/SystemSounds-Example/AppDelegate.swift | 60ede3399f39b3fc363f45106e7259c3088b2850 | [
"MIT"
] | permissive | Meniny/SystemSounds | 3b74f619e9530a108e55a913b8ff70f79053bae3 | b55eb1f3599ce0505436c895c34d62af27368b1f | refs/heads/master | 2021-06-04T23:18:48.430438 | 2017-08-29T11:16:22 | 2017-08-29T11:16:22 | 91,111,118 | 7 | 1 | MIT | 2021-03-26T08:48:39 | 2017-05-12T16:40:36 | Swift | UTF-8 | Swift | false | false | 2,180 | swift | //
// AppDelegate.swift
// SystemSounds-Example
//
// Created by Meniny on 2017-05-13.
// Copyright © 2017年 Meniny. 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,
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,
286776,
319544,
286778,
204856,
229432,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
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,
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,
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,
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,
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,
66690,
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,
181626,
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,
148946,
288214,
239064,
329177,
288217,
280027,
288220,
288218,
239070,
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,
230923,
304651,
304653,
370187,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
239202,
370279,
312938,
280183,
280185,
280188,
280191,
116354,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
419555,
321252,
313066,
288494,
280302,
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,
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,
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,
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,
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,
256716,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
240519,
183184,
142226,
289687,
240535,
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,
257550,
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,
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,
241821,
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,
295583,
307508,
315701,
332086,
307510,
307512,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
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,
127440,
315860,
176597,
283095,
127447,
299481,
127449,
176605,
242143,
127455,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
283142,
127494,
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,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
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,
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,
226185,
234379,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
226245,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
308226,
234501,
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,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
324757,
300189,
324766,
119967,
234653,
324768,
234657,
283805,
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,
243003,
283963,
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,
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,
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,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
276122,
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,
276206,
358128,
284399,
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,
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,
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,
342749,
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,
277337,
301913,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
276579,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
138246,
277511,
293899,
277519,
293908,
293917,
293939,
318516,
277561,
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,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
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,
280021,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
360322,
40851,
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
] |
ca700a7482933d0e3c72d92d5d1273eca9a97059 | dea616ccf8019bf5cc84465f0a6fee3a5d97ee46 | /Others/SwiftUI-Weather/SwiftUI-Weather/AppDelegate.swift | 0a3d72b40bbd97753cbc5af0b56b55747c95954c | [] | no_license | yungfan/SwiftUI-learning | 3b7544aa38c2c04e7b7eea9e527240b786f74c03 | a436080946f88dd81ff5c45411a55b6c6d9b6573 | refs/heads/master | 2023-07-03T12:43:17.799526 | 2023-06-19T10:43:14 | 2023-06-19T10:43:14 | 193,068,632 | 84 | 26 | null | null | null | null | UTF-8 | Swift | false | false | 1,414 | swift | //
// AppDelegate.swift
// SwiftUI-Weather
//
// Created by 杨帆 on 2020/3/24.
// Copyright © 2020 杨帆. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
| [
393222,
393224,
393230,
393250,
344102,
393261,
393266,
163891,
213048,
385081,
376889,
393275,
376905,
327756,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
286831,
368752,
286844,
417924,
262283,
286879,
286888,
377012,
327871,
180416,
377036,
180431,
377046,
377060,
327914,
205036,
393456,
393460,
336123,
418043,
336128,
385280,
262404,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
393538,
262472,
344403,
213332,
65880,
262496,
418144,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
328206,
410128,
393747,
254490,
188958,
385570,
33316,
197159,
377383,
352821,
188987,
418363,
369223,
385609,
385616,
352856,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
328378,
164538,
328386,
352968,
344776,
418507,
352971,
352973,
385742,
385748,
361179,
189153,
369381,
361195,
418553,
344831,
336643,
344835,
344841,
361230,
336659,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
336711,
328522,
336714,
426841,
197468,
254812,
361309,
361315,
361322,
328573,
377729,
369542,
222128,
345035,
345043,
386003,
386011,
386018,
386022,
435187,
328702,
328714,
361489,
386069,
336921,
386073,
336925,
345118,
377887,
345133,
345138,
386101,
361536,
197707,
189520,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
345267,
386258,
328924,
66782,
222437,
386285,
328941,
386291,
345376,
353570,
345379,
410917,
345382,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181649,
181654,
230809,
181670,
181673,
181678,
337329,
181681,
181684,
181690,
361917,
181696,
337349,
181703,
337365,
271839,
329191,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
419362,
394786,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
345701,
394853,
222830,
370297,
353919,
403075,
345736,
198280,
403091,
345749,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
337592,
419512,
337599,
419527,
419530,
419535,
272081,
394966,
419542,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
141051,
337659,
337668,
362247,
395021,
362255,
321299,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
337833,
362413,
337844,
346057,
247759,
346063,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
100453,
329832,
329855,
329885,
411805,
346272,
362660,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
321786,
379134,
411903,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
338211,
395566,
248111,
362822,
436555,
190796,
321879,
379233,
354673,
321910,
248186,
420236,
379278,
272786,
354727,
338352,
330189,
338381,
338386,
256472,
338403,
338409,
248308,
199164,
330252,
199186,
330267,
354855,
10828,
199249,
346721,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
338660,
338664,
264941,
363251,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
330642,
355218,
412599,
207808,
379848,
396245,
330710,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
330760,
330768,
248862,
396328,
158761,
396336,
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,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
372015,
347441,
372018,
199988,
44342,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
175486,
249214,
175489,
249218,
249224,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
208311,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
249308,
339420,
249312,
339424,
339428,
339434,
249328,
69113,
372228,
208398,
380432,
175635,
339503,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
224897,
372353,
216707,
339588,
126596,
421508,
224904,
224909,
159374,
11918,
339601,
224913,
126610,
224916,
224919,
126616,
208538,
224922,
224926,
224929,
224932,
224936,
257704,
224942,
257712,
224947,
257716,
257720,
224953,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
224993,
257761,
257764,
224999,
339695,
225012,
257787,
225020,
339710,
257790,
225025,
257794,
339721,
257801,
257804,
225038,
257807,
372499,
167700,
225043,
225048,
257819,
225053,
184094,
225058,
339747,
339749,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
257871,
225103,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
339814,
225127,
257896,
274280,
257901,
225137,
339826,
257908,
225141,
257912,
257916,
225148,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
405533,
430129,
266294,
266297,
217157,
421960,
356439,
430180,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
266453,
225493,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
397571,
389380,
61722,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
250199,
250202,
332125,
250210,
348522,
348525,
348527,
332152,
250238,
389502,
332161,
356740,
332172,
373145,
340379,
389550,
324030,
266687,
160234,
127471,
340472,
324094,
266754,
324099,
324102,
324111,
340500,
324117,
324131,
332324,
381481,
324139,
356907,
324142,
356916,
324149,
324155,
348733,
324160,
324164,
356934,
348743,
381512,
324170,
324173,
324176,
389723,
332380,
373343,
381545,
340627,
184982,
373398,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
332493,
357069,
357073,
332511,
332520,
340718,
332533,
348924,
373510,
389926,
152370,
348978,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
357211,
430939,
357214,
201579,
201582,
349040,
340849,
201588,
430965,
324472,
398201,
119674,
324475,
430972,
340861,
324478,
340858,
324481,
373634,
398211,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
422816,
324513,
398245,
201637,
324524,
340909,
324533,
5046,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
349180,
439294,
431106,
209943,
209946,
250914,
357410,
185380,
357418,
209965,
209968,
209971,
209975,
209979,
209987,
209990,
341071,
349267,
250967,
210010,
341091,
210025,
210027,
210030,
210039,
210044,
349308,
152703,
160895,
349311,
210052,
210055,
349319,
210067,
210071,
210077,
210080,
210084,
251044,
185511,
210088,
210095,
210098,
210107,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
251128,
218360,
275706,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
210260,
365911,
259421,
365921,
333154,
251235,
374117,
333162,
234866,
390516,
333175,
357755,
251271,
136590,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
415207,
366056,
415216,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
333399,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
153227,
333498,
333511,
210631,
259788,
358099,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
210739,
366387,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
259938,
399206,
358255,
399215,
268143,
358259,
341876,
333689,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
358339,
333774,
358371,
350189,
350193,
350202,
333818,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
334011,
260289,
350410,
260298,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
325891,
350467,
350475,
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,
268701,
342430,
375208,
326058,
375216,
334262,
334275,
326084,
358856,
334304,
334311,
375277,
334321,
350723,
186897,
342545,
334358,
342550,
342554,
334363,
358941,
350761,
252461,
334384,
383536,
358961,
334394,
252482,
219718,
334407,
334420,
350822,
375400,
334465,
334468,
162445,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
334528,
260801,
350917,
154317,
391894,
154328,
416473,
64230,
113388,
342766,
375535,
203506,
342776,
391937,
391948,
326416,
375568,
375571,
375574,
162591,
326441,
326451,
326454,
244540,
326460,
375612,
260924,
326467,
244551,
326473,
326477,
326485,
416597,
326490,
342874,
326502,
375656,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
359366,
326598,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
359451,
261147,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
367723,
384107,
187502,
384114,
343154,
212094,
351364,
384135,
384139,
384143,
351381,
384151,
384160,
384168,
367794,
244916,
384181,
384188,
351423,
384191,
384198,
326855,
244937,
384201,
253130,
343244,
384208,
146642,
384224,
359649,
343270,
351466,
384246,
351479,
384249,
343306,
261389,
359694,
253200,
261393,
384275,
384283,
245020,
384288,
245029,
171302,
351534,
376110,
245040,
384314,
425276,
384323,
212291,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
154999,
253303,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
425649,
155322,
425662,
155327,
245460,
155351,
155354,
212699,
245475,
155363,
245483,
155371,
409335,
155393,
155403,
155422,
360223,
155438,
155442,
155447,
155461,
360261,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
262005,
147317,
425845,
262008,
262011,
155516,
155521,
155525,
360326,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
393169,
384977,
155611,
155619,
253923,
155621,
327654,
253926,
204784,
393203,
360438,
253943,
393206,
393212,
155646
] |
40d68643904ee32d0dfa2d66332b12c73d90a986 | 14dd5b942bfd387a5fba12018cac292b628eaa10 | /CalenalaApp/MeetingDetail.swift | 6fc95e7b11deae93efe92519fc709ff75a2254e8 | [] | no_license | krezed1/calenala | 6c3f02cfb250fb9030c8bf12f71f49ce8eb4bd32 | 341ead0626d5da4e3254d9bfae4831d9147617e8 | refs/heads/master | 2020-06-17T19:38:11.523353 | 2017-09-21T06:08:20 | 2017-09-21T06:08:20 | 74,975,683 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,734 | swift | //
// MeetingDetail.swift
// CalenalaApp
//
// Created by Krezelok, Daniel (Ext) on 09/11/16.
// Copyright © 2016 Krezelok, Daniel. All rights reserved.
//
import Foundation
import Mantle
class MeetingDetail: MTLModel, MTLJSONSerializing {
public var meetingId: String?
public var name: String?
public var start: String?
public var end: String?
public var organizer: String?
public var rating: NSNumber?
public var ratedByMe: NSNumber?
public var locationName: String?
public var meetingDesc: String?
public var roomName: String?
public var duration: String?
public var peopleCount: String?
public var accepted: String?
public var declined: String?
public var tentative: String?
public var price: String?
public var potentialPrice: String?
public var attendees: Array<Attende>?
public var populatedMeetingInterval: String? {
var meetingInterval = ""
if let baseDate = start?.populateBaseDate(),
let startHours = start?.populateHours(),
let endHours = end?.populateHours() {
meetingInterval = String(format:"%@, %@ - %@",
baseDate,
startHours,
endHours)
}
return meetingInterval
}
// MARK: MTLJSONSerializing
public static func jsonKeyPathsByPropertyKey() -> [AnyHashable : Any]! {
return ["meetingDesc" : "description",
"duration" : "duration",
"peopleCount" : "peoplecount",
"accepted" : "accepted",
"declined" : "declined",
"tentative" : "tentative",
"price" : "price",
"potentialPrice" : "potentional_price",
"meetingId" : "id",
"name" : "name",
"start" : "start",
"end" : "end",
"organizer" : "organizer",
"rating" : "rating",
"locationName" : "location_name",
"ratedByMe" : "rated_by_me"
]
}
// + (NSValueTransformer *)HTMLURLJSONTransformer {
// return [NSValueTransformer valueTransformerForName:MTLURLValueTransformerName];
// }
// MARK: Public
public func attendeesRated() -> Array<Attende>? {
var attendeesRated: Array<Attende> = Array<Attende>()
guard let atts = attendees else {
return attendeesRated
}
for attendee in atts {
if attendee.rated() == true {
attendeesRated.append(attendee)
}
}
return attendeesRated
}
public func rateMeeting(rating: Int, ratingDesc: String, completion: @escaping (Bool) -> Swift.Void) {
let url = URL(string: APIManager.BASE_API_URL)
let params = String(format: "action=MobileApi&api_key=123456apikey&akce=rateMeeting&token=%@&meeting_id=%@&rating=%d&rating_description=%@", User.currentUser.token!, meetingId!, rating, ratingDesc)
let body = params.data(using: .utf8)
var request = URLRequest(url: url!)
request.httpMethod = "POST"
request.httpBody = body
APIManager.callRequest(request: request) { (JSON) in
DispatchQueue.main.async {
let resultStr = JSON?["response"] as? NSString
var result: Bool?
if resultStr == nil {
result = false
}
result = resultStr?.boolValue
completion(result!)
}
}
}
public static func loadMeetingDetail(meetingId: String, completion: @escaping (MeetingDetail?) -> Swift.Void) {
let url = URL(string: APIManager.BASE_API_URL)
let params = String(format: "action=MobileApi&api_key=123456apikey&akce=getMeetingInfo&token=%@&meeting_id=%@", User.currentUser.token!, meetingId)
let body = params.data(using: .utf8)
var request = URLRequest(url: url!)
request.httpMethod = "POST"
request.httpBody = body
APIManager.callRequest(request: request) { (JSON) in
let meetingInfoJSON = JSON?["meeting_info"] as? [AnyHashable : Any]
let attendeesJSON = JSON?["attendees"] as? [Any]
let meetingDetail = try! MTLJSONAdapter.model(of: MeetingDetail.self, fromJSONDictionary: meetingInfoJSON!) as? MeetingDetail
meetingDetail?.attendees = try! MTLJSONAdapter.models(of: Attende.self, fromJSONArray: attendeesJSON!) as? Array<Attende>
DispatchQueue.main.async {
completion(meetingDetail)
}
}
}
}
| [
-1
] |
88615be578719736d3b34d276747f4a065059ac6 | 8c481289087889c18a39558474eb808b59f661e7 | /Flicks/Flicks/MovieCell.swift | 71c438e94463db1d4abecc797cf70e2b3fa3535e | [
"Apache-2.0"
] | permissive | FionaBronwen/Flicks | 20a941067b9452cd2deb78a6501b39b4098caafb | 8dbe3afad1c405abebef227c0d9f428e53c1626a | refs/heads/master | 2021-01-11T22:28:17.586479 | 2017-02-14T01:45:40 | 2017-02-14T01:45:40 | 78,967,150 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 296 | swift | //
// MovieCell.swift
// Flicks
//
// Created by Fiona Thompson on 2/13/17.
// Copyright © 2017 Fiona Thompson. All rights reserved.
//
import UIKit
class MovieCell: UICollectionViewCell {
@IBOutlet weak var posterImage: UIImageView!
@IBOutlet weak var titleLabel: UILabel!
}
| [
281120,
135675
] |
1dfc6db9dc60caa51fe7c3a44d3fd7de99d61dfd | 247ec90fa8c8036619609b9f07f2a3336b351c55 | /TTPL-E-Commerce/Network/TTNetwork/Managers/TTNetworkCoreDataManager.swift | bd64a94b35035e3197b0e84cb3d5815e12ddc762 | [
"MIT"
] | permissive | Pradeepkn/ECommerce | af638e68ee9055aed2ea400e8b18c1a5899b4817 | a9d54fde131848e5bd94ad46d30cb309d9ec9052 | refs/heads/master | 2021-01-19T16:59:45.893889 | 2017-08-23T16:37:08 | 2017-08-23T16:37:08 | 101,032,811 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 8,937 | swift | //
// CoreDataManager.swift
// MapunitGroup
//
// Created by Pradeep on 4/21/16.
//
import Foundation
import CoreData
class TTNetworkCoreDataManager {
static let sharedInstance = TTNetworkCoreDataManager()
// MARK:- Configuration
static let modelName = "TTNetwork"
static let storeName = "TTNetwork.sqlite"
// Lightweight migration
static let storeOption = [NSMigratePersistentStoresAutomaticallyOption : true, NSInferMappingModelAutomaticallyOption : true]
// MARK: - Core Data stack
lazy var applicationDocumentsDirectory: NSURL = {
// The directory the application uses to store the Core Data store file.
let urls = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
return urls[urls.count-1] as NSURL
}()
lazy var managedObjectModel: NSManagedObjectModel = {
// The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model.
let modelURL = Bundle.main.url(forResource: modelName, withExtension: "momd")!
return NSManagedObjectModel(contentsOf: modelURL)!
}()
lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator = {
// The persistent store coordinator for the application. This implementation creates and returns a coordinator, having added the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail.
// Create the coordinator and store
let coordinator = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel)
let url = self.applicationDocumentsDirectory.appendingPathComponent(storeName)
var failureReason = "There was an error creating or loading the application's saved data."
do {
try coordinator.addPersistentStore(ofType: NSSQLiteStoreType, configurationName: nil, at: url, options: storeOption)
} catch {
// Report any error we got.
var dict = [String: AnyObject]()
dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data" as AnyObject?
dict[NSLocalizedFailureReasonErrorKey] = failureReason as AnyObject?
dict[NSUnderlyingErrorKey] = error as NSError
let wrappedError = NSError(domain: modelName, code: 9999, userInfo: dict)
// Replace this with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
NSLog("Unresolved error \(wrappedError), \(wrappedError.userInfo)")
abort()
}
return coordinator
}()
lazy var managedObjectContext: NSManagedObjectContext = {
// Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) This property is optional since there are legitimate error conditions that could cause the creation of the context to fail.
let coordinator = self.persistentStoreCoordinator
var managedObjectContext = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
managedObjectContext.persistentStoreCoordinator = coordinator
return managedObjectContext
}()
init() {
// subscribe to change notifications
NotificationCenter.default.addObserver(self, selector: #selector(mocDidSaveNotification as (NSNotification) -> ()), name:NSNotification.Name.NSManagedObjectContextDidSave, object: nil)
}
deinit {
NotificationCenter.default.removeObserver(self)
}
}
// MARK: - Context
extension TTNetworkCoreDataManager {
// MARK: - Context Observer
@objc public func mocDidSaveNotification(notificaiton: NSNotification) {
if let managedObjectContext = notificaiton.object as? NSManagedObjectContext {
// ignore change notifications for the main context
guard managedObjectContext != self.managedObjectContext else {
return
}
guard managedObjectContext.persistentStoreCoordinator == self.managedObjectContext.persistentStoreCoordinator else {
return
}
DispatchQueue.main.async {
self.managedObjectContext.mergeChanges(fromContextDidSave: notificaiton as Notification)
}
}
}
// MARK: - Private Concurrency Context
func createPrivateContext() -> NSManagedObjectContext {
let privateManagedObjectContect = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
privateManagedObjectContect.persistentStoreCoordinator = self.persistentStoreCoordinator
return privateManagedObjectContect
}
// MARK: - Private Concurrency Context
func createChildContext() -> NSManagedObjectContext {
let parentContext = self.managedObjectContext
let childContext = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
childContext.parent = parentContext
return childContext
}
func createChildContext(parentContext: NSManagedObjectContext) -> NSManagedObjectContext {
let parentContext = parentContext
let childContext = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
childContext.parent = parentContext
return childContext
}
// MARK: - Core Data Saving support
@discardableResult func saveContext (context: NSManagedObjectContext) -> NSError? {
var saveContextError: NSError?
if context.hasChanges {
context.performAndWait({
do {
try context.save()
} catch {
saveContextError = error as NSError
}
})
}
// If the context is child context the save the parent context changes also
if let parentContext = context.parent, saveContextError == nil {
if parentContext.hasChanges {
parentContext.performAndWait({
do {
try parentContext.save()
} catch {
saveContextError = error as NSError
}
})
}
}
return saveContextError
}
}
// MARK: - Query
extension TTNetworkCoreDataManager {
// MARK: - Fetch Request
func fetchRequest(entity: String,
predicate: NSPredicate?,
sortDescriptors: [NSSortDescriptor]?,
context: NSManagedObjectContext) -> ( [NSManagedObject]? ,NSError?) {
let fetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: entity)
if let predicate = predicate {
fetchRequest.predicate = predicate
}
if let sortDescriptors = sortDescriptors {
fetchRequest.sortDescriptors = sortDescriptors
}
var requestError: NSError?
var managedObjectList: [NSManagedObject]?
context.performAndWait(){
do {
try managedObjectList = context.fetch(fetchRequest) as? [NSManagedObject]
} catch {
requestError = error as NSError
}
}
return (managedObjectList, requestError)
}
// MARK: - Delete Request
func deleteRequest (entity: String,
predicate: NSPredicate?,
context: NSManagedObjectContext) -> NSError? {
let (managedObjectList, error) = fetchRequest(entity: entity, predicate: predicate, sortDescriptors: nil, context: context)
if let error = error {
// Unable to fetch the request with the predicate.
return error
}
var requestError: NSError?
if let managedObjectList = managedObjectList {
for managedObject in managedObjectList {
context.delete(managedObject)
requestError = saveContext(context: context)
}
}
return requestError
}
// MARK: - Delete Request With ManagedObject
func deleteRequest (managedObjectList : [NSManagedObject],
context: NSManagedObjectContext) -> NSError? {
var requestError: NSError?
for managedObject in managedObjectList {
context.delete(managedObject)
requestError = saveContext(context: context)
}
return requestError
}
}
| [
-1
] |
48408ed0f9e8a27c9175a418e0ed19d8a251281f | c10a781f4434eb75faae52d6c3e607ee8ad8e268 | /16_错误处理/16_错误处理/main.swift | 2500f275b54eb383230f553706ab28f313351b51 | [
"MIT"
] | permissive | 0Mooshroom/Learning-Swift | b99f7e8e347ed31c98704b1850f6c647805abace | df64e27103d0003d96c34395359785e3ae2e9baf | refs/heads/master | 2021-01-20T01:54:05.556471 | 2017-08-26T07:00:09 | 2017-08-26T07:00:09 | 101,305,853 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,826 | swift | //
// main.swift
// 16_错误处理
//
// Created by 赵恒 on 2017/8/26.
// Copyright © 2017年 Mooshroom. All rights reserved.
//
import Foundation
//: 表示和抛出错误
// 在Swift中,错误表示为遵循Error协议类型的值。这个空的协议明确了一个类型可以用于处理
enum VendingMachineError: Error {
case invalidSelection
case insufficientFunds(coinsNeeded: Int)
case outOfStock
}
//: 使用函数抛出函数传递错误
struct Item {
var price: Int
var count: Int
}
class VendingMachine {
var inventory = [
"Candy Bar": Item(price: 12, count: 7),
"Chips": Item(price: 10, count: 4),
"Pretzels": Item(price: 7, count: 1)
]
var coinsDeposited = 0
func vend(itemName name: String) throws {
guard let item = inventory[name] else {
throw VendingMachineError.invalidSelection
}
guard item.count > 0 else {
throw VendingMachineError.outOfStock
}
guard item.price <= coinsDeposited else {
throw VendingMachineError.insufficientFunds(coinsNeeded: item.price - coinsDeposited)
}
coinsDeposited -= item.price
var newItem = item
newItem.count -= 1
inventory[name] = newItem
print("Dispensing \(name)")
}
}
let favoriteSnacks = [
"Alice": "Chips",
"Bob": "Licorice",
"Eve": "Pretzels",
]
func buyFavoriteSnack(person: String, vendingMachine: VendingMachine) throws {
let snackName = favoriteSnacks[person] ?? "Candy Bar"
try vendingMachine.vend(itemName: snackName)
}
//: do-catch语句
var vendingMachine = VendingMachine()
vendingMachine.coinsDeposited = 10
do {
try buyFavoriteSnack(person: "Alice", vendingMachine: vendingMachine)
} catch VendingMachineError.invalidSelection {
print("Invalid Selection.")
} catch VendingMachineError.outOfStock {
print("Out of Stock.")
} catch VendingMachineError.insufficientFunds(let coinsNeeded) {
print("Insufficient funds. Please insert an additional \(coinsNeeded) coins.")
}
//: 转换错误为可选项
// 当你想要在同一句里处理所有错误时,使用 try?能让你的错误处理代码更加简洁
func getData() -> Data? {
if let data = try? fetchDataFromDisk() {
return data
}
if let data = try? fetchDataFromServer() {
return data
}
return nil
}
func fetchDataFromDisk() throws -> Data {
return Data()
}
func fetchDataFromServer() throws -> Data {
return Data()
}
//: 取消错误传递
// 比如说你已经知道一个抛出错误或者方法不会在运行时抛出错误。使用try!吧
let photo = try! loadImage("./Resources/JohnAppleseed.jpg")
func loadImage(url: String) throws -> UIImage? {
return UIImage()
}
| [
-1
] |
fd4f7369b1356c2f5a1905237f2e97a29716f727 | 447fd8c68c6a54823a084ed96afd47cec25d9279 | /icons/access-point-minus/src/access-point-minus.swift | d3aff2a93f451743a484fced23f503d5e2908fb6 | [] | no_license | friends-of-cocoa/material-design-icons | cf853a45d5936b16d0fddc88e970331379721431 | d66613cf64e521e32a4cbb64dadd9cb20ea6199e | refs/heads/master | 2022-07-29T15:51:13.647551 | 2020-09-16T12:15:32 | 2020-09-16T12:15:32 | 295,662,032 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 410 | swift | // Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen
// swiftlint:disable superfluous_disable_command identifier_name line_length nesting type_body_length type_name
public enum MDIIcons {
public static let accessPointMinus24pt = MDIIcon(name: "access-point-minus_24pt").image
}
// swiftlint:enable superfluous_disable_command identifier_name line_length nesting type_body_length type_name
| [
-1
] |
bf6716781faa9f0edfafc6d2bc0485007495957e | c8e296180dc7441eb5c156b511f896847e784d2c | /SampleTableview/ViewController.swift | a99da6194461754524c31f0e4c6a64832eda8394 | [] | no_license | SanaboinaPrasad/TableViewRow-animation | a4ae1db44a5a6af376009d0e08c52050e66bb305 | fb35ba4ad6c3c915c011113a572b9745025a8653 | refs/heads/master | 2020-04-06T19:52:35.432150 | 2018-11-15T18:10:50 | 2018-11-15T18:10:50 | 157,752,738 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,536 | swift | //
// ViewController.swift
// SampleTableview
//
// Created by Sriram Prasad on 15/11/18.
// Copyright © 2018 FullStackNet. All rights reserved.
// row animation
import UIKit
class ViewController: UITableViewController {
var friends = ["Munivar","Arji","Zaheer","karthik"]
var munivar = ["Flipkart","KPGM","Wipro","Cognizent"]
var arju = ["Lenovo","FlipKart","PKGM","Mphasisis"]
var zaheer = ["Mphasis","xerox","COgnizant","IBM","Wipro"]
var karthik = ["IBM","Hyderabad"]
var totallist = [Array<String>]()
var showAnimationButton = UIBarButtonItem()
override func viewDidLoad() {
super.viewDidLoad()
totallist = [munivar,arju,zaheer,karthik]
showAnimationButton = UIBarButtonItem(title: "ShowAnimation", style:.plain , target: self, action: #selector(handleShowAnimation))
navigationItem.rightBarButtonItem = showAnimationButton
tableView.register(SimpleCell.self, forCellReuseIdentifier: "cell")
navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Animation", style: .plain, target: self, action: #selector(handleLeftAnimation))
}
override func numberOfSections(in tableView: UITableView) -> Int {
return friends.count
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return totallist[section].count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! SimpleCell
cell.textLabel?.text = totallist[indexPath.section][indexPath.row] as? String
return cell
}
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let label = UILabel()
label.text = friends[section]
label.font = UIFont.boldSystemFont(ofSize: 15)
label.backgroundColor = .red
label.textColor = .white
label.textAlignment = .center
return label
}
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 36
}
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return true
}
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete{
totallist[indexPath.section].remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: .fade)
}
}
@objc func handleShowAnimation(){
var indexpathReloadaata = [IndexPath]()
for sections in totallist.indices {
for row in totallist[sections].indices{
let indexpath = IndexPath(row: row, section: sections)
indexpathReloadaata.append(indexpath)
}
}
tableView.reloadRows(at: indexpathReloadaata, with: .right)
}
@objc func handleLeftAnimation(){
var leftIndepath = [IndexPath]()
for section in totallist.indices {
for row in totallist[section].indices{
print(section,row)
let indexpaths = IndexPath(row: row, section: section)
leftIndepath.append(indexpaths)
}
}
tableView.reloadRows(at: leftIndepath, with: .top)
}
}
| [
-1
] |
2f904d7675e60c6275a093510fdd534c8dab6fdc | 29be5a4f5bd768036550c2a40b9133fbf83624f5 | /scratchMMVC2/ArchitectureGenerator/ArchitectureLoader.swift | 950521bcdbf0fce5b4bc340f1f2611edf5d7ec6a | [] | no_license | vjosullivan/scratchMMVC2 | de1d6e1690d6080aa2fcdc773a6f2a6745d76c7b | e1c459e0c547b9fd8ddc7a88c05515143e8abb88 | refs/heads/master | 2021-08-12T00:56:30.960978 | 2017-11-14T07:54:09 | 2017-11-14T07:54:09 | 110,381,068 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 241 | swift | //
// ArchitectureLoader.swift
// scratchMMVC
//
// Created by Vincent O'Sullivan on 10/11/2017.
// Copyright © 2017 Vincent O'Sullivan. All rights reserved.
//
import Foundation
class ArchitectureLoader: ArchitectureLoading {
}
| [
-1
] |
b7cb78994cc07353993dd518c922926892fef36b | 12b3d615bb00754224de781adbb5e3ff017b5628 | /XSCycleViewTests/XSCycleViewTests.swift | 376d319c38ed1ed373cad3f3c90c58bf001cf026 | [
"MIT"
] | permissive | summerxx27/ZJCycleScrollView | b94d69beebc9592ab3b5664618ece6af8a4491bf | 4f28ec1a8f722e4bfb246e1c7f7d728d4b869b0c | refs/heads/master | 2022-04-29T18:40:35.772441 | 2022-03-22T14:37:10 | 2022-03-22T14:37:10 | 56,125,270 | 7 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 983 | swift | //
// XSCycleViewTests.swift
// XSCycleViewTests
//
// Created by zjwang on 16/4/13.
// Copyright © 2016年 夏天. All rights reserved.
//
import XCTest
@testable import XSCycleView
class XSCycleViewTests: 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,
245457,
313357,
182296,
145435,
241692,
98333,
278558,
16419,
102437,
229413,
354343,
292902,
204840,
227370,
278570,
223274,
354345,
344107,
233517,
124975,
253999,
346162,
229430,
319542,
180280,
124984,
358456,
213052,
288833,
352326,
311372,
354385,
196691,
315476,
280661,
329814,
278615,
338007,
307289,
200794,
354393,
309345,
307299,
227428,
280675,
280677,
313447,
131178,
278634,
194666,
315498,
278638,
288879,
319598,
352368,
299121,
284788,
233589,
280694,
333940,
237689,
215164,
313469,
215166,
278655,
292992,
333955,
227460,
280712,
215178,
278670,
235662,
311438,
241808,
323729,
325776,
317587,
278677,
284826,
278685,
346271,
311458,
278691,
49316,
233636,
299174,
333991,
333992,
284841,
284842,
278699,
32941,
278704,
239793,
278708,
125109,
131256,
227513,
278714,
280762,
223419,
295098,
299198,
182456,
184505,
379071,
299203,
227524,
301251,
309444,
338119,
282831,
321745,
254170,
280795,
227548,
301279,
356576,
338150,
176362,
286958,
125169,
338164,
327929,
184570,
243962,
125183,
309503,
125188,
313608,
125193,
375051,
278797,
180493,
125198,
325905,
254226,
125203,
125208,
325912,
299293,
278816,
125217,
233762,
211235,
217380,
305440,
282919,
151847,
125235,
332085,
280887,
125240,
332089,
278842,
282939,
315706,
287041,
241986,
260418,
332101,
227654,
182598,
323916,
319821,
254286,
348492,
250192,
6481,
323920,
344401,
348500,
278869,
289110,
366929,
155990,
366930,
6489,
272729,
379225,
323935,
106847,
391520,
321894,
416104,
280939,
242029,
246127,
285040,
354676,
291192,
139640,
246136,
246137,
362881,
248194,
225670,
395659,
227725,
227726,
395661,
240016,
291224,
285084,
317852,
283038,
61857,
285090,
381347,
61859,
289189,
375207,
340398,
377264,
61873,
283064,
61880,
278970,
319930,
336317,
293310,
278978,
283075,
127427,
127428,
188871,
324039,
278989,
317901,
281040,
278993,
326100,
278999,
328152,
176601,
242139,
369116,
285150,
287198,
279008,
342498,
242148,
279013,
195045,
279018,
311786,
281072,
279029,
279032,
233978,
279039,
342536,
287241,
279050,
340490,
279057,
283153,
279062,
289304,
279065,
342553,
291358,
182817,
180771,
375333,
377386,
283182,
283184,
236081,
234036,
23092,
279094,
315960,
352829,
70209,
115270,
70215,
309830,
301638,
348742,
322120,
55881,
348749,
281166,
244310,
295519,
354911,
436832,
66150,
279144,
111208,
279146,
344680,
191082,
313966,
281199,
287346,
301689,
279164,
189057,
311941,
348806,
279177,
369289,
152203,
330379,
344715,
184973,
311949,
330387,
330388,
352917,
227990,
295576,
230040,
289434,
271000,
342682,
279206,
295590,
287404,
205487,
279217,
285361,
342706,
303793,
299699,
299700,
164533,
338613,
287417,
314040,
158394,
342713,
285373,
66242,
225995,
363211,
333521,
279252,
318173,
289502,
363230,
295652,
279269,
338662,
285415,
346858,
289518,
299759,
279280,
199414,
230134,
154359,
234234,
279294,
35583,
205568,
162561,
299776,
363263,
285444,
322313,
322319,
285458,
166676,
207640,
285466,
283419,
326429,
336671,
326433,
344865,
234277,
279336,
318250,
295724,
152365,
312108,
318252,
164656,
353069,
328499,
242485,
234294,
353078,
230199,
353079,
336702,
420677,
353094,
353095,
299849,
283467,
293711,
281427,
353109,
281433,
230234,
234331,
279392,
349026,
293730,
303972,
351077,
275303,
342887,
308076,
242541,
246641,
330609,
228215,
246648,
279417,
209785,
269178,
177019,
361337,
254850,
359298,
416646,
113542,
240518,
287622,
228234,
228233,
308107,
56208,
295824,
234386,
308112,
209817,
324506,
277403,
324507,
318364,
189348,
324517,
283558,
289703,
279464,
353195,
140204,
353197,
189374,
289727,
353216,
349121,
363458,
19399,
213960,
279498,
316364,
338899,
340955,
248797,
207838,
50143,
130016,
340961,
64485,
314342,
234472,
123881,
324586,
304110,
183279,
289774,
320494,
340974,
314355,
277492,
316405,
240630,
295927,
201720,
304122,
314362,
320507,
328700,
328706,
234500,
277509,
134150,
320516,
230410,
320527,
146448,
324625,
234514,
277524,
316437,
418837,
197657,
281626,
201755,
336929,
189474,
300068,
357414,
248872,
345132,
238639,
252980,
300084,
322612,
359478,
324666,
302139,
238651,
21569,
359495,
238664,
300111,
314448,
234577,
341073,
353367,
234587,
156764,
156765,
314467,
281700,
250981,
285798,
300135,
322663,
300136,
228458,
207979,
279660,
316520,
316526,
15471,
357486,
300146,
187506,
353397,
279672,
160891,
285820,
341115,
363644,
187521,
150657,
248961,
285828,
279685,
285830,
302213,
222343,
349316,
349318,
228491,
228493,
234638,
285838,
169104,
162961,
177296,
308372,
185493,
296086,
326804,
119962,
300187,
296092,
300188,
339102,
302240,
330913,
343203,
234663,
300201,
249002,
281771,
300202,
253099,
238765,
279728,
367799,
339130,
228540,
64700,
283840,
343234,
279747,
367810,
259268,
283847,
353479,
62665,
353481,
353482,
244940,
283852,
283853,
279760,
290000,
228563,
296153,
357595,
279774,
298212,
304356,
330984,
228588,
234733,
253167,
279792,
353523,
298228,
228600,
216315,
208124,
316669,
363771,
388349,
228609,
234755,
279814,
322824,
242954,
292107,
312587,
328971,
251153,
245019,
320796,
126237,
339234,
130338,
304421,
130343,
279854,
351537,
345396,
300343,
116026,
222524,
286018,
279875,
113987,
193859,
304456,
230729,
224586,
372043,
177484,
251213,
234831,
238927,
296273,
120148,
318805,
283991,
134491,
222559,
314720,
292195,
230756,
281957,
294243,
163175,
333160,
230765,
284014,
296303,
243056,
279920,
312689,
314739,
116084,
327025,
327031,
111993,
306559,
378244,
298374,
314758,
314760,
142729,
388487,
368011,
314766,
296335,
318864,
112017,
112018,
234898,
306579,
282007,
357786,
290207,
314783,
333220,
314789,
282022,
279974,
282024,
241066,
316842,
279984,
286129,
173491,
279989,
210358,
284089,
228795,
292283,
302529,
415171,
302531,
163268,
380357,
300487,
296392,
361927,
280010,
284107,
302540,
280013,
312782,
64975,
306639,
300489,
370123,
222675,
148940,
310732,
327121,
366037,
210390,
210391,
212442,
353750,
210393,
228827,
286172,
280032,
144867,
310757,
187878,
280041,
361963,
54765,
191981,
321009,
251378,
343542,
280055,
300536,
288249,
286202,
343543,
228861,
300542,
286205,
290301,
210433,
282114,
228867,
366083,
323080,
230921,
253452,
323087,
304656,
329232,
316946,
308756,
146964,
398869,
282136,
308764,
349726,
282146,
306723,
245287,
313339,
245292,
349741,
286254,
169518,
230959,
288309,
290358,
235070,
288318,
280130,
349763,
124485,
56902,
282183,
288326,
288327,
292425,
243274,
128587,
333388,
286288,
333393,
290390,
235095,
300630,
196187,
239198,
343647,
286306,
374372,
282213,
317032,
310889,
323178,
54893,
138863,
222832,
314998,
247416,
366203,
175741,
337535,
294529,
224901,
282246,
282245,
288392,
229001,
290443,
310923,
188048,
323217,
239250,
282259,
345752,
229020,
282271,
282273,
302754,
255649,
245412,
40613,
40614,
290471,
298661,
40615,
300714,
229029,
282280,
323236,
321207,
296632,
319162,
280251,
282303,
286399,
280257,
218819,
321219,
282312,
306890,
280267,
212685,
333517,
9936,
9937,
212688,
302802,
333520,
241361,
280278,
282327,
280280,
286423,
298712,
333523,
18138,
278234,
294622,
321247,
229088,
298720,
278240,
282339,
153319,
12010,
282348,
280300,
212716,
212717,
284401,
282358,
313081,
286459,
325371,
124669,
194303,
278272,
175873,
319233,
323331,
288516,
323332,
216839,
280327,
280329,
284429,
284431,
278291,
278293,
294678,
321302,
366360,
116505,
284442,
249626,
325404,
321310,
282400,
241441,
325410,
339745,
341796,
247590,
257830,
284459,
280366,
317232,
282417,
280372,
321337,
282427,
280380,
360252,
325439,
282434,
307011,
315202,
280390,
282438,
280392,
345929,
341836,
325457,
18262,
280410,
284507,
370522,
188251,
300894,
245599,
284512,
345951,
302946,
362337,
284514,
345955,
296806,
292712,
282474,
288619,
288620,
325484,
280430,
282480,
292720,
362352,
313203,
325492,
241528,
194429,
124798,
325503,
182144,
305026,
253829,
333701,
67463,
282504,
315273,
315274,
243591,
243597,
325518,
110480,
282518,
282519,
124824,
294809,
214937,
329622,
118685,
294814,
298909,
319392,
292771,
354212,
294823,
333735,
284587,
124852,
282549,
243637,
288697,
294843,
214977,
163781,
280519,
284619,
247757,
344013,
231375,
301008,
153554,
212946,
280541,
219101,
292836,
298980,
294886,
337895,
247785,
253929,
327661,
278512,
362480,
311282,
325619,
282612,
333817,
292858,
290811
] |
945bdfac80d31b3fc24c5cc279b61fe1b1cc3193 | 51d4387215a4f58d8c5314c1a9af241ae0ebc01c | /Tests/Sequence_Tests.swift | e79cd9a0ae54e2097d89238e63c92e2855fa00e6 | [] | no_license | stanislaw/CompositeOperations.Swift | d3f64befc8a633c3893e43095d5db9c96dff2d28 | abc227072fdd65e4db3855cffc55cf1d0c774a81 | refs/heads/master | 2021-01-10T03:00:55.527411 | 2016-01-17T17:22:25 | 2016-01-17T17:22:25 | 49,813,827 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,577 | swift | //
// Sequence_Tests.swift
// CompositeOperations
//
// Created by Stanislaw Pankevich on 17/01/16.
// Copyright © 2016 Stanislaw Pankevich. All rights reserved.
//
import XCTest
@testable import CompositeOperations
class LinearSequence_Tests: XCTestCase {
func test_should_finish() {
let sequentialOperation = SequentialOperation(sequence: TestLinearSequence_ThreeOperationsFinishingWithNull())
waitForCompletion({ (done) -> Void in
sequentialOperation.completion = { (result) in
done()
}
sequentialOperation.start()
})
XCTAssertTrue(sequentialOperation.finished)
}
func test_completion_should_have_array_with_NSNull() {
let sequentialOperation = SequentialOperation(sequence: TestLinearSequence_ThreeOperationsFinishingWithNull())
var expectedResult: CompositeOperationResult? = nil
waitForCompletion({ (done) -> Void in
sequentialOperation.completion = { (result) in
expectedResult = result
done()
}
sequentialOperation.start()
})
switch expectedResult! {
case .Results(let results):
XCTAssertEqual(results.count, 3)
for result in results {
switch result {
case .Result(let result):
XCTAssert(result as! NSNull == NSNull())
default:
XCTFail()
}
}
default:
XCTFail()
}
}
}
| [
-1
] |
4b7d64338123053d23242e65d57d957bd644d7fd | 525f62f385644e0aeba885b22c495365f1973ea3 | /Marvel/Controller/HomeViewController.swift | 3b53dd490bd4c1afb35b1e077b0f08c99f5c41a7 | [] | no_license | brunosilva808/Marvel_App | 95f3000ecf96c4277f5f7509da404b8a5c1bb2ec | 066aae4f5047568138dd20c081bd65b384182da8 | refs/heads/master | 2020-04-09T05:33:43.508037 | 2018-12-02T17:02:50 | 2018-12-02T17:02:50 | 160,069,578 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,021 | swift | //
// HomeViewController.swift
// Marvel
//
// Created by Bruno Silva on 16/11/2018.
//
import UIKit
private let reuseIdentifier = "Cell"
class HomeViewController: UIViewController {
@IBOutlet weak var tableView: UITableView! {
didSet {
tableView.delegate = self
tableView.dataSource = self
tableView.estimatedRowHeight = 44
tableView.rowHeight = UITableView.automaticDimension
tableView.registerNib(for: CharacterCell.self)
}
}
var character: Character? {
didSet {
DispatchQueue.main.async { [weak self] in
self?.tableView.reloadData()
}
}
}
override func viewDidLoad() {
super.viewDidLoad()
setupTableView()
NetworkManager().getCharacters(page: 0, onSuccess: { [weak self] (response) in
self?.character = response
}) {
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let destinationViewController = segue.destination as? FullScreenViewController,
let indexPath = sender as? IndexPath {
// destinationViewController.result = comics?.data.results[indexPath.row]
}
}
func setupTableView() {
}
}
extension HomeViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return character?.data.results.count ?? 0
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: CharacterCell.reuseIdentifier, for: indexPath) as! CharacterCell
cell.model = character?.data.results[indexPath.row]
return cell
// return tableView.reusableCell(for: indexPath.row, with: character?.data.results[indexPath.row]) as CharacterCell
}
}
| [
-1
] |
48f5cff388cadc7dda97e8e166b5295a9ea66ee3 | c97b912d327c46a69fcd566eb9d96f3f20a0fa22 | /LearnEnglish/LearnEnglish/Helpers/RouterProtocol.swift | 2dde971f4e56a83e850d7ebeae30a9f9fc03f3c1 | [] | no_license | zardak12/FinalProject | a786b739088515ec2cc143fd25ee9954bfa1d573 | cbb4bac1273d29d66acc21af27618d01d89b1e94 | refs/heads/main | 2023-06-30T14:44:17.658688 | 2021-07-30T21:55:28 | 2021-07-30T21:55:28 | 385,405,125 | 6 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 305 | swift | //
// RouterProtocol.swift
// LearnEnglish
//
// Created by Марк Шнейдерман on 13.07.2021.
//
import UIKit
// MARK: - RouterProtocol
protocol RouterProtocol {
var navigationContoller: UINavigationController { get set }
var assemblyBuilder: AssemblyBuilderProtocol { get set }
}
| [
-1
] |
52b811003f888d7a470288d0e461d41e4b35b1bc | 6a64c7d4be2377adabd846b5f46702e069aa8627 | /SwiftOptional.playground/Contents.swift | d4860265d430b26b6cd05a3d072d1cb8d70cd6ba | [] | no_license | iamsamitdev/iosbasic_playground | ee20fb9c16406dd74db361182d9652a915c0aa4a | 1b9532bb780ece412bd3a88afcfe864e5d192979 | refs/heads/master | 2020-07-15T20:48:59.948591 | 2019-09-03T02:28:30 | 2019-09-03T02:28:30 | 205,645,898 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 846 | swift | import UIKit
// Optional คือการบอกว่าตัวแปรนั้น ๆ "สามารถมีค่าหรือไม่มีค่าก็ได้"
// จะใช้เครื่องหมาย ? ต่อท้ายชนิดข้อมูล (Variable Type)
// Example
var box: String?
box = "Samit Koyom"
print(box ?? "")
box = nil
print(box ?? "")
// การเขียน Optional เขียนได้ 2 แบบด้วยกันคือ
// 1. Short form
let valueString = "42"
let shortForm:Int? = Int(valueString)
// 2. Long form
let longForm:Optional<Int> = Int(valueString)
print(shortForm ?? "")
print(longForm ?? "")
// การแสดงผล Optional Forced Unwrapping
// ใช้เครื่องหมาย !
var data:String? = "Some text"
print(data!)
| [
-1
] |
88b1a005d018c87c367585d4466713b450c4a333 | 67606e6bc17c5c659ce6032b2e94e3983412c8b8 | /PeekAndPopSimulator/AppDelegate.swift | 5d8b59284a2f331f55239f6afd875d11d50e636f | [] | no_license | sleepEarlier/PeekAndPopSimulator | 53802b626cba8b3412cfea8991dee707b4857862 | d0341c6e4b78a8711d3d352a4ee20e080f2d1dbb | refs/heads/master | 2020-12-28T20:09:12.332858 | 2015-10-16T16:08:59 | 2015-10-16T16:08:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,370 | swift | //
// AppDelegate.swift
// PeekAndPopSimulator
//
// Created by Bing on 15/10/16.
// Copyright © 2015年 tanyunbing. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {
// MARK: Properties
var window: UIWindow?
// MARK: App Delegate
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let splitViewController = self.window!.rootViewController as! UISplitViewController
splitViewController.delegate = self
return true
}
// MARK: Split View Delegate
func splitViewController(splitViewController: UISplitViewController, collapseSecondaryViewController secondaryViewController: UIViewController, ontoPrimaryViewController primaryViewController: UIViewController) -> Bool {
guard let secondaryAsNavController = secondaryViewController as? UINavigationController else { return false }
guard let topAsDetailController = secondaryAsNavController.topViewController as? DetailViewController else { return false }
// Return true if the `detailItemTitle` has not been set, collapsing the secondary controller.
return topAsDetailController.detailItemTitle == nil
}
}
| [
-1
] |
bf69b69ca2288d1e844d265e18a3d16fdebf7a10 | e8507521ab59f88dac7d7ffa21f37f2b59f1e3dd | /Example/Classes/Controller/PickerResultViewController.swift | fe0cdfe63def16a69c1ad533acc8fd88b08e79f9 | [
"MIT"
] | permissive | Pure-iOS/HXPHPicker | f33f5a832e5b1ce1a4783a7d3b012c6f173a39f0 | 4cd51b68ebbcd8e1cae754dec38d8a9ef4a8a18e | refs/heads/main | 2023-04-29T00:06:13.457481 | 2021-04-30T09:49:10 | 2021-04-30T09:49:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 22,039 | swift | //
// PickerResultViewController.swift
// HXPHPickerExample
//
// Created by Silence on 2020/12/18.
// Copyright © 2020 Silence. All rights reserved.
//
import UIKit
import Photos
import HXPHPicker
class PickerResultViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate,UICollectionViewDragDelegate, UICollectionViewDropDelegate, ResultViewCellDelegate {
@IBOutlet weak var collectionViewTopConstraint: NSLayoutConstraint!
@IBOutlet weak var collectionViewHeightConstraint: NSLayoutConstraint!
@IBOutlet weak var collectionView: UICollectionView!
@IBOutlet weak var pickerStyleControl: UISegmentedControl!
@IBOutlet weak var previewStyleControl: UISegmentedControl!
var addCell: ResultAddViewCell {
get {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ResultAddViewCellID", for: IndexPath(item: selectedAssets.count, section: 0)) as! ResultAddViewCell
return cell
}
}
var canSetAddCell: Bool {
get {
if selectedAssets.count == config.maximumSelectedCount && config.maximumSelectedCount > 0 {
return false
}
return true
}
}
var beforeRowCount: Int = 0
/// 当前已选资源
var selectedAssets: [PhotoAsset] = []
/// 是否选中的原图
var isOriginal: Bool = false
/// 相机拍摄的本地资源
var localCameraAssetArray: [PhotoAsset] = []
/// 相关配置
var config: PickerConfiguration = PhotoTools.getWXPickerConfig(isMoment: true)
weak var previewTitleLabel: UILabel?
weak var currentPickerController: PhotoPickerController?
init() {
super.init(nibName:"PickerResultViewController",bundle: nil)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override func viewDidLoad() {
super.viewDidLoad()
collectionViewTopConstraint.constant = 20
collectionView.register(ResultViewCell.self, forCellWithReuseIdentifier: "ResultViewCellID")
collectionView.register(ResultAddViewCell.self, forCellWithReuseIdentifier: "ResultAddViewCellID")
if #available(iOS 11.0, *) {
collectionView.dragDelegate = self
collectionView.dropDelegate = self
collectionView.dragInteractionEnabled = true
}else {
let longGestureRecognizer = UILongPressGestureRecognizer.init(target: self, action: #selector(longGestureRecognizerClick(longGestureRecognizer:)))
collectionView.addGestureRecognizer(longGestureRecognizer)
}
view.backgroundColor = UIColor.white
navigationItem.rightBarButtonItem = UIBarButtonItem.init(title: "设置", style: .done, target: self, action: #selector(didSettingButtonClick))
}
@objc func longGestureRecognizerClick(longGestureRecognizer: UILongPressGestureRecognizer) {
let touchPoint = longGestureRecognizer.location(in: collectionView)
let touchIndexPath = collectionView.indexPathForItem(at: touchPoint)
switch longGestureRecognizer.state {
case .began:
if let selectedIndexPath = touchIndexPath {
if canSetAddCell && selectedIndexPath.item == selectedAssets.count {
return
}
collectionView.beginInteractiveMovementForItem(at: selectedIndexPath)
}
break
case .changed:
if let selectedIndexPath = touchIndexPath {
if canSetAddCell && selectedIndexPath.item == selectedAssets.count {
return
}
}
collectionView.updateInteractiveMovementTargetPosition(touchPoint)
break
case .ended:
collectionView.endInteractiveMovement()
break
default:
collectionView.cancelInteractiveMovement()
break
}
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
let flowLayout: UICollectionViewFlowLayout = collectionView.collectionViewLayout as! UICollectionViewFlowLayout
let itemWidth = Int((view.width - 24 - 2) / 3)
flowLayout.itemSize = CGSize(width: itemWidth, height: itemWidth)
flowLayout.minimumInteritemSpacing = 1
flowLayout.minimumLineSpacing = 1
flowLayout.sectionInset = UIEdgeInsets(top: 0, left: 12, bottom: 0, right: 12)
configCollectionViewHeight()
}
func getCollectionViewrowCount() -> Int {
let assetCount = canSetAddCell ? selectedAssets.count + 1 : selectedAssets.count
var rowCount = Int(assetCount / 3) + 1
if assetCount % 3 == 0 {
rowCount -= 1
}
return rowCount
}
func configCollectionViewHeight() {
let rowCount = getCollectionViewrowCount()
beforeRowCount = rowCount
let itemWidth = Int((view.width - 24 - 2) / 3)
var heightConstraint = CGFloat(rowCount * itemWidth + rowCount)
if heightConstraint > view.height - UIDevice.navigationBarHeight - 20 - 150 {
heightConstraint = view.height - UIDevice.navigationBarHeight - 20 - 150
}
collectionViewHeightConstraint.constant = heightConstraint
}
func updateCollectionViewHeight() {
let rowCount = getCollectionViewrowCount()
if beforeRowCount == rowCount {
return
}
UIView.animate(withDuration: 0.25) {
self.configCollectionViewHeight()
self.view.layoutIfNeeded()
}
}
@objc func didSettingButtonClick() {
let pickerConfigVC: PickerConfigurationViewController
if #available(iOS 13.0, *) {
pickerConfigVC = PickerConfigurationViewController(style: .insetGrouped)
} else {
pickerConfigVC = PickerConfigurationViewController(style: .grouped)
}
pickerConfigVC.showOpenPickerButton = false
pickerConfigVC.config = config
present(UINavigationController.init(rootViewController: pickerConfigVC), animated: true, completion: nil)
}
/// 跳转选择资源界面
@IBAction func selectButtonClick(_ sender: UIButton) {
presentPickerController()
}
func presentPickerController() {
let pickerController = PhotoPickerController.init(picker: config)
pickerController.pickerDelegate = self
pickerController.selectedAssetArray = selectedAssets
pickerController.localCameraAssetArray = localCameraAssetArray
pickerController.isOriginal = isOriginal
if pickerStyleControl.selectedSegmentIndex == 0 {
pickerController.modalPresentationStyle = .fullScreen
}
pickerController.autoDismiss = false
present(pickerController, animated: true, completion: nil)
}
/// 获取已选资源的地址
@IBAction func didRequestSelectedAssetURL(_ sender: Any) {
let total = selectedAssets.count
if total == 0 {
ProgressHUD.showWarning(addedTo: self.view, text: "请先选择资源", animated: true, delay: 1.5)
return
}
var count = 0
for photoAsset in selectedAssets {
if photoAsset.mediaType == .photo {
if photoAsset.mediaSubType == .livePhoto {
var imageURL: URL?
var videoURL: URL?
AssetManager.requestLivePhoto(contentURL: photoAsset.phAsset!) { (url) in
imageURL = url
} videoHandler: { (url) in
videoURL = url
} completionHandler: { [weak self] (error) in
count += 1
if error == nil {
let image = UIImage.init(contentsOfFile: imageURL!.path)
print("LivePhoto中的图片:\(String(describing: image!))")
print("LivePhoto中的视频地址:\(videoURL!)")
}else {
print("LivePhoto中的内容获取失败\(error!)")
}
if count == total {
ProgressHUD.hide(forView: self?.view, animated: false)
ProgressHUD.showSuccess(addedTo: self?.view, text: "获取完成", animated: true, delay: 1.5)
}
}
}else {
count += 1
photoAsset.requestImageURL { [weak self] (imageURL) in
if imageURL != nil {
print("图片地址:\(imageURL!)")
}else {
print("图片地址获取失败")
}
if count == total {
ProgressHUD.hide(forView: self?.view, animated: false)
ProgressHUD.showSuccess(addedTo: self?.view, text: "获取完成", animated: true, delay: 1.5)
}
}
// print("图片:\(photoAsset.originalImage!)")
// if count == total {
// ProgressHUD.hide(forView: weakSelf?.navigationController?.view, animated: true)
// }
}
}else {
photoAsset.requestVideoURL { [weak self] (videoURL) in
count += 1
if videoURL == nil {
print("视频地址获取失败")
}else {
print("视频地址:\(videoURL!)")
}
if count == total {
ProgressHUD.hide(forView: self?.view, animated: false)
ProgressHUD.showSuccess(addedTo: self?.view, text: "获取完成", animated: true, delay: 1.5)
}
}
}
}
}
// MARK: UICollectionViewDataSource
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return canSetAddCell ? selectedAssets.count + 1 : selectedAssets.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
if canSetAddCell && indexPath.item == selectedAssets.count {
return addCell
}
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ResultViewCellID", for: indexPath) as! ResultViewCell
cell.resultDelegate = self
cell.photoAsset = selectedAssets[indexPath.item]
return cell
}
// MARK: ResultViewCellDelegate
func cell(didDeleteButton cell: ResultViewCell) {
if let indexPath = collectionView.indexPath(for: cell) {
let isFull = selectedAssets.count == config.maximumSelectedCount
selectedAssets.remove(at: indexPath.item)
if isFull {
collectionView.reloadData()
}else {
collectionView.deleteItems(at: [indexPath])
}
updateCollectionViewHeight()
}
}
// MARK: UICollectionViewDelegate
/// 跳转单独预览界面
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
if canSetAddCell && indexPath.item == selectedAssets.count {
presentPickerController()
return
}
if selectedAssets.isEmpty {
return
}
// let config = VideoEditorConfiguration.init()
// config.languageType = .english
// let vc = EditorController.init(photoAsset: selectedAssets.first!, config: config)
//// vc.videoEditorDelegate = self
// present(vc, animated: true, completion: nil)
// return
// modalPresentationStyle = .custom 会使用框架自带的动画效果
// 预览时可以重新初始化一个config设置单独的颜色或其他配置
let previewConfig = PhotoTools.getWXPickerConfig()
// previewConfig.prefersStatusBarHidden = true
// previewConfig.previewView.bottomView.showSelectedView = false
var style: UIModalPresentationStyle = .custom
if previewStyleControl.selectedSegmentIndex == 1 {
if #available(iOS 13.0, *) {
style = .automatic
}
}
let pickerController = PhotoPickerController.init(preview: previewConfig, currentIndex: indexPath.item, modalPresentationStyle: style)
pickerController.selectedAssetArray = selectedAssets
pickerController.pickerDelegate = self
// 透明导航栏建议修改取消图片,换张带阴影的图片
// config.previewView.cancelImageName = ""
// pickerController.navigationBar.setBackgroundImage(UIImage.image(for: UIColor.clear, havingSize: .zero), for: .default)
// pickerController.navigationBar.shadowImage = UIImage.image(for: UIColor.clear, havingSize: .zero)
let titleLabel = UILabel.init()
titleLabel.size = CGSize(width: 100, height: 30)
titleLabel.textColor = .white
titleLabel.font = UIFont.semiboldPingFang(ofSize: 17)
titleLabel.textAlignment = .center
titleLabel.text = String(indexPath.item + 1) + "/" + String(selectedAssets.count)
pickerController.previewViewController()?.navigationItem.titleView = titleLabel
previewTitleLabel = titleLabel
pickerController.previewViewController()?.navigationItem.rightBarButtonItem = UIBarButtonItem.init(title: "删除", style: .done, target: self, action: #selector(deletePreviewAsset))
present(pickerController, animated: true, completion: nil)
self.currentPickerController = pickerController
}
@objc func deletePreviewAsset() {
PhotoTools.showAlert(viewController: self.currentPickerController, title: "是否删除当前资源", message: nil, leftActionTitle: "确定", leftHandler: { (alertAction) in
self.currentPickerController?.deleteCurrentPreviewPhotoAsset()
}, rightActionTitle: "取消") { (alertAction) in
}
}
func collectionView(_ collectionView: UICollectionView, canEditItemAt indexPath: IndexPath) -> Bool {
if canSetAddCell && indexPath.item == selectedAssets.count {
return false
}
return true
}
func collectionView(_ collectionView: UICollectionView, moveItemAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
let sourceAsset = selectedAssets[sourceIndexPath.item]
selectedAssets.remove(at: sourceIndexPath.item)
selectedAssets.insert(sourceAsset, at: destinationIndexPath.item)
}
@available(iOS 11.0, *)
func collectionView(_ collectionView: UICollectionView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] {
let itemProvider = NSItemProvider.init()
let dragItem = UIDragItem.init(itemProvider: itemProvider)
dragItem.localObject = indexPath
return [dragItem]
}
@available(iOS 11.0, *)
func collectionView(_ collectionView: UICollectionView, canHandle session: UIDropSession) -> Bool {
if let sourceIndexPath = session.items.first?.localObject as? IndexPath {
if canSetAddCell && sourceIndexPath.item == selectedAssets.count {
return false
}
}
return true
}
@available(iOS 11.0, *)
func collectionView(_ collectionView: UICollectionView, dropSessionDidUpdate session: UIDropSession, withDestinationIndexPath destinationIndexPath: IndexPath?) -> UICollectionViewDropProposal {
if let sourceIndexPath = session.items.first?.localObject as? IndexPath {
if canSetAddCell && sourceIndexPath.item == selectedAssets.count {
return UICollectionViewDropProposal.init(operation: .forbidden, intent: .insertAtDestinationIndexPath)
}
}
if destinationIndexPath != nil && canSetAddCell && destinationIndexPath!.item == selectedAssets.count {
return UICollectionViewDropProposal.init(operation: .forbidden, intent: .insertAtDestinationIndexPath)
}
var dropProposal: UICollectionViewDropProposal
if session.localDragSession != nil {
dropProposal = UICollectionViewDropProposal.init(operation: .move, intent: .insertAtDestinationIndexPath)
}else {
dropProposal = UICollectionViewDropProposal.init(operation: .copy, intent: .insertAtDestinationIndexPath)
}
return dropProposal
}
@available(iOS 11.0, *)
func collectionView(_ collectionView: UICollectionView, performDropWith coordinator: UICollectionViewDropCoordinator) {
if let destinationIndexPath = coordinator.destinationIndexPath, let sourceIndexPath = coordinator.items.first?.sourceIndexPath {
collectionView.isUserInteractionEnabled = false
collectionView.performBatchUpdates {
let sourceAsset = selectedAssets[sourceIndexPath.item]
selectedAssets.remove(at: sourceIndexPath.item)
selectedAssets.insert(sourceAsset, at: destinationIndexPath.item)
collectionView.moveItem(at: sourceIndexPath, to: destinationIndexPath)
} completion: { (isFinish) in
collectionView.isUserInteractionEnabled = true
}
if let dragItem = coordinator.items.first?.dragItem {
coordinator.drop(dragItem, toItemAt: destinationIndexPath)
}
}
}
override var preferredStatusBarStyle: UIStatusBarStyle {
return .default
}
}
// MARK: PhotoPickerControllerDelegate
extension PickerResultViewController: PhotoPickerControllerDelegate {
func pickerController(_ pickerController: PhotoPickerController, didFinishSelection result: PickerResult) {
selectedAssets = result.photoAssets
isOriginal = result.isOriginal
collectionView.reloadData()
updateCollectionViewHeight()
// result.getURLs { (urls) in
// print(urls)
// }
pickerController.dismiss(animated: true, completion: nil)
}
func pickerController(_ pickerController: PhotoPickerController, didEditAsset photoAsset: PhotoAsset, atIndex: Int) {
if pickerController.isPreviewAsset {
selectedAssets[atIndex] = photoAsset
collectionView.reloadItems(at: [IndexPath.init(item: atIndex, section: 0)])
}
}
func pickerController(didCancel pickerController: PhotoPickerController) {
pickerController.dismiss(animated: true, completion: nil)
}
func pickerController(_ pickerController: PhotoPickerController, didDismissComplete localCameraAssetArray: [PhotoAsset]) {
setNeedsStatusBarAppearanceUpdate()
self.localCameraAssetArray = localCameraAssetArray
}
func pickerController(_ pikcerController: PhotoPickerController, previewUpdateCurrentlyDisplayedAsset photoAsset: PhotoAsset, atIndex: Int) {
previewTitleLabel?.text = String(atIndex + 1) + "/" + String(selectedAssets.count)
}
func pickerController(_ pickerController: PhotoPickerController, previewDidDeleteAsset photoAsset: PhotoAsset, atIndex: Int) {
let isFull = selectedAssets.count == config.maximumSelectedCount
selectedAssets.remove(at: atIndex)
if isFull {
collectionView.reloadData()
}else {
collectionView.deleteItems(at: [IndexPath.init(item: atIndex, section: 0)])
}
updateCollectionViewHeight()
}
func pickerController(_ pickerController: PhotoPickerController, presentPreviewViewForIndexAt index: Int) -> UIView? {
let cell = collectionView.cellForItem(at: IndexPath(item: index, section: 0))
return cell
}
func pickerController(_ pickerController: PhotoPickerController, presentPreviewImageForIndexAt index: Int) -> UIImage? {
let cell = collectionView.cellForItem(at: IndexPath(item: index, section: 0)) as? ResultViewCell
return cell?.imageView.image
}
func pickerController(_ pickerController: PhotoPickerController, dismissPreviewViewForIndexAt index: Int) -> UIView? {
let cell = collectionView.cellForItem(at: IndexPath(item: index, section: 0))
return cell
}
}
class ResultAddViewCell: PhotoPickerBaseViewCell {
override func initView() {
super.initView()
isHidden = false
imageView.image = UIImage.image(for: "hx_picker_add_img")
}
}
@objc protocol ResultViewCellDelegate: NSObjectProtocol {
@objc optional func cell(didDeleteButton cell: ResultViewCell)
}
class ResultViewCell: PhotoPickerViewCell {
weak var resultDelegate: ResultViewCellDelegate?
lazy var deleteButton: UIButton = {
let deleteButton = UIButton.init(type: .custom)
deleteButton.setImage(UIImage.init(named: "hx_compose_delete"), for: .normal)
deleteButton.size = deleteButton.currentImage?.size ?? .zero
deleteButton.addTarget(self, action: #selector(didDeleteButtonClick), for: .touchUpInside)
return deleteButton
}()
override func requestThumbnailImage() {
// 因为这里的cell不会很多,重新设置 targetWidth,使图片更加清晰
super.requestThumbnailImage(targetWidth: width * UIScreen.main.scale)
}
@objc func didDeleteButtonClick() {
resultDelegate?.cell?(didDeleteButton: self)
}
override func initView() {
super.initView()
// 默认是隐藏的,需要显示出来
isHidden = false
contentView.addSubview(deleteButton)
}
override func layoutView() {
super.layoutView()
deleteButton.x = width - deleteButton.width
}
}
| [
-1
] |
4b5ade107f7f84a5bd2ef38c2162bf285d86b857 | 35a7e973544e24c525ae8f8b3865cdc66bef329c | /tiptextfild1119UITests/tiptextfild1119UITests.swift | 776a3f74e6a83eee6ca9070f0d18726e47e6b47e | [] | no_license | p619/1122-2A | b0081348036cd4ec53d03178be506d9e09c0e58c | 84e4a9e87bf5627f6b0a5097c7a0502ac9171daa | refs/heads/master | 2020-06-28T19:34:49.676785 | 2016-11-22T14:41:06 | 2016-11-22T14:41:06 | 74,480,125 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,266 | swift | //
// tiptextfild1119UITests.swift
// tiptextfild1119UITests
//
// Created by heroshi on 2016/11/19.
// Copyright © 2016年 heroshi. All rights reserved.
//
import XCTest
class tiptextfild1119UITests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
| [
333827,
243720,
282634,
313356,
155665,
237599,
241695,
223269,
229414,
292901,
315431,
315433,
102441,
278571,
313388,
325675,
124974,
282671,
354346,
229425,
102446,
243763,
241717,
180279,
229431,
215095,
319543,
288829,
325695,
288835,
286787,
307269,
237638,
313415,
239689,
233548,
311373,
315468,
278607,
196687,
311377,
354386,
223317,
315477,
354394,
315488,
321632,
45154,
315489,
280676,
313446,
227432,
307306,
194667,
233578,
278637,
288878,
319599,
278642,
284789,
131190,
288890,
292987,
215165,
131199,
227459,
278669,
235661,
241809,
323730,
278676,
311447,
153752,
327834,
284827,
278684,
299166,
278690,
311459,
284840,
299176,
278698,
284843,
184489,
278703,
184498,
278707,
125108,
278713,
223418,
280761,
180409,
295099,
299197,
280767,
258233,
227517,
299202,
139459,
309443,
176325,
131270,
301255,
227525,
299208,
280779,
282832,
227536,
301270,
229591,
301271,
280792,
311520,
325857,
280803,
18661,
307431,
182503,
319719,
295147,
317676,
286957,
125166,
125170,
313595,
125180,
184574,
309504,
125184,
217352,
125192,
125197,
125200,
227601,
125204,
278805,
319764,
334104,
282908,
311582,
299294,
282912,
125215,
233761,
278817,
211239,
282920,
125225,
317738,
311596,
321839,
315698,
98611,
125236,
282938,
307514,
278843,
168251,
287040,
319812,
311622,
280903,
227655,
319816,
323914,
282959,
229716,
289109,
168280,
379224,
323934,
391521,
239973,
381286,
285031,
313703,
416103,
280938,
242027,
242028,
321901,
278895,
354671,
287089,
315768,
291193,
291194,
223611,
248188,
139641,
313726,
311679,
211327,
291200,
240003,
158087,
313736,
227721,
242059,
311692,
227730,
285074,
240020,
190870,
315798,
190872,
291225,
317851,
285083,
293275,
242079,
227743,
285089,
293281,
289185,
305572,
283039,
156069,
289195,
311723,
377265,
299449,
311739,
319931,
293309,
278974,
311744,
317889,
291266,
278979,
278988,
289229,
281038,
326093,
278992,
283089,
281039,
283088,
279000,
176602,
160224,
279009,
291297,
285152,
195044,
188899,
279014,
242150,
319976,
279017,
311787,
281071,
319986,
236020,
279030,
311800,
279033,
317949,
279042,
283138,
233987,
287237,
322057,
309770,
342537,
279053,
283154,
303634,
279060,
279061,
182802,
303635,
279066,
188954,
322077,
291359,
293420,
236080,
283185,
279092,
23093,
234037,
244279,
244280,
338491,
301635,
309831,
55880,
377419,
303693,
281165,
301647,
281170,
326229,
309847,
189016,
115287,
111197,
295518,
287327,
242274,
244326,
279143,
279150,
281200,
287345,
313970,
287348,
301688,
189054,
303743,
297600,
287359,
291455,
301702,
279176,
311944,
334473,
311948,
316044,
184974,
311950,
316048,
287379,
295575,
227991,
289435,
303772,
205469,
221853,
285348,
314020,
279207,
295591,
295598,
279215,
285360,
318127,
285362,
299698,
287412,
166581,
293552,
154295,
342705,
303802,
314043,
287418,
66243,
291529,
287434,
225996,
363212,
287438,
279249,
303826,
242385,
279253,
158424,
230105,
299737,
322269,
342757,
295653,
289511,
230120,
330473,
234216,
285419,
289517,
279278,
312046,
170735,
215790,
125683,
230133,
199415,
234233,
242428,
279293,
205566,
322302,
289534,
299777,
291584,
285443,
228099,
291591,
295688,
322312,
285450,
312076,
285457,
295698,
291605,
166677,
283418,
285467,
221980,
281378,
234276,
283431,
203560,
279337,
262952,
262953,
293673,
289580,
262957,
164655,
301872,
242481,
234290,
303921,
318251,
285493,
230198,
285496,
301883,
201534,
289599,
281407,
295745,
222017,
293702,
318279,
283466,
281426,
279379,
295769,
234330,
201562,
281434,
322396,
230238,
230239,
301919,
279393,
293729,
349025,
281444,
303973,
279398,
177002,
308075,
242540,
310132,
295797,
228214,
207735,
295799,
279418,
269179,
177018,
308093,
314240,
291713,
158594,
240517,
287623,
228232,
416649,
279434,
320394,
316299,
234382,
189327,
308111,
308113,
293780,
310166,
289691,
209820,
277404,
240543,
283551,
310177,
189349,
289704,
279465,
293801,
304050,
177074,
289720,
289723,
189373,
213956,
281541,
19398,
345030,
213961,
279499,
56270,
191445,
304086,
183254,
183258,
234469,
314343,
304104,
324587,
234476,
183276,
289773,
320492,
203758,
320495,
287730,
277493,
240631,
320504,
214009,
312313,
312317,
354342,
234499,
293894,
320520,
322571,
230411,
320526,
234513,
238611,
140311,
293911,
238617,
197658,
316441,
132140,
113710,
189487,
281647,
322609,
312372,
203829,
238646,
300087,
238650,
320571,
21567,
308288,
336962,
160834,
314437,
349254,
238663,
300109,
234578,
207954,
296023,
314458,
277600,
281698,
281699,
230500,
285795,
322664,
228457,
279659,
318571,
234606,
300145,
230514,
238706,
187508,
312435,
279666,
302202,
285819,
314493,
285823,
150656,
234626,
279686,
222344,
285833,
285834,
234635,
318602,
337037,
228492,
177297,
162962,
187539,
308375,
324761,
285850,
296091,
119965,
234655,
300192,
302239,
339106,
306339,
234662,
300200,
302251,
208044,
238764,
249003,
322733,
3243,
279729,
300215,
294075,
64699,
228541,
283841,
283846,
312519,
279752,
283849,
148687,
290001,
189651,
316628,
279766,
189656,
279775,
304352,
298209,
304353,
279780,
228587,
279789,
290030,
302319,
234741,
283894,
316661,
208123,
292092,
279803,
228608,
234756,
242955,
312588,
177420,
318732,
126229,
318746,
320795,
320802,
130342,
304422,
130344,
292145,
298290,
312628,
300342,
222523,
286012,
181568,
279872,
279874,
300355,
294210,
216387,
286019,
300354,
304457,
230730,
294220,
296269,
222542,
224591,
234830,
238928,
296274,
314708,
318804,
314711,
357720,
300378,
300379,
294236,
316764,
314721,
292194,
230757,
281958,
314727,
134504,
306541,
327023,
296304,
234864,
312688,
316786,
230772,
314740,
284015,
314742,
310650,
290170,
224637,
306558,
290176,
306561,
179586,
243073,
314752,
294278,
296328,
296330,
298378,
368012,
318860,
304523,
314765,
292242,
279955,
306580,
314771,
224662,
234902,
282008,
314776,
318876,
282013,
290206,
148899,
314788,
298406,
282023,
279979,
279980,
241067,
314797,
286128,
173492,
279988,
286133,
284086,
284090,
302523,
228796,
310714,
302530,
280003,
228804,
310725,
306630,
292291,
300488,
306634,
370122,
310731,
280011,
302539,
310735,
300490,
234957,
222674,
312785,
280020,
280025,
310747,
239069,
144862,
286176,
187877,
310758,
320997,
280042,
280043,
191980,
300526,
337391,
282097,
308722,
296434,
306678,
40439,
288248,
286201,
191991,
300539,
288252,
312830,
290304,
286208,
228868,
292359,
218632,
323079,
302602,
230922,
323083,
294413,
304655,
323088,
282132,
230933,
302613,
282135,
316951,
374297,
302620,
313338,
282147,
222754,
306730,
230960,
288305,
239159,
290359,
323132,
157246,
288319,
280131,
349764,
310853,
282182,
124486,
288328,
194118,
286281,
292426,
224848,
290391,
128600,
235096,
239192,
306777,
212574,
345697,
204386,
300643,
300645,
282214,
312937,
224874,
243306,
312941,
310896,
314997,
294517,
290425,
288377,
325246,
333438,
235136,
280193,
282244,
239238,
288391,
282248,
286344,
323208,
179853,
286351,
188049,
229011,
239251,
280217,
323226,
179868,
229021,
318247,
302751,
282272,
282279,
298664,
298666,
317102,
286387,
300725,
286392,
300729,
302778,
306875,
280252,
280253,
282302,
296636,
286400,
323265,
280259,
282309,
239305,
280266,
306891,
296649,
212684,
302798,
9935,
241360,
282321,
286419,
241366,
280279,
282330,
18139,
280285,
294621,
282336,
321250,
294629,
153318,
12009,
282347,
288492,
282349,
34547,
67316,
323315,
286457,
284410,
200444,
288508,
282366,
286463,
319232,
278273,
288515,
280326,
282375,
323335,
284425,
300810,
282379,
216844,
116491,
284430,
280333,
300812,
161553,
124691,
284436,
278292,
278294,
282390,
116502,
118549,
325403,
321308,
321309,
282399,
241440,
282401,
315172,
186148,
186149,
241447,
333609,
286507,
294699,
284460,
280367,
300849,
282418,
280373,
282424,
280377,
319289,
321338,
282428,
280381,
345918,
413500,
241471,
280386,
280391,
153416,
315209,
159563,
280396,
307024,
317268,
237397,
307030,
18263,
241494,
188250,
284508,
300893,
237411,
284515,
276326,
282471,
296807,
292713,
282476,
292719,
296815,
313200,
313204,
317305,
124795,
317308,
339840,
315265,
280451,
327556,
188293,
282503,
67464,
305032,
325514,
315272,
315275,
243592,
311183,
184207,
124816,
282517,
294806,
214936,
294808,
239515,
214943,
298912,
319393,
294820,
333734,
219046,
284584,
294824,
298921,
313257,
292783,
126896,
300983,
343993,
288698,
98240,
294849,
214978,
280517,
280518,
214983,
282572,
282573,
153553,
24531,
231382,
323554,
292835,
190437,
292838,
294887,
317416,
313322,
278507,
298987,
311277,
296942,
124912,
327666,
278515,
239610
] |
a305e3f647b063c01bbb4186031462a6e070868a | 81b920e3bd864cf1dfdf24d7c7c96b3f744df6ab | /0183-parser-printers-pt6/swift-parsing/Parsing.playground/Contents.swift | 5efb015aa3560fe7a9a2e4909d766c5a043bcb00 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | pointfreeco/episode-code-samples | 6156c8929449c741d375ec1624e78ff85514ee09 | 00e17446f499e283aa8997a19f8b4e1bb511716d | refs/heads/main | 2023-08-31T15:18:01.775334 | 2023-08-29T20:16:05 | 2023-08-29T20:16:05 | 113,688,516 | 881 | 342 | MIT | 2023-08-14T11:54:32 | 2017-12-09T17:39:53 | Swift | UTF-8 | Swift | false | false | 18,293 | swift | import Parsing
var input = ""[...]
//protocol PrependableCollection: Collection {
//}
protocol AppendableCollection: Collection {
mutating func append<S>(contentsOf newElements: S) where S : Sequence, Self.Element == S.Element
mutating func prepend<S>(contentsOf newElements: S) where S : Sequence, Self.Element == S.Element
}
import Foundation
extension Substring: AppendableCollection {
mutating func prepend<S>(contentsOf newElements: S) where S : Sequence, Character == S.Element {
var result = ""[...]
defer { self = result }
result.append(contentsOf: newElements)
result.append(contentsOf: self)
// self.insert(contentsOf: Array(newElements), at: self.startIndex)
}
}
//extension ArraySlice: AppendableCollection {}
//extension Data: AppendableCollection {}
//extension Substring.UnicodeScalarView: AppendableCollection {}
extension Substring.UTF8View: AppendableCollection {
mutating func append<S>(contentsOf newElements: S) where S : Sequence, String.UTF8View.Element == S.Element {
var result = Substring(self)
switch newElements {
case let newElements as Substring.UTF8View:
result.append(contentsOf: Substring(newElements))
default:
result.append(contentsOf: Substring(decoding: Array(newElements), as: UTF8.self))
}
self = result.utf8
}
mutating func prepend<S>(contentsOf newElements: S) where S : Sequence, String.UTF8View.Element == S.Element {
var result = Substring(self)
switch newElements {
case let newElements as Substring.UTF8View:
result.prepend(contentsOf: Substring(newElements))
default:
result.prepend(contentsOf: Substring(decoding: Array(newElements), as: UTF8.self))
}
self = result.utf8
}
}
//let _quotedField = ParsePrint {
// "\"".utf8
// Prefix { $0 != .init(ascii: "\"") }
// "\"".utf8
//}
protocol Printer {
associatedtype Input
associatedtype Output
func print(_ output: Output, to input: inout Input) throws
}
extension String: Printer {
func print(_ output: (), to input: inout Substring) {
input.prepend(contentsOf: self)
}
}
extension String.UTF8View: Printer {
func print(_ output: (), to input: inout Substring.UTF8View) {
input.prepend(contentsOf: self)
}
}
struct PrintingError: Error {}
extension Prefix: Printer where Input: AppendableCollection {
func print(_ output: Input, to input: inout Input) throws {
guard input.isEmpty || !self.predicate!(input.first!)
else { throw PrintingError() }
guard output.allSatisfy(self.predicate!)
else { throw PrintingError() }
input.prepend(contentsOf: output)
}
}
extension First: Printer where Input: AppendableCollection {
func print(_ output: Input.Element, to input: inout Input) throws {
input.prepend(contentsOf: [output])
}
}
input = "Hello,World"
try ParsePrint
{
Prefix { $0 != "," && $0 != "\n" }
First()
}
.parse(&input)
input
try ParsePrint
{
Prefix { $0 != "," && $0 != "\n" }
First()
}
.print(("Hello", "!"), to: &input)
input
try ParsePrint
{
Prefix { $0 != "," && $0 != "\n" }
First()
}
.parse(&input)
input
extension Parse: Printer where Parsers: Printer {
func print(_ output: Parsers.Output, to input: inout Parsers.Input) throws {
try self.parsers.print(output, to: &input)
}
}
extension Parsers.ZipVOV: Printer
where P0: Printer, P1: Printer, P2: Printer
{
func print(
_ output: P1.Output,
to input: inout P0.Input
) throws {
try self.p2.print((), to: &input)
try self.p1.print(output, to: &input)
try self.p0.print((), to: &input)
}
}
typealias ParsePrint<P: Parser & Printer> = Parse<P>
extension OneOf: Printer where Parsers: Printer {
func print(_ output: Parsers.Output, to input: inout Parsers.Input) throws {
try self.parsers.print(output, to: &input)
}
}
extension Parsers.OneOf2: Printer where P0: Printer, P1: Printer {
func print(_ output: P0.Output, to input: inout P0.Input) throws {
let original = input
do {
try self.p1.print(output, to: &input)
} catch {
input = original
try self.p0.print(output, to: &input)
}
}
}
extension Parsers.OneOf3: Printer where P0: Printer, P1: Printer, P2: Printer {
func print(_ output: P0.Output, to input: inout P0.Input) throws {
let original = input
do {
try self.p2.print(output, to: &input)
} catch {
input = original
do {
try self.p1.print(output, to: &input)
} catch {
input = original
try self.p0.print(output, to: &input)
}
}
}
}
extension Skip: Printer where Parsers: Printer, Parsers.Output == Void {
func print(
_ output: (),
to input: inout Parsers.Input
) throws {
try self.parsers.print((), to: &input)
}
}
extension Parsers.ZipVV: Printer where P0: Printer, P1: Printer {
func print(_ output: (), to input: inout P0.Input) throws {
try self.p1.print((), to: &input)
try self.p0.print((), to: &input)
}
}
extension Parsers.IntParser: Printer where Input: AppendableCollection {
func print(_ output: Output, to input: inout Input) {
// var substring = Substring(input)
// substring.append(contentsOf: String(output))
// input = substring.utf8
input.prepend(contentsOf: String(output).utf8)
}
}
extension FromUTF8View: Printer where UTF8Parser: Printer {
func print(
_ output: UTF8Parser.Output,
to input: inout Input
) throws {
var utf8 = self.toUTF8(input)
defer { input = self.fromUTF8(utf8) }
try self.utf8Parser.print(output, to: &utf8)
}
}
extension Parsers.BoolParser: Printer where Input: AppendableCollection {
func print(
_ output: Bool,
to input: inout Input
) throws {
input.prepend(contentsOf: String(output).utf8)
}
}
extension Parsers.ZipOVOVO: Printer
where
P0: Printer,
P1: Printer,
P2: Printer,
P3: Printer,
P4: Printer
{
func print(_ output: (P0.Output, P2.Output, P4.Output), to input: inout P0.Input) throws {
try self.p4.print(output.2, to: &input)
try self.p3.print((), to: &input)
try self.p2.print(output.1, to: &input)
try self.p1.print((), to: &input)
try self.p0.print(output.0, to: &input)
}
}
extension Parsers.ZipOO: Printer where P0: Printer, P1: Printer {
func print(_ output: (P0.Output, P1.Output), to input: inout P0.Input) throws {
try p1.print(output.1, to: &input)
try p0.print(output.0, to: &input)
}
}
extension Parsers.ZipVO: Printer where P0: Printer, P1: Printer {
func print(_ output: P1.Output, to input: inout P0.Input) throws {
try p1.print(output, to: &input)
try p0.print((), to: &input)
}
}
extension Many: Printer
where
Element: Printer,
Separator: Printer,
Separator.Output == Void,
Terminator: Printer,
Terminator.Output == Void,
Result == [Element.Output]
{
func print(_ output: [Element.Output], to input: inout Element.Input) throws {
try self.terminator.print((), to: &input)
var firstElement = true
for elementOutput in output.reversed() {
defer { firstElement = false }
if !firstElement {
try self.separator.print((), to: &input)
}
try self.element.print(elementOutput, to: &input)
}
}
}
try Parse
{
"Hello "
FromUTF8View { Int.parser() }
"!"
}
.parse("Hello 42!")
input = ""
try Parse { "Hello "; Int.parser(); "!" }
.print(42, to: &input)
input
//Skip { Prefix { $0 != "," } }.print(<#T##output: ()##()#>, to: &<#T##_#>)
// f: (A) -> B
// parse: (inout Input) throws -> Output
// print: (Output, inout Input) throws -> Void
// .map { Role.admin }
extension Parsers.Map: Printer where
Upstream: Printer,
Upstream.Output == Void,
NewOutput: Equatable
{
func print(_ output: NewOutput, to input: inout Upstream.Input) throws {
guard self.transform(()) == output
else {
throw PrintingError()
}
try self.upstream.print((), to: &input)
}
}
typealias ParserPrinter = Parser & Printer
struct Conversion<A, B> {
let apply: (A) throws -> B
let unapply: (B) throws -> A
}
extension Conversion where A == Substring, B == String {
static let string = Self(
apply: { String($0) },
unapply: { Substring($0) }
)
}
extension Parser where Self: Printer {
func map<NewOutput>(
_ conversion: Conversion<Output, NewOutput>
) -> Parsers.InvertibleMap<Self, NewOutput> {
.init(upstream: self, transform: conversion.apply, untransform: conversion.unapply)
}
}
// map: ((A) -> B) -> (F<A>) -> F<B>
// map: ((A) -> B) -> (Array<A>) -> Array<B>
// map: ((A) -> B) -> (Optional<A>) -> Optional<B>
// map: ((A) -> B) -> (Result<A, _>) -> Result<B, _>
// map: ((A) -> B) -> (Dictionary<_, A>) -> Dictionary<_, B>
//...
// map: (Conversion<A, B>) -> (ParserPrinter<_, A>) -> ParserPrinter<_, B>
// pullback: (KeyPath<A, B>) -> (Reducer<B, _, _>) -> Reducer<A, _, _>
// pullback: (CasePath<A, B>) -> (Reducer<_, B, _>) -> Reducer<_, A, _>
extension Parsers {
struct InvertibleMap<Upstream: ParserPrinter, NewOutput>: ParserPrinter {
let upstream: Upstream
let transform: (Upstream.Output) throws -> NewOutput
let untransform: (NewOutput) throws -> Upstream.Output
func parse(_ input: inout Upstream.Input) throws -> NewOutput {
try self.transform(self.upstream.parse(&input))
}
func print(_ output: NewOutput, to input: inout Upstream.Input) throws {
try self.upstream.print(self.untransform(output), to: &input)
}
}
}
extension Parse {
init<Upstream, NewOutput>(
_ conversion: Conversion<Upstream.Output, NewOutput>,
@ParserBuilder with build: () -> Upstream
) where Parsers == Parsing.Parsers.InvertibleMap<Upstream, NewOutput> {
self.init { build().map(conversion) }
}
}
extension Parsers.ZipOVO: Printer where P0: Printer, P1: Printer, P2: Printer {
func print(_ output: (P0.Output, P2.Output), to input: inout P0.Input) throws {
try self.p2.print(output.1, to: &input)
try self.p1.print((), to: &input)
try self.p0.print(output.0, to: &input)
}
}
extension Parser {
func printing(_ input: Input) -> Parsers.Printing<Self> where Input: AppendableCollection {
.init(upstream: self, input: input)
}
}
extension Parsers {
struct Printing<Upstream: Parser>: ParserPrinter where Upstream.Input: AppendableCollection {
let upstream: Upstream
let input: Upstream.Input
func parse(_ input: inout Upstream.Input) throws -> Upstream.Output {
try self.upstream.parse(&input)
}
func print(_ output: Upstream.Output, to input: inout Upstream.Input) throws {
input.prepend(contentsOf: self.input)
}
}
}
extension End: Printer {
func print(_ output: (), to input: inout Input) throws {
guard input.isEmpty
else { throw PrintingError() }
}
}
extension Rest: Printer where Input: AppendableCollection {
func print(_ output: Input, to input: inout Input) throws {
guard !output.isEmpty, input.isEmpty
else { throw PrintingError() }
input.prepend(contentsOf: output)
}
}
extension Not: Printer where Upstream: Printer, Upstream.Output == Void {
func print(_ output: (), to input: inout Upstream.Input) throws {
var input = input
do {
try self.upstream.parse(&input)
} catch {
return
}
throw PrintingError()
}
}
let x = 1
// let y = 2
let uncommentedLine = Parse {
Not { "//" }
Prefix { $0 != "\n" }
}
input = ""
try uncommentedLine.print("let x = 1", to: &input)
input
try uncommentedLine.parse(input)
//try uncommentedLine.parse("// let x = 1")
input = ""
try ParsePrint {
"Hello "
Int.parser()
}
.print(42, to: &input)
input
//input = ""
//try ParsePrint
//{
// Rest()
// Rest()
//}
//.print(("Hello", "World"), to: &input)
//input
//try Parse
//{
// Rest()
// Rest()
//}
//.parse(input)
input = ""
try Parse {
"Hello"
End()
}
.print((), to: &input)
input
//.parse("")
input = ""
try Parse {
Prefix { $0 != "\"" }
}
.print("Blob, Esq.", to: &input)
input
try Prefix
{ $0 != "\"" }.parse(&input)
input = ""
"Hello".print((), to: &input)
try "Hello".parse(&input) // ()
//print(<#T##items: Any...##Any#>, to: &<#T##TextOutputStream#>)
// parse: (inout Input) throws -> Output
// parse: (Input) throws -> (Output, Input)
// print: (Output, Input) throws -> Input
// print: (Output, inout Input) throws -> Void
// (S) -> (S, A)
// (inout S) -> A
let usersCsv = """
1, Blob, admin
2, Blob Jr, member
3, Blob Sr, guest
4, "Blob, Esq.", admin
"""
enum Role {
case admin, guest, member
}
struct User: Equatable {
var id: Int
var name: String
var role: Role
}
struct ConvertingError: Error {}
extension Conversion where A == Void, B: Equatable {
static func exactly(_ output: B) -> Self {
.init(apply: { output }, unapply: {
guard $0 == output
else { throw ConvertingError() }
})
}
}
let role = OneOf {
"admin".map { Role.admin }
"guest".map { Role.guest }
"member".map { Role.member }
}
input = ""
try role.print(.guest, to: &input)
input
input = ""
try role.print(.admin, to: &input)
input
input = ""
try role.print(.member, to: &input)
input
//OneOf {
// a.map(f)
// b.map(f)
// c.map(f)
//}
//==
//OneOf {
// a
// b
// c
//}
//.map(f)
let quotedFieldUtf8 = ParsePrint {
"\"".utf8
Prefix { $0 != .init(ascii: "\"") }
"\"".utf8
}
var inputUtf8 = ""[...].utf8
try quotedFieldUtf8.print("Blob, Esq"[...].utf8, to: &inputUtf8)
Substring(inputUtf8)
let quotedField = ParsePrint {
"\""
Prefix { $0 != "\"" }
"\""
}
input = ""
try quotedField.print("Blob, Esq.", to: &input)
input
let parsedQuotedField = try quotedField.parse(&input)
try quotedField.print(parsedQuotedField, to: &input)
input
let fieldUtf8 = OneOf {
quotedFieldUtf8
Prefix { $0 != .init(ascii: ",") }
}
// .map { String(Substring($0)) }
let field = OneOf {
quotedField
Prefix { $0 != "," }
}
.map(.string)
input = ""
try field.print("Blob, Esq." as String, to: &input)
input
input = ""
try field.print("Blob Jr." as String, to: &input)
input
let zeroOrOneSpaceUtf8 = OneOf {
" ".utf8
"".utf8
}
let zeroOrOneSpace = OneOf {
" "
""
}
.printing(" ")
input = ""
try Skip {
","
zeroOrOneSpace
}
.print((), to: &input)
input
let userUtf8 = Parse {
Int.parser()
Skip {
",".utf8
zeroOrOneSpaceUtf8
}
fieldUtf8
Skip {
",".utf8
zeroOrOneSpaceUtf8
}
Bool.parser()
}
unsafeBitCast((1, "Blob", true), to: User.self)
unsafeBitCast(User(id: 1, name: "Blob", role: .admin), to: (Int, String, Bool).self)
struct Private {
private let value: Int
// private let other: Int = 1
private init(value: Int) {
self.value = value
}
}
//Never
//Private(value: 42)
let `private` = unsafeBitCast(42, to: Private.self)
unsafeBitCast(`private`, to: Int.self)
extension Conversion where A == (Int, String, Role), B == User {
static let user = Self(
apply: B.init,
unapply: { unsafeBitCast($0, to: A.self) }
)
}
extension Conversion {
static func `struct`(_ `init`: @escaping (A) -> B) -> Self {
Self(
apply: `init`,
unapply: { unsafeBitCast($0, to: A.self) }
)
}
}
struct Person {
let firstName, lastName: String
var bio: String = ""
init(lastName: String, firstName: String) {
self.firstName = firstName
self.lastName = lastName
}
}
MemoryLayout<(String, String)>.size
MemoryLayout<Person>.size
let person = ParsePrint(.struct(Person.init)) {
Prefix { $0 != " " }.map(.string)
" "
Prefix { $0 != " " }.map(.string)
}
input = "Blob McBlob"
let p = try person.parse(&input)
input
//try person.print(p, to: &input)
input
let user = ParsePrint(.struct(User.init)) {
Int.parser()
Skip {
","
zeroOrOneSpace
}
field
Skip {
","
zeroOrOneSpace
}
role
}
//.map(User.init)
//.map(.struct(User.init))
input = ""
try user.print(User(id: 42, name: "Blob, Esq.", role: .admin), to: &input)
input
let usersUtf8 = Many {
userUtf8
} separator: {
"\n".utf8
} terminator: {
End()
}
let users = Many {
user
} separator: {
"\n"
} terminator: {
End()
}
//try users.parse("""
//1,Blob,admin
//2,Blob Jr,member
//3,Blob Sr,true
//""")
inputUtf8 = ""[...].utf8
try usersUtf8.print([
(1, "Blob"[...].utf8, true),
(2, "Blob, Esq."[...].utf8, false),
], to: &inputUtf8)
Substring(inputUtf8)
input = ""
try users.print([
User(id: 1, name: "Blob", role: .admin),
User(id: 2, name: "Blob, Esq.", role: .member),
], to: &input)
input
input = "A,A,A,B"
try Many { "A" } separator: { "," }.parse(&input)
input
input = usersCsv[...]
let output = try users.parse(&input)
input
"," == ","
func print(user: User) -> String {
"\(user.id), \(user.name.contains(",") ? "\"\(user.name)\"" : "\(user.name)"), \(user.role)"
}
struct UserPrinter: Printer {
func print(_ user: User, to input: inout String) {
input.append(contentsOf: "\(user.id),")
if user.name.contains(",") {
input.append(contentsOf: "\"\(user.name)\"")
} else {
input.append(contentsOf: user.name)
}
input.append(contentsOf: ",\(user.role)")
}
}
print(user: .init(id: 42, name: "Blob", role: .admin))
func print(users: [User]) -> String {
users.map(print(user:)).joined(separator: "\n")
}
struct UsersPrinter: Printer {
func print(_ users: [User], to input: inout String) {
var firstElement = true
for user in users {
defer { firstElement = false }
if !firstElement {
input += "\n"
}
UserPrinter().print(user, to: &input)
}
}
}
input = ""
//users.print(output, to: &input)
//print(users: output)
//
//input = usersCsv[...]
//try print(users: users.parse(input)) == input
//try users.parse(print(users: output)) == output
//
//var inputString = ""
//UsersPrinter().print(output, to: &inputString)
//inputString
"🇺🇸".count
"🇺🇸".unicodeScalars.count
Array("🇺🇸".unicodeScalars)
String.UnicodeScalarView([.init(127482)!])
String.UnicodeScalarView([.init(127480)!])
"🇺🇸".utf8.count
Array("🇺🇸".utf8)
String(decoding: [240, 159, 135, 186, 240, 159, 135, 184], as: UTF8.self)
String(decoding: [240, 159, 135, 186], as: UTF8.self)
String(decoding: [240, 159, 135, 184], as: UTF8.self)
String(decoding: [240, 159], as: UTF8.self)
String(decoding: [135, 186, 240, 159, 135, 184], as: UTF8.self)
var utf8 = "🇺🇸".utf8
//utf8.replaceSubrange(0...0, with: [241])
| [
-1
] |
0b2952b9346fc0edab6d4ed6d1015cf0561654c3 | a5b896c27f960af22e44609ba40acf15fc564672 | /Math Court/MultiPlayer.swift | 2779dc39c5808579f9e2823a81526b08a997d10d | [] | no_license | ShyamLingam/MathCourt | c7aceddb339b9e90859cbc724ff983d17bfbed0d | 739269e70765a30bd88720e1b5a592d50a38c928 | refs/heads/master | 2021-01-20T02:57:19.316408 | 2017-05-21T08:47:03 | 2017-05-21T08:47:03 | 89,475,522 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,576 | swift | //
// MultiPlayer.swift
// Math Court
//
// Created by Shyam Lingam on 21/5/17.
// Copyright © 2017 Deakin. All rights reserved.
//
import UIKit
class MultiPlayer: UIViewController {
//Question Answer Selection
@IBOutlet var LabelP1: UILabel!
@IBAction func PA1(_ sender: Any)
{
LabelP1.text = "P1: Incorrect Answer"
}
@IBAction func PA2(_ sender: Any)
{
LabelP1.text = "P1: Correct Answer"
}
@IBAction func PA3(_ sender: Any)
{
LabelP1.text = "P1: Incorrect Answer"
}
@IBOutlet var LabelP2: UILabel!
@IBAction func PA4(_ sender: Any)
{
LabelP2.text = "P2: Correct Answer"
}
@IBAction func PA5(_ sender: Any)
{
LabelP2.text = "P2: Incorrect Answer"
}
@IBAction func PA6(_ sender: Any)
{
LabelP2.text = "P2: Incorrect Answer"
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
f46365d650a3fea48ee44757c5ac07cf377225bc | 48822988d4fcd8f06c6c1f07c000ae4283c5503f | /FeedViewController.swift | efe060f0422f6c5028b48d5b59df0fc332dd0193 | [] | no_license | heat525/Week-2-Project-Carousel | 18525096aee4bb03746bfce8221ab068af5c507b | 1d49d0860f54e0e4eee97672d5ec5d6714863fc6 | refs/heads/master | 2021-01-10T10:39:55.357936 | 2015-09-29T04:19:48 | 2015-09-29T04:19:48 | 43,344,078 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,021 | swift | //
// FeedViewController.swift
// Week 2: Project Carousel
//
// Created by Prime, Heather(AWF) on 9/26/15.
// Copyright © 2015 Prime, Heather. All rights reserved.
//
import UIKit
class FeedViewController: UIViewController {
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var scrollView: UIScrollView!
override func viewDidLoad() {
super.viewDidLoad()
scrollView.contentSize = CGSize(width:320, height:1564)
}
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
] |
3e672a532b0eee09c2ff49fa800bcfe02b388bb7 | c93380cbfcd952858829ae012cd8362fe1b4ed32 | /CSE 394 Project 1/ArtModel.swift | afa31280a83e203891b8e1ef48749698f6df5f65 | [] | no_license | mpwelker/CSE-394-Project-1 | 9bdb07156557a8a876c9a4861921b30124b5531d | d88b956ee15492ce713050cb2873737f3c9b996d | refs/heads/master | 2021-01-19T12:32:42.442234 | 2015-04-08T20:27:31 | 2015-04-08T20:27:31 | 33,013,426 | 0 | 1 | null | 2015-04-08T20:27:32 | 2015-03-27T23:12:56 | Objective-C | UTF-8 | Swift | false | false | 629 | swift | //
// ArtModel.swift
// CSE 394 Project 1
//
// Created by Michael Welker on 2/26/15.
// Copyright (c) 2015 Michael Welker. All rights reserved.
//
import UIKit
class ArtModel : NSObject {
var title : NSString
var artist : NSString
var year : Int
var photo : UIImage // unused here, implemented in Pt. 2
// More data is stored for pieces than is present here, including
// date, location, exhibition, medium, notes, and favorite status
override init() {
self.title = NSString()
self.artist = NSString()
self.year = Int()
self.photo = UIImage()
}
}
| [
-1
] |
c62b9c0225c9d77ac6138e8b413d6349b77721d7 | 486b9787c9a08181eb7a6c51935f0b751ec0ae52 | /ViperKitExample/CoreLayer/Assemblies/StoryboardAssembly.swift | c950c561bc5e8a74297fd2d89c04dbfedf9584e6 | [] | no_license | galuzokb/ViperKitExample | 4a083281231b1d7dd545df562ad9cce5087c362b | 4e4ae99503e1541e6ba3947cbdf66f54817e2069 | refs/heads/master | 2021-05-10T11:31:35.627012 | 2019-04-02T06:36:07 | 2019-04-02T06:36:07 | 118,414,829 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,404 | swift | //
// StoryboardAssembly.swift
// ViperKitExample
//
// Created by Kirill Galuzo on 1/11/18.
// Copyright © 2018 galuzokb. All rights reserved.
//
import ViperKit
class StoryboardAssembly: BaseCoreAssembly {
var splashStoryboard: UIStoryboard {
return resolve(tag: "splash")
}
var signinStoryboard: UIStoryboard {
return resolve(tag: "signin")
}
var mainStoryboard: UIStoryboard {
return resolve(tag: "main")
}
var postsStoryboard: UIStoryboard {
return resolve(tag: "posts")
}
var postStoryboard: UIStoryboard {
return resolve(tag: "post")
}
var createPostStoryboard: UIStoryboard {
return resolve(tag: "createPost")
}
var searchStoryboard: UIStoryboard {
return resolve(tag: "search")
}
var segmentControlTestStoryboard: UIStoryboard {
return resolve(tag: "segmentControlTest")
}
var firstStoryboard: UIStoryboard {
return resolve(tag: "first")
}
var secondStoryboard: UIStoryboard {
return resolve(tag: "second")
}
init(withRoot root: RootCoreAssembly, system: SystemAssembly) {
super.init(withRoot: root)
container.register(.singleton, tag: "splash") { UIStoryboard(name: "Splash", bundle: system.bundle) }
container.register(.singleton, tag: "signin") { UIStoryboard(name: "Signin", bundle: system.bundle) }
container.register(.singleton, tag: "main") { UIStoryboard(name: "Main", bundle: system.bundle) }
container.register(.singleton, tag: "posts") { UIStoryboard(name: "Posts", bundle: system.bundle) }
container.register(.singleton, tag: "post") { UIStoryboard(name: "Post", bundle: system.bundle) }
container.register(.singleton, tag: "createPost") { UIStoryboard(name: "CreatePost", bundle: system.bundle) }
container.register(.singleton, tag: "search") { UIStoryboard(name: "Search", bundle: system.bundle) }
container.register(.singleton, tag: "segmentControlTest") { UIStoryboard(name: "SegmentControlTest", bundle: system.bundle) }
container.register(.singleton, tag: "first") { UIStoryboard(name: "First", bundle: system.bundle) }
container.register(.singleton, tag: "second") { UIStoryboard(name: "Second", bundle: system.bundle) }
bootstrap()
}
}
| [
-1
] |
9a194509d6983a92e27ecaf03e8790570de25bc4 | 8425957a71bf0c02ff73e83609c07995161fa6ec | /HelloWorldUITests/HelloWorldUITests.swift | c76dd2034f83b0e18cdb9cd722d3fc2d10075e57 | [] | no_license | pyar6329/SwiftHelloWorld | 33ec04cb029e1633ec381b369a097e6c68678f0a | 19624fa2034fb5d73fbbd68840b1f415e621eead | refs/heads/master | 2021-01-10T04:49:19.152347 | 2015-10-21T11:53:01 | 2015-10-21T11:53:01 | 44,672,152 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,248 | swift | //
// HelloWorldUITests.swift
// HelloWorldUITests
//
// Created by pyar6329 on 10/14/15.
// Copyright © 2015 pyar6329. All rights reserved.
//
import XCTest
class HelloWorldUITests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
| [
333827,
243720,
282634,
313356,
155665,
305173,
241695,
237599,
223269,
354342,
315431,
292901,
229414,
315433,
325675,
354346,
278571,
124974,
102446,
282671,
229425,
102441,
243763,
313388,
321589,
241717,
180279,
215095,
229431,
319543,
288829,
325695,
286787,
288835,
307269,
237638,
313415,
239689,
233548,
315468,
333902,
196687,
278607,
311377,
354386,
311373,
329812,
315477,
223317,
200795,
323678,
315488,
315489,
45154,
321632,
280676,
313446,
215144,
217194,
194667,
233578,
278637,
307306,
319599,
288878,
278642,
284789,
284790,
131190,
249976,
288890,
292987,
215165,
131199,
194692,
235661,
278669,
241809,
323730,
278676,
311447,
153752,
327834,
284827,
329884,
278684,
299166,
278690,
233635,
215204,
311459,
284840,
299176,
278698,
284843,
184489,
278703,
323761,
184498,
278707,
125108,
180409,
280761,
258233,
295099,
227517,
278713,
280767,
223418,
299197,
299202,
139459,
309443,
176325,
131270,
301255,
299208,
227525,
280779,
233678,
282832,
321744,
227536,
301271,
229591,
280792,
356575,
311520,
325857,
334049,
280803,
182503,
338151,
307431,
319719,
295147,
317676,
286957,
125166,
125170,
313595,
125180,
184574,
125184,
309504,
125192,
125197,
125200,
194832,
227601,
325904,
125204,
319764,
278805,
334104,
315674,
282908,
311582,
125215,
282912,
278817,
299294,
233761,
211239,
282920,
125225,
317738,
325930,
311596,
321839,
315698,
98611,
125236,
332084,
282938,
278843,
168251,
307514,
287040,
319812,
311622,
227655,
280903,
319816,
323914,
201037,
282959,
229716,
289109,
168280,
379224,
323934,
391521,
239973,
381286,
285031,
416103,
313703,
280938,
242027,
242028,
321901,
354671,
354672,
287089,
278895,
227702,
199030,
315768,
315769,
291194,
223611,
248188,
291193,
313726,
211327,
291200,
311679,
139641,
240003,
158087,
313736,
227721,
242059,
311692,
285074,
227730,
240020,
190870,
315798,
190872,
291225,
285083,
293275,
317851,
242079,
227743,
285089,
293281,
289185,
305572,
156069,
283039,
301482,
311723,
289195,
234957,
377265,
338359,
299449,
311739,
319931,
293309,
278974,
311744,
317889,
291266,
278979,
326083,
278988,
289229,
281038,
326093,
278992,
283089,
373196,
283088,
281039,
279000,
242138,
176602,
285152,
369121,
279009,
291297,
195044,
160224,
242150,
279014,
319976,
279017,
188899,
311787,
281071,
319986,
236020,
279030,
311800,
279033,
317949,
279042,
283138,
233987,
287237,
377352,
322057,
309770,
342537,
279053,
283154,
303635,
303634,
279061,
182802,
279060,
279066,
188954,
322077,
291359,
227881,
293420,
289328,
236080,
283185,
279092,
23093,
234037,
244279,
244280,
338491,
234044,
301635,
322119,
55880,
309831,
377419,
281165,
303693,
301647,
281170,
326229,
115287,
189016,
309847,
332379,
111197,
295518,
287327,
306634,
242274,
244326,
279150,
281200,
287345,
287348,
301688,
244345,
189054,
287359,
291455,
297600,
303743,
301702,
164487,
279176,
311944,
316044,
311948,
311950,
184974,
316048,
311953,
316050,
336531,
287379,
326288,
227991,
295575,
289435,
303772,
221853,
205469,
285348,
314020,
279207,
295591,
248494,
318127,
293552,
279215,
285362,
295598,
299698,
164532,
166581,
342705,
154295,
285360,
287418,
314043,
287412,
303802,
66243,
291529,
287434,
363212,
225996,
287438,
242385,
164561,
303826,
279249,
279253,
158424,
230105,
299737,
322269,
342757,
295653,
289511,
230120,
330473,
234216,
285419,
330476,
289517,
215790,
170735,
312046,
279278,
125683,
230133,
199415,
234233,
242428,
279293,
205566,
289534,
322302,
299777,
291584,
228099,
285443,
291591,
295688,
346889,
285450,
322312,
264971,
326413,
312076,
322320,
285457,
295698,
166677,
291605,
283418,
285467,
326428,
221980,
281378,
234276,
283431,
262952,
262953,
279337,
318247,
318251,
262957,
293673,
164655,
328495,
289580,
301872,
303921,
234290,
285493,
230198,
285496,
301883,
201534,
281407,
289599,
222017,
295745,
342846,
293702,
318279,
283466,
281426,
279379,
244569,
281434,
201562,
322396,
295769,
230238,
275294,
301919,
230239,
279393,
293729,
349025,
281444,
279398,
303973,
351078,
177002,
308075,
242540,
242542,
310132,
295797,
201590,
207735,
228214,
295799,
177018,
269179,
279418,
308093,
314240,
291713,
158594,
330627,
240517,
287623,
299912,
416649,
279434,
236427,
316299,
252812,
228232,
189327,
308111,
308113,
234382,
320394,
293780,
310166,
289691,
209820,
240543,
283551,
310177,
289699,
189349,
289704,
293801,
279465,
326571,
177074,
304050,
326580,
289720,
326586,
289723,
189373,
213956,
281541,
345030,
19398,
213961,
326602,
279499,
56270,
191445,
183254,
304086,
183258,
234469,
340967,
304104,
314343,
324587,
183276,
289773,
203758,
320492,
320495,
234476,
287730,
240631,
320504,
214009,
312313,
312317,
328701,
328705,
234499,
293894,
320520,
230411,
322571,
320526,
330766,
234513,
238611,
140311,
293911,
238617,
316441,
197658,
330789,
248871,
132140,
113710,
189487,
281647,
322609,
312372,
203829,
238646,
300087,
238650,
320571,
21567,
308288,
160834,
336962,
314437,
349254,
238663,
300109,
207954,
234578,
205911,
296023,
314458,
156763,
281698,
281699,
230500,
285795,
214116,
322664,
228457,
279659,
318571,
234606,
300145,
279666,
300147,
312435,
187508,
230514,
238706,
302202,
285819,
314493,
285823,
150656,
234626,
279686,
222344,
285833,
318602,
234635,
228492,
337037,
177297,
162962,
187539,
326803,
308375,
324761,
285850,
296091,
119965,
302239,
330912,
300192,
339106,
306339,
234655,
234662,
300200,
249003,
208044,
238764,
322733,
302251,
3243,
294069,
300215,
294075,
339131,
228541,
64699,
283841,
148674,
283846,
312519,
279752,
283849,
148687,
290001,
189651,
316628,
279766,
189656,
279775,
304352,
298209,
310496,
304353,
279780,
228587,
279789,
290030,
302319,
251124,
234741,
316661,
283894,
279803,
292092,
208123,
228608,
320769,
234756,
322826,
242955,
177420,
312588,
318732,
126229,
245018,
320795,
318746,
320802,
304422,
130342,
130344,
292145,
298290,
312628,
345398,
300342,
159033,
333114,
333115,
286012,
222523,
181568,
279872,
279874,
193858,
216387,
300354,
300355,
372039,
294210,
304457,
345418,
230730,
296269,
234830,
224591,
238928,
222542,
296274,
314708,
318804,
283990,
314711,
357720,
300378,
300379,
316764,
294236,
234330,
314721,
292194,
230757,
281958,
314727,
134504,
306541,
314734,
284015,
234864,
312688,
316786,
296304,
314740,
230772,
314742,
327030,
327023,
314745,
290170,
310650,
224637,
306558,
314752,
243073,
179586,
306561,
290176,
294278,
314759,
296328,
296330,
298378,
368012,
314765,
304523,
318860,
327556,
279955,
306580,
314771,
112019,
224662,
282008,
314776,
234902,
318876,
282013,
290206,
148899,
314788,
314790,
282023,
333224,
298406,
245160,
241067,
279980,
314797,
279979,
286128,
173492,
279988,
284086,
286133,
284090,
302523,
228796,
310714,
54719,
415170,
292291,
302530,
228804,
306630,
280003,
300488,
310725,
300490,
339403,
280011,
310731,
370122,
302539,
329168,
312785,
327122,
222674,
280020,
329170,
310735,
280025,
310747,
239069,
144862,
286176,
320997,
310758,
187877,
280042,
280043,
191980,
300526,
329198,
337391,
282097,
308722,
296434,
306678,
40439,
191991,
288248,
286201,
300539,
288252,
312830,
290304,
245249,
228868,
292359,
218632,
230922,
302602,
323083,
294413,
329231,
304655,
323088,
282132,
230933,
302613,
316951,
282135,
374297,
302620,
313338,
222754,
306730,
245291,
312879,
230960,
288305,
239159,
290359,
323132,
235069,
157246,
288319,
288322,
280131,
349764,
310853,
124486,
194118,
282182,
286281,
292426,
288328,
333389,
224848,
224852,
290391,
196184,
239192,
306777,
128600,
235096,
212574,
99937,
204386,
323171,
345697,
300645,
282214,
300643,
312937,
204394,
224874,
243306,
312941,
206447,
310896,
294517,
314997,
288377,
290425,
325246,
333438,
235136,
280193,
282244,
239238,
288391,
323208,
282248,
286344,
179853,
286351,
188049,
239251,
229011,
280217,
323226,
179868,
229021,
302751,
198304,
282272,
245413,
282279,
298664,
212649,
298666,
317102,
286387,
300725,
337590,
286392,
300729,
302778,
306875,
280252,
280253,
282302,
323262,
286400,
323265,
321217,
296636,
333508,
321220,
282309,
280259,
296649,
239305,
306891,
280266,
212684,
302798,
9935,
241360,
282321,
333522,
286419,
313042,
241366,
280279,
282330,
18139,
280285,
294621,
282336,
325345,
321250,
294629,
153318,
333543,
181992,
12009,
337638,
282347,
288492,
282349,
323315,
67316,
34547,
286457,
284410,
288508,
200444,
282366,
286463,
319232,
288515,
280326,
282375,
323335,
284425,
300810,
116491,
216844,
280333,
300812,
282379,
284430,
161553,
124691,
278292,
118549,
278294,
282390,
116502,
284436,
325403,
321308,
321309,
282399,
241440,
282401,
325411,
186148,
186149,
315172,
241447,
333609,
294699,
286507,
284460,
280367,
300849,
282418,
280373,
282424,
280377,
321338,
319289,
282428,
280381,
345918,
241471,
413500,
280386,
325444,
280391,
153416,
325449,
315209,
159563,
280396,
307024,
337746,
317268,
325460,
307030,
237397,
18263,
241494,
188250,
284508,
300893,
307038,
237411,
284515,
276326,
282471,
296807,
292713,
282476,
292719,
296815,
313200,
325491,
313204,
333687,
317305,
124795,
317308,
339840,
182145,
315265,
280451,
325508,
333700,
243590,
282503,
67464,
243592,
305032,
188293,
315272,
315275,
325514,
184207,
311183,
279218,
124816,
282517,
294806,
214936,
337816,
294808,
329627,
239515,
124826,
214943,
298912,
319393,
333727,
294820,
219046,
333734,
294824,
298921,
284584,
313257,
292783,
126896,
200628,
300983,
343993,
288698,
98240,
294849,
214978,
280517,
280518,
214983,
282573,
153553,
24531,
231382,
329696,
323554,
292835,
6116,
190437,
292838,
294887,
317416,
313322,
278507,
329707,
311277,
296942,
298987,
124912,
327666,
278515,
325620,
227316,
239610
] |
0925f5d14f89bdd8f9b2e1df0b74df2233328523 | 122dc6a305c6e1137b4b4bf416ee2ba4a6efc11a | /Emoji Dictionary/AppDelegate.swift | 1204fe722937755a95571224d8189c1feb406aa2 | [] | no_license | arsoares/Emoji-Dictionary | 807d573b4fba81bd265f40d0faf9b82101bc6d57 | 685fff9627501eae3526ce569b2681901f5162c5 | refs/heads/master | 2021-07-11T10:14:10.080640 | 2017-10-13T17:35:18 | 2017-10-13T17:35:18 | 104,884,538 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,184 | swift | //
// AppDelegate.swift
// Emoji Dictionary
//
// Created by Austin Soares on 9/26/17.
// Copyright © 2017 Austin Soares. 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,
229388,
294924,
278542,
229391,
327695,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
294950,
229415,
229417,
327722,
237613,
229422,
229426,
237618,
229428,
286774,
229432,
204856,
286776,
319544,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
237693,
327814,
131209,
303241,
417930,
311436,
303244,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
319694,
286926,
286928,
131281,
131278,
278743,
278747,
295133,
155872,
131299,
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,
311601,
287032,
155966,
278849,
319809,
319810,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
287238,
172552,
303623,
320007,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
311850,
279082,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
189040,
352880,
295538,
172656,
172660,
189044,
287349,
189039,
287355,
287360,
295553,
295557,
287365,
311942,
303751,
352905,
311946,
287371,
279178,
311951,
287377,
172691,
287381,
311957,
287386,
221850,
230045,
172702,
287390,
164509,
172705,
287394,
172707,
303780,
303773,
287398,
295583,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
279231,
287427,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
279258,
303835,
189149,
303838,
213724,
279267,
312035,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
304005,
295813,
304007,
320391,
304009,
213895,
304011,
230284,
304013,
189325,
213902,
279438,
189329,
295822,
304019,
295825,
189331,
58262,
304023,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
197645,
295949,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
164973,
205934,
312432,
279669,
337018,
189562,
279679,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
165038,
238766,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
230679,
320792,
230681,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
296264,
320840,
238919,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
410987,
230763,
148843,
230768,
296305,
312692,
230773,
279929,
181626,
304505,
304506,
181631,
312711,
296331,
288140,
230800,
288144,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
279991,
312759,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
148946,
222676,
288212,
288214,
370130,
280021,
329177,
288217,
288218,
280027,
288220,
239070,
239064,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
402942,
148990,
321022,
296450,
206336,
230916,
230919,
214535,
304651,
370187,
230923,
304653,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
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,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
280276,
313044,
321239,
280283,
313052,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
337732,
280388,
304968,
280393,
280402,
173907,
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,
288764,
313340,
239612,
239617,
313347,
288773,
313358,
305176,
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,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
215154,
313458,
280691,
149618,
313464,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
275606,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
321740,
313548,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
280819,
157940,
125171,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
321817,
125209,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
313700,
280937,
313705,
190832,
280946,
223606,
313720,
280956,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
297365,
240021,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
436684,
281045,
281047,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
240132,
305668,
330244,
223749,
223752,
150025,
338440,
281095,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
289317,
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,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
183172,
158596,
338823,
322440,
314249,
240519,
183184,
142226,
289687,
224151,
240535,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
322550,
134142,
322563,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
207937,
314433,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
298306,
380226,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
298365,
290174,
306555,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
314773,
306581,
314779,
314785,
282025,
314793,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
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,
282255,
282261,
175770,
298651,
323229,
282269,
298655,
323231,
61092,
282277,
306856,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
307009,
413506,
241475,
307012,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
282481,
110450,
315251,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
44948,
241556,
298901,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
290739,
241588,
282547,
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,
307211,
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,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
241813,
307352,
299164,
299167,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
176311,
299191,
307385,
184503,
258235,
307388,
176316,
307390,
307386,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
291089,
282906,
291104,
233766,
176435,
307508,
315701,
307510,
332086,
307512,
168245,
307515,
282942,
307518,
282947,
282957,
323917,
110926,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
283033,
291226,
242075,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
127407,
299440,
299444,
127413,
291254,
283062,
127417,
291260,
127421,
127424,
299457,
127429,
127431,
315856,
176592,
315860,
176597,
127447,
283095,
299481,
176605,
242143,
127455,
127457,
291299,
127460,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
291314,
291317,
127480,
135672,
291323,
233979,
291330,
127490,
283142,
127497,
135689,
233994,
127500,
291341,
233998,
234003,
127509,
234006,
152087,
127511,
283161,
234010,
242202,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
299655,
373383,
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,
242396,
299740,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
234231,
316151,
234236,
226045,
234239,
242431,
209665,
234242,
242436,
234246,
226056,
291593,
234248,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
234264,
201496,
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,
201557,
234329,
234333,
308063,
234336,
242530,
234338,
349027,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
177011,
234356,
152435,
234358,
234362,
226171,
291711,
234368,
234370,
291714,
291716,
234373,
226182,
234375,
226185,
308105,
234379,
234384,
234388,
234390,
226200,
234393,
209818,
308123,
234396,
324504,
291742,
324508,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
234410,
324522,
291754,
226220,
234414,
324527,
291760,
234417,
201650,
324531,
291756,
234422,
226230,
324536,
275384,
234428,
291773,
234431,
226239,
242623,
234434,
324544,
324546,
226245,
234437,
234439,
324548,
234443,
291788,
193486,
234446,
193488,
234449,
275406,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
234496,
316416,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
234519,
234520,
316439,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
234543,
234546,
275508,
234549,
300085,
300088,
234553,
234556,
234558,
316479,
234561,
160835,
234563,
308291,
316483,
234568,
234570,
316491,
300108,
234572,
234574,
300115,
234580,
234581,
234585,
275545,
242777,
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,
324757,
226453,
234648,
234647,
234650,
308379,
275608,
234653,
300189,
119967,
283805,
324766,
234657,
324768,
242852,
300197,
177318,
234661,
283813,
234664,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
283844,
300229,
308420,
308422,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
316663,
275703,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
300299,
177419,
300301,
349451,
242957,
177424,
275725,
283917,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
283963,
243003,
226628,
283973,
300357,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
136562,
324978,
333178,
275834,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
300448,
144807,
144810,
144812,
284076,
144814,
284084,
144820,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
300507,
103899,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
194101,
284215,
316983,
194103,
284218,
226877,
284223,
284226,
243268,
284228,
292421,
284231,
226886,
128584,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
276052,
276053,
284247,
235097,
243290,
284249,
284251,
317015,
300638,
284253,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
292470,
276086,
284278,
292473,
284283,
276093,
284286,
276095,
292479,
292481,
284290,
325250,
284292,
292485,
276098,
284288,
284297,
317066,
284299,
317068,
276109,
284301,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
276137,
317098,
284329,
284331,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
276175,
284368,
276177,
317138,
284370,
358098,
284372,
284377,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
153417,
292681,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
358292,
399252,
284564,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
292776,
276395,
292784,
276402,
358326,
161718,
358330,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
301015,
358360,
301017,
292828,
276446,
153568,
276448,
292839,
276455,
350186,
292843,
276460,
292845,
178161,
227314,
276466,
350200,
325624,
276472,
317435,
276476,
276479,
350210,
276482,
178181,
276485,
350218,
276490,
292876,
350222,
317456,
276496,
317458,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
178224,
276528,
243762,
309298,
325685,
325689,
235579,
276539,
235581,
178238,
325692,
276544,
243779,
284739,
292934,
243785,
276553,
350293,
350295,
309337,
227418,
350299,
194649,
350302,
194654,
227423,
178273,
227426,
309346,
194660,
350308,
309348,
227430,
292968,
350313,
309354,
276583,
350316,
309350,
309352,
301167,
276590,
350321,
284786,
276595,
227440,
350325,
350328,
292985,
301178,
350332,
292989,
292993,
301185,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
153765,
284837,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
276689,
309462,
301272,
276699,
309468,
194780,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
227571,
309491,
309494,
243960,
227583,
276735,
227587,
276739,
211204,
276742,
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,
342434,
317858,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
293346,
227810,
276964,
293352,
236013,
293364,
293370,
301562,
317951,
309764,
301575,
121352,
236043,
317963,
342541,
55822,
113167,
309779,
277011,
309781,
317971,
55837,
227877,
227879,
293417,
227882,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
318020,
301636,
301639,
301643,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
121458,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
334476,
326285,
318094,
318092,
277136,
277139,
227992,
334488,
285340,
318108,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
342707,
154292,
277173,
318132,
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,
293677,
318253,
285489,
293685,
285494,
301880,
285499,
301884,
293696,
310080,
277317,
277322,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
277368,
15224,
416639,
416640,
113538,
310147,
416648,
277385,
39817,
187274,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
276579,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
302075,
293882,
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,
285817,
367737,
302205,
285821,
392326,
285831,
253064,
302218,
285835,
294026,
162964,
384148,
187542,
302231,
302233,
285849,
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,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
384302,
285999,
277804,
113969,
277807,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
294211,
302403,
384328,
277832,
277836,
146765,
294221,
326991,
294223,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
310659,
294276,
351619,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
130486,
310710,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
245191,
310727,
64966,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
286188,
310764,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
286203,
40443,
40448,
228864,
286214,
228871,
302603,
302614,
302617,
286233,
302621,
187936,
146977,
286240,
187939,
40484,
294435,
40486,
286246,
294440,
245288,
294439,
294443,
196133,
294445,
40491,
310831,
40488,
286248,
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,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
327333,
229030,
212648,
302764,
278188,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
301163,
229086,
278238,
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,
237409,
229233,
294776,
360317,
294785,
327554,
360322,
40840,
294803,
40851,
188312,
294811,
319390,
40865,
294817,
319394,
294821,
311209,
180142,
294831,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
0121c97b6f94b052b295f60af98ed3421acfc574 | b748c2ff5d7408b3fe7fc3e9bd56dedfcba3eb3b | /AppleStore/Controllers/App/AppsPageController.swift | c99c9f9ca62973fdb2036735e57579580c1e84a9 | [] | no_license | Ari-Chou/AppStoreLayout | 06aeec0001f9437a5c7f3856018cac56adfd355d | 01b15686e01e545f4c9ecf07338aecf9b618c5b1 | refs/heads/main | 2023-03-31T18:29:25.209812 | 2021-04-04T08:28:04 | 2021-04-04T08:28:04 | 354,434,928 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,025 | swift | //
// AppsViewController.swift
// AppleStore
//
// Created by AriChou on 4/3/21.
//
import UIKit
class AppsPageController: BaseCollectionViewController, UICollectionViewDelegateFlowLayout {
// MARK: - Propertise
fileprivate let cellID = "cell"
fileprivate let headerID = "header"
var socialApps = [SocialApp]()
var groups = [AppGroup]()
let activityIndicatorView: UIActivityIndicatorView = {
let aiv = UIActivityIndicatorView(style: UIActivityIndicatorView.Style.large)
aiv.color = .black
aiv.startAnimating()
aiv.hidesWhenStopped = true
return aiv
}()
// MARK: - Lifecycle
override func viewDidLoad() {
super.viewDidLoad()
collectionView.backgroundColor = .white
collectionView.register(AppGroupCell.self, forCellWithReuseIdentifier: cellID)
collectionView.register(AppsPageHeader.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: headerID)
fetchData()
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
view.addSubview(activityIndicatorView)
activityIndicatorView.frame = view.bounds
}
// MARK: - Functions
private func fetchData() {
let dispatchGroup = DispatchGroup()
var group1: AppGroup?
var group2: AppGroup?
var group3: AppGroup?
dispatchGroup.enter()
APIService.shared.fetchEditorChoiseGames {(editChoiseGroup, error) in
dispatchGroup.leave()
if let error = error {
print("Apps Page Controller can not fetch the appGroup", error.localizedDescription)
return
}
group1 = editChoiseGroup
}
dispatchGroup.enter()
APIService.shared.fetchTopFree {(topFreeGroup, error) in
dispatchGroup.leave()
if let error = error {
print("Apps Page Controller can not fetch the appGroup", error.localizedDescription)
return
}
group2 = topFreeGroup
}
dispatchGroup.enter()
APIService.shared.fetchTopGrossing {(topGrossing, error) in
dispatchGroup.leave()
if let error = error {
print("Apps Page Controller can not fetch the appGroup", error.localizedDescription)
return
}
group3 = topGrossing
}
dispatchGroup.enter()
APIService.shared.fetchSocialApps { (socialApps, error) in
dispatchGroup.leave()
if let error = error {
print("Apps Page Controller can not fetch the header data", error.localizedDescription)
}
self.socialApps = socialApps ?? []
}
dispatchGroup.notify(queue: .main) {
if let group = group1 {
self.groups.append(group)
}
if let group = group2 {
self.groups.append(group)
}
if let group = group3 {
self.groups.append(group)
}
self.activityIndicatorView.isHidden = true
self.collectionView.reloadData()
}
}
}
// MARK: - Layout Collection View
extension AppsPageController {
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellID, for: indexPath) as! AppGroupCell
let appGroup = groups[indexPath.item]
cell.titleLabel.text = appGroup.feed.title
cell.horizontalController.appGroup = appGroup
cell.horizontalController.collectionView.reloadData()
return cell
}
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return groups.count
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return .init(width: view.frame.width, height: 300)
}
// MARK: - Page Header
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
return .init(width: view.frame.width, height: 300)
}
override func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: headerID, for: indexPath) as! AppsPageHeader
header.appsHeaderHorizontalController.socialApps = self.socialApps
header.appsHeaderHorizontalController.collectionView.reloadData()
return header
}
}
| [
-1
] |
874c01d37fb03a51fb32af4cb44515f2e1dca24d | 00abdbe81f2ac4b94313eb56663d1b2fae907f88 | /SnapKitAutoLayoutDemo/SnapKitAutoLayoutDemoUITests/SnapKitAutoLayoutDemoUITests.swift | 45095b0516561041c6b136dcce257f8f5708787d | [] | no_license | CoderJackyHuang/Swift2Demos | 0d29e35a825b135721aef3f4bc97b04448786a0b | e3cfa6dae9fd8fea63dcaa8121ac6b3c3883c947 | refs/heads/master | 2020-04-16T02:35:28.034740 | 2015-09-22T02:41:51 | 2015-09-22T02:41:51 | 42,380,649 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,121 | swift | //
// SnapKitAutoLayoutDemoUITests.swift
// SnapKitAutoLayoutDemoUITests
//
// Created by huangyibiao on 15/9/15.
// Copyright © 2015年 huangyibiao. All rights reserved.
//
import Foundation
import XCTest
class SnapKitAutoLayoutDemoUITests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
| [
333827,
243720,
313356,
223269,
229414,
292901,
315433,
325675,
124974,
282671,
229425,
243763,
241717,
180279,
229431,
227389,
325695,
237638,
239689,
311373,
278607,
311377,
354386,
280660,
223317,
354394,
321632,
315489,
280674,
45154,
227432,
233578,
194667,
307306,
319599,
223344,
131190,
288890,
292987,
227459,
280708,
323730,
278676,
311447,
327834,
284827,
299166,
278698,
278707,
125108,
180409,
278713,
295099,
299197,
280767,
299202,
139459,
176325,
131270,
301255,
227536,
282832,
321744,
18661,
182503,
319719,
286957,
125166,
125170,
125180,
125184,
125197,
125204,
319764,
282908,
299294,
125215,
282912,
233761,
278817,
211239,
282920,
125225,
317738,
315698,
98611,
125236,
307514,
227655,
280903,
319816,
323914,
282959,
229716,
323934,
313703,
285031,
280938,
242027,
321901,
287089,
227702,
291194,
248188,
313726,
313736,
242059,
285074,
240020,
315798,
291225,
317851,
305572,
301482,
377265,
311739,
278974,
311744,
317889,
289229,
281038,
326093,
291297,
195044,
242150,
311787,
281071,
319986,
317949,
283138,
322057,
182802,
283154,
188954,
322077,
291359,
283185,
279092,
23093,
309831,
303693,
326229,
309847,
189016,
111197,
242274,
244326,
279143,
277095,
313970,
287359,
297600,
303743,
184974,
316048,
316050,
287379,
295598,
279215,
318127,
287412,
166581,
154295,
287418,
303802,
225996,
363212,
287438,
303826,
158424,
230105,
322269,
230120,
330473,
285419,
279278,
312046,
230133,
199415,
322302,
299777,
291591,
295688,
285450,
312076,
322320,
295698,
166677,
285467,
318247,
262952,
262953,
279337,
318251,
289580,
262957,
301872,
242481,
303921,
230198,
289599,
295745,
222017,
293702,
318279,
277326,
295769,
201562,
301919,
293729,
308075,
242540,
242542,
310132,
295797,
207735,
269179,
308093,
314240,
291713,
240517,
287623,
279434,
316299,
308113,
293780,
209820,
277404,
240543,
283551,
189349,
177074,
289720,
289723,
189373,
213956,
19398,
213961,
52173,
56270,
191445,
304086,
183258,
142309,
304104,
183276,
203758,
320495,
287730,
277493,
277494,
240631,
320504,
293894,
230411,
320526,
140311,
293911,
197658,
132140,
113710,
189487,
281647,
322609,
312372,
203829,
238646,
238650,
320571,
21567,
160834,
336962,
300109,
207954,
296023,
234588,
277600,
281699,
322664,
228457,
318571,
300145,
238706,
312435,
187508,
285819,
285823,
279686,
285834,
318602,
337037,
162962,
187539,
308375,
324761,
302239,
300200,
238764,
322733,
279729,
300215,
294075,
283846,
283849,
148687,
189651,
189656,
298209,
304353,
302319,
283894,
320769,
234756,
242955,
318746,
292145,
181568,
294210,
216387,
286019,
304457,
230730,
296269,
238928,
296274,
314708,
300378,
300379,
292194,
230757,
327023,
234864,
290170,
290176,
243073,
179586,
306561,
294278,
296328,
298378,
304523,
318860,
224662,
234902,
282008,
290206,
148899,
298406,
241067,
279979,
314797,
284086,
284090,
302523,
302530,
280003,
228804,
310725,
306630,
306634,
280011,
302539,
222674,
280025,
310747,
144862,
280043,
282097,
40439,
286201,
300539,
288252,
312830,
286208,
228868,
292359,
230922,
294413,
304655,
323088,
230933,
374297,
313338,
282147,
306730,
239159,
290359,
157246,
280131,
310853,
124486,
288328,
290391,
306777,
212574,
99937,
204386,
300645,
282214,
312937,
224874,
243306,
310896,
294517,
288377,
235136,
280193,
286344,
323208,
286351,
239251,
229011,
229021,
302751,
282272,
282279,
298664,
286392,
300729,
302778,
306875,
280252,
296636,
282302,
286400,
323265,
280259,
239305,
296649,
306891,
9935,
282321,
286419,
241366,
278232,
294621,
278237,
282336,
278241,
294629,
12009,
282347,
282349,
286457,
282366,
286463,
319232,
278273,
282375,
282379,
161553,
321298,
124691,
278292,
118549,
116502,
282390,
325403,
321308,
282399,
241440,
282401,
315172,
286507,
280367,
300849,
282418,
280377,
280381,
280386,
280391,
315209,
237397,
307030,
18263,
188250,
300893,
282471,
296807,
292719,
296815,
313204,
124795,
339840,
280451,
327556,
188293,
282503,
325514,
184207,
124816,
282517,
294806,
214936,
294808,
239515,
298912,
333734,
284584,
294824,
292783,
300983,
343993,
98240,
294849,
214978,
280517,
214983,
282572,
282573,
153553,
190437,
292838,
294887,
317416,
313322,
298987,
311277,
296942,
124912,
278515,
227316,
239610
] |
32fe468221b471154e0357a9c87020e62538870c | eb8df21aca291c23ed53a951512083e72b07f472 | /Projets/Fidelity/Shared/Model/Shop.swift | 599e5f66a974167ee583d8089195768cdccb069a | [] | no_license | eLud/swift-traning-sb | 19a6bf5aea5d01890ae5e12ef0a40861c724ff29 | 59dbf93b8a8342162c8c12206356513a940010f0 | refs/heads/main | 2023-06-02T19:52:46.829688 | 2021-06-23T15:15:23 | 2021-06-23T15:15:23 | 372,500,903 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 307 | swift | //
// Shop.swift
// Fidelity
//
// Created by Ludovic Ollagnier on 01/06/2021.
//
import Foundation
// Magasin
// - Enseigne parente
// - Lieu (coord)
// - Lieu (adresse)
struct Shop: Identifiable {
var brand: Brand?
let location: (Double, Double)
let adress: String
let id = UUID()
}
| [
-1
] |
cf349d75b602c3456d47b2223bf89355f666c06d | f68a2343ef221b87cd9c6512d2947056d2d5577f | /BlinkingLabel/Classes/ReplaceMe.swift | 4b5ce38aa4b1a62bb1bfc4cdf0bf7bc1c1f8ba0f | [
"MIT"
] | permissive | carabina/BlinkingLabel-1 | 72c4e5f0071c0044394646a23e5a2f048f2480e9 | 038dba71f88603accbdea27129c6a15df10772aa | refs/heads/master | 2020-03-21T16:46:37.931993 | 2018-06-25T10:59:42 | 2018-06-25T10:59:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 382 | swift | import UIKit
public class BlinkingLabel : UILabel {
public func startBlinking() {
let options: UIViewAnimationOptions = .repeat
UIView.animate(withDuration: 0.25, delay:0.0, options:options, animations: {
self.alpha = 0
}, completion: nil)
}
public func stopBlinking() {
alpha = 1
layer.removeAllAnimations()
}
}
| [
-1
] |
9f250e447d2f8461ebac418a1f7a1bf83ab5d65c | fc00cd71ccb573923dc321da6d4cb8f71ef89710 | /Sources/Intermodular/Helpers/Combine/LazyFuture.swift | eaa0685035ea38de4b2311c054873f5c24e5086e | [] | no_license | vmanot/Merge | bccf5246bfb3f088720b58484c89867fe6484f9a | ad2837d330b79313c24e20cbdb60b4ad25c88b14 | refs/heads/master | 2023-08-18T15:43:10.134083 | 2023-08-16T07:47:31 | 2023-08-16T07:47:31 | 236,814,564 | 9 | 3 | null | null | null | null | UTF-8 | Swift | false | false | 655 | swift | //
// Copyright (c) Vatsal Manot
//
import Combine
import Dispatch
import Swift
public final class LazyFuture<Output, Failure: Error>: Publisher {
public typealias Promise = (Result<Output, Failure>) -> Void
public let cancellables = Cancellables()
private let base: Deferred<Future<Output, Failure>>
public init(_ attemptToFulfill: @escaping (@escaping Promise) -> Void) {
self.base = .init {
Future(attemptToFulfill)
}
}
public final func receive<S: Subscriber>(subscriber: S) where S.Input == Output, S.Failure == Failure {
base.receive(subscriber: subscriber)
}
}
| [
-1
] |
1175e84f4a1790867ae3caa87b9ed2dc0fe7115c | b3078c73bd08839b160aa67ae9ab3e423937a17c | /ItunesAPI/VideoViewController.swift | 19e8aadb7ae7ad7e69146e2fb06c8f1347132b4d | [] | no_license | anhtung87/ItunesAPI | 6549e82f0677491fd12624b71d6d71ad749105c3 | 27f04ac952a021c72ea6fdf6aaf42ca563aaa673 | refs/heads/master | 2022-07-26T14:53:53.800404 | 2020-05-20T16:33:29 | 2020-05-20T16:33:29 | 264,638,931 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,758 | swift | //
// VideoViewController.swift
// ItunesAPI
//
// Created by Hoang Tung on 5/20/20.
// Copyright © 2020 Hoang Tung. All rights reserved.
//
import UIKit
import AVFoundation
class VideoViewController: UIViewController {
var previewUrl: String?
var videoView: UIView = {
let view = UIView()
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()
var player: AVPlayer?
var played: Bool = true
var playButton: UIButton = {
let button = UIButton()
button.translatesAutoresizingMaskIntoConstraints = false
button.setTitle("Pause", for: .normal)
button.setTitleColor(.systemBlue, for: .normal)
button.setTitleColor(.systemRed, for: .highlighted)
button.backgroundColor = .white
return button
}()
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
addComponent()
setupLayout()
setupButton()
setupNavigation()
}
override func viewDidAppear(_ animated: Bool) {
let videoURL = URL(string: previewUrl ?? "")
player = AVPlayer(url: videoURL!)
let playerLayer = AVPlayerLayer(player: player)
playerLayer.frame = videoView.bounds
videoView.layer.addSublayer(playerLayer)
player?.play()
}
func addComponent() {
view.addSubview(videoView)
view.addSubview(playButton)
}
func setupLayout() {
[videoView.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 1),
videoView.heightAnchor.constraint(equalTo: view.heightAnchor, multiplier: 0.5),
videoView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
videoView.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: -100)].map { (anchor) in anchor.isActive = true}
[playButton.topAnchor.constraint(equalTo: videoView.bottomAnchor, constant: 16),
playButton.centerXAnchor.constraint(equalTo: view.centerXAnchor, constant: 0),
playButton.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.5),
playButton.heightAnchor.constraint(equalToConstant: 48)].map { (anchor) in anchor.isActive = true}
}
func setupButton() {
playButton.addTarget(self, action: #selector(playVideo), for: .touchUpInside)
}
@objc func playVideo() {
played = played == true ? false : true
switch played {
case true:
player?.play()
playButton.setTitle("Pause", for: .normal)
case false:
player?.pause()
playButton.setTitle("Play", for: .normal)
}
}
func setupNavigation() {
let backItem = UIBarButtonItem()
backItem.title = "Back"
navigationItem.backBarButtonItem = backItem
backItem.action = #selector(backButton)
}
@objc func backButton() {
player?.pause()
}
}
| [
-1
] |
0bb47497fed1f8298537328d74c13c1980ce4075 | 187de61f346bb4e28400b6c6c3ee01dedfce70ee | /Sources/App/Utils/DatabaseManager.swift | bd9bfb1665faf684c7a86653033781ba59b17d20 | [] | no_license | ricardopsantos/RJSP_VaporWebServer | 3edb3a24094a08657b5ad151a1b36ff511758acc | f796e9995ee5cc344b62495f786c224eab2266df | refs/heads/master | 2023-02-11T12:53:41.898488 | 2021-01-10T18:08:43 | 2021-01-10T18:08:43 | 325,804,224 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,164 | swift | import Foundation
import Vapor
import Logging
import PostgresKit
import Fluent
import FluentPostgresDriver
extension DatabaseID {
struct DB1 {
private init() { }
static let id = DatabaseID(string: "db1.id")
private static let connectionStringEnvKey = "DB1_CONNECTION_STRING"
static let connectionString = ConfigManager.valueWith(key: connectionStringEnvKey)
}
struct DB2 {
private init() { }
static let id = DatabaseID(string: "db2.id")
private static let connectionStringEnvKey = "DB2_CONNECTION_STRING"
static let connectionString = ConfigManager.valueWith(key: connectionStringEnvKey)
}
struct DB3 {
private init() { }
static let id = DatabaseID(string: "db2.id")
private static let connectionStringEnvKey = "DB2_CONNECTION_STRING"
static let connectionString = ConfigManager.valueWith(key: connectionStringEnvKey)
}
}
//
// https://docs.vapor.codes/4.0/fluent/overview/
// https://docs.vapor.codes/4.0/fluent/query/
//
public class DatabaseManager {
private init() { }
private static var dbReady: Bool = false
public static var ready: Bool { dbReady }
}
// MARK: - public
public extension DatabaseManager {
static func setup(app: Application) throws {
guard !dbReady else { return }
do {
guard let url = DatabaseID.DB1.connectionString else {
throw Abort(.unauthorized)
}
try app.databases.use(.postgres(url: url), as: DatabaseID.DB1.id)
dbReady = true
DatabaseManager.doTest(app: app)
} catch {
DevTools.Logs.log(error: "\(DatabaseManager.self) [\(error)] [\(DatabaseID.DB1.connectionString)]", app: app)
}
}
static func shutdownGracefully(_ app: Application? = nil) {
guard dbReady else { return }
DevTools.Logs.log(error: "\(DatabaseManager.self) will shutdown", app: app)
app?.databases.shutdown()
dbReady = false
}
static func doTest(app: Application) {
guard dbReady else { return }
do {
let test1Result = try KeyValueDBModel.query(on: app.db).all().wait()
DevTools.Logs.log(message: "DB connection: test1Result - sucess \(test1Result)", app: app)
let test2Result = DatabaseUtils.Querying.execute(query: "SELECT * FROM \(KeyValueDBModel.schema)", on: app.db)
DevTools.Logs.log(message: "DB connection: test2Result - sucess \(String(describing: test2Result))", app: app)
DatabaseUtils.Querying.execute(query: "SELECT * FROM \(KeyValueDBModel.schema)", on: app.db) { [weak app] (test3Result) in
if let test3Result = test3Result {
DevTools.Logs.log(message: "DB connection: test3Result - sucess \(test3Result)", app: app)
} else {
DevTools.Logs.log(message: "DB connection: test2Result - fail", app: app)
}
}
} catch {
DevTools.Logs.log(error: "Fail connection DB [\(error)]", app: app)
}
}
}
| [
-1
] |
82c7039c6814598f67006528af5618d0d6b540e5 | 3e386236e27756dd2e91322defdc2716657b51e5 | /infoAcopio/Views/Components/Alerts/ModAlertWebViewSingleButton.swift | 081248b9284065d21098c148d353ad037efb302c | [] | no_license | babalukas08/InfoAcopio | dadebf6110be03c0526b72b7123bccc4f0d01d79 | 70dff5b0eed99e7b7f0c4338071a6bbd9938f512 | refs/heads/master | 2021-07-04T13:35:31.736071 | 2017-09-24T19:34:38 | 2017-09-24T19:34:38 | 104,551,397 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,096 | swift | //
// ModAlertWebViewSingleButton.swift
// Pods
//
// Created by Mauricio Jimenez on 12/07/17.
//
//
import UIKit
import NibDesignable
public protocol ModAlertWebViewSingleButtonDelegate: class {
func onTapOk(mod: ModAlertWebViewSingleButton)
func onTapClose(mod: ModAlertWebViewSingleButton)
}
public class ModAlertWebViewSingleButton: NibDesignable {
weak public var delegate: ModAlertWebViewSingleButtonDelegate?
@IBOutlet weak public var imageView: UIImageView!
@IBOutlet weak public var btClose: UIButton!
@IBOutlet weak public var btOk: DefaultButton!
@IBOutlet weak public var webView: UIWebView!
public var textHTML: String = "" {
didSet {
webView.loadHTMLStringWithFont(textHTML)
}
}
@IBInspectable public var image: UIImage? {
didSet {
imageView.image = image
}
}
@IBInspectable public var buttonTitle: String? {
didSet {
btOk.setTitle(buttonTitle, for: .normal)
}
}
override public init(frame: CGRect) {
super.init(frame: frame)
setupView()
}
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setupView()
}
public func setupView() {
btOk.addTarget(self, action: #selector(onTapOk), for: .touchUpInside)
btClose.addTarget(self, action: #selector(onTapClose), for: .touchUpInside)
}
func onTapOk() {
delegate?.onTapOk(mod: self)
}
func onTapClose() {
delegate?.onTapClose(mod: self)
}
override public var intrinsicContentSize: CGSize {
// Width must be set from outside.
// We return 0 (zero) for height
// because it will be calculated by autolayout.
return CGSize(width: UIViewNoIntrinsicMetric, height: 0)
}
}
extension UIWebView {
func loadHTMLStringWithFont(_ htmlString:String) {
let font = "<font face='FunctionPro-Light'>"
self.loadHTMLString("\(font)\(htmlString)", baseURL: nil)
}
}
| [
-1
] |
50752a544475100a73fc5f446e2129683d14d3ed | 1a25015b744f2817f6352b6b232dbc05cd3c24ee | /workersTests/workersTests.swift | ad7eb65a5a127f4c5efb29fdfcb03a0912dced87 | [] | no_license | codemilli/WorkManager | 22d8b40ffe7fafaa377f363129adc39dd1dbc663 | be9f950738f9361819fc24d138573bc651b73867 | refs/heads/main | 2023-04-17T20:47:20.034929 | 2021-04-28T17:28:28 | 2021-04-28T17:28:28 | 365,810,262 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 893 | swift | //
// workersTests.swift
// workersTests
//
// Created by codemilli on 2021/04/24.
//
import XCTest
@testable import workers
class workersTests: 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.
}
}
}
| [
333828,
43014,
358410,
354316,
313357,
360462,
399373,
317467,
145435,
16419,
229413,
204840,
315432,
325674,
344107,
102445,
155694,
253999,
176175,
215089,
346162,
233517,
129076,
241716,
229430,
243767,
358456,
163896,
180280,
352315,
288828,
436285,
376894,
288833,
288834,
436292,
403525,
352326,
225351,
315465,
436301,
338001,
196691,
338003,
280661,
329814,
338007,
307289,
385116,
237663,
254048,
315487,
356447,
280675,
280677,
43110,
319591,
321637,
436329,
315498,
194666,
221290,
438377,
260207,
352368,
432240,
204916,
233589,
266357,
131191,
215164,
215166,
422019,
280712,
415881,
104587,
235662,
241808,
381073,
196760,
284826,
426138,
346271,
436383,
362659,
233636,
49316,
299174,
333991,
32941,
239793,
377009,
405687,
182456,
295098,
258239,
379071,
389313,
299203,
149703,
338119,
299209,
346314,
372941,
266449,
321745,
139479,
254170,
229597,
194782,
301279,
311519,
317664,
280802,
379106,
387296,
346346,
205035,
307435,
321772,
438511,
381172,
338164,
436470,
336120,
327929,
356602,
184570,
243962,
344313,
184575,
149760,
375039,
411906,
147717,
368905,
375051,
325905,
254226,
272658,
368916,
262421,
272660,
325912,
309529,
381208,
377114,
151839,
237856,
237857,
233762,
211235,
217380,
432421,
211238,
338218,
254251,
251213,
311597,
358703,
321840,
98610,
332083,
379186,
332085,
358709,
180535,
336183,
332089,
127284,
321860,
332101,
438596,
323913,
348492,
254286,
383311,
323920,
344401,
366930,
377169,
348500,
368981,
155990,
289110,
368984,
168281,
215385,
332123,
363163,
272729,
332127,
98657,
383332,
242023,
383336,
270701,
160110,
242033,
270706,
354676,
354677,
139640,
291192,
106874,
211326,
436608,
362881,
240002,
436611,
311685,
225670,
317831,
106888,
340357,
242058,
385417,
373134,
385422,
108944,
252308,
190871,
213403,
149916,
121245,
242078,
420253,
141728,
315810,
315811,
381347,
289189,
108972,
272813,
340398,
385454,
377264,
61873,
342450,
338356,
436661,
293303,
311738,
33211,
336317,
293310,
336320,
311745,
378244,
127427,
416197,
254406,
188871,
324039,
129483,
342476,
373197,
289232,
328152,
256477,
287198,
160225,
342498,
358882,
334309,
391655,
432618,
375276,
319981,
291311,
109042,
254456,
377338,
377343,
174593,
254465,
291333,
348682,
340490,
139792,
420369,
303636,
258581,
393751,
254488,
416286,
377376,
207393,
375333,
377386,
358954,
244269,
197167,
375343,
385588,
289332,
234036,
375351,
174648,
338489,
338490,
244281,
315960,
352829,
242237,
348732,
70209,
348742,
115270,
70215,
293448,
55881,
301638,
309830,
348749,
381517,
385615,
426576,
340558,
369235,
416341,
297560,
332378,
201308,
354911,
416351,
139872,
436832,
436834,
268899,
111208,
39530,
191082,
184940,
373358,
420463,
346737,
389745,
313971,
139892,
346740,
420471,
287352,
344696,
209530,
244347,
356989,
373375,
152195,
311941,
336518,
348806,
311945,
369289,
330379,
344715,
311949,
287374,
326287,
375440,
316049,
311954,
334481,
117396,
111253,
316053,
346772,
230040,
264856,
111258,
111259,
271000,
289434,
303771,
205471,
318106,
318107,
342682,
139939,
344738,
377500,
176808,
352937,
354274,
336558,
205487,
303793,
318130,
299699,
299700,
293556,
336564,
383667,
314040,
287417,
39614,
287422,
377539,
422596,
422599,
291530,
225995,
363211,
164560,
242386,
385747,
361176,
418520,
422617,
287452,
363230,
264928,
422626,
375526,
234217,
346858,
330474,
342762,
293612,
342763,
289518,
299759,
369385,
377489,
312052,
154359,
172792,
348920,
344827,
221948,
432893,
344828,
363263,
205568,
162561,
291585,
295682,
430849,
35583,
291592,
197386,
383754,
62220,
117517,
434957,
322319,
422673,
377497,
430865,
166676,
291604,
310036,
197399,
207640,
422680,
426774,
426775,
326429,
293664,
344865,
326433,
197411,
342820,
400166,
289576,
293672,
295724,
152365,
197422,
353070,
164656,
295729,
422703,
191283,
189228,
422709,
152374,
230199,
197431,
273207,
355130,
375609,
160571,
353078,
289598,
160575,
336702,
430910,
355137,
355139,
160580,
252741,
353094,
348998,
211836,
355146,
381773,
201551,
293711,
355121,
355152,
353109,
377686,
244568,
230234,
189275,
244570,
355165,
435039,
295776,
242529,
349026,
357218,
303972,
385893,
127841,
342887,
355178,
308076,
242541,
207727,
330609,
246643,
207732,
295798,
361337,
177019,
185211,
308092,
398206,
400252,
291712,
158593,
254850,
359298,
260996,
359299,
113542,
369538,
381829,
316298,
392074,
349067,
295824,
224145,
349072,
355217,
256922,
289690,
318364,
390045,
310176,
185250,
310178,
337227,
420773,
185254,
256935,
289703,
293800,
359338,
353195,
140204,
236461,
363438,
347055,
377772,
304051,
326581,
373687,
326587,
230332,
377790,
289727,
273344,
349121,
330689,
353215,
363458,
379844,
213957,
19399,
359364,
345033,
326601,
373706,
316364,
381897,
211914,
359381,
386006,
418776,
359387,
433115,
248796,
343005,
50143,
347103,
340955,
207838,
248797,
64485,
123881,
326635,
187374,
383983,
340974,
359406,
287731,
347123,
349171,
240630,
271350,
201720,
127992,
295927,
349175,
328700,
318461,
293886,
257024,
328706,
330754,
320516,
293893,
295942,
357379,
386056,
410627,
353290,
330763,
377869,
433165,
384016,
146448,
238610,
308243,
418837,
140310,
433174,
201755,
252958,
336929,
369701,
357414,
248872,
238639,
357423,
252980,
300084,
359478,
312373,
203830,
238651,
132158,
308287,
361535,
336960,
248901,
377926,
257094,
361543,
218186,
250954,
250956,
314448,
341073,
339030,
439384,
304222,
392290,
314467,
253029,
257125,
300135,
316520,
273515,
173166,
357486,
144496,
351344,
404593,
187506,
377972,
285814,
291959,
300150,
300151,
363641,
160891,
363644,
341115,
300158,
377983,
392318,
150657,
248961,
384131,
349316,
402565,
349318,
302216,
330888,
386189,
373903,
169104,
177296,
337039,
347283,
326804,
363669,
238743,
119962,
300187,
300188,
339100,
351390,
199839,
380061,
429214,
343203,
265379,
300201,
249002,
253099,
253100,
238765,
3246,
300202,
306346,
238769,
318639,
44203,
402613,
367799,
421048,
373945,
113850,
294074,
302274,
367810,
259268,
265412,
353479,
402634,
283852,
259280,
290000,
316627,
333011,
189653,
419029,
351446,
148696,
296153,
357595,
134366,
304351,
195808,
298208,
310497,
359647,
298212,
298213,
222440,
330984,
328940,
298221,
253167,
298228,
302325,
234742,
386294,
351478,
128251,
363771,
386301,
261377,
320770,
386306,
437505,
322824,
439562,
292107,
328971,
414990,
353551,
251153,
177428,
349462,
257305,
250192,
320796,
222494,
253216,
339234,
109861,
372009,
412971,
130348,
66862,
353584,
261425,
351537,
382258,
345396,
300343,
386359,
378172,
286013,
306494,
382269,
216386,
312648,
337225,
304456,
230729,
146762,
224586,
177484,
294218,
259406,
234831,
238927,
294219,
331090,
353616,
406861,
318805,
314710,
372054,
425304,
159066,
374109,
314720,
378209,
163175,
333160,
386412,
380271,
327024,
296307,
116084,
208244,
249204,
316787,
382330,
290173,
306559,
314751,
318848,
337281,
148867,
357762,
253317,
298374,
314758,
314760,
142729,
296329,
368011,
384393,
388487,
314766,
296335,
318864,
112017,
234898,
9619,
259475,
275859,
318868,
370071,
357786,
290207,
314783,
251298,
310692,
314789,
333220,
314791,
396711,
245161,
396712,
208293,
374191,
286129,
380337,
173491,
286132,
150965,
304564,
353719,
380338,
343476,
228795,
425405,
302531,
163268,
380357,
339398,
361927,
300489,
425418,
306639,
413137,
366037,
353750,
23092,
210390,
210393,
210391,
286172,
144867,
271843,
429542,
54765,
296433,
251378,
308723,
300536,
359930,
286202,
302590,
210433,
372227,
292356,
323080,
329225,
253451,
253452,
296461,
359950,
259599,
304656,
329232,
146964,
308756,
370197,
253463,
175639,
374296,
388632,
374299,
308764,
396827,
134686,
423453,
349726,
431649,
355876,
286244,
245287,
402985,
394794,
245292,
349741,
347694,
169518,
431663,
288309,
312889,
194110,
349763,
196164,
265798,
288327,
218696,
292425,
128587,
265804,
333388,
396882,
349781,
128599,
179801,
44635,
239198,
343647,
333408,
396895,
99938,
300644,
323172,
310889,
415338,
243307,
312940,
54893,
204397,
138863,
188016,
222832,
325231,
224883,
120427,
314998,
370296,
366203,
323196,
325245,
337534,
337535,
339584,
263809,
294529,
339585,
194180,
224901,
288392,
229001,
415375,
188048,
239250,
419478,
345752,
425626,
255649,
302754,
153251,
298661,
40614,
300714,
210603,
364207,
224946,
337591,
384695,
319162,
110268,
415420,
224958,
327358,
333503,
274115,
259781,
306890,
403148,
212685,
333517,
9936,
9937,
241361,
302802,
333520,
272085,
345814,
370388,
384720,
345821,
321247,
298720,
321249,
325346,
153319,
325352,
345833,
345834,
212716,
212717,
360177,
67315,
173814,
300794,
325371,
288512,
319233,
339715,
288516,
360195,
339720,
243472,
372496,
323346,
321302,
345879,
366360,
398869,
169754,
325404,
321310,
286494,
255776,
339745,
341796,
257830,
421672,
362283,
378668,
399147,
431916,
366381,
300848,
409394,
296755,
259899,
319292,
360252,
325439,
345919,
436031,
403267,
153415,
360264,
345929,
341836,
415567,
325457,
317269,
216918,
362327,
18262,
241495,
341847,
255829,
350044,
346779,
128862,
245599,
345951,
362337,
376669,
345955,
425825,
296806,
292712,
425833,
423789,
214895,
313199,
362352,
325492,
276341,
417654,
341879,
241528,
317304,
333688,
112509,
55167,
182144,
325503,
305026,
339841,
241540,
188292,
333701,
243591,
253829,
315273,
315274,
350093,
325518,
372626,
380821,
329622,
294807,
337815,
333722,
376732,
350109,
118685,
298909,
311199,
319392,
292771,
354212,
436131,
294823,
415655,
436137,
327596,
362417,
323507,
243637,
290745,
294843,
188348,
362431,
237504,
294850,
274371,
384964,
214984,
151497,
362443,
344013,
212942,
301008,
153554,
212946,
24532,
212951,
219101,
372701,
329695,
436191,
360417,
354272,
354269,
292836,
292837,
298980,
337895,
313319,
317415,
354280,
174057,
380908,
436205,
247791,
362480,
311281,
311282,
325619,
432116,
292858,
415741,
352917
] |
ef5d2b2791ca258cda8c4ad094b2169cb893e332 | b9980d154e26849abebe18051e619fb31ea3b2c3 | /Networking/Model/GetAllJobsModal.swift | 61f3d1058b90a3388f6bd262c3768e4aaf3af19f | [
"MIT"
] | permissive | AgrinobleAGN/Agrinoble-Mobile-App-iOS | acd1040e8b0e3bb4c2bf1efeae6a26462f775de9 | 9c28c53b8f3b74afcf5ba1e280c2f7ac36de2403 | refs/heads/main | 2023-07-18T12:29:44.182492 | 2021-09-02T09:29:13 | 2021-09-02T09:29:13 | 402,361,069 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 926 | swift |
import Foundation
class GetAllJobsModal {
struct getAllJobs_SuccessModal{
let api_status: Int
let data: [[String:Any]]
}
struct getAllJobs_ErrorModal :Codable{
let apiStatus: String
let errors: Errors
enum CodingKeys: String, CodingKey {
case apiStatus = "api_status"
case errors
}
}
// MARK: - Errors
struct Errors: Codable {
let errorID: Int
let errorText: String
enum CodingKeys: String, CodingKey {
case errorID = "error_id"
case errorText = "error_text"
}
}
}
extension GetAllJobsModal.getAllJobs_SuccessModal{
init(json :[String:Any]) {
let apiStatus = json["api_status"] as? Int
let data = json["data"] as? [[String:Any]]
self.api_status = apiStatus ?? 0
self.data = data ?? [["id" : "1234"]]
}
}
| [
-1
] |
b213ae1b634a39c0150d60f0f782b7a98f7f7a4b | 36e5a0264268bd846eccad0403dc913be6bc45d3 | /Protocols/BankVault.swift | 836de820703f02590326c153eec4bf6e2e976936 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | JoyceMatos/swift-ProtocolLab-lab-ios-0916 | e2b6329fad01e2dfb15e55012176b2298e89537c | 3133e0aa81ff40be74a73c1965a67dc9c2ee15f2 | refs/heads/master | 2021-01-12T16:54:00.137775 | 2016-10-20T14:08:53 | 2016-10-20T14:08:53 | 71,465,287 | 0 | 0 | null | 2016-10-20T13:21:35 | 2016-10-20T13:21:35 | null | UTF-8 | Swift | false | false | 873 | swift | //
// BankVault.swift
// Protocols
//
// Created by Papa Roach on 8/8/16.
// Copyright © 2016 Flatiron School. All rights reserved.
//
class BankVault {
let name: String
let address: String
var amount: Double = 0.0
init(name: String, address: String) {
self.name = name
self.address = address
}
}
protocol ProvideAccess {
func allowEntryWithPassword(_ password: [Int]) -> Bool
}
extension BankVault: ProvideAccess {
func allowEntryWithPassword(_ password: [Int]) -> Bool {
if password.isEmpty || password.count > 10{
return false
}
for (index, value) in password.enumerated() {
if index % 2 == 0 && value % 2 == 0 {
return true
} else {
return false
}
}
return false
}
}
| [
-1
] |
20d52ea7ad6230ae09ed8c0f8337018260ff243d | 23e48669129c81e6cd75a76f7565f0dbda25e4d5 | /SwiftUIMVVM/Modules/ActorDetail/ViewModel/ActorDetailViewModel.swift | 16914731f798b36e4911de7e2894938f6278dcf2 | [] | no_license | wesleysfavarin/SwiftUI-Combine-MVVM-Clean | 0903803603f0e4eee7806fb2dd70e866adf56db3 | a736972206e5419c44e6658dce9e12c30cd83552 | refs/heads/master | 2022-03-09T15:04:57.973887 | 2019-11-20T14:29:03 | 2019-11-20T14:29:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,370 | swift | //
// ActorDetailViewModel.swift
// SwiftUIMVVM
//
// Created by GandhiMena on 30/10/19.
// Copyright © 2019 gandhi. All rights reserved.
//
import Foundation
import Combine
class ActorDetailViewModel: ObservableObject {
internal var cancellables: [AnyCancellable] = []
internal let mainViewService: MainViewManagerProtocol
// @Published var known_for: [CastMovie] = []
@Published var castData: CastData = CastData()
var castID: String
init(castID: String, mainViewService: MainViewManagerProtocol = MainViewManager()) {
self.castID = castID
self.mainViewService = mainViewService
getActorInfo()
}
func getActorInfo() {
let mediaCastDetail = MediaCastDetail(mediaType: .credit, credit_id: castID)
let responsePublisher = mainViewService.getCastDetail(mediaCastDetail)
.sink(receiveCompletion: { completion in
switch completion {
case .failure(let error):
print(error.localizedDescription)
case .finished:
print("get castDetail Finished")
}
}) { [weak self] castDetail in
self?.castData = castDetail.person
}
cancellables += [
responsePublisher
]
}
}
| [
-1
] |
c737845836ea280c43c89a71ac99864cd7196d24 | be0e7ea8a12e136c846e77790487d043dbf0f84c | /Tests/StickyLockingTests/Lock+ModeTests.swift | 0b99780bfbef4b1625200283c84f2a76cd684fd3 | [
"Apache-2.0"
] | permissive | stickytools/sticky-locking | 61085280e8b319ac2756b066c35cff7f852f9ae7 | ea985bfc9a9ceb0a58941ee3523fcd93b18486b7 | refs/heads/master | 2020-03-11T00:02:07.512518 | 2019-02-23T15:54:46 | 2019-02-23T15:54:46 | 129,653,552 | 3 | 2 | Apache-2.0 | 2019-02-23T02:42:25 | 2018-04-15T21:44:29 | Swift | UTF-8 | Swift | false | false | 1,315 | swift | ///
/// Lock+ModeTests.swift
///
/// Copyright 2017 Tony Stone
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Created by Tony Stone on 12/2/17.
///
import XCTest
import StickyLocking
class Lock_ModeTests: XCTestCase {
func testInit() {
XCTAssertEqual(LockMode(integerLiteral: 10).value, 10)
}
func testEqualTrue() {
XCTAssertTrue(LockMode(integerLiteral: 20) == LockMode(integerLiteral: 20))
}
func testEqualFalse() {
XCTAssertFalse(LockMode(integerLiteral: 20) == LockMode(integerLiteral: 10))
}
func testDescription() {
XCTAssertEqual(LockMode(integerLiteral: 10).description, "10")
}
func testDebugDescription() {
XCTAssertEqual(LockMode(integerLiteral: 10).debugDescription, "10")
}
}
| [
-1
] |
7995303e68ec61ec2fb127421300a5953d7c97a1 | 3cb24b63149450d9fc6a50d709341728f39e2114 | /Example/ReactiveSwiftCell/ViewController.swift | 3ac34feb55d77a0fb9203bff7918f4d495bd6895 | [
"MIT"
] | permissive | xander-lis/ReactiveSwiftCell | 34d0f8866566c4188c3d023723d9e34f6586a10c | 643066247e6463f616e7079dfd190f2edcefddca | refs/heads/master | 2022-06-25T14:16:32.575249 | 2020-05-10T21:19:43 | 2020-05-10T21:19:43 | 262,789,514 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 8,849 | swift | //
// ViewController.swift
// ReactiveSwiftCell
//
// Created by Aleksandr Lis on 05/11/2020.
// Copyright (c) 2020 Aleksandr Lis. All rights reserved.
//
import UIKit
import ReactiveSwift
import ReactiveSwiftCell
class ViewController: UIViewController {
@IBOutlet private weak var tableView: UITableView!
private var (lifetime, token) = Lifetime.make()
private var notificationCenter: NotificationCenter {
return NotificationCenter.default
}
private enum SectionType: Int, CaseIterable {
case textView
case segmentControl
case `switch`
case slider
case stepper
case button
case textField
}
required init?(coder: NSCoder) {
super.init(coder: coder)
subscribeToKeyboardNotifications()
}
deinit {
unsubscribeFromKeyboardNotifications()
}
override func viewDidLoad() {
super.viewDidLoad()
setupTableView()
addTap()
bind()
}
private func setupTableView() {
tableView.tableFooterView = UIView()
tableView.register(UINib(nibName: String(describing: TextViewCell.self), bundle: nil),
forCellReuseIdentifier: String(describing: TextViewCell.self))
tableView.register(UINib(nibName: String(describing: SegmentControlCell.self), bundle: nil),
forCellReuseIdentifier: String(describing: SegmentControlCell.self))
tableView.register(UINib(nibName: String(describing: SwithCell.self), bundle: nil),
forCellReuseIdentifier: String(describing: SwithCell.self))
tableView.register(UINib(nibName: String(describing: SliderCell.self), bundle: nil),
forCellReuseIdentifier: String(describing: SliderCell.self))
tableView.register(UINib(nibName: String(describing: StepperCell.self), bundle: nil),
forCellReuseIdentifier: String(describing: StepperCell.self))
tableView.register(UINib(nibName: String(describing: ButtonCell.self), bundle: nil),
forCellReuseIdentifier: String(describing: ButtonCell.self))
tableView.register(UINib(nibName: String(describing: TextFieldCell.self), bundle: nil),
forCellReuseIdentifier: String(describing: TextFieldCell.self))
}
private func bind() {
inputCellEvent <~ InputCellCenter.shared.event
}
}
//MARK: Reactive
private extension ViewController {
var inputCellEvent: BindingTarget<InputCellEvent> {
return BindingTarget(lifetime: lifetime) { (event) in
switch event {
case .updateText(let value, let indexPath):
print("Text value = \(value) at = \(indexPath)")
case .updateSelectedIndex(let value, let indexPath):
print("Selected index value = \(value) at = \(indexPath)")
case .updateSwitch(let value, let indexPath):
print("Switch value = \(value) at = \(indexPath)")
case .updateSlider(let value, let indexPath):
print("Slider value = \(value) at = \(indexPath)")
case .updateStepper(let value, let indexPath):
print("Stepper value = \(value) at = \(indexPath)")
case .action(let indexPath):
print("Action at \(indexPath)")
case .didBeginEditing(let indexPath):
print("Begin editing = \(indexPath)")
case .didEndEditing(let indexPath):
print("End editing = \(indexPath)")
default:
break
}
}
}
}
//MARK: Private
private extension ViewController {
func subscribeToKeyboardNotifications() {
notificationCenter.addObserver(self,
selector: #selector(keyboardWillMove(_:)),
name: .UIKeyboardWillShow,
object: nil)
notificationCenter.addObserver(self,
selector: #selector(keyboardWillMove(_:)),
name: .UIKeyboardWillHide,
object: nil)
}
func unsubscribeFromKeyboardNotifications() {
notificationCenter.removeObserver(self,
name: .UIKeyboardWillShow,
object: nil)
notificationCenter.removeObserver(self,
name: .UIKeyboardWillHide,
object: nil)
}
func addTap() {
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(viewTapped))
tapGesture.cancelsTouchesInView = false
tableView?.addGestureRecognizer(tapGesture)
}
}
//MARK: Actions
private extension ViewController {
@objc func keyboardWillMove(_ notification: Notification) {
if notification.name == .UIKeyboardWillShow {
if let userInfo = notification.userInfo {
let keyboardFrame = userInfo[UIKeyboardFrameEndUserInfoKey] as! CGRect
var bottomPadding: CGFloat = 0
if #available(iOS 11.0, *) {
bottomPadding = UIApplication.shared.keyWindow?.safeAreaInsets.bottom ?? 0
}
tableView.contentInset.bottom = keyboardFrame.height - bottomPadding
}
}
if notification.name == .UIKeyboardWillHide {
tableView.contentInset = .zero
}
}
@objc func viewTapped() {
tableView.endEditing(true)
}
}
//MARK: UITableViewDataSource
extension ViewController: UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return SectionType.allCases.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
guard let sectionType = SectionType(rawValue: section) else { fatalError() }
switch sectionType {
case .textView,
.segmentControl,
.switch,
.slider,
.stepper,
.button:
return 1
case .textField:
return 5
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let sectionType = SectionType(rawValue: indexPath.section) else { fatalError() }
switch sectionType {
case .textView:
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: TextViewCell.self), for: indexPath) as! TextViewCell
cell.model = TextViewCell.Model(value: "", indexPath: indexPath)
cell.textChanged { [weak tableView] newText in
cell.syncText = newText
DispatchQueue.main.async {
tableView?.beginUpdates()
tableView?.endUpdates()
}
}
return cell
case .segmentControl:
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: SegmentControlCell.self), for: indexPath) as! SegmentControlCell
cell.model = SegmentControlCell.Model(value: Int.random(in: 0...2), indexPath: indexPath)
return cell
case .switch:
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: SwithCell.self), for: indexPath) as! SwithCell
cell.model = SwithCell.Model(value: Bool.random(), indexPath: indexPath)
return cell
case .slider:
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: SliderCell.self), for: indexPath) as! SliderCell
cell.model = SliderCell.Model(value: Float.random(in: 0...100), indexPath: indexPath)
return cell
case .stepper:
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: StepperCell.self), for: indexPath) as! StepperCell
cell.model = StepperCell.Model(value: Double.random(in: 0...100), indexPath: indexPath)
return cell
case .button:
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: ButtonCell.self), for: indexPath) as! ButtonCell
cell.model = ButtonCell.Model(indexPath: indexPath)
return cell
case .textField:
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: TextFieldCell.self), for: indexPath) as! TextFieldCell
cell.model = TextFieldCell.Model(value: "", indexPath: indexPath)
return cell
}
}
}
| [
-1
] |
f1e0bc7cfb1d13bdcdeaef10ebde2afeca475d85 | 7954e8a39fe16c262d34e4625c4d776d8c0c80f5 | /BookLibraryCollectionView/Extensions.swift | c6a7ec4f197efeb07d9a494d11c1352fb4426c8e | [] | no_license | luizdefranca/BookLibraryCollectionView | 173bdbfcea7314899855295d453920dc71cfc327 | 42abbc4ad9a90b12bde1eed70ad65f8d17f01593 | refs/heads/master | 2023-04-08T13:15:05.635499 | 2021-04-12T02:05:12 | 2021-04-12T02:05:12 | 351,926,443 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 482 | swift | //
// Extensions.swift
// BookLibraryCollectionView
//
// Created by Luiz on 3/26/21.
//
import UIKit
extension UIImageView {
func load(url: URL) {
DispatchQueue.global().async { [weak self] in
if let data = try? Data(contentsOf: url) {
if let image = UIImage(data: data) {
DispatchQueue.main.async {
self?.image = image
}
}
}
}
}
}
| [
-1
] |
7e8c9b9e954bb0d3bb3413c2ae5665a858f943f9 | 68d0948c0cb6bfc06c028f2c5c939861b46e1853 | /Soulwise/ViewModels/FeedsViewModel/FeedsViewModel.swift | 8b865afaae7ef5e6845da1b8abf8ffc19f0ffa45 | [] | no_license | jaganiOS222/Soulwise | a5b05c612ee7d44d1b8cc9b7e4acb8c434d847bc | aa79a614206ab14cffef840269cf53d6f4258874 | refs/heads/main | 2023-05-30T21:15:04.468526 | 2021-06-29T15:36:45 | 2021-06-29T15:36:45 | 353,712,123 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,600 | swift | //
// FeedsViewModel.swift
// Soulwise
//
// Created by apple on 02/04/21.
// Copyright © 2021 apple. All rights reserved.
//
import Foundation
class FeedsViewModel {
var itemsViewModel:[FeedsItemViewModel] = []
init(_ list:[NewsFeedList]) {
list.forEach({
itemsViewModel.append(FeedsItemViewModel.init($0))
})
}
func display() -> [TBSection] {
return self.sectionsData()
}
func headerRow(_ title:String) -> TBRow? {
let rowData = TBRowData.init()
rowData.title = title
rowData.hideHeaderIcon = true
let headerRow = TBRow.init(.feedsHeaderCell, rowData)
return headerRow
}
func sectionsData() ->[TBSection] {
var sections: [TBSection] = []
var titles:[String] = []
itemsViewModel.forEach({
if !titles.contains($0.type) {
titles.append($0.type)
}
})
titles.forEach({
sections.append(addingSection($0))
})
return sections
}
func addingSection(_ type:String) -> TBSection {
let section = TBSection.init(nil, [])
itemsViewModel.forEach({
if type == $0.type {
if let tbRows = $0.display() {
section.rows.append(contentsOf: tbRows)
}
}
})
if let header = self.headerRow(type) {
if section.rows.count > 0 {
section.rows.insert(header, at: 0)
}
}
return section
}
}
| [
-1
] |
00d70c268a2b8cd50e11887b84beae477217098b | 7378adc735ce254a68380376ba375d364f99e8fb | /PlaylistCoreData2/Models/Playlist+Convenience.swift | fd199ffb483b265bff8522a94e1adfb671fe2ae1 | [] | no_license | v0armd9/PlaylistCoreData2 | 95878da59ab3da98fc809f6ed1a144a41ec6ae68 | 5bc4954ddf2cb56f404b4d011699503bbebb4c3e | refs/heads/master | 2020-06-06T14:43:06.441534 | 2019-06-19T20:30:16 | 2019-06-19T20:30:16 | 192,767,558 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 423 | swift | //
// Playlist+Convenience.swift
// PlaylistCoreData2
//
// Created by Darin Marcus Armstrong on 6/19/19.
// Copyright © 2019 Darin Marcus Armstrong. All rights reserved.
//
import Foundation
import CoreData
extension Playlist {
@discardableResult
convenience init(name: String, context: NSManagedObjectContext = CoreDataStack.context) {
self.init(context: context)
self.name = name
}
}
| [
-1
] |
971b5ff536f6773f973020fdde301cebd110c792 | 86c3bec46a7ce93a81dc9640225a0ca956fa9e81 | /ShapeGameUITests/ShapeGameUITests.swift | 1a5d3fdcc1b67cc0465fedf5ca4fab4ae460b71d | [] | no_license | ImEric/ShapeGame | ae37af15751236bfecdb70dc69475e83a5bb253e | 3596c4ae9a58fd75a39d923a3f99604db6c0898d | refs/heads/master | 2021-01-10T16:29:43.401122 | 2015-10-14T06:41:34 | 2015-10-14T06:41:34 | 44,039,038 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,240 | swift | //
// ShapeGameUITests.swift
// ShapeGameUITests
//
// Created by ERIC on 10/10/15.
// Copyright © 2015 Eric Hu. All rights reserved.
//
import XCTest
class ShapeGameUITests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
| [
333827,
243720,
282634,
313356,
155665,
305173,
237599,
241695,
223269,
229414,
292901,
354342,
315433,
102441,
278571,
313388,
325675,
124974,
282671,
354346,
229425,
102446,
243763,
241717,
229431,
180279,
215095,
319543,
213051,
288829,
325695,
288835,
286787,
307269,
237638,
313415,
239689,
233548,
311373,
315468,
278607,
333902,
311377,
354386,
196687,
280660,
223317,
315477,
329812,
354394,
200795,
323678,
315488,
321632,
45154,
315489,
280676,
280674,
313446,
227432,
215144,
307306,
194667,
233578,
278637,
260206,
319599,
288878,
278642,
284789,
131190,
284790,
288890,
292987,
215165,
131199,
374913,
227459,
194692,
280708,
415883,
278669,
235661,
241809,
323730,
278676,
311447,
153752,
327834,
284827,
278684,
329884,
192670,
299166,
278690,
311459,
233635,
215204,
284840,
299176,
278698,
284843,
184489,
278703,
184498,
278707,
125108,
278713,
223418,
280761,
180409,
295099,
299197,
280767,
258233,
227517,
299202,
139459,
309443,
176325,
131270,
301255,
227525,
299208,
280779,
282832,
227536,
321744,
301270,
229591,
385240,
301271,
280792,
311520,
325857,
334049,
280803,
307431,
182503,
319719,
295147,
317676,
286957,
125166,
125170,
313595,
125180,
184574,
309504,
125184,
217352,
125192,
125197,
194832,
227601,
325904,
125200,
125204,
278805,
319764,
334104,
282908,
311582,
299294,
282912,
125215,
233761,
278817,
211239,
282920,
125225,
317738,
311596,
321839,
315698,
98611,
125236,
332084,
282938,
307514,
278843,
168251,
287040,
319812,
280903,
227655,
319816,
323914,
201037,
282959,
229716,
289109,
168280,
379224,
323934,
391521,
239973,
381286,
285031,
313703,
416103,
280938,
242027,
242028,
321901,
278895,
354671,
287089,
199030,
227702,
315768,
291193,
291194,
223611,
248188,
315769,
313726,
311679,
291200,
211327,
139641,
240003,
158087,
313736,
227721,
242059,
311692,
227730,
285074,
240020,
190870,
315798,
190872,
291225,
317851,
285083,
293275,
389534,
242079,
227743,
285089,
293281,
289185,
305572,
283039,
300490,
156069,
301482,
311723,
289195,
377265,
338359,
299449,
311739,
319931,
293309,
278974,
311744,
317889,
291266,
278979,
326083,
278988,
289229,
281038,
326093,
278992,
283089,
281039,
283088,
279000,
176602,
242138,
160224,
279009,
291297,
285152,
195044,
369121,
279014,
242150,
319976,
279017,
188899,
311787,
281071,
319986,
236020,
279030,
311800,
279033,
317949,
279042,
283138,
233987,
287237,
377352,
322057,
309770,
342537,
279053,
283154,
303634,
279060,
279061,
182802,
303635,
279066,
188954,
322077,
291359,
227881,
293420,
236080,
283185,
289328,
279092,
23093,
234037,
244279,
244280,
338491,
301635,
309831,
55880,
377419,
281165,
303693,
301647,
281170,
416340,
326229,
309847,
189016,
115287,
287319,
332379,
111197,
295518,
287327,
260705,
242274,
244326,
279143,
277095,
279150,
281200,
287345,
313970,
287348,
301688,
244345,
189054,
303743,
297600,
287359,
291455,
301702,
164487,
311944,
279176,
334473,
316044,
311948,
311950,
184974,
316048,
311953,
316050,
287379,
326288,
295575,
227991,
289435,
303772,
205469,
221853,
285348,
314020,
279207,
295591,
295598,
279215,
285360,
318127,
285362,
299698,
287412,
166581,
248494,
154295,
293552,
164532,
303802,
314043,
287418,
66243,
291529,
287434,
225996,
363212,
287438,
279249,
303826,
242385,
279253,
158424,
230105,
299737,
363228,
322269,
342757,
295653,
289511,
230120,
330473,
234216,
285419,
330476,
289517,
279278,
312046,
170735,
215790,
125683,
230133,
199415,
234233,
242428,
279293,
205566,
322302,
289534,
299777,
291584,
228099,
285443,
291591,
295688,
322312,
285450,
264971,
312076,
326413,
322320,
285457,
295698,
291605,
166677,
283418,
285467,
326428,
221980,
281378,
234276,
283431,
203560,
279337,
262952,
262953,
293673,
289580,
262957,
164655,
301872,
242481,
234290,
303921,
318251,
285493,
230198,
328495,
285496,
301883,
201534,
289599,
281407,
416577,
295745,
222017,
342846,
293702,
318279,
283466,
281426,
279379,
295769,
234330,
201562,
244569,
281434,
322396,
230239,
301919,
279393,
293729,
230238,
281444,
303973,
279398,
275294,
349025,
351078,
177002,
308075,
242540,
310132,
295797,
228214,
207735,
201590,
295799,
279418,
269179,
177018,
308093,
314240,
392065,
158594,
291713,
240517,
287623,
228232,
299912,
320394,
279434,
316299,
416649,
234382,
252812,
308111,
308113,
390034,
189327,
293780,
310166,
289691,
209820,
277404,
240543,
283551,
310177,
289699,
189349,
289704,
279465,
293801,
326571,
304050,
177074,
326580,
289720,
326586,
289723,
189373,
213956,
281541,
19398,
345030,
213961,
279499,
56270,
191445,
304086,
183254,
183258,
234469,
142309,
314343,
304104,
324587,
234476,
183276,
289773,
257007,
320492,
203758,
287730,
320495,
277493,
240631,
320504,
214009,
312313,
312317,
328701,
328705,
234499,
293894,
320520,
322571,
230411,
320526,
330766,
234513,
238611,
140311,
293911,
238617,
197658,
316441,
132140,
113710,
189487,
281647,
322609,
312372,
203829,
238646,
300087,
238650,
320571,
21567,
308288,
336962,
160834,
314437,
349254,
238663,
300109,
234578,
207954,
296023,
205911,
314458,
156763,
234588,
277600,
281698,
281699,
285795,
214116,
230500,
322664,
228457,
279659,
318571,
234606,
300145,
230514,
238706,
187508,
312435,
279666,
300147,
302202,
285819,
314493,
384127,
285823,
150656,
234626,
279686,
222344,
285833,
285834,
234635,
318602,
337037,
228492,
177297,
162962,
187539,
326803,
308375,
324761,
285850,
296091,
119965,
234655,
300192,
302239,
339106,
306339,
330912,
234662,
300200,
302251,
208044,
238764,
249003,
322733,
3243,
279729,
294069,
300215,
294075,
64699,
228541,
283841,
148674,
283846,
312519,
279752,
283849,
148687,
290001,
189651,
316628,
279766,
189656,
279775,
304352,
298209,
304353,
310496,
279780,
228587,
279789,
290030,
302319,
253168,
251124,
316661,
283894,
234741,
208123,
292092,
279803,
228608,
320769,
234756,
322826,
242955,
312588,
177420,
318732,
380178,
126229,
318746,
245018,
320795,
239610,
320802,
130342,
304422,
130344,
292145,
298290,
312628,
300342,
159033,
333114,
222523,
333115,
286012,
181568,
279872,
279874,
300355,
294210,
216387,
286019,
193858,
300354,
304457,
230730,
372039,
294220,
296269,
222542,
224591,
234830,
238928,
296274,
314708,
318804,
283990,
314711,
357720,
300378,
300379,
294236,
316764,
314721,
292194,
230757,
281958,
314727,
134504,
306541,
327023,
296304,
234864,
312688,
316786,
314740,
230772,
327030,
284015,
314742,
310650,
290170,
224637,
306558,
290176,
306561,
179586,
243073,
314752,
294278,
314759,
296328,
296330,
298378,
368012,
318860,
314765,
304523,
292242,
279955,
306580,
112019,
224662,
234902,
282008,
314776,
314771,
253339,
318876,
282013,
290206,
148899,
314788,
298406,
282023,
314790,
245160,
333224,
279979,
279980,
241067,
314797,
286128,
359860,
173492,
279988,
286133,
284086,
284090,
302523,
228796,
310714,
54719,
302530,
280003,
228804,
310725,
306630,
292291,
300488,
415170,
306634,
370122,
310731,
280011,
302539,
310735,
234957,
339403,
222674,
329168,
280020,
327122,
329170,
312785,
280025,
310747,
239069,
144862,
286176,
187877,
310758,
320997,
280042,
280043,
191980,
329198,
337391,
300526,
282097,
308722,
296434,
306678,
40439,
288248,
191991,
286201,
300539,
288252,
312830,
290304,
286208,
245249,
228868,
292359,
218632,
323079,
302602,
230922,
323083,
294413,
304655,
323088,
329231,
282132,
230933,
253462,
282135,
302613,
374297,
316951,
302620,
313338,
282147,
222754,
306730,
245291,
312879,
230960,
288305,
239159,
290359,
323132,
235069,
157246,
288319,
130622,
288322,
280131,
349764,
310853,
282182,
124486,
288328,
194118,
292426,
286281,
333389,
224848,
224852,
290391,
128600,
235096,
239192,
306777,
230999,
196184,
212574,
345697,
204386,
300643,
300645,
282214,
312937,
224874,
243306,
204394,
312941,
206447,
310896,
314997,
294517,
290425,
288377,
325246,
333438,
235136,
280193,
282244,
239238,
288391,
282248,
286344,
323208,
179853,
286351,
188049,
229011,
239251,
280217,
323226,
179868,
229021,
318247,
302751,
282272,
198304,
282279,
298664,
212649,
298666,
317102,
286387,
300725,
337590,
286392,
300729,
302778,
306875,
280252,
280253,
282302,
296636,
286400,
323265,
323262,
280259,
321217,
282309,
321220,
333508,
239305,
280266,
306891,
296649,
212684,
302798,
9935,
241360,
282321,
313042,
286419,
241366,
280279,
278232,
282330,
18139,
280285,
294621,
278237,
282336,
278241,
321250,
294629,
153318,
333543,
181992,
12009,
337638,
282347,
288492,
282349,
34547,
67316,
323315,
286457,
284410,
200444,
288508,
282366,
286463,
319232,
278273,
288515,
280326,
323335,
282375,
284425,
300810,
409355,
282379,
216844,
284430,
116491,
280333,
161553,
300812,
124691,
284436,
278292,
278294,
282390,
116502,
118549,
325403,
321308,
321309,
282399,
241440,
282401,
325411,
315172,
186149,
186148,
241447,
362281,
333609,
286507,
284460,
294699,
280367,
300849,
282418,
280373,
282424,
280377,
321338,
319289,
282428,
280381,
345918,
413500,
241471,
280386,
315431,
280391,
153416,
315209,
325449,
342705,
280396,
159563,
307024,
317268,
237397,
307030,
18263,
241494,
188250,
284508,
300893,
307038,
237411,
284515,
276326,
282471,
296807,
292713,
282476,
292719,
296815,
313200,
325491,
313204,
333687,
317305,
124795,
317308,
339840,
315265,
280451,
253828,
327556,
188293,
282503,
67464,
315272,
325514,
243592,
305032,
315275,
243590,
311183,
184207,
124816,
282517,
294806,
214936,
294808,
337816,
239515,
124826,
214943,
298912,
319393,
333727,
294820,
333734,
219046,
284584,
294824,
298921,
313257,
253868,
292783,
126896,
200628,
300983,
343993,
288698,
98240,
294849,
214978,
280517,
280518,
214983,
282572,
282573,
153553,
24531,
231382,
329696,
323554,
292835,
6116,
190437,
292838,
294887,
317416,
313322,
278507,
298987,
311277,
296942,
329707,
124912,
327666,
278515,
325620,
380922
] |
4e04e702067228308da3b430292414e2cea3e50a | fc9cbbf463b1e95e866790b66ae31dd7ac2bf8aa | /Atlas/Basket/View/CheckoutView.swift | a8c978e4657ce0ba50fa4e0f2880d4d9e3dfbc8f | [] | no_license | Nusmailov/Atlas | 6c6a3fea3c1812d4fd5665db5c35d0e61ebf9df1 | 24f29acdd4d3caba4b350f6863adfb21c7f6ca19 | refs/heads/master | 2020-12-22T08:36:39.677582 | 2020-03-02T06:02:13 | 2020-03-02T06:02:13 | 236,727,949 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,244 | swift | //
// CheckoutView.swift
// Atlas
//
// Created by Nurzhigit Smailov on 2/5/20.
// Copyright © 2020 Eldor Makkambayev. All rights reserved.
//
import UIKit
protocol CalendarDoOrderDelegate: class {
func isHidden(state: Bool)
}
class CheckoutView: UIView {
//MARK: - Properties
lazy var paymentType: CheckoutInfoView = {
let view = CheckoutInfoView()
view.dropView.dataSource = ["Самовывоз"]
view.button.setTitle(" Самовывоз", for: .normal)
return view
}()
lazy var typeOrderView: CheckoutInfoView = {
let view = CheckoutInfoView()
view.dropView.dataSource = ["Предзаказ", "Бронирование", "Заказ с хранением", "Обычный заказ"]
view.titleLabel.text = "Тип заказа"
// view.button.setTitle(" Обычный заказ", for: .normal)
view.delegate = self
return view
}()
lazy var dateSelectView: CheckoutInfoView = {
let view = CheckoutInfoView()
view.titleLabel.text = "Дата подготовки заказа"
return view
}()
lazy var descriptionLabel: UILabel = {
let label = UILabel()
label.text = "Обычный заказ - после Оформления заказа, необходимо провести оплату и организовать самовывоз."
label.textColor = UIColor(red: 0.318, green: 0.361, blue: 0.435, alpha: 1)
label.font = .getMontserraRegularFont(on: 13)
label.numberOfLines = 0
return label
}()
lazy var addressView: AddressView = {
let view = AddressView()
return view
}()
lazy var contactView: ContactView = {
let view = ContactView()
return view
}()
lazy var totalTextLabel: UILabel = {
let label = UILabel()
label.text = "Итого:"
label.textColor = UIColor(red: 0.318, green: 0.361, blue: 0.435, alpha: 1)
label.font = .getMontserraBoldFont(on: 15)
return label
}()
lazy var totalPriceLabel: UILabel = {
let label = UILabel()
label.text = "0₸"
label.textColor = UIColor(red: 0.318, green: 0.361, blue: 0.435, alpha: 1)
label.font = .getMontserraBoldFont(on: 18)
return label
}()
lazy var realizeButton: ContinueButton = {
let button = ContinueButton()
button.setTitle("Заказать", for: .normal)
button.layer.cornerRadius = 10
return button
}()
weak var calendarDelegate: CalendarDoOrderDelegate?
//MARK: - Init
override init(frame: CGRect) {
super.init(frame: frame)
setupViews()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
//MARK: - SetupViews
func setupViews() {
addSubviews(views: [paymentType, typeOrderView, addressView, descriptionLabel,
dateSelectView, contactView, totalTextLabel, totalPriceLabel,
realizeButton])
paymentType.snp.makeConstraints { (make) in
make.top.left.equalTo(16)
make.right.equalTo(-16)
}
typeOrderView.snp.makeConstraints { (make) in
make.top.equalTo(paymentType.snp.bottom).offset(16)
make.left.equalTo(16)
make.right.equalTo(-16)
}
descriptionLabel.snp.makeConstraints { (make) in
make.top.equalTo(typeOrderView.snp.bottom).offset(16)
make.left.equalTo(16)
make.right.equalTo(-16)
}
dateSelectView.snp.makeConstraints { (make) in
make.top.equalTo(descriptionLabel.snp.bottom).offset(16)
make.left.equalTo(16)
make.right.equalTo(-16)
}
addressView.snp.makeConstraints { (make) in
make.top.equalTo(dateSelectView.snp.bottom).offset(16)
make.left.equalTo(16)
make.right.equalTo(-16)
}
contactView.snp.makeConstraints { (make) in
make.top.equalTo(addressView.snp.bottom).offset(16)
make.left.equalTo(16)
make.right.equalTo(-16)
}
totalTextLabel.snp.makeConstraints { (make) in
make.top.equalTo(contactView.snp.bottom).offset(16)
make.left.equalTo(16)
make.right.equalTo(-16)
}
totalPriceLabel.snp.makeConstraints { (make) in
make.top.equalTo(totalTextLabel.snp.bottom).offset(4)
make.left.equalTo(16)
make.right.equalTo(-16)
}
realizeButton.snp.makeConstraints { (make) in
make.top.equalTo(totalPriceLabel.snp.bottom).offset(16)
make.left.equalTo(16)
make.height.equalTo(60)
make.right.bottom.equalTo(-16)
}
}
}
//MARK: - SelectTypeOrderDelegate
extension CheckoutView: SelectTypeOrderDelegate {
func showHide(state: Bool) {
if state {
UIView.animate(withDuration: .init(floatLiteral: 0.5)) {
self.dateSelectView.alpha = 1
self.dateSelectView.snp.remakeConstraints { (make) in
make.top.equalTo(self.descriptionLabel.snp.bottom).offset(16)
make.left.equalTo(16)
make.right.equalTo(-16)
}
self.addressView.snp.remakeConstraints { (make) in
make.top.equalTo(self.dateSelectView.snp.bottom).offset(16)
make.left.equalTo(16)
make.right.equalTo(-16)
}
}
} else {
UIView.animate(withDuration: .init(floatLiteral: 0.5)) {
self.dateSelectView.alpha = 0
self.addressView.snp.remakeConstraints { (make) in
make.top.equalTo(self.descriptionLabel.snp.bottom).offset(16)
make.left.equalTo(16)
make.right.equalTo(-16)
}
}
}
calendarDelegate?.isHidden(state: state)
}
func changeText(text: String) {
descriptionLabel.text = text
}
}
| [
-1
] |
16adbbfcfacb15970f1cce6c336d1b8797bfeee7 | 6564222ad9c324c4b1c08ee2cc875a8cca591d60 | /PureCloudApi/Classes/Models/ININServiceEntityListing.swift | 6c78a9c90dc8cc1504c0a0787f2a904d710e7be3 | [
"MIT"
] | permissive | atull/purecloud_api_sdk_ios | 88eaeb0178cc8729643a49eaa831098b646daba3 | e086556d0f7c47b9438e00a043f7e5bbac7bd685 | refs/heads/master | 2020-12-24T09:38:21.359249 | 2016-06-30T10:42:00 | 2016-06-30T10:42:00 | 73,276,924 | 0 | 0 | null | 2016-11-09T11:10:18 | 2016-11-09T11:10:18 | null | UTF-8 | Swift | false | false | 1,434 | swift | //
// ININServiceEntityListing.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
public class ININServiceEntityListing: JSONEncodable {
public var pageSize: Int32?
public var pageNumber: Int32?
public var total: Int64?
public var entities: [ININService]?
public var selfUri: String?
public var previousUri: String?
public var firstUri: String?
public var nextUri: String?
public var lastUri: String?
public var pageCount: Int32?
public init() {}
// MARK: JSONEncodable
func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]()
nillableDictionary["pageSize"] = self.pageSize?.encodeToJSON()
nillableDictionary["pageNumber"] = self.pageNumber?.encodeToJSON()
nillableDictionary["total"] = self.total?.encodeToJSON()
nillableDictionary["entities"] = self.entities?.encodeToJSON()
nillableDictionary["selfUri"] = self.selfUri
nillableDictionary["previousUri"] = self.previousUri
nillableDictionary["firstUri"] = self.firstUri
nillableDictionary["nextUri"] = self.nextUri
nillableDictionary["lastUri"] = self.lastUri
nillableDictionary["pageCount"] = self.pageCount?.encodeToJSON()
let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary
}
}
| [
-1
] |
82504e74cf5acb4eee088294ecd94f3c5b572e4b | 57649f5d0c96c5464f19b1294a4539488fb563bd | /Recipe.swift | 371954a525d93fb27944350d483b6de089b68547 | [] | no_license | jap99/FoodRecipes | 16b9d58cda5f63d29480f044a9a6402c37eebb9a | 375548186f8f35e61a4d7ac92c0306ad897cfb5f | refs/heads/master | 2021-05-30T20:00:10.251206 | 2016-03-10T09:37:42 | 2016-03-10T09:37:42 | 53,117,534 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 484 | swift | //
// Recipe.swift
// ProjectGrasshopper
//
// Created by Javid Poornasir on 3/5/16.
// Copyright © 2016 Javid Poornasir. All rights reserved.
//
import Foundation
import CoreData
import UIKit
class Recipe: NSManagedObject {
func setRecipeImage(img: UIImage) {
let data = UIImagePNGRepresentation(img)
self.image = data
}
func getRecipeImg() -> UIImage {
let img = UIImage(data: self.image!)!
return img
}
}
| [
-1
] |
0a1e89226810438c7158574ae96985453078829b | 4ab14e428a51b803b8089ad11c91109f75849aea | /vpd-ios-master/VPD/Controller/DashBoard/Home/FundWalletViewController.swift | a7da49ba2e3fd934ede2238c0f327910bb6bee8c | [] | no_license | iyykee01/VPD1.3 | c4d6f35aa42e0b2848bb58035182bb4be6364979 | 968cafc1a3f9e4052085c308374ab1f709fb8daa | refs/heads/main | 2023-04-10T12:00:23.903552 | 2021-04-13T08:34:30 | 2021-04-13T08:34:30 | 357,480,201 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 12,742 | swift |
// FundWalletViewController.swift
// VPD
//
// Created by Ikenna Udokporo on 09/07/2019.
// Copyright © 2019 voguepay. All rights reserved.
//
import UIKit
import Alamofire
import SwiftyJSON
class FundWalletViewController: UIViewController, UITextFieldDelegate, seguePerform {
@IBOutlet var viewWrapper: UIView!
@IBOutlet weak var zeroViewWrap: UIView!
@IBOutlet weak var zeroTextField: UITextField!
@IBOutlet weak var dropDownButton: UIButton!
@IBOutlet weak var selectPayementVIew: DesignableView!
@IBOutlet weak var currencyLabel: UILabel!
@IBOutlet weak var currencyBalanceLabel: UILabel!
@IBOutlet weak var currencyWallet: UILabel!
@IBOutlet weak var stackMultiplier: NSLayoutConstraint!
var walletID = ""
var currency = ""
var balance = ""
var userInputAmount = ""
var account_no = ""
var holder = ""
var reference = ""
var bank = ""
var amt: Int = 0
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
zeroTextField.delegate = self
zeroTextField.attributedPlaceholder = NSAttributedString(string: updateAmount()!,
attributes: [NSAttributedString.Key.foregroundColor: UIColor.white])
// zeroTextField.placeholder = updateAmount()
print(currency, walletID)
zeroTextField.startBlink()
currencyLabel.text = currency
currencyWallet.text = "\(currency) Wallet"
currencyBalanceLabel.text = "\(currency) \(balance)"
//***********Setting up Date Picker********************//
let toolBar = UIToolbar()
toolBar.barStyle = UIBarStyle.default
toolBar.isTranslucent = true
toolBar.tintColor = .black
toolBar.sizeToFit()
let doneButton = UIBarButtonItem(title: "Done", style: UIBarButtonItem.Style.done, target: self, action: #selector(self.donePicker))
let spaceButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.flexibleSpace, target: nil, action: nil)
let cancelButton = UIBarButtonItem(title: "Cancel", style: UIBarButtonItem.Style.plain, target: self, action: #selector(self.donePicker))
toolBar.setItems([cancelButton, spaceButton, doneButton], animated: false)
zeroTextField.inputAccessoryView = toolBar
let tap = UITapGestureRecognizer(target: self, action: #selector(self.handleTap(_:)))
viewWrapper.addGestureRecognizer(tap)
}
//***********Method to handle date format and date dismiss*********//
@objc func donePicker() {
zeroTextField.resignFirstResponder()
}
func updateAmount() -> String? {
let formatter = NumberFormatter()
formatter.numberStyle = .currency
formatter.currencySymbol = ""
let amount = Double(amt/100) + Double(amt%100)/100
return formatter.string(from: NSNumber(value: amount))
}
@objc func handleTap(_ sender: UITapGestureRecognizer? = nil) {
view.endEditing(true)
}
func textFieldDidBeginEditing(_ textField: UITextField) {
zeroTextField.stopBlink()
}
//MARK: - Textfield delegate method
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
let splited_text = zeroTextField.text!.split(separator: ",")
userInputAmount = String(splited_text[0])
zeroTextField.resignFirstResponder()
if zeroTextField.text == "" {
zeroTextField.startBlink()
}
view.endEditing(true)
return false
}
//MARK: -Delay function @if token is true move to next//
func delayToNextPage() {
/******Import and initialize Util Class*****////
let utililty = UtilClass()
let device = utililty.getPhoneId()
//print("shaDevicePpties")
let timeInSeconds: TimeInterval = Date().timeIntervalSince1970
let timeInSecondsToString = String(timeInSeconds)
let session = UserDefaults.standard.string(forKey: "SessionID")!
let customer_id = UserDefaults.standard.string(forKey: "CustomerID")!
//******getting parameter from string
let params = ["AppID":device.sha512,"language":"en","RequestID": timeInSecondsToString, "SessionID": session, "CustomerID": customer_id, "amount": userInputAmount, "WalletID": walletID, "currency": currency, "fund_type": "bank"]
let jsonEncode = JSONEncoder()
let jsonData = try! jsonEncode.encode(params)
let json = String(data: jsonData, encoding: .utf8)!
///*********converting shaDeivcepptiies to hexString*********////////
/////*********converting shaDeivcepptiies to hexString*********////////
let hexShaDevicePpties = utililty.convertToHexString(json)
print(hexShaDevicePpties)
let parameter = ["reqData": hexShaDevicePpties]
let token = UserDefaults.standard.string(forKey: "Token")!
let headers: HTTPHeaders = ["X-Authorization": token, "AppGroup": "IOS"]
let url = "\(utililty.url)wallet_funding"
postData(url: url, parameter: parameter, token: token, header: headers)
}
///////////***********Post Data MEthod*********////////
func postData(url: String, parameter: [String: String], token: String, header: [String: String]) {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { // Change `2.0` to the desired number of seconds.
// Code you want to be delayed
let loader = LoaderPopup()
let loaderVC = loader.Loader()
self.present(loaderVC, animated: true)
}
Alamofire.request(url, method: .post, parameters: parameter, headers: header).responseJSON {
response in
if response.result.isSuccess {
print("SUCCESSFUL.....")
//******Getting Data******//
let data: JSON = JSON(response.result.value!)
//****Decode json hear****/
let hexKey = data["reqResponse"].stringValue
/******Import and initialize Util Class*****////
let utililty = UtilClass()
//********decripting Hex key**********//
let decriptor = utililty.convertHexStringToString(text: hexKey)
//**********Changing Data back to Json format***///
let jsonData = decriptor.data(using: .utf8)!
let decriptorJson: JSON = JSON(jsonData)
print(decriptorJson)
let decriptorJsonResponse = decriptorJson["response"]
let status = decriptorJson["status"].boolValue
let message = decriptorJson["message"][0].stringValue
if status {
//********Response from server *******//
self.dismiss(animated: true, completion: nil)
self.account_no = decriptorJsonResponse["account_no"].stringValue
self.holder = decriptorJsonResponse["holder"].stringValue
self.reference = decriptorJsonResponse["reference"].stringValue
self.bank = decriptorJsonResponse["bank"].stringValue
self.performSegue(withIdentifier: "goToBackTransfer", sender: self)
}
else if (message == "Session has expired") {
self.navigationController?.popToViewController(ofClass: LoginViewController.self)
}
else {
self.dismiss(animated: true, completion: nil)
////From the alert Service
let alertService = AlertService()
let alertVC = alertService.alert(alertMessage: message)
self.present(alertVC, animated: true)
}
}
else {
self.dismiss(animated: true, completion: nil)
////From the alert Service
let alertService = AlertService()
let alertVC = alertService.alert(alertMessage: "Network Error")
self.present(alertVC, animated: true)
}
}
}
func goNext(next: String) {
if next == "goToBackTransfer" {
//Call api
delayToNextPage()
return
}
else {
performSegue(withIdentifier: next, sender: self)
}
}
func validate() {
userInputAmount = zeroTextField.text!.split(separator: ",").joined()
if (zeroTextField.text != "") && Double(userInputAmount)! < 100 {
let alertService = AlertService()
let alertVC = alertService.alert(alertMessage: "Minimum amount for transaction is 100")
self.present(alertVC, animated: true)
}
if(zeroTextField.text == ""){
self.showToast(message: "Please enter an amount", font: UIFont(name: "Muli", size: 14)!)
}
else {
view.endEditing(true)
zeroTextField.resignFirstResponder()
performSegue(withIdentifier: "goToFundWalletPopUp", sender: self)
}
}
//MARK - ADD Comma to Text
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if let digit = Int(string) {
amt = amt * 10 + digit
zeroTextField.text = updateAmount()
}
if string == "" {
amt = amt/10
zeroTextField.text = updateAmount()
}
return false
}
override func viewWillAppear(_ animated: Bool) {
selectPayementVIew.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(viewWasTapped)))
zeroViewWrap.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(textFieldTapped)))
}
@objc func textFieldTapped(sender: UIGestureRecognizer) {
zeroTextField.becomeFirstResponder()
}
@objc func viewWasTapped (sender : UITapGestureRecognizer) {
self.validate()
}
//MARK: - DropDown Button
@IBAction func dropDownButtonPressed(_ sender: Any) {
self.validate()
}
// MARK - Prepare for segue
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "goToCard" {
let destinationVC = segue.destination as! DebitCreditCardViewController
destinationVC.walletID = walletID
destinationVC.amount = userInputAmount
destinationVC.currency = currency
}
if segue.identifier == "goStraightToCard" {
let destinationVC = segue.destination as! WalletFundingWithCardViewController
destinationVC.walletID = walletID
destinationVC.amount = userInputAmount
destinationVC.currency = currency
}
if segue.identifier == "goToFundWalletPopUp" {
let destinationVC = segue.destination as! FundWalletPopupViewController
destinationVC.delegate = self
}
if segue.identifier == "goToBackTransfer" {
let destination = segue.destination as! BankTransferViewController
destination.account_no = account_no
destination.holder = holder
destination.reference = reference
destination.bank = bank
}
if segue.identifier == "goToSelectBank" {
let destination = segue.destination as! FundWalletLoaderViewController
destination.walletID = walletID
destination.amount = userInputAmount
destination.currency = currency
}
}
@IBAction func backButtonPressed(_ sender: Any) {
navigationController?.popViewController(animated: true)
}
}
| [
-1
] |
02835bdcc2662fe2c0704705618273123b4c03e4 | bf13495c70c89a4d8b802cfb7bc0c8a78bccc885 | /StetsonScene/TrendingView.swift | 81bb08f96d36f2c5e5bcb14ad0bd8cddd9b7058e | [] | no_license | ldhough/Stetson-Scene | b8ac4c720fcd6d3879ff27caa2289a312cfc7f84 | a6cedbbe286d91294e9064f46525ebc628dad258 | refs/heads/master | 2023-03-13T06:20:36.862851 | 2020-08-23T17:24:35 | 2020-08-23T17:24:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 16,965 | swift | //
// TrendingView.swift
// StetsonScene
//
// Created by Madison Gipson on 7/15/20.
// Copyright © 2020 Madison Gipson. All rights reserved.
//
import Foundation
import SwiftUI
import CoreLocation
struct TrendingView : View {
@ObservedObject var evm:EventViewModel
@EnvironmentObject var config: Configuration
@State var card = 0
@Binding var page:String
@Binding var subPage:String
var body: some View {
VStack {
Text("Trending").fontWeight(.heavy).font(.system(size: 50)).frame(maxWidth: .infinity, alignment: .leading).foregroundColor(Color.label).padding([.vertical, .horizontal]).padding(.bottom, 10)
//Announcements
Text("ANNOUNCEMENTS").fontWeight(.medium).font(.system(size: 25)).padding([.horizontal]).frame(maxWidth: .infinity, alignment: .leading).foregroundColor(config.accent)
Text("Important announcements will go here, they'll probably be updates about things going on on-campus.").fontWeight(.light).font(.system(size: 20)).padding(.vertical, 5).padding([.horizontal]).frame(maxWidth: .infinity, alignment: .leading).foregroundColor(Color.label)
//Carousel List- using GeomtryReader to detect the remaining height on the screen (smart scaling)
GeometryReader{ geometry in
Carousel(evm: self.evm, trendingList: self.trendingList(), card: self.$card, height: geometry.frame(in: .global).height, page: self.$page, subPage: self.$subPage)
}
//dots that show which card is being displayed
CardControl(trendingList: self.trendingList(), card: self.$card, page: self.$page, subPage: self.$subPage).padding(.bottom, 10)
}
}
func trendingList() -> [EventInstance] {
let recEngine = RecommendationEngine(evm: self.evm)
let list = recEngine.runEngine()
return list
}
}
//CAROUSEL: UIView that embeds the Cards SwiftUI View
//Uses a UIScrollView to detect card offset and tells the UIView when the card changes through @Binding card
//@Binding card then updates in the rest of the structs that use it so the correct card is displayed
struct Carousel : UIViewRepresentable {
@ObservedObject var evm:EventViewModel
var trendingList: [EventInstance]
@Binding var card : Int
var height : CGFloat
@Binding var page:String
@Binding var subPage:String
//create and update the Carousel UIScrollView
func makeUIView(context: Context) -> UIScrollView{
//create a scrollview to hold cards
let scrollview = UIScrollView()
let carouselWidth = Constants.width * CGFloat(trendingList.count)
scrollview.contentSize = CGSize(width: carouselWidth, height: 1.0) //setting height to 1.0 disables verical scroll
scrollview.isPagingEnabled = true
scrollview.bounces = true
scrollview.showsVerticalScrollIndicator = false
scrollview.showsHorizontalScrollIndicator = false
scrollview.delegate = context.coordinator
//make the Card SwiftUI View into a UIView (essentially)
let uiCardView = UIHostingController(rootView: Cards(evm: self.evm, trendingList: trendingList, height: height*0.9, page: self.$page, subPage: self.$subPage))
uiCardView.view.frame = CGRect(x: 0, y: 0, width: carouselWidth, height: self.height)
uiCardView.view.backgroundColor = .clear
//add the uiCardView as a subview of the scrollview
//(effectively embeds the Cards SwiftUI View into the Carousel UIScrollView)
scrollview.addSubview(uiCardView.view)
return scrollview
}
func updateUIView(_ uiView: UIScrollView, context: Context) {}
//give the Carousel UIScrollView a Coordinator to handle scrolling and changing cards
func makeCoordinator() -> Coordinator {
return Carousel.Coordinator(parent: self)
}
class Coordinator : NSObject, UIScrollViewDelegate {
var carousel : Carousel
init(parent: Carousel) {
carousel = parent
}
//get current page
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
let card = Int(scrollView.contentOffset.x / Constants.width)
self.carousel.card = card
}
}
}
//CARDS: create a card for each event in the list
struct Cards : View {
@ObservedObject var evm:EventViewModel
@EnvironmentObject var config: Configuration
var trendingList: [EventInstance]
var height : CGFloat
let cardWidth = Constants.width*0.9
@State var selectedEvent: EventInstance? = nil
@Binding var page:String
@Binding var subPage:String
//context menu
@State var detailView: Bool = false
@State var share: Bool = false
@State var calendar: Bool = false
@State var fav: Bool = false
@State var navigate: Bool = false
//for alerts
@State var internalAlert: Bool = false
@State var externalAlert: Bool = false
@State var tooFar: Bool = false
@State var arrived: Bool = false
@State var eventDetails: Bool = false
@State var isVirtual: Bool = false
var body: some View {
//horizontal list of events in list
HStack(spacing: 0) {
ForEach(trendingList) { event in
//area around the card (whole screen width)
VStack {
//card view
ZStack {
//Background Image
self.evm.buildingModelController.getImage(evm: self.evm, eventLocation: event.location).resizable().aspectRatio(contentMode: .fill).frame(width: self.cardWidth, height: self.height).cornerRadius(20)
//Layer over image
VStack {
//Spacer
VStack {
Spacer()
}.frame(width: self.cardWidth, height: self.height*0.6)
//Text
VStack (alignment: .leading) {
Text(event.name).fontWeight(.medium).font(.system(size: 30)).padding(.top, 10).foregroundColor(event.hasCultural ? self.config.accent : Color.label)
//TODO: CHANGE DATESTRING TO MONTH + DAY
Text(event.date + " | " + event.time).fontWeight(.light).font(.system(size: 20)).padding(.vertical, 5).foregroundColor(Color.secondaryLabel)
Text(event.location).fontWeight(.light).font(.system(size: 20)).padding(.bottom, 10).foregroundColor(Color.secondaryLabel)
}.padding([.horizontal, .vertical])
.frame(width: self.cardWidth, height: self.height*0.4, alignment: .leading)
.background(Color.tertiarySystemBackground.opacity(0.7))
}.frame(width: self.cardWidth, height: self.height)
}.padding([.horizontal, .vertical])
.frame(width: self.cardWidth, height: self.height)
.cornerRadius(20)
.shadow(radius: 5)
.onTapGesture {
self.detailView = true
self.selectedEvent = event
}
.contextMenu {
//SHARE
Button(action: {
haptic()
self.selectedEvent = event
self.share.toggle()
self.evm.isVirtual(event: event)
if event.isVirtual {
event.linkText = self.evm.makeLink(text: event.eventDescription)
if event.linkText == "" { event.isVirtual = false }
event.shareDetails = "Check out this event I found via StetsonScene! \(event.name!) is happening on \(event.date!) at \(event.time!)!"
} else {
event.shareDetails = "Check out this event I found via StetsonScene! \(event.name!), on \(event.date!) at \(event.time!), is happening at the \(event.location!)!"
}
}) {
Text("Share")
Image(systemName: "square.and.arrow.up")
}
//ADD TO CALENDAR
Button(action: {
haptic()
self.selectedEvent = event
self.calendar = true
}) {
Text(event.isInCalendar ? "Already in Calendar" : "Add to Calendar")
Image(systemName: "calendar.badge.plus")
}
//FAVORITE
Button(action: {
haptic()
self.selectedEvent = event
self.evm.toggleFavorite(event)
//self.fav = event.isFavorite //this fixes the display
}) {
Text(event.isFavorite ? "Unfavorite":"Favorite")
Image(systemName: event.isFavorite ? "heart.fill":"heart")
}
//NAVIGATE
// Button(action: {
// haptic()
// self.selectedEvent = event
// self.evm.isVirtual(event: event)
// //if you're trying to navigate to an event and are too far from campus, alert user and don't go to map
// let locationManager = CLLocationManager()
// let StetsonUniversity = CLLocation(latitude: 29.0349780, longitude: -81.3026430)
// if !event.isVirtual && locationManager.location != nil && (CLLocationManager.authorizationStatus() == .authorizedWhenInUse || CLLocationManager.authorizationStatus() == .authorizedAlways) && StetsonUniversity.distance(from: locationManager.location!) > 805 {
// self.externalAlert = true
// self.tooFar = true
// self.navigate = false
// } else if event.isVirtual { //if you're trying to navigate to a virtual event, alert user and don't go to map
// //TODO: add in the capability to follow a link to register or something
// self.externalAlert = true
// self.isVirtual = true
// self.navigate = false
// } else { //otherwise go to map
// self.externalAlert = false
// self.isVirtual = false
// self.tooFar = false
// self.navigate = true
// }
// }) {
// Text("Navigate")
// Image(systemName: "location")
// }
} //end of context menu
}.frame(width: Constants.width).animation(.default) //end of vstack
} //end of foreach
.background(EmptyView().sheet(isPresented: $share, content: { //NEED TO LINK TO APPROPRIATE LINKS ONCE APP IS PUBLISHED
ShareView(activityItems: [/*"linktoapp.com"*/(self.selectedEvent!.isVirtual && URL(string: self.selectedEvent!.linkText) != nil) ? URL(string: self.selectedEvent!.linkText)!:"", self.selectedEvent!.hasCultural ? "\(self.selectedEvent!.shareDetails) It’s even offering a cultural credit!" : "\(self.selectedEvent!.shareDetails)"/*, event.isVirtual ? URL(string: event.linkText)!:""*/], applicationActivities: nil)
}).background(EmptyView().sheet(isPresented: self.$detailView, content: {
EventDetailView(evm: self.evm, event: self.selectedEvent!, page: self.$page, subPage: self.$subPage).environmentObject(self.config)
})))
} //end of hstack
.actionSheet(isPresented: $calendar) {
self.evm.manageCalendar(self.selectedEvent!)
} //end of background and action sheet nonsense
} //end of view
} //end of struct
//.background(EmptyView().sheet(isPresented: $navigate, content: {
// ZStack {
// if self.arMode && !self.event.isVirtual {
// ARNavigationIndicator(evm: self.evm, arFindMode: false, navToEvent: self.event, internalAlert: self.$internalAlert, externalAlert: self.$externalAlert, tooFar: .constant(false), allVirtual: .constant(false), arrived: self.$arrived, eventDetails: self.$eventDetails, page: self.$page, subPage: self.$subPage).environmentObject(self.config)
// } else if !self.event.isVirtual { //mapMode
// MapView(evm: self.evm, mapFindMode: false, navToEvent: self.event, internalAlert: self.$internalAlert, externalAlert: self.$externalAlert, tooFar: .constant(false), allVirtual: .constant(false), arrived: self.$arrived, eventDetails: self.$eventDetails, page: self.$page, subPage: self.$subPage).environmentObject(self.config)
// }
// if self.config.appEventMode {
// ZStack {
// Text(self.arMode ? "Map View" : "AR View").fontWeight(.light).font(.system(size: 18)).foregroundColor(self.config.accent)
// }.padding(10)
// .background(RoundedRectangle(cornerRadius: 15).stroke(Color.clear).foregroundColor(Color.tertiarySystemBackground.opacity(0.8)).background(RoundedRectangle(cornerRadius: 10).foregroundColor(Color.tertiarySystemBackground.opacity(0.8))))
// .onTapGesture { withAnimation { self.arMode.toggle() } }
// .offset(y: Constants.height*0.4)
// }
// }.alert(isPresented: self.$internalAlert) { () -> Alert in //done in the view
// if self.arrived {
// return self.evm.alert(title: "You've Arrived!", message: "Have fun at \(String(describing: self.event.name!))!")
// } else if self.eventDetails {
// return self.evm.alert(title: "\(self.event.name!)", message: "This event is at \(self.event.time!) on \(self.event.date!).")/*, and you are \(distanceFromBuilding!)m from \(event!.location!)*/
// }
// return self.evm.alert(title: "ERROR", message: "Please report as a bug.")
// }
// }).alert(isPresented: self.$externalAlert) { () -> Alert in //done outside the view
// if self.isVirtual {
// return self.evm.alert(title: "Virtual Event", message: "Sorry! This event is virtual, so you have no where to navigate to.")
// } else if self.tooFar {
// //return self.evm.alert(title: "Too Far to Navigate to Event", message: "You're currently too far away from campus to navigate to this event. You can still view it in the map, and once you get closer to campus, can navigate there.")
// return self.evm.navAlert(lat: self.event.mainLat, lon: self.event.mainLon)
// }
// return self.evm.alert(title: "ERROR", message: "Please report as a bug.")
// }
//CARDCONTROL: shows which card is currently displayed
struct CardControl : UIViewRepresentable {
var trendingList: [EventInstance]
@Binding var card : Int
@Binding var page:String
@Binding var subPage:String
func makeUIView(context: Context) -> UIPageControl {
let cardControl = UIPageControl()
cardControl.currentPageIndicatorTintColor = UIColor.label
cardControl.pageIndicatorTintColor = UIColor.secondaryLabel.withAlphaComponent(0.25)
cardControl.numberOfPages = trendingList.count
return cardControl
}
//update page indicator (dots)
func updateUIView(_ uiView: UIPageControl, context: Context) {
DispatchQueue.main.async {
uiView.currentPage = self.card
}
}
}
| [
-1
] |
e556c8972331d1efefb82cb3d10561db6dfc57b0 | 92d9b3ae51cf52ddf6c123b38e7602bcc652963b | /Memorable Quotes/Memorable Quotes/AppDelegate.swift | a3a95a1b8bb8869ce2b4f78548e5b0453e658b60 | [] | no_license | KMorganAkiba/iOS_TableView_Quotes | 3b658ffda25f3b9b6f342a426121580e4142bb61 | 14a1388650cbf939eac79c2a0b2e9186ce6e44b4 | refs/heads/main | 2023-07-22T14:59:41.607744 | 2021-09-10T01:04:19 | 2021-09-10T01:04:19 | 404,913,426 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,353 | swift | //
// AppDelegate.swift
// Memorable Quotes
//
// Created by Kyle Morgan on 9/9/21.
//
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
| [
393222,
393224,
393230,
393250,
344102,
393261,
393266,
213048,
385081,
376889,
393275,
376905,
254030,
368727,
180313,
368735,
180320,
376931,
368752,
417924,
262283,
377012,
327871,
180416,
377036,
180431,
377046,
418007,
418010,
377060,
205036,
393456,
393460,
418043,
336123,
385280,
336128,
262404,
164106,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
393538,
262472,
344403,
213332,
65880,
262496,
418144,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
262566,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
410128,
393747,
254490,
188958,
385570,
33316,
377383,
197159,
352821,
197177,
418363,
188987,
369223,
385609,
385616,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
148105,
377484,
352918,
98968,
344744,
361129,
385713,
434867,
164534,
336567,
328378,
164538,
328386,
344776,
352968,
352971,
418507,
352973,
385742,
385748,
361179,
189153,
369381,
361195,
418553,
344831,
344835,
336643,
344841,
361230,
336659,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
361288,
328522,
336714,
426841,
197468,
254812,
361309,
361315,
361322,
328573,
377729,
369542,
222128,
345035,
386003,
345043,
386011,
386018,
386022,
435187,
328714,
361489,
386069,
386073,
336921,
336925,
345118,
377887,
345133,
345138,
386101,
361536,
189520,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
345267,
386258,
328924,
66782,
222437,
386285,
328941,
386291,
345376,
353570,
345379,
410917,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
230809,
181673,
181681,
181684,
361917,
181696,
337349,
271839,
329191,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
394853,
345701,
222830,
370297,
353919,
403075,
345736,
198280,
403091,
345749,
419483,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
419512,
337592,
419517,
337599,
419527,
419530,
419535,
272081,
394966,
419542,
419544,
181977,
345818,
419547,
419550,
419559,
419563,
370415,
337659,
337668,
362247,
395021,
362255,
395029,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
354150,
354156,
345964,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
362413,
337844,
346057,
346063,
247759,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
100453,
329832,
329855,
329885,
346272,
362660,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
379134,
411903,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
248111,
362822,
436555,
190796,
379233,
354673,
420236,
379278,
272786,
354727,
338352,
338381,
330189,
338386,
256472,
338403,
248308,
199164,
330252,
330267,
354855,
10828,
199249,
346721,
174695,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
338660,
338664,
264941,
363251,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
355218,
330642,
412599,
207808,
379848,
396245,
330710,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
347176,
158761,
396328,
199728,
396336,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
412764,
339036,
257120,
265320,
248951,
420984,
330889,
347287,
248985,
339097,
44197,
380070,
339112,
249014,
126144,
330958,
330965,
265432,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
347437,
372015,
347441,
372018,
199988,
44342,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
249214,
175486,
175489,
249218,
249227,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
208311,
372163,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
339420,
249308,
339424,
339428,
339434,
249328,
69113,
372228,
208398,
380432,
175635,
339503,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
372353,
224897,
216707,
421508,
126596,
224904,
11918,
159374,
224913,
126610,
224916,
224919,
126616,
208538,
224922,
224926,
224929,
224932,
257704,
224936,
224942,
257712,
224947,
257716,
257720,
224953,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
257761,
224993,
257764,
224999,
339695,
225012,
257787,
225020,
257790,
339710,
225025,
257794,
339721,
257801,
257804,
225038,
257807,
225043,
372499,
167700,
225048,
257819,
225053,
225058,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
225103,
257871,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
339814,
225127,
274280,
257896,
257901,
225137,
257908,
225141,
257912,
225148,
257916,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
372738,
405533,
430129,
266294,
266297,
421960,
356439,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
192673,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
225493,
266453,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
397571,
389380,
61722,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
348488,
332106,
332117,
250199,
332125,
332152,
389502,
250238,
332161,
356740,
332172,
373145,
340379,
389550,
324030,
266687,
160234,
127471,
340472,
381436,
324094,
266754,
324111,
340500,
381481,
356907,
324142,
356916,
324149,
324155,
348733,
324164,
348743,
381512,
324173,
324176,
389723,
332380,
373343,
381545,
340627,
373398,
184982,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
357069,
332493,
357073,
332511,
332520,
340718,
332533,
348924,
373510,
389926,
348978,
152370,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
430939,
357211,
357214,
201579,
201582,
349040,
340849,
430965,
324472,
398201,
119674,
324475,
430972,
340858,
340861,
324478,
324481,
373634,
398211,
324484,
324487,
381833,
324492,
324495,
430995,
324501,
324510,
422816,
324513,
398245,
324524,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
349180,
439294,
209943,
357410,
250914,
185380,
357418,
209965,
209971,
209975,
209979,
209987,
209990,
209995,
341071,
349267,
250967,
210010,
341091,
210025,
210030,
210036,
210039,
349308,
210044,
349311,
160895,
152703,
210052,
210055,
349319,
210067,
210077,
210080,
251044,
210084,
185511,
210095,
210098,
210107,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
218360,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
415033,
251210,
357708,
210260,
259421,
365921,
333154,
333162,
234866,
390516,
333175,
357755,
374160,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
415207,
366056,
366061,
415216,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
153227,
333498,
210631,
333511,
259788,
358099,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
210698,
366348,
210706,
399128,
210719,
358191,
366387,
210739,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
341851,
350045,
399199,
259938,
399206,
358255,
268143,
399215,
358259,
341876,
333689,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
358339,
333774,
358371,
350189,
350193,
350202,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
374902,
432271,
260289,
260298,
350416,
350422,
350425,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
350467,
325891,
350475,
375053,
268559,
350480,
432405,
350486,
325914,
350490,
325917,
350493,
325919,
350498,
194852,
350504,
358700,
391468,
350509,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
416157,
268701,
342430,
375208,
375216,
334262,
334275,
326084,
358856,
195039,
334304,
334311,
375277,
334321,
350723,
186897,
334358,
342550,
342554,
334363,
358941,
350761,
252461,
334384,
358961,
383536,
334394,
252482,
219718,
334407,
350822,
375400,
334465,
334468,
162445,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
260801,
350917,
391894,
154328,
416473,
64230,
342766,
375535,
203506,
342776,
391937,
391948,
375568,
326416,
375571,
375574,
162591,
326441,
383793,
326451,
326454,
260924,
375612,
244540,
326460,
326467,
244551,
326473,
326477,
416597,
326485,
326490,
375656,
433000,
326510,
211831,
351097,
392060,
359295,
351104,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
359366,
326598,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
261147,
359451,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
367723,
384107,
187502,
343154,
384114,
212094,
351364,
384135,
384139,
384143,
351381,
384160,
384168,
367794,
384181,
367800,
351423,
384191,
384198,
326855,
244937,
253130,
343244,
146642,
359649,
343270,
351466,
351479,
384249,
343306,
261389,
359694,
384269,
253200,
261393,
384275,
245020,
245029,
171302,
351534,
376110,
245040,
384314,
425276,
212291,
384323,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
253303,
154999,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
179802,
327275,
245357,
138864,
155254,
155273,
368288,
425638,
425649,
155322,
425662,
155327,
155351,
155354,
212699,
155363,
245475,
155371,
245483,
409335,
155393,
155403,
155422,
360223,
155438,
155442,
155447,
417595,
360261,
155461,
376663,
155482,
261981,
425822,
376671,
155487,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
425845,
147317,
262005,
262008,
262011,
155516,
155521,
155525,
360326,
376714,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
393169,
384977,
155611,
155619,
253923,
155621,
253926,
204784,
393203,
360438,
253943,
393206,
393212,
155646
] |
b36a0a78c71c66110cb47881069dbf42620abf76 | 73788cc6fba5f29c6dad265bb5f29366b5a3314d | /LogInFB/Controllers/Auth/SignInViewController.swift | 0ed3ae298e0221d52faf07de8b804d1b0531f791 | [] | no_license | 7wulfric7/SocialNetwork | 26525a9d3e1fd25703866ff8104c557a9feee218 | 50f3b155f6cd40d5dd4d347d2df9fa72a31cc9d5 | refs/heads/main | 2023-02-22T15:20:35.053433 | 2021-01-25T19:14:27 | 2021-01-25T19:14:27 | 320,082,372 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,826 | swift | //
// SignInViewController.swift
// LogInFB
//
// Created by Deniz Adil on 11/9/20.
//
import UIKit
import Firebase
import SVProgressHUD
import CoreServices
import SwiftPhotoGallery
class SignInViewController: UIViewController {
@IBOutlet weak var emailHolderView: UIView!
@IBOutlet weak var passwordHolderView: UIView!
@IBOutlet weak var txtEmail: UITextField!
@IBOutlet weak var txtPassword: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
title = "Sign In"
setupBordersAndFileds()
setCustomBackButton()
}
func setCustomBackButton() {
let back = UIButton(frame: CGRect(x: 0, y: 0, width: 20, height: 30))
back.setImage(UIImage(named: "BackButton"), for: .normal)
back.addTarget(self, action: #selector(onBack), for: .touchUpInside)
navigationItem.backBarButtonItem = UIBarButtonItem(image: UIImage(named: "BackButton"), style: .plain, target: self, action: #selector(onBack))
}
func setupBordersAndFileds() {
emailHolderView.layer.borderWidth = 1.0
emailHolderView.layer.borderColor = UIColor.gray.cgColor
emailHolderView.layer.cornerRadius = 8
txtEmail.delegate = self
txtEmail.returnKeyType = .done
passwordHolderView.layer.borderWidth = 1.0
passwordHolderView.layer.borderColor = UIColor.gray.cgColor
passwordHolderView.layer.cornerRadius = 8
txtPassword.delegate = self
txtPassword.returnKeyType = .continue
}
@objc func onBack() {
navigationController?.popViewController(animated: true)
}
@IBAction func onResetPassword(_ sender: UIButton) {
performSegue(withIdentifier: "resetPasswordSegue", sender: nil)
}
@IBAction func onGoToFeed(_ sender: UIButton) {
guard let email = txtEmail.text, email != "" else {
showErrorWith(title: "Error", msg: "Please enter your e-mail")
return
}
guard let password = txtPassword.text, password != "" else {
showErrorWith(title: "Error", msg: "Please enter password")
return
}
guard email.isValidEmail() else {
showErrorWith(title: "Error", msg: "Please enter a valid e-mail")
return
}
SVProgressHUD.show()
Auth.auth().signIn(withEmail: email, password: password) { authResult, error in
SVProgressHUD.dismiss()
if let error = error {
let specificError = error as NSError
if specificError.code == AuthErrorCode.invalidEmail.rawValue && specificError.code == AuthErrorCode.wrongPassword.rawValue {
self.showErrorWith(title: "Error", msg: "Incorrect e-mail or password")
return
}
if specificError.code == AuthErrorCode.userDisabled.rawValue {
self.showErrorWith(title: "Error", msg: "Your account was disabled!")
return
}
self.showErrorWith(title: "Error", msg: error.localizedDescription)
return
}
if let authResult = authResult {
self.getLocalUserData(uid: authResult.user.uid)
}
}
}
func getLocalUserData(uid: String) {
SVProgressHUD.show()
DataStore.shared.getUser(uid: uid) { (user, error) in
SVProgressHUD.dismiss()
if let error = error {
self.showErrorWith(title: "Error", msg: error.localizedDescription)
return
}
if let user = user {
DataStore.shared.localUser = user
self.continueToHome()
return
}
self.continueToSetUsetProfile()
}
}
func continueToHome() {
//MainTabBar
let storyboard = UIStoryboard(name: "Auth", bundle: nil)
let controller = storyboard.instantiateViewController(identifier: "MainTabBar")
present(controller, animated: true, completion: nil)
navigationController?.popToRootViewController(animated: false)
}
func continueToSetUsetProfile() {
let storyboard = UIStoryboard(name: "Auth", bundle: nil)
let controller = storyboard.instantiateViewController(identifier: "SetUpProfileViewController") as! SetUpProfileViewController
controller.state = .signin
navigationController?.pushViewController(controller, animated: true)
}
}
extension SignInViewController: UITextFieldDelegate {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}
}
| [
-1
] |
bd1f8476e562eb476feb3228f8ab3e6bdebae33f | e78bccf258f9651301d8dbfea2ca6c6a5cdc432e | /o_pokedekk/Views/Cells/PokemonListCell.swift | d1efa188fdebeee1ca3cfc395f601c53c3110e02 | [] | no_license | pasp94/o_pokedekk | 982a4e52a7f1d1c70d793f5c01766fc32e11c51d | 1cbed76c03771d48c0e479d35b8f2b745a004dbb | refs/heads/master | 2023-01-31T06:10:53.282414 | 2020-12-03T11:53:17 | 2020-12-03T11:53:17 | 313,073,483 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 4,712 | swift | //
// PokemonListCell.swift
// o_pokedekk
//
// Created by Pasquale Spisto on 19/11/20.
//
import Foundation
import UIKit
final class PokemonListCell: UICollectionViewCell {
let pokemonNameLabel: UILabel = {
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
label.font = UIFont.systemFont(ofSize: 14, weight: .heavy)
label.adjustsFontSizeToFitWidth = true
label.contentMode = .center
label.textColor = Constants.lightTextColor
return label
}()
let pokemonIconImageView: UIImageView = {
let imageView = UIImageView()
imageView.translatesAutoresizingMaskIntoConstraints = false
imageView.contentMode = .scaleAspectFit
imageView.backgroundColor = .clear
return imageView
}()
let spinner: UIActivityIndicatorView = {
let indicator = UIActivityIndicatorView(style: .whiteLarge)
indicator.backgroundColor = UIColor.gray.withAlphaComponent(0.8)
indicator.translatesAutoresizingMaskIntoConstraints = false
indicator.layer.cornerRadius = Constants.cellCorner
return indicator
}()
var viewModel: IconNameCellViewModelProtocol?
override init(frame: CGRect) {
super.init(frame: frame)
contentView.layer.masksToBounds = true
layer.cornerRadius = Constants.cellCorner
layer.shadowColor = UIColor.black.cgColor
layer.shadowOffset = CGSize(width: 0, height: 2.0)
layer.shadowRadius = 2.0
layer.shadowOpacity = 0.5
layer.masksToBounds = false
/// Add cell subviews to content view
contentView.addSubview(pokemonNameLabel)
contentView.addSubview(pokemonIconImageView)
contentView.addSubview(spinner)
/// _Costraint defination and activation_
NSLayoutConstraint.activate([
/// `pokemonNameLabel` costraint
pokemonNameLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
pokemonNameLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 15.0),
pokemonNameLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: 15.0),
pokemonNameLabel.heightAnchor.constraint(equalToConstant: contentView.bounds.height * 0.25),
/// `pokemonIconImageView` costrain
pokemonIconImageView.bottomAnchor.constraint(equalTo: pokemonNameLabel.topAnchor),
pokemonIconImageView.topAnchor.constraint(equalTo: contentView.topAnchor),
pokemonIconImageView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
pokemonIconImageView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
/// `Spinner` costrain
spinner.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
spinner.topAnchor.constraint(equalTo: contentView.topAnchor),
spinner.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
spinner.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
])
}
override func prepareForReuse() {
self.viewModel?.prepareCellForReuse()
self.pokemonNameLabel.text = Constants.namePlaceholder
self.pokemonIconImageView.image = Constants.iconPlaceholder
self.backgroundColor = .clear
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
extension PokemonListCell: ConfigurableCell {
func setViewModel<T>(_ viewModel: T) {
self.viewModel = viewModel as? IconNameCellViewModelProtocol
self.viewModel?.bindDataCell(completion: { [weak self] (viewIsLoaded) in
guard let self = self else { return }
if viewIsLoaded {
DispatchQueue.main.async {
self.pokemonNameLabel.text = self.viewModel?.name.uppercased()
self.pokemonIconImageView.image = self.viewModel?.icon
self.backgroundColor = self.viewModel?.backgroundColor
self.spinner.stopAnimating()
}
} else {
DispatchQueue.main.async {
self.pokemonNameLabel.text = Constants.namePlaceholder
self.pokemonIconImageView.image = Constants.iconPlaceholder
self.backgroundColor = .gray
self.spinner.startAnimating()
}
}
})
self.viewModel?.bindErrorCell(completion: { [weak self] (_) in
guard let self = self else { return }
DispatchQueue.main.async {
self.spinner.stopAnimating()
}
})
self.viewModel?.fetchViewData()
}
}
| [
-1
] |
99e44da178f019e7b9e465b3872412d8449093c1 | aab33645910dbb1f53ccb0e98d76a733d2111c68 | /Chapter 2/CodeFiles/NavigationController/NavigationController/ViewController.swift | e6558bbde8a35281f934e76f9ccf9143adbf8677 | [
"MIT"
] | permissive | PacktPublishing/iOS-Programming-Cookbook | 6062210000fd81b35a8cddc7a43fed7b512ca047 | 437a053c5da38cbe5c2f105c5e92ad88c5fa9f3f | refs/heads/master | 2023-02-05T04:49:14.782580 | 2023-01-24T11:08:38 | 2023-01-24T11:08:38 | 86,583,345 | 11 | 6 | null | null | null | null | UTF-8 | Swift | false | false | 523 | swift | //
// ViewController.swift
// NavigationController
//
// Created by Hossam Ghareeb on 6/25/16.
// Copyright © 2016 Hossam Ghareeb. 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,
277006,
278543,
282128,
234511,
236057,
286234,
317473,
282145,
295460,
284197,
296487,
286257,
300086,
234551,
279096,
237624,
288827,
226878,
277057,
286786,
159812,
228932,
129604,
284740,
226887,
243786,
288331,
288332,
300107,
158285,
284240,
226896,
280146,
212561,
228945,
300116,
237655,
307288,
212573,
200802,
292451,
276580,
284261,
356460,
307311,
281202,
284277,
300149,
284279,
287350,
284289,
303242,
285837,
311437,
227984,
234641,
278675,
282262,
117399,
280219,
284315,
284317,
299165,
285855,
302235,
278693,
287399,
100521,
234665,
284336,
307379,
276150,
280760,
282301,
277696,
285377,
227523,
228551,
280777,
279754,
284361,
298189,
287437,
313550,
229585,
307410,
189655,
226009,
298202,
298204,
280797,
298207,
363743,
282338,
298211,
284391,
277224,
228585,
294636,
234223,
312049,
289524,
280821,
288501,
280824,
358137,
234232,
358139,
286462,
280832,
276736,
230147,
226055,
299786,
312586,
295696,
296216,
329499,
281373,
287007,
228127,
277797,
282917,
234279,
283433,
282411,
293682,
289596,
279360,
289600,
288579,
300358,
238920,
234829,
287055,
279380,
295766,
279386,
188253,
289120,
308064,
293742,
299374,
199024,
291709,
290175,
275842,
183173,
313733,
324491,
234380,
304015,
226705,
310673,
226196,
227740,
294812,
277406,
285087,
234402,
289187,
284586,
144811,
291755,
277935,
324528,
230323,
282548,
292277,
296374,
130487,
278968,
234423,
127418,
281530,
278973,
291774,
295874,
289224,
165832,
306633,
288205,
281042,
301012,
163289,
279011,
168936,
286189,
183278,
277487,
282095,
298989,
293874,
227315,
308721,
237556,
296436,
277502,
287231
] |
85dc4e82db5022f9185a3a54e7498a20a16c2bed | dd84e88a7031a572a674499d79e62ad38554458b | /Source/SwipeController.swift | 0ec771678ad345445b6edea4e2bb291474362d86 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | oleksandr-krpv/SwipeCellKit | a9b6bb0532614e926604c87516ade8395bdff3aa | aaa065a9af4a7924d4b6741443c285a3f9f9d2c7 | refs/heads/master | 2022-12-08T16:18:31.309033 | 2018-11-20T12:35:29 | 2018-11-20T12:35:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 22,424 | swift | //
// SwipeController.swift
// SwipeCellKit
//
// Created by Mohammad Kurabi on 5/19/18.
//
import Foundation
protocol SwipeControllerDelegate: class {
func swipeController(_ controller: SwipeController, canBeginEditingSwipeableFor orientation: SwipeActionsOrientation) -> Bool
func swipeController(_ controller: SwipeController, editActionsForSwipeableFor orientation: SwipeActionsOrientation) -> [SwipeAction]?
func swipeController(_ controller: SwipeController, editActionsOptionsForSwipeableFor orientation: SwipeActionsOrientation) -> SwipeOptions
func swipeController(_ controller: SwipeController, willBeginEditingSwipeableFor orientation: SwipeActionsOrientation)
func swipeController(_ controller: SwipeController, didEndEditingSwipeableFor orientation: SwipeActionsOrientation)
func swipeController(_ controller: SwipeController, didDeleteSwipeableAt indexPath: IndexPath)
func swipeController(_ controller: SwipeController, visibleRectFor scrollView: UIScrollView) -> CGRect?
}
class SwipeController: NSObject {
weak var swipeable: (UIView & Swipeable)?
weak var actionsContainerView: UIView?
weak var delegate: SwipeControllerDelegate?
weak var scrollView: UIScrollView?
var animator: SwipeAnimator?
let elasticScrollRatio: CGFloat = 0.4
var originalCenter: CGFloat = 0
var scrollRatio: CGFloat = 1.0
var originalLayoutMargins: UIEdgeInsets = .zero
lazy var panGestureRecognizer: UIPanGestureRecognizer = {
let gesture = UIPanGestureRecognizer(target: self, action: #selector(handlePan(gesture:)))
gesture.delegate = self
return gesture
}()
lazy var tapGestureRecognizer: UITapGestureRecognizer = {
let gesture = UITapGestureRecognizer(target: self, action: #selector(handleTap(gesture:)))
gesture.delegate = self
return gesture
}()
init(swipeable: UIView & Swipeable, actionsContainerView: UIView) {
self.swipeable = swipeable
self.actionsContainerView = actionsContainerView
super.init()
configure()
}
@objc func handlePan(gesture: UIPanGestureRecognizer) {
guard let target = actionsContainerView, var swipeable = self.swipeable else { return }
let velocity = gesture.velocity(in: target)
if delegate?.swipeController(self, canBeginEditingSwipeableFor: velocity.x > 0 ? .left : .right) == false {
return
}
switch gesture.state {
case .began:
if let swipeable = scrollView?.swipeables.first(where: { $0.state == .dragging }) as? UIView, swipeable != self.swipeable {
return
}
stopAnimatorIfNeeded()
originalCenter = target.center.x
if swipeable.state == .center || swipeable.state == .animatingToCenter {
let orientation: SwipeActionsOrientation = velocity.x > 0 ? .left : .right
showActionsView(for: orientation)
}
case .changed:
guard let actionsView = swipeable.actionsView, let actionsContainerView = self.actionsContainerView else { return }
guard swipeable.state.isActive else { return }
if swipeable.state == .animatingToCenter {
let swipedCell = scrollView?.swipeables.first(where: { $0.state == .dragging || $0.state == .left || $0.state == .right }) as? UIView
if let swipedCell = swipedCell, swipedCell != self.swipeable {
return
}
}
let translation = gesture.translation(in: target).x
scrollRatio = 1.0
// Check if dragging past the center of the opposite direction of action view, if so
// then we need to apply elasticity
if (translation + originalCenter - swipeable.bounds.midX) * actionsView.orientation.scale > 0 {
target.center.x = gesture.elasticTranslation(in: target,
withLimit: .zero,
fromOriginalCenter: CGPoint(x: originalCenter, y: 0)).x
swipeable.actionsView?.visibleWidth = abs((swipeable as Swipeable).frame.minX)
scrollRatio = elasticScrollRatio
return
}
if let expansionStyle = actionsView.options.expansionStyle, let scrollView = scrollView {
let referenceFrame = actionsContainerView != swipeable ? actionsContainerView.frame : nil;
let expanded = expansionStyle.shouldExpand(view: swipeable, gesture: gesture, in: scrollView, within: referenceFrame)
let targetOffset = expansionStyle.targetOffset(for: swipeable)
let currentOffset = abs(translation + originalCenter - swipeable.bounds.midX)
if expanded && !actionsView.expanded && targetOffset > currentOffset {
let centerForTranslationToEdge = swipeable.bounds.midX - targetOffset * actionsView.orientation.scale
let delta = centerForTranslationToEdge - originalCenter
animate(toOffset: centerForTranslationToEdge)
gesture.setTranslation(CGPoint(x: delta, y: 0), in: swipeable.superview!)
} else {
target.center.x = gesture.elasticTranslation(in: target,
withLimit: CGSize(width: targetOffset, height: 0),
fromOriginalCenter: CGPoint(x: originalCenter, y: 0),
applyingRatio: expansionStyle.targetOverscrollElasticity).x
swipeable.actionsView?.visibleWidth = abs(actionsContainerView.frame.minX)
}
actionsView.setExpanded(expanded: expanded, feedback: true)
} else {
target.center.x = gesture.elasticTranslation(in: target,
withLimit: CGSize(width: actionsView.preferredWidth, height: 0),
fromOriginalCenter: CGPoint(x: originalCenter, y: 0),
applyingRatio: elasticScrollRatio).x
swipeable.actionsView?.visibleWidth = abs(actionsContainerView.frame.minX)
if (target.center.x - originalCenter) / translation != 1.0 {
scrollRatio = elasticScrollRatio
}
}
case .ended, .cancelled, .failed:
guard let actionsView = swipeable.actionsView, let actionsContainerView = self.actionsContainerView else { return }
if swipeable.state.isActive == false && swipeable.bounds.midX == target.center.x {
return
}
swipeable.state = targetState(forVelocity: velocity)
if actionsView.expanded == true, let expandedAction = actionsView.expandableAction {
perform(action: expandedAction)
} else {
let targetOffset = targetCenter(active: swipeable.state.isActive)
let distance = targetOffset - actionsContainerView.center.x
let normalizedVelocity = velocity.x * scrollRatio / distance
animate(toOffset: targetOffset, withInitialVelocity: normalizedVelocity) { _ in
if self.swipeable?.state == .center {
self.reset()
}
}
if !swipeable.state.isActive {
delegate?.swipeController(self, didEndEditingSwipeableFor: actionsView.orientation)
}
}
default: break
}
}
@discardableResult
func showActionsView(for orientation: SwipeActionsOrientation) -> Bool {
guard let actions = delegate?.swipeController(self, editActionsForSwipeableFor: orientation), actions.count > 0 else { return false }
guard let swipeable = self.swipeable else { return false }
originalLayoutMargins = swipeable.layoutMargins
configureActionsView(with: actions, for: orientation)
delegate?.swipeController(self, willBeginEditingSwipeableFor: orientation)
return true
}
func configureActionsView(with actions: [SwipeAction], for orientation: SwipeActionsOrientation) {
guard var swipeable = self.swipeable,
let actionsContainerView = self.actionsContainerView,
let scrollView = self.scrollView else {
return
}
let options = delegate?.swipeController(self, editActionsOptionsForSwipeableFor: orientation) ?? SwipeOptions()
swipeable.actionsView?.removeFromSuperview()
swipeable.actionsView = nil
var contentEdgeInsets = UIEdgeInsets.zero
if let visibleTableViewRect = delegate?.swipeController(self, visibleRectFor: scrollView) {
let frame = (swipeable as Swipeable).frame
let visibleSwipeableRect = frame.intersection(visibleTableViewRect)
if visibleSwipeableRect.isNull == false {
let top = visibleSwipeableRect.minY > frame.minY ? max(0, visibleSwipeableRect.minY - frame.minY) : 0
let bottom = max(0, frame.size.height - visibleSwipeableRect.size.height - top)
contentEdgeInsets = UIEdgeInsets(top: top, left: 0, bottom: bottom, right: 0)
}
}
let actionsView = SwipeActionsView(contentEdgeInsets: contentEdgeInsets,
maxSize: swipeable.bounds.size,
safeAreaInsetView: scrollView,
options: options,
orientation: orientation,
actions: actions)
actionsView.delegate = self
actionsContainerView.addSubview(actionsView)
actionsView.heightAnchor.constraint(equalTo: swipeable.heightAnchor).isActive = true
actionsView.widthAnchor.constraint(equalTo: swipeable.widthAnchor, multiplier: 2).isActive = true
actionsView.topAnchor.constraint(equalTo: swipeable.topAnchor).isActive = true
if orientation == .left {
actionsView.rightAnchor.constraint(equalTo: actionsContainerView.leftAnchor, constant: 8).isActive = true
} else {
actionsView.leftAnchor.constraint(equalTo: actionsContainerView.rightAnchor, constant: 8).isActive = true
}
actionsView.layer.cornerRadius = 8
actionsView.setNeedsUpdateConstraints()
swipeable.actionsView = actionsView
swipeable.state = .dragging
}
func animate(duration: Double = 0.7, toOffset offset: CGFloat, withInitialVelocity velocity: CGFloat = 0, completion: ((Bool) -> Void)? = nil) {
stopAnimatorIfNeeded()
swipeable?.layoutIfNeeded()
let animator: SwipeAnimator = {
if velocity != 0 {
if #available(iOS 10, *) {
let velocity = CGVector(dx: velocity, dy: velocity)
let parameters = UISpringTimingParameters(mass: 1.0, stiffness: 100, damping: 18, initialVelocity: velocity)
return UIViewPropertyAnimator(duration: 0.0, timingParameters: parameters)
} else {
return UIViewSpringAnimator(duration: duration, damping: 1.0, initialVelocity: velocity)
}
} else {
if #available(iOS 10, *) {
return UIViewPropertyAnimator(duration: duration, dampingRatio: 1.0)
} else {
return UIViewSpringAnimator(duration: duration, damping: 1.0)
}
}
}()
animator.addAnimations({
guard let swipeable = self.swipeable, let actionsContainerView = self.actionsContainerView else { return }
actionsContainerView.center = CGPoint(x: offset, y: actionsContainerView.center.y)
swipeable.actionsView?.visibleWidth = abs(actionsContainerView.frame.minX)
swipeable.layoutIfNeeded()
})
if let completion = completion {
animator.addCompletion(completion: completion)
}
self.animator = animator
animator.startAnimation()
}
func traitCollectionDidChange(from previousTraitCollrection: UITraitCollection?, to traitCollection: UITraitCollection) {
guard let swipeable = self.swipeable,
let actionsContainerView = self.actionsContainerView,
previousTraitCollrection != nil else {
return
}
if swipeable.state == .left || swipeable.state == .right {
let targetOffset = targetCenter(active: swipeable.state.isActive)
actionsContainerView.center = CGPoint(x: targetOffset, y: actionsContainerView.center.y)
swipeable.actionsView?.visibleWidth = abs(actionsContainerView.frame.minX)
swipeable.layoutIfNeeded()
}
}
func stopAnimatorIfNeeded() {
if animator?.isRunning == true {
animator?.stopAnimation(true)
}
}
@objc func handleTap(gesture: UITapGestureRecognizer) {
hideSwipe(animated: true)
}
@objc func handleTablePan(gesture: UIPanGestureRecognizer) {
if gesture.state == .began {
hideSwipe(animated: true)
}
}
func targetState(forVelocity velocity: CGPoint) -> SwipeState {
guard let actionsView = swipeable?.actionsView else { return .center }
switch actionsView.orientation {
case .left:
return (velocity.x < 0 && !actionsView.expanded) ? .center : .left
case .right:
return (velocity.x > 0 && !actionsView.expanded) ? .center : .right
}
}
func targetCenter(active: Bool) -> CGFloat {
guard let swipeable = self.swipeable else { return 0 }
guard let actionsView = swipeable.actionsView, active == true else { return swipeable.bounds.midX }
return swipeable.bounds.midX - actionsView.preferredWidth * actionsView.orientation.scale
}
func configure() {
swipeable?.addGestureRecognizer(tapGestureRecognizer)
swipeable?.addGestureRecognizer(panGestureRecognizer)
}
func reset() {
swipeable?.state = .center
swipeable?.actionsView?.removeFromSuperview()
swipeable?.actionsView = nil
}
}
extension SwipeController: UIGestureRecognizerDelegate {
func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
if gestureRecognizer == tapGestureRecognizer {
if UIAccessibility.isVoiceOverRunning {
scrollView?.hideSwipeables()
}
let swipedCell = scrollView?.swipeables.first(where: {
$0.state.isActive ||
$0.panGestureRecognizer.state == .began ||
$0.panGestureRecognizer.state == .changed ||
$0.panGestureRecognizer.state == .ended
})
return swipedCell == nil ? false : true
}
if gestureRecognizer == panGestureRecognizer,
let view = gestureRecognizer.view,
let gestureRecognizer = gestureRecognizer as? UIPanGestureRecognizer {
let translation = gestureRecognizer.translation(in: view)
return abs(translation.y) <= abs(translation.x)
}
return true
}
}
extension SwipeController: SwipeActionsViewDelegate {
func swipeActionsView(_ swipeActionsView: SwipeActionsView, didSelect action: SwipeAction) {
perform(action: action)
}
func perform(action: SwipeAction) {
guard let actionsView = swipeable?.actionsView else { return }
if action == actionsView.expandableAction, let expansionStyle = actionsView.options.expansionStyle {
// Trigger the expansion (may already be expanded from drag)
actionsView.setExpanded(expanded: true)
switch expansionStyle.completionAnimation {
case .bounce:
perform(action: action, hide: true)
case .fill(let fillOption):
performFillAction(action: action, fillOption: fillOption)
}
} else {
perform(action: action, hide: action.hidesWhenSelected)
}
}
func perform(action: SwipeAction, hide: Bool) {
guard let indexPath = swipeable?.indexPath else { return }
if hide {
hideSwipe(animated: true)
}
action.handler?(action, indexPath)
}
func performFillAction(action: SwipeAction, fillOption: SwipeExpansionStyle.FillOptions) {
guard let swipeable = self.swipeable, let actionsContainerView = self.actionsContainerView else { return }
guard let actionsView = swipeable.actionsView, let indexPath = swipeable.indexPath else { return }
let newCenter = swipeable.bounds.midX - (swipeable.bounds.width + actionsView.minimumButtonWidth) * actionsView.orientation.scale
action.completionHandler = { [weak self] style in
guard let `self` = self else { return }
action.completionHandler = nil
self.delegate?.swipeController(self, didEndEditingSwipeableFor: actionsView.orientation)
switch style {
case .delete:
actionsContainerView.mask = actionsView.createDeletionMask()
self.delegate?.swipeController(self, didDeleteSwipeableAt: indexPath)
UIView.animate(withDuration: 0.3, animations: {
guard let actionsContainerView = self.actionsContainerView else { return }
actionsContainerView.center.x = newCenter
actionsContainerView.mask?.frame.size.height = 0
swipeable.actionsView?.visibleWidth = abs(actionsContainerView.frame.minX)
if fillOption.timing == .after {
actionsView.alpha = 0
}
}) { [weak self] _ in
self?.actionsContainerView?.mask = nil
self?.reset()
}
case .reset:
self.hideSwipe(animated: true)
}
}
let invokeAction = {
action.handler?(action, indexPath)
if let style = fillOption.autoFulFillmentStyle {
action.fulfill(with: style)
}
}
animate(duration: 0.3, toOffset: newCenter) { _ in
if fillOption.timing == .after {
invokeAction()
}
}
if fillOption.timing == .with {
invokeAction()
}
}
func hideSwipe(animated: Bool, completion: ((Bool) -> Void)? = nil) {
guard var swipeable = self.swipeable, let actionsContainerView = self.actionsContainerView else { return }
guard swipeable.state == .left || swipeable.state == .right else { return }
guard let actionView = swipeable.actionsView else { return }
swipeable.state = .animatingToCenter
let targetCenter = self.targetCenter(active: false)
if animated {
animate(toOffset: targetCenter) { complete in
self.reset()
completion?(complete)
}
} else {
actionsContainerView.center = CGPoint(x: targetCenter, y: actionsContainerView.center.y)
swipeable.actionsView?.visibleWidth = abs(actionsContainerView.frame.minX)
reset()
}
delegate?.swipeController(self, didEndEditingSwipeableFor: actionView.orientation)
}
func showSwipe(orientation: SwipeActionsOrientation, animated: Bool = true, completion: ((Bool) -> Void)? = nil) {
setSwipeOffset(.greatestFiniteMagnitude * orientation.scale * -1,
animated: animated,
completion: completion)
}
func setSwipeOffset(_ offset: CGFloat, animated: Bool = true, completion: ((Bool) -> Void)? = nil) {
guard var swipeable = self.swipeable, let actionsContainerView = self.actionsContainerView else { return }
guard offset != 0 else {
hideSwipe(animated: animated, completion: completion)
return
}
let orientation: SwipeActionsOrientation = offset > 0 ? .left : .right
let targetState = SwipeState(orientation: orientation)
if swipeable.state != targetState {
guard showActionsView(for: orientation) else { return }
scrollView?.hideSwipeables()
swipeable.state = targetState
}
let maxOffset = min(swipeable.bounds.width, abs(offset)) * orientation.scale * -1
let targetCenter = abs(offset) == CGFloat.greatestFiniteMagnitude ? self.targetCenter(active: true) : swipeable.bounds.midX + maxOffset
if animated {
animate(toOffset: targetCenter) { complete in
completion?(complete)
}
} else {
actionsContainerView.center.x = targetCenter
swipeable.actionsView?.visibleWidth = abs(actionsContainerView.frame.minX)
}
}
}
| [
312072,
135777,
152942,
148463
] |
eff51773a02644bcd22957053222b50c08675337 | 017533708e2e9631003b4cb2752a60a79ada6df5 | /Wake up if I sleep (watch OS) Extension/ExtensionDelegate.swift | 60f294cd99c12fa55e335d5206f7fbd485555f19 | [] | no_license | Yukihaya0817/Wake-up-if-I-sleep | f4bb8c789fface1f0ca51abf3b77662fdd863631 | 59e03da44ffb611e823da152c0b6274fee55536e | refs/heads/master | 2021-01-24T08:47:41.971775 | 2017-06-05T10:09:23 | 2017-06-05T10:09:23 | 93,390,155 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,479 | swift | //
// ExtensionDelegate.swift
// Wake up if I sleep (watch OS) Extension
//
// Created by 平岡 和佳子 on 2017/06/04.
// Copyright © 2017年 平岡 和佳子. All rights reserved.
//
import WatchKit
class ExtensionDelegate: NSObject, WKExtensionDelegate {
func applicationDidFinishLaunching() {
// Perform any final initialization of your application.
}
func applicationDidBecomeActive() {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillResignActive() {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, etc.
}
func handle(_ backgroundTasks: Set<WKRefreshBackgroundTask>) {
// Sent when the system needs to launch the application in the background to process tasks. Tasks arrive in a set, so loop through and process each one.
for task in backgroundTasks {
// Use a switch statement to check the task type
switch task {
case let backgroundTask as WKApplicationRefreshBackgroundTask:
// Be sure to complete the background task once you’re done.
backgroundTask.setTaskCompleted()
case let snapshotTask as WKSnapshotRefreshBackgroundTask:
// Snapshot tasks have a unique completion call, make sure to set your expiration date
snapshotTask.setTaskCompleted(restoredDefaultState: true, estimatedSnapshotExpiration: Date.distantFuture, userInfo: nil)
case let connectivityTask as WKWatchConnectivityRefreshBackgroundTask:
// Be sure to complete the connectivity task once you’re done.
connectivityTask.setTaskCompleted()
case let urlSessionTask as WKURLSessionRefreshBackgroundTask:
// Be sure to complete the URL session task once you’re done.
urlSessionTask.setTaskCompleted()
default:
// make sure to complete unhandled task types
task.setTaskCompleted()
}
}
}
}
| [
313604,
286341,
312968,
302729,
330506,
177291,
179598,
205971,
316820,
333717,
292374,
218523,
320539,
324764,
36769,
241445,
168102,
266917,
192042,
40493,
140077,
61871,
164399,
219697,
238648,
159036,
312895,
159809,
15683,
309448,
298954,
193483,
310349,
196689,
259412,
377684,
196055,
241501,
200799,
144503,
224638,
286180,
166372,
229222,
177125,
350310,
157285,
175742,
287728,
108912,
328946,
299765,
240118,
234743,
153086
] |
1c85616f88aa1400ebb80859f50c8df8740fb0c0 | d23abb83b4af4d0522e64de4d17936e74f36de2e | /src/v1/autenticador/Controllers/MainViewController.swift | cc1e8365bd304e62d3824015c3c7c1463fc53c95 | [
"MIT"
] | permissive | luizantoniojr/autenticador | efb8d20b4a0b4dd119213d415ea00193579a295b | 1cb9bd1b67ae3f945067fdab60cc6dec630a7db9 | refs/heads/main | 2023-02-26T23:01:47.644751 | 2021-01-29T02:30:52 | 2021-01-29T02:30:52 | 326,852,826 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,851 | swift | //
// ViewController.swift
// autenticador
//
// Created by Luiz Antônio da Silva Júnior on 04/01/21.
//
import UIKit
class MainViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, AddOtpProtocol {
@IBOutlet weak var otpsTableView: UITableView!
@IBOutlet weak var periodProgressView: UIProgressView!
var otps: [Otp] = Array<Otp>()
let backgroundColor = UIColor(red: 20, green: 20, blue: 20, alpha: 0)
let otpDao = OtpDao()
override func viewDidLoad() {
super.viewDidLoad()
setupTableView()
loadOtps()
setupPeriodRefreshProgressView()
}
private func loadOtps() {
do {
otps = try otpDao.get()
self.otpsTableView.reloadData()
} catch {
Alert(controller: self).show(message: "Não foi possível ler os OTPs.")
}
}
func setupTableView() {
self.otpsTableView.dataSource = self
self.otpsTableView.delegate = self
self.otpsTableView.backgroundColor = backgroundColor
}
func setupPeriodRefreshProgressView() {
Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(refreshPeriodProgressView) , userInfo: nil, repeats: true)
}
@objc func refreshPeriodProgressView() {
let progress = getPeriodProgress()
self.periodProgressView.progress = progress
if progress <= 0.1 {
self.otpsTableView.reloadData()
}
}
func getPeriodProgress() -> Float {
let timeNow = Date().timeIntervalSince1970 / 30
let progress = timeNow.truncatingRemainder(dividingBy: 1)
return Float(progress)
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let identifier = String(describing: OtpTableViewCell.self)
let cell = tableView.dequeueReusableCell(withIdentifier: identifier, for: indexPath) as! OtpTableViewCell
let otp = otps[indexPath.section]
cell.nameLabel?.text = otp.name
cell.otpLabel?.text = otp.generate()
let longPress = UILongPressGestureRecognizer(target: self, action: #selector(showDetails))
cell.addGestureRecognizer(longPress)
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.phone ? 100 : 190;
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let headerView = UIView()
headerView.backgroundColor = backgroundColor
return headerView
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 20
}
func numberOfSections(in tableView: UITableView) -> Int {
return otps.count
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "novo",
let viewController = segue.destination as? NewOtpViewController {
viewController.delegate = self
}
}
func add(_ otp: Otp) {
do {
otps.append(otp)
try otpDao.save(otps)
self.otpsTableView.reloadData()
} catch {
otps.removeLast()
Alert(controller: self).show(message: "Não foi possível salvar o OTP.")
}
}
@objc func showDetails(_ gesture: UILongPressGestureRecognizer) {
if gesture.state == .began {
let cell = gesture.view as! UITableViewCell
if let indexPath = self.otpsTableView.indexPath(for: cell) {
let otp = otps[indexPath.section]
let acoes = getActions { (alert) in
do {
self.otps.remove(at: indexPath.section)
try self.otpDao.delete(at: indexPath.section)
self.otpsTableView.reloadData()
} catch {
Alert(controller: self).show(message: "Não foi possível remover o OTP.")
}
}
Alert(controller: self).show(title: otp.name, message: otp.seed, actions: acoes)
}
}
}
func getActions (removerHandler: @escaping (UIAlertAction) -> Void) -> [UIAlertAction] {
let removeAction = UIAlertAction(title: "Remover", style: .destructive, handler: removerHandler)
let cancelAction = UIAlertAction(title: "Cancelar", style: .cancel, handler: nil)
return [cancelAction, removeAction]
}
}
| [
-1
] |
072cf3931acd585891556c2a02c7c1a7146c6767 | 0364e1750c5e4f7d73bc25af1ee5d8475e7ee427 | /BeaconEmitter/Swift/ViewController.swift | 6d7c7e43662d638d19a0332d8ebd34793b164213 | [] | no_license | isabella232/Barcodes_with_iOS | 401d6e0265f177bb06c554f1447a18db3c4663d5 | 11183bb28653940f8f0e40d7de1d4686807f47fc | refs/heads/master | 2023-03-15T16:40:25.743708 | 2015-02-27T14:58:33 | 2015-02-27T14:58:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,015 | swift | //
// ViewController.swift
// BeaconEmitter
//
// Created by Geoff Breemer on 11/10/14.
// Copyright (c) 2014 Cocoanetics. All rights reserved.
//
import UIKit
import CoreBluetooth
import CoreLocation
import Foundation
@objc(ViewController) class ViewController: UIViewController, CBPeripheralManagerDelegate
{
@IBOutlet var UUIDTextField: UITextField?
@IBOutlet var majorTextField: UITextField?
@IBOutlet var minorTextField: UITextField?
@IBOutlet var beaconSwitch: UISwitch!
private var _peripheralManager: CBPeripheralManager?
private var _isAdvertising: Bool = false
override func viewDidLoad()
{
super.viewDidLoad()
_peripheralManager = CBPeripheralManager(delegate: self, queue: nil)
// changing autorization status kills app
_updateUIForAuthorizationStatus()
}
func _updateUIForAuthorizationStatus()
{
let status: CBPeripheralManagerAuthorizationStatus = CBPeripheralManager.authorizationStatus()
if (status == .Restricted ||
status == .Denied)
{
println("Cannot start BT peripheral, not authorized")
beaconSwitch.enabled = false
}
else
{
beaconSwitch.enabled = true
}
}
func _startAdvertising()
{
// get values from UI
let UUIDString: String = UUIDTextField!.text
let major: NSInteger = majorTextField!.text.toInt()!
let minor: NSInteger = minorTextField!.text.toInt()!
let UUID: NSUUID = NSUUID(UUIDString: UUIDString)!
// identifier cannot be nil, but is inconsequential
let region: CLBeaconRegion = CLBeaconRegion(proximityUUID: UUID, major: CLBeaconMajorValue(major), minor: CLBeaconMinorValue(minor), identifier: "FooBar")
// only care about this dictionary for advertising it
let beaconPeripheralData: Dictionary = region.peripheralDataWithMeasuredPower(nil)
_peripheralManager!.startAdvertising(beaconPeripheralData)
}
func _updateEmitterForDesiredState()
{
// only issue commands when powered on
if (_peripheralManager!.state == .PoweredOn)
{
if (_isAdvertising)
{
if (!_peripheralManager!.isAdvertising)
{
_startAdvertising()
}
}
else
{
if (_peripheralManager!.isAdvertising)
{
_peripheralManager!.stopAdvertising()
}
}
}
}
// MARK: - CBPeripheralManagerDelegate
func peripheralManagerDidUpdateState(peripheral: CBPeripheralManager!) {
_updateEmitterForDesiredState()
}
// MARK: - Actions
@IBAction func advertisingSwitch(sender: UISwitch)
{
_isAdvertising = sender.on
_updateEmitterForDesiredState()
}
} | [
-1
] |
b8d9703cde9a6e3cbbdff1728c04b3e5199f6e16 | fc1b8cb5fd5caa220998a750e5f1f191c8cb0852 | /GZWeibo007/GZWeibo007/Class/Module/Main/Controller/CZMainViewController.swift | a790e696ecf88502f0d4aef4e059f4a8909d5324 | [] | no_license | NactEunS/Code | a15594c3a0fc2339d7e8cc314e354e5a8980c891 | fd31b8a0f03fbb428b867b817305ddcec3c22b0a | refs/heads/master | 2023-05-09T17:28:22.937726 | 2021-06-17T06:29:35 | 2021-06-17T06:29:35 | 370,564,138 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,940 | swift | //
// CZMainViewController.swift
// GZWeibo007
//
// Created by Apple on 15/12/15.
// Copyright © 2015年 Apple. All rights reserved.
//
import UIKit
class CZMainViewController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
// 自定义tabbar,是只读的,不能直接使用 = 进行赋值
// KVC 进行替换
let mainTabBar = CZMainTabbar()
setValue(mainTabBar, forKey: "tabBar")
// 设置tabbar的tintColor
// self.tabBar.tintColor = UIColor.orangeColor()
// 首页
let homeVC = CZHomeViewController()
self.addChildVC(homeVC, title: "首页", imageName: "tabbar_home")
// 消息
let messageVC = CZMessageViewController()
self.addChildVC(messageVC, title: "消息", imageName: "tabbar_message_center")
// 发现
let discoveryVC = CZDiscoveryViewController()
self.addChildVC(discoveryVC, title: "发现", imageName: "tabbar_discover")
// 我
let profileVC = CZProfileViewController()
self.addChildVC(profileVC, title: "我", imageName: "tabbar_profile")
}
/// controller: 控制器
/// title: 控制器显示的标题
/// imageName: 在tabbar上面显示的图片名称
private func addChildVC(controller: UIViewController, title: String, imageName: String) {
// 包装导航控制器
self.addChildViewController(UINavigationController(rootViewController: controller))
// 设置title,导航栏和tabBar上都有
controller.title = title
// 设置图片
controller.tabBarItem.image = UIImage(named: imageName)
// 设置高亮图片
let highLightedName = imageName + "_highlighted"
controller.tabBarItem.selectedImage = UIImage(named: highLightedName)?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
// 设置文字颜色
// NSForegroundColorAttributeName: 设置文字的前景颜色
controller.tabBarItem.setTitleTextAttributes([NSForegroundColorAttributeName : UIColor.orangeColor()], forState: UIControlState.Selected)
}
// private: 方法不想让别人调用, 即可以修饰方法,也可以修饰属性
private func old() {
// 首页
let homeVC = CZHomeViewController()
// 包装导航控制器
self.addChildViewController(UINavigationController(rootViewController: homeVC))
// 设置title,导航栏和tabBar上都有
homeVC.title = "首页"
// 设置图片
homeVC.tabBarItem.image = UIImage(named: "tabbar_home")
// 消息
let messageVC = CZHomeViewController()
// 包装导航控制器
self.addChildViewController(UINavigationController(rootViewController: messageVC))
// 设置title,导航栏和tabBar上都有
messageVC.title = "消息"
// 设置图片
messageVC.tabBarItem.image = UIImage(named: "tabbar_message_center")
// 发现
let discoveryVC = CZHomeViewController()
// 包装导航控制器
self.addChildViewController(UINavigationController(rootViewController: discoveryVC))
// 设置title,导航栏和tabBar上都有
discoveryVC.title = "发现"
// 设置图片
discoveryVC.tabBarItem.image = UIImage(named: "tabbar_discover")
// 我
let profileVC = CZHomeViewController()
// 包装导航控制器
self.addChildViewController(UINavigationController(rootViewController: profileVC))
// 设置title,导航栏和tabBar上都有
profileVC.title = "我"
// 设置图片,不需要系统来渲染颜色
profileVC.tabBarItem.image = UIImage(named: "tabbar_profile")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
}
}
| [
-1
] |
7b95fc938284bb0e0bb1b3b3165c8c48ba345b68 | 77f048afddf48aa63741ae8b69d306037382d765 | /AirPorts/APIService.swift | 5ddc7d129afa6b969ef556d52b24699391856512 | [] | no_license | Tonku/Airport | 51479a3bcd56fa44ec53918b56612d529f6b2758 | 0c0773bfa545a7e7d0f39608240e4b4a1b5b7f95 | refs/heads/master | 2021-01-19T23:06:22.436984 | 2017-11-20T00:04:26 | 2017-11-20T00:04:26 | 88,925,009 | 1 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 1,920 | swift | //
// APIService.swift
// AirPorts
//
// Created by Tony Thomas on 28/2/17.
// Copyright © 2017 Tony Thomas. All rights reserved.
//
import Alamofire
import Moya
final class APIService {
static let httpSuccessCode: Int = 200
var airPortsProvider = MoyaProvider<AirPortTarget>()
static var shared: APIService {
return APIService()
}
func getAirPortList(completion: @escaping ([[String: Any]]?, AppError?)->Void) {
airPortsProvider.request(.airportList) { (response) in
switch(response) {
case let .success(moyaResponse):
if moyaResponse.statusCode == APIService.httpSuccessCode {
do {
let data = try moyaResponse.mapJSON()
if let json = data as? [String: Any],
let airPorts = json["airports"] as? [[String:Any]]{
completion(airPorts, nil)
return
} else {
completion(nil, AppError.unknownJSONFormat)
return
}
} catch {
completion(nil, AppError.unknownJSONFormat)
return
}
}
completion(nil, AppError.httpError(moyaResponse.statusCode))
case let .failure(error):
switch error {
case let .underlying(uError) where uError.0._code == NSURLErrorNotConnectedToInternet:
completion(nil, AppError.noInternetConnection)
case let .underlying(uError) where uError.0._code == NSURLErrorTimedOut:
completion(nil, AppError.requestTimeout)
default:
completion(nil, AppError.unknownError)
}
}
}
}
}
| [
-1
] |
88a00e351d6b52d16689fdd36f5e6174667be170 | 4dc074b1a8c515db7435b06f427eb6686aad159d | /WannaBasket/Enum/Quarter.swift | b3a3c329f2e16ce43342a89accff93a02a5eab92 | [] | no_license | het22/wanna-basket | 99b0febcc923fb5daa096be4548ad2f5e233dfcb | 4954ca0138d17f0b341b688f80d337f54c6f489d | refs/heads/master | 2022-12-05T11:27:37.432628 | 2020-07-30T11:50:28 | 2020-07-30T11:50:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 654 | swift | //
// Quarter.swift
// WannaBasket
//
// Created by Het Song on 09/07/2019.
// Copyright © 2019 Het Song. All rights reserved.
//
import Foundation
enum Quarter: CustomStringConvertible, Equatable {
case Regular(Int)
case Overtime(Int)
var num: Int {
switch self {
case .Regular(let num):
return num
case .Overtime(let num):
return num
}
}
var description: String {
switch self {
case .Regular:
return "\(num)"+"Q".localized
case .Overtime:
return "OT".localized + "\(num)" + "Q".localized
}
}
}
| [
-1
] |
80f65b4c546d8efbdc8d76d2edc59e7d66c73571 | 885504b26b703ac2b51d0ef785d9214a657aa5ed | /Tests/CRC32CTests/CRC32Tests.swift | 3518129301e2a8fd15b7770dfade031d172f92cc | [
"MIT"
] | permissive | tbartelmess/swift-crc32c | 65b266667b64c5887a5fd5695b23542badf30f5b | 42a512fc647a1ea457bb349d29df550dfa1d4e1e | refs/heads/main | 2022-12-26T00:55:19.351412 | 2020-10-06T01:53:22 | 2020-10-06T01:53:22 | 290,923,305 | 0 | 0 | null | 2020-10-04T16:36:46 | 2020-08-28T01:41:42 | C | UTF-8 | Swift | false | false | 1,455 | swift | import XCTest
import CRC32C
final class Swift_CRC32Tests: XCTestCase {
func testSimpleNumbersCRC32() {
let numbers:[UInt8] = [0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef]
let expected: UInt32 = 0x2F720F20
var crc = CRC32C()
crc.update(numbers)
crc.finalize()
XCTAssertEqual(crc.value, expected)
}
func testSimpleData() {
let numbers:[UInt8] = [0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, // 64 bit
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, // 128 bit
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef] // 192 bit
let expected: UInt32 = 0xBE6DF95B
let data = Data(numbers)
var crc = CRC32C()
crc.update(data)
crc.finalize()
XCTAssertEqual(crc.value, expected)
}
func test192BitValue() {
let numbers:[UInt8] = [0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, // 64 bit
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, // 128 bit
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef] // 192 bit
let data = Data(numbers)
var crc = CRC32C()
crc.update(data)
crc.finalize()
}
static var allTests = [
("testSimpleNumbersCRC32", testSimpleNumbersCRC32),
("testSimpleData", testSimpleData),
("test192BitValue", test192BitValue)
]
}
| [
-1
] |
b05299a5054f8ba0cfb791621060c6013e71d2d3 | 1ae21b2a05202badf04e53b07660c52919718a18 | /RxCocoaVideo/RxCocoaVideo/classes/Douyin/View/SmallVideoLayout.swift | 8259f803cffa327d753feba98f8ad01679dde55a | [] | no_license | huanghuzhijing/Real | c6ab686fea17091d49fce13dea500a8a73b2120a | 171403bbd273650d153b692e4fa1d81246cca109 | refs/heads/master | 2020-05-23T12:14:04.382218 | 2019-05-26T14:44:51 | 2019-05-26T14:44:51 | 186,753,141 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 483 | swift | //
// SmallVideoLayout.swift
// RxCocoaVideo
//
// Created by 胡涛 on 2018/7/12.
// Copyright © 2018年 胡涛. All rights reserved.
//
import UIKit
class SmallVideoLayout: UICollectionViewFlowLayout {
override func prepare() {
super.prepare()
itemSize = CGSize(width: collectionView!.width, height: collectionView!.height)
minimumLineSpacing = 0
minimumInteritemSpacing = 0
scrollDirection = .vertical
}
}
| [
-1
] |
12a8b7220eb22a5f2bc48e94b6f6e06e6fa5da43 | c96f94c8529c9acfd46128bc150a1cdca409f5e1 | /ios-hue/LightTableViewController.swift | e440b4b08975953559dead370f848539fa128e7f | [] | no_license | rbnpst/ios-hue | 54876a9d0abfbd92db16e93cace2142e1386f5b8 | 9b92ff3723ef40c366743d10ad1e14a89ca2a492 | refs/heads/master | 2021-07-07T07:39:47.043392 | 2017-09-29T09:52:44 | 2017-09-29T09:52:44 | 105,150,113 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,882 | swift | //
// LightTableViewController.swift
// ios-hue
//
// Created by Robin on 28/09/2017.
// Copyright © 2017 Robin. All rights reserved.
//
import UIKit
class LightTableViewController: UITableViewController {
var hostname: String = ""
var username: String = ""
var place : Place?
var lights : [Light] = []
var api = HueAPI()
override func viewDidLoad() {
super.viewDidLoad()
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
let hostname = place?.hostname
let username = place?.username
api.requestLights(url: hostname!, username: username!) { response in
self.lights = response
self.tableView.reloadData()
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return lights.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "lightIdentifier", for: indexPath) as! LightTableViewCell
let hostname = place?.hostname
let username = place?.username
let light : Light = lights[indexPath.row]
cell.labelLightName.text = light.name
cell.switchLightOn.setOn(lights[indexPath.row].on!, animated: false)
cell.lightId = light.id!
cell.hostname = hostname!
cell.username = username!
return cell
}
/*
// Override to support conditional editing of the table view.
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
*/
/*
// Override to support editing the table view.
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
// Delete the row from the data source
tableView.deleteRows(at: [indexPath], with: .fade)
} else if editingStyle == .insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) {
}
*/
/*
// Override to support conditional rearranging of the table view.
override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the item to be re-orderable.
return true
}
*/
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
8d6dcf012ab5df833d2a6c5f476be546a2e66775 | 7ea3687250c9a9f5a3517af8f2919731167206fc | /Anchors/Anchors/Helper/String+Extension.swift | 80c4a7afde91bb46e67915928db510b7ab055195 | [] | no_license | JarvisTheAvenger/Anchors-UITest | dd9e04ea79168634f1afdfe9cab0973323d6fa35 | 1ca7b6f129d953817a93f1d29cd736ce80e4998b | refs/heads/main | 2023-04-21T02:50:35.495906 | 2021-05-09T04:17:44 | 2021-05-09T04:17:44 | 365,662,035 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 392 | swift | //
// String+Extension.swift
// Anchors
//
// Created by Rahul on 08/05/21.
//
import Foundation
extension String {
func isEmail() -> Bool {
let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"
let emailTest = NSPredicate(format:"SELF MATCHES %@", emailRegEx)
let isValid = emailTest.evaluate(with: self)
return isValid
}
}
| [
-1
] |
89f20c5bcab92487b4ba509866286457c8d9dd35 | 9d6c0dbaa30a125ba3451360d798a10ae06585f6 | /Sources/Swim/Draw/DrawImage.swift | 43c1029ec8ffd3ece2531263e395a7e6b1c8c244 | [
"MIT"
] | permissive | JaviSoto/swim | 342ce0d2da8659139b5f137d3b6f7d68a7adbbd0 | 32410cab08bf63ed5bfffb3aeb9edd47a58012c2 | refs/heads/master | 2022-04-23T16:58:44.231831 | 2020-04-21T18:33:43 | 2020-04-21T18:33:48 | 257,681,530 | 1 | 0 | MIT | 2020-04-21T18:28:57 | 2020-04-21T18:28:56 | null | UTF-8 | Swift | false | false | 9,125 | swift | extension Image where P: NoAlpha {
/// Draw image.
///
/// This method simply overwrites the pixel values. `self`'s colors in drawing area does no effect.
///
/// - Parameters:
/// - origin: Origin in `self` to draw
/// - image: Image to draw.
/// - mask: If given, `image[x, y]` is drawn iff `mask[x, y]` is `true`.
/// - Precondition: `image` and `mask` have same size.
@inlinable
public mutating func drawImage(origin: (x: Int, y: Int),
image: Image,
mask: Image<Gray, Bool>? = nil) {
precondition(image.size == mask?.size ?? image.size, "Image and mask must have same size.")
guard origin.x < width && origin.y < height
&& origin.x + image.width > 0 && origin.y + image.height > 0 else {
// Drawing area is out of image.
return
}
let selfRangeX = max(origin.x, 0)..<min(origin.x + image.width, width)
let selfRangeY = max(origin.y, 0)..<min(origin.y + image.height, height)
let imageStartX = max(-origin.x, 0)
let imageStartY = max(-origin.y, 0)
unsafePixelwiseConvert(selfRangeX, selfRangeY) { ref in
let imageX = ref.x - selfRangeX.startIndex + imageStartX
let imageY = ref.y - selfRangeY.startIndex + imageStartY
guard mask?[imageX, imageY, .gray] ?? true else {
return
}
ref.setColor(x: imageX, y: imageY, in: image)
}
}
}
extension Image where P: NoAlpha, T: BinaryInteger {
/// Draw image with alpha blending.
///
/// Pixel values are assumed to be in range [0, 255].
@inlinable
public mutating func drawImage<P2: HasAlpha>(origin: (x: Int, y: Int),
image: Image<P2, T>) where P2.BaseType == P {
guard origin.x < width && origin.y < height
&& origin.x + image.width > 0 && origin.y + image.height > 0 else {
// Drawing area is out of image.
return
}
let selfRangeX = max(origin.x, 0)..<min(origin.x + image.width, width)
let selfRangeY = max(origin.y, 0)..<min(origin.y + image.height, height)
let imageStartX = max(-origin.x, 0)
let imageStartY = max(-origin.y, 0)
unsafePixelwiseConvert(selfRangeX, selfRangeY) { ref in
let imageX = ref.x - selfRangeX.startIndex + imageStartX
let imageY = ref.y - selfRangeY.startIndex + imageStartY
let alpha = Int(image[imageX, imageY, P2.alphaIndex])
guard alpha > 0 else {
return
}
let colorStartIndex = image.dataIndex(x: imageX, y: imageY, c: P2.colorStartIndex)
for c in 0..<P.channels {
let value: Int = (255-alpha) * Int(ref[c])
+ alpha * Int(image.data[colorStartIndex + c])
ref[c] = T(value / 255)
}
}
}
}
extension Image where P: NoAlpha, T: BinaryFloatingPoint {
/// Draw image with alpha blending.
///
/// Pixel values are assumed to be in range [0, 1].
@inlinable
public mutating func drawImage<P2: HasAlpha>(origin: (x: Int, y: Int),
image: Image<P2, T>) where P2.BaseType == P {
guard origin.x < width && origin.y < height
&& origin.x + image.width > 0 && origin.y + image.height > 0 else {
// Drawing area is out of image.
return
}
let selfRangeX = max(origin.x, 0)..<min(origin.x + image.width, width)
let selfRangeY = max(origin.y, 0)..<min(origin.y + image.height, height)
let imageStartX = max(-origin.x, 0)
let imageStartY = max(-origin.y, 0)
unsafePixelwiseConvert(selfRangeX, selfRangeY) { ref in
let imageX = ref.x - selfRangeX.startIndex + imageStartX
let imageY = ref.y - selfRangeY.startIndex + imageStartY
let alpha = image[imageX, imageY, P2.alphaIndex]
guard alpha > 0 else {
return
}
let colorStartIndex = image.dataIndex(x: imageX, y: imageY, c: P2.colorStartIndex)
for c in 0..<P.channels {
ref[c] *= (1-alpha)
ref[c] += alpha * image.data[colorStartIndex + c]
}
}
}
}
extension Image where P: HasAlpha, T: BinaryInteger {
/// Draw image with alpha blending.
///
/// Pixel values are assumed to be in range [0, 255].
///
/// - Note: If you simply want overwriting rather than alpha blending, use `image.subscript(xRange:, yRange:)`'s setter.
@inlinable
public mutating func drawImage<P2: HasAlpha>(origin: (x: Int, y: Int),
image: Image<P2, T>) where P2.BaseType == P.BaseType{
guard origin.x < width && origin.y < height
&& origin.x + image.width > 0 && origin.y + image.height > 0 else {
// Drawing area is out of image.
return
}
let selfRangeX = max(origin.x, 0)..<min(origin.x + image.width, width)
let selfRangeY = max(origin.y, 0)..<min(origin.y + image.height, height)
let imageStartX = max(-origin.x, 0)
let imageStartY = max(-origin.y, 0)
unsafePixelwiseConvert(selfRangeX, selfRangeY) { ref in
let imageX = ref.x - selfRangeX.startIndex + imageStartX
let imageY = ref.y - selfRangeY.startIndex + imageStartY
let imageAlpha = Int(image[imageX, imageY, P2.alphaIndex])
let imageColorStartIndex = image.dataIndex(x: imageX, y: imageY, c: P2.colorStartIndex)
let selfAlpha = Int(ref[P2.alphaIndex])
if imageAlpha == 0 {
if selfAlpha == 0 {
for c in 0..<P.channels {
ref[P.colorStartIndex + c] = 0
}
} else {
// Keep color
}
} else {
let factor = (255-imageAlpha) * selfAlpha
let blendAlpha255 = (255*imageAlpha + factor)
for c in 0..<P.channels {
let colorIndex = P.colorStartIndex + c
var value = Int(ref[colorIndex]) * factor
value += 255 * imageAlpha * Int(image.data[imageColorStartIndex + c])
value /= blendAlpha255
ref[colorIndex] = T(value)
}
ref[P.alphaIndex] = T(blendAlpha255 / 255)
}
}
}
}
extension Image where P: HasAlpha, T: BinaryFloatingPoint {
/// Draw image with alpha blending.
///
/// Pixel values are assumed to be in range [0, 1].
///
/// - Note: If you simply want overwriting rather than alpha blending, use `image.subscript(xRange:, yRange:)`'s setter.
@inlinable
public mutating func drawImage<P2: HasAlpha>(origin: (x: Int, y: Int),
image: Image<P2, T>) where P2.BaseType == P.BaseType{
guard origin.x < width && origin.y < height
&& origin.x + image.width > 0 && origin.y + image.height > 0 else {
// Drawing area is out of image.
return
}
let selfRangeX = max(origin.x, 0)..<min(origin.x + image.width, width)
let selfRangeY = max(origin.y, 0)..<min(origin.y + image.height, height)
let imageStartX = max(-origin.x, 0)
let imageStartY = max(-origin.y, 0)
unsafePixelwiseConvert(selfRangeX, selfRangeY) { ref in
let imageX = ref.x - selfRangeX.startIndex + imageStartX
let imageY = ref.y - selfRangeY.startIndex + imageStartY
let imageAlpha = image[imageX, imageY, P2.alphaIndex]
let imageColorStartIndex = image.dataIndex(x: imageX, y: imageY, c: P2.colorStartIndex)
let selfAlpha = ref[P2.alphaIndex]
if imageAlpha == 0 {
if selfAlpha == 0 {
for c in 0..<P.channels {
ref[P.colorStartIndex + c] = 0
}
} else {
// Keep color
}
} else {
let factor = (1-imageAlpha) * selfAlpha
let blendAlpha = imageAlpha + factor
for c in 0..<P.channels {
let colorIndex = P.colorStartIndex + c
ref[colorIndex] *= factor
ref[colorIndex] += imageAlpha * image.data[imageColorStartIndex + c]
ref[colorIndex] /= blendAlpha
}
ref[P.alphaIndex] = blendAlpha
}
}
}
}
| [
-1
] |
5989338ff5df760d8d85ed2425a4b5d02125ac97 | 49d8bb3ce02fe9c1b633734963b371813f9a7678 | /SettingsController.swift | 34842552669c254fb35cdc810fd45fa382edfc45 | [] | no_license | cminson/AudioDrive | f2aa3ced8eaa00a063d97f0dd1609ddcf2c70a87 | 1cbef19d0152402527b59bbe1543d05799fe59bb | refs/heads/master | 2022-09-26T12:12:04.403836 | 2020-06-06T22:17:53 | 2020-06-06T22:17:53 | 265,960,491 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,545 | swift | //
// SettingsController.swift
// AudioDrive
//
// Created by Christopher on 5/9/20.
// Copyright © 2020 Christopher Minson. All rights reserved.
//
import UIKit
import GoogleSignIn
import GoogleAPIClientForREST
import GTMSessionFetcher
let COLOR_REDDISH = UIColor(hex: "#990033ff")
let COLOR_GREENISH = UIColor(hex: "#006400ff")
extension UIColor {
public convenience init?(hex: String) {
let r, g, b, a: CGFloat
if hex.hasPrefix("#") {
let start = hex.index(hex.startIndex, offsetBy: 1)
let hexColor = String(hex[start...])
if hexColor.count == 8 {
let scanner = Scanner(string: hexColor)
var hexNumber: UInt64 = 0
if scanner.scanHexInt64(&hexNumber) {
r = CGFloat((hexNumber & 0xff000000) >> 24) / 255
g = CGFloat((hexNumber & 0x00ff0000) >> 16) / 255
b = CGFloat((hexNumber & 0x0000ff00) >> 8) / 255
a = CGFloat(hexNumber & 0x000000ff) / 255
self.init(red: r, green: g, blue: b, alpha: a)
return
}
}
}
return nil
}
}
class SettingsController: UIViewController, GIDSignInDelegate {
@IBOutlet weak var UIUploadFolder: UITextField!
@IBOutlet weak var UIAudioType: UISegmentedControl!
@IBOutlet weak var UIAudioSampleRate: UISegmentedControl!
@IBOutlet weak var UIAudioBitRate: UISegmentedControl!
@IBOutlet weak var UIGoogleButton: UIButton!
var parentController: ViewController?
override func viewDidLoad() {
super.viewDidLoad()
self.title = "Settings"
GIDSignIn.sharedInstance()?.clientID = CLIENT_ID
GIDSignIn.sharedInstance().delegate = self
GIDSignIn.sharedInstance()?.presentingViewController = self
GIDSignIn.sharedInstance()?.restorePreviousSignIn()
}
override func viewWillAppear(_ animated: Bool) {
Settings().loadSettings()
UIUploadFolder.text = ConfigUploadFolder
if (ConfigAudioBitRate == "96,000") {
UIAudioBitRate.selectedSegmentIndex = 0
}
else if (ConfigAudioBitRate == "128,000") {
UIAudioBitRate.selectedSegmentIndex = 1
}
else {
UIAudioBitRate.selectedSegmentIndex = 2
}
if GIDSignIn.sharedInstance()?.currentUser != nil {
// we're signed in, so display sign out option
UIGoogleButton.setTitle("Sign Out of Google", for: .normal)
UIGoogleButton.backgroundColor = COLOR_REDDISH
} else {
// we're signed out, so display sign in option
UIGoogleButton.setTitle("Sign Into Google", for: .normal)
UIGoogleButton.backgroundColor = COLOR_GREENISH
}
super.viewWillAppear(animated)
}
override func viewWillDisappear(_ animated: Bool) {
var uploadFolder = DEFAULT_UPLOAD_FOLDER
if (uploadFolder.count > 0) {uploadFolder = UIUploadFolder.text!}
let audioBitRate = UIAudioBitRate.titleForSegment(at: UIAudioBitRate.selectedSegmentIndex)!
Settings().saveSettings(uploadFolder: uploadFolder,
audioBitRate: audioBitRate
)
Settings().loadSettings()
super.viewWillDisappear(animated)
}
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!,
withError error: Error!) {
if let error = error {
if (error as NSError).code == GIDSignInErrorCode.hasNoAuthInKeychain.rawValue {
print("The user has not signed in before or they have since signed out.")
} else {
print("\(error.localizedDescription)")
}
return
}
AudioDriveGoogleUser = user
GoogleDriveService.authorizer = user.authentication.fetcherAuthorizer()
print("Settings Controller: User signed in")
// update button state to show we are signed out
UIGoogleButton.setTitle("Sign Out Of Google", for: .normal)
UIGoogleButton.backgroundColor = COLOR_REDDISH
// update parent UI for the new google state
parentController?.setGoogleStatusUI()
// upload anything that is hanging around locally
parentController?.connectToGoogleDrive(uploadFiles: true)
}
func sign(_ signIn: GIDSignIn!, didDisconnectWith user: GIDGoogleUser!,
withError error: Error!) {
print("User disconnecting")
}
@IBAction func SignIntoGoogle(_ sender: Any) {
if signedIntoGoogle() {
checkGoogleSignOut()
} else
{
googleSignIn()
}
}
func signedIntoGoogle() -> Bool {
if GIDSignIn.sharedInstance()?.currentUser != nil {
return true
}
return false
}
func googleSignIn() {
GIDSignIn.sharedInstance()?.signIn()
GIDSignIn.sharedInstance()?.scopes = [kGTLRAuthScopeDrive]
print("Signed In")
}
func googleSignOut() {
UIGoogleButton.setTitle("Sign Into Google", for: .normal)
UIGoogleButton.backgroundColor = COLOR_GREENISH
GIDSignIn.sharedInstance()?.signOut()
print("Signed Out")
}
func checkGoogleSignOut() {
let alert = UIAlertController(title: "Are you sure?",
message: "Audio files will not upload until you sign back into google again",
preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "No, Don't Sign Out", style: UIAlertAction.Style.default, handler: { _ in
//Cancel Action
}))
alert.addAction(UIAlertAction(title: "Yes, Sign out",
style: UIAlertAction.Style.default,
handler: {(_: UIAlertAction!) in
//Sign out action
self.googleSignOut()
}))
self.present(alert, animated: true, completion: nil)
}
}
| [
-1
] |
dffb8e8ed21a6192ec12e2f97fa7a6d625cc4750 | 27caaa8ba96cce30fc23ddf9d572fe7723046d4f | /LNFabDialog/Classes/LNFabAlertView.swift | 7e646a38492a34087dbc18af81b0b5668428bf80 | [
"MIT"
] | permissive | lucasanovaes/LNFabDialog | eb5bf40ccae7e56b1966bafdfd3600baa4333046 | e7ed5aa8d499e30c4e5a532693b58a45f9b85d95 | refs/heads/master | 2021-05-12T00:27:21.191039 | 2018-01-23T11:53:34 | 2018-01-23T11:53:34 | 117,535,626 | 1 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 5,606 | swift | //
// LNFabItemAlertView.swift
// LNFabDialog
//
// Created by iCasei Site on 15/01/2018.
// Copyright © 2018 Lucas Novaes. All rights reserved.
//
import UIKit
protocol LNFabAlertViewDelegate: class{
func didSelectRow(_ tableView: UITableView, at indexPath: IndexPath)
}
internal class LNFabAlertView: UIView{
fileprivate var tableView = UITableView()
fileprivate var tableViewHeader = UIView()
fileprivate var tableViewFooter = UIView()
weak var delegate: LNFabAlertViewDelegate?
var model: LNFabItemModel
var alertLayer = CAShapeLayer()
fileprivate let tableViewCellIdentifier = "LNFabItem"
init(delegate: LNFabAlertViewDelegate, model: LNFabItemModel) {
self.delegate = delegate
self.model = model
super.init(frame: LNFabAlertView.alertFrame(model: model))
// Refatorar o model para um unico objeto com uma propriedade [LNFabItemModel] que tem como um dos parametros o TITLE do alert
setTableViewHeader(title: model.sectionTitle, font: model.sectionFont)
setTableView()
setAlertShadowLayer()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
fileprivate func setTableView(){
tableView = UITableView(frame: self.bounds, style: .grouped)
addSubview(tableView)
tableView.delegate = self
tableView.dataSource = self
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = UIColor.white
tableView.separatorStyle = .none
tableView.register(UINib(nibName: "LNFabItemTableViewCell", bundle: Bundle(for: LNFabItemTableViewCell.self)), forCellReuseIdentifier: tableViewCellIdentifier)
tableView.reloadData()
}
fileprivate func setAlertShadowLayer() {
alertLayer.frame = CGRect(x: 0, y: 0, width: frame.size.width, height: frame.size.height)
alertLayer.backgroundColor = UIColor.white.cgColor
alertLayer.cornerRadius = 2
layer.addSublayer(alertLayer)
bringSubview(toFront: tableView)
alertLayer.shadowOffset = CGSize(width: 1, height: 10)
alertLayer.shadowRadius = 8
alertLayer.shadowColor = UIColor.black.cgColor
alertLayer.shadowOpacity = 0.4
}
private func setTableViewHeader(title: String, font: UIFont?){
tableViewHeader = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.width))
let supportText = UILabel(frame: CGRect(x: 24, y: 24, width: UIScreen.main.bounds.width - 48, height: 24))
supportText.text = title
supportText.font = font
tableViewHeader.addSubview(supportText)
}
// Issue #1 - Implement dynamic LNFabAlertView item (UITableViewCell) size.
private static func alertFrame(model: LNFabItemModel) -> CGRect{
let screenSize = UIScreen.main.bounds
let maxAlertWidth: CGFloat = 336
let sideSpace: CGFloat = 20
let alertWidth = screenSize.width - CGFloat(sideSpace * 2) // Calculating alert width base on side spaces and screen width
let finalAlertWidth = alertWidth > maxAlertWidth ? maxAlertWidth : alertWidth
let alertFinalHeight = LNFabAlertView.alertHeight(model: model)
return CGRect(x: (screenSize.width / 2) - finalAlertWidth / 2, y: (screenSize.height / 2) - (alertFinalHeight / 2), width: finalAlertWidth, height: alertFinalHeight)
}
private static func alertHeight(model: LNFabItemModel) -> CGFloat{
let itemSize: CGFloat = 56.0
let maxNumberOfItensInAlert: CGFloat = 5
let alertInitialHeight = CGFloat(model.itens.count * Int(itemSize)) + 68
if alertInitialHeight > itemSize * maxNumberOfItensInAlert{
return (itemSize * maxNumberOfItensInAlert) + 68
}
return alertInitialHeight
}
}
// MARK: TableView Delegate & DataSource
extension LNFabAlertView: UITableViewDelegate, UITableViewDataSource{
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return model.itens.count
}
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: tableViewCellIdentifier) as! LNFabItemTableViewCell
cell.fill(model: model.itens[indexPath.row])
return cell
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
tableViewHeader.backgroundColor = UIColor.white
return tableViewHeader
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
tableViewFooter.backgroundColor = UIColor.white
return tableViewFooter
}
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
delegate?.didSelectRow(tableView, at: indexPath)
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 56
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 68
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 20
}
}
| [
-1
] |
0dbb1f846946eae51a6ffed92386baaaad3379f6 | 6b26e6bc82723e3198c19ff30ea3a30e983b5119 | /CoachMarkGuide/AppDelegate.swift | d2fd6624d2569b904e8993d4a72f0de39da3162d | [] | no_license | ernielikesapple/coachMarkGuide | 8964df66765cd51d5d7076e941aad9e3d4c3047a | 760a301b7abe9cb8b2911cee9a748e13db037b1f | refs/heads/master | 2020-12-02T23:57:31.701413 | 2017-07-05T15:00:50 | 2017-07-05T15:00:50 | 95,966,688 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,984 | swift | //
// AppDelegate.swift
// CoachMarkGuide
//
// Created by ernie.cheng on 7/1/17.
// Copyright © 2017 ernie.cheng. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// get current version
let infoDictionary = Bundle.main.infoDictionary
let currentAppVersion = infoDictionary!["CFBundleShortVersionString"] as! String
// retrieve former version
let userDefaults = UserDefaults.standard
let appVersion = userDefaults.string(forKey: "appVersion")
let storyboard = UIStoryboard(name: "Main", bundle: nil)
// 1st time open or been updated
if appVersion == nil || appVersion != currentAppVersion {
// save lastest version
userDefaults.setValue(currentAppVersion, forKey: "appVersion")
let guideViewController = storyboard.instantiateViewController(withIdentifier: "GuideViewController") as! ViewController
self.window?.rootViewController = guideViewController
}
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:.
}
}
| [
284377,
40509
] |
a2a33fcd618c22735bc0ec1152ef5fb280c01b04 | f12a9116d79572cc22c7e39295e64e93636950e3 | /Strings.playground/Pages/Exercise-Go! Fight! Win!.xcplaygroundpage/Contents.swift | 8a71f223f061666e5cd98b4ec7bc06fff85a38ed | [] | no_license | Fdelgado14/AdvancedPlaygroundRepo | f1d1b9b03ddbff668a3fc6b48ae39b17f1e24760 | 1635a158818f4b424733c19682ff966f8b922b19 | refs/heads/master | 2022-11-16T22:53:19.283773 | 2020-07-14T17:44:17 | 2020-07-14T17:44:17 | 279,652,248 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,012 | swift | /*:
## Exercise: Go! Fight! Win!
Many schools have “fight songs”: Students learn at least some portion of the words and then sing the songs together loudly at school events like sports games.
You’ve decided that your school’s fight song needs a rewrite. You want to edit the song in code so you don’t have to copy and paste as much while you work.
1. Edit the `song` to have more than a repeated refrain.
2. Edit the `refrain` to have actual words.
3. Edit the `refrain` to use the `schoolName` at least twice.
4. Test your work by changing the school name to a fictional school.
Use string interpolation in case you decide to sell your brilliant song to another school.
- note:
Use the show result button to view the results of your work.
*/
let schoolName = "KCP"
let refrain = "One, Two, Three! \(schoolName)! Take The Lead!"
let song = "\(refrain)\n\(refrain)\nYes, \(refrain)"
//:
//:[Previous](@previous) | page 15 of 16 | [Next: Exercise: Displaying Values](@next)
| [
-1
] |
ce38722cd4bb20471dfc467a75bb4e7adb63dbe1 | 93e98e1a0958a4fa0aebb818c108697178eeda0d | /MoodTracker/MoodTracker/PersonTableViewCell.swift | 1e8f37dc6fbe5da7a80990fc715cb9ecfb623bdc | [] | no_license | ShennyO/MakeSchool-MOB1 | 515e40d3e32d5f25a27cf01a571313c49ca38e54 | 5583adbbea2e4277272a6e0b705e0d79e9a13f7c | refs/heads/master | 2021-07-17T21:52:16.562955 | 2017-10-24T00:53:55 | 2017-10-24T00:53:55 | 107,935,778 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 618 | swift | //
// PersonTableViewCell.swift
// MoodTracker
//
// Created by Sunny Ouyang on 9/28/17.
// Copyright © 2017 Sunny Ouyang. All rights reserved.
//
import UIKit
class PersonTableViewCell: UITableViewCell {
@IBOutlet weak var personNameLabel: UILabel!
@IBOutlet weak var personMoodLabel: 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
}
}
| [
258720,
233857,
317378,
306724,
306725,
382282,
168300,
230733,
279757,
323532,
323536,
222835,
278228,
300533,
276406,
278231,
310840,
230746
] |
213a0b337c3c87bced9ea777894a2cf887c2ba4b | bcb772cb40f87325d9f364d2fef9a9e0a8d39048 | /UserPostTableViewController.swift | 0f0d9774855fddbb5920ea6266b570185cded8e1 | [
"MIT"
] | permissive | dx14/Glenna | 6d7fdac1829b35a5b7e3223bae3d860fcf402e2f | ee947d1fcfe2eb0b298210ad1f824ad0ecbef9ce | refs/heads/master | 2021-01-23T02:23:02.155295 | 2018-08-27T01:13:39 | 2018-08-27T01:13:39 | 85,987,814 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 900 | swift | //
// UserPostTableViewController.swift
// Glenna
//
// Created by dennis on 12/10/16.
// Copyright © 2016 Dennis Xu, Vanessa Wu, William Yang. All rights reserved.
//
import UIKit
class UserPostTableViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
228945,
292427
] |
c453a24ecf44c80d06c50f1efacdb58b90e97e34 | 84770e88d4186e21c21a8a2bbc4f33172c1a02bf | /Specs/TBX/generated/Swift/Sources/Requests/AuthorizationService/AuthorizationServiceCreateRuleToOverrideResponse.swift | 0d84eada17384c925d9dd2371efc102c6ca1b1be | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | mirage3d/SwagGen | e9826d36d5fba8ec47be1d5ed9a55afb9a3752d4 | cb9f6674f4c30b33f113c446c777950f7eae6e15 | refs/heads/master | 2020-03-26T16:00:52.620961 | 2018-08-03T06:46:43 | 2018-08-03T06:46:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,546 | swift | //
// Generated by SwagGen
// https://github.com/yonaskolb/SwagGen
//
import Foundation
extension TBX.AuthorizationService {
public enum AuthorizationServiceCreateRuleToOverrideResponse {
public static let service = APIService<Response>(id: "AuthorizationService.createRuleToOverrideResponse", tag: "AuthorizationService", method: "POST", path: "/AuthorizationServices/overrideRule", hasBody: true)
public final class Request: APIRequest<Response> {
public struct Options {
/** List of URNs to override */
public var urn: String
/** Token credits */
public var response: Bool
/** List of countries to override */
public var country: String?
/** List of IDPs to override */
public var idp: String?
/** List of actions to override */
public var action: String?
/** Start date */
public var dateFrom: DateTime?
/** until date */
public var dateUntil: DateTime?
/** Priority Order */
public var priority: Double?
public init(urn: String, response: Bool, country: String? = nil, idp: String? = nil, action: String? = nil, dateFrom: DateTime? = nil, dateUntil: DateTime? = nil, priority: Double? = nil) {
self.urn = urn
self.response = response
self.country = country
self.idp = idp
self.action = action
self.dateFrom = dateFrom
self.dateUntil = dateUntil
self.priority = priority
}
}
public var options: Options
public init(options: Options) {
self.options = options
super.init(service: AuthorizationServiceCreateRuleToOverrideResponse.service)
}
/// convenience initialiser so an Option doesn't have to be created
public convenience init(urn: String, response: Bool, country: String? = nil, idp: String? = nil, action: String? = nil, dateFrom: DateTime? = nil, dateUntil: DateTime? = nil, priority: Double? = nil) {
let options = Options(urn: urn, response: response, country: country, idp: idp, action: action, dateFrom: dateFrom, dateUntil: dateUntil, priority: priority)
self.init(options: options)
}
public override var parameters: [String: Any] {
var params: [String: Any] = [:]
params["urn"] = options.urn
params["response"] = options.response
if let country = options.country {
params["country"] = country
}
if let idp = options.idp {
params["idp"] = idp
}
if let action = options.action {
params["action"] = action
}
if let dateFrom = options.dateFrom?.encode() {
params["dateFrom"] = dateFrom
}
if let dateUntil = options.dateUntil?.encode() {
params["dateUntil"] = dateUntil
}
if let priority = options.priority {
params["priority"] = priority
}
return params
}
}
public enum Response: APIResponseValue, CustomStringConvertible, CustomDebugStringConvertible {
public typealias SuccessType = OverrideRuleObject
/** Request was successful */
case status200(OverrideRuleObject)
/** Bad Request */
case status400(ErrorObject)
/** Unauthorized */
case status401(ErrorObject)
/** Customer or Device not Found */
case status404(ErrorObject)
/** Device was Logged Out or the customer not longer exists */
case status410(ErrorObject)
public var success: OverrideRuleObject? {
switch self {
case .status200(let response): return response
default: return nil
}
}
public var failure: ErrorObject? {
switch self {
case .status400(let response): return response
case .status401(let response): return response
case .status404(let response): return response
case .status410(let response): return response
default: return nil
}
}
/// either success or failure value. Success is anything in the 200..<300 status code range
public var responseResult: APIResponseResult<OverrideRuleObject, ErrorObject> {
if let successValue = success {
return .success(successValue)
} else if let failureValue = failure {
return .failure(failureValue)
} else {
fatalError("Response does not have success or failure response")
}
}
public var response: Any {
switch self {
case .status200(let response): return response
case .status400(let response): return response
case .status401(let response): return response
case .status404(let response): return response
case .status410(let response): return response
}
}
public var statusCode: Int {
switch self {
case .status200: return 200
case .status400: return 400
case .status401: return 401
case .status404: return 404
case .status410: return 410
}
}
public var successful: Bool {
switch self {
case .status200: return true
case .status400: return false
case .status401: return false
case .status404: return false
case .status410: return false
}
}
public init(statusCode: Int, data: Data, decoder: ResponseDecoder) throws {
switch statusCode {
case 200: self = try .status200(decoder.decode(OverrideRuleObject.self, from: data))
case 400: self = try .status400(decoder.decode(ErrorObject.self, from: data))
case 401: self = try .status401(decoder.decode(ErrorObject.self, from: data))
case 404: self = try .status404(decoder.decode(ErrorObject.self, from: data))
case 410: self = try .status410(decoder.decode(ErrorObject.self, from: data))
default: throw APIClientError.unexpectedStatusCode(statusCode: statusCode, data: data)
}
}
public var description: String {
return "\(statusCode) \(successful ? "success" : "failure")"
}
public var debugDescription: String {
var string = description
let responseString = "\(response)"
if responseString != "()" {
string += "\n\(responseString)"
}
return string
}
}
}
}
| [
-1
] |
5d9ce51ca2a3a0648346f7f512bcada64d25ac90 | 2da3d0339f504fc7c3eb478e1c34f667c1fcf99a | /Variable/Variable/ContentView.swift | 9460b71c3ae3fb4f1fa5bdefd59520f5bd1bb28a | [] | no_license | LyvennithaQgen/DataTransferSwiftUI | 1c351055bebab84a09c27c76708a62d1fca4da84 | fbb24c36fb8f5726abd7c21eee5d0549f8d4595a | refs/heads/main | 2023-07-19T11:12:44.354971 | 2021-09-27T05:48:46 | 2021-09-27T05:48:46 | 410,756,824 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 678 | swift | //
// ContentView.swift
// Variable
//
// Created by Lyvennitha on 03/09/21.
//
import SwiftUI
struct ContentView: View {
@State public var InitStr: String = "Hello World from View!"
var body: some View{
NavigationView {
NavigationLink(destination: WeatherView(Str: $InitStr)){//passing initstr //to Str of weatherView
Text("Hello World")
.foregroundColor(.black)
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
struct WeatherView: View{
@Binding var Str: String
var body: some View{
Text(Str)
}
}
| [
-1
] |
d978b189277b21348cabecc3bd94ebb993d27b80 | 025bc68c919a9db12e6c13a13c6de111bae0fe76 | /main.swift | 90597c6864dd306393a82f03f6af867ec944b3a4 | [] | no_license | levidavis111/Hangman | 11ffd9c25a575ae3b25f65473c63f0defe976e59 | 4c005f02c644bd6e6dd3fe8d18d3634a9c3944be | refs/heads/master | 2020-06-19T22:08:21.812565 | 2019-07-14T23:18:27 | 2019-07-14T23:18:27 | 196,892,409 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 11,903 | swift | //
// main.swift
// hangman-project-levi
//
// Created by Levi Davis on 7/12/19.
// Copyright © 2019 Levi Davis. All rights reserved.
//
import Foundation
let allTheWords = ["able", "about", "account", "acid", "across", "addition", "adjustment", "advertisement", "after", "again", "against", "agreement", "almost", "among", "amount", "amusement", "angle", "angry", "animal", "answer", "apparatus", "apple", "approval", "arch", "argument", "army", "attack", "attempt", "attention", "attraction", "authority", "automatic", "awake", "baby", "back", "balance", "ball", "band", "base", "basin", "basket", "bath", "beautiful", "because", "before", "behaviour", "belief", "bell", "bent", "berry", "between", "bird", "birth", "bite", "bitter", "black", "blade", "blood", "blow", "blue", "board", "boat", "body", "boiling", "bone", "book", "boot", "bottle", "brain", "brake", "branch", "brass", "bread", "breath", "brick", "bridge", "bright", "broken", "brother", "brown", "brush", "bucket", "building", "bulb", "burn", "burst", "business", "butter", "button", "cake", "camera", "canvas", "card", "care", "carriage", "cart", "cause", "certain", "chain", "chalk", "chance", "change", "cheap", "cheese", "chemical", "chest", "chief", "chin", "church", "circle", "clean", "clear", "clock", "cloth", "cloud", "coal", "coat", "cold", "collar", "colour", "comb", "come", "comfort", "committee", "common", "company", "comparison", "competition", "complete", "complex", "condition", "connection", "conscious", "control", "cook", "copper", "copy", "cord", "cork", "cotton", "cough", "country", "cover", "crack", "credit", "crime", "cruel", "crush", "current", "curtain", "curve", "cushion", "damage", "danger", "dark", "daughter", "dead", "dear", "death", "debt", "decision", "deep", "degree", "delicate", "dependent", "design", "desire", "destruction", "detail", "development", "different", "digestion", "direction", "dirty", "discovery", "discussion", "disease", "disgust", "distance", "distribution", "division", "door", "doubt", "down", "drain", "drawer", "dress", "drink", "driving", "drop", "dust", "early", "earth", "east", "edge", "education", "effect", "elastic", "electric", "engine", "enough", "equal", "error", "even", "event", "ever", "every", "example", "exchange", "existence", "expansion", "experience", "expert", "face", "fact", "fall", "false", "family", "farm", "father", "fear", "feather", "feeble", "feeling", "female", "fertile", "fiction", "field", "fight", "finger", "fire", "first", "fish", "fixed", "flag", "flame", "flat", "flight", "floor", "flower", "fold", "food", "foolish", "foot", "force", "fork", "form", "forward", "fowl", "frame", "free", "frequent", "friend", "from", "front", "fruit", "full", "future", "garden", "general", "girl", "give", "glass", "glove", "goat", "gold", "good", "government", "grain", "grass", "great", "green", "grey", "grip", "group", "growth", "guide", "hair", "hammer", "hand", "hanging", "happy", "harbour", "hard", "harmony", "hate", "have", "head", "healthy", "hear", "hearing", "heart", "heat", "help", "high", "history", "hole", "hollow", "hook", "hope", "horn", "horse", "hospital", "hour", "house", "humour", "idea", "important", "impulse", "increase", "industry", "insect", "instrument", "insurance", "interest", "invention", "iron", "island", "jelly", "jewel", "join", "journey", "judge", "jump", "keep", "kettle", "kick", "kind", "kiss", "knee", "knife", "knot", "knowledge", "land", "language", "last", "late", "laugh", "lead", "leaf", "learning", "leather", "left", "letter", "level", "library", "lift", "light", "like", "limit", "line", "linen", "liquid", "list", "little", "living", "lock", "long", "look", "loose", "loss", "loud", "love", "machine", "make", "male", "manager", "mark", "market", "married", "mass", "match", "material", "meal", "measure", "meat", "medical", "meeting", "memory", "metal", "middle", "military", "milk", "mind", "mine", "minute", "mist", "mixed", "money", "monkey", "month", "moon", "morning", "mother", "motion", "mountain", "mouth", "move", "much", "muscle", "music", "nail", "name", "narrow", "nation", "natural", "near", "necessary", "neck", "need", "needle", "nerve", "news", "night", "noise", "normal", "north", "nose", "note", "number", "observation", "offer", "office", "only", "open", "operation", "opinion", "opposite", "orange", "order", "organization", "ornament", "other", "oven", "over", "owner", "page", "pain", "paint", "paper", "parallel", "parcel", "part", "past", "paste", "payment", "peace", "pencil", "person", "physical", "picture", "pipe", "place", "plane", "plant", "plate", "play", "please", "pleasure", "plough", "pocket", "point", "poison", "polish", "political", "poor", "porter", "position", "possible", "potato", "powder", "power", "present", "price", "print", "prison", "private", "probable", "process", "produce", "profit", "property", "prose", "protest", "public", "pull", "pump", "punishment", "purpose", "push", "quality", "question", "quick", "quiet", "quite", "rail", "rain", "range", "rate", "reaction", "reading", "ready", "reason", "receipt", "record", "regret", "regular", "relation", "religion", "representative", "request", "respect", "responsible", "rest", "reward", "rhythm", "rice", "right", "ring", "river", "road", "roll", "roof", "room", "root", "rough", "round", "rule", "safe", "sail", "salt", "same", "sand", "scale", "school", "science", "scissors", "screw", "seat", "second", "secret", "secretary", "seed", "seem", "selection", "self", "send", "sense", "separate", "serious", "servant", "shade", "shake", "shame", "sharp", "sheep", "shelf", "ship", "shirt", "shock", "shoe", "short", "shut", "side", "sign", "silk", "silver", "simple", "sister", "size", "skin", "skirt", "sleep", "slip", "slope", "slow", "small", "smash", "smell", "smile", "smoke", "smooth", "snake", "sneeze", "snow", "soap", "society", "sock", "soft", "solid", "some", "song", "sort", "sound", "soup", "south", "space", "spade", "special", "sponge", "spoon", "spring", "square", "stage", "stamp", "star", "start", "statement", "station", "steam", "steel", "stem", "step", "stick", "sticky", "stiff", "still", "stitch", "stocking", "stomach", "stone", "stop", "store", "story", "straight", "strange", "street", "stretch", "strong", "structure", "substance", "such", "sudden", "sugar", "suggestion", "summer", "support", "surprise", "sweet", "swim", "system", "table", "tail", "take", "talk", "tall", "taste", "teaching", "tendency", "test", "than", "that", "then", "theory", "there", "thick", "thin", "thing", "this", "thought", "thread", "throat", "through", "through", "thumb", "thunder", "ticket", "tight", "till", "time", "tired", "together", "tomorrow", "tongue", "tooth", "touch", "town", "trade", "train", "transport", "tray", "tree", "trick", "trouble", "trousers", "true", "turn", "twist", "umbrella", "under", "unit", "value", "verse", "very", "vessel", "view", "violent", "voice", "waiting", "walk", "wall", "warm", "wash", "waste", "watch", "water", "wave", "weather", "week", "weight", "well", "west", "wheel", "when", "where", "while", "whip", "whistle", "white", "wide", "will", "wind", "window", "wine", "wing", "winter", "wire", "wise", "with", "woman", "wood", "wool", "word", "work", "worm", "wound", "writing", "wrong", "year", "yellow", "yesterday", "young"]
//now my code starts
func playTheGame() {
//create a function to run
let targetWord: String = allTheWords.randomElement()! //I'm too tired to use something more elegant!
var targetWordArray: [String] = []
var whatToDisplay: [String] = []
var lettersGuessed: [String] = []
var counter: Int = 0
var guesses = 0
// set up some variables, target word, something to display, an array to hold guesses and compare to the target, and a counter to keep track and end the game.
for _ in 1...targetWord.count {
whatToDisplay.append("?")
//creating an array of "?" to start.
}
for i in targetWord {
targetWordArray.append(String(i))
//creating an array to compare to the display so the game knows when you've won
}
//here is where the game really starts
while guesses < 6 && targetWordArray != whatToDisplay {
// The loop starts, as long as there are not too many guesses and the guesses to not equal the target
let userInput = readLine()
//user input
if let userInput = userInput {
lettersGuessed.append(userInput)
//add guess to array to compare to targetWord
for i in targetWord {
let stringI = String(i)
if lettersGuessed.contains(stringI) {
whatToDisplay[counter] = stringI
// wasItCorrect = "true"
//add correct guess to display at index of counter value
}
else {
whatToDisplay[counter] = "?"
// wasItCorrect = "false"
//show "?" in spaces where letter has not been guessed
}
counter += 1
//increment counter
}
print("The word is \(whatToDisplay)")
print("You have guessed: \(lettersGuessed)")
//
//Display
}
if let userInput = userInput {
if targetWordArray.contains(userInput) != true {
guesses += 1
//increment guesses only if guess is wrong
}
}
let guessesLeft = 6 - guesses
print("Number of guesses left: \(guessesLeft)")
//Increment guesses counter and show how many left
if guessesLeft == 5{
print(" - - - - -\n| |\n| O\n")
} else if guessesLeft == 4 {
print(" - - - - -\n| |\n| O\n| / |")
} else if guessesLeft == 3 {
print(" - - - - -\n| |\n| O\n| / | \\")
} else if guessesLeft == 2 {
print(" - - - - -\n| |\n| O\n| / | \\\n| |")
} else if guessesLeft == 1 {
print(" - - - - -\n| |\n| O\n| / | \\\n| |\n| /")
} else if guessesLeft == 0 {
print(" - - - - -\n| |\n| O\n| / | \\\n| |\n| / \\")
} //pictures
counter = 0
//reset array counter before next guess
}
if targetWordArray == whatToDisplay {
for _ in 1...100 {
print("*!*!*!*!")
}
print("You win!")
print(targetWordArray)
print("You had \(6 - guesses) guesses left. Do better next time. Your parents are ashamed of you.")
}
else {
print("You lose. The word was \(targetWordArray).")
}
}
//Greeting to start the game. Probably could have put this inside the other func, but by the time I got around to it, this was easier.
func doYouWantToPlay() {
print("Do you want to play Hangman? (y/n)")
let userInput = readLine()
if let userInput = userInput {
if userInput == "n" {
print("You lose")
}
else if userInput == "y" {
print("You are playing Hangman! Guess a letter.")
playTheGame()
}
else {
print("Does not compute")
}
}
print("Do you want to play again (y,n)?")
if userInput == "y" {
playTheGame()
//hmm, it takes "y" as the first guess ont he new game, how do I fix that?
} else {
print("It's been real.")
//hmm, even if they say no, the game restarts.
}
}
doYouWantToPlay()
//" - - - - -\n"+
//"| |\n"+
//"| O\n" +
//"| / | \\ \n"+
//"| |\n" +
//"| / \\ \n" +
//"|\n" +
//"|\n";
| [
-1
] |
ae66b057aa5777c8902d3d028bc93291ff7e1987 | bffd9a32d9fb54df207d7afb69ae833fd8032000 | /ProxyReminders/Support Files/AppDelegate.swift | 9d19f06e2ab1ce05e37dd510d57049d8c1365448 | [] | no_license | MaxiOSDev/ProxyReminders | 19d2c72e64903190b6e8a745cb07d6f33e959084 | 2dde7ed905e0d69da84bfe67f7f2d33c4689569a | refs/heads/master | 2021-09-13T05:35:59.845543 | 2018-04-25T14:33:03 | 2018-04-25T14:33:03 | 125,910,784 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,546 | swift | //
// AppDelegate.swift
// ProxyReminders
//
// Created by Max Ramirez on 3/19/18.
// Copyright © 2018 Max Ramirez. All rights reserved.
//
import UIKit
import CoreData
import CoreLocation
import UserNotifications
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
let manager = CLLocationManager()
let context = CoreDataStack().managedObjectContext
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
// Requesting Authorization for local notifications as soon as app finishes launching.
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { (granted, error) in
// proper handling here
}
UNUserNotificationCenter.current().delegate = self
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.
UNUserNotificationCenter.current().getPendingNotificationRequests { (notificationRequests) in
print("Notification Requests count when entering the background the app: \(notificationRequests)")
}
}
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.
UNUserNotificationCenter.current().getPendingNotificationRequests { (notificationRequests) in
print("Notification Requests count when entering the foreground : \(notificationRequests)")
}
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
// Saves changes in the application's managed object context before the application terminates.
UNUserNotificationCenter.current().getPendingNotificationRequests { (notificationRequests) in
print("Notification Requests count when terminating the app: \(notificationRequests)")
}
self.saveContext()
}
// MARK: - Core Data stack
lazy var persistentContainer: NSPersistentContainer = {
/*
The persistent container for the application. This implementation
creates and returns a container, having loaded the store for the
application to it. This property is optional since there are legitimate
error conditions that could cause the creation of the store to fail.
*/
let container = NSPersistentContainer(name: "ProxyReminders")
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
/*
Typical reasons for an error here include:
* The parent directory does not exist, cannot be created, or disallows writing.
* The persistent store is not accessible, due to permissions or data protection when the device is locked.
* The device is out of space.
* The store could not be migrated to the current model version.
Check the error message to determine what the actual problem was.
*/
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
return container
}()
// MARK: - Core Data Saving support
func saveContext () {
let context = persistentContainer.viewContext
if context.hasChanges {
do {
try context.save()
} catch {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
}
}
}
extension AppDelegate: UNUserNotificationCenterDelegate {
// Delegate Notifation Methods.
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
completionHandler([.alert, .sound])
}
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
if response.actionIdentifier == UNNotificationDismissActionIdentifier {
} else if response.actionIdentifier == UNNotificationDefaultActionIdentifier {
UIApplication.shared.applicationIconBadgeNumber = 0
}
}
}
| [
320008,
313360,
288275,
290326,
322080,
306721,
229411,
296483,
322083,
306726,
309287,
292907,
217132,
316465,
288306,
322102,
322109,
286783,
313409,
349765,
320582,
288329,
196177,
344661,
287323,
300124,
212571,
322666,
310378,
296043,
152685,
311914,
307310,
292466,
307315,
314995,
314487,
314491,
318599,
311444,
311449,
300194,
298662,
286896,
300208,
286389,
294070,
125111,
309439,
235200,
284352,
296641,
242371,
302787,
284360,
321228,
182486,
189654,
320730,
241371,
179420,
311516,
322272,
317665,
298210,
311525,
229098,
307436,
125167,
286455,
322299,
319228,
302332,
184576,
309505,
241410,
366339,
309509,
318728,
125194,
234763,
321806,
125201,
296218,
326434,
295716,
313125,
289577,
317233,
241971,
201530,
287038,
292159,
234828,
292172,
379218,
321364,
230748,
294238,
293741,
316788,
292212,
244598,
196988,
124796,
317821,
313215,
305022,
314241,
325509,
293767,
316300,
306576,
322448,
308114,
319900,
298910,
313250,
308132,
324015,
200625,
324017,
300979,
296888,
300987,
319932,
292288,
323520,
312772,
298950,
289744,
310740,
235994,
315359,
240098,
323555,
326640,
203761,
320498,
314357,
288246,
300540,
310782
] |
43ef4122f661d693026fd4f73dda1e96a8a396ad | f9f78c897174598f7f58ded35c7c541c478a4043 | /src/main/ui/artist/search/ArtistSearchWireframe.swift | 86b5123cfc1a8ebd1df24ba6eaea0b1bf1d4a323 | [] | no_license | SDOSLabs/UnidadEditorialItunes | 6fcf68e621eaeda69ad0e1c7cc304db1eaa86991 | 3c617b141d551a363323361c8e8c662d80de9290 | refs/heads/master | 2020-06-04T07:14:43.075108 | 2019-06-14T10:10:50 | 2019-06-14T10:10:50 | 191,919,731 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 892 | swift | //
// ArtistSearchWireframe.swift
//
// Created by Rafael Fernandez Alvarez on 12/06/2019.
// Archivo creado usando la plantilla VIPER por SDOS http://www.sdos.es/
//
import UIKit
/*
Dependency register JSON
{
"dependencyName": "ArtistSearchWireframeActions",
"className": "ArtistSearchWireframe"
}
*/
protocol ArtistSearchWireframeActions: BaseWireframeActions {
func goToView(from navigationController: UINavigationController, artistBO: ArtistBO, albumsBO: [AlbumBO]?)
}
class ArtistSearchWireframe: BaseWireframe {
}
extension ArtistSearchWireframe: ArtistSearchWireframeActions {
func goToView(from navigationController: UINavigationController, artistBO: ArtistBO, albumsBO: [AlbumBO]?) {
navigationController.pushViewController(Dependency.injector.resolveArtistAlbumsViewActions(artistBO: artistBO, albumsBO: albumsBO), animated: true)
}
}
| [
-1
] |
99455fd1ea1310bb415cee4bf15317b37bbdad62 | 41be34b73bfe34a66ea88d3f46f032ad98f9115e | /99BalloonsTests/_9BalloonsTests.swift | fa227197a80cc35d22a303e3b68cbb31eba2ef3e | [] | no_license | xaksis/balloons | 22073f2da5178decc9dc8eb5936adfec1bbefecf | 56b59e6741685174452d7ce2fede74c0d090ecd0 | refs/heads/master | 2016-08-03T14:34:17.046602 | 2014-11-15T19:10:37 | 2014-11-15T19:10:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 911 | swift | //
// _9BalloonsTests.swift
// 99BalloonsTests
//
// Created by Akshay Anand on 11/15/14.
// Copyright (c) 2014 CrayonBytes. All rights reserved.
//
import UIKit
import XCTest
class _9BalloonsTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
XCTAssert(true, "Pass")
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
// Put the code you want to measure the time of here.
}
}
}
| [
295953,
223767,
277017,
278056,
278060,
276533,
277049,
230463,
159807,
301634,
280649,
277066,
276050,
223318,
278618,
147036,
370271,
277603,
276581,
234603,
295535,
276592,
275571,
234612,
276084,
398457,
141450,
311435,
312972,
133774,
276627,
277141,
276631,
278170,
280220,
164512,
276129,
277665,
227492,
275628,
166580,
296628,
199366,
278214,
276687,
277204,
203477,
203478,
119513,
363744,
419569,
168188,
278285,
276753,
276760,
369432,
278810,
105246,
259363,
277289,
165677,
262450,
277814,
276792,
162621,
278856,
276813,
277838,
277327,
234323,
277339,
276318,
297822,
142689,
297826,
281962,
279919,
226170,
142716,
280961,
277890,
226694,
277900,
234381,
226189,
230799,
40850,
206228,
40853,
247712,
277410,
276394,
370091,
226222,
276401,
226227,
277939,
277943,
296375,
277435,
287677,
277952,
296387,
277957,
276422,
111056,
275410,
277988,
296425
] |
0da7826e99cae4ef91b3a497674efec5478efe8b | 1b79b14c8cc015ea8e5239b9c9d3891cb73f8a65 | /IndiaSwift/IndiaSwift/ViewController.swift | a71ebb200a4d9f1a31af4252350b9f1cf7282a1d | [] | no_license | udaybabuK/R-D | 0139f7a2edacff5cf2077e4c0312b59890dd2295 | f73a863080c05b41890f0121725d8ee0eb1515e0 | refs/heads/master | 2020-03-22T18:22:00.849781 | 2018-07-10T15:18:14 | 2018-07-10T15:18:14 | 140,455,128 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 8,950 | swift | //
// ViewController.swift
// IndiaSwift
//
// Created by Orient Technologies Mac on 6/5/18.
// Copyright © 2018 Orient. All rights reserved.
//
import UIKit
import MBProgressHUD
class ViewController: UIHelper,UITextFieldDelegate,UIAlertViewDelegate {
@IBOutlet weak var txtPassword: UITextField!
@IBOutlet weak var txtUserId: UITextField!
var CurrentTextfield = UITextField()
override func viewDidLoad() {
super.viewDidLoad()
let strUUID:String = CastUUID.sharedInstance.getUUID()
print("UUID IS :\(strUUID)")
self.txtUserId.delegate = self
self.txtPassword.delegate = self
NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillShow(sender:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillHide(sender:)), name: NSNotification.Name.UIKeyboardWillHide, object: nil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated);
self.navigationController?.isNavigationBarHidden = true
}
func keyboardWillShow(sender: NSNotification) {
self.view.frame.origin.y = -150 // Move view 150 points upward
}
func keyboardWillHide(sender: NSNotification) {
self.view.frame.origin.y = 0 // Move view to original position
}
public func textFieldDidBeginEditing(_ textField: UITextField){
CurrentTextfield = textField
}
public func textFieldShouldReturn(_ textField: UITextField) -> Bool{
textField.resignFirstResponder()
return true
}
@IBAction func btnLogin(_ sender: Any) {
let spinnerActivity = MBProgressHUD.showAdded(to: self.view, animated: true);
spinnerActivity.label.text = "Loading";
spinnerActivity.detailsLabel.text = "Please Wait!!";
spinnerActivity.isUserInteractionEnabled = false;
DispatchQueue.global(qos: .userInitiated).async {
self.CurrentTextfield.resignFirstResponder()
self.LoadData()
// Bounce back to the main thread to update the UI
DispatchQueue.main.async {
spinnerActivity.hide(animated: true);
}
}
}
func LoadData() -> Void {
if (self.txtUserId.text?.characters.count)!>0 && (self.txtPassword.text?.characters.count)!>0 {
if(self.isInternetAvailable()){
Helper.sharedInstance.getData(Constants.Url,JsonHelper.sharedInstance.getDictionarytoStringlogin(Dict:JsonHelper.sharedInstance.loginCallsJson(callName: "login",userId: txtUserId.text! as String,password: txtPassword.text! as String)), completion: {
resultData in
//spinner running code
/*
let spinnerActivity = MBProgressHUD.showAdded(to: self.view, animated: true);
spinnerActivity.hide(animated: false)
spinnerActivity.label.text = "Loading";
spinnerActivity.detailsLabel.text = "Please Wait!!";
spinnerActivity.isUserInteractionEnabled = false;
*/
//responceCode
var jsonData = JSON(data:resultData)
let str = String.init(data: resultData, encoding: .utf8)
let dict = JsonHelper.sharedInstance.convertStringToDictionary(text: str!)
print("Response:\(dict)")
if( Helper.sharedInstance.nullToNil(value: jsonData[Constants.ResponseCode] as AnyObject?) != nil ){
// self.txtUserId.text = nil
// self.txtPassword.text = nil
if String(describing: jsonData[Constants.ResponseCode]) == Constants.LoginSuccessRespCode {
let isDeleted:Bool = ModelManager.getInstance().deleteTabeldata(tableName:Constants.tblName_LoginResponce)
if isDeleted {
print("tblName_LoginResponce deleted successfully!")
}
self.insertLoginData(ResponseLoginDict:dict!)
self.callsToDo()
}else{
self.globalAlertView(message:String(describing: jsonData[Constants.Message]) )
}
}else{
self.globalAlertView(message:"Server not available")
}
DispatchQueue.main.async(execute: {
//stopSpin
// spinnerActivity.hide(animated: true);
})
})
}else{
self.globalAlertView(message:"Network not available")
}
}
else
{
self.globalAlertView(message:"Please enter valid Account Id, Login Id and Password")
}
}
func insertLoginData(ResponseLoginDict:Dictionary<String,Any>) -> Void {
let userIdStr:String = txtUserId.text! as String
let passworStr:String = txtPassword.text! as String
print(passworStr)
//login Credentials.
let login:Login=Login()
login.cId = "1"
login.ptn = userIdStr
login.passwd = passworStr
ModelManager.getInstance().InsertLogincredits(login)
//login Response.
let loginResponse:LoginResponse=LoginResponse()
let yourStringVar = NSArray(array:ResponseLoginDict["callToDo"] as! Array).componentsJoined(by: ",")
var stringArray = Array<String>()
stringArray = [yourStringVar]
let string = stringArray.joined(separator: " ")
loginResponse.callToDo = string
loginResponse.uName = ResponseLoginDict["uName"] as! String
loginResponse.empNo = ResponseLoginDict["empNo"] as! String
loginResponse.uId = (Helper.sharedInstance.convertAnyToString(value: ResponseLoginDict["uId"] as Any))
loginResponse.cId = (Helper.sharedInstance.convertAnyToString(value: ResponseLoginDict["cId"] as Any ))
loginResponse.SFA = (Helper.sharedInstance.convertAnyToString(value: ResponseLoginDict["SFA"] as Any ))
loginResponse.sessionId = (Helper.sharedInstance.convertAnyToString(value: ResponseLoginDict["sessionId"] as Any ))
ModelManager.getInstance().InsertLoginresponse(loginResponse)
//stored in Defaults
Helper.sharedInstance.setUserDefaults(value: "1", key: "accountId")
Helper.sharedInstance.setUserDefaults(value:userIdStr, key: "loginId")
Helper.sharedInstance.setUserDefaults(value:passworStr, key: "password")
Helper.sharedInstance.setUserDefaults(value:ResponseLoginDict["uName"] as! String, key: "uName")
Helper.sharedInstance.setUserDefaults(value:Helper.sharedInstance.convertAnyToString(value: ResponseLoginDict["sessionId"] as Any), key: "sessionId")
Helper.sharedInstance.setUserDefaults(value:Helper.sharedInstance.convertAnyToString(value: ResponseLoginDict["uId"] as Any), key: "uId")
Helper.sharedInstance.setUserDefaults(value:Helper.sharedInstance.convertAnyToString(value: ResponseLoginDict["cId"] as Any), key: "cId")
Helper.sharedInstance.setUserDefaults(value:Helper.sharedInstance.convertAnyToString(value: ResponseLoginDict["empNo"] as Any), key: "empNo")
Helper.sharedInstance.setUserDefaults(value:Helper.sharedInstance.convertAnyToString(value: ResponseLoginDict["SFA"] as Any ), key: "SFA")
}
func callsToDo() -> Void {
let callsToDoList = ["settingsGet","icSalesAppList"]
for calls in callsToDoList {
let aStr = String(format:calls )
Helper.sharedInstance.getData(Constants.Url,JsonHelper.sharedInstance.getDictionarytoStringlogin(Dict:JsonHelper.sharedInstance.getCallsToDoJson(callName: aStr)), completion: {
resultData in
// let jsonData = JSON(data:resultData)
let str = String.init(data: resultData, encoding: .utf8)
let dict:Dictionary = JsonHelper.sharedInstance.convertStringToDictionary(text: str!)!
print("Response:\(dict)")
Helper.sharedInstance.inserServiceDetai(Data:dict)
DispatchQueue.main.async(execute: {
})
})
}
}
}
| [
-1
] |
c73d923de9346374223384a38ba8e37c769e7c54 | 5d9c188abeceac0d0ca926534ae4447c75af6483 | /BreakpointApp_Firebase/Controller/FeedVC.swift | 9f3eadafaca6572e13c032953d9edbc53f2c7f2c | [] | no_license | boyvui821/BreakpointApp_Firebase | c9f24dffd0f43739296f118e5096f81c01859297 | ee6bd6d304b7fa0007c634694ff6b97dc2edf70c | refs/heads/master | 2020-03-17T10:09:13.470536 | 2018-05-15T11:18:44 | 2018-05-15T11:18:44 | 133,502,176 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,687 | swift | //
// FeedVC.swift
// BreakpointApp_Firebase
//
// Created by Nguyen Hieu Trung on 5/10/18.
// Copyright © 2018 NHTSOFT. All rights reserved.
//
import UIKit
class FeedVC: UIViewController {
@IBOutlet weak var tableFeed: UITableView!
var arrayFeed = [Message]();
override func viewDidLoad() {
super.viewDidLoad()
self.tableFeed.delegate = self;
self.tableFeed.dataSource = self;
// Do any additional setup after loading the view.
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated);
DataService.instant.getAllFeedMessage { (message) in
self.arrayFeed = message;
self.tableFeed.reloadData();
}
}
}
extension FeedVC:UITableViewDelegate, UITableViewDataSource{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arrayFeed.count;
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
print("ARRAYFEED: \(self.arrayFeed.count)");
guard let cell = tableView.dequeueReusableCell(withIdentifier: "FeedReuseCell", for: indexPath) as? FeedCell else{return UITableViewCell()};
let msgFeed = self.arrayFeed[indexPath.row];
print("ARRAYFEED: \(msgFeed.content)");
let image = UIImage(named: "defaultProfileImage");
DataService.instant.getUserName(forUID: msgFeed.senderID) { (userName) in
cell.configCell(image: image!, email: userName, message: msgFeed.content);
}
return cell;
}
}
| [
-1
] |
11a6d77b0ab57c7230ddd1640661534dd7a2dcf0 | 6138151963cc823f26154b456a32cce9577501d4 | /LogBook/LogBook/ViewController.swift | b5fb226aa6ae1a53cd29bad836c7cfdb45a83536 | [] | no_license | david-barnes/Sr-Project | 7cfe2b58f79bb767c6b03cad48419707cdbd9dc5 | 489f088db9c3e1b7465680f43d35dc4d1dfb287d | refs/heads/master | 2021-09-23T07:13:48.402209 | 2018-09-20T21:50:00 | 2018-09-20T21:50:00 | 105,708,079 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 9,573 | swift | //
// ViewController.swift
// LogBook
//
// Created by David Barnes on 11/26/17.
// Copyright © 2017 David Barnes. All rights reserved.
//
import Cocoa
import SQLite
class ViewController: NSViewController {
let DispatchName = Expression<String>("DispatchName")
let DriverName = Expression<String>("DriverName")
let MileID = Expression<Int64>("MileID")
let Miles = Expression<Double>("Miles")
let DeadHead = Expression<Double>("DeadHead")
let TotalMiles = Expression<Double>("TotalMiles")
let Standby = Expression<Double>("Standby")
let JobID = Expression<Int64>("JobID")
let JobNum = Expression<String>("JobNum")
let NoteID = Expression<Int64>("NoteID")
let Notes = Expression<String>("Notes")
let PaidID = Expression<Int64>("PaidID")
let BeenPaid = Expression<String>("BeenPaid")
let MileRate = Expression<Double>("MileRate")
let StandbyRate = Expression<Double>("StandbyRate")
let DeadHeadRate = Expression<Double>("DeadHeadRate")
let TotalOwed = Expression<Double>("TotalOwed")
let CheckAmount = Expression<Double>("CheckAmount")
let RouteID = Expression<Int64>("RouteID")
let Start = Expression<String>("Start")
let End = Expression<String>("End")
let TruckCoName = Expression<String>("TruckCoName")
let TruckID = Expression<String>("TruckID")
let DateFrom = Expression<String>("DateFrom")
let DateTo = Expression<String>("DateTo")
let Dispatch = Table("Dispatch")
let Driver = Table("Driver")
let Mileage = Table("Mileage")
let Notations = Table("Notations")
let Paid = Table("Paid")
let Route = Table("Route")
let TruckCo = Table("TruckCo")
let Job = Table("Job")
@IBOutlet var JobIDField: NSTextField!
@IBOutlet var tableView: NSTableView!
@IBOutlet var SetYearField: NSTextField!
var tableViewData = [Dictionary<String,String>]()
var year = ""
let path = NSSearchPathForDirectoriesInDomains(
.applicationSupportDirectory, .userDomainMask, true
).first! + "/" + Bundle.main.bundleIdentifier!
override func viewDidLoad(){
super.viewDidLoad()
self.tableView.delegate = self
self.tableView.dataSource = self
self.tableView.reloadData()
getCurrentDate()
}
func getCurrentDate(){
let formatter = DateFormatter()
formatter.dateFormat = "yyyy"
year = formatter.string(from: Date())
}
@IBAction func showAllButtonClicked(_ sender: Any) {
if SetYearField.stringValue != "" {year = SetYearField.stringValue}
do {
year += "%"
let db = try Connection("\(path)/LogData.db")
let query = Job.join(Mileage, on: Job[JobID] == Mileage[MileID])
.join(Paid, on: Job[JobID] == Paid[PaidID])
.join(Route, on: Job[JobID] == Route[RouteID])
.join(Notations, on:Job[JobID] == Notations[NoteID])
.filter(DateFrom.like(year))
var dbData = [Dictionary<String,String>]()
for job in try db.prepare(query) {
dbData.append(["JobID" : "\(job[JobID])", "BeenPaid" : "\(job[BeenPaid])", "Job#" : "\(job[JobNum])", "Dispatcher" : "\(job[DispatchName])", "DateFrom" : "\(job[DateFrom].toDateString(inputDateFormat: "yyyy-MM-dd", outputDateFormat: "MMMM/d/yyyy"))", "DateTo" : "\(job[DateTo].toDateString(inputDateFormat: "yyyy-MM-dd", outputDateFormat: "MMMM/d/yyyy"))", "TruckCo" : "\(job[TruckCoName])" , "TruckID" : "\(job[TruckID])", "Driver" : "\(job[DriverName])", "Start" : "\(job[Start])", "End" : "\(job[End])", "Miles" : "\(job[Miles])", "TotalMiles" : "\(job[TotalMiles])", "TotalOwed" : "\(job[TotalOwed])", "CheckAmount" : "\(job[CheckAmount])", "Notes" : "\(job[Notes])"])
}
tableViewData = dbData
self.tableView.reloadData()
} catch {
print("\(error)")
}
}
override func prepare(for segue: NSStoryboardSegue, sender: Any?) {
if segue.identifier!.rawValue == "updateView" {
let updateJobViewController = segue.destinationController as! UpdateViewController
updateJobViewController.jobNumber = Int64(JobIDField.stringValue)!
do {
let db = try Connection("\(path)/LogData.db")
let query = Job.join(Mileage, on: Job[JobID] == Mileage[MileID])
.join(Paid, on: Job[JobID] == Paid[PaidID])
.join(Route, on: Job[JobID] == Route[RouteID])
.join(Notations, on:Job[JobID] == Notations[NoteID])
.filter(Job[JobID] == Int64(JobIDField.stringValue)!)
for job in try db.prepare(query) {
updateJobViewController.beenPaid = "\(job[BeenPaid])"
updateJobViewController.checkAmount = "\(job[CheckAmount])"
updateJobViewController.jobNum = "\(job[JobNum])"
updateJobViewController.dispatcherName = "\(job[DispatchName])"
updateJobViewController.dateFrom = "\(job[DateFrom].toDateString(inputDateFormat: "yyyy-MM-dd", outputDateFormat: "MMMM/d/yyyy"))"
updateJobViewController.dateTo = "\(job[DateTo].toDateString(inputDateFormat: "yyyy-MM-dd", outputDateFormat: "MMMM/d/yyyy"))"
updateJobViewController.truckCo = "\(job[TruckCoName])"
updateJobViewController.truckNum = "\(job[TruckID])"
updateJobViewController.driverName = "\(job[DriverName])"
updateJobViewController.startingLocation = "\(job[Start])"
updateJobViewController.endingLocation = "\(job[End])"
updateJobViewController.rate = "\(job[MileRate])"
updateJobViewController.miles = "\(job[Miles])"
updateJobViewController.deadHeadRate = "\(job[DeadHeadRate])"
updateJobViewController.deadHeadMiles = "\(job[DeadHead])"
updateJobViewController.standbyRate = "\(job[StandbyRate])"
updateJobViewController.hours = "\(job[Standby])"
updateJobViewController.notes = "\(job[Notes])"
}
} catch {
print("\(error)")
}
}
}
@IBAction func updateJobButtonClicked(_ sender: Any) {
}
@IBAction func addJobButtonClicked(_ sender: Any) {
}
@IBAction func createReportButtonClicked(_ sender: Any) {
let fileName = "Summary Report " + SetYearField.stringValue + ".csv"
//let fileManager = FileManager.default
if let filePath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first {
do {
//let filePath = try fileManager.url(for: .documentDirectory, in: .allDomainsMask, appropriateFor: nil, create: false)
let fileURL = filePath.appendingPathComponent(fileName)
//let file = try FileHandle(forWritingTo: fileURL)
//defer { file.closeFile() }
let db = try Connection("\(path)/LogData.db")
let query = Job.join(Mileage, on: Job[JobID] == Mileage[MileID])
.join(Paid, on: Job[JobID] == Paid[PaidID])
.filter(BeenPaid == "yes")
.filter(DateFrom.like(SetYearField.stringValue + "%"))
.order(DispatchName, DateFrom)
var contents = "Dispatcher, DateFrom, DateTo, Total Miles, Check Amount\n"
//file.write(Headers.data(using: .utf8)!)
for job in try db.prepare(query) {
contents += "\(job[DispatchName]), \(job[DateFrom]), \(job[DateTo]), \(job[TotalMiles]), \(job[CheckAmount])\n"
}
try contents.write(to:fileURL, atomically: false, encoding: .utf8)
}catch{
print("\(error)")
}
}
}
}
extension ViewController:NSTableViewDataSource{
func numberOfRows(in tableView: NSTableView) -> Int {
return tableViewData.count
}
}
extension ViewController: NSTableViewDelegate{
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
var result:NSTableCellView
result = tableView.makeView(withIdentifier: (tableColumn?.identifier)!, owner: self) as! NSTableCellView
result.textField?.stringValue = tableViewData[row][(tableColumn?.identifier.rawValue)!]!
return result
}
}
extension String
{
func toDateString(inputDateFormat inputFormat : String, outputDateFormat outputFormat : String) -> String
{
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = inputFormat
let date = dateFormatter.date(from: self)
dateFormatter.dateFormat = outputFormat
return dateFormatter.string(from: date!)
}
func capitalizingFirstLetter() -> String {
return prefix(1).uppercased() + dropFirst()
}
mutating func capitalizeFirstLetter() {
self = self.capitalizingFirstLetter()
}
}
| [
-1
] |
0f9c6685b1edb9934351cf7904dcabb322d6c507 | 81395b8cd6c40cea53f2674097851360c24be625 | /Toy/DetailViewController.swift | 1309adf57a34ade0488ff24661abcd0a62d1b9bc | [] | no_license | CarltonS13/appDeviOS | 1981d771e155a0a700fc28ca2b5d2840a388cc38 | 79860c660fffeb2dbfcc3154d2ef1663b13d692a | refs/heads/master | 2020-03-30T07:02:04.042735 | 2018-11-26T22:35:56 | 2018-11-26T22:35:56 | 150,909,904 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,131 | swift | //
// DetailViewController.swift
// Toy
//
// Created by Carlton Segbefia on 10/6/18.
// Copyright © 2018 Carlton Segbefia. All rights reserved.
//
import UIKit
class DetailViewController: UIViewController {
var name : String! = ""
var population : String! = ""
var department : String! = ""
var image : UIImage!
@IBOutlet weak var ImageView: UIImageView!
@IBOutlet weak var NameLabel: UILabel!
@IBOutlet weak var PopulationLabel: UILabel!
@IBOutlet weak var DepartmentLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
NameLabel.text = name
PopulationLabel.text = population
DepartmentLabel.text = department
ImageView.image = image
}
/*
// 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
] |
9fc999aee3be413916d9483e0e1aefa63c3c4b3c | 867233ac397527c7898863ec41e5b4f2c1fe1a3b | /HelloRxSwift/ViewController.swift | 6ad732ba684ea39cd20320f7b8d4859095f3f1ad | [] | no_license | Brun41v35/HelloRxSwift | 14ad84c339c4457dc77c560429608288d89eade7 | 91896d247fbe1c2df945032850bb51d5f6fef9ae | refs/heads/main | 2023-03-15T09:34:52.603165 | 2021-03-13T02:10:25 | 2021-03-13T02:10:25 | 347,249,397 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 586 | swift | //
// ViewController.swift
// HelloRxSwift
//
// Created by Bruno Silva on 12/03/21.
//
import UIKit
import RxSwift
import RxCocoa
class ViewController: UIViewController {
//MARK: - Outlets
@IBOutlet weak var slider: UISlider!
@IBOutlet weak var label: UILabel!
//MARK: - Variaveis
let disposeBag = DisposeBag()
//MARK: - LifeCycle
override func viewDidLoad() {
super.viewDidLoad()
self.slider.rx.value.subscribe(onNext: { myValue in
self.label.text = "\(myValue)"
}).disposed(by: disposeBag)
}
}
| [
-1
] |
6f51ec09e19273a7806de65ef3ae74a5a785e4fd | 7351e1c8a591b2beab11384e4f5daec63e67dfee | /NewsApiFeed/ArticlesList/ArticlesListViewController.swift | a7a69cafdf69eef577f02b0c06e233e662c4bef6 | [
"MIT"
] | permissive | Kirya333/NewsApiFeed | 9c95051ca853251896378b8ecad8d3b69edc8d76 | 1770468812c412b5f217d90b22ce6ab2dc645c13 | refs/heads/main | 2023-08-27T20:19:07.245992 | 2021-11-05T19:53:12 | 2021-11-05T19:53:12 | 425,067,382 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 5,132 | swift | //
// ArticlesListViewController.swift
// NewsApiFeed
//
// Created by Кирилл Тарасов on 05.11.2021.
//
import RIBs
import RxSwift
import UIKit
import SnapKit
protocol ArticlesListPresentableListener: AnyObject {
func didRefresh()
func didSelectArticle(at indexPath: IndexPath)
}
final class ArticlesListViewController: UIViewController, ArticlesListPresentable, ArticlesListViewControllable {
var viewModel: ArticlesListViewModel!
weak var listener: ArticlesListPresentableListener?
private lazy var tableView: UITableView = {
let tableView = UITableView(frame: .zero)
tableView.showsVerticalScrollIndicator = false
tableView.showsHorizontalScrollIndicator = false
tableView.rowHeight = 80
tableView.dataSource = self
tableView.delegate = self
tableView.backgroundColor = .white
tableView.tableFooterView = UIView()
tableView.register(ArticleItemCell.self, forCellReuseIdentifier: ArticleItemCell.description())
tableView.refreshControl = refreshControl
return tableView
}()
private let activityIndicator: UIActivityIndicatorView = {
let aiView = UIActivityIndicatorView(style: .gray)
aiView.hidesWhenStopped = true
return aiView
}()
private lazy var refreshControl: UIRefreshControl = {
let refresh = UIRefreshControl()
refresh.addTarget(self, action: #selector(didPullRefresh(_:)), for: .valueChanged)
return refresh
}()
init() {
super.init(nibName: nil, bundle: nil)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: - VC Lifecycle
override func viewDidLoad() {
super.viewDidLoad()
title = "TableView"
navigationItem.title = "New list"
setupView()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}
private func setupView() {
view.addSubview(tableView)
view.addSubview(activityIndicator)
tableView.snp.makeConstraints { maker in
maker.edges.equalTo(self.view)
}
activityIndicator.snp.makeConstraints { maker in
maker.center.equalTo(self.tableView)
}
}
@objc private func didPullRefresh(_ sender: UIRefreshControl) {
listener?.didRefresh()
}
// MARK: - ArticlesListPresentable
func showActivityIndicator() {
activityIndicator.startAnimating()
}
func hideActivityIndicator() {
DispatchQueue.main.async {
self.activityIndicator.stopAnimating()
if self.refreshControl.isRefreshing {
self.refreshControl.endRefreshing()
}
}
}
func showError(message: String) {
}
func reloadTableView() {
DispatchQueue.main.async {
self.tableView.reloadData()
}
}
// MARK: - ArticlesListViewControllable
func pushViewController(_ viewControllable: ViewControllable, animated: Bool) {
navigationController?.pushViewController(viewControllable.uiviewController, animated: animated)
}
}
// MARK: - UITableViewDataSource & UITableViewDelegate
extension ArticlesListViewController: UITableViewDataSource, UITableViewDelegate {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return viewModel?.numberOfItems() ?? 0
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: ArticleItemCell.description(), for: indexPath) as! ArticleItemCell
let article = viewModel.item(at: indexPath.row)
cell.textLabel?.text = article?.title
cell.detailTextLabel?.text = article?.publishedAt
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
listener?.didSelectArticle(at: indexPath)
tableView.deselectRow(at: indexPath, animated: true)
}
}
final class ArticleItemCell: UITableViewCell {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: .subtitle, reuseIdentifier: reuseIdentifier)
setupView()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
setupView()
}
private func setupView() {
backgroundColor = .white
textLabel?.font = UIFont.systemFont(ofSize: 20, weight: .medium)
detailTextLabel?.font = UIFont.systemFont(ofSize: 15, weight: .regular)
}
}
public extension UINavigationController {
func pushViewController(_ viewController: UIViewController, animated: Bool = true, completion: (() -> Void)? = nil) {
CATransaction.begin()
CATransaction.setCompletionBlock(completion)
pushViewController(viewController, animated: animated)
CATransaction.commit()
}
}
| [
-1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.